Просмотр исходного кода

🎨 优化文章列表页,详情页细节

快乐的梦鱼 1 месяц назад
Родитель
Сommit
cab0a4ca03

+ 7 - 6
src/common/components/parts/Box2LineImageRightShadow.vue

@@ -21,17 +21,18 @@
         mode="aspectFill"
       />
       <FlexCol :flexGrow="1" :width="500" :gap="10">
-        <Text 
-          :color="'primary'"
-          :fontConfig="desc || title1 ? 'title' : 'subText'"
+        <Text
+          fontConfig="lightImportantTitle"
+          fontFamily="SongtiSCBlack"
           :lines="desc || title1 ? 1 : 2"
         >{{ title }}</Text>
         <Text 
-          fontConfig="subText"
-          color="second"
+          fontConfig="secondText"
           :lines="2"
         >{{ desc }}</Text>
-        <Tag v-if="badge" :text="badge" scheme="light" type="primary" size="small" />
+        <FlexRow>
+          <Tag v-if="badge" :text="badge" scheme="light" type="success" size="small" />
+        </FlexRow>
         <RoundTags v-if="tags" :tags="tags" small />
       </FlexCol>
     </FlexRow>

+ 1 - 1
src/common/components/parts/RoundTags.vue

@@ -1,6 +1,6 @@
 <template>
   <scroll-view scroll-x>
-    <FlexRow gap="gap.lg">
+    <FlexRow gap="gap.md">
       <template
         v-for="(tag, k) in tags"
         :key="k" 

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

@@ -6,6 +6,7 @@ export function configAppTheme() {
     theme.colorConfigs.default.primary = '#e19579';
     theme.colorConfigs.pressed.primary = '#fbce7a';
     theme.colorConfigs.default.button = '#f6e9d9';
+    theme.colorConfigs.background.page = '#fef2e8';
     theme.colorConfigs.background.primary = '#fef2e8';
     theme.colorConfigs.background.secondary = '#f7f8f9';
     theme.colorConfigs.background.tertiary = '#fff7f1';

+ 1 - 1
src/components/composeabe/loader/SimpleDataLoader.ts

@@ -1,4 +1,4 @@
-import { computed, onMounted, ref, type Ref } from "vue";
+import { computed, onMounted, ref, watch, type Ref } from "vue";
 import type { ILoaderCommon, LoaderLoadType } from "./LoaderCommon";
 
 export interface ISimpleDataLoader<T, P> extends ILoaderCommon<P> {

+ 0 - 2
src/pages/article/details.vue

@@ -17,7 +17,6 @@
                 :src="item" 
                 width="100%"
                 :height="500"
-                radius="radius.md"
                 mode="aspectFill"
                 touchable
                 @click="onPreviewImage(key)"
@@ -26,7 +25,6 @@
           </swiper>
           <Image 
             v-else-if="loader.content.value.image"
-            radius="radius.md"
             :src="loader.content.value.image"
             mode="widthFix"
             width="100%"

+ 2 - 2
src/pages/article/web/webPassToken.ts

@@ -4,11 +4,11 @@ import { computed } from "vue";
 export function useWebPassToken(url: string, subUrl: string) {
   const authStore = useAuthStore();
   const finalUrl = computed(() => {
-    return `${url}?token=${authStore.token}#${subUrl}`;
+    return `${url}?token=${authStore.token}#${subUrl}?token=${authStore.token}`;
   });
 
   function getFinalUrl(url: string, subUrl: string) {
-     return `${url}?token=${authStore.token}#${subUrl}`;
+     return `${url}?token=${authStore.token}#${subUrl}?token=${authStore.token}`;
   }
 
   return { finalUrl, getFinalUrl };

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

@@ -126,7 +126,7 @@ const listLoader = useSimplePageListLoader(8, async (page, pageSize) => {
       desc: `可采编:${item.collectModuleText || '暂无'}`,
     })),
   }
-});
+}, false);
 
 function newData() {
   navTo('./volunteer', { 

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

@@ -110,7 +110,7 @@ const listLoader = useSimplePageListLoader(8, async (page, pageSize,) => {
     total: res.total,
     list: res.list,
   }
-});
+}, false);
 
 const reviewPopup = ref(false);
 const reviewItem = ref<VolunteerInfo>();

+ 4 - 7
src/pages/home/discover/details.vue

@@ -129,6 +129,7 @@
               @click="goDetails(item.id)"
             />
           </FlexCol>
+          <Height :height="100" />
           <LikeFooter 
             :content="loader.content.value" 
             @refresh="loader.reload(); isChangedStatus=true" 
@@ -178,26 +179,22 @@ const loader = useSimpleDataLoader(async () => {
   uni.setNavigationBarTitle({ title: res.title });
   console.log('加载信息', res);
   return res;
-});
+}, false);
 const recommendListLoader = useSimpleDataLoader(async () => {
-  if (!querys.value.keywords)
-    return []
-  return (await VillageInfoApi.getListForDiscover(1, 5, querys.value.keywords))
+  return (await VillageInfoApi.getListForDiscover(1, 5))
     .list
     .filter((p) => p.id !== querys.value.id);
 });
 
 const { querys } = useLoadQuerys({ 
   id: 0,
-  keywords: '',
-}, (t) => loader.load(false, t));
+}, (t) => loader.reload());
 
 const isChangedStatus = ref(false);
 
 function goDetails(id: number) {
   navTo('details', { 
     id,
-    keywords: querys.value.keywords,
   });
 }
 

