Przeglądaj źródła

🎨 优化界面细节问题

快乐的梦鱼 17 godzin temu
rodzic
commit
13b913d66c

+ 1 - 1
src/api/light/LightVillageApi.ts

@@ -451,7 +451,7 @@ export class LightVillageApi extends AppServerRequestModule<DataModel> {
 
   async updateVillageSkin(id: number, currentSkinId: number) {
     return await this.post<KeyValue>('/village/village/setSkin', '更新村社皮肤', {
-      id: id,
+      village_id: id,
       skin_id: currentSkinId,
     });
   }

+ 1 - 1
src/common/components/parts/IndexRoundSimpleItem.vue

@@ -15,7 +15,7 @@
   >
     <Image 
       :src="item.image" 
-      :width="half ? 320 : 640" 
+      :width="half ? 340 : '100%'" 
       :height="imageHeight" 
       mode="aspectFill" 
     />

+ 7 - 6
src/components/loader/SimplePageContentLoader.vue

@@ -22,15 +22,16 @@
     class="loader-view"
   >
     <Empty
+      v-if="emptyView"
       image="search"
-      :description="emptyView?.text ?? '暂无数据'"
+      :description="emptyView.text ?? '暂无数据'"
     >
       <Height :height="20" />
       <Button 
-        v-if="emptyView?.button"  
+        v-if="emptyView && emptyView.button"  
         type="primary"
-        :text="emptyView?.buttonText ?? '刷新'"
-            @click="() => emptyView?.buttonClick ? emptyView?.buttonClick() : handleRetry()"
+        :text="emptyView.buttonText ?? '刷新'"
+            @click="() => emptyView!.buttonClick ? emptyView!.buttonClick() : handleRetry()"
       />
     </Empty>
   </view>
@@ -81,8 +82,8 @@ const props = defineProps({
       buttonText?: string,
       button?: boolean,
       buttonClick?: () => void,
-    }>,
-    default: null,
+    }|null>,
+    default: () => ({}),
   },
 })
 

+ 29 - 27
src/pages/home/index.vue

@@ -186,34 +186,36 @@
         </scroll-view>
       </SimplePageContentLoader>
 
-      <HomeTitle title="最新动态" />
-      <SimplePageContentLoader :loader="noticeListLoader">
-        <FlexCol gap="gap.lg">
-          <FlexRow 
-            v-for="item in noticeListLoader.content.value?.slice(0, 3) || [] "
-            :key="item.item.id"
-            backgroundColor="background.tertiary"
-            radius="radius.md"
-            :padding="[20, 30]"
-            gap="gap.lg"
-            align="center"
-          > 
-            <Avatar 
-              :src="(item.item.avatar as string)"
-              :size="80"
-              :round="false"
-              :radius="10"
-            />
-            <FlexCol>
-              <Text :text="item.item.title" fontConfig="contentText" />
-              <Text 
-                :text="`来自${item.item.villageName}`" 
-                fontConfig="secondText"
+      <template v-if="authStore.isLogged">
+        <HomeTitle title="最新动态" />
+        <SimplePageContentLoader :loader="noticeListLoader" :emptyView="null">
+          <FlexCol gap="gap.lg">
+            <FlexRow 
+              v-for="item in noticeListLoader.content.value?.slice(0, 3) || [] "
+              :key="item.item.id"
+              backgroundColor="background.tertiary"
+              radius="radius.md"
+              :padding="[20, 30]"
+              gap="gap.lg"
+              align="center"
+            > 
+              <Avatar 
+                :src="(item.item.avatar as string)"
+                :size="80"
+                :round="false"
+                :radius="10"
               />
-            </FlexCol>
-          </FlexRow>
-        </FlexCol>
-      </SimplePageContentLoader>
+              <FlexCol>
+                <Text :text="item.item.title" fontConfig="contentText" />
+                <Text 
+                  :text="`来自${item.item.villageName}`" 
+                  fontConfig="secondText"
+                />
+              </FlexCol>
+            </FlexRow>
+          </FlexCol>
+        </SimplePageContentLoader>
+      </template>
 
       <HomeTitle title="乡村排名" showMore @moreClicked="navTo('/pages/home/village/rank/village', {})" />
       <VillageRankList :list="villageRankListLoader.content.value ?? []" :jumpToSingle="false" @goDetails="handleGoVillageDetails" />

