Selaa lähdekoodia

我的投稿列表

快乐的梦鱼 1 kuukausi sitten
vanhempi
commit
a7d384115e

+ 4 - 2
src/api/inhert/VillageInfoApi.ts

@@ -80,6 +80,8 @@ export class CommonInfoModel extends DataModel<CommonInfoModel> {
   image = '';
   images = [] as string[];
   content = '';
+  catalogId = 0;
+  collectModuleId = 0;
   villageId = 0;
   villageVolunteerId = 0;
   villageName = '';
@@ -217,7 +219,7 @@ export class VillageInfoApi extends AppServerRequestModule<DataModel> {
       id,
     }, '通用获取信息详情', undefined, modelClassCreator)).data as T
   }
-  async getList<T extends DataModel = VillageListItem>(
+  async getList<T extends DataModel = CommonInfoModel>(
     collectModuleId: number|undefined,
     subType: string,
     subId: number|undefined,
@@ -227,7 +229,7 @@ export class VillageInfoApi extends AppServerRequestModule<DataModel> {
     catalogId?: number|undefined,
     page?: number,
     pageSize?: number,
-    modelClassCreator: (new () => T) = VillageListItem as any 
+    modelClassCreator: (new () => T) = CommonInfoModel as any 
   ) {
     return (this.post(`/village/collect/list`, {
       collect_module_id: collectModuleId,

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

@@ -12,6 +12,7 @@
     :loadmoreText="loader.loadError.value" 
     @loadmore="handleRetry" 
   />
+  <slot v-else />
 </template>
 
 <script setup lang="ts">

+ 2 - 2
src/components/basic/Image.vue

@@ -157,7 +157,7 @@ function handleClick() {
     emit('click');
 }
 function loadSrcState() {
-  if (props.src) {
+  if (props.src || props.defaultImage) {
     isErrorState.value = false;
     isLoadState.value = true;
   } else {
@@ -176,7 +176,7 @@ function measureImage() {
 }
 
 watch(() => props.src, (newVal, oldVal) => {
-  if (!newVal) {
+  if (!newVal && !props.defaultImage) {
     isErrorState.value = true;
     isLoadState.value = false;
   } else

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

@@ -174,6 +174,7 @@ function doDeleteUser(item: VolunteerInfo) {
     content: `请注意:删除${item.name}后将无法继续登录,请确认此账号不再继续使用。`,
     confirmColor: 'danger',
     confirmCountDown: 10,
+    width: 560,
   }).then((res) => {
     if (res) {
       VillageApi.deleteVolunteer(item.id, querys.value.villageId).then(() => {

+ 53 - 43
src/pages/dig/forms/submits.vue

@@ -15,28 +15,48 @@
         <Touchable 
           v-for="item in listLoader.list.value"
           :key="item.id" 
-          :gap="20"
           :padding="[15,20]"
           :radius="15"
+          justify="space-between"
           align="center"
           backgroundColor="white"
           direction="row"
           touchable
-          @click="goDetail(item.id)"
+          @click="goDetail(item)"
         >
-          <Image 
-            :src="item.image"
-            :showFailed="false"
-            :width="100"
-            :height="100"
-            :radius="10"
-            mode="aspectFill"
-            round
-          />
-          <FlexCol>
-            <H4 :size="36">{{ item.title }}</H4>
-            <Text :size="23">{{ item.desc }}</Text>
-          </FlexCol>
+          <FlexRow align="center" :gap="20">
+            <Image 
+              :src="item.image"
+              :showFailed="false"
+              :width="150"
+              :height="150"
+              :radius="10"
+              mode="aspectFill"
+              round
+            />
+            <FlexCol>
+              <H4 :size="36">{{ item.title }}</H4>
+              <Height :height="10" />
+              <Text :size="23" :text="`栏目: ${item.catalogName}`" />
+              <Text :size="23" :text="`时间: ${DataDateUtils.formatDate(item.updatedAt, 'YYYY-MM-dd')}`" />
+              <FlexRow align="center">
+                <Text :size="23" :text="`状态:`" />
+                <Tag 
+                  size="small"
+                  :text="(item.statusText as string)" 
+                  :type="selectObjectByType(item.status as string, '0', {
+                    '-1': 'danger',
+                    '0': 'default',
+                    '1': 'warning',
+                    '2': 'primary',
+                    '3': 'primary',
+                    '4': 'success',
+                  })" 
+                />
+              </FlexRow>
+            </FlexCol>
+          </FlexRow>
+          <Icon icon="arrow-right-bold" color="primary" :size="36" />
         </Touchable>
       </FlexCol>
     </SimplePageListLoader>
@@ -52,9 +72,10 @@ import { useSimplePageListLoader } from '@/common/composeabe/SimplePageListLoade
 import { useLoadQuerys } from '@/common/composeabe/LoadQuerys';
 import { useCollectStore } from '@/store/collect';
 import { useAuthStore } from '@/store/auth';
+import { selectObjectByType } from '@/components/theme/ThemeTools';
 import { navTo } from '@/components/utils/PageAction';
 import SimplePageListLoader from '@/common/components/SimplePageListLoader.vue';
-import VillageInfoApi from '@/api/inhert/VillageInfoApi';
+import VillageInfoApi, { CommonInfoModel } from '@/api/inhert/VillageInfoApi';
 import Image from '@/components/basic/Image.vue';
 import Empty from '@/components/feedback/Empty.vue';
 import SearchBar from '@/components/form/SearchBar.vue';
@@ -64,54 +85,43 @@ 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 FlexRow from '@/components/layout/FlexRow.vue';
+import Tag from '@/components/display/Tag.vue';
+import Icon from '@/components/basic/Icon.vue';
 
 const searchText = ref('');
 const authStore = useAuthStore();
+const collectStore = useCollectStore();
 
-const listLoader = useSimplePageListLoader<{
-  id: number,
-  image: string,
-  title: string,
-  desc: string
-}, {
-  villageId: number,  
-  villageVolunteerId: number,
-}>(8, async (page, pageSize, params) => {
-  if (!params )
-    throw new Error("未传入参数,当前页面需要参数");
+const listLoader = useSimplePageListLoader<CommonInfoModel>(8, async (page, pageSize) => {
   let res = await VillageInfoApi.getList(
     undefined,
     '',
     undefined,
     undefined,
-    params.villageId,
-    params.villageVolunteerId,
+    querys.value.villageId,
+    querys.value.villageVolunteerId,
     undefined,
     page,
     pageSize,
   )
   if (searchText.value)
     res = res.filter((p) => p.title.includes(searchText.value));
-  const list = res.map((item) => {
-    return {
-      id: item.id,
-      image: item.image,
-      title: item.title,
-      desc: DataDateUtils.formatDate(item.updatedAt, 'YYYY-MM-dd') + (
-        authStore.isAdmin ? (' 投稿人:' + item.villageVolunteerName) : ''
-      )
-    }
-  })
   return {
-    list: list,
-    total: list.length,
+    list: res,
+    total: res.length,
   };
 });
-function goDetail(id: number) {
+function goDetail(item: CommonInfoModel) {
   navTo('common', { 
-    id,
+    id: item.id,
     villageId: querys.value.villageId,
     villageVolunteerId: querys.value.villageVolunteerId,
+    catalogId: item.catalogId,
+    subType:  collectStore.getCollectModuleInternalNameById(item.collectModuleId),
+    subKey: '',
+    subId: -1,
+    subTitle: item.catalogName,
   });
 }
 function search() {