Procházet zdrojové kódy

📦 认领村庄提示对话框

快乐的梦鱼 před 1 měsícem
rodič
revize
54b1ebdc75

+ 1 - 0
src/common/components/CommonDialog.vue

@@ -17,6 +17,7 @@
     >
       <template v-if="props.title">
         <Height :size="24" />
+        <slot name="titlePre"></slot>
         <FlexCol center gap="gap.lg">
           <H3 fontConfig="primaryTitle">{{ props.title }}</H3>
           <CommonDivider />

+ 5 - 0
src/common/config/Theme.ts

@@ -52,6 +52,11 @@ export function configAppTheme() {
       color: 'text.title',
       fontSize: '34rpx',
     };
+    theme.textConfigs.contentSpeicalText = {
+      color: 'text.content',
+      fontSize: '30rpx',
+      fontFamily: 'SongtiSCBlack',
+    };
     theme.textConfigs.contentText = {
       color: 'text.content',
       fontSize: '26rpx',

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

@@ -102,7 +102,7 @@
         <Button 
           icon="https://xy.wenlvti.net/app_static/images/home/IconLight.png" 
           radius="radius.lg" :padding="[10, 30]" 
-          @click="requireLogin(async () => navTo('/pages/home/light/submit-map', { city: currentCity }), '登录后才能点亮村社哦!')"
+          @click="handleLightVillage"
         >
           点亮村社
         </Button>
@@ -170,6 +170,8 @@
     >
       <VillageMyFollow @goDetails="goDetails" />
     </Popup>
+
+    <IntroClamTip ref="introClamTipRef" @apply="handleLightVillage" />
   </FlexCol>
 </template>
 
@@ -180,6 +182,10 @@ import { useSimpleDataLoader } from '@/components/composeabe/loader/SimpleDataLo
 import { useStorageVar } from '@/components/composeabe/StorageVar';
 import { useVillageStore } from '@/store/village';
 import { useGetCurrentLocation } from './composeabe/GetCurrentLocation';
+import { useAuthStore } from '@/store/auth';
+import { useReqireLogin } from '@/common/composeabe/RequireLogin';
+import { useOfficialAccount } from './composeabe/OfficialAccount';
+import { useUserTools } from '@/common/composeabe/UserTools';
 import { ArrayUtils, waitTimeOut } from '@imengyu/imengyu-utils';
 import { toast } from '@/components/utils/DialogAction';
 import { navTo } from '@/components/utils/PageAction';
@@ -199,19 +205,12 @@ import MapApi from '@/api/map/MapApi';
 import LightMap from './components/LightMap.vue';
 import NoticeBar from '@/components/display/NoticeBar.vue';
 import StatusBarSpace from '@/components/layout/space/StatusBarSpace.vue';
-import FollowVillageApi from '@/api/light/FollowVillageApi';
 import LightVillageApi, { VillageListItem } from '@/api/light/LightVillageApi';
 import type { CityItem } from '@/api/map/MapApi';
-import SimplePageListLoader from '@/components/loader/SimplePageListLoader.vue';
-import { useAuthStore } from '@/store/auth';
-import { useReqireLogin } from '@/common/composeabe/RequireLogin';
-import Avatar from '@/components/display/Avatar.vue';
-import Text from '@/components/basic/Text.vue';
-import BackgroundBox from '@/components/display/block/BackgroundBox.vue';
-import Construction from '@/common/components/Construction.vue';
 import Width from '@/components/layout/space/Width.vue';
-import { useOfficialAccount } from './composeabe/OfficialAccount';
 import OfficialAccountPublishWrap from '@/common/components/OfficialAccountPublishWrap.vue';
+import IntroClamTip from './village/dialogs/IntroClamTip.vue';
+import MemoryTimeOut from '@/components/composeabe/MemoryTimeOut';
 
 const emit = defineEmits(['goVillage']);
 const { onPublishSuccess } = useOfficialAccount();
@@ -219,10 +218,12 @@ const authStore = useAuthStore();
 const villageStore = useVillageStore();
 const themeContext = useTheme();
 const { requireLogin } = useReqireLogin();
+const { getIsVolunteer } = useUserTools();
 const searchKeywords = ref('');
 const showCityPopup = ref(false);
 const showMyFollowPopup = ref(false);
-
+const introClamTipRef = ref();
+const introClamTipTimeout = new MemoryTimeOut('IntroClamTip', 1000 * 3600 * 30);//30h
 
 const currentRegion = ref<number | null>(null);
 const { value: currentCity } = useStorageVar('currentCityName', '');
@@ -324,8 +325,22 @@ function handleGoAI() {
     navTo('/pages/chat/index');
   }, '暂时需要登录后才能使用AI助手');
 }
+async function handleLightVillage() {
+  requireLogin(async () => navTo('/pages/home/light/submit-map', { city: currentCity }), '登录后才能点亮村社哦!');
+}
 
 async function loadInfo() {
+
+  //如果不是志愿者,则显示认领村庄提示
+  const isVolunteer = await getIsVolunteer();
+  if (!isVolunteer) {
+    if (introClamTipTimeout.isTimeout()) {
+      introClamTipRef.value?.show();
+      introClamTipTimeout.recordTime();
+    }
+  }
+
+  //加载我的关注村庄
   await villageStore.loadMyFollowVillages();
   if (villageStore.myFollowVillages.length > 0) {
     const currentVillage = villageStore.loadCurrentVillage();
@@ -339,6 +354,7 @@ async function loadInfo() {
 
 watch(() => authStore.isLogged, async (newVal) => {
   if (newVal) {
+    introClamTipTimeout.reset();
     await loadInfo();
   }
 });

+ 39 - 0
src/pages/home/village/dialogs/IntroClamTip.vue

@@ -0,0 +1,39 @@
+<template>
+  <CommonDialog v-model:show="show" title="开启你的乡村之旅">
+    <template #titlePre>
+      <FlexRow center>
+        <Image src="https://xy.wenlvti.net/app_static/images/home/BadgeNew.png" :width="320" mode="widthFix" />
+      </FlexRow>
+    </template>
+    <FlexCol gap="gap.lg" padding="padding.md">
+      <Text 
+        textAlign="center"
+        text="认领属于你的村庄,参与建设家乡 或者先随便看看,了解更多乡村故事" 
+        fontConfig="contentSpeicalText" 
+      />
+      <FlexRow justify="space-around" gap="gap.md">
+        <FrameButton text="随便看看" @click="show = false" width="220rpx" />
+        <FrameButton primary text="认领村庄" @click="show = false; emit('apply')" width="220rpx" />
+      </FlexRow>
+    </FlexCol>
+  </CommonDialog>
+</template>
+
+<script setup lang="ts">
+import CommonDialog from '@/common/components/CommonDialog.vue';
+import FrameButton from '@/common/components/FrameButton.vue';
+import Image from '@/components/basic/Image.vue';
+import Text from '@/components/basic/Text.vue';
+import FlexCol from '@/components/layout/FlexCol.vue';
+import FlexRow from '@/components/layout/FlexRow.vue';
+import { ref } from 'vue';
+
+const show = ref(false);
+const emit = defineEmits(['apply']);
+
+defineExpose({
+  show: () => {
+    show.value = true;
+  },
+});
+</script>

+ 2 - 2
src/pages/index.vue

@@ -88,7 +88,7 @@ onShareTimeline(() => {
   }
 })
 onMounted(() => {
-  if (isDevEnv)
-    tabIndex.value = 1;
+  //if (isDevEnv)
+    //tabIndex.value = 1;
 })
 </script>