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.

96 lines
2.7 KiB

const app = getApp();
Page({
data: {
result: ['1', '2', '3'],
checked: false,
sSeriesName: '',
brand: '',
Id: "",
},
onLoad() {
wx.setNavigationBarTitle({
title: '危机事件推送设置'
})
let pages = getCurrentPages();
let currentPage = pages[pages.length - 1]
let options = currentPage.options
this.setData({
brand: options.brand
})
},
onShow() {
let sSeriesName = wx.getStorageSync("sSeriesArr") || '';
this.setData({
sSeriesName: sSeriesName,
})
this.getSwsQyQuartz()
},
getSwsQyQuartz() {
let obj = {
action: "getSwsQyQuartzList",
pid: 'brand',
token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
}
app.globalData.request(obj).then(res => {
let data = res[0];
let Es = data.Es || {};
let Id = data.Id || "";
let crisis = Es.Crisis ? Es.Crisis.split(",") : [];
let seriesNames = Es.SeriesNames || ''
let checked = data.Statu == 1 ? false : true
this.setData({
Id: Id,
result: crisis,
sSeriesName: this.data.sSeriesName || seriesNames,
checked: checked
})
})
},
onChange(event) {
wx.setStorageSync('sCrisis', event.detail.toString());
this.setData({
result: event.detail,
});
},
onChange1({
detail
}) {
let Statu = detail ? 2 : 1;
this.setData({
checked: detail
});
app.globalData.request({
action: 'addOrUpdSwsQyQuartzList',
data: {
Id: this.data.Id,
Statu: Statu
},
token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
})
},
handlerModel() {
app.globalData.request({
action: 'getUserMainBrand',
token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
}).then(res => {
wx.navigateTo({
url: '/pages/brandCrisis/chooseModel/index?brand=' + res
})
})
},
save() {
let data = {
Id: this.data.Id,
Es: {
Brands: this.data.brand,
Crisis: this.data.result.toString(),
SeriesNames: this.data.sSeriesName
}
}
app.globalData.request({
action: "addOrUpdSwsQyQuartzList",
data: data,
token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
})
},
})