You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.1 KiB

// pages/varComm/pages/addEvent/index.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
active: 0,
result:[],
themeList:[],
themeData:[],
issList:[],
titleList:[
{
title:'我的主题',
index:0,
active:true
},{
title:'往期主题',
index:1,
active:false
}
]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getData()
},
changeTitle(e){
let index = e.currentTarget.dataset.index
let arr = this.data.titleList
for(let[index1,i] of arr.entries()){
if(index1==index){
i.active=true
}else{
i.active =false
}
}
this.setData({
titleList:arr,
active:index
})
},
onChange(event) {
const {
detail
} = event
let themeData=[]
for(let i of detail){
themeData.push(JSON.parse(i))
}
themeData.len=6
this.setData({
result: detail,
themeData,
})
wx.setStorageSync('themeData', themeData)
wx.navigateBack({
delta: 1,
})
},
getData(){
let themeData = wx.getStorageSync('themeData')
let result =[]
themeData.forEach(ele=>{
if(ele)result.push(JSON.stringify(ele)),this.data.themeData.push(ele)
})
this.setData({
result
})
app.globalData.request({
action: 'getSchemeDataToTheme',
token: wx.getStorageSync('token'),
sType:'now'
}).then(res=>{
this.setData({
themeList: res
})
})
app.globalData.request({
action: 'getSchemeDataToTheme',
token: wx.getStorageSync('token'),
sType:'former '
}).then(res=>{
this.setData({
issList: res
})
})
}
})