reportPage.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <template>
  2. <view class="container reportDetail-container">
  3. <block v-if="haveAuth === 1">
  4. <web-view :src="linkurl">
  5. <cover-view bindtap="searchViewTap" class="search-view">
  6. <cover-view class="search-view-box" @click="btnSearch">
  7. <cover-image class="search-icon" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/search.png"></cover-image>
  8. <cover-view class="search-text">搜索您想要的纪要</cover-view>
  9. </cover-view>
  10. </cover-view>
  11. <cover-view class="footer-con">
  12. <cover-view class="handle-item" @click="applyHandle">
  13. <cover-image class="download-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/apply_act.png" v-if="reportInfo.IsInterviewApply"></cover-image>
  14. <cover-image class="download-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/apply_ico.png" v-else></cover-image>
  15. <cover-view>{{ reportInfo.IsInterviewApply ? "已申请访谈" : "申请访谈" }}</cover-view>
  16. </cover-view>
  17. <cover-view class="handle-item" @click="collectHandle">
  18. <cover-image class="download-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png" v-if="reportInfo.IsCollect"></cover-image>
  19. <cover-image class="download-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_ico.png" v-else></cover-image>
  20. <cover-view>{{ reportInfo.IsCollect ? "已收藏" : "收藏" }}</cover-view>
  21. </cover-view>
  22. <cover-view class="handle-item" v-if="fileLink" @click="downloadFile">
  23. <cover-image class="download-img" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/down_ico.png"></cover-image>
  24. <cover-view>下载</cover-view>
  25. </cover-view>
  26. </cover-view>
  27. <cover-view class="footer-free-charge free-charge" v-if="isShowFree">
  28. <cover-image class="img" @click="toggle" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/free_icon.png"></cover-image>
  29. <cover-image @click="removeBton" class="remove-icon" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/free_%20remove.png"></cover-image>
  30. </cover-view>
  31. </web-view>
  32. </block>
  33. </view>
  34. </template>
  35. <script>
  36. import { Report, User, Reports,FreeButton } from "@/config/api.js";
  37. import freeCharge from "@/components/freeCharge";
  38. let app = getApp({ allowDefault: true });
  39. export default {
  40. data() {
  41. return {
  42. haveAuth: false,
  43. // haveFree:false,//是否付费
  44. access_token: "", //用户标识
  45. isIphoneX: false, //判断机型
  46. reportInfo: "",
  47. showNav: false,
  48. id: "",
  49. linkurl: "",
  50. isShowTip: false,
  51. sale_name: "", //可联系销售名称
  52. sale_number: "", //可联系销售电话
  53. industry: "", //行业
  54. readTiem: 0,
  55. setIntervalTiem: null,
  56. fileLink: false,
  57. };
  58. },
  59. components: {
  60. freeCharge,
  61. },
  62. methods: {
  63. /* 获取详情 */
  64. getDetail() {
  65. Report.reportDtl({
  66. ArticleId: Number(this.id),
  67. }).then((res) => {
  68. if (res.Ret === 200) {
  69. uni.setNavigationBarTitle({
  70. title: res.Data.Detail.IsSummary == 1 ? "纪要详情" : "报告详情",
  71. });
  72. this.haveAuth = res.Data.HasPermission;
  73. this.industry = res.Data.Detail.CategoryName;
  74. this.sale_name = res.Data.Detail.SellerName;
  75. this.sale_number = res.Data.Detail.SellerMobile;
  76. if (res.Data.HasPermission === 1) {
  77. //有访问权限
  78. this.reportInfo = res.Data.Detail;
  79. this.linkurl = res.Data.Detail.HttpUrl;
  80. this.fileLink = res.Data.Detail.FileLink;
  81. this.access_token = this.access_token || this.$db.get("access_token");
  82. this.$store.dispatch("statistics", { PageType: "ReportParticulars", DetailId: this.id });
  83. }
  84. }
  85. });
  86. },
  87. /* 无权限申请开通权限 */
  88. applyAuth() {
  89. /* 区分是否是潜在用户 */
  90. this.haveAuth === 2
  91. ? User.applyTry({
  92. ApplyMethod: 3,
  93. TryType: "Article",
  94. DetailId: Number(this.id),
  95. }).then((res) => {
  96. if (res.Ret === 200) {
  97. uni.navigateTo({
  98. url: "/pageMy/applyResult/applyResult",
  99. });
  100. }
  101. })
  102. : this.haveAuth === 4
  103. ? uni.navigateTo({
  104. url: "/pageMy/applyTrial/applyTrial?tryType=Article&detailId=" + this.id,
  105. })
  106. : uni.showModal({
  107. title: "",
  108. content: "您已经提交过申请了,请耐心等待",
  109. showCancel: false,
  110. confirmColor: "#365595",
  111. success: function (res) {},
  112. });
  113. },
  114. //销售的立即申请
  115. sellerApplyAuth() {
  116. User.applyTry({
  117. TryType: "Article",
  118. DetailId: Number(this.id),
  119. }).then((res) => {
  120. if (res.Ret === 200) {
  121. uni.showModal({
  122. title: "",
  123. content: "提交申请成功,请耐心等待",
  124. showCancel: false,
  125. confirmColor: "#365595",
  126. success: function (res) {
  127. this.backIndex();
  128. },
  129. });
  130. }
  131. });
  132. },
  133. // 返回首頁
  134. backIndex() {
  135. uni.navigateBack({
  136. fail() {
  137. uni.switchTab({
  138. url: "/pages/index/index",
  139. });
  140. },
  141. });
  142. },
  143. callPhone(num) {
  144. uni.makePhoneCall({
  145. phoneNumber: num,
  146. });
  147. },
  148. /* 申请访谈 */
  149. applyHandle() {
  150. // 申请访谈
  151. !this.reportInfo.IsInterviewApply &&
  152. this.$util.modal("", "专家访谈申请会提交给您的对口销售,销售会线下与您取得联系,确定申请吗?", () => {
  153. this.interviewApi();
  154. });
  155. // 取消申请访谈 区分状态 '待邀请','待访谈','已完成','已取消'
  156. if (this.reportInfo.IsInterviewApply) {
  157. this.$util.modal(
  158. "",
  159. this.reportInfo.InterviewApplyStatus == "待访谈"
  160. ? "当前无法取消访谈,若有疑问,请联系对口销售"
  161. : this.reportInfo.InterviewApplyStatus == "待邀请"
  162. ? "您要取消此次访谈申请吗?"
  163. : "该访谈已完成",
  164. () => {
  165. this.reportInfo.InterviewApplyStatus == "待邀请"
  166. ? this.interviewApi()
  167. : this.reportInfo.InterviewApplyStatus == "待访谈"
  168. ? uni.makePhoneCall({
  169. phoneNumber: "18767183922",
  170. })
  171. : "";
  172. }
  173. );
  174. }
  175. },
  176. /* 访谈接口 */
  177. interviewApi() {
  178. Report.applyRpt({
  179. ArticleId: Number(this.id),
  180. }).then((res) => {
  181. this.reportInfo.IsInterviewApply = !this.reportInfo.IsInterviewApply;
  182. });
  183. },
  184. /* 收藏 */
  185. collectHandle() {
  186. Report.collectRpt({
  187. ArticleId: Number(this.id),
  188. }).then((res) => {
  189. this.reportInfo.IsCollect = !this.reportInfo.IsCollect;
  190. this.$util.toast(res.Msg);
  191. });
  192. },
  193. /* 错误 */
  194. errorDetails() {
  195. uni.showModal({
  196. confirmText: "知道了",
  197. showCancel: false,
  198. confirmColor: "#3385FF",
  199. content: "网络不好,请刷新重试",
  200. success: (res) => {
  201. uni.navigateBack({
  202. fail() {
  203. uni.switchTab({
  204. url: "/pages/index/index",
  205. });
  206. },
  207. });
  208. },
  209. });
  210. },
  211. async downloadFile() {
  212. const res = await Report.articlePdfwatermark({
  213. ArticleId: Number(this.id),
  214. });
  215. if (res.Ret === 200) {
  216. uni.navigateTo({
  217. url: "/pageMy/downloadFile/downloadFile?url=" + res.Data.FileLink,
  218. });
  219. }
  220. },
  221. btnSearch() {
  222. uni.navigateTo({ url: "/pageMy/search/search" });
  223. },
  224. //跳转到免费送月卡页面
  225. toggle() {
  226. uni.navigateTo({
  227. url: "/pageMy/freeTrial/freeTrial",
  228. });
  229. },
  230. //隐藏当天的按钮
  231. async removeBton() {
  232. const res = await FreeButton.userFreeButtonUpdate();
  233. },
  234. },
  235. async onShow() {
  236. this.readTiem = 0;
  237. this.setIntervalTiem = setInterval(() => {
  238. this.readTiem++;
  239. }, 1000);
  240. let page = getCurrentPages(); //查看路径
  241. if (page.length === 1) {
  242. await this.$store.dispatch("checkHandle");
  243. if (!this.$store.state.isAuth && !this.$store.state.isBind) this.getDetail();
  244. } else {
  245. // 跳转入口
  246. this.getDetail();
  247. }
  248. },
  249. onLoad(option) {
  250. // /* 兼容iphonex底部 */
  251. uni.getSystemInfo({
  252. success: (res) => {
  253. let ua = res.model;
  254. if (ua.search("iPhone X") != -1 || ua.search("iPhone 11") != -1 || ua.search("iPhone 11 Pro Max") != -1) {
  255. this.isIphoneX = true;
  256. }
  257. },
  258. });
  259. this.id = option.id ? option.id : "";
  260. if (!this.id && !+this.id > 0) {
  261. this.errorDetails();
  262. }
  263. },
  264. /**
  265. * 用户点击分享
  266. */
  267. onShareAppMessage: function (res) {
  268. if (this.id) {
  269. return {
  270. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.reportInfo.Title,
  271. path: "/pageMy/reportDetail/reportDetail?id=" + this.id,
  272. success: (res) => {},
  273. fail: (err) => {},
  274. };
  275. }
  276. },
  277. onHide() {
  278. //页面退出
  279. if (this.id && +this.id > 0) {
  280. clearInterval(this.setIntervalTiem);
  281. Reports.addStopTime({
  282. ArticleId: Number(this.id),
  283. StopTime: this.readTiem,
  284. OutType: 2,
  285. Source: "MOBILE",
  286. }).then((res) => {});
  287. }
  288. },
  289. onUnload() {
  290. if (this.id && +this.id > 0) {
  291. //页面返回
  292. clearInterval(this.setIntervalTiem);
  293. Reports.addStopTime({
  294. ArticleId: Number(this.id),
  295. StopTime: this.readTiem,
  296. OutType: 1,
  297. Source: "MOBILE",
  298. }).then((res) => {});
  299. }
  300. },
  301. };
  302. </script>
  303. <style lang="scss" scoped>
  304. .reportDetail-container {
  305. background-color: #fff;
  306. .search-view {
  307. position: fixed;
  308. width: 100%;
  309. height: 110rpx;
  310. padding: 15rpx 34rpx;
  311. z-index: 99999;
  312. font-size: 24rpx;
  313. box-sizing: border-box;
  314. background: #fff;
  315. .search-view-box {
  316. display: flex;
  317. align-items: center;
  318. background: #f6f6f6;
  319. border: 1px solid #e5e5e5;
  320. border-radius: 35rpx;
  321. height: 70rpx;
  322. z-index: 99999;
  323. }
  324. .search-icon {
  325. width: 26rpx;
  326. height: 26rpx;
  327. margin: 0 15rpx;
  328. z-index: 99999;
  329. }
  330. }
  331. .footer-con {
  332. position: fixed;
  333. z-index: 99999;
  334. bottom: 0;
  335. padding-bottom: constant(safe-area-inset-bottom);
  336. padding-bottom: env(safe-area-inset-bottom);
  337. left: 0;
  338. width: 100%;
  339. background-color: #ffffff;
  340. display: flex;
  341. justify-content: space-around;
  342. height: 100rpx;
  343. border-top: 1px solid #dddddd;
  344. .handle-item {
  345. align-items: center;
  346. display: flex;
  347. flex-direction: column;
  348. justify-content: center;
  349. position: relative;
  350. z-index: 99999;
  351. .download-img {
  352. width: 44rpx;
  353. height: 44rpx;
  354. margin-bottom: 4rpx;
  355. }
  356. }
  357. }
  358. .footer-free-charge {
  359. .img {
  360. width: 156rpx;
  361. height: 156rpx;
  362. }
  363. .remove-icon {
  364. width: 31rpx;
  365. height: 31rpx;
  366. position: absolute;
  367. right: 0;
  368. top: 0;
  369. }
  370. }
  371. }
  372. </style>