Prechádzať zdrojové kódy

feat(pages): 添加多个新页面路由和首页内容

- 新增反馈列表、详情页面路由配置
- 新增日志上报及详情页面路由配置
- 新增免责申明、新闻详情页面路由配置
- 新增农户、调查员、村干部页面路由配置
- 添加测试页面路由并设置导航标题
- 注释掉 tabBar 配置以禁用底部导航栏
- 创建首页 index.vue 页面包含轮播图和新闻列表
- 实现首页跳转至测试页面功能
- 实现首页图标点击跳转不同角色页面功能
- 实现新闻列表展示及跳转详情页功能
nahida 6 mesiacov pred
rodič
commit
346ab2a26b

+ 90 - 20
src/pages.json

@@ -36,6 +36,76 @@
       "style": {
         "navigationBarTitleText": "意见反馈"
       }
+    },
+    {
+      "path": "pages/feedback/list/index",
+      "style": {
+        "navigationBarTitleText": "反馈列表",
+        "enablePullDownRefresh": true,
+        "backgroundTextStyle": "dark"
+      }
+    },
+    {
+      "path": "pages/feedback/list/detail/index",
+      "style": {
+        "navigationBarTitleText": "反馈详情"
+      }
+    },
+    {
+      "path": "pages/log-report/index",
+      "style": {
+        "navigationBarTitleText": "日志上报"
+      }
+    },
+    {
+      "path": "pages/log-report/list/index",
+      "style": {
+        "navigationBarTitleText": "日志列表",
+        "enablePullDownRefresh": true,
+        "backgroundTextStyle": "dark"
+      }
+    },
+    {
+      "path": "pages/log-report/list/detail/index",
+      "style": {
+        "navigationBarTitleText": "日志详情"
+      }
+    },
+    {
+      "path": "pages/disclaimer/index",
+      "style": {
+        "navigationBarTitleText": "免责申明"
+      }
+    },
+    {
+      "path": "pages/index/news-detail/index",
+      "style": {
+        "navigationBarTitleText": "新闻详情"
+      }
+    },
+    {
+      "path": "pages/farmer/index",
+      "style": {
+        "navigationBarTitleText": "农户"
+      }
+    },
+    {
+      "path": "pages/investigator/index",
+      "style": {
+        "navigationBarTitleText": "调查员"
+      }
+    },
+    {
+      "path": "pages/official/index",
+      "style": {
+        "navigationBarTitleText": "村干部"
+      }
+    },
+    {
+      "path": "pages/test/index",
+      "style": {
+        "navigationBarTitleText": "测试"
+      }
     }
   ],
   "globalStyle": {
@@ -43,25 +113,25 @@
     "navigationBarTitleText": "uni-app",
     "navigationBarBackgroundColor": "#F8F8F8",
     "backgroundColor": "#F8F8F8"
-  },
-  "tabBar": {
-    "color": "#7A7E83",
-    "selectedColor": "#007AFF",
-    "borderStyle": "black",
-    "backgroundColor": "#ffffff",
-    "list": [
-      {
-        "pagePath": "pages/index/index",
-        "text": "首页",
-        "iconPath": "static/home.png",
-        "selectedIconPath": "static/home-selected.png"
-      },
-      {
-        "pagePath": "pages/my/index",
-        "text": "我的",
-        "iconPath": "static/my.png",
-        "selectedIconPath": "static/my-selected.png"
-      }
-    ]
   }
+//  "tabBar": {
+//    "color": "#7A7E83",
+//    "selectedColor": "#007AFF",
+//    "borderStyle": "black",
+//    "backgroundColor": "#ffffff",
+//    "list": [
+//      {
+//        "pagePath": "pages/index/index",
+//        "text": "首页",
+//        "iconPath": "static/home.png",
+//        "selectedIconPath": "static/home-selected.png"
+//      },
+//      {
+//        "pagePath": "pages/my/index",
+//        "text": "我的",
+//        "iconPath": "static/my.png",
+//        "selectedIconPath": "static/my-selected.png"
+//      }
+//    ]
+//  }
 }

+ 138 - 0
src/pages/index/index.vue

