Quellcode durchsuchen

📦 按要求增加关于页,我的关注我的订单页

快乐的梦鱼 vor 4 Wochen
Ursprung
Commit
edf6607248

+ 15 - 0
src/pages.json

@@ -94,6 +94,21 @@
       }
     },
     {
+      "path": "pages/home/village/follows",
+      "style": {
+        "navigationBarTitleText": "我的关注",
+        "navigationStyle": "custom",
+        "enablePullDownRefresh": true
+      }
+    },
+    {
+      "path": "pages/home/village/orders",
+      "style": {
+        "navigationBarTitleText": "我的订单",
+        "navigationStyle": "custom"
+      }
+    },
+    {
       "path": "pages/home/village/goods/index",
       "style": {
         "navigationBarTitleText": "乡源好物",

+ 29 - 39
src/pages/home/components/LightMap.vue

@@ -55,36 +55,33 @@
       <ActivityIndicator :size="64" />
     </FlexCol>
 
-    <NButton 
-      :innerStyle="{
-        position: 'absolute',
-        bottom: '20rpx',
-        left: '20rpx',
-        zIndex: 100,
-        backgroundColor: '#ffffff',
-      }"
-      :icon="searchKeyword ? 'close' : 'search'" 
-      @click="showSearch" 
-    />
-    <SimpleDropDownPicker 
-      v-if="!isEmptyRegion"
-      class="light-map-region-picker" 
-      :modelValue="selectedRegion" 
-      @update:modelValue="onSelectedRegion"
-      :columns="regionLoader.content.value" 
-    />
-    <NButton 
-      :innerStyle="{
-        position: 'absolute',
-        bottom: '20rpx',
-        right: '20rpx',
-        zIndex: 100,
-        backgroundColor: '#ffffff',
-      }"
-      text="定位"
-      icon="navigation" 
-      @click="emit('getCurrentLonlat')" 
-    />
+    <FlexCol 
+      position="absolute" 
+      :inset="{ l: 0, b: 0,r: 0 }"
+      :zIndex="20"
+      :padding="full ? [0, 40] : 20"
+    >
+      <FlexRow align="center" justify="space-between">
+        <NButton
+          :icon="searchKeyword ? 'close' : 'search'" 
+          @click="showSearch" 
+        />
+        <SimpleDropDownPicker 
+          v-if="!isEmptyRegion"
+          class="light-map-region-picker" 
+          :modelValue="selectedRegion" 
+          @update:modelValue="onSelectedRegion"
+          :columns="regionLoader.content.value" 
+        />
+        <NButton
+          text="定位"
+          icon="navigation" 
+          @click="emit('getCurrentLonlat')" 
+        />
+      </FlexRow>
+      <StatusBarSpace v-if="full" />
+    </FlexCol>
+
     <Dialog 
       v-model:show="searchDialogShow" 
       title="搜索村社"
@@ -118,6 +115,8 @@ import MapApi from '@/api/map/MapApi';
 import Dialog from '@/components/dialog/Dialog.vue';
 import Field from '@/components/form/Field.vue';
 import { toast } from '@/components/dialog/CommonRoot';
+import FlexRow from '@/components/layout/FlexRow.vue';
+import StatusBarSpace from '@/components/layout/space/StatusBarSpace.vue';
 
 const instance = getCurrentInstance();
 const mapCtx = uni.createMapContext('prevMap', instance);
