Browse Source

Merge branch '10.8' of http://8.136.199.33:3000/hongze/horzi_rai_wxa into CYGX_10.9

hbchen 1 year ago
parent
commit
cd66065af8
2 changed files with 142 additions and 40 deletions
  1. 8 1
      config/modules/Home.js
  2. 134 39
      pages/index/index.vue

+ 8 - 1
config/modules/Home.js

@@ -44,5 +44,12 @@ export const Home = {
   bannerHistory: (params) => {
     return postHttp("/banner/add/history", params, 0);
   },
-  
+  /* 获取标签列表 */
+  homeTagListCustom: (params) => {
+    return getHttp("/tag/list/custom", params, 0);
+  },
+  /* 标签记录点击信息 */
+  tagAddHistory: (params) => {
+    return postHttp("/tag/add/history", params, 0);
+  },
 };

+ 134 - 39
pages/index/index.vue

@@ -31,47 +31,64 @@
           </view>
         </swiper>
       </view>
-      <view class="content-ul">
-        <view class="item-ul">
-          <block v-for="(item, index) in newDataList" :key="index">
-            <view v-if="index % 2 == 0 && item.IsShowData">
-              <block v-if="item.Source === 'article'"> <ReportItem :list="item.Article" /></block>
-              <block v-if="item.Source === 'newchart'">
-                <ChartItem :list="item.Newchart" :isMyChartCollection="isMyChartCollection" @myChartIsTop="myChartIsTop" @myChartCollect="myChartCollect" />
-              </block>
-              <block v-if="item.Source === 'roadshow' || item.Source === 'activityvideo' || item.Source === 'activityvoice'">
-                <RoadshowItem :list="item.Roadshow" @isCollectionHandeler="isCollectionHandeler" />
-              </block>
-              <block v-if="item.Source === 'activity' || item.Source === 'activityspecial'">
-                <ActivityItem :list="item.Activity" />
-              </block>
-              <block v-if="['researchsummary', 'minutessummary', 'meetingreviewchapt', 'productinterior'].includes(item.Source)">
-                <item-content :list="dataListItem(item)" @showMorningDialog="showMorningDialog" />
-              </block>
-            </view>
-          </block>
+      <view
+        v-if="isTopHeight"
+        class="lable-select-content"
+        :style="[{ top: isTopHeight }, { 'background-color': isScrollNumber >= 175 ? '#fff' : '#f5f6fa' }, { 'box-shadow': isScrollNumber >= 175 ? '0rpx 3rpx 8rpx 0rpx rgba(0, 0, 0, 0.16)' : '' }]"
+      >
+        <view class="lable-row" v-for="(item, index) in lableIsRows" :key="index">
+          <view :class="['lable-item', lable.isAct && 'item-active']" v-for="lable in item" :key="lable.TagId" @click="lableKeysHandler(lable)">
+            {{ lable.TagName }}
+          </view>
         </view>
-        <view class="item-ul">
-          <block v-for="(item, index) in newDataList" :key="index">
-            <view v-if="index % 2 !== 0 && item.IsShowData">
-              <block v-if="item.Source === 'article'"> <ReportItem :list="item.Article" /></block>
-              <block v-if="item.Source === 'newchart'">
-                <ChartItem :list="item.Newchart" :isMyChartCollection="isMyChartCollection" @myChartIsTop="myChartIsTop" @myChartCollect="myChartCollect" />
-              </block>
-              <block v-if="item.Source === 'roadshow' || item.Source === 'activityvideo' || item.Source === 'activityvoice'">
-                <RoadshowItem :list="item.Roadshow" @isCollectionHandeler="isCollectionHandeler" />
-              </block>
-              <block v-if="item.Source === 'activity' || item.Source === 'activityspecial'">
-                <ActivityItem :list="item.Activity" />
-              </block>
-              <block v-if="['researchsummary', 'minutessummary', 'meetingreviewchapt', 'productinterior'].includes(item.Source)">
-                <item-content :list="dataListItem(item)" @showMorningDialog="showMorningDialog" />
-              </block>
-            </view>
-          </block>
+      </view>
+      <block v-if="newDataList && newDataList.length">
+        <view class="content-ul">
+          <view class="item-ul">
+            <block v-for="(item, index) in newDataList" :key="index">
+              <view v-if="index % 2 == 0 && item.IsShowData">
+                <block v-if="item.Source === 'article'"> <ReportItem :list="item.Article" /></block>
+                <block v-if="item.Source === 'newchart'">
+                  <ChartItem :list="item.Newchart" :isMyChartCollection="isMyChartCollection" @myChartIsTop="myChartIsTop" @myChartCollect="myChartCollect" />
+                </block>
+                <block v-if="item.Source === 'roadshow' || item.Source === 'activityvideo' || item.Source === 'activityvoice'">
+                  <RoadshowItem :list="item.Roadshow" @isCollectionHandeler="isCollectionHandeler" />
+                </block>
+                <block v-if="item.Source === 'activity' || item.Source === 'activityspecial'">
+                  <ActivityItem :list="item.Activity" />
+                </block>
+                <block v-if="['researchsummary', 'minutessummary', 'meetingreviewchapt', 'productinterior'].includes(item.Source)">
+                  <item-content :list="dataListItem(item)" @showMorningDialog="showMorningDialog" />
+                </block>
+              </view>
+            </block>
+          </view>
+          <view class="item-ul">
+            <block v-for="(item, index) in newDataList" :key="index">
+              <view v-if="index % 2 !== 0 && item.IsShowData">
+                <block v-if="item.Source === 'article'"> <ReportItem :list="item.Article" /></block>
+                <block v-if="item.Source === 'newchart'">
+                  <ChartItem :list="item.Newchart" :isMyChartCollection="isMyChartCollection" @myChartIsTop="myChartIsTop" @myChartCollect="myChartCollect" />
+                </block>
+                <block v-if="item.Source === 'roadshow' || item.Source === 'activityvideo' || item.Source === 'activityvoice'">
+                  <RoadshowItem :list="item.Roadshow" @isCollectionHandeler="isCollectionHandeler" />
+                </block>
+                <block v-if="item.Source === 'activity' || item.Source === 'activityspecial'">
+                  <ActivityItem :list="item.Activity" />
+                </block>
+                <block v-if="['researchsummary', 'minutessummary', 'meetingreviewchapt', 'productinterior'].includes(item.Source)">
+                  <item-content :list="dataListItem(item)" @showMorningDialog="showMorningDialog" />
+                </block>
+              </view>
+            </block>
+          </view>
         </view>
