From 73c3507d82c06066d592d626ccd1a9a0961e0c5f Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期五, 19 七月 2024 20:10:26 +0800
Subject: [PATCH] ''
---
wechat_jiaxuan/pages/consult/consult.js | 66 ++++++++++++++++++++++++++-------
1 files changed, 52 insertions(+), 14 deletions(-)
diff --git a/wechat_jiaxuan/pages/consult/consult.js b/wechat_jiaxuan/pages/consult/consult.js
index 52fb869..4b2b005 100644
--- a/wechat_jiaxuan/pages/consult/consult.js
+++ b/wechat_jiaxuan/pages/consult/consult.js
@@ -1,4 +1,4 @@
-import { getZhongTaiProductNewsPage, getCatalogList } from '../../api/index'
+import { getZhongTaiProductNewsPage, getCatalogList, getCataLogTagList } from '../../api/index'
Page({
/**
@@ -6,10 +6,11 @@
*/
data: {
category: [],
- secondCategory: ['绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�','绾у垎绫�'],
- activeCate: '',
- seActiveCate: '',
+ secondCategory: [],
+ catalogCode: '',
+ tagCode: '',
+ search: '',
dataList: [],
total: 0,
pageNum: 1,
@@ -17,23 +18,47 @@
},
onLoad(options) {
this.getCate()
- this.getList()
},
getCate() {
getCatalogList({catalogCode: 'product_info'}).then(res => {
this.setData({ category: res.data })
+ if(res.data && res.data.length > 0){
+ this.setData({catalogCode: res.data[0].code})
+ this.gettag()
+ this.getList()
+ }
+ })
+ },
+ gettag() {
+ const { catalogCode } = this.data
+ getCatalogList({
+ catalogCode
+ }).then(res => {
+ if(res.data && res.data.length > 0){
+ this.setData({ secondCategory: res.data })
+ }
})
},
itemClick(e) {
- const { id } = e.currentTarget.dataset
- wx.navigateTo({
- url: '/pages/consult/detail?id='+id,
- })
+ const item = e.currentTarget.dataset.item
+ if(item.contentType == 'link'){
+ wx.navigateTo({
+ url: '/pages/webView/index?link=' + item.content,
+ success: function(res) {
+ // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�
+ res.eventChannel.emit('acceptDataFromOpenerPage', { link: item.openContent, title: item.title })
+ }
+ })
+ }else{
+ wx.navigateTo({
+ url: '/pages/consult/detail?id='+item.id,
+ })
+ }
},
getList() {
- const { pageNum, pageSize, activeCate } = this.data
+ const { pageNum, pageSize, catalogCode, tagCode, search } = this.data
getZhongTaiProductNewsPage({
- pageNum, pageSize, catalogCode: activeCate
+ pageNum, pageSize, search, catalogCode: tagCode || catalogCode
}).then(res => {
if(res.data){
this.setData({ dataList: res.data.records,total: res.data.records.total })
@@ -43,13 +68,26 @@
},
cateClick(e) {
const { code } = e.currentTarget.dataset
- this.setData({ activeCate: code })
+ this.setData({ catalogCode: code,secondCategory: [], tagCode: '' })
+ this.gettag()
this.getList()
+ console.log('e', e.currentTarget.dataset);
+ console.log('catalogCode', this.data.catalogCode);
},
seCateClick(e) {
- const { index } = e.currentTarget.dataset
- console.log(index);
+ const { code } = e.currentTarget.dataset
+ if(this.data.tagCode == code){
+ this.setData({ tagCode: '' })
+ }else{
+ this.setData({ tagCode: code })
+ }
+ this.getList()
},
+ priviewFull(e){
+ const item = e.currentTarget.dataset.item
+ console.log('item', item);
+
+ },
onReady() {
},
--
Gitblit v1.9.3