|
@@ -13,10 +13,10 @@
|
|
|
<view class="iconfont icon-xiugai" @click="onIconOpen"></view>
|
|
|
</view>
|
|
|
<view class="function" v-else>
|
|
|
- <view class="function-item">
|
|
|
+ <view class="function-item" @click="toLogin">
|
|
|
登录
|
|
|
</view>/
|
|
|
- <view class="function-item">
|
|
|
+ <view class="function-item" @click="toRegister">
|
|
|
注册
|
|
|
</view>
|
|
|
</view>
|
|
@@ -186,7 +186,7 @@
|
|
|
import { useAuthStore } from '@/store/authStore'
|
|
|
|
|
|
import { getCreditCard, getZhongjie, getAnjie, getIconList, updateIcon } from '@/api/user.js'
|
|
|
- import { msgError, msgSuccess } from '@/utils/common'
|
|
|
+ import { msgError, msgSuccess, showConfirm } from '@/utils/common'
|
|
|
|
|
|
import { useTabbarStore } from '@/store/tabbarStore.js'
|
|
|
const tabbarStore = useTabbarStore()
|
|
@@ -324,21 +324,42 @@
|
|
|
sfzh: null,
|
|
|
whcd: null
|
|
|
})
|
|
|
+ function showMsg() {
|
|
|
+ showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
|
|
|
+ if (res.confirm) {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: '/pages/initial/initial'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
// 点击-会费缴交
|
|
|
function onHuiFeiJiaoJiao() {
|
|
|
+ if (!isLogin.value) {
|
|
|
+ showMsg()
|
|
|
+ return
|
|
|
+ }
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/huiFeiJiaoJiao/huiFeiJiaoJiao'
|
|
|
})
|
|
|
}
|
|
|
// 点击-我的订单
|
|
|
function onWoDeDingDan() {
|
|
|
+ if (!isLogin.value) {
|
|
|
+ showMsg()
|
|
|
+ return
|
|
|
+ }
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/order/order'
|
|
|
})
|
|
|
}
|
|
|
// 点击-我的收藏
|
|
|
function onWoDeShouChang() {
|
|
|
+ if (!isLogin.value) {
|
|
|
+ showMsg()
|
|
|
+ return
|
|
|
+ }
|
|
|
uni.navigateTo({
|
|
|
url: '/pages/collect/collect'
|
|
|
})
|
|
@@ -353,9 +374,23 @@
|
|
|
}
|
|
|
// 点击-退出登录
|
|
|
function onLogout() {
|
|
|
+ if (!isLogin.value) {
|
|
|
+ return
|
|
|
+ }
|
|
|
removeToken()
|
|
|
uni.redirectTo({
|
|
|
- url: '/pages/login/login'
|
|
|
+ url: '/pages/initial/initial'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function toLogin() {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/initial/initial'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ function toRegister() {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/register/register'
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -365,27 +400,29 @@
|
|
|
|
|
|
onLoad(() => {
|
|
|
user.value = authStore.userInfo
|
|
|
- getCreditCard().then(res => {
|
|
|
- if (res && res.message === 'success') {
|
|
|
- creditCard.value = res.data
|
|
|
- authStore.setCreditCard(res.data)
|
|
|
- }
|
|
|
- })
|
|
|
- getZhongjie().then(res => {
|
|
|
- if (res && res.message === 'success') {
|
|
|
- zhongjie.value = res.data ?? {zsbh: null}
|
|
|
- }
|
|
|
- })
|
|
|
- getAnjie().then(res => {
|
|
|
- if (res && res.message === 'success') {
|
|
|
- anjie.value = res.data ?? {zsbh: null}
|
|
|
- }
|
|
|
- })
|
|
|
- getIconList().then(res => {
|
|
|
- if (res && res.message === 'success') {
|
|
|
- iconList.value = res.data
|
|
|
- }
|
|
|
- })
|
|
|
+ if (isLogin.value) {
|
|
|
+ getCreditCard().then(res => {
|
|
|
+ if (res && res.message === 'success') {
|
|
|
+ creditCard.value = res.data
|
|
|
+ authStore.setCreditCard(res.data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ getZhongjie().then(res => {
|
|
|
+ if (res && res.message === 'success') {
|
|
|
+ zhongjie.value = res.data ?? {zsbh: null}
|
|
|
+ }
|
|
|
+ })
|
|
|
+ getAnjie().then(res => {
|
|
|
+ if (res && res.message === 'success') {
|
|
|
+ anjie.value = res.data ?? {zsbh: null}
|
|
|
+ }
|
|
|
+ })
|
|
|
+ getIconList().then(res => {
|
|
|
+ if (res && res.message === 'success') {
|
|
|
+ iconList.value = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
</script>
|
|
|
|