|
|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <FlexCol :padding="30">
|
|
|
+ <FlexCol padding="space.md" gap="space.md">
|
|
|
<Result v-if="error"
|
|
|
:title="error"
|
|
|
/>
|
|
|
@@ -11,8 +11,27 @@
|
|
|
:innerStyle="{ width: querys.isView ? '600rpx' : '460rpx' }"
|
|
|
@search="search"
|
|
|
/>
|
|
|
- <Button v-if="!querys.isView" type="primary" @click="newData">+ 新增</Button>
|
|
|
+ <Button v-if="!querys.isView" type="primary" @click="newData">+ 编写</Button>
|
|
|
</FlexRow>
|
|
|
+ <FlexCol
|
|
|
+ v-if="!volunteerInfo"
|
|
|
+ center
|
|
|
+ gap="gap.lg"
|
|
|
+ border="primary"
|
|
|
+ backgroundColor="background.tertiary"
|
|
|
+ radius="radius.md"
|
|
|
+ padding="padding.md"
|
|
|
+ >
|
|
|
+ <Image
|
|
|
+ src="https://xy.wenlvti.net/app_static/images/village/PlaceholderVolunteer.png"
|
|
|
+ mode="widthFix"
|
|
|
+ :width="200"
|
|
|
+ :height="200"
|
|
|
+ />
|
|
|
+ <Text>您还不是当前村社的志愿者</Text>
|
|
|
+ <Text>欢迎注册,加入志愿者队伍,点亮村落</Text>
|
|
|
+ <Button type="primary" @click="goJoin">去点亮村落</Button>
|
|
|
+ </FlexCol>
|
|
|
<Height :height="20" />
|
|
|
<FlexCol :gap="20">
|
|
|
<Touchable
|
|
|
@@ -59,13 +78,15 @@
|
|
|
<script setup lang="ts">
|
|
|
import { ref } from 'vue';
|
|
|
import { onPullDownRefresh } from '@dcloudio/uni-app';
|
|
|
-import { alert } from '@/components/dialog/CommonRoot';
|
|
|
import { DataDateUtils } from '@imengyu/js-request-transform';
|
|
|
import { useSimplePageListLoader } from '@/components/composeabe/loader/SimplePageListLoader';
|
|
|
import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
|
|
|
import { useCollectStore } from '@/store/collect';
|
|
|
import { useAuthStore } from '@/store/auth';
|
|
|
+import { TaskMenuDef, type TaskMenuDefGoForm, type TaskMenuDefItem } from './tasks';
|
|
|
+import { useUserTools } from '@/common/composeabe/UserTools';
|
|
|
import { navTo } from '@/components/utils/PageAction';
|
|
|
+import { confirm, alert } from '@/components/utils/DialogAction';
|
|
|
import SimplePageListLoader from '@/components/loader/SimplePageListLoader.vue';
|
|
|
import VillageInfoApi from '@/api/inhert/VillageInfoApi';
|
|
|
import Image from '@/components/basic/Image.vue';
|
|
|
@@ -79,12 +100,12 @@ 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 { getIsVolunteer, volunteerInfo } = useUserTools();
|
|
|
const authStore = useAuthStore();
|
|
|
const error = ref('');
|
|
|
|
|
|
@@ -106,15 +127,13 @@ const listLoader = useSimplePageListLoader<{
|
|
|
throw new Error("params.subType");
|
|
|
if (!params.villageId)
|
|
|
throw new Error("params.villageId");
|
|
|
- if (!params.villageVolunteerId)
|
|
|
- throw new Error("params.villageId");
|
|
|
let res = await VillageInfoApi.getList(
|
|
|
collectStore.getCollectModuleId(params.subType),
|
|
|
params.subType,
|
|
|
params.subKey ? params.subId : undefined,
|
|
|
params.subKey,
|
|
|
params.villageId,
|
|
|
- querys.value.isView && authStore.isAdmin ? undefined : params.villageVolunteerId,
|
|
|
+ querys.value.isView && authStore.isAdmin && params.villageVolunteerId ? undefined : params.villageVolunteerId,
|
|
|
querys.value.catalogId,
|
|
|
page,
|
|
|
pageSize,
|
|
|
@@ -135,9 +154,21 @@ const listLoader = useSimplePageListLoader<{
|
|
|
list: list,
|
|
|
total: list.length,
|
|
|
};
|
|
|
-});
|
|
|
+}, false);
|
|
|
|
|
|
function newData() {
|
|
|
+ if (!volunteerInfo.value) {
|
|
|
+ confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: "您还不是当前村社的志愿者,请先加入志愿者队伍",
|
|
|
+ confirmText: '去点亮村落',
|
|
|
+ }).then((res) => {
|
|
|
+ if (res) {
|
|
|
+ goJoin();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (querys.value.isView) {
|
|
|
alert({ title: '提示', content: "查看模式下不能新增数据" });
|
|
|
return;
|
|
|
@@ -167,6 +198,11 @@ function goDetail(id: number) {
|
|
|
function search() {
|
|
|
listLoader.reload();
|
|
|
}
|
|
|
+function goJoin() {
|
|
|
+ navTo('/pages/home/light/submit', {
|
|
|
+ villageId: querys.value.villageId,
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
const { querys } = useLoadQuerys({
|
|
|
taskName: '',
|
|
|
@@ -180,33 +216,45 @@ const { querys } = useLoadQuerys({
|
|
|
subTitle: '',
|
|
|
isView: false,
|
|
|
}, async (querys) => {
|
|
|
+
|
|
|
if (querys.taskName) {
|
|
|
//普通用户进入预览模式
|
|
|
+ await getIsVolunteer();
|
|
|
+
|
|
|
const menuDef = TaskMenuDef[querys.taskName];
|
|
|
if (!menuDef) {
|
|
|
error.value = '任务不存在';
|
|
|
return;
|
|
|
}
|
|
|
- if (!querys.taskFindCatalogName) {
|
|
|
- error.value = '查询目录名称不能为空';
|
|
|
- return;
|
|
|
+ let catalog : TaskMenuDefItem | undefined ;
|
|
|
+ if (querys.taskFindCatalogName) {
|
|
|
+ querys.subTitle = querys.taskFindCatalogName;
|
|
|
+ catalog = menuDef.list.find((p) => p.name === querys.taskFindCatalogName);
|
|
|
+ } else {
|
|
|
+ catalog = menuDef.list[0];
|
|
|
}
|
|
|
- const catalog = menuDef.list.find((p) => p.name === querys.taskFindCatalogName);
|
|
|
- if (!catalog) {
|
|
|
+ if (!catalog || !catalog.goForm) {
|
|
|
error.value = '查询目录不存在';
|
|
|
return;
|
|
|
}
|
|
|
- querys.catalogId = catalog.id;
|
|
|
+ const goForm = catalog.goForm as TaskMenuDefGoForm;
|
|
|
+ querys.subType = goForm[0];
|
|
|
+ querys.subId = goForm[1];
|
|
|
+ querys.subKey = goForm[2] || 'type';
|
|
|
+ querys.subTitle = goForm[4] || querys.subTitle;
|
|
|
+ querys.catalogId = goForm[5] || 0;
|
|
|
+ querys.villageVolunteerId = volunteerInfo.value?.id || 0;
|
|
|
listLoader.load(false, querys)
|
|
|
|
|
|
} else {
|
|
|
//原有采集页进入
|
|
|
- if (querys.subTitle) {
|
|
|
- subTitle.value = querys.subTitle;
|
|
|
- uni.setNavigationBarTitle({ title: subTitle.value + '列表', })
|
|
|
- }
|
|
|
listLoader.load(false, querys)
|
|
|
}
|
|
|
+
|
|
|
+ if (querys.subTitle) {
|
|
|
+ subTitle.value = querys.subTitle;
|
|
|
+ uni.setNavigationBarTitle({ title: subTitle.value + '列表', })
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
onPullDownRefresh(() => {
|