index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. <template>
  2. <page-meta :page-style="isMorningShow ? 'overflow: hidden;' : ''">
  3. <view class="container New-container">
  4. <view :class="[!bannerDataList.length ? 'banne-content' : 'content-search']">
  5. <swiper v-if="bannerDataList.length" autoplay :interval="4000000" circular indicator-dots>
  6. <view v-for="item in bannerDataList" :key="item.BannerId" @click="bannerSwiperHandler(item)">
  7. <swiper-item>
  8. <image :src="item.IndexImg"></image>
  9. <view class="banner-title">
  10. <text class="text_twoLine" :style="{ 'font-size': item.Subtitle.length > 24 ? '45rpx' : '50rpx' }">
  11. {{ item.Title }}
  12. </text>
  13. <text class="time text_twoLine"> {{ item.Subtitle }}</text>
  14. </view>
  15. </swiper-item>
  16. </view>
  17. </swiper>
  18. <view class="top-content-box">
  19. <search-bar @goSearch="goSearch" :searchTitle="searchPlaceholderList.SummarySearch" :width="44">
  20. <template slot="content-left">
  21. <view class="box-img" @click="goMyInfo">
  22. <view class="content-img">
  23. <image v-if="info.Headimgurl" :src="info.Headimgurl" alt=""></image>
  24. <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/logo.png" class="avatar"></image>
  25. </view>
  26. <view class="content-my"> 我的 </view>
  27. </view>
  28. </template>
  29. </search-bar>
  30. </view>
  31. </view>
  32. <view class="content-ul">
  33. <view class="item-ul">
  34. <block v-for="(item, index) in newDataList" :key="index">
  35. <view v-if="index % 2 == 0">
  36. <block v-if="item.Source === 'article'"> <ReportItem :list="item.Article" /></block>
  37. <block v-if="item.Source === 'newchart'">
  38. <ChartItem
  39. :list="item.Newchart"
  40. :isMyChartCollection="isMyChartCollection"
  41. @myChartIsTop="myChartIsTop"
  42. @myChartCollect="myChartCollect"
  43. />
  44. </block>
  45. <block v-if="item.Source === 'roadshow' || item.Source === 'activityvideo' || item.Source === 'activityvoice'">
  46. <RoadshowItem :list="item.Roadshow" @isCollectionHandeler="isCollectionHandeler" />
  47. </block>
  48. <block v-if="item.Source === 'activity' || item.Source === 'activityspecial'">
  49. <ActivityItem :list="item.Activity" />
  50. </block>
  51. <block v-if="['researchsummary', 'minutessummary', 'meetingreviewchapt', 'productinterior'].includes(item.Source)">
  52. <item-content :list="dataListItem(item)" @showMorningDialog="showMorningDialog" />
  53. </block>
  54. </view>
  55. </block>
  56. </view>
  57. <view class="item-ul">
  58. <block v-for="(item, index) in newDataList" :key="index">
  59. <view v-if="index % 2 !== 0">
  60. <block v-if="item.Source === 'article'"> <ReportItem :list="item.Article" /></block>
  61. <block v-if="item.Source === 'newchart'">
  62. <ChartItem
  63. :list="item.Newchart"
  64. :isMyChartCollection="isMyChartCollection"
  65. @myChartIsTop="myChartIsTop"
  66. @myChartCollect="myChartCollect"
  67. />
  68. </block>
  69. <block v-if="item.Source === 'roadshow' || item.Source === 'activityvideo' || item.Source === 'activityvoice'">
  70. <RoadshowItem :list="item.Roadshow" @isCollectionHandeler="isCollectionHandeler" />
  71. </block>
  72. <block v-if="item.Source === 'activity' || item.Source === 'activityspecial'">
  73. <ActivityItem :list="item.Activity" />
  74. </block>
  75. <block v-if="['researchsummary', 'minutessummary', 'meetingreviewchapt', 'productinterior'].includes(item.Source)">
  76. <item-content :list="dataListItem(item)" @showMorningDialog="showMorningDialog" />
  77. </block>
  78. </view>
  79. </block>
  80. </view>
  81. </view>
  82. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="page_no > 1" />
  83. <view v-if="newDataList.length === 4" class="bind-btn">
  84. <view @click="goLogin"> 为了给您提供更好的使用体验,<br />请 <text class="login-text">登录</text>后再查看此页面内容</view>
  85. </view>
  86. <morning-dlg v-if="isMorningShow" :isMorningShow.sync="isMorningShow" :morningItem.sync="morningItem" />
  87. </view>
  88. <videoModule :showVideoPop.sync="showVideoPopUp" :videoPopList="videoPopListUp" />
  89. <suspenButton :show.sync="wholeShowListData.IsShow" v-if="wholeShowListData.IsShow" />
  90. </page-meta>
  91. </template>
  92. <script>
  93. import { Home, Mine } from "@/config/api";
  94. import ChartItem from "@/components/ItemComponent/chartItem.vue";
  95. import ReportItem from "@/components/ItemComponent/reportItem.vue";
  96. import RoadshowItem from "@/components/ItemComponent/roadshowItem.vue";
  97. import ActivityItem from "@/components/ItemComponent/activityItem.vue";
  98. import SearchBar from "@/components/search-bar/searchBar.vue";
  99. import MorningDlg from "./components/morningDlg.vue";
  100. import ItemContent from "./components/ItemContent.vue";
  101. import videoModule from "@/components/videoModule/index";
  102. import suspenButton from "@/components/suspen_button.vue";
  103. export default {
  104. data() {
  105. return {
  106. newDataList: [],
  107. page_no: 1,
  108. pageSize: 10,
  109. status: "loadmore",
  110. refresh: false, //正在下拉
  111. loadText: {
  112. loadmore: "上拉加载更多",
  113. loading: "加载中",
  114. nomore: "已经到底了",
  115. },
  116. info: {},
  117. isMorningShow: false, // 晨会的弹框
  118. morningItem: {}, // 晨会的弹框
  119. bannerDataList: [], // banner数据
  120. showVideoPopUp: false, //
  121. videoPopListUp: {},
  122. };
  123. },
  124. components: {
  125. ChartItem,
  126. ReportItem,
  127. RoadshowItem,
  128. ActivityItem,
  129. SearchBar,
  130. MorningDlg,
  131. ItemContent,
  132. videoModule,
  133. suspenButton,
  134. },
  135. methods: {
  136. // 获取最先数据
  137. async getNewList() {
  138. const res = await Home.getNewList({
  139. PageSize: this.pageSize,
  140. CurrentIndex: this.page_no,
  141. });
  142. if (res.Ret === 200) {
  143. this.status = !res.Data.Paging.IsEnd ? "loadmore" : "nomore";
  144. let listArr = [];
  145. res.Data.List &&
  146. res.Data.List.forEach((item) => {
  147. listArr.push({
  148. Source: item.Source,
  149. Article: item.Article,
  150. Newchart: item.Newchart,
  151. Activity: item.Activity || item.Activityspecial,
  152. Roadshow: item.Roadshow || item.Activityvideo || item.Activityvoice,
  153. ThreeSummary: item.Researchsummary || item.Minutessummary || item.Meetingreviewchapt || item.ProductInterior,
  154. });
  155. });
  156. this.newDataList = this.page_no === 1 ? listArr : [...this.newDataList, ...listArr];
  157. if (this.refresh) {
  158. uni.stopPullDownRefresh();
  159. this.refresh = false;
  160. }
  161. }
  162. },
  163. // 微路演收藏
  164. async isCollectionHandeler(item) {
  165. await this.$store.dispatch("showLoginModal");
  166. const res = await Home.microRoadshowCollect({
  167. Id: item.Id,
  168. SourceType: item.Type,
  169. PageRouter: this.$store.state.pageRouterReport,
  170. });
  171. if (res.Ret === 200) {
  172. let index = this.newDataList.findIndex((key) => key.Roadshow && key.Roadshow.Id == item.Id);
  173. res.Data.Status == 1 ? (this.newDataList[index].Roadshow.IsCollect = true) : (this.newDataList[index].Roadshow.IsCollect = false);
  174. uni.showToast({
  175. title: res.Msg,
  176. duration: 2000,
  177. });
  178. }
  179. },
  180. // 跳转到我的页面
  181. goMyInfo() {
  182. uni.navigateTo({
  183. url: "/pageMy/myPage/myPage",
  184. });
  185. },
  186. // 跳转绑定页面
  187. goLogin() {
  188. uni.showModal({
  189. title: "即将前往登录页面,请确认是否继续",
  190. content: "为了给您提供更好的使用体验,请登录后再进行查看或操作",
  191. confirmColor: "#3385FF",
  192. cancelColor: "#606266",
  193. success: function (res) {
  194. if (res.confirm) {
  195. //已授权未绑定
  196. uni.navigateTo({
  197. url: "/pageMy/login/login",
  198. });
  199. } else if (res.cancel) {
  200. console.log("用户点击取消");
  201. }
  202. },
  203. });
  204. },
  205. /* 搜索 */
  206. goSearch() {
  207. this.$store.dispatch("checkHandle", "/pages-search/indedxSearch/indedxSearch?isType=" + this.topTabsActive + "&source=首页页面");
  208. },
  209. async getUserInfo() {
  210. const res = await Mine.getInfo();
  211. if (res.Ret === 200) {
  212. this.info = res.Data;
  213. }
  214. },
  215. // 晨会弹框显示
  216. showMorningDialog(item) {
  217. console.log(item);
  218. if (item.Source == "meetingreviewchapt") {
  219. this.isMorningShow = true;
  220. this.morningItem = item;
  221. }
  222. },
  223. dataListItem(item) {
  224. let obj = item.ThreeSummary ? { ...item.ThreeSummary, Source: item.Source } : {};
  225. return obj;
  226. },
  227. // 获取banner 列表
  228. async getBannerList() {
  229. const res = await Home.bannerList();
  230. if (res.Ret === 200) {
  231. this.bannerDataList = res.Data.List || [];
  232. }
  233. },
  234. // bannaer 点击事件
  235. async bannerSwiperHandler(item) {
  236. let { Type, SourceId, Path } = item.BannerUrlResp;
  237. if (Type == 1) return;
  238. await Home.bannerHistory({
  239. BannerId: item.BannerId,
  240. });
  241. if (Type == 5) {
  242. let obj = {
  243. BackgroundImg: "https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/my_log.png",
  244. Id: SourceId,
  245. PlaySeconds: "15",
  246. ResourceUrl: "https://hzstatic.hzinsights.com/static/yb/video/8617330c2a76e0c35999f6466b4470c4.mp4",
  247. Title: "三分钟了解弘则研究体系和方法论",
  248. Type: "三分钟了解弘则研究体系和方法论",
  249. };
  250. this.videoPopListUp = obj;
  251. this.showVideoPopUp = true;
  252. await Mine.addHistory();
  253. } else {
  254. Path &&
  255. uni.navigateTo({
  256. url: Path + SourceId,
  257. });
  258. }
  259. },
  260. },
  261. mounted() {
  262. uni.$on("updateNewList", (data) => {
  263. this.getNewList();
  264. });
  265. },
  266. onLoad() {
  267. this.getBannerList();
  268. this.getNewList();
  269. },
  270. onShow() {
  271. this.getUserInfo();
  272. this.getRecordTracking("首页");
  273. this.$store.commit("setRouterActivity", "首页");
  274. this.$store.commit("setRouterReport", "首页");
  275. },
  276. // 加载数据
  277. onReachBottom() {
  278. if (this.status === "nomore" || this.newDataList.length < 8) return;
  279. this.status = "loading";
  280. this.page_no++;
  281. this.getNewList();
  282. },
  283. // 下拉刷新
  284. onPullDownRefresh() {
  285. this.page_no = 1;
  286. this.refresh = true;
  287. this.getNewList();
  288. },
  289. /** 用户点击分享*/
  290. onShareAppMessage: function ({ from, target }) {
  291. if (from === "button") {
  292. let item = target.dataset.item;
  293. let audio_id = item.Type == 1 || item.AudioType == 1 ? item.Id : "";
  294. // type=2 -- 活动视频 type=3 -- 产业视频
  295. let video_id = item.Type == 2 || item.Type == 3 ? item.Id : "";
  296. let activity_id = item.Type == 2 && item.ActivityId > 0 ? item.ActivityId : "";
  297. let title_share = item.AudioTitle || item.Title;
  298. this.getRecordTracking("首页转发", { ActivityId: item.ActivityId, Id: item.Id, Type: item.Type });
  299. return {
  300. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : title_share,
  301. path: "/pages/material/material?topTabsActive=4" + "&audioShareId=" + audio_id + "&videoShareId=" + video_id + "&activityId=" + activity_id,
  302. imageUrl: item.AudioShareImg || item.ShareImg,
  303. };
  304. } else {
  305. return {
  306. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : "您手边的弘则研究素材检索库",
  307. path: "/pages/index/index",
  308. imageUrl: "https://hzstatic.hzinsights.com/cygx/czbk/home_share.png",
  309. success: (res) => {},
  310. fail: (err) => {},
  311. };
  312. }
  313. },
  314. };
  315. </script>
  316. <style lang="scss" scoped>
  317. .New-container {
  318. background-color: #f5f6fa;
  319. .content-search {
  320. position: sticky;
  321. top: 0;
  322. left: 0;
  323. width: 100%;
  324. z-index: 9;
  325. .top-content-box {
  326. position: sticky;
  327. top: 0;
  328. left: 0;
  329. width: 100%;
  330. z-index: 9;
  331. }
  332. }
  333. .banne-content {
  334. position: sticky;
  335. top: 0;
  336. left: 0;
  337. width: 100%;
  338. z-index: 9;
  339. height: 402rpx;
  340. width: 100%;
  341. overflow: hidden;
  342. swiper {
  343. height: 402rpx;
  344. }
  345. image {
  346. width: 100%;
  347. height: 100%;
  348. }
  349. .banner-title {
  350. position: absolute;
  351. bottom: 35rpx;
  352. left: 20rpx;
  353. color: #fff;
  354. font-weight: 500;
  355. line-height: 65rpx;
  356. min-height: 160rpx;
  357. max-height: 225rpx;
  358. overflow: hidden;
  359. .time {
  360. font-size: 28rpx;
  361. line-height: 39rpx;
  362. }
  363. }
  364. .top-content-box {
  365. position: absolute;
  366. top: 0;
  367. left: 0;
  368. width: 100%;
  369. z-index: 9;
  370. }
  371. /deep/ .nav-bar-wrap {
  372. background-color: transparent;
  373. }
  374. }
  375. /deep/ .nav-bar-wrap {
  376. padding-left: 35rpx;
  377. .box-img {
  378. position: relative;
  379. height: 88rpx;
  380. width: 165rpx;
  381. display: flex;
  382. align-items: center;
  383. justify-content: center;
  384. margin-right: 20rpx;
  385. border-radius: 50%;
  386. image {
  387. width: 80rpx;
  388. height: 80rpx;
  389. }
  390. .content-img {
  391. position: absolute;
  392. top: 0;
  393. left: 0;
  394. width: 80rpx;
  395. height: 80rpx;
  396. border-radius: 50%;
  397. overflow: hidden;
  398. z-index: 9;
  399. }
  400. .content-my {
  401. width: 163rpx;
  402. height: 64rpx;
  403. margin-left: 2rpx;
  404. display: flex;
  405. align-items: center;
  406. background-color: #f7f7f7;
  407. border-radius: 38rpx;
  408. color: #333333;
  409. font-size: 28rpx;
  410. padding-right: 18rpx;
  411. justify-content: flex-end;
  412. }
  413. }
  414. }
  415. .content-ul {
  416. padding: 30rpx 10rpx;
  417. display: flex;
  418. justify-content: space-between;
  419. .item-ul {
  420. width: 49%;
  421. &:first-child {
  422. margin-right: 10rpx;
  423. }
  424. }
  425. }
  426. .bind-btn {
  427. padding-top: 110rpx;
  428. text-align: center;
  429. font-size: 24rpx;
  430. color: #333;
  431. line-height: 39rpx;
  432. padding-bottom: 100rpx;
  433. .login-text {
  434. display: inline-block;
  435. color: #3385ff;
  436. }
  437. }
  438. }
  439. </style>