Przeglądaj źródła

🎨 按要求增加点亮村社提示

快乐的梦鱼 19 godzin temu
rodzic
commit
f373710aea
1 zmienionych plików z 31 dodań i 6 usunięć
  1. 31 6
      src/pages/home/index.vue

+ 31 - 6
src/pages/home/index.vue

@@ -106,13 +106,23 @@
         >
           我的关注
         </Button>
-        <Button 
-          icon="https://xy.wenlvti.net/app_static/images/home/IconLight.png" 
-          radius="radius.lg" :padding="[10, 30]" 
-          @click="handleLightVillage"
+        <BubbleTip
+          v-model:show="showLightTip"
+          content="没有加入村社?点击这里点亮村落"
+          position="bottom"
+          crossPosition="right"
+          :arrowOffsetX="130"
+          @contentClick="handleLightVillage"
+          @close="handleCloseLightTip"
         >
-          点亮村社
-        </Button>
+          <Button 
+            icon="https://xy.wenlvti.net/app_static/images/home/IconLight.png" 
+            radius="radius.lg" :padding="[10, 30]" 
+            @click="handleLightVillage"
+          >
+            点亮村社
+          </Button>
+        </BubbleTip>
       </FlexRow>
 
       <!-- <HomeTitle title="最新动态" />
@@ -249,6 +259,7 @@ import SimplePageListLoader from '@/components/loader/SimplePageListLoader.vue';
 import PostIndex from './village/dialogs/PostIndex.vue';
 import FrameButton from '@/common/components/FrameButton.vue';
 import type { RegionItem } from '@/api/map/RegionApi';
+import BubbleTip from '@/components/feedback/BubbleTip.vue';
 
 const emit = defineEmits(['goVillage','goDig']);
 const authStore = useAuthStore();
@@ -325,6 +336,18 @@ const recommendLoader = useSimplePageListLoader(20, async (page, pageSize) => {
   return await VillageInfoApi.getListForDiscover(page, pageSize);
 }, true);
 
+
+const showLightTipTimeout = new MemoryTimeOut('LightTip', 1000 * 3600 * 2);//2h
+const showLightTip = ref(false);
+
+function handleShowLightTip() {
+  if (showLightTipTimeout.isTimeout())
+    showLightTip.value = true;
+}
+function handleCloseLightTip() {
+  showLightTipTimeout.recordTime();
+}
+
 function handleGoRecommendDetails(item: CommonInfoModel) {
   navTo(`/pages/home/discover/details`, { id: item.id });
 }
@@ -413,6 +436,8 @@ async function loadInfo() {
     console.error(error);
   }
 
+  handleShowLightTip();
+
   try {
     if (villageStore.myFollowVillages.length > 0) {
       const currentVillage = villageStore.loadCurrentVillage();