+        <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="page_no > 1" />
+      </block>
+      <view class="nodata" v-else>
+        <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
+        <text style="">暂无数据</text>
       </view>
-      <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="page_no > 1" />
       <view v-if="newDataList.length === 4" class="bind-btn">
         <view @click="goLogin"> 为了给您提供更好的使用体验,<br />请 <text class="login-text">登录</text>后再查看此页面内容</view>
       </view>
@@ -122,14 +139,37 @@ export default {
       showVideoPopUp: false, //
       videoPopListUp: {},
       isScrollNumber: 0,
+      dataListLable: [], // 标签的数据
+      actIdLable: "", // 标签选择后的ID
+      isTopHeight: "",
     };
   },
   computed: {
     bannerClass() {
+      //判断banner的样式
       return this.bannerDataList.length > 0 && this.isScrollNumber < 235;
     },
     bannerPosition() {
-      return this.bannerDataList.length > 0 ;
+      return this.bannerDataList.length > 0;
+    },
+    lableIsRows() {
+      //处理标签的样式
+      const numTags = this.dataListLable.length;
+      const rows = [];
+
+      if (numTags <= 4) {
+        rows.push(this.dataListLable);
+      } else if (numTags > 4 && numTags <= 8) {
+        const firstRow = this.dataListLable.slice(0, 4);
+        const secondRow = this.dataListLable.slice(4);
+        rows.push(firstRow, secondRow);
+      } else if (numTags >= 9) {
+        const firstRow = this.dataListLable.filter((_, index) => index % 2 === 0);
+        const secondRow = this.dataListLable.filter((_, index) => index % 2 !== 0);
+        rows.push(firstRow, secondRow);
+      }
+
+      return rows;
     },
   },
   components: {
@@ -149,6 +189,7 @@ export default {
       const res = await Home.getNewList({
         PageSize: this.pageSize,
         CurrentIndex: this.page_no,
+        TagIds: this.actIdLable,
       });
       if (res.Ret === 200) {
         this.status = !res.Data.Paging.IsEnd ? "loadmore" : "nomore";
@@ -282,6 +323,28 @@ export default {
           });
       }
     },
+    async lableKeysHandler(item) {
+      const res = await Home.tagAddHistory({
+        TagId: item.TagId,
+      });
+      let actId = [];
+      this.$set(item, "isAct", !item.isAct);
+      this.lableIsRows.forEach((item) => {
+        item.forEach((_) => {
+          _.isAct && actId.push(_.TagId);
+        });
+      });
+      this.page_no = 1;
+      this.actIdLable = actId.join(",");
+      this.getNewList();
+    },
+    // 或者标签内容
+    async homeTagListCustom() {
+      const res = await Home.homeTagListCustom();
+      if (res.Ret === 200) {
+        this.dataListLable = res.Data || [];
+      }
+    },
   },
   mounted() {
     uni.$on("updateNewList", (data) => {
@@ -292,6 +355,9 @@ export default {
   onLoad() {
     this.getBannerList();
     this.getNewList();
+    this.homeTagListCustom();
+    let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
+    this.isTopHeight = menuButtonInfo.height + menuButtonInfo.top + 7 + "px";
   },
   onShow() {
     this.getUserInfo();
@@ -466,5 +532,34 @@ export default {
       color: #3385ff;
     }
   }
+  .lable-select-content {
+    position: sticky;
+    left: 0;
+    top: 88px;
+    overflow: hidden;
+    overflow-x: auto;
+    width: 100%;
+    background-color: #fff;
+    padding: 10rpx 0 10rpx 20rpx;
+    z-index: 9;
+
+    .lable-row {
+      display: flex;
+    }
+    .lable-item {
+      flex-shrink: 0;
+      padding: 8rpx 40rpx;
+      background: #ffffff;
+      border: 1rpx solid #dcdfe6;
+      border-radius: 48rpx;
+      margin-right: 20rpx;
+      white-space: nowrap;
+      margin-top: 20rpx;
+    }
+    .item-active {
+      background: #3385ff;
+      color: #fff;
+    }
+  }
 }
 </style>