dev
Esdese 3 years ago
parent e6077ba8ae
commit a4f543dde2

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

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

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

@ -5,20 +5,42 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
boxArr:new Array(6), boxArr: new Array(6),
tabActive:0, tabActive: 0,
sonCom:true sonCom: true
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
this.getData()
this.setData({ },
boxArr:wx.getStorageSync('themeData') onShow() {
}) this.getData()
wx.setStorageSync('brandRatioTime', {sTimeType:'34'}) 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) { changeTab(val) {
let n = val.detail.index; let n = val.detail.index;
@ -26,14 +48,30 @@ Page({
tabActive: n tabActive: n
}) })
}, },
changeTime(event){ changeTime(event) {
let {detail} = event let {
wx.setStorageSync('brandRatioTime', detail) detail
} = event
wx.setStorageSync('brandRatioTime', detail)
this.reLoad()
},
reLoad() {
this.setData({ this.setData({
sonCom:false sonCom: false
}) })
this.setData({ 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_box" wx:else>
<view class="del_top"> <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" /> <van-icon name="sort" size="12px" color="white" />
<text style="font-size: 24rpx; color: rgba(255, 255, 255, 1);">切换</text> <text style="font-size: 24rpx; color: rgba(255, 255, 255, 1);">切换</text>
</view> </view>
<view style="display:inline-block;margin-left:32rpx;color: rgba(255, 255, 255, 1);">|</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}}"> <view style="display:inline-block;margin-left:36rpx;" bindtap="del" data-index="{{index}}">
<van-icon name="cross" size="12px" color="white" /> <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> <text style="font-size: 24rpx; color: rgba(255, 255, 255, 1);">删除</text>
</view> </view>
</view> </view>

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

@ -4,6 +4,6 @@
<van-tab title="品牌对比"><brand-child wx:if="{{active===0}}"></brand-child></van-tab> <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="车型对比"><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="事件对比"><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> </van-tabs>
</view> </view>

@ -25,6 +25,11 @@ Component({
url: '/contrastPackages/addEvent/index', url: '/contrastPackages/addEvent/index',
}) })
}, },
switchEvent(e){
let index = e.currentTarget.dataset.index
this.data.boxArr.splice(index,1)
this.add()
},
del(e){ del(e){
let index = e.currentTarget.dataset.index let index = e.currentTarget.dataset.index
let result = [...this.data.result] let result = [...this.data.result]
@ -44,11 +49,6 @@ Component({
const { const {
detail detail
} = event } = event
console.log(detail);
// if(detail.length>2){
// console.log("至多两个");
// return
// }
if(detail.length>2){ if(detail.length>2){
Dialog.alert({ Dialog.alert({
message: '至多二个', message: '至多二个',
@ -70,13 +70,7 @@ Component({
}, },
lifetimes: { lifetimes: {
attached() { attached() {
let x=wx.getStorageSync('eventData')
if(wx.getStorageSync('eventData')){
x.length=2
this.setData({
boxArr:x
})
}
app.globalData.request({ app.globalData.request({
action: 'getEventList', action: 'getEventList',
token: wx.getStorageSync('token'), token: wx.getStorageSync('token'),
@ -84,10 +78,21 @@ Component({
iPageIndex: 1, iPageIndex: 1,
iPageSize: 4, iPageSize: 4,
sTimeType: 20 sTimeType: 20
}).then(res => { }).then(res => {
this.setData({ this.setData({
eventList: res 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>
<view class="del_box" wx:else> <view class="del_box" wx:else>
<view class="del_top"> <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" /> <van-icon name="sort" size="12px" color="white" />
<text style="font-size: 24rpx; color: rgba(255, 255, 255, 1);">切换</text> <text style="font-size: 24rpx; color: rgba(255, 255, 255, 1);">切换</text>
</view> </view>

@ -19,10 +19,16 @@ Component({
show:false show:false
}) })
}, },
switchTheme(e){
let index = e.currentTarget.dataset.index
this.data.boxArr.splice(index,1)
this.add()
},
add(){ add(){
// wx.navigateTo({ wx.setStorageSync('themeData', this.data.boxArr)
// url: 'pages/addEvent/index', wx.navigateTo({
// }) url: '/contrastPackages/addTheme/index',
})
}, },
del(e){ del(e){
let index = e.currentTarget.dataset.index let index = e.currentTarget.dataset.index
@ -62,10 +68,22 @@ Component({
}, },
lifetimes: { lifetimes: {
attached() { 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({ app.globalData.request({
action: 'getSchemeDataToTheme', action: 'getSchemeDataToTheme',
token: wx.getStorageSync('token'), token: wx.getStorageSync('token'),
sType: 'contrast', sType:'former '
}).then(res => { }).then(res => {
this.setData({ this.setData({
themeList: res themeList: res

@ -11,7 +11,7 @@
<view class="del_box" wx:else> <view class="del_box" wx:else>
<view class="del_top"> <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" /> <van-icon name="sort" size="12px" color="white" />
<text style="font-size: 24rpx; color: rgba(255, 255, 255, 1);">切换</text> <text style="font-size: 24rpx; color: rgba(255, 255, 255, 1);">切换</text>
</view> </view>

Loading…
Cancel
Save