快乐的梦鱼 месяцев назад: 2
Родитель
Сommit
b83db4e430

+ 5 - 0
src/api/inhert/VillageInfoApi.ts

@@ -213,6 +213,8 @@ export class VillageInfoApi extends AppServerRequestModule<DataModel> {
     villageId: number,
     villageVolunteerId: number,
     catalogId?: number|undefined,
+    page?: number,
+    pageSize?: number,
     modelClassCreator: (new () => T) = VillageListItem as any 
   ) {
     return (this.post(`/village/collect/list`, {
@@ -220,6 +222,9 @@ export class VillageInfoApi extends AppServerRequestModule<DataModel> {
       [subKey ? subKey : 'type']: subId,
       village_id: villageId,
       village_volunteer_id: villageVolunteerId,
+      catalog_id: catalogId,
+      page,
+      pageSize: pageSize,
     }, '获取信息详情'))
       .then(res => transformArrayDataModel<T>(modelClassCreator, (res.data2.data || res.data2) ?? [], `获取分类列表`, true))
       .catch(e => { throw e });

+ 30 - 22
src/common/components/parts/Box2LineImageRightShadow.vue

@@ -1,43 +1,51 @@
 <template>
-  <view 
-    class="d-flex flex-row flex-grow-1 justify-between shadow-s 
-    radius-base mb-3 p-2 pt-3 pb-3 overflow-hidden
-    border-all-light-light-primary"
+  <FlexRow 
     :style="{ 
       height: 'calc(100% - 20rpx)',
       width: 'calc(100% - 10rpx)',
     }"
+    :flexGrow="1" 
+    overflow="hidden"
+    justify="space-between"
+    :padding="[20,10]"
     @click="$emit('click')"
   >
-    <view class="d-flex flex-row w-100">
-      <image 
-        :class="[
-          wideImage ? 'width-250' : 'width-150', 
-          'height-150', 
-          'radius-base',
-          'flex-shrink-0'
-        ]"
+    <FlexRow width="100%" :gap="10">
+      <Image 
+        :width="wideImage ? 250 : 150"
+        :height="150"
+        :radius="10"
+        :flexShrink="0"
         :src="image"
         mode="aspectFill"
       />
-      <view class="d-flex flex-col ml-3 flex-one width-500">
-        <text :class="[
-          'color-primary size-base',
-          desc || title1 ? 'text-lines-1' : 'text-lines-2',
-        ]">{{ title }}</text>
-        <text class="size-s color-second text-lines-2 mt-2 mb-2">{{ desc }}</text>
+      <FlexCol :flexGrow="1" :width="500" :gap="10">
+        <Text 
+          :color="'primary'"
+          :fontConfig="desc || title1 ? 'title' : 'subText'"
+          :lines="desc || title1 ? 1 : 2"
+        >{{ title }}</Text>
+        <Text 
+          fontConfig="subText"
+          color="second"
+          :lines="2"
+        >{{ desc }}</Text>
         <Tag v-if="badge" :text="badge" scheme="light" type="primary" size="small" />
         <RoundTags v-if="tags" :tags="tags" small />
-      </view>
-    </view>
-    <text class="color-primary-second-text size-ss">{{ right }}</text>
-  </view>
+      </FlexCol>
+    </FlexRow>
+    <Text color="primary-second-text" fontConfig="caption">{{ right }}</Text>
+  </FlexRow>
 </template>
 
 <script setup lang="ts">
 import type { PropType } from 'vue';
 import RoundTags from './RoundTags.vue';
 import Tag from '@/components/display/Tag.vue';
