Quellcode durchsuchen

📦 修改主页细节问题

快乐的梦鱼 vor 1 Monat
Ursprung
Commit
29a58ed872

+ 25 - 0
src/common/composeabe/UserTools.ts

@@ -0,0 +1,25 @@
+import VillageApi from "@/api/inhert/VillageApi";
+import { useAuthStore } from "@/store/auth";
+
+export function useUserTools() {
+
+  const authStore = useAuthStore();
+
+  async function getIsVolunteer() {
+
+    if (!authStore.isLogged) {
+      return false;
+    }
+
+    try {
+      const volunteerInfo = await VillageApi.getVolunteerInfo();
+      return volunteerInfo !== null;
+    } catch {
+      return false;
+    }
+  }
+
+  return {
+    getIsVolunteer,
+  };
+}

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

@@ -9,12 +9,16 @@ export function configAppTheme() {
     theme.colorConfigs.background.primary = '#fef2e8';
     theme.colorConfigs.background.secondary = '#f7f8f9';
     theme.colorConfigs.background.tertiary = '#fff7f1';
+    theme.colorConfigs.background.quaternary = '#fff4d8';
 
     theme.colorConfigs.text.title = '#62422f';
     theme.colorConfigs.text.content = '#7b5e49';
     theme.colorConfigs.text.second = '#95755a';
     theme.colorConfigs.text.titleLight = '#55989a';
 
+    theme.colorConfigs.border.primary = '#55989a';
+    theme.colorConfigs.border.secondary = '#5F3F2C';
+
     theme.varOverrides.radius.xs = '5rpx';
     theme.varOverrides.radius.sm = '10rpx';
     theme.varOverrides.radius.md = '20rpx';

+ 5 - 5
src/pages.json

@@ -41,7 +41,7 @@
     {
       "path": "pages/home/light/details",
       "style": {
-        "navigationBarTitleText": "村详情",
+        "navigationBarTitleText": "村详情",
         "enablePullDownRefresh": false
       }
     },
@@ -55,14 +55,14 @@
     {
       "path": "pages/home/light/submit",
       "style": {
-        "navigationBarTitleText": "点亮村",
+        "navigationBarTitleText": "点亮村",
         "enablePullDownRefresh": false
       }
     },
     {
       "path": "pages/home/light/submit-map",
       "style": {
-        "navigationBarTitleText": "选择点亮村",
+        "navigationBarTitleText": "选择点亮村",
         "enablePullDownRefresh": false
       }
     },
@@ -85,7 +85,7 @@
     {
       "path": "pages/home/village/rank/village",
       "style": {
-        "navigationBarTitleText": "村排名",
+        "navigationBarTitleText": "村排名",
         "navigationStyle": "custom",
         "enablePullDownRefresh": false
       }
@@ -238,7 +238,7 @@
         {
           "path": "admin/preview",
           "style": {
-            "navigationBarTitleText": "村预览",
+            "navigationBarTitleText": "村预览",
             "enablePullDownRefresh": false
           }
         },

+ 2 - 2
src/pages/dig/admin/data/volunteer.ts

@@ -159,8 +159,8 @@ export function getVolunteerForm(options: {
             } as CheckBoxTreeListProps,
           }]: []),
           { 
-            label: '村认领说明', name: 'claimReason', type: 'text', 
-            additionalProps: { placeholder: '请输入村认领说明' } ,
+            label: '村认领说明', name: 'claimReason', type: 'text', 
+            additionalProps: { placeholder: '请输入村认领说明' } ,
             show: { callback: () => options.isNew.value },
           },
         ]

+ 1 - 1
src/pages/dig/admin/preview.vue

