From 00bf17838b496e6fcfed2e521f9c27f8f0e3e3c7 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期一, 05 八月 2024 18:38:20 +0800
Subject: [PATCH] ‘’
---
wechat_staff/pages/productVideo/index.js | 98 +++++++++++++++++++++++++++++++++++++------------
1 files changed, 74 insertions(+), 24 deletions(-)
diff --git a/wechat_staff/pages/productVideo/index.js b/wechat_staff/pages/productVideo/index.js
index 22a8ed7..54ccde2 100644
--- a/wechat_staff/pages/productVideo/index.js
+++ b/wechat_staff/pages/productVideo/index.js
@@ -1,34 +1,92 @@
-// pages/consult/consult.js
+import { getZhongTaiVideoPage, actionDo, getCataLogTagList ,refreshEnjoy} from '../../api/index'
Page({
/**
* 椤甸潰鐨勫垵濮嬫暟鎹�
*/
data: {
- category: ['鏂板搧涓婂競', '涓撳埄璇佷功', '澶х墝鎺堟潈','鏂板搧涓婂競', '涓撳埄璇佷功', '澶х墝鎺堟潈'],
- secondCategory: ['绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�'],
- activeCate: '',
- seActiveCate: '',
- dataList: []
- },
+ category: [],
+ tagCodes: '',
+ acVid:'',
+ viewIdList: [],
- itemClick(e) {
- const { id } = e.target.dataset
- console.log(e.target.dataset);
- wx.navigateTo({
- url: '/pages/consult/detail',
+ dataList: [],
+ total: 0,
+ pageSize: 10,
+ pageNum: 1,
+
+ },
+ onReachBottom() {
+ console.log('瑙﹀簳浜嬩欢');
+ const { total, dataList, pageNum } = this.data
+ if(total > dataList.length){
+ this.setData({ pageNum: pageNum + 1 })
+ this.getList()
+ }else{
+ wx.showToast({
+ title: '鏆傛棤鏇村鏁版嵁',
+ icon: 'none'
+ })
+ }
+ },
+ getList() {
+ const { pageSize, pageNum, tagCodes } = this.data
+ getZhongTaiVideoPage({
+ pageSize,pageNum, tagCodes: tagCodes ? [tagCodes] : []
+ }).then(res => {
+ this.setData({
+ dataList: [...this.data.dataList, ...res.data.records],
+ total: res.data.total
+ })
})
},
+ getTagList() {
+ getCataLogTagList({
+ catalogCode: 'video_rec'
+ }).then(res => {
+ this.setData({ category: res.data })
+ })
+ },
+ itemClick(e) {
+ const { id } = e.currentTarget.dataset.item
+ const { dataList, acVid, viewIdList } = this.data
+ const index = viewIdList.findIndex(i => i === id)
+ if(acVid){
+ if(id != acVid){
+ wx.createVideoContext(acVid).pause()
+ wx.createVideoContext(id).play()
+ this.setData({ acVid: id })
+ }
+ }else{
+ this.setData({ acVid: id })
+ wx.createVideoContext(id).play()
+ }
+ dataList.forEach(ite => {
+ if(id === ite.id && index === -1){
+ ite.viewCount += 1
+ viewIdList.push(id)
+ actionDo({
+ actionType: 'view',
+ id: id
+ })
+ this.setData({ viewIdList })
+ }
+ })
+ this.setData({ dataList })
+ },
cateClick(e) {
- const { index } = e.target.dataset
- console.log(index);
+ const { code } = e.target.dataset
+ this.setData({ tagCodes: code })
+ this.setData({ total: 0, dataList: [], pageNum: 1 })
+ this.getList()
},
seCateClick(e) {
const { index } = e.target.dataset
console.log(index);
},
onLoad(options) {
-
+ this.getTagList()
+ this.getList()
},
/**
@@ -42,7 +100,7 @@
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
*/
onShow() {
-
+ refreshEnjoy(this)
},
/**
@@ -65,14 +123,6 @@
onPullDownRefresh() {
},
-
- /**
- * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
- */
- onReachBottom() {
-
- },
-
/**
* 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
*/
--
Gitblit v1.9.3