dev
Esdese 3 years ago
parent e6077ba8ae
commit a4f543dde2

@ -47,7 +47,8 @@
"carModelsRatio/index",
"eventRatio/index",
"themeRatio/index",
"addEvent/index"
"addEvent/index",
"addTheme/index"
]
}
],

@ -5,19 +5,28 @@ Page({
* 页面的初始数据
*/
data: {
boxArr:new Array(2),
tabActive:0,
sonCom:true
boxArr: new Array(2),
tabActive: 0,
sonCom: true
},
/**
* 生命周期函数--监听页面加载
*/
getEvent() {
this.setData({
boxArr: wx.getStorageSync('eventData')
})
wx.setStorageSync('brandRatioTime', {
sTimeType: '34'
})
},
onLoad(options) {
this.setData({
boxArr:wx.getStorageSync('eventData')
})
wx.setStorageSync('brandRatioTime', {sTimeType:'34'})
this.getEvent()
},
onShow() {
this.getEvent()
this.reLoad()
},
changeTab(val) {
let n = val.detail.index;
@ -25,14 +34,27 @@ Page({
tabActive: n
})
},
changeTime(event){
let {detail} = event
wx.setStorageSync('brandRatioTime', detail)
switchEvent(e) {
let index = e.currentTarget.dataset.index
this.data.boxArr.splice(index, 1)
wx.setStorageSync('eventData', this.data.boxArr)
wx.navigateTo({
url: '/contrastPackages/addEvent/index',
})
},
changeTime(event) {
let {
detail
} = event
wx.setStorageSync('brandRatioTime', detail)
this.reLoad()
},
reLoad() {
this.setData({
sonCom:false
sonCom: false
})
this.setData({
sonCom:true
sonCom: true
})
}
})

@ -7,17 +7,11 @@
<view class="event">添加事件一</view>
</view>
<view class="del_box" wx:else>
<view class="del_top">
<view style="display:inline-block;margin-left:48rpx;">
<view class="del_top" bindtap="switchEvent" data-index="{{index}}">
<view style="text-align: center;">
<van-icon name="sort" size="12px" color="white" />
<text style="font-size: 24rpx; color: rgba(255, 255, 255, 1);">切换</text>
</view>
<view style="display:inline-block;margin-left:32rpx;color: rgba(255, 255, 255, 1);">|</view>
<view style="display:inline-block;margin-left:36rpx;" bindtap="del" data-index="{{index}}">
<van-icon name="cross" size="12px" color="white" />
<view style="margin-left: 2rpx; display: inline-block;"></view>
<text style="font-size: 24rpx; color: rgba(255, 255, 255, 1);">删除</text>
</view>
</view>
<view class="del_title">
{{item.events_title}}

@ -5,20 +5,42 @@ Page({
* 页面的初始数据
*/
data: {
boxArr:new Array(6),
tabActive:0,
sonCom:true
boxArr: new Array(6),
tabActive: 0,
sonCom: true
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
boxArr:wx.getStorageSync('themeData')
})
wx.setStorageSync('brandRatioTime', {sTimeType:'34'})
this.getData()
},
onShow() {
this.getData()
this.reLoad()
},
del(e) {
let index = e.currentTarget.dataset.index
let boxArr = this.data.boxArr
boxArr.splice(index, 1)
boxArr.length = 6
this.setData({
boxArr
})
wx.setStorageSync('themeData', boxArr)
this.reLoad()
},
switchTheme(e) {
let index = e.currentTarget.dataset.index
this.data.boxArr.splice(index, 1)
this.add()
},
add() {
wx.setStorageSync('themeData', this.data.boxArr)
wx.navigateTo({
url: '/contrastPackages/addTheme/index',
})
},
changeTab(val) {
let n = val.detail.index;
@ -26,14 +48,30 @@ Page({
tabActive: n
})
},
changeTime(event){
let {detail} = event
wx.setStorageSync('brandRatioTime', detail)
changeTime(event) {
let {
detail
} = event
wx.setStorageSync('brandRatioTime', detail)
this.reLoad()
},
reLoad() {
this.setData({
sonCom:false
sonCom: false
})
this.setData({
sonCom:true
sonCom: true
})
},
getData() {
let boxArr = wx.getStorageSync('themeData')
boxArr.length = 6
this.setData({
boxArr: boxArr
})
wx.setStorageSync('brandRatioTime', {
sTimeType: '34'
})
}
})

