Pārlūkot izejas kodu

重新提交时清除前面的缓存,否则重新提交申请后再刷会显示旧数据

lifanagju_citu 1 mēnesi atpakaļ
vecāks
revīzija
530a2ae9f6

+ 1 - 4
layout/components/authModal/login/index.vue

@@ -200,10 +200,7 @@ async function handleRegister () {
     // 查看用户是否有在申请中的数据
     const { code } =  await useUserStore.getPersonalApplyingData()
     changeType.value = 'login'
-
-    uni.navigateTo({
-      url: code ? '/pages/register/review' : '/pages/register/index'
-    })
+    uni.navigateTo({ url: code ? '/pages/register/review?hasData=true' : '/pages/register/index' })
   } finally {
   }
 }

+ 7 - 5
pages/index/loading.vue

@@ -12,22 +12,24 @@
 import { onShow } from '@dcloudio/uni-app'
 import { getAccessToken } from '@/utils/request'
 import { showAuthModal } from '@/hooks/useModal'
-
+import { userStore } from '@/store/user'
+const useUserStore = userStore()
 
 const tabBarControl = (show = false) => { // 显示/隐藏 TabBar
-  console.log('TabBar:', show ? '展示' : '隐藏')
   const currentPage = getCurrentPages()
   if (!currentPage) return
   const currentTabBar = currentPage[0]?.getTabBar?.()
   currentTabBar?.setData({ show })
 }
 
-onShow(() => {
+onShow(async() => {
   tabBarControl(false) // 隐藏页面底部导航
   // 检查是否是个人令牌
   if (getAccessToken() && uni.getStorageSync('isPersonalToken')) {
-    const url = uni.getStorageSync('entRegisterData') ? '/pages/register/review?hasData=true' : '/pages/register/index'
-    uni.redirectTo({ url })
+    
+    // 查看用户是否有在申请中的数据
+    const { code } =  await useUserStore.getPersonalApplyingData()
+    uni.redirectTo({ url: code ? '/pages/register/review?hasData=true' : '/pages/register/index' })
     return
   }
 	if (!getAccessToken()) showAuthModal()

+ 2 - 1
pages/register/contact.vue

@@ -177,8 +177,9 @@ const handleSubmit = async () => {
 			icon: 'success',
 			duration: 2000
 		})
+		uni.removeStorageSync('entRegisterData') // 重新提交时清除前面的缓存,否则重新提交申请后再刷会显示旧数据
 		uni.reLaunch({
-			url: '/pages/register/review'
+			url: '/pages/register/review?applySubmit=true'
 		})
 	} catch {
 		uni.hideLoading()

+ 29 - 21
pages/register/review.vue

@@ -1,7 +1,22 @@
 <template>
-	<view v-if="show" style="padding: 15px;">
+	<view style="padding: 15px;">
+		<!-- 提交企业注册以后跳转显示页面 -->
+		<view v-if="!applyInfo?.status">
+			<view class="d-flex flex-column align-center">
+				<image src="/static/svg/submit.svg" style="height: 200px; width: "></image>
+			</view>
+			<view style="text-align: center;"><span class="color-primary font-size-20 font-weight-bold">您的企业注册申请已提交</span></view>
+      <view class="mt-5">审核时间预计在1~3个工作日内,申请结果会以短信方式通知到您的手机上,请注意查收。</view>
+      <view style="width: 100%;">
+        <view class="mt-5 mb-1">如有疑问请长按二维码添加下方企业微信联系我们:</view>
+        <view style="width: 150px; height: 150px; margin: auto;">
+					<image show-menu-by-longpress="true" src="https://minio.menduner.com/dev/menduner/contact.png" style="width: 150px; height: 150px;"></image>
+        </view>
+        <view class="text-center ml-5">潘青海先生(Peter Pan)</view>
+      </view>
+		</view>
 		<!-- 等待审核 -->
-		<view v-if="applyInfo?.status === '0'">
+		<view v-else-if="applyInfo?.status === '0'">
 			<view class="d-flex flex-column align-center">
 				<image src="/static/svg/submit.svg" style="height: 200px; width: "></image>
 			</view>
@@ -41,26 +56,11 @@
         <view class="text-center ml-5">潘青海先生(Peter Pan)</view>
       </view>
 		</view>
-		
-		<!-- 提交企业注册以后跳转显示页面 -->
-		<view v-else>
-			<view class="d-flex flex-column align-center">
-				<image src="/static/svg/submit.svg" style="height: 200px; width: "></image>
-			</view>
-			<view style="text-align: center;"><span class="color-primary font-size-20 font-weight-bold">您的企业注册申请已提交</span></view>
-      <view class="mt-5">审核时间预计在1~3个工作日内,申请结果会以短信方式通知到您的手机上,请注意查收。</view>
-      <view style="width: 100%;">
-        <view class="mt-5 mb-1">如有疑问请长按二维码添加下方企业微信联系我们:</view>
-        <view style="width: 150px; height: 150px; margin: auto;">
-					<image show-menu-by-longpress="true" src="https://minio.menduner.com/dev/menduner/contact.png" style="width: 150px; height: 150px;"></image>
-        </view>
-        <view class="text-center ml-5">潘青海先生(Peter Pan)</view>
-      </view>
-		</view>
 
-		<view class="d-flex align-center">
+		<view>
 			<!-- <button :class="{'second-button': applyInfo.status === '2', 'send-button': applyInfo.status !== '2'}" @tap="handleToHome">回到首页</button> -->
-			<button v-if="applyInfo.status === '2'" class="recomm-button" @tap="handleConfirm">重新提交</button>
+			<button v-if="applyInfo?.status === '2'" class="recomm-button" @tap="handleConfirm">重新提交</button>
+			<button class="recomm-button" @tap="refresh">刷新结果</button>
 		</view>
 	</view>
 </template>
@@ -85,7 +85,7 @@ const getApplyInfo = async () => {
 	} else {
 		const { data } = await getUserRegisterEnterpriseApply()
 		result = data || {}
-		uni.setStorageSync('applyInfo', JSON.stringify(result))
+		uni.setStorageSync('entRegisterData', JSON.stringify(result))
 	}
 	
   applyInfo.value = {
@@ -103,9 +103,17 @@ const getApplyInfo = async () => {
 let hasData = false
 onLoad((options) => {
 	hasData = options?.hasData ? true : false
+
+	// 刚提交审核,只显示提交页面,不查询审核状态,刷新后再显示申请状态
+	if (options?.applySubmit) return
 	getApplyInfo()
 })
 
+const refresh = async () => {
+	hasData = false
+	await getApplyInfo()
+	uni.showToast({ title: '刷新成功', icon: 'success', duration: 1500 })
+}
 
 // 回到首页时需将当前个人登录状态及缓存中的数据清除
 const handleToHome = async () => {