Преглед на файлове

🎨 增加村社简介显示

快乐的梦鱼 преди 2 седмици
родител
ревизия
cd4e2a466f
променени са 2 файла, в които са добавени 74 реда и са изтрити 22 реда
  1. 12 7
      src/pages/home/village/index.vue
  2. 62 15
      src/pages/home/village/introd/card.vue

+ 12 - 7
src/pages/home/village/index.vue

@@ -9,8 +9,8 @@
           crossPosition="left"
           arrowOffsetX="-50rpx"
           content="点此可以查看我关注的村社"
-          @contentClick="showMyFollowPopup = true;handleCloseFollowTip()"
-          @close="handleCloseFollowTip"
+          @contentClick="handleCloseFollowTip(true)"
+          @close="handleCloseFollowTip(false)"
         >
           <Button
             icon="https://xy.wenlvti.net/app_static/images/home/IconSwitch.png"
@@ -37,7 +37,7 @@
         <Text text="等你的加入,快来为家乡建设做贡献吧" fontConfig="contentText" />
         <Height :height="20" />
         <FlexRow gap="gap.lg">
-          <FrameButton :text="isFollowed ? '已关注' : '先关注村社'" @click="isFollowed ? onUnFollow() : onFollow()" />
+          <FrameButton :text="isFollowed ? '已关注' : '先关注村社'" @click="isFollowed ? onUnFollow() : handleFollow()" />
           <FrameButton text="去申请点亮" @click="handleLight" primary />
         </FlexRow>
       </FlexCol>
@@ -103,7 +103,6 @@
 import { computed, onMounted, ref, watch } from 'vue';
 import { useVillageStore } from '@/store/village';
 import { useFollow } from './composeabe/Follow';
-import { navTo } from '@/components/utils/PageAction';
 import { isDevEnv } from '@/common/config/AppCofig';
 import { waitTimeOut } from '@imengyu/imengyu-utils';
 import type { VillageListItem } from '@/api/light/LightVillageApi';
@@ -149,16 +148,22 @@ const isLight = computed(() => {
   return villageStore.currentVillage?.isLight ?? false;
 });
 
-const showFollowTipTimeout = new MemoryTimeOut('FollowTip', 1000 * 3600 * 2);//2h
+const showFollowTipTimeout = new MemoryTimeOut('FollowTip', 1000 * 3600 * 30);//30h
 const showFollowTip = ref(false);
 