@@ -14,7 +14,7 @@
         small
         :descItems="[
           {
-            label: '村类型',
+            label: '村类型',
             value: overviewLoader.content.value.villageTypeText ,
           },
           {

+ 2 - 2
src/pages/dig/components/TaskList.vue

@@ -18,11 +18,11 @@ defineProps({
   },
   title: {
     type: String,
-    default: '村概况',
+    default: '村概况',
   },
   desc: {
     type: String,
-    default: '探索村的历史渊源与发生轨迹',
+    default: '探索村的历史渊源与发生轨迹',
   },
   button: {
     type: Boolean,

+ 82 - 50
src/pages/dig/forms/list.vue

@@ -1,52 +1,57 @@
 <template>
   <FlexCol :padding="30">
-    <FlexRow justify="space-between">
-      <SearchBar
-        v-model="searchText"
-        placeholder="搜一搜" 
-        :innerStyle="{ width: querys.isView ? '600rpx' : '460rpx' }"
-        @search="search"
-      />
-      <Button v-if="!querys.isView" type="primary" @click="newData">+ 新增</Button>
-    </FlexRow>
-    <Height :height="20" />
-    <FlexCol :gap="20">
-      <Touchable 
-        v-for="item in listLoader.list.value"
-        :key="item.id" 
-        :gap="20"
-        :padding="[15,20]"
-        radius="radius.md"
-        align="center"
-        backgroundColor="white"
-        direction="row"
-        touchable
-        @click="goDetail(item.id)"
-      >
-        <Image 
-          :src="item.image"
-          :showFailed="false"
-          :width="100"
-          :height="100"
-          radius="radius.sm"
-          mode="aspectFill"
-          round
+    <Result v-if="error" 
+      :title="error"
+    />
+    <template v-else>
+      <FlexRow justify="space-between">
+        <SearchBar
+          v-model="searchText"
+          placeholder="搜一搜" 
+          :innerStyle="{ width: querys.isView ? '600rpx' : '460rpx' }"
+          @search="search"
         />
-        <FlexCol>
-          <H4 :size="36">{{ item.title }}</H4>
-          <Text :size="23">{{ item.desc }}</Text>
-        </FlexCol>
-      </Touchable>
-    </FlexCol>
-    <SimplePageListLoader :loader="listLoader" :noEmpty="true">
-      <template #empty>
-        <Empty v-if="querys.isView" image="search" description="暂无数据,等待志愿者编写中..." />
-        <Empty v-else image="search" description="这里还没有数据,快来编写完善吧!">
-          <Height :height="40" />
-          <Button type="primary" :text="`+ 新增${subTitle}数据`" @click="newData" />
-        </Empty>
-      </template>
-    </SimplePageListLoader>
+        <Button v-if="!querys.isView" type="primary" @click="newData">+ 新增</Button>
+      </FlexRow>
+      <Height :height="20" />
+      <FlexCol :gap="20">
+        <Touchable 
+          v-for="item in listLoader.list.value"
+          :key="item.id" 
+          :gap="20"
+          :padding="[15,20]"
+          radius="radius.md"
+          align="center"
+          backgroundColor="white"
+          direction="row"
+          touchable
+          @click="goDetail(item.id)"
+        >
+          <Image 
+            :src="item.image"
+            :showFailed="false"
+            :width="100"
+            :height="100"
+            radius="radius.sm"
+            mode="aspectFill"
+            round
+          />
+          <FlexCol>
+            <H4 :size="36">{{ item.title }}</H4>
+            <Text :size="23">{{ item.desc }}</Text>
+          </FlexCol>
+        </Touchable>
+      </FlexCol>
+      <SimplePageListLoader :loader="listLoader" :noEmpty="true">
+        <template #empty>
+          <Empty v-if="querys.isView" image="search" description="暂无数据,等待志愿者编写中..." />
+          <Empty v-else image="search" description="这里还没有数据,快来编写完善吧!">
+            <Height :height="40" />
+            <Button type="primary" :text="`+ 新增${subTitle}数据`" @click="newData" />
+          </Empty>
+        </template>
+      </SimplePageListLoader>
+    </template>
     <XBarSpace />
   </FlexCol>
 </template>
@@ -74,11 +79,14 @@ import Height from '@/components/layout/space/Height.vue';
 import H4 from '@/components/typography/H4.vue';
 import Touchable from '@/components/feedback/Touchable.vue';
 import XBarSpace from '@/components/layout/space/XBarSpace.vue';
+import { TaskMenuDef } from './tasks';
+import Result from '@/components/feedback/Result.vue';
 
 const subTitle = ref('');
 const searchText = ref('');
 const collectStore = useCollectStore();
 const authStore = useAuthStore();
+const error = ref('');
 
 const listLoader = useSimplePageListLoader<{
   id: number,
@@ -161,6 +169,8 @@ function search() {
 }
 
 const { querys } = useLoadQuerys({ 
+  taskName: '',
+  taskFindCatalogName: '',
   villageId: 0,  
   villageVolunteerId: 0,
   catalogId: 0,
@@ -170,11 +180,33 @@ const { querys } = useLoadQuerys({
   subTitle: '',
   isView: false,
 }, async (querys) => {
-  if (querys.subTitle) {
-    subTitle.value = querys.subTitle;
-    uni.setNavigationBarTitle({  title: subTitle.value + '列表', })
+  if (querys.taskName) {
+    //普通用户进入预览模式
+    const menuDef = TaskMenuDef[querys.taskName];
+    if (!menuDef) {
+      error.value = '任务不存在';
+      return;
+    }
+    if (!querys.taskFindCatalogName) {
+      error.value = '查询目录名称不能为空';
+      return;
+    }
+    const catalog = menuDef.list.find((p) => p.name === querys.taskFindCatalogName);
+    if (!catalog) {
+      error.value = '查询目录不存在';
+      return;
+    }
+    querys.catalogId = catalog.id;
+    listLoader.load(false, querys)
+
+  } else {
+    //原有采集页进入
+    if (querys.subTitle) {
+      subTitle.value = querys.subTitle;
+      uni.setNavigationBarTitle({  title: subTitle.value + '列表', })
+    }
+    listLoader.load(false, querys)
   }
-  listLoader.load(false, querys)
 });
 
 onPullDownRefresh(() => {

+ 11 - 11
src/pages/dig/forms/tasks.ts

@@ -19,13 +19,13 @@ export type TaskMenuDefItem = {
 
 export const TaskRootDef : TaskMenuDefItem[] = [
   {
-    title: '村概况',
-    desc: '探索村的历史渊源与发生轨迹',
+    title: '村概况',
+    desc: '探索村的历史渊源与发生轨迹',
     icon: 'icon-task-summary',
     enable: 'overview',
     name: 'overview',
     goForm: {
-      title: '村概况',
+      title: '村概况',
       name: 'overview',
     }
   },
@@ -122,7 +122,7 @@ export const TaskMenuDef : Record<string, TaskMenuDefGroup> = {
     list: [
       {
         title: '建筑分布',
-        desc: '村内传统建筑分布情况',
+        desc: '村内传统建筑分布情况',
         icon: 'icon-task-building-1',
         enable: 'distribution',
         goForm: [ 'distribution', 0, undefined, undefined, '建筑分布', undefined ],
@@ -195,7 +195,7 @@ export const TaskMenuDef : Record<string, TaskMenuDefGroup> = {
     list: [
       {
         title: '自然环境',
-        desc: '村建立与发展历程',
+        desc: '村建立与发展历程',
         icon: 'icon-task-environment-1',
         enable: 'environment',
         goForm: [ 'environment', 0, undefined, undefined, '自然环境', undefined ],
@@ -240,7 +240,7 @@ export const TaskMenuDef : Record<string, TaskMenuDefGroup> = {
     list: [
       {
         title: '建村历史',
-        desc: '村建立与发展历程',
+        desc: '村建立与发展历程',
         icon: 'icon-task-history-1',
         enable: 'cultural',
         goForm: [ 'cultural', 1, 'culturalType', undefined, '建村历史', undefined ],
@@ -320,17 +320,17 @@ export const TaskMenuDef : Record<string, TaskMenuDefGroup> = {
     list: [
       {
         title: '行政区划',
-        desc: '村行政区域划分及变迁',
+        desc: '村行政区域划分及变迁',
         icon: 'icon-task-summary-1',
         enable: 'overview',
         goForm: [ 'overview', 1, undefined, 'common', '行政区划', undefined ],
       },
       {
-        title: '村综述',
-        desc: '村整体概况介绍',
+        title: '村综述',
+        desc: '村整体概况介绍',
         icon: 'icon-task-summary-5',
         enable: 'overview',
-        goForm: [ 'overview', 5, undefined, 'common', '村综述', undefined ],
+        goForm: [ 'overview', 5, undefined, 'common', '村综述', undefined ],
       },
       {
         title: '地理信息',
@@ -341,7 +341,7 @@ export const TaskMenuDef : Record<string, TaskMenuDefGroup> = {
       },
       {
         title: '建设与保护',
-        desc: '村发展与文化遗产保护',
+        desc: '村发展与文化遗产保护',
         icon: 'icon-task-summary-3',
         enable: 'overview',
         goForm: [ 'overview', 3, undefined, 'common', '建设与保护', undefined ],

+ 1 - 1
src/pages/home/light/form/claim.ts

@@ -117,7 +117,7 @@ export function getClaimVillageForm(options: {
             name: 'claimReason',
             type: 'textarea',
             additionalProps: {
-              placeholder: '请说明认领该村的原因',
+              placeholder: '请说明认领该村的原因',
               showWordLimit: true,
               maxLength: 200,
             } as FieldProps,

+ 14 - 2
src/pages/home/light/form/volunteer.ts

@@ -120,6 +120,18 @@ export function getVolunteerForm(options: {
             } as RadioValueProps,
             rules: [{ required: true, message: '请选择类型' }],
           },
+          {
+            label: '类型', name: 'residentStatus', type: 'radio-value',
+            additionalProps: {
+              options: [
+                { text: '在村劳作', value: 1 },
+                { text: '社区居民', value: 2 },
+                { text: '在外游子', value: 3 },
+                { text: '退休人员', value: 4 },
+              ]
+            } as RadioValueProps,
+            rules: [{ required: true, message: '请选择类型' }],
+          },
           { 
             label: '工作单位', name: 'unit', type: 'text', additionalProps: { placeholder: '请输入手机号' } ,
             rules: [{ required: true, message: '请输入手机号' }],
@@ -159,8 +171,8 @@ export function getVolunteerForm(options: {
             } as CheckBoxTreeListProps,
           }]: []),
           { 
-            label: '村认领说明', name: 'claimReason', type: 'text', 
-            additionalProps: { placeholder: '请输入村认领说明' } ,
+            label: '村认领说明', name: 'claimReason', type: 'text', 
+            additionalProps: { placeholder: '请输入村认领说明' } ,
             show: { callback: () => options.isNew.value },
           },
         ]

+ 6 - 4
src/pages/home/light/submit.vue

@@ -15,7 +15,7 @@
       <FlexCol v-else-if="step === 'add'">
         <Alert 
           type="info"
-          message="您已经是志愿者,请填写以下信息,认领当前村"
+          message="您已经是志愿者,请填写以下信息,认领当前村"
         />
         <DynamicForm
           ref="addFormRef"
@@ -31,7 +31,7 @@
         status="success"
         :title="finishedMode === 'claim' ? '认领申请已提交' : '注册志愿者成功'"
         :description="finishedMode === 'claim'
-          ? '请等待管理员审核认领申请,审核通过后即可采编该村文化资源'
+          ? '请等待管理员审核认领申请,审核通过后即可采编该村文化资源'
           : '请等待管理员审核,在此期间,可以在社区中先逛逛,学习如何采编村社文化资源信息吧'"
       >
         <Height :size="20" />
@@ -49,7 +49,7 @@
         
         <Icon icon="smile-filling" color="primary" :size="156" />
         <Height :height="20" />
-        <Text :fontSize="26" color="primary" text="欢迎注册,加入志愿者队伍,点亮村" />
+        <Text :fontSize="26" color="primary" text="欢迎注册,加入志愿者队伍,点亮村" />
         <Height :size="40" />
 
         <!-- #ifdef MP-WEIXIN -->
@@ -88,6 +88,7 @@ import { waitTimeOut } from '@imengyu/imengyu-utils';
 import { fillClaimFromVolunteer, getClaimVillageForm } from './form/claim';
 import { getVolunteerForm } from './form/volunteer';
 import Alert from '@/components/feedback/Alert.vue';
+import { useUserTools } from '@/common/composeabe/UserTools';
 
 /**
  * 点亮村社页面
@@ -95,6 +96,7 @@ import Alert from '@/components/feedback/Alert.vue';
 
 const authStore = useAuthStore();
 const { init } = useAppInit();
+const { getIsVolunteer } = useUserTools();
 
 const { querys } = useLoadQuerys({ 
   villageId: 0,  
@@ -110,7 +112,7 @@ onMounted(async () => {
     return;
   }
 
-  //如果已登录,则尝试获取志愿者信息,有注册志愿者,则显示认领当前村表单
+  //如果已登录,则尝试获取志愿者信息,有注册志愿者,则显示认领当前村表单
   if (authStore.isLogged) {
     try {
       const volunteerInfo = await VillageApi.getVolunteerInfo();

+ 28 - 20
src/pages/home/village/introd/card.vue

@@ -156,18 +156,26 @@
     <VillageUserRankList :list="villageUserRankListLoader.content.value ?? []" />
 
     <!-- 魅力乡源 -->
-    <HomeTitle title="魅力乡源" showMore>
+    <HomeTitle title="魅力乡源" showMore @moreClicked="handleGoCollect()">
       <template #right>
-        <BackgroundImageButton 
-          backgroundImage="https://xy.wenlvti.net/app_static/images/village/TagActive.png"
-          :backgroundCutBorder="[10, 10, 10, 10]"
-          :backgroundCutBorderSize="[10, 10, 10, 10]"
+        <Touchable 
           :padding="[15, 20]"
-          :innerStyle="{ marginRight: '20rpx' }"
+          :innerStyle="{ 
+            marginRight: '20rpx'
+          }"
+          borderStyle="solid"
+          borderColor="border.secondary"
+          borderWidth="1px"
+          backgroundColor="background.quaternary"
+          radius="radius.md"
+          direction="row"
+          center
+          gap="gap.sm"
+          @click="handleGoCollect()"
         >
           <Icon name="https://xy.wenlvti.net/app_static/images/village/IconHistory.png" :size="30" />
-          <Text text="共编村史" fontConfig="contentText" color="white" />
-        </BackgroundImageButton>
+          <Text text="共编村史" fontConfig="contentText" />
+        </Touchable>
       </template>
     </HomeTitle>
     <ProvideVar :vars="{
@@ -200,7 +208,7 @@
         <GridItem title="乡源荣光" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeHornor.png" touchable />
         <GridItem title="乡源好物" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeGoods.png" touchable />
         <GridItem title="乡源树" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeTree.png" touchable />
-        <GridItem title="共编村史" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeIndustry.png" touchable />
+        <GridItem title="政贤连心" icon="https://xy.wenlvti.net/app_static/images/village/IconGovAffairs.png" touchable />
         <GridItem title="互动游戏" icon="https://xy.wenlvti.net/app_static/images/village/IconLargeGame.png" touchable />
       </Grid>
     </ProvideVar>
@@ -214,8 +222,12 @@
           :backgroundCutBorderSize="[10, 10, 10, 10]"
           :padding="[15, 20]"
           :innerStyle="{ marginRight: '20rpx' }"
+          direction="row"
+          center
+          gap="gap.sm"
           @click="handleGoPublish()"
         >
+          <Icon name="https://xy.wenlvti.net/app_static/images/village/IconLargeHistory.png" :size="30" />
           <Text text="去发布" fontConfig="contentText" color="white" />
         </BackgroundImageButton>
       </template>
@@ -281,8 +293,10 @@ import LightVillageApi from '@/api/light/LightVillageApi';
 import SimplePageListLoader from '@/components/loader/SimplePageListLoader.vue';
 import Construction from '@/common/components/Construction.vue';
 import VillageApi from '@/api/inhert/VillageApi';
+import { useUserTools } from '@/common/composeabe/UserTools';
 
 const authStore = useAuthStore();
+const { getIsVolunteer } = useUserTools();
 const { requireLogin } = useReqireLogin();
 const villageStore = useVillageStore();
 const { isFollowed, onFollow, onUnFollow } = useFollow();
@@ -337,19 +351,14 @@ watch(rankActiveTag, () => {
 const meIsVolunteer = ref(false);
 const myJoinedVillagesLoader = useSimpleDataLoader(async () => {
   try {
-    try {
-      await VillageApi.getVolunteerInfo();
-      meIsVolunteer.value = true;
-    } catch (error) {
-      meIsVolunteer.value = false;
+    meIsVolunteer.value = await getIsVolunteer();
+    if (!meIsVolunteer.value) 
       return [];
-    }
     return await VillageApi.getClaimedVallageList();
   } catch (error) {
     return [];
   }
 });
-
 const isJoined = computed(() => {
   return myJoinedVillagesLoader.content.value?.some(p => p.id === villageStore.currentVillage?.id) ?? false;
 });
@@ -376,18 +385,17 @@ function handleGoJoin() {
 function handleGoNew() {
   navTo('/pages/home/light/help/new');
 }
-function handleGoCollect(taskName: string) {
-  navTo('/pages/dig/forms/task', {
+function handleGoCollect(taskName?: string) {
+  navTo('/pages/dig/forms/list', {
     villageId: villageStore.currentVillage?.id ?? undefined,
     taskName: taskName,
-    taskPid: -1,
   });
 }
 function handleGoPublish() {
   if (!authStore.isLogged) {
     confirm({
       title: '提示',
-      content: '登录后就可以发布村贴图了',
+      content: '登录后就可以发布村贴图了',
       confirmText: '去登录',
     }).then((res) => {
       if (res) {

+ 1 - 1
src/pages/home/village/rank/village.vue

@@ -7,7 +7,7 @@
     minHeight: '100vh',
   }">
     <StatusBarSpace />
-    <NavBar title="村排名" leftButton="back" />
+    <NavBar title="村排名" leftButton="back" />
     <FlexCol gap="gap.lg" padding="space.md">
       <BackgroundBox
         v-for="(item, index) in villageRankListLoader.content.value"