|
@@ -1,5 +1,6 @@ |
|
|
const app = getApp() |
|
|
const app = getApp() |
|
|
|
|
|
|
|
|
|
|
|
const config = require("../../config/config"); |
|
|
|
|
|
const Http = require("../../utils/HttpBasics"); |
|
|
Component({ |
|
|
Component({ |
|
|
|
|
|
|
|
|
properties: { |
|
|
properties: { |
|
@@ -30,11 +31,15 @@ Component({ |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
data: { |
|
|
data: { |
|
|
array: ['A广场', 'B广场-北京西单'], |
|
|
|
|
|
|
|
|
tenantData: JSON.parse(wx.getStorageSync('tenantData')), |
|
|
|
|
|
groupIf: wx.getStorageSync('groupIf'), |
|
|
|
|
|
tenantId: wx.getStorageSync('tenantId'), |
|
|
|
|
|
array: [], |
|
|
index: 1, |
|
|
index: 1, |
|
|
statusBarHeight: app.statusBarHeight + 'px', |
|
|
statusBarHeight: app.statusBarHeight + 'px', |
|
|
navigationBarHeight: (app.statusBarHeight + 44) + 'px' |
|
|
navigationBarHeight: (app.statusBarHeight + 44) + 'px' |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
methods: { |
|
|
methods: { |
|
|
backHome: function () { |
|
|
backHome: function () { |
|
|
wx.switchTab({ |
|
|
wx.switchTab({ |
|
@@ -46,6 +51,52 @@ Component({ |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
index: e.detail.value |
|
|
index: e.detail.value |
|
|
}) |
|
|
}) |
|
|
|
|
|
let groupIf = false; |
|
|
|
|
|
let selectIndex = 0; |
|
|
|
|
|
this.data.tenantData.map((item, index) => { |
|
|
|
|
|
if (e.detail.value == item.parentTenantId) { |
|
|
|
|
|
groupIf = true; |
|
|
|
|
|
} |
|
|
|
|
|
if (e.detail.value == item.tenantId) { |
|
|
|
|
|
selectIndex = index; |
|
|
|
|
|
wx.setStorageSync('tenantId', item.tenantId) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
let param = { |
|
|
|
|
|
tenantId: this.data.tenantData[selectIndex].parentTenantId, |
|
|
|
|
|
subTenantId: this.data.tenantData[e.detail.value].tenantId |
|
|
|
|
|
} |
|
|
|
|
|
if (groupIf) { |
|
|
|
|
|
wx.setStorageSync('groupIf', true) |
|
|
|
|
|
} else { |
|
|
|
|
|
wx.setStorageSync('groupIf', false) |
|
|
|
|
|
} |
|
|
|
|
|
this.checkAble = true; |
|
|
|
|
|
Http.post({ |
|
|
|
|
|
url: config.api.selectMall, |
|
|
|
|
|
data: param |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
title: '提示', |
|
|
|
|
|
content: '切换成功!', |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
.catch(err => { |
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
title: '提示', |
|
|
|
|
|
content: err.message, |
|
|
|
|
|
showCancel: false, |
|
|
|
|
|
success: function (res) { |
|
|
|
|
|
// 如果游戏下架或者找不到,重启首页 |
|
|
|
|
|
if (res.confirm) { |
|
|
|
|
|
// wx.reLaunch({ |
|
|
|
|
|
// url: '/pages/index/index', |
|
|
|
|
|
// }) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
this.alphaClick(); |
|
|
|
|
|
}) |
|
|
}, |
|
|
}, |
|
|
back: function () { |
|
|
back: function () { |
|
|
wx.navigateBack({ |
|
|
wx.navigateBack({ |
|
@@ -54,6 +105,20 @@ Component({ |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
attached: function(){ |
|
|
attached: function(){ |
|
|
|
|
|
console.log(JSON.parse(wx.getStorageSync('tenantData')),11111) |
|
|
|
|
|
let list = []; |
|
|
|
|
|
let tindex = 0; |
|
|
|
|
|
this.data.tenantData.map((item,index)=>{ |
|
|
|
|
|
list.push(item.name) |
|
|
|
|
|
if(item.tenantId == this.data.tenantId){ |
|
|
|
|
|
tindex = index |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
console.log(list,9999) |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
array:list, |
|
|
|
|
|
index: tindex |
|
|
|
|
|
}) |
|
|
let pages = getCurrentPages(); |
|
|
let pages = getCurrentPages(); |
|
|
if (pages.length <= 1) { |
|
|
if (pages.length <= 1) { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|