index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. <template>
  2. <view class="container Index-container">
  3. <view class="index-fixed">
  4. <view class="index-header">
  5. <input type="text" placeholder="搜索您想要的纪要" placeholder-class="sea_ipt_placeholder" class="sea_ipt" v-model="searchTxt" disabled @click="goSearch" />
  6. <icon type="search" size="15" class="search_ico" />
  7. </view>
  8. <!-- 导航条 -->
  9. <view class="tab-cont">
  10. <scroll-view scroll-x="true" scroll-with-animation class="scroll-tab" @scroll="scrollMove" :scroll-left="scrollLeft" :scroll-into-view="'_' + tabIndex">
  11. <block v-for="(item, index) in tabBars" :key="item.ChartPermissionId">
  12. <view :id="'_' + index" class="scroll-tab-item" :class="{ active: tabAct_id == item.ChartPermissionId }" @click.stop="toggleTab(item, index)">
  13. {{ item.PermissionName }}
  14. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/border_act.png" mode="" class="border_act" v-if="tabAct_id == item.ChartPermissionId"></image>
  15. </view>
  16. </block>
  17. <view class="limit-box" v-if="limitIsShow">
  18. <image class="limit-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/limit_icon.png" mode=""></image>
  19. </view>
  20. </scroll-view>
  21. </view>
  22. </view>
  23. <block v-if="haveData">
  24. <view class="data-cont">
  25. <view class="report-ul">
  26. <view class="report-item" v-for="(report, index) in dataList" :key="index" v-if="index % 2 === 0" @click="goDetail(report)">
  27. <view class="item-content-img" v-if="report.BodyHtml">
  28. <!-- <mp-html :content="report.BodyHtml" /> -->
  29. <image :src="report.BodyHtml" mode=""></image>
  30. </view>
  31. <view class="item-content" v-else>{{ report.Body }}</view>
  32. <view class="line"></view>
  33. <text class="item-title">{{ report.Title }}</text>
  34. <view class="item-abstract text_twoLine" v-if="report.ExpertBackground">
  35. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/fenxi_ico.png" class="report_ico"></image>
  36. {{ report.ExpertBackground }}
  37. </view>
  38. <view class="item-createtime">
  39. <text>{{ report.PublishDate }}</text>
  40. <view class="item-examine" v-if="report.IsResearch">
  41. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/examine_icon.png"></image>
  42. <text>{{ report.Pv }}</text>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="report-ul">
  48. <view class="report-item" v-for="(report, index) in dataList" :key="index" v-if="index % 2 !== 0" @click="goDetail(report)">
  49. <view class="item-content-img" v-if="report.BodyHtml">
  50. <!-- <mp-html :content="report.BodyHtml" /> -->
  51. <image :src="report.BodyHtml"></image>
  52. </view>
  53. <view class="item-content" v-else>{{ report.Body }}</view>
  54. <view class="line"></view>
  55. <text class="item-title">{{ report.Title }}</text>
  56. <view class="item-abstract text_twoLine" v-if="report.ExpertBackground">
  57. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/fenxi_ico.png" class="report_ico"></image>
  58. {{ report.ExpertBackground }}
  59. </view>
  60. <view class="item-createtime">
  61. <text>{{ report.PublishDate }}</text>
  62. <view class="item-examine" v-if="report.IsResearch">
  63. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/examine_icon.png"></image>
  64. <text>{{ report.Pv }}</text>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. <u-loadmore :status="status" icon-type="flower" :load-text="loadText" margin-top="20" />
  71. </block>
  72. <view class="nodata" v-else-if="haveData === false" style="padding-top: 400rpx">
  73. <image src="@/static/img/nodata.png" mode="" class="nodata_ico"></image>
  74. <text>暂时没有行业数据</text>
  75. </view>
  76. <view class="content-intimate" v-if="reportShow">
  77. <van-transition :show="showTransition" name="fade-right">
  78. <view class="content">
  79. <view @click="goSecretDetail('1')">
  80. <text>报告</text>
  81. <text>精选</text>
  82. </view>
  83. <view class="cont-border" @click="goSecretDetail('2')">
  84. <text>本周研</text>
  85. <text>究汇总</text>
  86. </view>
  87. <view @click="goSecretDetail('3')">
  88. <text>上周纪</text>
  89. <text>要汇总</text>
  90. </view>
  91. </view>
  92. </van-transition>
  93. <image @click="showTransition = !showTransition" src="https://hzstatic.hzinsights.com/cygx/czbk/intimate-icon.png" mode=""></image>
  94. </view>
  95. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
  96. </view>
  97. </template>
  98. <script>
  99. import { Home, Reports } from "@/config/api.js";
  100. import { Throttle } from "@/config/util.js";
  101. import freeCharge from "@/components/freeCharge";
  102. let app = getApp();
  103. export default {
  104. data() {
  105. return {
  106. refresh: false,
  107. pageSize: 10, //条数
  108. pageNum: 1, //页码
  109. haveMore: true, //是否有更多数据
  110. haveData: null, //是否有数据
  111. tabAct_id: 0,
  112. //数据列表
  113. dataList: [],
  114. // tab
  115. tabBars: [],
  116. status: "loadmore",
  117. loadText: {
  118. loadmore: "上拉加载更多",
  119. loading: "加载中",
  120. nomore: "已经到底了",
  121. },
  122. totalPage: "",
  123. limitIsShow: false, //限免的隐现
  124. scrollLeft: 0,
  125. showTransition: false, //点击绝密后的隐现
  126. reportShow: false, //绝密标签的隐现
  127. };
  128. },
  129. components: {
  130. freeCharge,
  131. },
  132. watch: {
  133. tabAct_id: {
  134. handler() {
  135. this.getReportList();
  136. },
  137. immediate: true,
  138. },
  139. },
  140. onLoad(optios) {
  141. uni.getSystemInfo({
  142. success: function (res) {
  143. if (res.windowWidth > 700) {
  144. uni.reLaunch({
  145. url: "/pages/pcWebViev/pcWebViev",
  146. });
  147. }
  148. },
  149. });
  150. if (optios.tabid) {
  151. this.tabAct_id = optios.tabid;
  152. }
  153. this.getTabs();
  154. this.reportIsShow();
  155. },
  156. onShow() {
  157. this.$store.dispatch("statistics", { PageType: "Summary", ChartPermissionId: Number(this.tabAct_id) });
  158. // #ifdef MP-WEIXIN
  159. uni.hideHomeButton();
  160. // #endif
  161. },
  162. methods: {
  163. gopc() {
  164. uni.reLaunch({
  165. url: "/pages/pcWebViev/pcWebViev",
  166. });
  167. },
  168. goSecretDetail(type) {
  169. uni.navigateTo({
  170. url: "/reportPages/secretDetails/secretDetails?type=" + type,
  171. });
  172. },
  173. async reportIsShow() {
  174. const res = await Reports.reportIsShow();
  175. if (res.Ret === 200) {
  176. this.reportShow = res.Data.IsShow;
  177. }
  178. },
  179. /* 切换分类 */
  180. toggleTab(item, index) {
  181. if (this.tabAct_id !== item.ChartPermissionId) {
  182. this.tabAct_id = item.ChartPermissionId;
  183. this.pageNum = 1;
  184. uni.pageScrollTo({
  185. scrollTop: 0,
  186. duration: 0,
  187. });
  188. this.$store.dispatch("statistics", { PageType: "Summary", ChartPermissionId: Number(this.tabAct_id) });
  189. }
  190. },
  191. scrollMove(e) {
  192. this.scrollLeft = e.detail.scrollLeft;
  193. },
  194. /* 获取列表 */
  195. getReportList() {
  196. Home.getList({
  197. PageSize: this.pageSize,
  198. CurrentIndex: this.pageNum,
  199. ChartPermissionId: Number(this.tabAct_id) || 0,
  200. }).then((res) => {
  201. if (res.Ret === 200) {
  202. if (!res.Data.HaveResearch) {
  203. this.$util.modalShow("", "您暂无查看研选权限", "", () => {
  204. uni.reLaunch({
  205. url: "/pages/index/index",
  206. });
  207. });
  208. }
  209. this.status = this.pageNum < res.Data.Paging.Pages ? "loadmore" : "nomore";
  210. // this.totalPage = res.Data.Paging.Pages;//总页数
  211. if (res.Data.List && res.Data.List.length > 0) {
  212. res.Data.List.forEach((item) => {
  213. if (item.BodyHtml) {
  214. item.BodyHtml = item.BodyHtml.replace(/'\'/g, "");
  215. }
  216. });
  217. }
  218. if (this.pageNum === 1) {
  219. this.dataList = res.Data.List || [];
  220. this.haveData = this.dataList.length ? true : false;
  221. } else {
  222. this.dataList = this.dataList.concat(res.Data.List);
  223. }
  224. if (this.refresh) {
  225. uni.stopPullDownRefresh();
  226. this.refresh = false;
  227. }
  228. }
  229. });
  230. },
  231. /* 获取tab分类 */
  232. getTabs() {
  233. Home.Tab().then((res) => {
  234. if (res.Ret === 200) {
  235. let arr = res.Data.List;
  236. arr.unshift({
  237. ChartPermissionId: 0,
  238. PermissionName: "最新",
  239. });
  240. this.tabBars = arr;
  241. this.limitIsShow = this.tabBars.some((item) => item.IsShowSustainable);
  242. if (this.tabAct_id == 0) {
  243. this.getReportList();
  244. }
  245. }
  246. });
  247. },
  248. /* 进入详情 校验是否有该品种权限 */
  249. goDetail(item) {
  250. /* 无需授权且已绑定 检验是或否有权限 */
  251. this.$store.dispatch("checkHandle", "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId);
  252. },
  253. /* 搜索 */
  254. goSearch() {
  255. this.$store.dispatch("checkHandle", "/pageMy/search/search");
  256. },
  257. adviceHandle() {
  258. this.$store.dispatch("checkHandle", "/pageMy/advice/advice");
  259. },
  260. },
  261. onShow() {
  262. this.$store.dispatch("statistics", { PageType: "Activit" });
  263. },
  264. /* 下拉刷新 */
  265. onPullDownRefresh: Throttle(function () {
  266. this.pageNum = 1;
  267. this.refresh = true;
  268. this.getReportList();
  269. }),
  270. // 上拉加载
  271. onReachBottom: Throttle(function () {
  272. if (this.status === "nomore") return;
  273. this.status = "loading";
  274. this.pageNum++;
  275. this.getReportList();
  276. }),
  277. /**
  278. * 用户点击分享
  279. */
  280. onShareAppMessage: function (res) {
  281. return {
  282. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费试用月卡!" : "您手边的弘则研究素材检索库",
  283. path: "/pages/index/index?tabid=" + this.tabAct_id,
  284. imageUrl: this.tabAct_id == 0 ? "https://hzstatic.hzinsights.com/cygx/czbk/home_share.png" : "",
  285. success: (res) => {},
  286. fail: (err) => {},
  287. };
  288. },
  289. onHide() {
  290. if (this.showTransition) {
  291. this.showTransition = false;
  292. }
  293. },
  294. };
  295. </script>
  296. <style lang="scss">
  297. .Index-container {
  298. background-color: #f7f7f7;
  299. font-size: 30rpx;
  300. .index-fixed {
  301. width: 750rpx;
  302. position: fixed;
  303. left: 0;
  304. top: 0;
  305. z-index: 999;
  306. .index-header {
  307. background-color: #fff;
  308. padding: 32rpx 34rpx;
  309. position: relative;
  310. .sea_ipt_placeholder {
  311. color: #8d8d8d;
  312. opacity: 0.7;
  313. }
  314. .sea_ipt {
  315. width: 100%;
  316. height: 70rpx;
  317. font-size: 30rpx;
  318. color: #707070;
  319. background-color: #f6f6f6;
  320. padding: 0 34rpx 0 70rpx;
  321. border-radius: 70rpx;
  322. border: 1rpx solid #e5e5e5;
  323. }
  324. .search_ico {
  325. display: block;
  326. position: absolute;
  327. color: #8d8d8d;
  328. left: 60rpx;
  329. top: 50%;
  330. z-index: 100;
  331. transform: translateY(-50%);
  332. }
  333. }
  334. .tab-cont {
  335. padding: 0 26rpx;
  336. background-color: #fff;
  337. font-size: 32rpx;
  338. box-shadow: 0 3rpx 6rpx rgba(187, 216, 255, 0.2);
  339. .scroll-tab {
  340. position: relative;
  341. width: 100%;
  342. white-space: nowrap;
  343. }
  344. .limit-box {
  345. position: absolute;
  346. text-align: center;
  347. display: inline-block;
  348. padding-right: 50rpx;
  349. top: -9rpx;
  350. margin-left: -38rpx;
  351. image {
  352. width: 46rpx;
  353. height: 26rpx;
  354. }
  355. }
  356. .scroll-tab-item {
  357. // flex-grow: 1;
  358. text-align: center;
  359. display: inline-block;
  360. padding: 10rpx 8rpx 20rpx 8rpx;
  361. margin-right: 35rpx;
  362. border-bottom: 8rpx solid transparent;
  363. position: relative;
  364. &:last-child {
  365. margin-right: 0;
  366. }
  367. &.active {
  368. border-bottom: none;
  369. color: #2c83ff;
  370. font-weight: 700;
  371. }
  372. .border_act {
  373. width: 100%;
  374. height: 8rpx;
  375. position: absolute;
  376. bottom: 0;
  377. left: 0;
  378. }
  379. }
  380. }
  381. }
  382. .data-cont {
  383. padding: 228rpx 20rpx 10rpx;
  384. display: flex;
  385. .report-ul {
  386. width: 50%;
  387. &:first-child {
  388. margin-right: 10rpx;
  389. }
  390. .report-item {
  391. padding: 20rpx 20rpx 24rpx 20rpx;
  392. margin-bottom: 20rpx;
  393. border-radius: 8rpx;
  394. box-shadow: 0 3rpx 6rpx rgba($color: #000000, $alpha: 0.16);
  395. background: #fff;
  396. .item-content-img {
  397. display: flex;
  398. align-items: center;
  399. image {
  400. width: 100%;
  401. height: 232rpx;
  402. vertical-align: middle;
  403. }
  404. }
  405. .item-content {
  406. height: 273rpx;
  407. font-size: 24rpx;
  408. line-height: 40rpx;
  409. color: #7f7f7f;
  410. overflow: hidden;
  411. text-overflow: ellipsis;
  412. display: -webkit-box;
  413. -webkit-line-clamp: 7;
  414. -webkit-box-orient: vertical;
  415. image {
  416. width: 100% !important;
  417. }
  418. }
  419. .line {
  420. margin: 18rpx 0;
  421. content: "";
  422. width: 100%;
  423. height: 1px;
  424. padding: 0 32rpx;
  425. box-sizing: border-box;
  426. background-color: #e5e5e5;
  427. -webkit-transform: scale(1, 0.5);
  428. transform: scale(1, 0.5);
  429. -webkit-transform-origin: center bottom;
  430. transform-origin: center bottom;
  431. }
  432. .item-title {
  433. font-size: 28rpx;
  434. color: #4a4a4a;
  435. margin-bottom: 10rpx;
  436. }
  437. .item-abstract {
  438. font-size: 26rpx;
  439. color: #6a6a6a;
  440. margin-bottom: 10rpx;
  441. .report_ico {
  442. width: 32rpx;
  443. height: 26rpx;
  444. margin-right: 20rpx;
  445. display: inline-block;
  446. }
  447. }
  448. .item-createtime {
  449. display: flex;
  450. align-items: center;
  451. justify-content: space-between;
  452. color: #acacac;
  453. font-size: 24rpx;
  454. .item-examine {
  455. display: flex;
  456. align-items: center;
  457. image {
  458. width: 30rpx;
  459. height: 24rpx;
  460. margin: 0 10rpx 0 15rpx;
  461. }
  462. }
  463. }
  464. }
  465. }
  466. }
  467. .advice_ico {
  468. width: 81rpx;
  469. height: 81rpx;
  470. position: fixed;
  471. right: 30rpx;
  472. bottom: 214rpx;
  473. }
  474. .content-intimate {
  475. position: fixed;
  476. display: flex;
  477. align-items: center;
  478. bottom: 96rpx;
  479. right: 41rpx;
  480. height: 156rpx;
  481. .content {
  482. width: 432rpx;
  483. height: 112rpx;
  484. background-color: #fff;
  485. display: flex;
  486. border-radius: 56rpx;
  487. overflow: hidden;
  488. .cont-border {
  489. margin: 0 2rpx;
  490. }
  491. view {
  492. flex: 1;
  493. background-color: #3385ff;
  494. font-size: 30rpx;
  495. color: #fff;
  496. padding-top: 15rpx;
  497. text-align: center;
  498. }
  499. }
  500. image {
  501. width: 156rpx;
  502. height: 100%;
  503. z-index: 99;
  504. }
  505. }
  506. // .rich-text {
  507. // width: 315rpx;
  508. // height: 272rpx;
  509. // image {
  510. // width: 315rpx;
  511. // height: 272rpx;
  512. // }
  513. // img {
  514. // width: 315rpx;
  515. // height: 272rpx;
  516. // }
  517. // }
  518. }
  519. </style>