|
|
|
@ -250,6 +250,8 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { requireLoginToPage } from '@/utils/authRedirect.js' |
|
|
|
|
|
|
|
const MY_CENTER_IMAGE_CACHE_KEY = 'my_center_image_cache_v1' |
|
|
|
const MY_CENTER_IMAGE_CACHE_TTL = 30 * 24 * 60 * 60 * 1000 |
|
|
|
const MY_CENTER_IMAGE_CACHE_LIMIT = 30 |
|
|
|
@ -479,10 +481,14 @@ |
|
|
|
uni.$off('myCenterCountsChange', this.setPendingCounts) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
requirePageLogin() { |
|
|
|
return requireLoginToPage('/pages/index/index?tabIndex=4') |
|
|
|
}, |
|
|
|
getMyCenterImage(key) { |
|
|
|
return this.myCenterImages[key] || MY_CENTER_IMAGE_URLS[key] || '' |
|
|
|
}, |
|
|
|
openProfileEditor() { |
|
|
|
if (!this.requirePageLogin()) return |
|
|
|
this.editNickname = this.userName || '' |
|
|
|
this.editAvatar = this.profileAvatar || '' |
|
|
|
this.nicknameInputByKeyboard = false |
|
|
|
@ -490,12 +496,14 @@ |
|
|
|
this.$refs.profilePopup.open() |
|
|
|
}, |
|
|
|
openOfficialAccountPopup() { |
|
|
|
if (!this.requirePageLogin()) return |
|
|
|
this.officialAccountPopupVisible = true |
|
|
|
}, |
|
|
|
closeOfficialAccountPopup() { |
|
|
|
this.officialAccountPopupVisible = false |
|
|
|
}, |
|
|
|
previewOfficialAccountQr() { |
|
|
|
if (!this.requirePageLogin()) return |
|
|
|
uni.previewImage({ |
|
|
|
current: this.officialAccountQr, |
|
|
|
urls: [this.officialAccountQr] |
|
|
|
@ -560,6 +568,7 @@ |
|
|
|
this.submitProfile(nickname) |
|
|
|
}, |
|
|
|
submitProfile(nickname) { |
|
|
|
if (!this.requirePageLogin()) return |
|
|
|
this.profileSaving = true |
|
|
|
this.tui.request('/user/miniProfile', 'POST', { |
|
|
|
nickname, |
|
|
|
@ -875,6 +884,12 @@ |
|
|
|
this.schoolName1 = area.title |
|
|
|
this.schoolShop = this.normalizeShopList(uni.getStorageSync('schoolShop')) |
|
|
|
this.worker = uni.getStorageSync('worker') |
|
|
|
if (!uni.getStorageSync('hiver_token')) { |
|
|
|
this.workerCounts = 0 |
|
|
|
this.shopCounts = 0 |
|
|
|
this.balance = '0.00' |
|
|
|
return Promise.resolve() |
|
|
|
} |
|
|
|
let shopId = uni.getStorageSync('shopId') |
|
|
|
let worker = uni.getStorageSync('worker') |
|
|
|
this.workerCounts = 0 |
|
|
|
@ -919,6 +934,7 @@ |
|
|
|
}) |
|
|
|
}, |
|
|
|
clickShop(item) { |
|
|
|
if (!this.requirePageLogin()) return |
|
|
|
this.setCurrentShop(item) |
|
|
|
this.$refs.shopPopup.close() |
|
|
|
uni.navigateTo({ |
|
|
|
@ -937,6 +953,7 @@ |
|
|
|
}) |
|
|
|
}, |
|
|
|
onClickArea(item) { |
|
|
|
if (!this.requirePageLogin()) return |
|
|
|
uni.setStorageSync('area', JSON.stringify(item)) |
|
|
|
const area = this.getArea() |
|
|
|
this.schoolName1 = uni.getStorageSync('schoolName') || area.title || '沧州师范学院' |
|
|
|
@ -960,6 +977,7 @@ |
|
|
|
this.$forceUpdate() |
|
|
|
}, |
|
|
|
navigatorTo(e, index) { |
|
|
|
if (!this.requirePageLogin()) return |
|
|
|
let url = "" |
|
|
|
if (e == 'addgoods') { |
|
|
|
url = '/package2/myCenter/addGoods' |
|
|
|
|