|
|
|
@ -7,21 +7,19 @@ Page({
|
|
|
|
|
*/
|
|
|
|
|
data: {
|
|
|
|
|
active: 0,
|
|
|
|
|
result:[],
|
|
|
|
|
themeList:[],
|
|
|
|
|
themeData:[],
|
|
|
|
|
issList:[],
|
|
|
|
|
titleList:[
|
|
|
|
|
{
|
|
|
|
|
title:'我的主题',
|
|
|
|
|
index:0,
|
|
|
|
|
active:true
|
|
|
|
|
},{
|
|
|
|
|
title:'往期主题',
|
|
|
|
|
index:1,
|
|
|
|
|
active:false
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
result: [],
|
|
|
|
|
themeList: [],
|
|
|
|
|
themeData: [],
|
|
|
|
|
issList: [],
|
|
|
|
|
titleList: [{
|
|
|
|
|
title: '我的主题',
|
|
|
|
|
index: 0,
|
|
|
|
|
active: true
|
|
|
|
|
}, {
|
|
|
|
|
title: '往期主题',
|
|
|
|
|
index: 1,
|
|
|
|
|
active: false
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -29,45 +27,72 @@ Page({
|
|
|
|
|
*/
|
|
|
|
|
onLoad: function (options) {
|
|
|
|
|
this.getData()
|
|
|
|
|
if (options.switchTheme) {
|
|
|
|
|
let switchTheme = JSON.parse(options.switchTheme)
|
|
|
|
|
this.setData({
|
|
|
|
|
switchTheme
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onUnload() {
|
|
|
|
|
if (this.data.switchTheme) {
|
|
|
|
|
this.back('switch')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
changeTitle(e){
|
|
|
|
|
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
|
|
|
|
|
for (let [index1, i] of arr.entries()) {
|
|
|
|
|
if (index1 == index) {
|
|
|
|
|
i.active = true
|
|
|
|
|
} else {
|
|
|
|
|
i.active = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.setData({
|
|
|
|
|
titleList:arr,
|
|
|
|
|
active:index
|
|
|
|
|
titleList: arr,
|
|
|
|
|
active: index
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
onChange(event) {
|
|
|
|
|
const {
|
|
|
|
|
detail
|
|
|
|
|
} = event
|
|
|
|
|
let themeData=[]
|
|
|
|
|
for(let i of detail){
|
|
|
|
|
let themeData = []
|
|
|
|
|
for (let i of detail) {
|
|
|
|
|
themeData.push(JSON.parse(i))
|
|
|
|
|
}
|
|
|
|
|
themeData.len=6
|
|
|
|
|
themeData.len = 6
|
|
|
|
|
this.setData({
|
|
|
|
|
result: detail,
|
|
|
|
|
themeData,
|
|
|
|
|
})
|
|
|
|
|
wx.setStorageSync('themeData', themeData)
|
|
|
|
|
wx.navigateBack({
|
|
|
|
|
delta: 1,
|
|
|
|
|
this.setData({
|
|
|
|
|
hasAdd:true
|
|
|
|
|
})
|
|
|
|
|
this.back('add')
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
getData(){
|
|
|
|
|
back(type) {
|
|
|
|
|
if (type == 'add') {
|
|
|
|
|
wx.navigateBack({
|
|
|
|
|
delta: 1,
|
|
|
|
|
})
|
|
|
|
|
} else if (type == "switch" && !this.data.hasAdd) {
|
|
|
|
|
console.log("执行切换");
|
|
|
|
|
let {
|
|
|
|
|
themeData
|
|
|
|
|
} = this.data
|
|
|
|
|
themeData.push(this.data.switchTheme)
|
|
|
|
|
wx.setStorageSync('themeData', themeData)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
getData() {
|
|
|
|
|
let themeData = wx.getStorageSync('themeData')
|
|
|
|
|
let result =[]
|
|
|
|
|
themeData.forEach(ele=>{
|
|
|
|
|
if(ele)result.push(JSON.stringify(ele)),this.data.themeData.push(ele)
|
|
|
|
|
let result = []
|
|
|
|
|
themeData.forEach(ele => {
|
|
|
|
|
if (ele) result.push(JSON.stringify(ele)), this.data.themeData.push(ele)
|
|
|
|
|
})
|
|
|
|
|
this.setData({
|
|
|
|
|
result
|
|
|
|
@ -75,8 +100,17 @@ Page({
|
|
|
|
|
app.globalData.request({
|
|
|
|
|
action: 'getSchemeDataToTheme',
|
|
|
|
|
token: wx.getStorageSync('token'),
|
|
|
|
|
sType:'now'
|
|
|
|
|
}).then(res=>{
|
|
|
|
|
sType: 'now'
|
|
|
|
|
}).then(res => {
|
|
|
|
|
for (let i of themeData) {
|
|
|
|
|
if (i) {
|
|
|
|
|
for (let j = 0; j < res.length; j++) {
|
|
|
|
|
if (i.Id == res[j].Id) {
|
|
|
|
|
res.splice(j, 1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.setData({
|
|
|
|
|
themeList: res
|
|
|
|
|
})
|
|
|
|
@ -85,8 +119,8 @@ Page({
|
|
|
|
|
app.globalData.request({
|
|
|
|
|
action: 'getSchemeDataToTheme',
|
|
|
|
|
token: wx.getStorageSync('token'),
|
|
|
|
|
sType:'former '
|
|
|
|
|
}).then(res=>{
|
|
|
|
|
sType: 'former '
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.setData({
|
|
|
|
|
issList: res
|
|
|
|
|
})
|
|
|
|
|