Ver código fonte

🎨 按要求修改首页

快乐的梦鱼 1 mês atrás
pai
commit
be8b6a9a6e

+ 7 - 0
src/pages.json

@@ -227,6 +227,13 @@
         "navigationBarTitleText": "测试话题页",
         "enablePullDownRefresh": false
       }
+    },
+    {
+      "path": "pages/test/blank",
+      "style": {
+        "navigationBarTitleText": "测试空白页",
+        "enablePullDownRefresh": false
+      }
     }
   ],
   "globalStyle": {

+ 2 - 0
src/pages/article/common/CommonContent.ts

@@ -22,6 +22,7 @@ export function goCommonContentList(p: {
   latitude?: number,
   longitude?: number,
   isNearby?: boolean,
+  autoJumpFirst?: boolean,
 }) {
   navTo('/pages/article/common/list', {
     title: p.title,
@@ -33,6 +34,7 @@ export function goCommonContentList(p: {
     latitude: p.latitude,
     longitude: p.longitude,
     isNearby: p.isNearby,
+    autoJumpFirst: p.autoJumpFirst,
   }) 
 } 
 

+ 8 - 0
src/pages/article/common/list.vue

@@ -17,6 +17,7 @@
 import { useLoadQuerys, stringDotNumbersToNumbers } from '@/common/composeabe/LoadQuerys';
 import CommonListPage from './CommonListPage.vue';
 import CommonContent, { GetContentListParams } from '@/api/CommonContent';
+import { redirectTo } from '@/components/utils/PageAction';
 
 const { querys } = useLoadQuerys({
   villageId: 0,
@@ -31,6 +32,7 @@ const { querys } = useLoadQuerys({
   latitude: 0,
   longitude: 0,
   isNearby: false,
+  autoJumpFirst: false,
 });
 
 async function loadData(
@@ -57,6 +59,12 @@ async function loadData(
       element.desc = `来源:${element.from}`;
   }
 
+  if (querys.value.autoJumpFirst) {
+    redirectTo('/pages/article/details', {
+      id: res.list[0].id,
+    })
+  }
+
   return res;
 }
 </script>

+ 49 - 9
src/pages/home/index.vue

@@ -17,13 +17,46 @@
         @getedCurrentLonlat="getedCurrentLonlat"
       />
       <FlexRow justify="space-between" :padding="[10, 16]">
-        <ImageButton src="https://mn.wenlvti.net/app_static/xiangyuan/images/home/ButtonMainAction.png" :width="215" mode="widthFix" @click="goCommonContentList({ modelId: 18, mainBodyColumnId: 361 })" />
+        <ImageButton src="https://mn.wenlvti.net/app_static/xiangyuan/images/home/ButtonMainAction.png" :width="215" mode="widthFix" @click="goCommonContentList({ modelId: 18, mainBodyColumnId: 361, autoJumpFirst: true })" />
         <ImageButton src="https://mn.wenlvti.net/app_static/xiangyuan/images/home/ButtonMainLight.png" :width="215" mode="widthFix" @click="navTo('/pages/home/light/submit-map', { latitude: currentLonlat.latitude, longitude: currentLonlat.longitude })" />
-        <ImageButton src="https://mn.wenlvti.net/app_static/xiangyuan/images/home/ButtonMainSupport.png" :width="215" mode="widthFix" @click="goCommonContentList({ modelId: 18, mainBodyColumnId: 362 })" />
+        <ImageButton src="https://mn.wenlvti.net/app_static/xiangyuan/images/home/ButtonMainSupport.png" :width="215" mode="widthFix" @click="goCommonContentList({ modelId: 18, mainBodyColumnId: 362, autoJumpFirst: true })" />
       </FlexRow>
     </Box>
 
-    <Box title="发现 · 周边" icon="https://mncdn.wenlvti.net/app_static/xiangyuan/images/home/icon-compass.png" showMore @moreClicked="goCommonContentList({ 
+    <Box title="资讯动态" icon="https://mncdn.wenlvti.net/app_static/xiangyuan/images/home/icon-compass.png" showMore @moreClicked="goCommonContentList({
+      title: '资讯动态',
+      modelId: 18,
+      mainBodyColumnId: 363,
+    })">  
+      <SimplePageContentLoader :loader="newsLoader">
+        <FlexCol :gap="25">
+          <Touchable 
+            v-for="(item, i) in newsLoader.content.value"
+            :key="i"
+            justify="space-between"
+            align="center"
+            direction="row"
+            @click="goDiscoverDetails(item)"
+          > 
+            <FlexCol flex="1" :gap="20">
+              <Text :text="item.title" fontConfig="h5" />
+              <Text :text="item.desc" fontConfig="subText" />
+            </FlexCol>
+            <Width :width="25" />
+            <Image 
+              :src="item.image" 
+              :failedImage="AppCofig.defaultImage"
+              :width="170" 
+              :height="120" 
+              :radius="15" 
+              mode="aspectFill"
+            />
+          </Touchable>
+        </FlexCol>
+      </SimplePageContentLoader>
+    </Box>
+
+    <Box title="周边文化遗产" icon="https://mncdn.wenlvti.net/app_static/xiangyuan/images/home/icon-compass.png" @moreClicked="goCommonContentList({ 
       modelId: 1, 
       latitude: currentLonlat.latitude,
       longitude: currentLonlat.longitude,
@@ -39,9 +72,9 @@
             direction="row"
             @click="goCommonContentDetail(item.id)"
           > 
-            <FlexCol flex="1" :gap="20">
-              <Text :text="item.title" fontConfig="h5" />
-              <Text :text="`距离您约 ${item.distance}`" fontConfig="subText" />
+            <Text :text="item.title" fontConfig="h5" />
+            <Text :text="`距离您约 ${item.distance}`" fontConfig="subText" />
+            <!-- <FlexCol flex="1" :gap="20">
             </FlexCol>
             <Width :width="25" />
             <Image 
@@ -51,12 +84,12 @@
               :height="120" 
               :radius="15" 
               mode="aspectFill"
-            />
+            /> -->
           </Touchable>
         </FlexCol>
       </SimplePageContentLoader>
     </Box>
-    <Box title="线上史馆展示" icon="https://mncdn.wenlvti.net/app_static/xiangyuan/images/home/icon-ancient-gate.png">
+    <!-- <Box title="线上史馆展示" icon="https://mncdn.wenlvti.net/app_static/xiangyuan/images/home/icon-ancient-gate.png">
       <SimplePageContentLoader :loader="recommendLoader">
         <FlexRow justify="space-between" align="center" wrap :gap="25">
           <Touchable 
@@ -79,7 +112,7 @@
           </Touchable>
         </FlexRow>
       </SimplePageContentLoader>
-    </Box>
+    </Box> -->
     <Box title="精彩推荐" icon="https://mncdn.wenlvti.net/app_static/xiangyuan/images/home/icon-compass.png" showMore @moreClicked="$emit('goDiscover')">  
       <SimplePageContentLoader :loader="discoverLoader">
         <FlexCol :gap="25">
@@ -221,6 +254,13 @@ const discoverLoader = useSimpleDataLoader(async () => {
   })
 });
 
+const newsLoader = useSimpleDataLoader(async () => {
+  return (await CommonContent.getContentList(new GetContentListParams()
+    .setModelId(18)
+    .setMainBodyColumnId(363)
+  , 1, 8)).list;
+});
+
 function goDiscoverDetails(item: any) {
   navTo('/pages/home/discover/details', {
     id: item.id,

+ 17 - 0
src/pages/test/blank.vue

@@ -0,0 +1,17 @@
+<template>
+  <div>
+    <h1>userId {{ querys.userId }}</h1>
+  </div>
+</template>
+
+<script setup lang="ts">
+import { useLoadQuerys } from '@/common/composeabe/LoadQuerys';
+
+const { querys } = useLoadQuerys({
+  userId: 0,
+});
+</script>
+
+<style scoped>
+
+</style>

+ 15 - 2
src/pages/test/topic.vue

@@ -1,13 +1,26 @@
 <template>
   <official-account-publish 
-    path="/pages/index" 
+    :path="`/pages/test/blank?userId=${authStore.userId}`" 
     @error="onError"
     @publishsuccess="onPublishSuccess"
     @publishfail="onPublishFail"
   />
 </template>
 
-<script setup lang="ts">  
+<script setup lang="ts">
+import { useAuthStore } from '@/store/auth';
+import { onMounted } from 'vue';
+
+const authStore = useAuthStore();
+
+onMounted(() => {
+  console.log(authStore.userId);
+  setTimeout(() => {
+    uni.setNavigationBarTitle({
+      title: '亮乡源话题' + (authStore.userId || '') ,
+    })
+  }, 1000);
+});
 
 function onError(e: any) {
   console.error(e);