@ -9,14 +9,14 @@
<view class="del_box" wx:else>
<view class="del_top">
<view style="display:inline-block;margin-left:26rpx;">
<view style="display:inline-block;margin-left:26rpx;" bindtap="switchTheme" data-index="{{index}}">
<van-icon name="sort" size="12px" color="white" />
<text style="font-size: 24rpx; color: rgba(255, 255, 255, 1);">切换</text>
</view>
<view style="display:inline-block;margin-left:32rpx;color: rgba(255, 255, 255, 1);">|</view>
<view style="display:inline-block;margin-left:36rpx;" bindtap="del" data-index="{{index}}">
<van-icon name="cross" size="12px" color="white" />
<view style="margin-left: 2rpx; display: inline-block;"></view>
<view style="margin-left: 2rpx; display: inline-block;" bindtap="del" data-index="{{index}}"></view>
<text style="font-size: 24rpx; color: rgba(255, 255, 255, 1);">删除</text>
</view>
</view>

@ -9,7 +9,7 @@ Page({
onShow() {
this.getTabBar().init();
console.log(this.data.active)
if(this.data.active==2){
if(this.data.active==2 || this.data.active==3){
this.reLoad()
}
},

@ -4,6 +4,6 @@
<van-tab title="品牌对比"><brand-child wx:if="{{active===0}}"></brand-child></van-tab>
<van-tab title="车型对比"><model-child wx:if="{{active===1}}"></model-child></van-tab>
<van-tab title="事件对比"><event-child wx:if="{{active===2 && wshow}}"></event-child></van-tab>
<van-tab title="主题对比"><theme-child wx:if="{{active===3}}"></theme-child></van-tab>
<van-tab title="主题对比"><theme-child wx:if="{{active===3 && wshow}}"></theme-child></van-tab>
</van-tabs>
</view>

@ -25,6 +25,11 @@ Component({
url: '/contrastPackages/addEvent/index',
})
},
switchEvent(e){
let index = e.currentTarget.dataset.index
this.data.boxArr.splice(index,1)
this.add()
},
del(e){
let index = e.currentTarget.dataset.index
let result = [...this.data.result]
@ -44,11 +49,6 @@ Component({
const {
detail
} = event
console.log(detail);
// if(detail.length>2){
// console.log("至多两个");
// return
// }
if(detail.length>2){
Dialog.alert({
message: '至多二个',
@ -70,13 +70,7 @@ Component({
},
lifetimes: {
attached() {
let x=wx.getStorageSync('eventData')
if(wx.getStorageSync('eventData')){
x.length=2
this.setData({
boxArr:x
})
}
app.globalData.request({
action: 'getEventList',
token: wx.getStorageSync('token'),
@ -84,10 +78,21 @@ Component({
iPageIndex: 1,
iPageSize: 4,
sTimeType: 20
}).then(res => {
}).then(res => {
this.setData({
eventList: res
})
let x=wx.getStorageSync('eventData')
let result = x.map(ele=>{
return JSON.stringify(ele)
})
if(wx.getStorageSync('eventData')){
x.length=2
this.setData({
boxArr:x,
result
})
}
})
},
},

@ -10,7 +10,7 @@
</view>
<view class="del_box" wx:else>
<view class="del_top">
<view style="display:inline-block;margin-left:48rpx;">
<view style="display:inline-block;margin-left:48rpx;" bindtap="switchEvent" data-index="{{index}}">
<van-icon name="sort" size="12px" color="white" />
<text style="font-size: 24rpx; color: rgba(255, 255, 255, 1);">切换</text>
</view>

@ -19,10 +19,16 @@ Component({
show:false
})
},
switchTheme(e){
let index = e.currentTarget.dataset.index
this.data.boxArr.splice(index,1)
this.add()
},
add(){
// wx.navigateTo({
// url: 'pages/addEvent/index',
// })
wx.setStorageSync('themeData', this.data.boxArr)
wx.navigateTo({
url: '/contrastPackages/addTheme/index',
})
},
del(e){
let index = e.currentTarget.dataset.index
@ -62,10 +68,22 @@ Component({
},
lifetimes: {
attached() {
let x=wx.getStorageSync('themeData')
if(wx.getStorageSync('themeData')){
let result = x.map(ele=>{
return JSON.stringify(ele)
})
x.length=6
this.setData({
boxArr:x,
result
})
}
app.globalData.request({
action: 'getSchemeDataToTheme',
token: wx.getStorageSync('token'),
sType: 'contrast',
sType:'former '
}).then(res => {
this.setData({
themeList: res

@ -11,7 +11,7 @@
<view class="del_box" wx:else>
<view class="del_top">
<view style="display:inline-block;margin-left:26rpx;">
<view style="display:inline-block;margin-left:26rpx;" bindtap="switchTheme" data-index="{{index}}">
<van-icon name="sort" size="12px" color="white" />
<text style="font-size: 24rpx; color: rgba(255, 255, 255, 1);">切换</text>
</view>

Loading…
Cancel
Save