@@ -0,0 +1,138 @@
+<template>
+  <view class="w-full h-[100rpx] bg-[#f5f5f5] flex items-center justify-center" @click="navigateToTest">进入测试页面</view>
+  <view class="flex flex-col items-center justify-start bg-[#f5f5f5]">
+
+    <!-- 轮播图 -->
+    <swiper class="w-full h-[300rpx] mb-[20rpx]" :indicator-dots="true" :autoplay="true" interval="3000" duration="500"
+            :circular="true">
+      <swiper-item v-for="(item, index) in bannerList" :key="index">
+        <image :src="item.imageUrl" class="w-full object-contain" mode="aspectFill" />
+      </swiper-item>
+    </swiper>
+
+    <!-- 三个图标 -->
+    <view class="flex justify-around w-full py-[20rpx] bg-white rounded-[12rpx] mb-[20rpx]">
+      <view class="flex flex-col items-center p-[20rpx] w-[200rpx] text-center" @click="handleIconClick('farmer')">
+        <view class="w-[80rpx] h-[80rpx] rounded-full bg-#FFF1E0 flex items-center justify-center shadow">
+          <image src="/static/icon/farmer.png" class="w-[48rpx] h-[48rpx]" />
+        </view>
+        <text class="mt-[10rpx] text-[28rpx] text-[#333]">我是农户</text>
+      </view>
+
+      <view class="flex flex-col items-center p-[20rpx] w-[200rpx] text-center" @click="handleIconClick('investigator')">
+        <view class="w-[80rpx] h-[80rpx] rounded-full bg-#FFE4E0 flex items-center justify-center shadow">
+          <image src="/static/icon/investigator.png" class="w-[48rpx] h-[48rpx]" />
+        </view>
+        <text class="mt-[10rpx] text-[28rpx] text-[#333]">我是调查员</text>
+      </view>
+
+      <view class="flex flex-col items-center p-[20rpx] w-[200rpx] text-center" @click="handleIconClick('official')">
+        <view class="w-[80rpx] h-[80rpx] rounded-full bg-#E3E3FF flex items-center justify-center shadow">
+          <image src="/static/icon/official.png" class="w-[48rpx] h-[48rpx]" />
+        </view>
+        <text class="mt-[10rpx] text-[28rpx] text-[#333]">我是村干部</text>
+      </view>
+    </view>
+
+    <!-- 新闻 -->
+    <view class="w-full bg-white rounded-[12rpx] py-[20rpx]">
+      <view class="text-[32rpx] font-bold text-[#333] mb-[20rpx]">新闻政策</view>
+
+      <view class="flex flex-col gap-[20rpx]">
+        <view v-for="(news, index) in newsList" :key="index" class="flex bg-white rounded-[12rpx] overflow-hidden shadow" @click="toDetail(news)">
+          <view class="flex-1 p-[20rpx] flex flex-col justify-between">
+            <text class="text-[28rpx] text-[#333] leading-snug mb-[10rpx]">{{ news.title }}</text>
+            <text class="text-[24rpx] text-[#666] mb-[10rpx]">{{ news.time }}</text>
+            <view class="flex items-center text-[24rpx] text-[#666]">
+              <view class="text-[#007aff] mr-[10rpx]">{{ news.source }}</view>
+              <view class="ml-[10rpx] flex items-center">
+                <image src="/static/icon/eye.png" class="w-[36rpx] h-[36rpx]" />
+                <text>{{ news.views }} 次</text>
+              </view>
+            </view>
+          </view>
+<!--          <image :src="news.image" class="w-[180rpx] h-[120rpx]" mode="aspectFill" />-->
+          <div class="bg-blue w-[180rpx] h-190rpx my-5rpx"></div>
+        </view>
+      </view>
+    </view>
+  <CustomTabBar :current="0" />
+  </view>
+</template>
+
+<script setup lang="ts">
+import { ref } from 'vue'
+import CustomTabBar from "@/components/CustomTabBar.vue";
+
+const navigateToTest = () => {
+  uni.navigateTo({
+    url: '/pages/test/index'
+  })
+}
+
+// 轮播图数据
+const bannerList = ref([
+  {
+    imageUrl: '/static/banner/banner1.png'
+  },
+  {
+    imageUrl: '/static/banner/banner2.png'
+  },
+  {
+    imageUrl: '/static/banner/banner3.png'
+  }
+])
+
+// 新闻列表数据
+const newsList = ref([
+  {
+    title: '湖南省第二轮土地承包到期后再延长30年政策问题解答(1)',
+    time: '2025-08-19 18:02:55',
+    source: '实时新闻',
+    views: 29771,
+    image: '/static/news/news1.jpg',
+    content: '湖南省第二轮planting到期后再延长30年政策问题解答(1)'
+  },
+  {
+    title: '农业农村部:稳妥推进第二轮土地承包到期后再延长30年试点',
+    time: '2025-08-19 18:01:53',
+    source: '实时新闻',
+    views: 15643,
+    image: '/static/news/news2.jpg',
+    content: '农业农村部:稳妥推进第二轮土地承包到期后再延长30年试点'
+  },
+  {
+    title: '关于加强农村土地流转管理的通知',
+    time: '2025-08-18 16:30:22',
+    source: '政策发布',
+    views: 8921,
+    image: '/static/news/news3.jpg',
+    content: '关于加强农村土地流转管理的通知'
+  },
+  {
+    title: '乡村振兴战略实施情况报告',
+    time: '2025-08-17 14:25:11',
+    source: '专题报道',
+    views: 12345,
+    image: '/static/news/news4.jpg',
+    content: '<p style="color: red">乡村振兴战略实施情况报告</p>'
+  }
+])
+
+// 跳转到新闻详情页面
+const toDetail = (news: any) => {
+  // 存储新闻数据到缓存中
+  uni.setStorageSync('newsParams', news)
+  // 跳转到新闻详情页面
+  uni.navigateTo({
+    url: '/pages/index/news-detail/index'
+  })
+}
+
+// 图标点击处理
+const handleIconClick = (type: 'official'|'investigator'|'farmer') => {
+  uni.navigateTo({
+    url: `/pages/${type}/index`
+  })
+}
+</script>

BIN
src/static/icon/investigator.png


BIN
src/static/icon/official.png


BIN
src/static/my/login.png


BIN
src/static/point.png