+ 1 - 1
src/pages/home/village/follow/list.vue

@@ -68,7 +68,7 @@ const villageUserRankListLoader = useSimplePageListLoader(20, async (page, pageS
     page, pageSize, 
     villageId: querys.value.villageId
   }))
-});
+}, false);
 
 function goDetails(item: {
   id: number;

+ 2 - 2
src/pages/home/village/goods/detail.vue

@@ -73,7 +73,7 @@ import { useAuthStore } from '@/store/auth';
 import { computed, onMounted } from 'vue';
 import { backAndCallOnPageBack, navTo } from '@/components/utils/PageAction';
 import { useUserTools } from '@/common/composeabe/UserTools';
-import { confirm } from '@/components/dialog/CommonRoot';
+import { confirm, alert } from '@/components/dialog/CommonRoot';
 import { assertNotNull } from '@imengyu/imengyu-utils';
 
 const { querys } = useLoadQuerys({
@@ -103,7 +103,7 @@ const handleModify = () => {
 const handleConsult = async () => {
   assertNotNull(goodLoader.content.value)
   if (!goodLoader.content.value.contactNumber) {
-    alert('作者很懒~暂未留下联系方式');
+    alert({ content: '作者很懒~暂未留下联系方式' });
     return;
   }
   const goContract = await confirm({

+ 46 - 41
src/pages/home/village/index.vue

@@ -20,54 +20,56 @@
             @click="showMyFollowPopup = true"
           />
         </BubbleTip>
-        <Button
+        <!-- <Button
           :textColor="topTab === 'around' ? 'text.titleLight' : 'text.content'"
           text="周边村社" 
           size="medium"
           @click="topTab = 'around'" 
-        />
+        /> -->
       </FlexRow>
     </FlexCol>
     <Height :height="40" />
-    <FlexCol v-if="topTab === 'village' && villageStore.currentVillage" gap="gap.md">
-      <FlexRow center :padding="[0,30]">
-        <HomeLargeTitle title="村社名片" :active="tab === 'card'" @click="tab = 'card'" />
-        <Width :width="30" />
-        <HomeLargeTitle title="乡源树" titleColorAnim :active="tab === 'tree'" @click="tab = 'tree'">
-          <template #icon>
-            <Image src="https://xy.wenlvti.net/app_static/images/village/TreeIconAmin2.gif" :width="34" :height="50" mode="heightFix" />
-          </template>
-        </HomeLargeTitle>
-        <Width :width="30" />
-      </FlexRow>
-      <Card 
-        v-if="tab === 'card'" 
-        ref="cardRef"
-        @goTree="tab = 'tree'" 
-        @goJoin="joinDialog?.show()"
-      />
-      <Tree 
-        v-if="tab === 'tree'" 
-        ref="treeRef"
-      />
-      <Height :height="150" />
-    </FlexCol>
-    <FlexCol v-else-if="topTab === 'village'" gap="gap.md">
-      <FlexCol center :padding="[60,0]" gap="gap.md">
-        <Image src="https://xy.wenlvti.net/app_static/images/home/BadgeNew.png" :width="320" mode="widthFix" />
-        <Text text="还未选择一个村社" fontConfig="primaryTitle" />
-        <Text text="欢迎关注或者认领村社,认领自己家乡参与建设,或四处看看" fontConfig="contentText" />
-        <Height :height="20" />
-        <FlexRow gap="gap.lg">
-          <FrameButton text="去认领村社" @click="handleGoSuscribe" primary />
+    <template v-if="delayShow">
+      <FlexCol v-if="topTab === 'village' && villageStore.currentVillage" gap="gap.md">
+        <FlexRow center :padding="[0,30]">
+          <HomeLargeTitle title="村社名片" :active="tab === 'card'" @click="tab = 'card'" />
+          <Width :width="30" />
+          <HomeLargeTitle title="乡源树" titleColorAnim :active="tab === 'tree'" @click="tab = 'tree'">
+            <template #icon>
+              <Image src="https://xy.wenlvti.net/app_static/images/village/TreeIconAmin2.gif" :width="34" :height="50" mode="heightFix" />
+            </template>
+          </HomeLargeTitle>
+          <Width :width="30" />
         </FlexRow>
+        <Card 
+          v-if="tab === 'card'" 
+          ref="cardRef"
+          @goTree="tab = 'tree'" 
+          @goJoin="joinDialog?.show()"
+        />
+        <Tree 
+          v-if="tab === 'tree'" 
+          ref="treeRef"
+        />
+        <Height :height="150" />
       </FlexCol>
-      <Height :height="150" />
-    </FlexCol>
-    <Around 
-      v-else 
-      @selectVillage="onSelectVillage" 
-    />
+      <FlexCol v-else-if="topTab === 'village'" gap="gap.md">
+        <FlexCol center :padding="[60,0]" gap="gap.md">
+          <Image src="https://xy.wenlvti.net/app_static/images/home/BadgeNew.png" :width="320" mode="widthFix" />
+          <Text text="还未选择一个村社" fontConfig="primaryTitle" />
+          <Text text="欢迎关注或者认领村社,认领自己家乡参与建设,或四处看看" fontConfig="contentText" />
+          <Height :height="20" />
+          <FlexRow gap="gap.lg">
+            <FrameButton text="去认领村社" @click="handleGoSuscribe" primary />
+          </FlexRow>
+        </FlexCol>
+        <Height :height="150" />
+      </FlexCol>
+      <!-- <Around 
+        v-else 
+        @selectVillage="onSelectVillage" 
+      /> -->
+    </template>
     <Height :height="200" />
     <Popup 
       v-model:show="showMyFollowPopup" 
@@ -117,8 +119,9 @@ import MemoryTimeOut from '@/components/composeabe/MemoryTimeOut';
 
 const topTab = ref<'village' | 'around'>('village');
 const tab = ref('card');
+const delayShow = ref(false);
 const villageStore = useVillageStore();
-const { isFollowed, onFollow, onUnFollow } = useFollow();
+const { isFollowed } = useFollow();
 
 const showMyFollowPopup = ref(false);
 const joinDialog = ref<InstanceType<typeof JoinDialog>>();
@@ -136,7 +139,6 @@ const emit = defineEmits(['goHome']);
 const showFollowTipTimeout = new MemoryTimeOut('FollowTip', 1000 * 3600 * 30);//30h
 const showFollowTip = ref(false);
 
-
 function handleShowFollowTip() {
   if (showFollowTipTimeout.isTimeout()) {
     showFollowTip.value = true;
@@ -155,6 +157,7 @@ function handleGoSuscribe() {
 function onSelectVillage(village: VillageListItem) {
   topTab.value = 'village';
   villageStore.setCurrentVillage(village);
+  uni.pageScrollTo({ scrollTop: 0 });
   showMyFollowPopup.value = false;
 }
 
@@ -175,6 +178,8 @@ onMounted(async () => {
       title: villageStore.currentVillage?.name || '未选择村庄',
     });
   }
+  await waitTimeOut(100);
+  delayShow.value = true;
   await waitTimeOut(1000);
   handleTestGoTree();
 });

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

@@ -47,7 +47,7 @@ const villageRankListLoader = useSimpleDataLoader(async () => {
     id: item.id,
     points: item.points,
   }));
-});
+}, false);
 
 const villageStore = useVillageStore();
 

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

@@ -59,7 +59,7 @@ const villageUserRankListLoader = useSimpleDataLoader(async () => {
       isAdmin: item.type === 'admin',
     }));
   return res
-});
+}, false);
 const villageUserRankListFirst3 = computed(() => {
   return villageUserRankListLoader.content.value?.slice(0, 3) ?? [];
 });

