index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  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'].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'].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. };
  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,
  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,
  205. };
  206. listArr.push({ ...obj, IsShowData: obj.Article || obj.Newchart || obj.Roadshow || obj.Activity || obj.ThreeSummary });
  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. this.$store.dispatch("checkHandle", "/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. let actId = [];
  327. this.$set(item, "isAct", !item.isAct);
  328. this.lableIsRows.forEach((item) => {
  329. item.forEach((_) => {
  330. _.isAct && actId.push(_.TagId);
  331. });
  332. });
  333. this.page_no = 1;
  334. this.actIdLable = actId.join(",");
  335. this.getNewList();
  336. if (!item.isAct) return;
  337. const res = await Home.tagAddHistory({
  338. TagId: item.TagId,
  339. });
  340. },
  341. // 或者标签内容
  342. async homeTagListCustom() {
  343. const res = await Home.homeTagListCustom();
  344. if (res.Ret === 200) {
  345. this.dataListLable = res.Data || [];
  346. }
  347. },
  348. },
  349. mounted() {
  350. uni.$on("updateNewList", (data) => {
  351. this.page_no = 1;
  352. this.getNewList();
  353. });
  354. },
  355. onLoad() {
  356. this.getBannerList();
  357. this.getNewList();
  358. this.homeTagListCustom();
  359. let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
  360. this.isTopHeight = menuButtonInfo.height + menuButtonInfo.top + 7 + "px";
  361. },
  362. onShow() {
  363. this.getUserInfo();
  364. this.getRecordTracking("首页");
  365. this.$store.commit("setRouterActivity", "首页");
  366. this.$store.commit("setRouterReport", "首页");
  367. },
  368. // 加载数据
  369. onReachBottom() {
  370. if (this.status === "nomore" || this.newDataList.length < 8) return;
  371. this.status = "loading";
  372. this.page_no++;
  373. this.getNewList();
  374. },
  375. // 下拉刷新
  376. onPullDownRefresh() {
  377. this.page_no = 1;
  378. this.refresh = true;
  379. this.getNewList();
  380. },
  381. onPageScroll(val) {
  382. this.isScrollNumber = val.scrollTop;
  383. },
  384. /** 用户点击分享*/
  385. onShareAppMessage: function ({ from, target }) {
  386. if (from === "button") {
  387. let item = target.dataset.item;
  388. let audio_id = item.Type == 1 || item.AudioType == 1 ? item.Id : "";
  389. // type=2 -- 活动视频 type=3 -- 产业视频
  390. let video_id = item.Type == 2 || item.Type == 3 ? item.Id : "";
  391. let activity_id = item.Type == 2 && item.ActivityId > 0 ? item.ActivityId : "";
  392. let title_share = item.AudioTitle || item.Title;
  393. this.getRecordTracking("首页转发", { ActivityId: item.ActivityId, Id: item.Id, Type: item.Type });
  394. return {
  395. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : title_share,
  396. path: "/pages/material/material?topTabsActive=4" + "&audioShareId=" + audio_id + "&videoShareId=" + video_id + "&activityId=" + activity_id,
  397. imageUrl: item.AudioShareImg || item.ShareImg,
  398. };
  399. } else {
  400. return {
  401. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : "弘则研究—聚焦·前瞻·客观·深度",
  402. path: "/pages/index/index",
  403. success: (res) => {},
  404. fail: (err) => {},
  405. };
  406. }
  407. },
  408. };
  409. </script>
  410. <style lang="scss" scoped>
  411. .New-container {
  412. background-color: #f5f6fa;
  413. .content-search {
  414. position: sticky;
  415. top: 0;
  416. left: 0;
  417. width: 100%;
  418. z-index: 9;
  419. .top-content-box {
  420. position: sticky;
  421. top: 0;
  422. left: 0;
  423. width: 100%;
  424. z-index: 9;
  425. }
  426. }
  427. .banner-Position {
  428. position: fixed !important;
  429. }
  430. .banne-bg {
  431. /deep/ .nav-bar-wrap {
  432. background-color: transparent;
  433. }
  434. }
  435. .banne-content {
  436. height: 402rpx;
  437. width: 100%;
  438. overflow: hidden;
  439. swiper {
  440. height: 402rpx;
  441. }
  442. image {
  443. width: 100%;
  444. height: 100%;
  445. }
  446. .banner-title {
  447. position: absolute;
  448. bottom: 35rpx;
  449. left: 20rpx;
  450. color: #fff;
  451. font-weight: 500;
  452. line-height: 65rpx;
  453. min-height: 160rpx;
  454. max-height: 225rpx;
  455. overflow: hidden;
  456. .time {
  457. font-size: 28rpx;
  458. line-height: 39rpx;
  459. }
  460. }
  461. .top-content-box {
  462. position: absolute;
  463. top: 0;
  464. left: 0;
  465. width: 100%;
  466. z-index: 9;
  467. }
  468. }
  469. /deep/ .nav-bar-wrap {
  470. padding-left: 35rpx;
  471. .box-img {
  472. position: relative;
  473. height: 88rpx;
  474. width: 165rpx;
  475. display: flex;
  476. align-items: center;
  477. justify-content: center;
  478. margin-right: 20rpx;
  479. border-radius: 50%;
  480. image {
  481. width: 80rpx;
  482. height: 80rpx;
  483. }
  484. .content-img {
  485. position: absolute;
  486. top: 0;
  487. left: 0;
  488. width: 80rpx;
  489. height: 80rpx;
  490. border-radius: 50%;
  491. overflow: hidden;
  492. z-index: 9;
  493. }
  494. .content-my {
  495. width: 163rpx;
  496. height: 64rpx;
  497. margin-left: 2rpx;
  498. display: flex;
  499. align-items: center;
  500. background-color: #f7f7f7;
  501. border-radius: 38rpx;
  502. color: #333333;
  503. font-size: 28rpx;
  504. padding-right: 18rpx;
  505. justify-content: flex-end;
  506. }
  507. }
  508. }
  509. .content-ul {
  510. padding: 30rpx 10rpx;
  511. display: flex;
  512. justify-content: space-between;
  513. .item-ul {
  514. width: 49%;
  515. &:first-child {
  516. margin-right: 10rpx;
  517. }
  518. }
  519. }
  520. .bind-btn {
  521. padding-top: 110rpx;
  522. text-align: center;
  523. font-size: 24rpx;
  524. color: #333;
  525. line-height: 39rpx;
  526. padding-bottom: 100rpx;
  527. .login-text {
  528. display: inline-block;
  529. color: #3385ff;
  530. }
  531. }
  532. .lable-select-content {
  533. position: sticky;
  534. left: 0;
  535. top: 88px;
  536. overflow: hidden;
  537. overflow-x: auto;
  538. width: 100%;
  539. background-color: #fff;
  540. padding: 10rpx 0 10rpx 20rpx;
  541. z-index: 9;
  542. .lable-row {
  543. display: flex;
  544. }
  545. .lable-item {
  546. flex-shrink: 0;
  547. padding: 8rpx 40rpx;
  548. background: #ffffff;
  549. border: 1rpx solid #dcdfe6;
  550. border-radius: 48rpx;
  551. margin-right: 20rpx;
  552. white-space: nowrap;
  553. margin-top: 20rpx;
  554. }
  555. .item-active {
  556. background: #3385ff;
  557. color: #fff;
  558. }
  559. }
  560. }
  561. </style>