@@ -418,15 +417,6 @@ onMounted(async () => {
     width: 100%;
     height: 600rpx;
   }
-
-  .light-map-region-picker {
-    position: absolute;
-    bottom: 20rpx;
-    left: 50%;
-    transform: translateX(-50%);
-    z-index: 100;
-  }
-
   .light-map-address {
     position: absolute;
     bottom: 20rpx;

+ 2 - 2
src/pages/home/components/VillageRankList.vue

@@ -29,7 +29,7 @@
         center
         backgroundColor="rgba(0, 0, 0, 0.5)"
       >
-        <Text :text="item.title" fontConfig="h4" color="white" />
+        <Text :text="item.title" fontConfig="h4" :lines="1" color="white" />
       </FlexRow>
       <FlexCol 
         position="absolute"
@@ -47,7 +47,7 @@
             `url('https://xy.wenlvti.net/app_static/images/home/RankBadgeN.png')`,
         }"
       >
-        <Text v-if="item.rank > 1" fontConfig="h4" :text="item.rank" color="white" />
+        <Text v-if="item.rank > 1" fontConfig="h4" :text="item.rank" :lines="1" color="white" />
       </FlexCol>
     </Touchable>
   </FlexRow>

+ 1 - 1
src/pages/home/components/VillageUserRankList.vue

@@ -30,7 +30,7 @@
           defaultAvatar="https://xy.wenlvti.net/app_static/images/village/PlaceholderVolunteer.png"
         />
         <Height :height="item.rank == 1 ? 15 : 10" />
-        <Text fontConfig="h4" :text="item.title" color="white" />
+        <Text fontConfig="h4" :text="item.title" :lines="1" color="white" />
         <Height :height="6" />
         <Text fontConfig="h2" :text="`${item.score}`" :fontSize="30" :color="scoreColors[item.rank - 1]" fontFamily="SongtiSCBlack" />
         <Text fontFamily="SongtiSCBlack" :fontSize="18" :text="scoreSuffix" :color="scoreColors[item.rank - 1]" />

+ 14 - 11
src/pages/home/discover/index.vue

@@ -13,7 +13,7 @@
     />
 
     <HomeTitle title="乡村排名" showMore @moreClicked="navTo('/pages/home/village/rank/village')" />
-    <FlexCol gap="gap.lg">
+    <FlexCol gap="gap.md">
       <RankVillageItem
         v-for="item in villageRankListLoader.content.value"
         :key="item.id"
@@ -22,12 +22,13 @@
         :rank="item.rank"
         :title="item.title"
         :points="item.points"
+        :small="true"
         @click="handleGoVillageDetails(item as any)"
       />
     </FlexCol>
 
     <HomeTitle title="志愿者排名" showMore :lightCount="3" @moreClicked="navTo('/pages/home/village/rank/volunteer')" />
-    <FlexCol gap="gap.lg">
+    <FlexCol gap="gap.md">
       <RankVolunteerItem
         v-for="(item, index) in villageUserRankListLoader.content.value" :key="item.id"
         :id="item.id"
@@ -36,16 +37,17 @@
         :title="item.title"
         :score="item.score"
         :isAdmin="false"
+        :small="true"
         scoreSuffix="文化积分"
         @click="navTo('/pages/home/village/volunteer/detail', { id: item.id })"
       />
     </FlexCol>
 
     <HomeTitle title="乡源好物" showMore @moreClicked="navTo('/pages/home/village/goods/index')" />
-    <SimplePageListLoader :loader="goodsLoader" :showNomore="false">
+    <SimplePageContentLoader :loader="goodsLoader" :showNomore="false">
       <FlexRow wrap justify="space-around" gap="gap.sm">
         <BoxMid
-          v-for="good in goodsLoader.list.value" :key="good.id"
+          v-for="good in goodsLoader.content.value" :key="good.id"
           :innerStyle="{
             width: 'calc(50% - 70rpx)',
           }"
@@ -68,9 +70,9 @@
             </FlexRow>
           </Touchable>
         </BoxMid>
-        <FlexCol v-if="goodsLoader.list.value.length % 2 !== 0" width="calc(50%)" />
+        <FlexCol v-if="goodsLoader.content.value && goodsLoader.content.value.length % 2 !== 0" width="calc(50%)" />
       </FlexRow>