+function handleFollow() {
+  onFollow();
+  handleShowFollowTip();
+}
 function handleShowFollowTip() {
-  if (isFollowed.value && showFollowTipTimeout.isTimeout()) {
+  if (showFollowTipTimeout.isTimeout()) {
     showFollowTip.value = true;
   }
 }
-function handleCloseFollowTip() {
+function handleCloseFollowTip(open: boolean) {
   showFollowTipTimeout.recordTime();
+  if (open) 
+    showMyFollowPopup.value = true;
 }
 
 function handleLight() {

+ 62 - 15
src/pages/home/village/introd/card.vue

@@ -14,7 +14,7 @@
     >
 
       <!-- 标题 -->
-      <FlexRow justify="space-between" width="100%">
+      <FlexRow justify="space-between" align="flex-end" width="100%">
         <FlexCol gap="gap.md">
           <Text :text="villageInfoLoader.content.value?.title" fontConfig="primaryTitle" />
         </FlexCol>
@@ -43,6 +43,14 @@
         </FlexRow>
       </FlexRow>
 
+      <!-- 简介 -->
+      <TextEllipsis 
+        fontConfig="secondText"
+        :lines="2" 
+        :expandable="(villageInfoLoader.content.value?.desc as string || '').length > 80"
+        :text="(villageInfoLoader.content.value?.desc as string) || '暂无简介,欢迎您来编写完善!'"
+      />
+
       <!-- 状态与申请 -->
       <FlexRow 
         backgroundColor="background.tertiary" 
@@ -219,17 +227,38 @@
     <!-- 文脉乡源 -->
     <HomeTitle title="文脉乡源">
       <template #right>
-        <Touchable
-          :padding="[15, 20]"
-          :innerStyle="{ marginRight: '20rpx' }"
-          direction="row"
-          center
-          gap="gap.md"
-          @click="handleGoPublish()"
-        >
-          <Icon name="https://xy.wenlvti.net/app_static/images/village/IconLargeHistory.png" :size="30" />
-          <Text text="乡源AI帮你写" fontConfig="contentText" />
-        </Touchable>
+        <FlexRow align="center" gap="gap.md">
+          <BubbleTip
+            v-model:show="showManageTip"
+            position="bottom"
+            crossPosition="left"
+            arrowOffsetX="-50rpx"
+            content="村社贴图太乱?点这里整理"
+            @contentClick="handleCloseManageTip(true)"
+            @close="handleCloseManageTip(false)"
+          >
+            <Touchable
+              :padding="[15, 20]"
+              direction="row"
+              center
+              gap="gap.md"
+              @click="handleGoPublish()"
+            >
+              <Icon name="https://xy.wenlvti.net/app_static/images/village/IconLargeFolkloreVibe.png" :size="30" />
+              <Text text="管理" fontConfig="contentText" />
+            </Touchable>
+          </BubbleTip>
+          <Touchable
+            :padding="[15, 20]"
+            direction="row"
+            center
+            gap="gap.md"
+            @click="handleGoPublish()"
+          >
+            <Icon name="https://xy.wenlvti.net/app_static/images/village/IconLargeHistory.png" :size="30" />
+            <Text text="乡源AI帮你写" fontConfig="contentText" />
+          </Touchable>
+        </FlexRow>
       </template>
     </HomeTitle>
     <RoundTags v-model:active="listActiveTag" :tags="['广场', '老味道', '老手艺', '老物件', '老故事']" />
@@ -237,6 +266,7 @@
   <OfficialAccountPublishWrap
     :topic="recommendTagName" 
     @publishsuccess="onPublishSuccess"
+    @empty="isOfficialEmpty=true"
   />
   <UpgradeDialog 
     ref="upgradeRef"
@@ -273,15 +303,14 @@ import GridItem from '@/components/layout/grid/GridItem.vue';
 import LightVillageApi from '@/api/light/LightVillageApi';
 import OfficialAccountPublishWrap from '@/common/components/OfficialAccountPublishWrap.vue';
 import UpgradeDialog from '../dialogs/UpgradeDialog.vue';
-import JoinDialog from '../dialogs/JoinDialog.vue';
 import VillageGallery from '../components/VillageGallery.vue';
 import WxButton from '@/components/basic/WxButton.vue';
 import Height from '@/components/layout/space/Height.vue';
 import IconButton from '@/components/basic/IconButton.vue';
 import Button from '@/components/basic/Button.vue';
-import BubbleBox from '@/components/feedback/BubbleBox.vue';
 import BubbleTip from '@/components/feedback/BubbleTip.vue';
 import MemoryTimeOut from '@/components/composeabe/MemoryTimeOut';
+import TextEllipsis from '@/components/display/TextEllipsis.vue';
 
 const authStore = useAuthStore();
 const { getIsVolunteer } = useUserTools();
@@ -296,6 +325,7 @@ const { onPublishSuccess } = useOfficialAccount(() => {
 const { isFollowed, onFollow, onUnFollow } = useFollow();
 const villageStore = useVillageStore();
 const { getIsJoinedVillage } = useUserTools();
+const isOfficialEmpty = ref(false);
 const isJoined = ref(false);
 const villageInfoLoader = useSimpleDataLoader(async () => {
   const village = villageStore.currentVillage;  
@@ -306,6 +336,10 @@ const villageInfoLoader = useSimpleDataLoader(async () => {
     isJoined.value = false;
   }
   handleShowFollowTip();
+  isOfficialEmpty.value = false;
+  setTimeout(() => {
+    handleManageFollowTip();
+  }, 3000);
   return {
     title: village?.name || '',
     desc: village?.desc || '',
@@ -364,6 +398,16 @@ function handleCloseFollowTip() {
   showFollowTipTimeout.recordTime();
 }
 
+const showManageTipTimeout = new MemoryTimeOut('VillageManageTip', 1000 * 3600 * 20);//30h
+const showManageTip = ref(false);
+
+function handleManageFollowTip() {
+  if (showManageTipTimeout.isTimeout() && !isOfficialEmpty.value)
+    showManageTip.value = true;
+}
+function handleCloseManageTip(goComp: boolean) {
+  showManageTipTimeout.recordTime();
+}
 
 watch(rankActiveTag, () => {
   villageUserRankListLoader.reload();
@@ -426,9 +470,12 @@ defineExpose({
   onPageBack: (name: string, data: Record<string, unknown>) => {
     if (name === 'refreshVillageGrallery') {
       villageGalleryRef.value?.refresh();
-
     } else if (name === 'showVillageUpgrade') {
       upgradeRef.value?.show();
+    } else if (name === 'refreshOfficialAccount') {
+      const tag = listActiveTag.value;
+      listActiveTag.value = '';
+      setTimeout(() => listActiveTag.value = tag, 100);
     }
   },
 });