tianyi 2 weeks ago
parent
commit
e6d1cc4882
  1. 25
      components/tab-bar/myCenter.vue

25
components/tab-bar/myCenter.vue

@ -14,7 +14,7 @@
<text class="verify-dot"></text> <text class="verify-dot"></text>
</view> </view>
<view class="school-row" hover-class="tap-soft" hover-stay-time="80" <view class="school-row" hover-class="tap-soft" hover-stay-time="80"
@tap.stop="navigatorTo('qiehuan')">{{schoolName}} </view> @tap.stop="navigatorTo('qiehuan')">{{schoolName1}} </view>
<view class="identity-pill" @tap.stop="navigatorTo('qiehuan')">切换校区</view> <view class="identity-pill" @tap.stop="navigatorTo('qiehuan')">切换校区</view>
</view> </view>
</view> </view>
@ -220,6 +220,7 @@
export default { export default {
data() { data() {
return { return {
schoolName1:'',
areaList: [], areaList: [],
schoolShop: [], schoolShop: [],
workerCounts: 0, workerCounts: 0,
@ -281,10 +282,6 @@
avatarText() { avatarText() {
return (this.userName || '张').slice(0, 1) return (this.userName || '张').slice(0, 1)
}, },
schoolName() {
const area = this.getArea()
return uni.getStorageSync('schoolName') || area.title || '沧州师范学院'
},
milkTeaCount() { milkTeaCount() {
return Math.max(1, Math.round((Number(this.savedMoney) || 0) / 5)) return Math.max(1, Math.round((Number(this.savedMoney) || 0) / 5))
}, },
@ -591,6 +588,8 @@
}, },
init() { init() {
this.applyCachedMyCenterImages() this.applyCachedMyCenterImages()
const area = this.getArea()
this.schoolName1 = area.title
this.schoolShop = this.normalizeShopList(uni.getStorageSync('schoolShop')) this.schoolShop = this.normalizeShopList(uni.getStorageSync('schoolShop'))
this.worker = uni.getStorageSync('worker') this.worker = uni.getStorageSync('worker')
let shopId = uni.getStorageSync('shopId') let shopId = uni.getStorageSync('shopId')
@ -661,6 +660,22 @@
}, },
onClickArea(item) { onClickArea(item) {
uni.setStorageSync('area', JSON.stringify(item)) uni.setStorageSync('area', JSON.stringify(item))
const area = this.getArea()
this.schoolName1 = uni.getStorageSync('schoolName') || area.title || '沧州师范学院'
this.tui.request("/worker/admin/add", "POST", {
userId: uni.getStorageSync('id'),
isChangeArea: 1,
region: area.id
}, false, true).then((res) => {
if (res.code == 200) {
if (res.result != null) {
uni.setStorageSync('worker', res.result)
}
} else {
this.tui.toast(res.message)
}
uni.hideLoading()
}).catch((res) => {})
this.areaKeyword = '' this.areaKeyword = ''
this.tui.toast('切换成功') this.tui.toast('切换成功')
this.$refs.areaPopup.close() this.$refs.areaPopup.close()

Loading…
Cancel
Save