-    </SimplePageListLoader>
+    </SimplePageContentLoader>
 
     <HomeTitle title="最新推荐" />
     <SimplePageListLoader :loader="discoverLoader">
@@ -124,6 +126,7 @@ import FlexRow from '@/components/layout/FlexRow.vue';
 import BoxMid from '@/common/components/box/BoxMid.vue';
 import RankVolunteerItem from '../village/rank/components/RankVolunteerItem.vue';
 import RankVillageItem from '../village/rank/components/RankVillageItem.vue';
+import SimplePageContentLoader from '@/components/loader/SimplePageContentLoader.vue';
 
 const emit = defineEmits([ 'goVillage' ]);
 
@@ -143,7 +146,7 @@ const villageRankListLoader = useSimpleDataLoader(async () => {
   }));
 });
 const villageUserRankListLoader = useSimpleDataLoader(async () => {
-  const res = (await LightVillageApi.getVolunteerRankList({ num: 6 }))
+  const res = (await LightVillageApi.getVolunteerRankList({ num: 10 }))
     .map((item, i) => ({
       id: item.id,
       image: item.image ?? '',
@@ -153,11 +156,11 @@ const villageUserRankListLoader = useSimpleDataLoader(async () => {
     }));
   return res
 });
-const goodsLoader = useSimplePageListLoader(20, async (page, pageSize, params) => {
-  return await VillageInfoApi.getList({
+const goodsLoader = useSimpleDataLoader(async () => {
+  return (await VillageInfoApi.getList({
     collectModuleId: 24,
-    page, pageSize,
-  });
+    page: 1, pageSize: 10,
+  })).list;
 });
 
 function handleGoodDetail(good: { id: number }) {

+ 1 - 1
src/pages/home/village/bless/my-orders.vue

@@ -85,7 +85,7 @@ function handlePaySuccess() {
 }
 
 const listLoader = useSimplePageListLoader(20, async (page, pageSize) => {
-  if (!querys.value.villageId || !authStore.userId) {
+  if (!authStore.userId) {
     return {
       list: [],
       total: 0,

+ 17 - 0
src/pages/home/village/follows.vue

@@ -0,0 +1,17 @@
+<script setup lang="ts">
+import CommonTopBanner from '@/common/components/CommonTopBanner.vue';
+import VillageMyFollow from '../components/VillageMyFollow.vue';
+import { backAndCallOnPageBack } from '@/components/utils/PageAction';
+
+function goDetails(item: { id: number }) {
+  backAndCallOnPageBack('goVillage', { id: item.id });
+}
+</script>
+
+<template>
+  <CommonTopBanner title="我的关注">
+    <VillageMyFollow 
+      @goDetails="goDetails"
+    />
+  </CommonTopBanner>
+</template>

+ 25 - 0
src/pages/home/village/orders.vue

@@ -0,0 +1,25 @@
+<script setup lang="ts">
+import CommonTopBanner from '@/common/components/CommonTopBanner.vue';
+import Cell from '@/components/basic/Cell.vue';
+import CellGroup from '@/components/basic/CellGroup.vue';
+import FlexCol from '@/components/layout/FlexCol.vue';
+import ProvideVar from '@/components/theme/ProvideVar.vue';
+import { navTo } from '@/components/utils/PageAction';
+
+</script>
+
+<template>
+  <CommonTopBanner title="我的订单">
+    <FlexCol padding="padding.md">
+      <ProvideVar :vars="{
+        CellBackground: 'background.tertiary',
+        CellBottomBorder: false,
+      }">
+        <CellGroup round>
+          <Cell icon="https://xy.wenlvti.net/app_static/images/mine/IconMyRecord.png" title="赐福订单" showArrow touchable @click="navTo('/pages/home/village/bless/my-orders')" />
+          <Cell icon="https://xy.wenlvti.net/app_static/images/mine/IconMyReward.png" title="升级订单" showArrow touchable @click="navTo('/pages/home/village/upgrade/my-orders')" />
+        </CellGroup>
+      </ProvideVar>
+    </FlexCol>
+  </CommonTopBanner>
+</template>

+ 4 - 3
src/pages/home/village/rank/components/RankVillageItem.vue

@@ -9,7 +9,7 @@
       justify="space-between"
       align="center"
       gap="gap.md"
-      :padding="[25,25]"
+      :padding="small ? [15,25] : [25,25]"
       @click="emit('click')"
     >
       <FlexRow align="center" gap="gap.lg">
@@ -24,8 +24,8 @@
         <Image 
           :src="image" 
           defaultImage="https://xy.wenlvti.net/app_static/images/village/PlaceholderVillage.jpg"
-          width="170rpx"
-          height="120rpx"
+          :width="small ? 130 : 170"
+          :height="small ? 80 : 120"
           mode="aspectFill"
           radius="radius.md"
         />
@@ -63,6 +63,7 @@ const props = defineProps<{
   rank: number;
   title: string;
   points: number;
+  small?: boolean;
 }>();
 
 const emit = defineEmits<{

+ 2 - 1
src/pages/home/village/rank/components/RankVolunteerItem.vue

@@ -7,7 +7,7 @@
       backgroundImage="https://xy.wenlvti.net/app_static/images/village/BoxDark.png"
       :backgroundCutBorder="[6,6,6,6]"
       :backgroundCutBorderSize="[10,10,10,10]"
-      :padding="[25,25]"
+      :padding="small ? [10,25] : [25,25]"
       direction="row"
       justify="space-between"
       align="center"
@@ -68,6 +68,7 @@ const props = defineProps<{
   score: number;
   isAdmin: boolean;
   scoreSuffix: string;
+  small?: boolean;
 }>();
 
 const emit = defineEmits<{

+ 1 - 1
src/pages/home/village/upgrade/my-orders.vue

@@ -79,7 +79,7 @@ const { querys } = useLoadQuerys({
 const authStore = useAuthStore();
 
 const listLoader = useSimplePageListLoader(20, async (page, pageSize) => {
-  if (!querys.value.villageId || !authStore.userId) {
+  if (!authStore.userId) {
     return {
       list: [],
       total: 0,

+ 1 - 1
src/pages/index.vue

@@ -143,7 +143,7 @@ onShareTimeline(() => {
 })
 onMounted(() => {
   if (isDevEnv) {
-    tabIndex.value = 1;
+    tabIndex.value = 3;
   }
 })
 </script>

+ 2 - 2
src/pages/user/index.vue

@@ -33,8 +33,8 @@
       GridItemPaddingHorizontal: 0,
     }">
       <Grid :borderGrid="false" :mainAxisCount="4">
-        <GridItem title="乡源等级" icon="https://xy.wenlvti.net/app_static/images/mine/IconLevel.png" touchable @click="toast('暂未开放,敬请期待')" />
-        <GridItem title="我的成就" icon="https://xy.wenlvti.net/app_static/images/mine/IconArchive.png" touchable @click="navTo('/pages/home/village/task/archivement')" />
+        <GridItem title="我的关注" icon="https://xy.wenlvti.net/app_static/images/mine/IconLevel.png" touchable @click="requireLogin(() => navTo('/pages/home/village/follows'), '登录后查看我的关注哦')" />
+        <GridItem title="我的订单" icon="https://xy.wenlvti.net/app_static/images/mine/IconArchive.png" touchable @click="requireLogin(() => navTo('/pages/home/village/orders'), '登录后查看我的订单哦')" />
         <GridItem title="任务中心" icon="https://xy.wenlvti.net/app_static/images/mine/IconTask.png" touchable @click="navTo('/pages/home/village/task/index')" />
         <GridItem title="兑换商城" icon="https://xy.wenlvti.net/app_static/images/mine/IconShop.png" touchable @click="toast('暂未开放,敬请期待')" />
       </Grid>