123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- const pages = require('../../mixin/pages')
- const { getLunboList } = require('./api/index')
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- ...pages.data(),
- listUrl: '/api/user/video/list',
- searchForm: {
- 'key_words': '',
- 'type': '1' // 类型 1最新2播放最高
- },
- swiperActiveDot: 0,
- nav: [
- {
- name: '最新视频',
- value: '1'
- },
- {
- name: '播放最高',
- value: '2'
- }
- ],
- lunboList: []
- },
- ...pages.methods,
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- this.fetchLunboList()
- this.fetchOrderList()
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- if (this.data.freshing) {
- return
- }
- this.setData({
- freshing: true
- })
- this.bindCallBack()
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- this.fetchOrderList()
- },
- bindCallBack() {
- this.fetchLunboList()
- this.refreshOrderList()
- },
- handleSwiperChange(e) {
- const { current } = e.detail
- this.setData({
- swiperActiveDot: current
- })
- },
- handleNav(e) {
- const { value } = e.detail
- this.setData({
- 'searchForm.type': value
- }, () => {
- this.refreshOrderList()
- })
- },
- jumpMediaDetail(e) {
- const { item } = e.currentTarget.dataset
- wx.navigateTo({
- url: '/pages/mediaDetail/mediaDetail?videoConfig=' + JSON.stringify(item)
- })
- },
- async fetchLunboList() {
- try {
- const { status, data, msg } = await getLunboList()
- if (status) {
- this.setData({
- lunboList: data.list
- })
- } else {
- wx.showToast({
- title: msg,
- icon: 'none'
- })
- }
- } catch (err) {}
- }
- })
|