index.vue 12 KB

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