li.shaoyi %!s(int64=3) %!d(string=hai) anos
pai
achega
a1e7315e5c

+ 2 - 1
src/packages/mobile/assets/themes/global/global.less

@@ -76,7 +76,8 @@
 .van {
     &-dialog {
         &__message {
-            font-size: .28rem;
+            font-size  : .28rem;
+            line-height: .44rem;
         }
     }
 }

+ 3 - 12
src/packages/mobile/views/home/components/mine/index.less

@@ -45,24 +45,15 @@
                     display       : flex;
                     flex-direction: column;
 
-                    span {
+                    >span {
                         line-height: .4rem;
-
-                        &:first-child {
-                            font-size  : .3rem;
-                            font-weight: bold;
-                        }
-
-                        &:last-child {
-                            font-size: .24rem;
-                            color    : #A1B1C5;
-                        }
+                        font-size  : .3rem;
+                        font-weight: bold;
                     }
                 }
             }
 
             &-account {
-                flex           : 1;
                 display        : flex;
                 flex-direction : column;
                 justify-content: center;

+ 11 - 30
src/packages/mobile/views/home/components/mine/index.vue

@@ -11,7 +11,10 @@
               <img class="g-image--avatar" src="" />
             </div>
             <div class="profile-user__info">
-              <span>{{ getUserId() }}</span>
+              <div>
+                <Tag type="success" v-if="hasAuth">已实名</Tag>
+                <Tag type="primary" v-else>未实名</Tag>
+              </div>
               <span>{{ getLoginId() }}</span>
             </div>
           </div>
@@ -67,7 +70,7 @@
     </div>
     <div class="g-navmenu">
       <CellGroup>
-        <Cell is-link @click="hasAuth">
+        <Cell is-link :to="{ name: 'account-certification' }" v-if="!hasAuth">
           <template #title>
             <app-iconfont icon="icon-shimingrenzheng">实名认证</app-iconfont>
           </template>
@@ -117,21 +120,21 @@
 
 <script lang="ts" setup>
 import { shallowRef } from 'vue'
-import { Cell, CellGroup, Button, Toast } from 'vant'
-import { fullloading, dialog } from '@/utils/vant'
+import { Cell, CellGroup, Button, Tag } from 'vant'
+import { dialog } from '@/utils/vant'
 import { useNavigation } from '@/hooks/navigation'
-import { useLoginStore, useAccountStore } from '@/stores'
+import { useLoginStore, useUserStore, useAccountStore, } from '@/stores'
 import { useAuth } from '@/business/auth'
 import AppIconfont from '@mobile/components/base/iconfont/index.vue'
-import { queryUserAccount } from '@/services/api/account'
 import { useBankAccountSign } from '@/business/bank'
 
 const { router, routerTo } = useNavigation()
-const { getLoginId, getUserId, getFirstAccountId } = useLoginStore()
+const { getLoginId, getFirstAccountId } = useLoginStore()
+const { hasAuth } = useUserStore()
+const { getBankAccountList, dataList } = useBankAccountSign()
 const { logout } = useAuth()
 const { accountInfo } = useAccountStore()
 const headerRef = shallowRef<HTMLDivElement>()
-const { getBankAccountList, dataList } = useBankAccountSign()
 
 getBankAccountList()
 
@@ -153,28 +156,6 @@ const doInOutMoney = (tab: string) => {
   router.push({ name: 'bank-wallet', query: { tab } })
 }
 
-// 检查是否已实名认证
-const hasAuth = () => {
-  fullloading((hideLoading) => {
-    queryUserAccount({
-      data: {
-        userID: getUserId()
-      },
-      success: (res) => {
-        hideLoading()
-        if (res.data.hasauth) {
-          dialog('当前已实名')
-        } else {
-          routerTo('account-certification')
-        }
-      },
-      fail: (err) => {
-        Toast.fail('加载失败')
-      }
-    })
-  }, '正在加载...')
-}
-
 const userLogout = () => {
   dialog('是否退出当前账号?', {
     showCancelButton: true

+ 12 - 1
src/stores/modules/user.ts

@@ -1,4 +1,4 @@
-import { toRefs, shallowReadonly } from 'vue'
+import { toRefs, shallowReadonly, computed } from 'vue'
 import { queryLoginData } from '@/services/api/account'
 import { useLoginStore } from './login'
 import { VueStore } from '../base'
@@ -26,6 +26,16 @@ const store = new (class extends VueStore<StoreState>{
         super(state)
     }
 
+    /** 是否已实名认证 */
+    private hasAuth = computed(() => {
+        const { userAccount } = this.state.userData
+        return userAccount?.hasauth === 1
+    })
+
+    getters = {
+        hasAuth: this.hasAuth
+    }
+
     actions = {
         /** 获取用户数据 */
         getUserData: () => {
@@ -63,6 +73,7 @@ const store = new (class extends VueStore<StoreState>{
 export function useUserStore() {
     return shallowReadonly({
         ...toRefs(store.state),
+        ...store.getters,
         ...store.actions,
         ...store.methods,
     })