ソースを参照

修改细节问题

快乐的梦鱼 1 ヶ月 前
コミット
d4f7adeeaf
共有2 個のファイルを変更した13 個の追加3 個の削除を含む
  1. 4 2
      src/App.vue
  2. 9 1
      src/pages/dig/index.vue

+ 4 - 2
src/App.vue

@@ -19,9 +19,11 @@ const redirectThrottle = new MemoryTimeOut('RedirectThrottle', 50000);
 onLaunch(async () => {
   console.log('App Launch');
 
+  //加载登录信息
+  const loginState = await authStore.loadLoginState();
   if (AppConfig.requireLogin) {
-    //加载登录信息。如果未登录,跳转登录页
-    if (!await authStore.loadLoginState() && redirectThrottle.isTimeout()) {
+    //如果未登录,跳转登录页
+    if (!loginState && redirectThrottle.isTimeout()) {
       redirectThrottle.recordTime();
       setTimeout(() => {   
         const pageUrl = getCurrentPageUrl() || '';

+ 9 - 1
src/pages/dig/index.vue

@@ -107,7 +107,7 @@
 </template>
 
 <script setup lang="ts">
-import { ref } from 'vue';
+import { ref, watch } from 'vue';
 import { navTo } from '@/components/utils/PageAction';
 import { useAuthStore } from '@/store/auth';
 import { useCollectStore } from '@/store/collect';
@@ -144,6 +144,14 @@ const volunteerInfoLoader = useSimpleDataLoader(async () => {
 }, true);
 const rankListLoader = useSimpleDataLoader(async () => await VillageApi.getVolunteerRanklist(), true);
 
+watch(() => authStore.isLogged, (newVal) => {
+  if (newVal) {
+    villageListLoader.loadData();
+    volunteerInfoLoader.loadData();
+    rankListLoader.loadData();
+  }
+})
+
 function goSubmitDigPage(item: VillageListItem) {
   navTo('./dig/details', { 
     name: item.villageName,