+import FlexCol from '@/components/layout/FlexCol.vue';
+import FlexRow from '@/components/layout/FlexRow.vue';
+import Image from '@/components/basic/Image.vue';
+import Text from '@/components/basic/Text.vue';
 
 defineProps({
   title: String,

+ 15 - 22
src/components/dialog/CommonRoot.ts

@@ -4,46 +4,39 @@ import type { DialogAlertOptions } from "./DialogRoot.vue";
 import type { ToastShowProps } from "../feedback/Toast.vue";
 import type { ActionSheetOptions } from "./ActionSheetRoot.vue";
 
-let currentRoot : ICommonRoot|null = null;
+const currentRootStack : ICommonRoot[] = [];
 
 export function setCurrentRoot(root : ICommonRoot) {
-  currentRoot = root;
+  currentRootStack.push(root);
+}
+export function destroyCurrentRoot(root : ICommonRoot) {
+  const index = currentRootStack.indexOf(root);
+  if (index !== -1)
+    currentRootStack.splice(index, 1);
 }
 export function NaDialogRoot() : ICommonRoot {
-  if (!currentRoot)
+  if (!currentRootStack.length)
     throw new Error("No dialog root found.");
-  return currentRoot;
+  return currentRootStack[currentRootStack.length - 1];
 }
 
 export function alert(options: DialogAlertOptions) {
-  if (!currentRoot)
-    throw new Error("No dialog root found.");
-  return currentRoot.alert(options);
+  return NaDialogRoot().alert(options);
 }
 export function confirm(options: DialogAlertOptions) {
-  if (!currentRoot)
-    throw new Error("No dialog root found.");
-  return currentRoot.confirm(options);
+  return NaDialogRoot().confirm(options);
 }
 export function toast(options: ToastShowProps) {
-  if (!currentRoot)
-    throw new Error("No dialog root found.");
-  return currentRoot.toast(options);
+  return NaDialogRoot().toast(options);
 }
 export function closeToast() {
-  if (!currentRoot)
-    throw new Error("No dialog root found.");
-  return currentRoot.closeToast();
+  return NaDialogRoot().closeToast();
 }
 export function actionSheet(options: ActionSheetOptions) {
-  if (!currentRoot)
-    throw new Error("No dialog root found.");
-  return currentRoot.actionSheet(options);
+  return NaDialogRoot().actionSheet(options);
 }
 export function notify(options: ToastShowProps) {
-  if (!currentRoot)
-    throw new Error("No dialog root found.");
-  return currentRoot.notify(options);
+  return NaDialogRoot().notify(options);
 }
 
 export default {

+ 5 - 2
src/components/dialog/CommonRoot.vue

@@ -7,8 +7,8 @@
 </template>
 
 <script setup lang="ts">
-import { onMounted, ref } from 'vue';
-import { setCurrentRoot } from './CommonRoot';
+import { onBeforeUnmount, onMounted, ref } from 'vue';
+import { destroyCurrentRoot, setCurrentRoot } from './CommonRoot';
 import Notify, { type NotifyInstance } from '../feedback/Notify.vue';
 import Toast, { type ToastInstance } from '../feedback/Toast.vue';
 import ActionSheet, { type ActionSheetRoot } from './ActionSheetRoot.vue';
@@ -41,6 +41,9 @@ onMounted(() => {
   setCurrentRoot(commonRoot);
   (uni as any).$na = commonRoot;
 });
+onBeforeUnmount(() => {
+  destroyCurrentRoot(commonRoot!);
+});
 
 defineExpose<ICommonRoot>(commonRoot);
 </script>

+ 2 - 2
src/components/form/UploaderListAddItem.vue

@@ -3,7 +3,7 @@
     v-if="!isListStyle"
     icon="add"
     :size="themeContext.getVar('UploaderAddIconSize', 60)"
-    :pressedBackgroundColor="themeContext.getVar('UploaderListAddItemPressedBackgroundColor', 'pressed.grey')"
+    :pressedBackgroundColor="themeContext.getVar('UploaderListAddItemPressedBackgroundColor', 'pressed.button')"
     :buttonStyle="{
       ...themeStyles.itemAddButton.value, 
       ...props.style, 
@@ -34,7 +34,7 @@ const themeContext = useTheme();
 const themeStyles = themeContext.useThemeStyles({
   itemAddButton: {
     overflow: 'hidden',
-    backgroundColor: DynamicColor('UploaderListAddItemBackgroundColor', 'grey'),
+    backgroundColor: DynamicColor('UploaderListAddItemBackgroundColor', 'button'),
     borderRadius: DynamicSize('UploaderListAddItemBorderRadius', 20),
     margin: DynamicSize('UploaderListAddItemMargin', 4),
   },

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

@@ -103,7 +103,8 @@ const overviewLoader = useSimpleDataLoader<CommonInfoModel>(async () => {
   const collectModuleId = getCollectModuleId('overview');
   const list = await VillageInfoApi.getList(
     collectModuleId, subType, undefined, undefined,
-    querys.value.villageId, querys.value.villageVolunteerId);
+    querys.value.villageId, querys.value.villageVolunteerId
+  );
 
   if (list.length > 0) {
     const info =  (await VillageInfoApi.getInfo(

+ 3 - 1
src/pages/dig/forms/common.vue

@@ -106,7 +106,9 @@ const { querys } = useLoadQuerys({
           undefined, 
           querys.villageId, 
           querys.villageVolunteerId,
-          querys.catalogId,
+          undefined,
+          1,
+          1
         );
         if (list?.length > 0)
           findId = list[0].id;

+ 9 - 5
src/pages/dig/forms/list.vue

@@ -4,7 +4,7 @@
       <SearchBar
         v-model="searchText"
         placeholder="搜一搜" 
-        :innerStyle="{ width: '460rpx' }"
+        :innerStyle="{ width: querys.isView ? '600rpx' : '460rpx' }"
         @confirm="search"
       />
       <Button v-if="!querys.isView" type="primary" @click="newData">+ 新增</Button>
@@ -42,8 +42,9 @@
     </FlexCol>
     <SimplePageListLoader :loader="listLoader" :noEmpty="true">
       <template #empty>
-        <Empty v-if="querys.isView" image="search" text="暂无数据,等待志愿者编写中..." />
-        <Empty v-else image="search" text="这里还没有数据,快来编写完善吧!">
+        <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>
@@ -98,14 +99,17 @@ const listLoader = useSimplePageListLoader<{
     throw new Error("params.villageId");
   if (!params.villageVolunteerId)
     throw new Error("params.villageId");
-  let res = (page == 1 ? await VillageInfoApi.getList(
+  let res = await VillageInfoApi.getList(
     collectStore.getCollectModuleId(params.subType),
     params.subType,
     params.subKey ? params.subId : undefined,
     params.subKey,
     params.villageId,
     params.villageVolunteerId,
-  ) : [])
+    querys.value.catalogId,
+    page,
+    pageSize,
+  )
   if (searchText.value)
     res = res.filter((p) => p.title.includes(searchText.value));
   const list = res.map((item) => {