Browse Source

增加历史调研列表

bding 1 năm trước cách đây
mục cha
commit
4deedcff86
3 tập tin đã thay đổi với 121 bổ sung0 xóa
  1. 8 0
      src/api/hzyb/report.js
  2. 5 0
      src/router/hzyb/index.js
  3. 108 0
      src/views/hzyb/report/surveyHistory.vue

+ 8 - 0
src/api/hzyb/report.js

@@ -74,4 +74,12 @@ export const apiPublicBannerMark = params=>{
  */
 export const apiPublicBannerList = params=>{
     return get('/public/banner/list',params)
+}
+
+/**
+ * banner历史图列表
+ * @returns 
+ */
+export const bannerHistoryList = params=>{
+    return get('/public/banner_history/list',params)
 }

+ 5 - 0
src/router/hzyb/index.js

@@ -67,5 +67,10 @@ export const hzybRoutes=[
                 component:() => import("@/views/hzyb/report/PreviewPDF.vue")
             }
         ]
+    },
+    {
+        path:'/hzyb/surveyHistory',
+        name:'surveyHistory',
+        component: () => import("@/views/hzyb/report/surveyHistory.vue"),
     }
 ]

+ 108 - 0
src/views/hzyb/report/surveyHistory.vue

@@ -0,0 +1,108 @@
+<script setup>
+import { onMounted, ref } from "vue";
+import { apiPublicBannerList, apiPublicBannerMark, bannerHistoryList } from "@/api/hzyb/report";
+import { List } from "vant";
+const bannerDataList = ref([]);
+
+// banner 获取列表
+async function getBannerList() {
+  const res = await apiPublicBannerList();
+  if (res.code == 200) {
+    // 加载状态结束
+    bannerDataList.value = res.data;
+  }
+}
+
+const loading = ref(false);
+const finished = ref(false);
+
+function surveyHistoryLoad() {
+  if (loading.value) return;
+  page.value++;
+  getSurveyHistoryList();
+}
+const page = ref(1);
+const limit = ref(10);
+const bannerHistoryDataList = ref([]);
+
+// 获取已结束的调研
+async function getSurveyHistoryList() {
+  loading.value = true;
+  const res = await bannerHistoryList({
+    page: page.value,
+    limit: limit.value,
+  });
+  loading.value = false;
+  if (res.code === 200) {
+    let arr = res.data.list || [];
+    bannerHistoryDataList.value = [...bannerHistoryDataList.value, ...arr];
+    if (res.data.paging.is_end) {
+      finished.value = true;
+    }
+  }
+}
+
+// banner 点击事件
+async function bannerSwiperHandler(item) {
+  const res = await apiPublicBannerMark({
+    first_source: 1, //一级来源 1小程序移动 2小程序pc 3研报官网
+    second_source: 2, //二级来源 1首页 2研报详情页
+    id: item.id,
+  });
+  if (res.code === 200) {
+    wx.miniProgram.navigateTo({
+      url: "/pages-report/disseminatePage/disseminatePage?imgHb=" + item.jump_url_mobile + "&title=" + item.remark,
+    });
+  }
+}
+
+onMounted(() => {
+  getBannerList();
+  getSurveyHistoryList();
+  document.title = "调研列表";
+});
+</script>
+
+<template>
+  <div class="container survey-history-content">
+    <div class="state-content">进行中</div>
+    <div class="activity-content" v-for="item in bannerDataList" :key="item.id" @click="bannerSwiperHandler(item)">
+      <img :src="item.image_url_mobile" alt="" />
+    </div>
+    <div class="state-content" style="margin-top:20px">已结束</div>
+    <List v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="surveyHistoryLoad">
+      <div class="activity-content" v-for="item in bannerDataList" :key="item.id" @click="bannerSwiperHandler(item)">
+        <img :src="item.image_url_mobile" alt="" />
+      </div>
+    </List>
+  </div>
+</template>
+
+<style lang="scss" scoped>
+.survey-history-content {
+  padding: 35px;
+  .state-content {
+    position: relative;
+    font-size: 28px;
+    font-weight: 500;
+    padding-left: 15px;
+    &::after {
+      content: "";
+      position: absolute;
+      top: 8px;
+      left: 0;
+      width: 6px;
+      height: 27px;
+      background-color: #e3b377;
+    }
+  }
+  .activity-content {
+    margin-top: 20px;
+    width: 100%;
+    img {
+      width: 100%;
+      height: auto;
+    }
+  }
+}
+</style>