Переглянути джерело

feat: 首页顶部统计,新增参数控制显示

laiqi 1 рік тому
батько
коміт
adebb7c296
2 змінених файлів з 36 додано та 25 видалено
  1. 3 5
      package.json
  2. 33 20
      src/pages/index/index.vue

+ 3 - 5
package.json

@@ -4,11 +4,9 @@
   "version": "2.5.5",
   "description": "unibest - 最好的 uniapp 开发模板",
   "author": {
-    "name": "feige996",
-    "zhName": "菲鸽",
-    "email": "1020103647@qq.com",
-    "github": "https://github.com/feige996",
-    "gitee": "https://gitee.com/feige996"
+    "name": "laiqi",
+    "email": "419250880@qq.com",
+    "github": "https://github.com/laiqi"
   },
   "license": "MIT",
   "repository": "https://github.com/feige996/unibest",

+ 33 - 20
src/pages/index/index.vue

@@ -15,8 +15,18 @@
     <!-- 顶部标题 -->
     <view class="text-xl font-bold text-center py-3 bg-white">达州农机优惠券</view>
 
+    <wd-swiper
+      :list="swiperList"
+      autoplay
+      v-model:current="current"
+      :indicator="{ type: 'dots-bar' } as any"
+      @click="handleSwiperClick"
+      @change="handleSwiperChange"
+      v-if="!statisticsDataShow"
+    ></wd-swiper>
+
     <!-- 数据统计卡片 -->
-    <view class="grid grid-cols-2 gap-3 mb-4">
+    <view class="grid grid-cols-2 gap-3 mb-4" v-else>
       <!-- 总销售额 -->
       <statistics-card
         title="总销售额"
@@ -72,15 +82,6 @@
       />
     </view>
 
-    <!-- <wd-swiper
-      :list="swiperList"
-      autoplay
-      v-model:current="current"
-      :indicator="{ type: 'dots-bar' } as any"
-      @click="handleSwiperClick"
-      @change="handleSwiperChange"
-    ></wd-swiper> -->
-
     <view class="pb-4">
       <!-- 网点地址标题 -->
       <view class="text-lg font-bold py-4 border-b border-gray-100">农机销售网点</view>
@@ -148,7 +149,7 @@
 </template>
 
 <script lang="ts" setup>
-// import banner1 from '@/static/banner1.png'
+import banner1 from '@/static/banner1.png'
 import { ref } from 'vue'
 import { useUserStore } from '@/store/user'
 import { useAppStore } from '@/store/app'
@@ -161,22 +162,24 @@ const userStore = useUserStore()
 const appStore = useAppStore()
 const dictStore = useDictStore()
 const message = useMessage()
-// const current = ref<number>(0)
-// const swiperList = ref([banner1, banner1, banner1])
+
+const statisticsDataShow = ref(false)
+const current = ref<number>(0)
+const swiperList = ref([banner1, banner1, banner1])
 
 const statisticsData = ref([0, 0, 0, 0, 0, 0])
 
 // 获取安全区域距离
 const { safeAreaInsets } = uni.getWindowInfo()
 
-// // 轮播图事件处理
-// function handleSwiperClick(e: any) {
-//   // console.log('轮播图点击', e)
-// }
+// 轮播图事件处理
+function handleSwiperClick(e: any) {
+  // console.log('轮播图点击', e)
+}
 
-// function handleSwiperChange(e: any) {
-//   // console.log('轮播图切换', e)
-// }
+function handleSwiperChange(e: any) {
+  // console.log('轮播图切换', e)
+}
 
 // 网点数据
 const locationList = ref([])
@@ -292,10 +295,20 @@ const getStatisticsData = async () => {
   }
 }
 
+// 获取统计数据是否显示配置
+const getStatisticsDataShow = async () => {
+  const configList = await dictStore.getConfigList('mini_program_index_sumary_show')
+  if (configList.length > 0) {
+    // 将字符串分割后转换为数字类型
+    statisticsDataShow.value = configList[0].substance === '1'
+  }
+}
+
 onShow(() => {
   getUserList()
   showCompleteDialog()
   getStatisticsData()
+  getStatisticsDataShow()
 })
 </script>