material.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. <template>
  2. <view class="container Index-container">
  3. <view class="top-content-box">
  4. <search-bar @goSearch="goSearch" :searchTitle="searchPlaceholderList.SummarySearch" :width="70" />
  5. <view class="tabs-content">
  6. <view class="global_two_tabs two_tabs">
  7. <view :class="['item', item.ChartPermissionId == secondActive && 'tabs-active']" v-for="(item, index) in secondBars" :key="item.ChartPermissionId" @click="handleClickTopSub(item)">
  8. {{ item.PermissionName }}
  9. <block v-if="wholeShowListData.IsShowResearch && index === secondBars.length - 1 && topTabsActive == '2'">
  10. <image class="limit-img tabs-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/limit_icon.png" mode=""></image>
  11. </block>
  12. <view class="active" v-if="item.ChartPermissionId == secondActive"></view>
  13. </view>
  14. <view class="item special-item" @click="goSpecialHandler">
  15. 专题看板
  16. <image class="limit-img tabs-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/limit_icon.png" mode=""></image>
  17. </view>
  18. </view>
  19. <view class="children-ul" v-if="chartChildren.length">
  20. <view :class="['chart-children', chartChildrenActive == item.CtagId ? 'children-active' : '']" v-for="item in chartChildren" :key="item.CtagId" @click="handleChartChildren(item)">{{
  21. item.Name
  22. }}</view>
  23. </view>
  24. <!-- 我的收藏滚动显示 -->
  25. <view class="notice" @click="noticeBarHandler" v-if="secondActive == 0">
  26. <van-notice-bar
  27. custom-class="custom-class-notice"
  28. color="#E37318"
  29. background="#FFF1E9"
  30. text="如何定制自己的图表面板:在上方分栏下选择感兴趣的图表类别,点击标题查看大图,点亮☆收藏就可以在自己的图表首页可见。也可在报告中随时点☆收藏感兴趣的图表。"
  31. />
  32. </view>
  33. </view>
  34. </view>
  35. <block v-if="haveData">
  36. <view class="content-ul">
  37. <view class="report-ul" style="width: 49%">
  38. <block v-for="(item, index) in dataList" :key="index">
  39. <view v-if="index % 2 == 0">
  40. <ChartItem v-if="topTabsActive == 3" :list="item" :isMyChartCollection="isMyChartCollection" @myChartIsTop="myChartIsTop" @myChartCollect="myChartCollect" />
  41. </view>
  42. </block>
  43. </view>
  44. <view class="report-ul" style="width: 49%">
  45. <block v-for="(item, index) in dataList" :key="index">
  46. <view v-if="index % 2 !== 0">
  47. <ChartItem v-if="topTabsActive == 3" :list="item" :isMyChartCollection="isMyChartCollection" @myChartIsTop="myChartIsTop" @myChartCollect="myChartCollect" />
  48. </view>
  49. </block>
  50. </view>
  51. </view>
  52. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" v-if="pageNum > 1" />
  53. </block>
  54. <view class="nodata" v-else-if="haveData === false" style="padding-top: 400rpx">
  55. <block class="nodata" v-if="!isBindingMobile && secondActive == 0">
  56. <text>请先绑定联系方式</text>
  57. <view class="bind-mobile" @click="bindingMobile">绑定联系方式</view>
  58. </block>
  59. <block v-else>
  60. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/act_search.png" mode="" class="nodata_ico"></image>
  61. <text>{{ topTabsActive == 3 && secondActive == 0 ? "暂无收藏的图表" : "暂时没有数据" }}</text>
  62. </block>
  63. </view>
  64. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
  65. <Loading />
  66. <van-popup custom-class="custom-class-popup" :show="isNoticeBarShow" :close-on-click-overlay="false" @close="onCloseHandler">
  67. <view class="close-iocn">
  68. <van-icon @click="onCloseHandler" color="#333" name="cross" />
  69. </view>
  70. <view class="popup-box">
  71. 如何定制自己的图表面板:在上方分栏下选择感兴趣的图表类别,点击标题查看大图,点亮<van-icon name="star" color="#E37318" />收藏就可以在自己的图表首页可见。也可在报告中随时点<van-icon
  72. name="star"
  73. color="#E37318"
  74. />收藏感兴趣的图表。
  75. </view>
  76. </van-popup>
  77. </view>
  78. </template>
  79. <script>
  80. import { Home, Reports, Chart, activity } from "@/config/api.js";
  81. import { Throttle, deepCopy } from "@/config/util.js";
  82. import freeCharge from "@/components/freeCharge";
  83. import SearchBar from "@/components/search-bar/searchBar.vue";
  84. import ChartItem from "@/components/ItemComponent/chartItem.vue";
  85. let app = getApp();
  86. export default {
  87. data() {
  88. return {
  89. topTabsActive: 3, //一级top的tabs
  90. secondActive: "", //二级的tabs
  91. secondBars: [], //二级的tabs数组
  92. chartChildren: [], //二级的tabs下的标签
  93. chartChildrenActive: 0,
  94. refresh: false,
  95. pageSize: 10, //条数
  96. pageNum: 1, //页码
  97. haveMore: true, //是否有更多数据
  98. haveData: null, //是否有数据
  99. //数据列表
  100. dataList: [],
  101. status: "loadmore",
  102. loadText: {
  103. loadmore: "上拉加载更多",
  104. loading: "加载中",
  105. nomore: "已经到底了",
  106. },
  107. isBindingMobile: true, //图表我的收藏是否绑定手机号
  108. isNoticeBarShow: false,
  109. };
  110. },
  111. components: {
  112. freeCharge,
  113. ChartItem,
  114. SearchBar,
  115. },
  116. watch: {},
  117. onLoad(optios) {
  118. if (optios.topTabsActive) {
  119. this.topTabsActive = optios.topTabsActive;
  120. this.secondActive = optios.secondActive;
  121. this.chartChildrenActive = optios.childrenActive;
  122. }
  123. this.getTabs();
  124. this.getReportList();
  125. },
  126. onShow() {
  127. this.getRecordTracking("纪要库");
  128. this.$store.commit("setRouterActivity", "纪要库");
  129. this.$store.commit("setRouterReport", "纪要库");
  130. //进入页面的记录
  131. this.$store.dispatch("statistics", { PageType: "Activit" });
  132. // #ifdef MP-WEIXIN
  133. uni.hideHomeButton();
  134. // #endif
  135. this.$store.commit("audioBg/parseIntAudio", true);
  136. },
  137. computed: {
  138. isMyChartCollection() {
  139. return this.topTabsActive == "3" && this.secondActive == 0;
  140. },
  141. },
  142. methods: {
  143. //点击顶部一级分类
  144. topTabsChange(item) {
  145. if (item.Id == 5) {
  146. // 精选看板的点击事件
  147. uni.navigateTo({
  148. url: "/reportPages/selectedBulletin/selectedBulletin",
  149. });
  150. return;
  151. }
  152. this.topTabsActive = item.Id;
  153. this.chartChildren = [];
  154. this.chartChildrenActive = 0;
  155. this.secondActive = "";
  156. this.pageNum = 1;
  157. this.dataList = [];
  158. uni.pageScrollTo({
  159. scrollTop: 0,
  160. duration: 0,
  161. });
  162. if (this.topTabsActive == "2" || this.topTabsActive == "3") {
  163. this.getTabs();
  164. } else {
  165. this.initData();
  166. }
  167. this.$store.commit("setRouterReport", item.Id === 3 ? "我的收藏" : "纪要库");
  168. },
  169. //点击顶部二级分类
  170. handleClickTopSub(item) {
  171. this.$store.commit("setRouterReport", item.PermissionName === "我的收藏" ? "我的收藏" : "纪要库");
  172. this.secondActive = item.ChartPermissionId;
  173. this.chartChildren = [];
  174. this.chartChildrenActive = 0;
  175. this.childrenChartData();
  176. this.initData();
  177. },
  178. //点击图标的二级分类 处理数据
  179. childrenChartData() {
  180. if (this.topTabsActive == 3 && this.secondActive != 0) {
  181. let arr = [];
  182. this.secondBars &&
  183. this.secondBars.forEach((item) => {
  184. if (this.secondActive == item.ChartPermissionId) {
  185. deepCopy(arr, item.List);
  186. arr.unshift({
  187. CtagId: 0,
  188. Name: "全部",
  189. });
  190. this.chartChildren = arr;
  191. }
  192. });
  193. this.chartChildrenActive > 0 ? "" : (this.chartChildrenActive = 0);
  194. }
  195. },
  196. //点击图标的三级分类
  197. handleChartChildren(item) {
  198. this.chartChildrenActive = item.CtagId;
  199. this.initData();
  200. },
  201. //点击
  202. initData() {
  203. this.pageNum = 1;
  204. this.dataList = [];
  205. uni.pageScrollTo({
  206. scrollTop: 0,
  207. duration: 0,
  208. });
  209. this.getReportList();
  210. },
  211. /* 获取tab分类 */
  212. getTabs() {
  213. this.secondBars = [];
  214. this.topTabsActive == "2"
  215. ? Home.Tab().then((res) => {
  216. if (res.Ret === 200) {
  217. this.secondBars = res.Data.List;
  218. this.secondActive > 0 ? "" : (this.secondActive = this.secondBars[0].ChartPermissionId);
  219. this.getReportList();
  220. }
  221. })
  222. : this.topTabsActive == "3"
  223. ? Chart.getChartPatg().then((res) => {
  224. if (res.Ret === 200) {
  225. let arr = res.Data;
  226. arr.unshift({
  227. ChartPermissionId: 0,
  228. PermissionName: "我的收藏",
  229. });
  230. this.secondBars = arr;
  231. this.secondActive ? "" : (this.secondActive = 0);
  232. this.secondActive > 0 && this.childrenChartData();
  233. this.getReportList();
  234. }
  235. })
  236. : "";
  237. },
  238. /* 获取列表 */
  239. async getReportList() {
  240. let myChart = this.topTabsActive == "3" && this.secondActive == 0;
  241. const res = myChart
  242. ? await Chart.getChartcollection({
  243. PageSize: this.pageSize,
  244. CurrentIndex: this.pageNum,
  245. })
  246. : await Home.getList({
  247. PageSize: this.pageSize,
  248. CurrentIndex: this.pageNum,
  249. ChartPermissionId: this.secondActive,
  250. CtagId: this.chartChildrenActive,
  251. ListType: this.topTabsActive,
  252. });
  253. if (res.Ret === 200) {
  254. this.status = this.pageNum < res.Data.Paging.Pages ? "loadmore" : "nomore";
  255. let isDataList = myChart ? res.Data.List || [] : res.Data.ChartList || [];
  256. if (this.pageNum === 1) {
  257. this.dataList = isDataList;
  258. this.haveData = this.dataList.length ? true : false;
  259. } else {
  260. this.dataList = this.dataList.concat(isDataList);
  261. }
  262. }
  263. },
  264. //我的收藏的删除
  265. myChartCollect(id) {
  266. uni.showModal({
  267. content: "确认要将该图表移除我的收藏吗?",
  268. confirmColor: "#376cbb",
  269. cancelColor: "#606266",
  270. success: async (res) => {
  271. if (res.confirm) {
  272. const res = await Chart.myChartCollect({
  273. ChartId: id,
  274. });
  275. if (res.Ret === 200) {
  276. this.initData();
  277. this.$util.toast("已取消收藏");
  278. }
  279. }
  280. },
  281. });
  282. },
  283. //我的收藏 置顶
  284. async myChartIsTop(id) {
  285. const res = await Chart.myChartTop({
  286. ChartId: id,
  287. });
  288. if (res.Ret === 200) {
  289. this.initData();
  290. this.$util.toast(res.Msg);
  291. }
  292. },
  293. /* 搜索 */
  294. goSearch() {
  295. uni.navigateTo({ url: "/pages-search/indedxSearch/indedxSearch?isType=" + this.topTabsActive + "&source=纪要库页面" });
  296. },
  297. /* 绑定联系方式 */
  298. bindingMobile() {
  299. uni.showModal({
  300. title: "即将前往登录页面,请确认是否继续",
  301. content: "为了给您提供更好的使用体验,请登录后再进行查看或操作",
  302. confirmColor: "#376cbb",
  303. cancelColor: "#606266",
  304. success: function (res) {
  305. if (res.confirm) {
  306. //已授权未绑定
  307. uni.navigateTo({
  308. url: "/pageMy/login/login",
  309. });
  310. }
  311. },
  312. });
  313. },
  314. // 点击了图表下的滚动条
  315. noticeBarHandler() {
  316. this.isNoticeBarShow = true;
  317. },
  318. // 关闭滚动条的弹框
  319. onCloseHandler() {
  320. this.isNoticeBarShow = false;
  321. },
  322. // 精选看板的点击事件
  323. goSpecialHandler() {
  324. uni.navigateTo({
  325. url: "/reportPages/selectedBulletin/selectedBulletin",
  326. });
  327. },
  328. },
  329. onHide() {
  330. this.$store.commit("audioBg/parseIntAudio", false);
  331. },
  332. mounted() {
  333. uni.$on("updateAudioVideo", (data) => {
  334. this.$store.dispatch("checkHandle", "noGO");
  335. this.getReportList();
  336. });
  337. },
  338. /* 下拉刷新 */
  339. onPullDownRefresh: Throttle(function () {
  340. this.status = "loadmore";
  341. this.refresh = true;
  342. this.dataList = [];
  343. this.pageNum = 1;
  344. this.getReportList();
  345. }),
  346. // 上拉加载
  347. onReachBottom: Throttle(function () {
  348. if (this.status === "nomore") return;
  349. this.status = "loading";
  350. this.pageNum++;
  351. this.getReportList();
  352. }),
  353. /** 用户点击分享*/
  354. onShareAppMessage: function ({ from, target }) {
  355. if (from === "button") {
  356. let item = target.dataset.item;
  357. let title_share = item.AudioTitle || item.Title;
  358. this.getRecordTracking("微路演转发", { SourceId: item.SourceId, SourceType: item.SourceType });
  359. return {
  360. title: title_share,
  361. path: "/pages/material/material?topTabsActive=4" + "&SourceId=" + item.SourceId + "&SourceType=" + item.Type,
  362. imageUrl: item.AudioShareImg || item.ShareImg,
  363. };
  364. } else {
  365. return {
  366. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : "图表库",
  367. path: "/pages/material/material?topTabsActive=" + this.topTabsActive + "&secondActive=" + this.secondActive + "&childrenActive=" + this.chartChildrenActive,
  368. success: (res) => {},
  369. fail: (err) => {},
  370. };
  371. }
  372. },
  373. };
  374. </script>
  375. <style lang="scss">
  376. .Index-container {
  377. background-color: $uni-bg-color;
  378. font-size: 30rpx;
  379. /deep/ .search-box {
  380. margin-left: 30rpx !important;
  381. }
  382. .content-ul {
  383. display: flex;
  384. flex-wrap: wrap;
  385. justify-content: space-between;
  386. padding: 20rpx 15rpx;
  387. }
  388. .top-content-box {
  389. position: sticky;
  390. top: 0;
  391. left: 0;
  392. width: 100%;
  393. z-index: 9;
  394. .top-tabs {
  395. width: 100%;
  396. display: flex;
  397. align-items: center;
  398. justify-content: space-between;
  399. font-size: 28rpx;
  400. background-color: #fff;
  401. padding: 35rpx 0 10rpx;
  402. &::-webkit-scrollbar {
  403. width: 0;
  404. height: 0;
  405. display: none;
  406. }
  407. .item {
  408. position: relative;
  409. display: flex;
  410. justify-content: center;
  411. padding-bottom: 8rpx;
  412. flex: 1;
  413. flex-shrink: 0;
  414. .active {
  415. position: absolute;
  416. left: 50%;
  417. bottom: 0;
  418. transform: translateX(-50%);
  419. width: 32rpx;
  420. height: 6rpx;
  421. border-radius: 2rpx;
  422. background: $uni-color-new;
  423. }
  424. }
  425. .tabs-active {
  426. color: $uni-color-new;
  427. font-weight: 500;
  428. }
  429. .limit-img {
  430. position: absolute;
  431. top: -20rpx;
  432. right: -30rpx;
  433. z-index: 99;
  434. }
  435. }
  436. }
  437. .tabs-content-ul {
  438. padding: 35rpx 50rpx 10rpx 20rpx !important;
  439. .item {
  440. flex: none !important;
  441. padding: 0 20rpx;
  442. }
  443. }
  444. .tabs-content {
  445. .children-ul {
  446. padding: 20rpx 20rpx 0;
  447. display: flex;
  448. flex-wrap: wrap;
  449. background-color: #fff;
  450. .children-active {
  451. background-color: $uni-color-new;
  452. color: #fff;
  453. }
  454. }
  455. .chart-children {
  456. display: flex;
  457. align-items: center;
  458. height: 52rpx;
  459. padding: 0 30rpx;
  460. margin: 0rpx 20rpx 20rpx 0;
  461. background-color: #f8f8fa;
  462. color: #666666;
  463. font-size: 24rpx;
  464. border-radius: 100rpx;
  465. }
  466. .two_tabs {
  467. height: auto;
  468. flex-wrap: wrap;
  469. overflow-x: hidden;
  470. padding: 10rpx 30rpx 20rpx;
  471. .item {
  472. margin-top: 10rpx;
  473. }
  474. .special-item {
  475. position: relative;
  476. background-color: #376cbb;
  477. color: #fff;
  478. .limit-img {
  479. position: absolute;
  480. top: -8rpx;
  481. right: -12rpx;
  482. z-index: 99;
  483. }
  484. }
  485. }
  486. }
  487. .tabs-img {
  488. width: 46rpx;
  489. height: 26rpx;
  490. }
  491. .nodata {
  492. font-size: 40rpx;
  493. .bind-mobile {
  494. width: 244rpx;
  495. height: 58rpx;
  496. background: #376cbb;
  497. border-radius: 8rpx;
  498. font-size: 28rpx;
  499. line-height: 58rpx;
  500. text-align: center;
  501. color: #fff;
  502. margin: 50rpx auto;
  503. }
  504. }
  505. .select-conyent {
  506. .items-box {
  507. width: 40rpx;
  508. }
  509. .menu-items {
  510. background-color: #f8f8fa;
  511. width: 100%;
  512. display: flex;
  513. flex-wrap: wrap;
  514. padding: 30rpx 30rpx 0;
  515. .menu-items-box {
  516. display: flex;
  517. width: 50%;
  518. font-size: 28rpx;
  519. font-weight: 400;
  520. margin-bottom: 40rpx;
  521. }
  522. }
  523. .replacement {
  524. margin: 0rpx 30rpx 20rpx;
  525. display: flex;
  526. background-color: $uni-color-new;
  527. height: 60rpx;
  528. line-height: 58rpx;
  529. font-size: 28rpx;
  530. font-weight: 400;
  531. color: #ffffff;
  532. border-radius: 30rpx;
  533. text {
  534. flex: 1;
  535. text-align: center;
  536. line-height: 60rpx;
  537. }
  538. .replacement-box {
  539. border: 1rpx solid $uni-color-new;
  540. line-height: 58rpx;
  541. color: $uni-color-new;
  542. background: #ffffff;
  543. border-radius: 28rpx 0rpx 28rpx 28rpx;
  544. }
  545. }
  546. }
  547. .paly-list-image {
  548. position: fixed;
  549. right: 50rpx;
  550. bottom: 150rpx;
  551. z-index: 99;
  552. width: 100rpx;
  553. height: 100rpx;
  554. image {
  555. width: 100rpx;
  556. height: 100rpx;
  557. }
  558. }
  559. /deep/.van-dropdown-menu {
  560. background-color: #fff;
  561. box-shadow: none !important;
  562. display: flex;
  563. align-items: center;
  564. }
  565. /deep/.van-dropdown-menu__item {
  566. box-sizing: border-box;
  567. width: 160rpx;
  568. // margin-right: 20rpx;
  569. padding-right: 20rpx;
  570. height: 51rpx;
  571. border-radius: 26rpx;
  572. background: #f8f8fa;
  573. }
  574. /deep/.van-dropdown-item {
  575. margin-top: -10rpx;
  576. }
  577. /deep/[data-index="2"] {
  578. margin-right: 0rpx;
  579. }
  580. /deep/ .van-ellipsis {
  581. font-size: 24rpx;
  582. }
  583. .custom-class-popup {
  584. border-radius: 12rpx;
  585. .close-iocn {
  586. padding: 25rpx 35rpx;
  587. display: flex;
  588. justify-content: flex-end;
  589. }
  590. .popup-box {
  591. width: 632rpx;
  592. padding: 0 30rpx 50rpx;
  593. line-height: 48rpx;
  594. font-size: 32rpx;
  595. }
  596. }
  597. }
  598. </style>