+ 1 - 1
src/pages/home/village/volunteer/detail.vue

@@ -113,7 +113,7 @@ const { querys } = useLoadQuerys({
 
 const infoLoader = useSimpleDataLoader(async () => {
   return (await VillageApi.getVolunteerInfoByIdAdmin(querys.value.id));
-});
+}, false);
 const infoGrids = computed(() => {
   return [
     {

+ 1 - 1
src/pages/home/village/volunteer/list.vue

@@ -76,7 +76,7 @@ const { querys } = useLoadQuerys({
 
 const villageUserRankListLoader = useSimplePageListLoader(20, async (page, pageSize) => {
   return (await VillageApi.getVillageVolunteerList(page, pageSize, querys.value.villageId))
-});
+}, false);
 
 function goDetails(item: {
   id: number;

+ 4 - 4
src/pages/index.vue

@@ -19,9 +19,9 @@
       />
       <HomeIndex v-show="tabIndex === 0" @goVillage="tabIndex = 1" @goDig="tabIndex = 2" />
       <VillageIndex v-if="tabIndex === 1" showSwitch ref="villageIndex" @goHome="tabIndex=0" />
-      <DigIndex v-else-if="tabIndex === 2" />
-      <DiscoverIndex v-else-if="tabIndex === 3" @goVillage="tabIndex = 1" />
-      <UserIndex v-else-if="tabIndex === 4" @goSubmit="tabIndex = 2" />
+      <DigIndex v-show="tabIndex === 2" />
+      <DiscoverIndex v-show="tabIndex === 3" @goVillage="tabIndex = 1" />
+      <UserIndex v-show="tabIndex === 4" @goSubmit="tabIndex = 2" />
       <TabBar
         v-model:selectedTabIndex="tabIndex"
         fixed
@@ -135,7 +135,7 @@ async function paySuccessAndRefresh() {
 
 watch(tabIndex, () => {
   uni.setStorageSync('lastTabIndex', tabIndex.value);
-  uni.pageScrollTo({ scrollTop: 0 });
+  uni.pageScrollTo({ scrollTop: 0, duration: 0 });
 });