Bläddra i källkod

修改细节问题

快乐的梦鱼 2 veckor sedan
förälder
incheckning
5f12e53f5c

+ 4 - 4
package-lock.json

@@ -25,7 +25,7 @@
         "@dcloudio/uni-mp-xhs": "3.0.0-4070620250821001",
         "@dcloudio/uni-quickapp-webview": "3.0.0-4070620250821001",
         "@imengyu/imengyu-utils": "^0.0.16",
-        "@imengyu/js-request-transform": "^0.3.6",
+        "@imengyu/js-request-transform": "^0.3.7",
         "@imengyu/vue-dynamic-form": "^0.1.1",
         "async-validator": "^4.2.5",
         "pinia": "^3.0.1",
@@ -3059,9 +3059,9 @@
       }
     },
     "node_modules/@imengyu/js-request-transform": {
-      "version": "0.3.6",
-      "resolved": "https://registry.npmmirror.com/@imengyu/js-request-transform/-/js-request-transform-0.3.6.tgz",
-      "integrity": "sha512-MeBI2uRWNOwqK0CexCNd831inckQaAp70itpOsN+jneisYOgoV/xTDGnOjj50DJ1NxNyWeja/p8X+EWsz1pLqQ==",
+      "version": "0.3.7",
+      "resolved": "https://registry.npmmirror.com/@imengyu/js-request-transform/-/js-request-transform-0.3.7.tgz",
+      "integrity": "sha512-DeFvljuiOwzJ5gibHaQAFWShetSjgiZUdu98lOpAi4VN2JFOtChmUCUdfzAmjrfy2/MHKLYObbbtghHCco40JQ==",
       "license": "MIT",
       "dependencies": {
         "dayjs": "^1.11.7"

+ 1 - 1
package.json

@@ -52,7 +52,7 @@
     "@dcloudio/uni-mp-xhs": "3.0.0-4070620250821001",
     "@dcloudio/uni-quickapp-webview": "3.0.0-4070620250821001",
     "@imengyu/imengyu-utils": "^0.0.16",
-    "@imengyu/js-request-transform": "^0.3.6",
+    "@imengyu/js-request-transform": "^0.3.7",
     "@imengyu/vue-dynamic-form": "^0.1.1",
     "async-validator": "^4.2.5",
     "pinia": "^3.0.1",

+ 30 - 12
src/pages/dig/details.vue

@@ -14,13 +14,9 @@
         <view class="label">文化积分:</view>
         <view class="value">{{ querys.points }}</view>
       </view>
-      <view class="btn">
-        <text class="iconfont icon-point"></text>
-        积分兑换
-      </view>
     </view>
     <view class="task-list">
-      <view class="item">
+      <view v-if="canCollect('village')" class="item">
         <text class="iconfont icon-task-summary"></text>
         <view class="info">
           <view class="title">村落概况</view>
@@ -28,7 +24,7 @@
         </view>
         <view class="btn" @click="navTo('task/summary', nextPageData)">去完成</view>
       </view>
-      <view class="item">
+      <view v-if="canCollect('cultural')" class="item">
         <text class="iconfont icon-task-history"></text>
         <view class="info">
           <view class="title">历史文化</view>
@@ -38,7 +34,17 @@
           去完成
         </view>
       </view>
-      <view class="item">
+      <view v-if="canCollect('ich')" class="item">
+        <text class="iconfont icon-task-custom-1"></text>
+        <view class="info">
+          <view class="title">非物质文化遗产项目</view>
+          <view class="desc">维护文化多样性</view>
+        </view>
+        <view class="btn" @click="goForm('ich', 0)">
+          去完成
+        </view>
+      </view>
+      <view v-if="canCollect('building')" class="item">
         <text class="iconfont icon-task-environment"></text>
         <view class="info">
           <view class="title">环境格局</view>
@@ -48,7 +54,7 @@
           去完成
         </view>
       </view>
-      <view class="item">
+      <view v-if="canCollect('building')" class="item">
         <text class="iconfont icon-task-building"></text>
         <view class="info">
           <view class="title">传统建筑</view>
@@ -58,7 +64,7 @@
           去完成
         </view>
       </view>
-      <view class="item">
+      <view v-if="canCollect('folk_culture')" class="item">
         <text class="iconfont icon-task-custom"></text>
         <view class="info">
           <view class="title">民俗文化</view>
@@ -68,7 +74,7 @@
           去完成
         </view>
       </view>
-      <view class="item">
+      <view v-if="canCollect('food_product')" class="item">
         <text class="iconfont icon-task-food"></text>
         <view class="info">
           <view class="title">地道美食</view>
@@ -78,7 +84,7 @@
           去完成
         </view>
       </view>
-      <view class="item">
+      <view v-if="canCollect('food_product')" class="item">
         <text class="iconfont icon-task-mine"></text>
         <view class="info">
           <view class="title">物产资源</view>
@@ -88,7 +94,7 @@
           去完成
         </view>
       </view>
-      <view class="item">
+      <view v-if="canCollect('route')" class="item">
         <text class="iconfont icon-task-trip"></text>
         <view class="info">
           <view class="title">旅游路线</view>
@@ -98,6 +104,13 @@
           去完成
         </view>
       </view>
+      <div v-if="!authStore.isAdmin && isEmpty" class="item">
+        <i class="iconfont icon-task-summary"></i>
+        <div class="info">
+          <div class="title">您当前没有可完成的任务</div>
+          <div class="desc">请联系管理员认领可采编栏目</div>
+        </div>
+      </div>
       <view class="item">
         <text class="iconfont icon-task-other"></text>
         <view class="info">
@@ -116,6 +129,8 @@
 import { useLoadQuerys } from '@/common/composeabe/LoadQuerys';
 import { navTo } from '@imengyu/imengyu-utils/dist/uniapp/PageAction';
 import { computed } from 'vue';
+import { useAuthStore } from '@/store/auth';
+import { useCollectStore } from '@/store/collect';
 
 const { querys } = useLoadQuerys({ 
   id: 0,  
@@ -125,6 +140,9 @@ const { querys } = useLoadQuerys({
   villageVolunteerId: 0,
 });
 
+const authStore = useAuthStore();
+const { canCollect, isEmpty } = useCollectStore();
+
 const nextPageData = computed(() => ({
   villageId: querys.value.id,  
   villageVolunteerId: querys.value.villageVolunteerId,

+ 3 - 1
src/pages/dig/task/building.vue

@@ -4,7 +4,7 @@
       <image mode="aspectFill" src="https://mn.wenlvti.net/app_static/xiangan/banner_dig_building.jpg"></image>
     </view>
     <view class="task-list">
-      <view class="item">
+      <view v-if="canCollect('distribution')" class="item">
         <text class="iconfont icon-task-building-1"></text>
         <view class="info">
           <view class="title">建筑分布</view>
@@ -49,7 +49,9 @@
 </template>
 
 <script setup lang="ts">
+import { useCollectStore } from '@/store/collect';
 import { useTaskEntryForm } from '../composeable/TaskEntryForm';
 
 const { goForm } = useTaskEntryForm();
+const { canCollect } = useCollectStore();
 </script>

+ 2 - 0
src/pages/dig/task/custom.vue

@@ -69,7 +69,9 @@
 </template>
 
 <script setup lang="ts">
+import { useCollectStore } from '@/store/collect';
 import { useTaskEntryForm } from '../composeable/TaskEntryForm';
 
 const { goForm } = useTaskEntryForm();
+const { canCollect } = useCollectStore();
 </script>

+ 5 - 3
src/pages/dig/task/environment.vue

@@ -14,7 +14,7 @@
           填写
         </view>
       </view>
-      <view class="item">
+      <view v-if="canCollect('cultural_relic')" class="item">
         <text class="iconfont icon-task-environment-5"></text>
         <view class="info">
           <view class="title">文物古迹</view>
@@ -24,10 +24,10 @@
           填写
         </view>
       </view>
-      <view class="item">
+      <view v-if="canCollect('element')" class="item">
         <text class="iconfont icon-task-environment-6"></text>
         <view class="info">
-          <view class="title">历史环境</view>
+          <view class="title">历史环境要素</view>
           <view class="desc">村民口述历史记录</view>
         </view>
         <view class="btn" @click="goForm('element', 0)">
@@ -39,8 +39,10 @@
 </template>
 
 <script setup lang="ts">
+import { useCollectStore } from '@/store/collect';
 import { useTaskEntryForm } from '../composeable/TaskEntryForm';
 
 const { goForm } = useTaskEntryForm();
+const { canCollect } = useCollectStore();
 </script>
 

+ 2 - 0
src/pages/dig/task/food.vue

@@ -29,7 +29,9 @@
 </template>
 
 <script setup lang="ts">
+import { useCollectStore } from '@/store/collect';
 import { useTaskEntryForm } from '../composeable/TaskEntryForm';
 
+const { canCollect } = useCollectStore();
 const { goForm } = useTaskEntryForm();
 </script>

+ 3 - 1
src/pages/dig/task/history.vue

@@ -34,7 +34,7 @@
           填写
         </view>
       </view>
-      <view class="item">
+      <view v-if="canCollect('story')" class="item">
         <text class="iconfont icon-task-history-4"></text>
         <view class="info">
           <view class="title">掌故轶事</view>
@@ -69,8 +69,10 @@
 </template>
 
 <script setup lang="ts">
+import { useCollectStore } from '@/store/collect';
 import { useTaskEntryForm } from '../composeable/TaskEntryForm';
 
+const { canCollect } = useCollectStore();
 const { goForm } = useTaskEntryForm();
 </script>
 

+ 2 - 0
src/pages/dig/task/mine.vue

@@ -39,7 +39,9 @@
 </template>
 
 <script setup lang="ts">
+import { useCollectStore } from '@/store/collect';
 import { useTaskEntryForm } from '../composeable/TaskEntryForm';
 
+const { canCollect } = useCollectStore();
 const { goForm } = useTaskEntryForm();
 </script>

+ 2 - 0
src/pages/dig/task/summary.vue

@@ -59,8 +59,10 @@
 </template>
 
 <script setup lang="ts">
+import { useCollectStore } from '@/store/collect';
 import { useTaskEntryForm } from '../composeable/TaskEntryForm';
 
+const { canCollect } = useCollectStore();
 const t = useTaskEntryForm();
 
 function goForm(subId: number) {

+ 4 - 2
src/pages/dig/task/trip.vue

@@ -4,7 +4,7 @@
       <image mode="aspectFill" src="https://mn.wenlvti.net/app_static/xiangan/banner_dig_trip.jpg"></image>
     </view>
     <view class="task-list">
-      <view class="item">
+      <view v-if="canCollect('travel_guide')" class="item">
         <text class="iconfont icon-task-trip-3"></text>
         <view class="info">
           <view class="title">旅游导览</view>
@@ -13,7 +13,7 @@
           填写
         </view>
       </view>
-      <view class="item">
+      <view v-if="canCollect('route')" class="item">
         <text class="iconfont icon-task-trip-1"></text>
         <view class="info">
           <view class="title">游览路线</view>
@@ -45,8 +45,10 @@
 </template>
 
 <script setup lang="ts">
+import { useCollectStore } from '@/store/collect';
 import { useTaskEntryForm } from '../composeable/TaskEntryForm';
 
+const { canCollect } = useCollectStore(); 
 const { goForm } = useTaskEntryForm();
 </script>
 

+ 14 - 19
src/pages/index.vue

@@ -4,15 +4,6 @@
       <image mode="aspectFill" src="https://mn.wenlvti.net/app_static/xiangan/banner_submit.jpg"></image>
     </view>
     <view class="main">
-      <template v-if="!villageListLoader.content.value?.length">
-        <view class="cat">
-          <text>村庄认领</text>
-        </view>
-        <u-button type="primary" @click="goClamVillage">
-          <text>+</text>
-          认领新村庄
-        </u-button>
-      </template>
       <view class="cat">
         <text>我的村庄</text>
       </view>
@@ -23,8 +14,8 @@
           :emptyView="{
             text: '你还没有认领的村庄',
             button: true,
-            buttonText: '认领',
-            buttonClick: goClamVillage,
+            buttonText: '联系管理员认领',
+            buttonClick: () => {},
           }"
         >
           <view class="village-list">
@@ -42,15 +33,12 @@
               <view class="info">
                 <view class="name">{{ item.villageName }}</view>
                 <view class="d-flex flex-row align-center">
-                  <view class="btn p-1 pr-2" @click="navTo('/pages/inherit/village/details', { id: item.villageId })">
-                    <text class="iconfont icon-view"></text>预览
+                  <view class="btn p-1 pr-2" @click="goManagePage(item)">
+                    <text class="iconfont icon-view"></text>管理
                   </view>
                   <view class="btn p-1 pr-2 active" @click="goSubmitDigPage(item)">
                     <text class="iconfont icon-search"></text>采编
                   </view>
-                  <view v-if="authStore.isAdmin" class="btn p-1 pr-2 active" @click="goManagePage(item)">
-                    管理
-                  </view>
                 </view>
               </view>
             </view>
@@ -65,7 +53,7 @@
         <view class="retribution">
           <view class="item">
             <text class="iconfont icon-total-points"></text>
-            <view class="num">{{ volunteerInfoLoader.content.value?.points }}</view>
+            <view class="num">{{ volunteerInfoLoader.content.value?.points || 0 }}</view>
             <view>文化积分</view>
           </view>
           <view>
@@ -73,7 +61,7 @@
           </view>
           <view class="item">
             <text class="iconfont icon-level"></text>
-            <view class="level">Lv.{{ volunteerInfoLoader.content.value?.level }}</view>
+            <view class="level">Lv.{{ volunteerInfoLoader.content.value?.level || 1 }}</view>
             <view>等级</view>
           </view>
         </view>
@@ -91,10 +79,17 @@ import { useReqireLogin } from '@/common/composeabe/RequireLogin';
 import { useSimpleDataLoader } from '@/common/composeabe/SimpleDataLoader';
 import { useAuthStore } from '@/store/auth';
 import { navTo } from '@imengyu/imengyu-utils/dist/uniapp/PageAction';
+import { useCollectStore } from '@/store/collect';
 
 const authStore = useAuthStore();
+const collectStore = useCollectStore();
 const villageListLoader = useSimpleDataLoader(async () => await VillageApi.getClaimedVallageList(), true);
-const volunteerInfoLoader = useSimpleDataLoader(async () => await VillageApi.getVolunteerInfo(), true);
+const volunteerInfoLoader = useSimpleDataLoader(async () =>{
+  const res = await VillageApi.getVolunteerInfo();
+  const collectableModules = (volunteerInfoLoader.content.value?.collectModule as string)?.split(',') || [];
+  collectStore.setCollectableModules(collectableModules);
+  return res;
+}, true);
 const rankListLoader = useSimpleDataLoader(async () => await VillageApi.getVolunteerRanklist(), true);
 
 const { requireLogin } = useReqireLogin();

+ 26 - 0
src/store/collect.ts

@@ -0,0 +1,26 @@
+import { computed, ref } from 'vue'
+import { defineStore } from 'pinia'
+import { useAuthStore } from './auth';
+
+export const useCollectStore = defineStore('collect', () => {
+  const collectableModules = ref<string[]>([]);
+  const authStore = useAuthStore();
+
+  function setCollectableModules(modules: string[]) {
+    collectableModules.value = modules;
+  }
+  function canCollect(module: string) {
+    if (authStore.isAdmin)
+      return true;
+    return collectableModules.value.includes(module);
+  }
+  
+  const isEmpty = computed(() => collectableModules.value.length === 0);
+
+  return { 
+    isEmpty,
+    collectableModules,
+    setCollectableModules,
+    canCollect,
+  }
+})