index.vue 19 KB

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