index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. <template>
  2. <page-meta :page-style="isMorningShow ? 'overflow: hidden;' : ''">
  3. <view class="container New-container">
  4. <view :class="['content-search', bannerClass && 'banne-bg', bannerPosition && 'banner-Position']">
  5. <view class="top-content-box">
  6. <search-bar @goSearch="goSearch" :searchTitle="searchPlaceholderList.SummarySearch" :width="58">
  7. <template slot="content-left">
  8. <view class="box-img" @click="goMyInfo">
  9. <view class="content-img">
  10. <image v-if="info.Headimgurl" :src="info.Headimgurl" alt=""></image>
  11. <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/logo.png" class="avatar"></image>
  12. </view>
  13. </view>
  14. </template>
  15. </search-bar>
  16. </view>
  17. </view>
  18. <view class="banne-content" v-if="bannerDataList.length">
  19. <swiper autoplay :interval="4000" circular indicator-dots>
  20. <view v-for="item in bannerDataList" :key="item.BannerId" @click="bannerSwiperHandler(item)">
  21. <swiper-item>
  22. <image :src="item.IndexImg"></image>
  23. <view class="banner-title">
  24. <text class="text_twoLine" :style="{ 'font-size': item.Subtitle.length > 24 ? '45rpx' : '50rpx' }">
  25. {{ item.Title }}
  26. </text>
  27. <text class="time text_twoLine"> {{ item.Subtitle }}</text>
  28. </view>
  29. </swiper-item>
  30. </view>
  31. </swiper>
  32. </view>
  33. <view
  34. v-if="isTopHeight"
  35. class="lable-select-content"
  36. :style="[{ top: isTopHeight }, { 'background-color': isScrollNumber >= 175 ? '#fff' : '#f5f6fa' }, { 'box-shadow': isScrollNumber >= 175 ? '0rpx 3rpx 8rpx 0rpx rgba(0, 0, 0, 0.16)' : '' }]"
  37. >
  38. <view class="lable-row" v-for="(item, index) in lableIsRows" :key="index">
  39. <view :class="['lable-item', lable.isAct && 'item-active']" v-for="lable in item" :key="lable.TagId" @click="lableKeysHandler(lable)">
  40. {{ lable.TagName }}
  41. </view>
  42. </view>
  43. </view>
  44. <block v-if="newDataList && newDataList.length">
  45. <view class="content-ul">
  46. <view class="item-ul">
  47. <block v-for="(item, index) in newDataList" :key="index">
  48. <view v-if="index % 2 == 0 && item.IsShowData">
  49. <block v-if="item.Source === 'article' || item.Source === 'yanxuanspecial'"> <ReportItem :list="item.Article" /></block>
  50. <block v-if="item.Source === 'newchart'">
  51. <ChartItem :list="item.Newchart" :isMyChartCollection="isMyChartCollection" @myChartIsTop="myChartIsTop" @myChartCollect="myChartCollect" />
  52. </block>
  53. <block v-if="item.Source === 'roadshow' || item.Source === 'activityvideo' || item.Source === 'activityvoice'">
  54. <RoadshowItem :list="item.Roadshow" @isCollectionHandeler="isCollectionHandeler" />
  55. </block>
  56. <block v-if="item.Source === 'activity' || item.Source === 'activityspecial'">
  57. <ActivityItem :list="item.Activity" />
  58. </block>
  59. <block v-if="['researchsummary', 'minutessummary', 'meetingreviewchapt', 'productinterior', 'reportselection'].includes(item.Source)">
  60. <item-content :list="dataListItem(item)" @showMorningDialog="showMorningDialog" />
  61. </block>
  62. </view>
  63. </block>
  64. </view>
  65. <view class="item-ul">
  66. <block v-for="(item, index) in newDataList" :key="index">
  67. <view v-if="index % 2 !== 0 && item.IsShowData">
  68. <block v-if="item.Source === 'article' || item.Source === 'yanxuanspecial'"> <ReportItem :list="item.Article" /></block>
  69. <block v-if="item.Source === 'newchart'">
  70. <ChartItem :list="item.Newchart" :isMyChartCollection="isMyChartCollection" @myChartIsTop="myChartIsTop" @myChartCollect="myChartCollect" />
  71. </block>
  72. <block v-if="item.Source === 'roadshow' || item.Source === 'activityvideo' || item.Source === 'activityvoice'">
  73. <RoadshowItem :list="item.Roadshow" @isCollectionHandeler="isCollectionHandeler" />
  74. </block>
  75. <block v-if="item.Source === 'activity' || item.Source === 'activityspecial'">
  76. <ActivityItem :list="item.Activity" />
  77. </block>
  78. <block v-if="['researchsummary', 'minutessummary', 'meetingreviewchapt', 'productinterior', 'reportselection'].includes(item.Source)">
  79. <item-content :list="dataListItem(item)" @showMorningDialog="showMorningDialog" />
  80. </block>
  81. </view>
  82. </block>
  83. </view>
  84. </view>
  85. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="page_no > 1" />
  86. </block>
  87. <view class="nodata" v-else>
  88. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
  89. <text style="">暂无数据</text>
  90. </view>
  91. <!-- <view v-if="newDataList.length === 4" class="bind-btn">
  92. <view @click="goLogin"> 为了给您提供更好的使用体验,<br />请 <text class="login-text">登录</text>后再查看此页面内容</view>
  93. </view> -->
  94. <morning-dlg v-if="isMorningShow" :isMorningShow.sync="isMorningShow" :morningItem.sync="morningItem" />
  95. </view>
  96. <suspenButton :show.sync="wholeShowListData.IsShow" v-if="wholeShowListData.IsShow" ref="suspenButton">
  97. <template slot="center">
  98. <image mode="widthFix" style="height: 120rpx; width: 120rpx" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/new_cygx/most_confidential.png "> </image>
  99. </template>
  100. <template slot="top">
  101. <image @click.stop="goSecretDetail(1)" mode="widthFix" style="height: 120rpx; width: 120rpx" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/company_icon.png"> </image>
  102. </template>
  103. <template slot="left">
  104. <image @click.stop="goSecretDetail(3)" mode="widthFix" style="height: 120rpx; width: 120rpx" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/week_summary.png"> </image>
  105. </template>
  106. </suspenButton>
  107. <Loading />
  108. <videoModule :showVideoPop.sync="showVideoPopUp" :videoPopList="videoPopListUp" />
  109. </page-meta>
  110. </template>
  111. <script>
  112. import { Home, Mine } from "@/config/api";
  113. import ChartItem from "@/components/ItemComponent/chartItem.vue";
  114. import ReportItem from "@/components/ItemComponent/reportItem.vue";
  115. import RoadshowItem from "@/components/ItemComponent/roadshowItem.vue";
  116. import ActivityItem from "@/components/ItemComponent/activityItem.vue";
  117. import SearchBar from "@/components/search-bar/searchBar.vue";
  118. import MorningDlg from "./components/morningDlg.vue";
  119. import ItemContent from "./components/ItemContent.vue";
  120. import videoModule from "@/components/videoModule/index";
  121. import suspenButton from "@/components/suspen_button.vue";
  122. export default {
  123. data() {
  124. return {
  125. newDataList: [],
  126. page_no: 1,
  127. pageSize: 10,
  128. status: "loadmore",
  129. refresh: false, //正在下拉
  130. loadText: {
  131. loadmore: "上拉加载更多",
  132. loading: "加载中",
  133. nomore: "已经到底了",
  134. },
  135. info: {},
  136. isMorningShow: false, // 晨会的弹框
  137. morningItem: {}, // 晨会的弹框
  138. bannerDataList: [], // banner数据
  139. showVideoPopUp: false, //
  140. videoPopListUp: {},
  141. isScrollNumber: 0,
  142. dataListLable: [], // 标签的数据
  143. actIdLable: "", // 标签选择后的ID
  144. isTopHeight: "",
  145. lableArrList: [],
  146. };
  147. },
  148. computed: {
  149. bannerClass() {
  150. //判断banner的样式
  151. return this.bannerDataList.length > 0 && this.isScrollNumber < 235;
  152. },
  153. bannerPosition() {
  154. return this.bannerDataList.length > 0;
  155. },
  156. lableIsRows() {
  157. //处理标签的样式
  158. const numTags = this.dataListLable.length;
  159. const rows = [];
  160. if (numTags <= 4) {
  161. rows.push(this.dataListLable);
  162. } else if (numTags > 4 && numTags <= 8) {
  163. const firstRow = this.dataListLable.slice(0, 4);
  164. const secondRow = this.dataListLable.slice(4);
  165. rows.push(firstRow, secondRow);
  166. } else if (numTags >= 9) {
  167. const firstRow = this.dataListLable.filter((_, index) => index % 2 === 0);
  168. const secondRow = this.dataListLable.filter((_, index) => index % 2 !== 0);
  169. rows.push(firstRow, secondRow);
  170. }
  171. return rows;
  172. },
  173. },
  174. components: {
  175. ChartItem,
  176. ReportItem,
  177. RoadshowItem,
  178. ActivityItem,
  179. SearchBar,
  180. MorningDlg,
  181. ItemContent,
  182. videoModule,
  183. suspenButton,
  184. },
  185. methods: {
  186. // 获取最先数据
  187. async getNewList() {
  188. const res = await Home.getNewList({
  189. PageSize: this.pageSize,
  190. CurrentIndex: this.page_no,
  191. TagIds: this.actIdLable,
  192. });
  193. if (res.Ret === 200) {
  194. this.status = !res.Data.Paging.IsEnd ? "loadmore" : "nomore";
  195. let listArr = [];
  196. res.Data.List &&
  197. res.Data.List.forEach((item) => {
  198. let obj = {
  199. Source: item.Source,
  200. Article: item.Article || item.YanxuanSpecial,
  201. Newchart: item.Newchart,
  202. Activity: item.Activity || item.Activityspecial,
  203. Roadshow: item.Roadshow || item.Activityvideo || item.Activityvoice,
  204. ThreeSummary: item.Researchsummary || item.Minutessummary || item.Meetingreviewchapt || item.ProductInterior || item.ReportSelection,
  205. };
  206. listArr.push({ ...obj, IsShowData: obj.Article || obj.Newchart || obj.Roadshow || obj.Activity || obj.ThreeSummary || item.YanxuanSpecial });
  207. });
  208. this.newDataList = this.page_no === 1 ? listArr : [...this.newDataList, ...listArr];
  209. if (this.refresh) {
  210. uni.stopPullDownRefresh();
  211. this.refresh = false;
  212. }
  213. }
  214. },
  215. // 微路演收藏
  216. async isCollectionHandeler(item) {
  217. await this.$store.dispatch("showLoginModal");
  218. const res = await Home.microRoadshowCollect({
  219. Id: item.Id,
  220. SourceType: item.Type,
  221. PageRouter: this.$store.state.pageRouterReport,
  222. });
  223. if (res.Ret === 200) {
  224. let index = this.newDataList.findIndex((key) => key.Roadshow && key.Roadshow.Id == item.Id);
  225. res.Data.Status == 1 ? (this.newDataList[index].Roadshow.IsCollect = true) : (this.newDataList[index].Roadshow.IsCollect = false);
  226. uni.showToast({
  227. title: res.Msg,
  228. duration: 2000,
  229. });
  230. }
  231. },
  232. // 跳转到我的页面
  233. goMyInfo() {
  234. uni.navigateTo({
  235. url: "/pageMy/myPage/myPage",
  236. });
  237. },
  238. // 跳转绑定页面
  239. goLogin() {
  240. uni.showModal({
  241. title: "即将前往登录页面,请确认是否继续",
  242. content: "为了给您提供更好的使用体验,请登录后再进行查看或操作",
  243. confirmColor: "#3385FF",
  244. cancelColor: "#606266",
  245. success: function (res) {
  246. if (res.confirm) {
  247. //已授权未绑定
  248. uni.navigateTo({
  249. url: "/pageMy/login/login",
  250. });
  251. } else if (res.cancel) {
  252. console.log("用户点击取消");
  253. }
  254. },
  255. });
  256. },
  257. /* 搜索 */
  258. goSearch() {
  259. uni.navigateTo({ url: "/pages-search/indedxSearch/indedxSearch?isType=" + this.topTabsActive + "&source=首页页面" });
  260. },
  261. async getUserInfo() {
  262. const res = await Mine.getInfo();
  263. if (res.Ret === 200) {
  264. this.info = res.Data;
  265. }
  266. },
  267. // 晨会弹框显示
  268. showMorningDialog(item) {
  269. console.log(item);
  270. if (item.Source == "meetingreviewchapt") {
  271. this.isMorningShow = true;
  272. this.morningItem = item;
  273. }
  274. },
  275. dataListItem(item) {
  276. let obj = item.ThreeSummary ? { ...item.ThreeSummary, Source: item.Source } : {};
  277. return obj;
  278. },
  279. /* 绝密标签点击后的跳转 */
  280. goSecretDetail(type) {
  281. if (type == 1) {
  282. uni.navigateTo({
  283. url: "/reportPages/keyCompany/keyCompany",
  284. });
  285. } else {
  286. uni.navigateTo({
  287. url: "/reportPages/secretDetails/secretDetails",
  288. });
  289. }
  290. this.$refs.suspenButton.onOpen();
  291. },
  292. // 获取banner 列表
  293. async getBannerList() {
  294. const res = await Home.bannerList();
  295. if (res.Ret === 200) {
  296. this.bannerDataList = res.Data.List || [];
  297. }
  298. },
  299. // bannaer 点击事件
  300. async bannerSwiperHandler(item) {
  301. let { Type, SourceId, Path } = item.BannerUrlResp;
  302. if (Type == 1) return;
  303. await Home.bannerHistory({
  304. BannerId: item.BannerId,
  305. });
  306. if (Type == 5) {
  307. let obj = {
  308. BackgroundImg: "https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/my_log.png",
  309. Id: SourceId,
  310. PlaySeconds: "15",
  311. ResourceUrl: "https://hzstatic.hzinsights.com/static/yb/video/8617330c2a76e0c35999f6466b4470c4.mp4",
  312. Title: "三分钟了解弘则研究体系和方法论",
  313. Type: "三分钟了解弘则研究体系和方法论",
  314. };
  315. this.videoPopListUp = obj;
  316. this.showVideoPopUp = true;
  317. await Mine.addHistory();
  318. } else {
  319. Path &&
  320. uni.navigateTo({
  321. url: Path + SourceId,
  322. });
  323. }
  324. },
  325. async lableKeysHandler(item) {
  326. const checkList = item.CheckList;
  327. if (item.isAct) {
  328. item.isAct = false;
  329. this.lableArrList = this.lableArrList.filter((key) => checkList.includes(key));
  330. this.getLableDataList();
  331. return;
  332. }
  333. let isFlag = false; //是否有交集
  334. for (let e of checkList) {
  335. if (this.lableArrList.includes(e)) {
  336. isFlag = true;
  337. break;
  338. }
  339. }
  340. if (!isFlag) {
  341. this.lableArrList = [...this.lableArrList, ...checkList];
  342. item.isAct = true;
  343. } else {
  344. //有交集
  345. // 找到有交集的那个 设置为false 然后将点击的这个设置为true
  346. this.lableIsRows.forEach((e1) => {
  347. e1.forEach((e2) => {
  348. let flag = false;
  349. for (let i of e2.CheckList) {
  350. if (this.lableArrList.includes(i)) {
  351. flag = true;
  352. break;
  353. }
  354. }
  355. if (flag) {
  356. e2.isAct = false;
  357. }
  358. });
  359. });
  360. item.isAct = true;
  361. }
  362. this.getLableDataList();
  363. if (!item.isAct) return;
  364. const res = await Home.tagAddHistory({
  365. TagId: item.TagId,
  366. });
  367. },
  368. getLableDataList() {
  369. let actId = [];
  370. this.lableIsRows.forEach((item) => {
  371. item.forEach((_) => {
  372. _.isAct && actId.push(_.TagId);
  373. });
  374. });
  375. this.page_no = 1;
  376. this.actIdLable = actId.join(",");
  377. this.getNewList();
  378. },
  379. // 或者标签内容
  380. async homeTagListCustom() {
  381. const res = await Home.homeTagListCustom();
  382. if (res.Ret === 200) {
  383. const arr = res.Data || [];
  384. this.dataListLable = arr.map((item) => {
  385. return {
  386. ...item,
  387. isAct: false,
  388. };
  389. });
  390. }
  391. },
  392. },
  393. mounted() {
  394. uni.$on("updateNewList", (data) => {
  395. this.page_no = 1;
  396. this.getNewList();
  397. });
  398. },
  399. onLoad() {
  400. this.getBannerList();
  401. this.getNewList();
  402. this.homeTagListCustom();
  403. let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
  404. this.isTopHeight = menuButtonInfo.height + menuButtonInfo.top + 7 + "px";
  405. },
  406. onShow() {
  407. this.getUserInfo();
  408. this.getRecordTracking("首页");
  409. this.$store.commit("setRouterActivity", "首页");
  410. this.$store.commit("setRouterReport", "首页");
  411. },
  412. // 加载数据
  413. onReachBottom() {
  414. if (this.status === "nomore" || this.newDataList.length < 8) return;
  415. this.status = "loading";
  416. this.page_no++;
  417. this.getNewList();
  418. },
  419. // 下拉刷新
  420. onPullDownRefresh() {
  421. this.page_no = 1;
  422. this.refresh = true;
  423. this.getNewList();
  424. },
  425. onPageScroll(val) {
  426. this.isScrollNumber = val.scrollTop;
  427. },
  428. /** 用户点击分享*/
  429. onShareAppMessage: function ({ from, target }) {
  430. if (from === "button") {
  431. let item = target.dataset.item;
  432. let audio_id = item.Type == 1 || item.AudioType == 1 ? item.Id : "";
  433. // type=2 -- 活动视频 type=3 -- 产业视频
  434. let video_id = item.Type == 2 || item.Type == 3 ? item.Id : "";
  435. let activity_id = item.Type == 2 && item.ActivityId > 0 ? item.ActivityId : "";
  436. let title_share = item.AudioTitle || item.Title;
  437. this.getRecordTracking("首页转发", { ActivityId: item.ActivityId, Id: item.Id, Type: item.Type });
  438. return {
  439. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : title_share,
  440. path: "/pages/material/material?topTabsActive=4" + "&audioShareId=" + audio_id + "&videoShareId=" + video_id + "&activityId=" + activity_id,
  441. imageUrl: item.AudioShareImg || item.ShareImg,
  442. };
  443. } else {
  444. return {
  445. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : "弘则研究—聚焦·前瞻·客观·深度",
  446. path: "/pages/index/index",
  447. success: (res) => {},
  448. fail: (err) => {},
  449. };
  450. }
  451. },
  452. };
  453. </script>
  454. <style lang="scss" scoped>
  455. .New-container {
  456. background-color: #f5f6fa;
  457. .content-search {
  458. position: sticky;
  459. top: 0;
  460. left: 0;
  461. width: 100%;
  462. z-index: 9;
  463. .top-content-box {
  464. position: sticky;
  465. top: 0;
  466. left: 0;
  467. width: 100%;
  468. z-index: 9;
  469. }
  470. }
  471. .banner-Position {
  472. position: fixed !important;
  473. }
  474. .banne-bg {
  475. /deep/ .nav-bar-wrap {
  476. background-color: transparent;
  477. }
  478. }
  479. .banne-content {
  480. height: 402rpx;
  481. width: 100%;
  482. overflow: hidden;
  483. swiper {
  484. height: 402rpx;
  485. }
  486. image {
  487. width: 100%;
  488. height: 100%;
  489. }
  490. .banner-title {
  491. position: absolute;
  492. bottom: 35rpx;
  493. left: 20rpx;
  494. color: #fff;
  495. font-weight: 500;
  496. line-height: 65rpx;
  497. min-height: 160rpx;
  498. max-height: 225rpx;
  499. overflow: hidden;
  500. .time {
  501. font-size: 28rpx;
  502. line-height: 39rpx;
  503. }
  504. }
  505. .top-content-box {
  506. position: absolute;
  507. top: 0;
  508. left: 0;
  509. width: 100%;
  510. z-index: 9;
  511. }
  512. }
  513. /deep/ .nav-bar-wrap {
  514. padding-left: 35rpx;
  515. .box-img {
  516. position: relative;
  517. height: 64rpx;
  518. width: 64rpx;
  519. display: flex;
  520. align-items: center;
  521. justify-content: center;
  522. margin-right: 20rpx;
  523. border-radius: 50%;
  524. image {
  525. width: 64rpx;
  526. height: 64rpx;
  527. }
  528. .content-img {
  529. position: absolute;
  530. top: 0;
  531. left: 0;
  532. width: 64rpx;
  533. height: 64rpx;
  534. border-radius: 50%;
  535. overflow: hidden;
  536. z-index: 9;
  537. }
  538. }
  539. }
  540. .content-ul {
  541. padding: 20rpx 10rpx;
  542. display: flex;
  543. justify-content: space-between;
  544. .item-ul {
  545. width: 49%;
  546. &:first-child {
  547. margin-right: 10rpx;
  548. }
  549. }
  550. }
  551. .bind-btn {
  552. padding-top: 110rpx;
  553. text-align: center;
  554. font-size: 24rpx;
  555. color: #333;
  556. line-height: 39rpx;
  557. padding-bottom: 100rpx;
  558. .login-text {
  559. display: inline-block;
  560. color: #3385ff;
  561. }
  562. }
  563. .lable-select-content {
  564. position: sticky;
  565. left: 0;
  566. top: 88px;
  567. overflow: hidden;
  568. overflow-x: auto;
  569. width: 100%;
  570. background-color: #fff;
  571. padding: 10rpx 0 20rpx 20rpx;
  572. z-index: 9;
  573. .lable-row {
  574. display: flex;
  575. font-size: 24rpx;
  576. }
  577. .lable-item {
  578. flex-shrink: 0;
  579. padding: 8rpx 40rpx;
  580. background: #ffffff;
  581. border: 1rpx solid #dcdfe6;
  582. border-radius: 39rpx;
  583. margin-right: 20rpx;
  584. white-space: nowrap;
  585. margin-top: 20rpx;
  586. color: #999999;
  587. }
  588. .item-active {
  589. border:none;
  590. font-weight: 500;
  591. background: #e5efff;
  592. color: $uni-color-new;
  593. }
  594. }
  595. }
  596. </style>