reportPage.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <template>
  2. <view class="container reportDetail-container">
  3. <block v-if="haveAuth === 1">
  4. <web-view :src="strategyUrl + '?url=' + linkurl" v-if="linkurl">
  5. <cover-view class="footer-con">
  6. <cover-view class="handle-item" @click="leavingMessage">
  7. <cover-image class="download-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/leaving_message.png"></cover-image>
  8. <cover-view>留言</cover-view>
  9. </cover-view>
  10. <cover-view class="handle-item" @click="collectHandle">
  11. <cover-image
  12. class="download-img"
  13. :src="isCollection ? 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png' : 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_ico.png'"
  14. ></cover-image>
  15. <cover-view>收藏</cover-view>
  16. </cover-view>
  17. <cover-view class="handle-item" v-if="fileLink" @click="downloadFile">
  18. <cover-image class="download-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/down_ico.png"></cover-image>
  19. <cover-view>下载</cover-view>
  20. </cover-view>
  21. </cover-view>
  22. <cover-view class="footer-free-charge free-charge" v-if="isShowFree">
  23. <cover-image class="img" @click="toggle" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/free_icon.png"></cover-image>
  24. <cover-image @click="removeBton" class="remove-icon" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/free_%20remove.png"></cover-image>
  25. </cover-view>
  26. </web-view>
  27. </block>
  28. <view class="noauth-cont" v-else-if="haveAuth === 2 || haveAuth === 3 || haveAuth === 4 || haveAuth === 5">
  29. <block v-if="!isShowAlert">
  30. <image src="https://hzstatic.hzinsights.com/cygx/czbk/noauth.png" class="noauth-ico"></image>
  31. <block v-if="haveAuth !== 3">
  32. <view class="tip">您暂无权限查看此报告内容,若想查看可以申请开通对应的试用权限</view>
  33. <view class="btn-cont" @click="applyAuth">{{ isShowAlert ? "立即上传" : "立即申请" }} </view>
  34. </block>
  35. <view class="tip" v-if="haveAuth === 3">
  36. 您暂无权限查看此报告内容
  37. <view class="contract">
  38. 若想查看可以联系对口销售
  39. <text @click="callPhone(sale_number)"
  40. >{{ sale_name }}:<text style="color: #d4bf86">{{ sale_number }}</text></text
  41. >
  42. </view>
  43. <view>申请开通对应的试用权限</view>
  44. </view>
  45. <view v-if="haveAuth === 3" class="btn-cont" @click="sellerApplyAuth"> 立即申请</view>
  46. <view class="btn-cont back-btn" @click="backIndex"> 返回 </view>
  47. </block>
  48. <block v-else>
  49. <text class="moneh-text"> 上传名片并填写简单信息,24小时内我们会为您开通一个月的免费月卡 </text>
  50. <img src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/month_card.png" class="month_card" alt="" />
  51. <view class="btn-cont btn-dl" @click="applyAuth"> 立即上传 </view>
  52. <view class="btn-cont month-back" @click="backIndex"> 返回</view>
  53. </block>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import { Report, User, Reports, FreeButton } from "@/config/api.js";
  59. import freeCharge from "@/components/freeCharge";
  60. import { reportStrategyUrl } from "@/config/config";
  61. let app = getApp({ allowDefault: true });
  62. export default {
  63. data() {
  64. return {
  65. readTiem: 0,
  66. access_token: "", //用户标识
  67. reportInfo: "",
  68. id: "",
  69. linkurl: "",
  70. sale_name: "", //可联系销售名称
  71. sale_number: "", //可联系销售电话
  72. industry: "", //行业
  73. setIntervalTiem: null,
  74. fileLink: false,
  75. isCollection: false,
  76. isInterviewApply: false,
  77. isShowTip: false,
  78. showNav: false,
  79. haveAuth: false,
  80. };
  81. },
  82. components: {
  83. freeCharge,
  84. },
  85. computed: {
  86. shareTitle() {
  87. let title = this.reportInfo.Abstract ? this.reportInfo.Title + "--" + this.reportInfo.Abstract : this.reportInfo.Title;
  88. return title;
  89. },
  90. strategyUrl() {
  91. return reportStrategyUrl;
  92. },
  93. },
  94. methods: {
  95. /* 获取详情 */
  96. getDetail() {
  97. Report.reportDtl({
  98. ArticleId: this.id,
  99. PageRouter: this.$store.state.pageRouterReport,
  100. }).then((res) => {
  101. if (res.Ret === 200) {
  102. uni.setNavigationBarTitle({
  103. title: res.Data.Detail.IsSummary == 1 ? "纪要详情" : "报告详情",
  104. });
  105. this.haveAuth = res.Data.HasPermission;
  106. this.industry = res.Data.Detail.CategoryName;
  107. this.isShowWriter = res.Data.IsShow;
  108. this.sale_name = res.Data.Detail.SellerName;
  109. this.sale_number = res.Data.Detail.SellerMobile;
  110. if (res.Data.HasPermission === 1) {
  111. //有访问权限
  112. this.reportInfo = res.Data.Detail;
  113. this.isCollection = this.reportInfo.IsCollect;
  114. this.isInterviewApply = this.reportInfo.IsInterviewApply;
  115. this.linkurl = encodeURIComponent(res.Data.Detail.HttpUrl);
  116. this.fileLink = res.Data.Detail.FileLink;
  117. this.access_token = this.access_token || this.$db.get("access_token");
  118. this.$store.dispatch("statistics", { PageType: "ReportParticulars", DetailId: this.id + "" });
  119. }
  120. }
  121. });
  122. },
  123. /* 无权限申请开通权限 */
  124. applyAuth() {
  125. /* 区分是否是潜在用户 */
  126. this.haveAuth === 2
  127. ? User.applyTry({
  128. ApplyMethod: 3,
  129. TryType: "Article",
  130. DetailId: this.id,
  131. }).then((res) => {
  132. if (res.Ret === 200) {
  133. uni.navigateTo({
  134. url: "/pageMy/applyResult/applyResult",
  135. });
  136. }
  137. })
  138. : this.haveAuth === 4
  139. ? uni.navigateTo({
  140. url: "/pageMy/applyTrial/applyTrial?tryType=Article&detailId=" + this.id,
  141. })
  142. : uni.showModal({
  143. title: "",
  144. content: "您已经提交过申请了,请耐心等待",
  145. showCancel: false,
  146. confirmColor: "#365595",
  147. success: function (res) {},
  148. });
  149. },
  150. //销售的立即申请
  151. sellerApplyAuth() {
  152. User.applyTry({
  153. TryType: "Article",
  154. DetailId: this.id,
  155. }).then((res) => {
  156. if (res.Ret === 200) {
  157. uni.showModal({
  158. title: "",
  159. content: "提交申请成功,请耐心等待",
  160. showCancel: false,
  161. confirmColor: "#365595",
  162. success: function (res) {
  163. this.backIndex();
  164. },
  165. });
  166. }
  167. });
  168. },
  169. // 返回首頁
  170. backIndex() {
  171. uni.navigateBack({
  172. fail() {
  173. uni.switchTab({
  174. url: "/pages/index/index",
  175. });
  176. },
  177. });
  178. },
  179. callPhone(num) {
  180. uni.makePhoneCall({
  181. phoneNumber: num,
  182. });
  183. },
  184. /* 申请访谈 */
  185. applyHandle() {
  186. // 申请访谈
  187. !this.isInterviewApply &&
  188. this.$util.modal("", "专家访谈申请会提交给您的对口销售,销售会线下与您取得联系,确定申请吗?", () => {
  189. this.interviewApi();
  190. });
  191. // 取消申请访谈 区分状态 '待邀请','待访谈','已完成','已取消'
  192. if (this.isInterviewApply) {
  193. this.$util.modal(
  194. "",
  195. this.reportInfo.InterviewApplyStatus == "待访谈"
  196. ? "当前无法取消访谈,若有疑问,请联系对口销售"
  197. : this.reportInfo.InterviewApplyStatus == "待邀请"
  198. ? "您要取消此次访谈申请吗?"
  199. : "该访谈已完成",
  200. () => {
  201. this.reportInfo.InterviewApplyStatus == "待邀请"
  202. ? this.interviewApi()
  203. : this.reportInfo.InterviewApplyStatus == "待访谈"
  204. ? uni.makePhoneCall({
  205. phoneNumber: "18767183922",
  206. })
  207. : "";
  208. }
  209. );
  210. }
  211. },
  212. /* 访谈接口 */
  213. interviewApi() {
  214. Report.applyRpt({
  215. ArticleId: this.id,
  216. }).then((res) => {
  217. this.isInterviewApply = !this.isInterviewApply;
  218. });
  219. },
  220. /* 收藏 */
  221. collectHandle() {
  222. Report.collectRpt({
  223. ArticleId: this.id,
  224. PageRouter: this.$store.state.pageRouterReport,
  225. }).then((res) => {
  226. this.isCollection = !this.isCollection;
  227. this.$util.toast(res.Msg);
  228. });
  229. },
  230. /* 错误 */
  231. errorDetails() {
  232. uni.showModal({
  233. confirmText: "知道了",
  234. showCancel: false,
  235. confirmColor: "#3385FF",
  236. content: "网络不好,请刷新重试",
  237. success: (res) => {
  238. uni.navigateBack({
  239. fail() {
  240. uni.switchTab({
  241. url: "/pages/index/index",
  242. });
  243. },
  244. });
  245. },
  246. });
  247. },
  248. async downloadFile() {
  249. const res = await Report.articlePdfwatermark({
  250. ArticleId: this.id,
  251. });
  252. if (res.Ret === 200) {
  253. uni.navigateTo({
  254. url: "/pageMy/downloadFile/downloadFile?url=" + res.Data.FileLink,
  255. });
  256. }
  257. },
  258. btnSearch() {
  259. uni.navigateTo({ url: "/pages-search/indedxSearch/indedxSearch?source=报告详情页面" });
  260. },
  261. //跳转到免费送月卡页面
  262. toggle() {
  263. uni.navigateTo({
  264. url: "/pageMy/freeTrial/freeTrial",
  265. });
  266. },
  267. //隐藏当天的按钮
  268. async removeBton() {
  269. const res = await FreeButton.userFreeButtonUpdate();
  270. },
  271. leavingMessage() {
  272. uni.navigateTo({
  273. url: "/activityPages/generationAsk/generationAsk?id=" + this.id + "&type=文章",
  274. });
  275. },
  276. },
  277. async onShow() {
  278. this.readTiem = 0;
  279. this.setIntervalTiem = setInterval(() => {
  280. this.readTiem++;
  281. }, 1000);
  282. let page = getCurrentPages(); //查看路径
  283. if (page.length === 1) {
  284. await this.$store.dispatch("checkHandle");
  285. if (!this.$store.state.isAuth && !this.$store.state.isBind && this.id > 0) this.getDetail();
  286. } else {
  287. // 跳转入口
  288. this.id > 0 && this.getDetail();
  289. }
  290. },
  291. onLoad(option) {
  292. this.id = option.id ? +option.id : "";
  293. if (!this.id && !this.id > 0) {
  294. this.errorDetails();
  295. }
  296. },
  297. /**
  298. * 用户点击分享
  299. */
  300. onShareAppMessage: function (res) {
  301. if (this.id) {
  302. return {
  303. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.shareTitle,
  304. path: "/pageMy/reportDetail/reportDetail?id=" + this.id,
  305. success: (res) => {},
  306. fail: (err) => {},
  307. };
  308. }
  309. },
  310. onHide() {
  311. //页面退出
  312. if (this.id && this.id > 0) {
  313. clearInterval(this.setIntervalTiem);
  314. Reports.addStopTime({
  315. ArticleId: this.id,
  316. StopTime: this.readTiem,
  317. OutType: 2,
  318. Source: "MOBILE",
  319. }).then((res) => {});
  320. }
  321. },
  322. onUnload() {
  323. if (this.id && this.id > 0) {
  324. //页面返回
  325. clearInterval(this.setIntervalTiem);
  326. Reports.addStopTime({
  327. ArticleId: this.id,
  328. StopTime: this.readTiem,
  329. OutType: 1,
  330. Source: "MOBILE",
  331. }).then((res) => {});
  332. }
  333. },
  334. };
  335. </script>
  336. <style lang="scss" scoped>
  337. .reportDetail-container {
  338. background-color: #fff;
  339. padding-bottom: 200rpx;
  340. padding-bottom: calc(200rpx + constant(safe-area-inset-bottom));
  341. padding-bottom: calc(200rpx + env(safe-area-inset-bottom));
  342. .search-view {
  343. position: fixed;
  344. width: 100%;
  345. height: 110rpx;
  346. padding: 15rpx 34rpx;
  347. z-index: 99999;
  348. font-size: 24rpx;
  349. box-sizing: border-box;
  350. background: #fff;
  351. .search-view-box {
  352. display: flex;
  353. align-items: center;
  354. background: #f6f6f6;
  355. border: 1px solid #e5e5e5;
  356. border-radius: 35rpx;
  357. height: 70rpx;
  358. z-index: 99999;
  359. }
  360. .search-icon {
  361. width: 26rpx;
  362. height: 26rpx;
  363. margin: 0 15rpx;
  364. z-index: 99999;
  365. }
  366. }
  367. .footer-con {
  368. position: fixed;
  369. z-index: 99999;
  370. bottom: 0;
  371. padding-bottom: constant(safe-area-inset-bottom);
  372. padding-bottom: env(safe-area-inset-bottom);
  373. left: 0;
  374. width: 100%;
  375. background-color: #ffffff;
  376. display: flex;
  377. justify-content: space-around;
  378. height: 100rpx;
  379. border-top: 1px solid #dddddd;
  380. .handle-item {
  381. align-items: center;
  382. display: flex;
  383. flex-direction: column;
  384. justify-content: center;
  385. position: relative;
  386. z-index: 99999;
  387. .download-img {
  388. width: 44rpx;
  389. height: 44rpx;
  390. margin-bottom: 4rpx;
  391. }
  392. }
  393. }
  394. .footer-free-charge {
  395. .img {
  396. width: 156rpx;
  397. height: 156rpx;
  398. }
  399. .remove-icon {
  400. width: 31rpx;
  401. height: 31rpx;
  402. position: absolute;
  403. right: 0;
  404. top: 0;
  405. }
  406. }
  407. .noauth-cont {
  408. padding-top: 150rpx;
  409. text-align: center;
  410. font-size: 28rpx;
  411. .noauth-ico {
  412. width: 365rpx;
  413. height: 229rpx;
  414. margin-bottom: 70rpx;
  415. }
  416. .tip {
  417. width: 532rpx;
  418. margin: 0 auto 100rpx;
  419. .contract {
  420. padding: 40rpx 90rpx 0;
  421. line-height: 44rpx;
  422. text {
  423. display: inline-block;
  424. }
  425. }
  426. }
  427. .btn-cont {
  428. width: 368rpx;
  429. height: 80rpx;
  430. // position: relative;
  431. background: linear-gradient(268deg, #2ddbff 0%, #1599ff 49%, #005eff 100%);
  432. color: #fff;
  433. font-size: 34rpx;
  434. margin: 0 auto;
  435. text-align: center;
  436. line-height: 80rpx;
  437. &.back-btn {
  438. background: #fff !important;
  439. color: #2c83ff;
  440. border: 1px solid #2c83ff;
  441. margin-top: 30rpx;
  442. }
  443. .btn_bg {
  444. width: 100%;
  445. height: 80rpx;
  446. position: absolute;
  447. left: 0;
  448. top: 0;
  449. }
  450. .btn-txt {
  451. width: 100%;
  452. position: absolute;
  453. z-index: 1;
  454. }
  455. }
  456. }
  457. .month_card {
  458. width: 100%;
  459. height: 565rpx;
  460. padding-left: -20rpx;
  461. }
  462. .btn-dl {
  463. background: linear-gradient(253deg, #fcf3e9 0%, #eedec8 100%) !important;
  464. color: #333 !important;
  465. margin: 30rpx auto !important;
  466. }
  467. .month-back {
  468. background: #f6f6f6 !important;
  469. color: #999 !important;
  470. }
  471. .moneh-text {
  472. text-align: center;
  473. width: 632rpx;
  474. margin: 0 auto 20rpx;
  475. color: #999999;
  476. }
  477. }
  478. </style>