From 854a58f1043bff09d7b53a496ff30bd0fd440268 Mon Sep 17 00:00:00 2001 From: liuyongli <1598631486@qq.com> Date: Fri, 16 Sep 2022 18:09:24 +0800 Subject: [PATCH] no message --- pages/brandCrisis/crisisList/index.js | 248 ++++++++++++++---------- pages/brandCrisis/crisisList/index.wxml | 76 +++++--- pages/brandCrisis/index.js | 1 + pages/varComm/pages/brand/index.wxml | 2 +- project.private.config.json | 21 ++ 5 files changed, 217 insertions(+), 131 deletions(-) diff --git a/pages/brandCrisis/crisisList/index.js b/pages/brandCrisis/crisisList/index.js index 9a23d51..9763656 100644 --- a/pages/brandCrisis/crisisList/index.js +++ b/pages/brandCrisis/crisisList/index.js @@ -1,116 +1,152 @@ -import {doStr} from "../../../utils/doStr.js" +import { + doStr +} from "../../../utils/doStr.js" const app = getApp(); let iPageIndex = 1 // 当前第几页,0代表第一页 let iPageSize = 10 //每页显示多少数据 Page({ - data: { - active: 0, - brand: '', - list: [ - { - title: "高级危机", - val: 3 - }, - { - title: "中级危机", - val: 2 - }, - { - title: "低级危机", - val: 1 - } - ], - crisisList: [], - val: 3, - loadMore: false, //"上拉加载"的变量,默认false,隐藏 - loadAll: false, //“没有数据”的变量,默认false,隐藏 - }, - onLoad() { - wx.setNavigationBarTitle({ - title: '负面消息' + data: { + active: 0, + brand: '', + news: '', + Grade: '', + option: [{ + text: '全部消息', + value: '' + }, + { + text: '推送消息', + value: '推送消息' + } + ], + option1: [{ + text: '全部等级', + value: '' + }, + { + text: '低级危机', + value: 1 + }, + { + text: '中级危机', + value: 2 + }, + { + text: '高级危机', + value: 3 + }, + ], + crisisList: [], + val: '', + loadMore: false, //"上拉加载"的变量,默认false,隐藏 + loadAll: false, //“没有数据”的变量,默认false,隐藏 + }, + onLoad() { + wx.setNavigationBarTitle({ + title: '负面消息' + }) + let pages = getCurrentPages(); + let currentPage = pages[pages.length - 1] + let options = currentPage.options + this.setData({ + brand: options.brand + }) + iPageIndex = 1; + this.getData(3); + }, + onReachBottom: function () { + console.log("上拉触底事件") + let that = this + if (!that.data.loadMore) { + that.setData({ + loadMore: true, //加载中 + loadAll: false //是否加载完所有数据 + }); + //加载更多,这里做下延时加载 + that.getData(this.data.val); + } + }, + getData() { + let sTimeType = wx.getStorageSync("sTimeType") || 34; + let sStartTime = wx.getStorageSync("sStartTime") || ''; + let sEndTime = wx.getStorageSync("sEndTime") || ''; + let sCrisis = this.data.val; + console.log("123", this.data.val); + let obj = { + action: "getList", + sTimeType: sTimeType, + sStartTime: sStartTime, + sEndTime: sEndTime, + iPageIndex: iPageIndex, + iPageSize: iPageSize, + sType: "BrandData", + sCrisis: sCrisis, + sBrand: this.data.brand, + // sSeriesName: sSeriesName, + token: wx.getStorageSync('token') || 't%2BrswgjvzGM=' + } + app.globalData.request(obj).then(res => { + if (res && res.length > 0) { + iPageIndex++; + res.forEach(ele => { + // ele._source.affections=ele._source.affections + ele._source.title = doStr(ele._source.title, 70); + ele._source.content = doStr(ele._source.content, 200); }) - let pages = getCurrentPages(); - let currentPage = pages[pages.length - 1] - let options = currentPage.options + let arr = this.data.crisisList.concat(res); this.setData({ - brand: options.brand + crisisList: arr, + loadMore: false }) - iPageIndex = 1; - this.getData(3); - }, - onReachBottom: function () { - console.log("上拉触底事件") - let that = this - if (!that.data.loadMore) { - that.setData({ - loadMore: true, //加载中 - loadAll: false //是否加载完所有数据 - }); - //加载更多,这里做下延时加载 - that.getData(this.data.val); + if (res.length < iPageSize) { + this.setData({ + loadMore: false, //隐藏加载中。。 + loadAll: true //所有数据都加载完了 + }); } - }, - getData(val) { - let sTimeType = wx.getStorageSync("sTimeType") || 34; - let sStartTime = wx.getStorageSync("sStartTime") || ''; - let sEndTime = wx.getStorageSync("sEndTime") || ''; - let sCrisis = val; - let obj = { - action: "getList", - sTimeType: sTimeType, - sStartTime: sStartTime, - sEndTime: sEndTime, - iPageIndex: iPageIndex, - iPageSize: iPageSize, - sType: "BrandData", - sCrisis: sCrisis, - sBrand: this.data.brand, - // sSeriesName: sSeriesName, - token: wx.getStorageSync('token') || 't%2BrswgjvzGM=' - } - app.globalData.request(obj).then(res => { - if (res && res.length > 0) { - iPageIndex++; - res.forEach(ele => { - ele._source.title = doStr(ele._source.title, 70); - ele._source.content = doStr(ele._source.content, 200); - }) - let arr = this.data.crisisList.concat(res); - this.setData({ - crisisList: arr, - loadMore: false - }) - if (res.length < iPageSize) { - this.setData({ - loadMore: false, //隐藏加载中。。 - loadAll: true //所有数据都加载完了 - }); - } - } else { - this.setData({ - loadAll: true, //把“没有数据”设为true,显示 - loadMore: false //把"上拉加载"的变量设为false,隐藏 - }); - } - }) - }, - searchScrollLower() { - this.getData(this.data.val); - }, - handlerTap(e) { - let n = e.detail.index; - let val = this.data.list[n].val; - iPageIndex = 1; + } else { this.setData({ - val: val, - crisisList: [] - }) - this.getData(val); - }, - handlerDetail(e) { - let row = e.currentTarget.dataset.row; - wx.navigateTo({ - url: '/subPackages/pages/detail/index?id=' + row._id - }) - } + loadAll: true, //把“没有数据”设为true,显示 + loadMore: false //把"上拉加载"的变量设为false,隐藏 + }); + } + }) + }, + mySelect2(e) { + let { + detail + } = e + iPageIndex = 1 + iPageSize = 20 + this.setData({ + Grade: detail, + val: detail, + crisisList: [] + + }) + this.getData(); + }, + // 列表展示 + mySelect1(e) { + let { + detail + } = e + iPageIndex = 1 + iPageSize = 20 + this.setData({ + news: detail, + crisisList: [], + }) + this.getData() + }, + searchScrollLower() { + this.getData(this.data.val); + }, + + handlerDetail(e) { + let row = e.currentTarget.dataset.row; + wx.navigateTo({ + url: '/subPackages/pages/detail/index?id=' + row._id + }) + } }) \ No newline at end of file diff --git a/pages/brandCrisis/crisisList/index.wxml b/pages/brandCrisis/crisisList/index.wxml index c64004b..8b2b08b 100644 --- a/pages/brandCrisis/crisisList/index.wxml +++ b/pages/brandCrisis/crisisList/index.wxml @@ -1,26 +1,54 @@ - - - - - - - 高级危机 - 中级危机 - 低级危机 - {{it._source.firsttime}} - - - {{it._source.title}} - {{it._source.content}} - - - 查看详情 - - - - - - - + + + + + + + + + + + 高级危机 + 中级危机 + 低级危机 + {{it._source.firsttime}} + + + {{it._source.title}} + {{it._source.content}} + + + 查看详情 + + + + + + + + \ No newline at end of file diff --git a/pages/brandCrisis/index.js b/pages/brandCrisis/index.js index aeebf8c..3e61c23 100644 --- a/pages/brandCrisis/index.js +++ b/pages/brandCrisis/index.js @@ -232,6 +232,7 @@ Page({ }) }, handlerGoList() { + console.log('oked',this.data.headlBrand) wx.navigateTo({ url: '/pages/brandCrisis/crisisList/index?brand=' + this.data.headlBrand }) diff --git a/pages/varComm/pages/brand/index.wxml b/pages/varComm/pages/brand/index.wxml index e07167d..d21e929 100644 --- a/pages/varComm/pages/brand/index.wxml +++ b/pages/varComm/pages/brand/index.wxml @@ -31,7 +31,7 @@ - + diff --git a/project.private.config.json b/project.private.config.json index ce75484..299bd3f 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -35,6 +35,27 @@ "query": "", "launchMode": "default", "scene": null + }, + { + "name": "", + "pathName": "pages/brandCrisis/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/brandCrisis/crisisList/index", + "query": "brand=%E5%A5%87%E7%91%9E%E6%96%B0%E8%83%BD%E6%BA%90", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/varComm/index", + "query": "", + "launchMode": "default", + "scene": null } ] }