处理未登录情况
This commit is contained in:
@@ -7,10 +7,10 @@
|
||||
/>
|
||||
|
||||
<view class='top-row'>
|
||||
<image :src='userInfo.image' />
|
||||
<image :src='userInfo?.image||defaultAvatar' />
|
||||
<view class='u-flex-column'>
|
||||
<text>{{ userInfo.nickName }}</text>
|
||||
<text>{{ userInfo.telephone }}</text>
|
||||
<text>{{ userInfo?.nickName || '未登录' }}</text>
|
||||
<text>{{ userInfo?.telephone }}</text>
|
||||
</view>
|
||||
|
||||
<image :src='assetsUrl("ic_qrcode_white.png")' @click.stop='gotoPath("qrcode")' />
|
||||
@@ -18,15 +18,15 @@
|
||||
|
||||
<view class='bottom-row'>
|
||||
<view @click.stop='gotoPath("/pages/mine/subs/integral/index")'>
|
||||
<text>{{ userInfo.integration }}</text>
|
||||
<text>{{ userInfo?.integration||0 }}</text>
|
||||
<text>积分</text>
|
||||
</view>
|
||||
<view @click.stop='gotoPath("/pages/mine/subs/recharge/index")'>
|
||||
<text>{{ userInfo.balance }}</text>
|
||||
<text>{{ userInfo?.balance||0 }}</text>
|
||||
<text>余额</text>
|
||||
</view>
|
||||
<view @click.stop='gotoPath("/pages/mine/subs/coupon/index")'>
|
||||
<text>3</text>
|
||||
<text>{{ userInfo?.couponsCount || 0}}</text>
|
||||
<text>优惠券</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -45,7 +45,7 @@
|
||||
<view v-for='(item,index) in orderActionList' :key='index' @click.stop='gotoPath(item.path)'>
|
||||
<image :src='item.icon' />
|
||||
<text>{{ item.title }}</text>
|
||||
<text v-if='index==0&&userInfo.orderNum>0'>{{ userInfo.orderNum }}</text>
|
||||
<text v-if='index==0&&userInfo?.orderNum>0'>{{ userInfo?.orderNum }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -65,10 +65,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang='ts'>
|
||||
import { useUserStore } from '@/store';
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import { goPath } from '@/utils';
|
||||
import { assetsUrl, defaultAvatar } from '@/utils/assets';
|
||||
import { goLogin, goPath, isLogin } from '@/utils';
|
||||
import OfficialAccountDialog from '@/components/official-account-dialog.vue';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
const officialAccountDialogRef = ref();
|
||||
|
||||
@@ -124,6 +124,13 @@ title.value = import.meta.env.VITE_APP_TITLE;
|
||||
const store = useUserStore();
|
||||
const { userInfo } = storeToRefs(store);
|
||||
|
||||
onLoad(() => {
|
||||
if(!isLogin()) {
|
||||
goLogin();
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
const gotoPath = (path: string) => {
|
||||
if(path === 'follow_official_account') {
|
||||
showOfficialAccountDialog();
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<view class='content'>
|
||||
<view class='top-card-view'>
|
||||
<image class='bg-image' :src='assetsUrl("test_bg.png")' />
|
||||
<image class='avatar-image' :src='userInfo.image' />
|
||||
<image class='avatar-image' :src='params.avatarUrl' />
|
||||
<text>{{ userInfo.name }}</text>
|
||||
<text>{{ userInfo.levelName }}</text>
|
||||
</view>
|
||||
@@ -80,7 +80,7 @@ const params = ref<{
|
||||
});
|
||||
|
||||
onLoad(() => {
|
||||
store.getProfile();
|
||||
// store.getProfile();
|
||||
});
|
||||
|
||||
const chooseAvatar = (e: any) => {
|
||||
|
Reference in New Issue
Block a user