+ 37 - 13
src/pages/home/village/introd/card.vue

@@ -23,7 +23,11 @@
         <Width :width="30" />
       </FlexRow>
 
+      <FlexCol v-if="showLoading" :height="500" center>
+        <ActivityIndicator />
+      </FlexCol>
       <DynamicX 
+        v-else-if="show"
         :page="pageThemeLoader.content.value"
         :injectScriptGlobal="pageScriptGlobal"
       >
@@ -279,6 +283,7 @@
           </DynamicXNodeChild>
         </template>
       </DynamicX>
+
     </ProvideVar>
   </SimplePageContentLoader>
 
@@ -394,6 +399,8 @@ import ContentBlocks from './card/content/ContentBlocks.vue';
 import ContentTitle from './card/content/ContentTitle.vue';
 import ContentMap from './card/content/ContentMap.vue';
 import type { ContentTitleBlockDefine } from './card/content/ContentBlocks';
+import { onHide, onShow } from '@dcloudio/uni-app';
+import ActivityIndicator from '@/components/basic/ActivityIndicator.vue';
 
 const emit = defineEmits<{
   (e: 'goTree'): void;
@@ -588,7 +595,7 @@ const pageScriptGlobal = reactive({
   handleGoCollect,
   getVillageId: () => villageStore.currentVillage?.id ?? 0,
   getDefaultTags: () => defaultTags,
-  navTo,
+  navTo: navTo,
   emit,
   todo: () => alert({ content: '暂未实现,敬请期待' }),
 });
@@ -622,20 +629,37 @@ watch(() => villageStore.currentVillage, async () => {
   await noticeListLoader.reload();
 }, { immediate: true });
 
+const show = ref(true);
+const showLoading = ref(false);
+
+onHide(() => {
+  show.value = false;
+})
+onShow(() => {
+  showLoading.value = true;
+  setTimeout(() => {
+    showLoading.value = false;
+    show.value = true;
+  }, 1100);
+}) 
+
 defineExpose({
   onPageBack: (name: string, data: Record<string, unknown>) => {
-    if (name === 'refreshVillageGrallery') {
-      villageGalleryRef.value?.refresh();
-    } else if (name === 'refreshOfficialAccount') {
-      officialAccountPublishRef.value?.refresh();
-    } else if (name === 'showVillageUpgrade') {
-      upgradeRef.value?.show();
-    } else if (name === 'backShowVillageJoin') {
-      handleGoJoin();
-    } else if (name === 'backRefreshSkin') {
-      pageThemeLoader.load();
-      tagsLoader.load();  
-    } 
+    setTimeout(async () => {
+      if (name === 'refreshVillageGrallery') {
+        villageGalleryRef.value?.refresh();
+      } else if (name === 'refreshOfficialAccount') {
+        officialAccountPublishRef.value?.refresh();
+      } else if (name === 'showVillageUpgrade') {
+        upgradeRef.value?.show();
+      } else if (name === 'backShowVillageJoin') {
+        handleGoJoin();
+      } else if (name === 'backRefreshSkin') {
+        await villageStore.reloadVillageInfo();
+        await pageThemeLoader.load();
+        await tagsLoader.load();  
+      }      
+    }, 1500);
   },
 });
 </script>

+ 9 - 0
src/pages/home/village/introd/data/DarkCard.json

@@ -201,6 +201,15 @@
           }
         },
         {
+          "type": "Block:ContentTitle",
+          "props": {
+            "title": "文脉乡源",
+            "showMore": false,
+            "showIcon": true,
+            "showTopMargin": false
+          }
+        },
+        {
           "name": "VILLAGE:CONTENT:Official",
           "type": "Block:Official",
           "props": {