Parcourir la source

fix(app): 同学荟

EvilDragon il y a 4 mois
Parent
commit
778aef400e

+ 1 - 0
packages/app/package.json

@@ -101,6 +101,7 @@
     "@dcloudio/uni-quickapp-webview": "3.0.0-alpha-4020820240920001",
     "@designer-hub/assets": "workspace:*",
     "@designer-hub/merchant": "workspace:*",
+    "@huolala-tech/page-spy-uniapp": "^1.9.9",
     "czg": "^1.9.3",
     "dayjs": "1.11.10",
     "extract-colors": "^4.1.0",

+ 3 - 0
packages/app/src/App.vue

@@ -1,7 +1,10 @@
 <script setup lang="ts">
 import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
 import * as sentry from 'sentry-uniapp'
+import { useUserStore } from './store'
+import { pageSpy } from './core/utils/page-spy'
 
+const userStore = useUserStore()
 onLaunch(() => {
   console.log('App Launch')
   sentry.init({

+ 4 - 0
packages/app/src/core/libs/requests.ts

@@ -149,6 +149,10 @@ export const createUserAuthInfo = (
     remark: string
   }>,
 ) => httpPost<any>('/app-api/member/user-auth-info/create', data)
+/**
+ * 获取设计师审核
+ */
+export const getUserAuthInfo = () => httpPost('/app-api/member/user-auth-info/get')
 export const getCircles = (query: { tagName?: string; circleType?: string; stylistId?: string }) =>
   httpGet<{
     list: {

+ 5 - 0
packages/app/src/core/utils/page-spy.ts

@@ -0,0 +1,5 @@
+import PageSpy from '@huolala-tech/page-spy-uniapp'
+export const pageSpy = new PageSpy({
+  api: 'page-spy.sxwobo.cn',
+  title: '',
+})

+ 3 - 1
packages/app/src/main.ts

@@ -1,11 +1,12 @@
 import { createSSRApp } from 'vue'
 import App from './App.vue'
-import store from './store'
+import store, { useUserStore } from './store'
 import { routeInterceptor, requestInterceptor, prototypeInterceptor } from './interceptors'
 import 'virtual:uno.css'
 import '@/style/index.scss'
 import '@/style/fonts.css'
 import '@/core/themes/default.scss'
+import { pageSpy } from './core/utils/page-spy'
 
 export function createApp() {
   const app = createSSRApp(App)
@@ -13,6 +14,7 @@ export function createApp() {
   app.use(routeInterceptor)
   app.use(requestInterceptor)
   app.use(prototypeInterceptor)
+  pageSpy.init()
   return {
     app,
   }

+ 1 - 1
packages/app/src/pages/home/study-tour/index.vue

@@ -21,7 +21,7 @@ import PageHelper from '@/components/page-helper.vue'
 const router = useRouter()
 const { data: studyTours, run: setStudyTours } = useRequest(() => getContents({ contentType: '1' }))
 const { data: classmates, run: setClassmates } = useRequest(
-  () => getContents({ contentType: '1', contentCategory: '101', pageSize: '2' }),
+  () => getContents({ contentCategory: '101', pageSize: '2' }),
   { initialData: { list: [] } },
 )
 const { data: banners, run: setBanners } = useRequest(

+ 5 - 3
packages/app/src/pages/mine/authentication/index.vue

@@ -28,7 +28,7 @@ import { requestToast } from '../../../core/utils/common'
 const { alert } = useMessage()
 const router = useRouter()
 const userStore = useUserStore()
-const { userInfo } = storeToRefs(userStore)
+const { userInfo, isDesigner } = storeToRefs(userStore)
 const { error } = useToast()
 const formData = ref<any>({})
 const formInited = ref(false)
@@ -100,7 +100,7 @@ const handleSubmit = async () => {
     ...formData.value,
   })
   if (code === 0) {
-    uni.navigateTo({ url: '/pages/mine/authentication/submit/success/index' })
+    router.replace(`/pages/mine/authentication/submit/success/index`)
   } else {
     error(msg)
   }
@@ -158,7 +158,9 @@ defineExpose({})
       </Card>
       <div class="flex-1"></div>
       <div>
-        <wd-button block :round="false" @click="handleSubmit">提交</wd-button>
+        <wd-button block :round="false" :disabled="isDesigner" @click="handleSubmit">
+          提交
+        </wd-button>
       </div>
     </div>
   </div>

+ 21 - 10
packages/app/src/pages/mine/index.vue

@@ -82,6 +82,18 @@ const pieces = ref([
 const avatar = computed(() =>
   !isEmpty(userInfo.value.avatar) ? userInfo.value.avatar : 'https://via.placeholder.com/72x72',
 )
+const certificationStatusText = computed(() => {
+  if (!userInfo.value.userStatusEnabled) return '未认证'
+  if (userInfo.value.userStatusEnabled && userInfo.value.userAuthStatus === 1) return '审核中'
+  if (userInfo.value.userStatusEnabled && userInfo.value.userAuthStatus === 2) return '已驳回'
+  return '通过'
+})
+const certificationBtnText = computed(
+  () => ({ 0: '通过', 1: '审核中', 2: '已驳回' })[userInfo.value.userAuthStatus] || '去认证',
+)
+const isCertified = computed(
+  () => userInfo.value.userStatusEnabled && userInfo.value.userAuthStatus === 0,
+)
 const nickNameClickHandle = async () => {
   if (isLogined.value) return
   uni.navigateTo({ url: '/pages/login/index' })
@@ -133,7 +145,7 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
     </wd-navbar>
     <div
       class="bg-black/30 flex flex-col justify-end box-border bg-[url(https://image.zhuchaohui.com/zhucaohui/c706ec14a5a927c10e9e1fa0153affb11bbdd9255882e18c67ee82687ff9813a.png)] bg-[length:100%_auto]"
-      :class="[userInfo.userStatusEnabled ? 'aspect-[0.94/1] pb-44' : 'aspect-[1.15/1] pb-20']"
+      :class="[isCertified ? 'aspect-[0.94/1] pb-44' : 'aspect-[1.15/1] pb-20']"
     >
       <div class="my-6.5 px-3.5 flex">
         <img class="w-[72px] h-[72px] rounded-full border border-white" :src="avatar" />
@@ -145,20 +157,17 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
             {{ !isLogined ? '请点击登录' : userInfo?.nickname }}
           </div>
           <div
-            v-if="!userInfo.userStatusEnabled"
+            v-if="!isCertified"
             class="mt-2 w-[63px] h-[26px] bg-black/10 rounded-[20px] border border-white/60 flex items-center justify-center"
           >
             <div
               class="text-center text-white text-xs font-normal font-['PingFang_SC'] leading-normal"
             >
-              未认证
+              <!-- 未认证 -->
+              {{ certificationStatusText }}
             </div>
           </div>
-          <div
-            v-if="userInfo.userStatusEnabled"
-            class="flex items-center text-white"
-            @click="handleToHomepage"
-          >
+          <div v-if="isCertified" class="flex items-center text-white" @click="handleToHomepage">
             <div
               class="text-center text-white text-sm font-normal font-['PingFang_SC'] leading-normal"
             >
@@ -210,7 +219,7 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
         </div>
       </div>
     </div>
-    <div class="relative top--18" v-if="!userInfo.userStatusEnabled">
+    <div class="relative top--18" v-if="!isCertified">
       <div class="mx-3.5 box-border absolute left-0 right-0 top-0">
         <wd-img :src="vipBg" width="100%" mode="widthFix"></wd-img>
       </div>
@@ -230,7 +239,9 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
             <div
               class="text-[#9e5934] text-[13px] font-normal font-['PingFang_SC'] leading-relaxed"
             >
-              去认证
+              <!-- 去认证 -->
+              <!-- {{ !isCertified ? '去认证' : certificationStatusText }} -->
+              {{ certificationBtnText }}
             </div>
           </div>
         </div>

+ 4 - 0
packages/app/src/store/user.ts

@@ -20,12 +20,16 @@ export const useUserStore = defineStore(
       userInfo.value = { ...initState }
     }
     const isLogined = computed(() => !!userInfo.value.token)
+    const isDesigner = computed(
+      () => userInfo.value.userStatusEnabled && userInfo.value.userAuthStatus === 0,
+    )
 
     return {
       userInfo,
       setUserInfo,
       clearUserInfo,
       isLogined,
+      isDesigner,
       reset,
     }
   },

+ 35 - 0
pnpm-lock.yaml

@@ -61,6 +61,9 @@ importers:
       '@designer-hub/merchant':
         specifier: workspace:*
         version: link:../merchant
+      '@huolala-tech/page-spy-uniapp':
+        specifier: ^1.9.9
+        version: 1.9.9
       czg:
         specifier: ^1.9.3
         version: 1.10.0
@@ -2301,6 +2304,19 @@ packages:
     resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==}
     deprecated: Use @eslint/object-schema instead
 
+  '@huolala-tech/page-spy-base@1.0.6':
+    resolution: {integrity: sha512-7r87TjCtxqbqtmXBMalPo7Dl03SVRUpczj+2gSFt8BF0hI4a6OWnTfmRKM0w+w92mBnJwpPbYCkfC5v6+EPlEA==}
+
+  '@huolala-tech/page-spy-mp-base@1.0.8':
+    resolution: {integrity: sha512-LSgaaAjRecY9Gsifs5W5WPxoeDMR2w2adnXZKw+792u+B0kuDBlcl867UkfmB6a7p9+9qMXm8nbbGJZQEeb0dw==}
+
+  '@huolala-tech/page-spy-types@1.9.6':
+    resolution: {integrity: sha512-owWTDxcm+qm2EDbBTBdPNixBSDRwAY/eAb05c7aZbByN3F8epXlqMTWfiHuFeM7f3Z6604fDv0nXad9hhala1A==}
+
+  '@huolala-tech/page-spy-uniapp@1.9.9':
+    resolution: {integrity: sha512-UQg1ld7TBoYZp7hDk6DqwePAPsBt+qiIW0VjATHlGkKBw1fK33gCCL42oPqq+m9OMkH8HIrYkA82NI+DE68bOA==}
+    engines: {node: '>=12'}
+
   '@iconify-json/carbon@1.2.1':
     resolution: {integrity: sha512-dIMY6OOY9LnwR3kOqAtfz4phGFG+KNfESEwSL6muCprBelSlSPpRXtdqvEEO/qWhkf5AJ9hWrOV3Egi5Z2IuKA==}
 
@@ -11849,6 +11865,25 @@ snapshots:
 
   '@humanwhocodes/object-schema@2.0.3': {}
 
+  '@huolala-tech/page-spy-base@1.0.6':
+    dependencies:
+      '@huolala-tech/page-spy-types': 1.9.6
+
+  '@huolala-tech/page-spy-mp-base@1.0.8':
+    dependencies:
+      '@huolala-tech/page-spy-base': 1.0.6
+      '@huolala-tech/page-spy-types': 1.9.6
+
+  '@huolala-tech/page-spy-types@1.9.6':
+    dependencies:
+      '@huolala-tech/page-spy-base': 1.0.6
+
+  '@huolala-tech/page-spy-uniapp@1.9.9':
+    dependencies:
+      '@huolala-tech/page-spy-base': 1.0.6
+      '@huolala-tech/page-spy-mp-base': 1.0.8
+      '@huolala-tech/page-spy-types': 1.9.6
+
   '@iconify-json/carbon@1.2.1':
     dependencies:
       '@iconify/types': 2.0.0