reportPage.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  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: Number(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: Number(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: Number(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: Number(this.id),
  216. }).then((res) => {
  217. this.isInterviewApply = !this.isInterviewApply;
  218. });
  219. },
  220. /* 收藏 */
  221. collectHandle() {
  222. Report.collectRpt({
  223. ArticleId: Number(this.id),
  224. }).then((res) => {
  225. this.isCollection = !this.isCollection;
  226. this.$util.toast(res.Msg);
  227. });
  228. },
  229. /* 错误 */
  230. errorDetails() {
  231. uni.showModal({
  232. confirmText: "知道了",
  233. showCancel: false,
  234. confirmColor: "#3385FF",
  235. content: "网络不好,请刷新重试",
  236. success: (res) => {
  237. uni.navigateBack({
  238. fail() {
  239. uni.switchTab({
  240. url: "/pages/index/index",
  241. });
  242. },
  243. });
  244. },
  245. });
  246. },
  247. async downloadFile() {
  248. const res = await Report.articlePdfwatermark({
  249. ArticleId: Number(this.id),
  250. });
  251. if (res.Ret === 200) {
  252. uni.navigateTo({
  253. url: "/pageMy/downloadFile/downloadFile?url=" + res.Data.FileLink,
  254. });
  255. }
  256. },
  257. btnSearch() {
  258. uni.navigateTo({ url: "/pages-search/indedxSearch/indedxSearch" });
  259. },
  260. //跳转到免费送月卡页面
  261. toggle() {
  262. uni.navigateTo({
  263. url: "/pageMy/freeTrial/freeTrial",
  264. });
  265. },
  266. //隐藏当天的按钮
  267. async removeBton() {
  268. const res = await FreeButton.userFreeButtonUpdate();
  269. },
  270. leavingMessage() {
  271. uni.navigateTo({
  272. url: "/activityPages/generationAsk/generationAsk?id=" + this.id + "&type=文章",
  273. });
  274. },
  275. },
  276. async onShow() {
  277. this.readTiem = 0;
  278. this.setIntervalTiem = setInterval(() => {
  279. this.readTiem++;
  280. }, 1000);
  281. let page = getCurrentPages(); //查看路径
  282. if (page.length === 1) {
  283. await this.$store.dispatch("checkHandle");
  284. if (!this.$store.state.isAuth && !this.$store.state.isBind) this.getDetail();
  285. } else {
  286. // 跳转入口
  287. this.getDetail();
  288. }
  289. },
  290. onLoad(option) {
  291. this.id = option.id ? option.id : "";
  292. if (!this.id && !+this.id > 0) {
  293. this.errorDetails();
  294. }
  295. },
  296. /**
  297. * 用户点击分享
  298. */
  299. onShareAppMessage: function (res) {
  300. if (this.id) {
  301. return {
  302. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.shareTitle,
  303. path: "/pageMy/reportDetail/reportDetail?id=" + this.id,
  304. success: (res) => {},
  305. fail: (err) => {},
  306. };
  307. }
  308. },
  309. onHide() {
  310. //页面退出
  311. if (this.id && +this.id > 0) {
  312. clearInterval(this.setIntervalTiem);
  313. Reports.addStopTime({
  314. ArticleId: Number(this.id),
  315. StopTime: this.readTiem,
  316. OutType: 2,
  317. Source: "MOBILE",
  318. }).then((res) => {});
  319. }
  320. },
  321. onUnload() {
  322. if (this.id && +this.id > 0) {
  323. //页面返回
  324. clearInterval(this.setIntervalTiem);
  325. Reports.addStopTime({
  326. ArticleId: Number(this.id),
  327. StopTime: this.readTiem,
  328. OutType: 1,
  329. Source: "MOBILE",
  330. }).then((res) => {});
  331. }
  332. },
  333. };
  334. </script>
  335. <style lang="scss" scoped>
  336. .reportDetail-container {
  337. background-color: #fff;
  338. padding-bottom: 200rpx;
  339. padding-bottom: calc(200rpx + constant(safe-area-inset-bottom));
  340. padding-bottom: calc(200rpx + env(safe-area-inset-bottom));
  341. .search-view {
  342. position: fixed;
  343. width: 100%;
  344. height: 110rpx;
  345. padding: 15rpx 34rpx;
  346. z-index: 99999;
  347. font-size: 24rpx;
  348. box-sizing: border-box;
  349. background: #fff;
  350. .search-view-box {
  351. display: flex;
  352. align-items: center;
  353. background: #f6f6f6;
  354. border: 1px solid #e5e5e5;
  355. border-radius: 35rpx;
  356. height: 70rpx;
  357. z-index: 99999;
  358. }
  359. .search-icon {
  360. width: 26rpx;
  361. height: 26rpx;
  362. margin: 0 15rpx;
  363. z-index: 99999;
  364. }
  365. }
  366. .footer-con {
  367. position: fixed;
  368. z-index: 99999;
  369. bottom: 0;
  370. padding-bottom: constant(safe-area-inset-bottom);
  371. padding-bottom: env(safe-area-inset-bottom);
  372. left: 0;
  373. width: 100%;
  374. background-color: #ffffff;
  375. display: flex;
  376. justify-content: space-around;
  377. height: 100rpx;
  378. border-top: 1px solid #dddddd;
  379. .handle-item {
  380. align-items: center;
  381. display: flex;
  382. flex-direction: column;
  383. justify-content: center;
  384. position: relative;
  385. z-index: 99999;
  386. .download-img {
  387. width: 44rpx;
  388. height: 44rpx;
  389. margin-bottom: 4rpx;
  390. }
  391. }
  392. }
  393. .footer-free-charge {
  394. .img {
  395. width: 156rpx;
  396. height: 156rpx;
  397. }
  398. .remove-icon {
  399. width: 31rpx;
  400. height: 31rpx;
  401. position: absolute;
  402. right: 0;
  403. top: 0;
  404. }
  405. }
  406. .noauth-cont {
  407. padding-top: 150rpx;
  408. text-align: center;
  409. font-size: 28rpx;
  410. .noauth-ico {
  411. width: 365rpx;
  412. height: 229rpx;
  413. margin-bottom: 70rpx;
  414. }
  415. .tip {
  416. width: 532rpx;
  417. margin: 0 auto 100rpx;
  418. .contract {
  419. padding: 40rpx 90rpx 0;
  420. line-height: 44rpx;
  421. text {
  422. display: inline-block;
  423. }
  424. }
  425. }
  426. .btn-cont {
  427. width: 368rpx;
  428. height: 80rpx;
  429. // position: relative;
  430. background: linear-gradient(268deg, #2ddbff 0%, #1599ff 49%, #005eff 100%);
  431. color: #fff;
  432. font-size: 34rpx;
  433. margin: 0 auto;
  434. text-align: center;
  435. line-height: 80rpx;
  436. &.back-btn {
  437. background: #fff !important;
  438. color: #2c83ff;
  439. border: 1px solid #2c83ff;
  440. margin-top: 30rpx;
  441. }
  442. .btn_bg {
  443. width: 100%;
  444. height: 80rpx;
  445. position: absolute;
  446. left: 0;
  447. top: 0;
  448. }
  449. .btn-txt {
  450. width: 100%;
  451. position: absolute;
  452. z-index: 1;
  453. }
  454. }
  455. }
  456. .month_card {
  457. width: 100%;
  458. height: 565rpx;
  459. padding-left: -20rpx;
  460. }
  461. .btn-dl {
  462. background: linear-gradient(253deg, #fcf3e9 0%, #eedec8 100%) !important;
  463. color: #333 !important;
  464. margin: 30rpx auto !important;
  465. }
  466. .month-back {
  467. background: #f6f6f6 !important;
  468. color: #999 !important;
  469. }
  470. .moneh-text {
  471. text-align: center;
  472. width: 632rpx;
  473. margin: 0 auto 20rpx;
  474. color: #999999;
  475. }
  476. }
  477. </style>