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.

99 lines
2.9 KiB

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