From 5b219a9694c8d69db42e746a654c779cc6a61bf6 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期四, 18 七月 2024 18:42:20 +0800
Subject: [PATCH] ‘’
---
wechat_jiaxuan/pages/consult/consult.js | 50 +++++++++++++++++++++++++++++++++-----------------
1 files changed, 33 insertions(+), 17 deletions(-)
diff --git a/wechat_jiaxuan/pages/consult/consult.js b/wechat_jiaxuan/pages/consult/consult.js
index 22a8ed7..52fb869 100644
--- a/wechat_jiaxuan/pages/consult/consult.js
+++ b/wechat_jiaxuan/pages/consult/consult.js
@@ -1,39 +1,55 @@
-// pages/consult/consult.js
+import { getZhongTaiProductNewsPage, getCatalogList } from '../../api/index'
Page({
/**
* 椤甸潰鐨勫垵濮嬫暟鎹�
*/
data: {
- category: ['鏂板搧涓婂競', '涓撳埄璇佷功', '澶х墝鎺堟潈','鏂板搧涓婂競', '涓撳埄璇佷功', '澶х墝鎺堟潈'],
+ category: [],
secondCategory: ['绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�'],
activeCate: '',
seActiveCate: '',
- dataList: []
- },
+ dataList: [],
+ total: 0,
+ pageNum: 1,
+ pageSize: 10,
+ },
+ onLoad(options) {
+ this.getCate()
+ this.getList()
+ },
+ getCate() {
+ getCatalogList({catalogCode: 'product_info'}).then(res => {
+ this.setData({ category: res.data })
+ })
+ },
itemClick(e) {
- const { id } = e.target.dataset
- console.log(e.target.dataset);
+ const { id } = e.currentTarget.dataset
wx.navigateTo({
- url: '/pages/consult/detail',
+ url: '/pages/consult/detail?id='+id,
+ })
+ },
+ getList() {
+ const { pageNum, pageSize, activeCate } = this.data
+ getZhongTaiProductNewsPage({
+ pageNum, pageSize, catalogCode: activeCate
+ }).then(res => {
+ if(res.data){
+ this.setData({ dataList: res.data.records,total: res.data.records.total })
+ }
+
})
},
cateClick(e) {
- const { index } = e.target.dataset
- console.log(index);
+ const { code } = e.currentTarget.dataset
+ this.setData({ activeCate: code })
+ this.getList()
},
seCateClick(e) {
- const { index } = e.target.dataset
+ const { index } = e.currentTarget.dataset
console.log(index);
},
- onLoad(options) {
-
- },
-
- /**
- * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
- */
onReady() {
},
--
Gitblit v1.9.3