From 383d2cdfdfd09bd4be7ca1d63003f68b8d620592 Mon Sep 17 00:00:00 2001 From: zx <604444282@qq.com> Date: Thu, 4 Aug 2022 17:48:58 +0800 Subject: [PATCH] zx --- components/indexCom/mediaChild/index.js | 2 +- components/timeCustom/index.js | 124 ++++++++++++++++++ components/timeCustom/index.json | 3 + components/timeCustom/index.wxml | 19 +++ components/timeCustom/index.wxss | 38 ++++++ pages/brandCrisis/index.js | 2 +- .../pages/brandInsight/TailInsight/index.js | 2 +- .../pages/brandInsight/totalReview/index.js | 2 +- .../pages/eventInsight/evTailwing/index.js | 2 +- .../pages/eventInsight/evTotal/index.js | 2 +- .../pages/modalInsight/TailInsight/index.js | 2 +- .../pages/modalInsight/totalReview/index.js | 2 +- 12 files changed, 192 insertions(+), 8 deletions(-) create mode 100644 components/timeCustom/index.js create mode 100644 components/timeCustom/index.json create mode 100644 components/timeCustom/index.wxml create mode 100644 components/timeCustom/index.wxss diff --git a/components/indexCom/mediaChild/index.js b/components/indexCom/mediaChild/index.js index 06791c1..c0ddb4a 100644 --- a/components/indexCom/mediaChild/index.js +++ b/components/indexCom/mediaChild/index.js @@ -26,7 +26,7 @@ Component({ duration: 300000 }) let obj = { - action: 'getWebsiteHome0528', + action: 'getHomeSourceTop', sType: 'Home', sTimeType: sTimeType, sStartTime: sStartTime, diff --git a/components/timeCustom/index.js b/components/timeCustom/index.js new file mode 100644 index 0000000..9c11ee2 --- /dev/null +++ b/components/timeCustom/index.js @@ -0,0 +1,124 @@ +import moment from "moment" +Component({ + data: { + timelist: ['二十四小时', '最近七天', '最近三十天', '自定义'], + valList: ['34', '3', '20', '4'], + sStartTime: '', + sEndTime: '', + sTimeType: '34', + intervalSel: 0, + show: false, + start: moment().format("YYYY-MM-DD HH:mm:ss"), + startTime: moment().valueOf(), + end: moment().format("YYYY-MM-DD HH:mm:ss"), + endTime: moment().valueOf(), + show1: false, + show2: false, + dt: '', + dt1: '', + showDialog: false + }, + lifetimes: { + attached() { + wx.setStorageSync('sTimeType', '34'); + wx.setStorageSync('sStartTime', ''); + wx.setStorageSync('sEndTime', ''); + } + }, + methods: { + priceSel(e){ + this.setData({ + intervalSel: e.currentTarget.dataset.index + }) + wx.setStorageSync('sTimeType', this.data.valList[this.data.intervalSel]); + let start = ""; + let end = ""; + if(this.data.intervalSel === 3) { + wx.setStorageSync('sStartTime', this.data.start); + wx.setStorageSync('sEndTime', this.data.end); + start = this.data.start; + end = this.data.end; + this.setData({ + show: true + }) + } else { + wx.setStorageSync('sStartTime', ''); + wx.setStorageSync('sEndTime', ''); + start = ''; + end = ''; + this.setData({ + show: false + }) + } + this.triggerEvent('change', {sTimeType: this.data.valList[this.data.intervalSel], sStartTime: start, sEndTime: end}) + }, + onDisplay() { + this.setData({ + show1: true + }); + }, + onDisplay1() { + this.setData({ + show2: true + }); + }, + onInput(event) { + let dt = moment(event.detail).format("YYYY-MM-DD HH:mm:ss"); + this.setData({ + dt: dt + }); + }, + onInput1(event) { + let dt = moment(event.detail).format("YYYY-MM-DD HH:mm:ss"); + this.setData({ + dt1: dt, + }); + }, + onConfirm() { + let isBefore = moment(this.data.dt).isBefore(this.data.dt1) + if(!isBefore) { + this.setData({ + showDialog: true, + }); + return + } + this.setData({ + show1: false, + start: this.data.dt + }); + wx.setStorageSync('sStartTime', this.data.start); + this.triggerEvent('change', {sTimeType: this.data.valList[this.data.intervalSel], sStartTime: this.data.start, sEndTime: this.data.end}) + }, + onConfirm1() { + let isBefore = moment(this.data.dt).isBefore(this.data.dt1) + if(!isBefore) { + this.setData({ + showDialog: true, + }); + return + } + this.setData({ + show2: false, + end: this.data.dt1 + }); + wx.setStorageSync('sEndTime', this.data.end); + this.triggerEvent('change', {sTimeType: this.data.valList[this.data.intervalSel], sStartTime: this.data.start, sEndTime: this.data.end}) + }, + onCancel() { + this.setData({ + show1: false, + }); + }, + onCancel1() { + this.setData({ + show2: false, + }); + }, + cdialog() { + this.setData({ + showDialog: false, + }); + } + + } +}) \ No newline at end of file diff --git a/components/timeCustom/index.json b/components/timeCustom/index.json new file mode 100644 index 0000000..fba482a --- /dev/null +++ b/components/timeCustom/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/components/timeCustom/index.wxml b/components/timeCustom/index.wxml new file mode 100644 index 0000000..84bf193 --- /dev/null +++ b/components/timeCustom/index.wxml @@ -0,0 +1,19 @@ + + {{item}} + + + + + + + + + + + + + 结束时间不能小于开始时间 + + \ No newline at end of file diff --git a/components/timeCustom/index.wxss b/components/timeCustom/index.wxss new file mode 100644 index 0000000..0a0610b --- /dev/null +++ b/components/timeCustom/index.wxss @@ -0,0 +1,38 @@ +.timelist { + width: 670rpx; + height: 80rpx; + line-height: 80rpx; + margin:0 auto; + display: flex; + flex-wrap: nowrap; + background: white; + justify-content:space-between; + padding-left: 8rpx; + padding-right: 8rpx; + margin-top: 32rpx; + border-radius: 8rpx; +} + +.timelist view { + text-align: center; + color: #999999; + font-size: 24rpx; + width: 166rpx; +} + +.timelist .active { + color: #027AFF; + background-color: #f9f9f9; + font-weight: bolder; + width: 166rpx; + height: 64rpx; + line-height: 64rpx; + margin-top: 8rpx; + border-radius: 4rpx; +} +.tc-d-t { + font-size: 14px; + padding: 15px 0px; + color: #909497; + text-align: center; +} \ No newline at end of file diff --git a/pages/brandCrisis/index.js b/pages/brandCrisis/index.js index eb5ddff..f61dd64 100644 --- a/pages/brandCrisis/index.js +++ b/pages/brandCrisis/index.js @@ -192,7 +192,7 @@ Page({ let sEndTime = wx.getStorageSync("sEndTime") || ''; let sSeriesName = wx.getStorageSync("sSeriesName") || ''; let obj = { - action: "getWebsite", + action: "getSourceTop", sType: "BrandOverview", sTimeType: sTimeType, sStartTime: sStartTime, diff --git a/pages/insight/pages/brandInsight/TailInsight/index.js b/pages/insight/pages/brandInsight/TailInsight/index.js index 064b0f0..a868ce3 100644 --- a/pages/insight/pages/brandInsight/TailInsight/index.js +++ b/pages/insight/pages/brandInsight/TailInsight/index.js @@ -43,7 +43,7 @@ Component({ this.setData({ taTransform: singleLine(dValue,dx) }) }); app.globalData.request({ - action: 'getWebsite', //重点媒体 + action: 'getSourceTop', //重点媒体 token: 't%2BrswgjvzGM=', sType: 'BrandWeiYi', sTimeType: wx.getStorageSync('sTimeType') || 34, diff --git a/pages/insight/pages/brandInsight/totalReview/index.js b/pages/insight/pages/brandInsight/totalReview/index.js index ffda28c..b7b2d4e 100644 --- a/pages/insight/pages/brandInsight/totalReview/index.js +++ b/pages/insight/pages/brandInsight/totalReview/index.js @@ -61,7 +61,7 @@ Component({ }); }); app.globalData.request({ - action: 'getWebsite', + action: 'getSourceTop', token: 't%2BrswgjvzGM=', sType: 'BrandOverview', sTimeType: wx.getStorageSync('sTimeType') || 34, diff --git a/pages/insight/pages/eventInsight/evTailwing/index.js b/pages/insight/pages/eventInsight/evTailwing/index.js index 4f7dac2..563b259 100644 --- a/pages/insight/pages/eventInsight/evTailwing/index.js +++ b/pages/insight/pages/eventInsight/evTailwing/index.js @@ -32,7 +32,7 @@ Component({ this.setData({ tailTransChart: singleLine(dValue,dx) }) }); app.globalData.request({ - action: 'getWebsite', //重点媒体 + action: 'getSourceTop', //重点媒体 token: 't%2BrswgjvzGM=', sType: 'BrandWeiYi', sTimeType: wx.getStorageSync('sTimeType') || 34, diff --git a/pages/insight/pages/eventInsight/evTotal/index.js b/pages/insight/pages/eventInsight/evTotal/index.js index 41acaaf..16420f6 100644 --- a/pages/insight/pages/eventInsight/evTotal/index.js +++ b/pages/insight/pages/eventInsight/evTotal/index.js @@ -50,7 +50,7 @@ Component({ }) }); app.globalData.request({ - action: 'getWebsite', //传播重点媒体 + action: 'getSourceTop', //传播重点媒体 token: 't%2BrswgjvzGM=', sType: 'HotEvent', sTimeType: wx.getStorageSync('sTimeType') || 34, diff --git a/pages/insight/pages/modalInsight/TailInsight/index.js b/pages/insight/pages/modalInsight/TailInsight/index.js index f8faa88..4f67a44 100644 --- a/pages/insight/pages/modalInsight/TailInsight/index.js +++ b/pages/insight/pages/modalInsight/TailInsight/index.js @@ -45,7 +45,7 @@ Component({ this.setData({ taTransform: singleLine(dValue,dx) }) }); app.globalData.request({ - action: 'getWebsite', //重点媒体 + action: 'getSourceTop', //重点媒体 token: 't%2BrswgjvzGM=', sType: 'BrandWeiYi', sTimeType: wx.getStorageSync('sTimeType') || 34, diff --git a/pages/insight/pages/modalInsight/totalReview/index.js b/pages/insight/pages/modalInsight/totalReview/index.js index e063930..3a09a43 100644 --- a/pages/insight/pages/modalInsight/totalReview/index.js +++ b/pages/insight/pages/modalInsight/totalReview/index.js @@ -46,7 +46,7 @@ Component({ },500) }); app.globalData.request({ - action: 'getWebsite', + action: 'getSourceTop', token: 't%2BrswgjvzGM=', sType: 'BrandOverview', sTimeType: wx.getStorageSync('sTimeType') || 34,