index.vue 20 KB

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