From a75b18a4157ab486e0b51c438ac165ab3a08e3e0 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期四, 25 七月 2024 18:10:00 +0800
Subject: [PATCH] 代码提交
---
wechat_jiaxuan/pages/homeId/index.js | 111 +++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 83 insertions(+), 28 deletions(-)
diff --git a/wechat_jiaxuan/pages/homeId/index.js b/wechat_jiaxuan/pages/homeId/index.js
index 22a8ed7..95ecff5 100644
--- a/wechat_jiaxuan/pages/homeId/index.js
+++ b/wechat_jiaxuan/pages/homeId/index.js
@@ -1,39 +1,97 @@
-// pages/consult/consult.js
+import { getCataLogTagList, pageZSZXContentList, actionDo } from '../../api/index'
Page({
/**
* 椤甸潰鐨勫垵濮嬫暟鎹�
*/
data: {
- category: ['鏂板搧涓婂競', '涓撳埄璇佷功', '澶х墝鎺堟潈','鏂板搧涓婂競', '涓撳埄璇佷功', '澶х墝鎺堟潈'],
- secondCategory: ['绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�'],
+ tagList: [],
activeCate: '',
- seActiveCate: '',
- dataList: []
- },
+ dataList: [],
+ total: 0,
+ pageNum: 1,
+ pageSize: 10,
- itemClick(e) {
- const { id } = e.target.dataset
- console.log(e.target.dataset);
- wx.navigateTo({
- url: '/pages/consult/detail',
- })
- },
- cateClick(e) {
- const { index } = e.target.dataset
- console.log(index);
- },
- seCateClick(e) {
- const { index } = e.target.dataset
- console.log(index);
+ code: '',
+ tagCodes: ''
},
onLoad(options) {
-
+ wx.setNavigationBarTitle({
+ title: options.name
+ })
+ this.setData({ code: options.code})
+ this.getTabList()
+ this.getList()
},
-
- /**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
- */
+ 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 { code, tagCodes, pageSize, pageNum } = this.data
+ pageZSZXContentList({
+ catalogCode: code,
+ tagCodes: tagCodes ? [tagCodes] : [],
+ pageSize,
+ pageNum
+ }).then(res => {
+ this.setData({
+ total: res.data.total,
+ dataList: [ ...this.data.dataList, ...res.data.records ]
+ })
+ })
+ },
+ itemClick(e) {
+ const item = e.currentTarget.dataset.item
+ console.log('item', item);
+ actionDo({actionType: 'view',id: item.id})
+ if(item.contentType == 'video'){
+ wx.previewMedia({
+ sources: [{ url: item.content, type: 'video' }]
+ })
+ }
+ if(item.contentType == 'link'){
+ wx.navigateTo({
+ url: '/pages/webView/index?link=' + item.content,
+ })
+ }
+ if(item.contentType == 'page'){
+ getApp().globalData.catalogCode=item.content
+ wx.switchTab({
+ url: '/pages/discover/discover'
+ })
+ }
+ },
+ cateClick(e) {
+ const { code } = e.target.dataset
+ this.setData({
+ tagCodes: code,
+ pageNum: 1,
+ dataList: []
+ })
+ this.getList()
+ },
+ getTabList() {
+ getCataLogTagList({
+ catalogCode: this.data.code
+ }).then(res => {
+ if(res && res.data && res.data.length > 0){
+ this.setData({
+ tagList: res.data[0].valueVos
+ })
+ }
+
+ })
+ },
onReady() {
},
@@ -69,9 +127,6 @@
/**
* 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
*/
- onReachBottom() {
-
- },
/**
* 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
--
Gitblit v1.9.3