zx 3 years ago
parent c8becd4e68
commit 383d2cdfdf

@ -26,7 +26,7 @@ Component({
duration: 300000
})
let obj = {
action: 'getWebsiteHome0528',
action: 'getHomeSourceTop',
sType: 'Home',
sTimeType: sTimeType,
sStartTime: sStartTime,

@ -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,
});
}
}
})

@ -0,0 +1,3 @@
{
"component": true
}

@ -0,0 +1,19 @@
<view class="timelist">
<view wx:for="{{timelist}}" class="{{index === intervalSel?'active':''}}" wx:key="index" data-index="{{index}}" bindtap="priceSel">{{item}}
</view>
</view>
<view wx:if="{{show}}">
<van-cell title="选择开始时间" is-link value="{{ start }}" bind:click="onDisplay" />
<van-cell title="选择结束时间" is-link value="{{ end }}" bind:click="onDisplay1" />
<van-popup show="{{ show1 }}" position="bottom">
<van-datetime-picker type="datetime" value="{{startTime}}" bind:input="onInput" bind:confirm="onConfirm"
bind:cancel="onCancel" />
</van-popup>
<van-popup show="{{ show2 }}" position="bottom">
<van-datetime-picker type="datetime" value="{{endTime}}" bind:input="onInput1" bind:confirm="onConfirm1"
bind:cancel="onCancel1" />
</van-popup>
<van-dialog use-slot title="注意" show="{{ showDialog }}" bind:confirm="cdialog">
<view class="tc-d-t">结束时间不能小于开始时间</view>
</van-dialog>
</view>

@ -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;
}

@ -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,

@ -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,

@ -61,7 +61,7 @@ Component({
});
});
app.globalData.request({
action: 'getWebsite',
action: 'getSourceTop',
token: 't%2BrswgjvzGM=',
sType: 'BrandOverview',
sTimeType: wx.getStorageSync('sTimeType') || 34,

@ -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,

@ -50,7 +50,7 @@ Component({
})
});
app.globalData.request({
action: 'getWebsite', //传播重点媒体
action: 'getSourceTop', //传播重点媒体
token: 't%2BrswgjvzGM=',
sType: 'HotEvent',
sTimeType: wx.getStorageSync('sTimeType') || 34,

@ -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,

@ -46,7 +46,7 @@ Component({
},500)
});
app.globalData.request({
action: 'getWebsite',
action: 'getSourceTop',
token: 't%2BrswgjvzGM=',
sType: 'BrandOverview',
sTimeType: wx.getStorageSync('sTimeType') || 34,

Loading…
Cancel
Save