From e6d1cc48828d15a813dc922294f21df942efd3a0 Mon Sep 17 00:00:00 2001 From: tianyi <13521030702@163.com> Date: Tue, 14 Jul 2026 18:00:04 +0800 Subject: [PATCH] 1 --- components/tab-bar/myCenter.vue | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/components/tab-bar/myCenter.vue b/components/tab-bar/myCenter.vue index f7095db..d32d216 100644 --- a/components/tab-bar/myCenter.vue +++ b/components/tab-bar/myCenter.vue @@ -14,7 +14,7 @@ {{schoolName}} › + @tap.stop="navigatorTo('qiehuan')">{{schoolName1}} › 切换校区 @@ -220,6 +220,7 @@ export default { data() { return { + schoolName1:'', areaList: [], schoolShop: [], workerCounts: 0, @@ -281,10 +282,6 @@ avatarText() { return (this.userName || '张').slice(0, 1) }, - schoolName() { - const area = this.getArea() - return uni.getStorageSync('schoolName') || area.title || '沧州师范学院' - }, milkTeaCount() { return Math.max(1, Math.round((Number(this.savedMoney) || 0) / 5)) }, @@ -591,6 +588,8 @@ }, init() { this.applyCachedMyCenterImages() + const area = this.getArea() + this.schoolName1 = area.title this.schoolShop = this.normalizeShopList(uni.getStorageSync('schoolShop')) this.worker = uni.getStorageSync('worker') let shopId = uni.getStorageSync('shopId') @@ -661,6 +660,22 @@ }, onClickArea(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.tui.toast('切换成功') this.$refs.areaPopup.close()