report.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. <template>
  2. <div>
  3. <div class="container-cygx" @copy="copyMonitor" v-if="haveData == 1" :class="reportInfo.IsResearch ? 'no-cv' : ''">
  4. <canvas id="tutorial" ref="tutorial"></canvas>
  5. <topbar class="top-box-bar" showText="弘则研究" />
  6. <div class="search">
  7. <div class="search-box" @click="btnSearch">
  8. <Icon name="search" color="#8D8D8D" />
  9. <span>搜索您想要的纪要</span>
  10. </div>
  11. </div>
  12. <div class="z-index-content">
  13. <div class="content-top">
  14. <div class="report-title">{{ reportInfo.Title }}</div>
  15. <div class="report-text">
  16. <div class="report_desc">
  17. <span class="author">{{ reportInfo.Department }}</span>
  18. <span>{{ reportInfo.PublishDate }}</span>
  19. </div>
  20. <div class="seller-list" v-if="!reportInfo.IsResearch">
  21. <span>联系人:</span>
  22. <span v-for="(item, index) in reportInfo.SellerList" :key="index"> {{ item.SellerName }}({{ item.SellerMobile }})&nbsp;&nbsp; </span>
  23. </div>
  24. <div class="seller-list" v-else>
  25. <span>作者:{{ reportInfo.SellerAndMobile }} </span>
  26. </div>
  27. <div>注:请务必阅读<span class="tip" @click="showTips = true"> &nbsp;免责声明</span></div>
  28. <div class="container-abstract">&nbsp;&nbsp;摘要:&nbsp;{{ reportInfo.Abstract }}</div>
  29. </div>
  30. </div>
  31. <div class="detail-report">
  32. <div id="report-content" v-html="reportInfo.Body"></div>
  33. </div>
  34. </div>
  35. <div class="btn-returntop">
  36. <img src="~@/assets/cygx/returntop.png" @click="scrolltop" style="width: 40px" />
  37. </div>
  38. <div class="fixed_cont">
  39. <div class="handle-item" @click="quizBtn" v-if="reportInfo.IsResearch">
  40. <img src="@/assets/cygx/quiz_ico.png" class="img_ico" />
  41. <div>提问</div>
  42. </div>
  43. <div class="handle-item" @click="collectHandle">
  44. <img src="@/assets/cygx/collect_act.png" class="img_ico" v-if="reportInfo.IsCollect" />
  45. <img src="@/assets/cygx/collect_ico.png" class="img_ico" v-else />
  46. <div v-if="reportInfo.IsResearch">
  47. {{ `${reportInfo.CollectionNum} 人收藏` }}
  48. </div>
  49. </div>
  50. </div>
  51. <dlg :showTips="showTips" :reportInfo="reportInfo" @hideDlg="showTips = false" />
  52. </div>
  53. <div v-else class="nodata">
  54. <img src="@/assets/cygx/noauth.png" mode="" class="nodata_ico" />
  55. <div v-if="haveData == 2">
  56. <p>您暂无权限查看报告</p>
  57. <p>若想查看可联系海通销售开通试用权限</p>
  58. </div>
  59. <div v-else>
  60. <p>您的试用权限已到期</p>
  61. <p>若想继续试用,请联系海通销售</p>
  62. </div>
  63. </div>
  64. <topbar v-if="haveData != 1" class="top-haveData-bar" showText="弘则研究" />
  65. </div>
  66. </template>
  67. <script setup>
  68. import { reactive, onMounted, toRefs, ref, onUnmounted } from "vue";
  69. import { useRouter, useRoute } from "vue-router";
  70. import { RaiApi } from "@/api/htgj/api.js";
  71. import { Icon, Dialog, Toast } from "vant";
  72. import dlg from "../cygx/dlg.vue";
  73. import store from "@/store";
  74. import topbar from "./topbar.vue";
  75. const router = useRouter();
  76. const route = useRoute();
  77. const state = reactive({
  78. reportInfo: {},
  79. });
  80. const rerportId = ref(null);
  81. const haveData = ref(1);
  82. const fileLink = ref(false);
  83. const showTips = ref(false);
  84. const tutorial = ref(null);
  85. /* 访谈接口 */
  86. const interviewApi = () => {
  87. RaiApi.applyRpt({
  88. ArticleId: Number(rerportId.value),
  89. }).then((res) => {
  90. if (res.Ret === 200) {
  91. state.reportInfo.IsInterviewApply = !state.reportInfo.IsInterviewApply;
  92. state.reportInfo.InterviewApplyStatus = state.reportInfo.IsInterviewApply ? "待邀请" : "";
  93. Toast(res.Msg);
  94. }
  95. });
  96. };
  97. const scrolltop = () => {
  98. document.body.scrollTop = document.documentElement.scrollTop = 0;
  99. };
  100. /* 复制 */
  101. const copyMonitor = () => {
  102. RaiApi.pageHistoryCopy({
  103. DetailId: rerportId.value + "",
  104. }).then((res) => {});
  105. };
  106. /* 打水印 */
  107. const waterMark = (text) => {
  108. let canvas = document.createElement("canvas");
  109. let ctx = canvas.getContext("2d");
  110. ctx.font = "20px Arial";
  111. ctx.rotate((-45 * Math.PI) / 200);
  112. ctx.fillText(text, 30, 200);
  113. ctx.fillText(text, -40, 100);
  114. // 将canvas的内容转换为base64编码
  115. let data = canvas.toDataURL("image/png");
  116. // 将容器的的背景图片设置为生成的base64图片,并平铺
  117. tutorial.value.style.background = "url(" + data + ") repeat";
  118. };
  119. //点击回到搜索页面
  120. const btnSearch = () => {
  121. router.push("/htgj/search");
  122. };
  123. const timeState = reactive({
  124. setIntervalTiem: null,
  125. readTiem: 0,
  126. });
  127. /* 获取报告详情 */
  128. const getReport = (id) => {
  129. RaiApi.reportDtl({
  130. ArticleId: id,
  131. }).then((res) => {
  132. if (res.Ret === 200) {
  133. haveData.value = res.Data.HasPermission;
  134. if (res.Data.HasPermission === 1) {
  135. //有访问权限
  136. state.reportInfo = res.Data.Detail;
  137. fileLink.value = res.Data.Detail.FileLink;
  138. if (state.reportInfo.IsResearch || state.reportInfo.IsBelongSummary) {
  139. waterMark(res.Data.CompanyName);
  140. }
  141. $(document).on("click", "#report-content img", function (event) {
  142. let imgArray = [];
  143. let src_tag = $(this).attr("src");
  144. let parent_tag = $(this).parent();
  145. if (src_tag && !parent_tag.attr("href")) {
  146. $("#report-content img").each(function (index, el) {
  147. let itemSrc = $(this).attr("src");
  148. imgArray.push(itemSrc);
  149. });
  150. wx.previewImage({ current: src_tag, urls: imgArray });
  151. }
  152. });
  153. timeState.readTiem = 0;
  154. timeState.setIntervalTiem = setInterval(() => {
  155. timeState.readTiem++;
  156. }, 1000);
  157. }
  158. }
  159. });
  160. };
  161. //点击到提问页面
  162. const quizBtn = () => {
  163. // wx.miniProgram.navigateTo({
  164. // url: "/activityPages/generationAsk/generationAsk?id=" + state.reportInfo.ArticleId + "&type=文章",
  165. // });
  166. router.push({
  167. path: "/htgj/quiz",
  168. query: {
  169. id: rerportId.value,
  170. },
  171. });
  172. };
  173. /* 收藏 */
  174. const collectHandle = () => {
  175. RaiApi.collectRpt({
  176. ArticleId: Number(rerportId.value),
  177. }).then((res) => {
  178. if (res.Ret === 200) {
  179. state.reportInfo.IsCollect = !state.reportInfo.IsCollect;
  180. if (res.Data.Status == 2) {
  181. state.reportInfo.CollectionNum -= 1;
  182. } else {
  183. state.reportInfo.CollectionNum += 1;
  184. }
  185. Toast(res.Msg);
  186. }
  187. });
  188. };
  189. onMounted(() => {
  190. if (route.query.id) {
  191. rerportId.value = route.query.id;
  192. getReport(rerportId.value);
  193. }
  194. });
  195. onUnmounted(() => {
  196. clearInterval(timeState.setIntervalTiem);
  197. if (!rerportId.value || haveData.value !== 1) return;
  198. RaiApi.addStopTime({
  199. ArticleId: Number(rerportId.value),
  200. StopTime: timeState.readTiem,
  201. OutType: 1,
  202. Source: "PC",
  203. }).then((res) => {});
  204. });
  205. const { reportInfo } = toRefs(state);
  206. </script>
  207. <style lang="scss">
  208. .container-cygx {
  209. padding: 54px 34px 34px 34px;
  210. position: relative;
  211. z-index: 5;
  212. .z-index-content {
  213. position: relative;
  214. z-index: 5;
  215. }
  216. .fixed_cont {
  217. position: fixed;
  218. bottom: 0;
  219. left: 0;
  220. right: 0;
  221. display: flex;
  222. justify-content: space-around;
  223. border-top: 1px solid #ddd;
  224. padding-bottom: calc(5px + constant(safe-area-inset-bottom));
  225. padding-bottom: calc(5px + env(safe-area-inset-bottom));
  226. background-color: #fff;
  227. z-index: 9;
  228. box-sizing: border-box;
  229. .handle-item {
  230. padding-top: 14px;
  231. text-align: center;
  232. line-height: 33px;
  233. font-size: 20px;
  234. color: #888888;
  235. width: 130px;
  236. img {
  237. width: 44px;
  238. height: 44px;
  239. padding: 0;
  240. margin: 0;
  241. }
  242. div {
  243. padding: 0;
  244. margin: 0;
  245. }
  246. }
  247. }
  248. .top-box-bar {
  249. position: fixed;
  250. top: 0;
  251. left: 0;
  252. width: 100%;
  253. height: 60px;
  254. background-color: #fff;
  255. margin: 0;
  256. padding-top: 20px;
  257. z-index: 10;
  258. img {
  259. margin-top: 10px;
  260. }
  261. }
  262. .search {
  263. width: 100%;
  264. padding: 20px 20px;
  265. line-height: 70px;
  266. position: fixed;
  267. top: 60px;
  268. left: 0;
  269. background: #fff;
  270. z-index: 9;
  271. .search-box {
  272. display: flex;
  273. align-items: center;
  274. padding-left: 20px;
  275. width: 100%;
  276. height: 70px;
  277. border-radius: 35px;
  278. background: #f6f6f6;
  279. color: #8d8d8d;
  280. font-size: 24px;
  281. }
  282. }
  283. .content-top {
  284. margin-top: 115px;
  285. .report-title {
  286. font-size: 34px;
  287. font-weight: bold;
  288. color: #4a4a4a;
  289. margin: 60px 0 20px;
  290. }
  291. .report-text {
  292. color: #999999;
  293. font-size: 28px;
  294. .seller-list {
  295. margin: 20px 0;
  296. }
  297. .report_desc {
  298. display: flex;
  299. justify-content: space-between;
  300. }
  301. .tip {
  302. color: #3385ff;
  303. }
  304. .container-abstract {
  305. margin: 40px 0 20px;
  306. padding-bottom: 40px;
  307. border-bottom: 2px dashed #999;
  308. position: relative;
  309. line-height: 44px;
  310. color: #333;
  311. &::before {
  312. content: "";
  313. position: absolute;
  314. top: 0;
  315. left: 0;
  316. width: 8px;
  317. height: 44px;
  318. background: #2a65f5;
  319. }
  320. }
  321. }
  322. }
  323. .report-link {
  324. font-size: 28px;
  325. line-height: 80px;
  326. }
  327. .detail-report {
  328. padding-bottom: 130px;
  329. p,
  330. span {
  331. font-size: 28px !important;
  332. }
  333. img {
  334. width: 100% !important;
  335. }
  336. a {
  337. color: #333;
  338. }
  339. table {
  340. border-collapse: collapse;
  341. width: 100% !important;
  342. margin-left: 0 !important;
  343. }
  344. tr td,
  345. th {
  346. border: 1px solid #333;
  347. }
  348. }
  349. pre {
  350. width: 100%;
  351. overflow-y: auto;
  352. overflow-x: hidden;
  353. outline: none;
  354. border: 0;
  355. white-space: pre-wrap;
  356. word-break: normal;
  357. }
  358. .btn-returntop {
  359. position: fixed;
  360. right: 40px;
  361. bottom: 150px;
  362. width: 88px;
  363. height: 88px;
  364. z-index: 10;
  365. }
  366. .fixed_cont {
  367. position: fixed;
  368. bottom: 0;
  369. left: 0;
  370. right: 0;
  371. display: flex;
  372. justify-content: space-around;
  373. border-top: 1px solid #ddd;
  374. padding-bottom: calc(5px + constant(safe-area-inset-bottom));
  375. padding-bottom: calc(5px + env(safe-area-inset-bottom));
  376. background-color: #fff;
  377. z-index: 9;
  378. box-sizing: border-box;
  379. .handle-item {
  380. padding-top: 14px;
  381. text-align: center;
  382. line-height: 33px;
  383. font-size: 20px;
  384. color: #888888;
  385. img {
  386. width: 44px;
  387. height: 44px;
  388. padding: 0;
  389. margin: 0;
  390. }
  391. div {
  392. padding: 0;
  393. margin: 0;
  394. }
  395. }
  396. }
  397. }
  398. .nodata {
  399. width: 100%;
  400. margin: 30% auto;
  401. text-align: center;
  402. img {
  403. width: 50%;
  404. margin-bottom: 30px;
  405. }
  406. p {
  407. margin-top: 20px;
  408. }
  409. }
  410. .no-cv {
  411. -webkit-user-select: none;
  412. -khtml-user-select: none;
  413. -moz-user-select: none;
  414. -ms-user-select: none;
  415. user-select: none;
  416. }
  417. .top-box-bar {
  418. position: fixed;
  419. top: 0;
  420. left: 0;
  421. width: 100%;
  422. height: 40px;
  423. background-color: #fff;
  424. margin-top: 15px;
  425. z-index: 10;
  426. }
  427. #tutorial {
  428. position: absolute;
  429. top: 0;
  430. left: 0;
  431. z-index: 1;
  432. width: 100%;
  433. height: 100%;
  434. opacity: 0.1;
  435. // transform: translateX(130px) rotate(-38deg);
  436. }
  437. .van-dialog--round-button .van-dialog__footer {
  438. border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
  439. padding: 0 !important;
  440. .van-button--warning {
  441. color: #333 !important;
  442. border-right: 1px solid rgba(0, 0, 0, 0.1) !important;
  443. }
  444. .van-button--danger {
  445. color: #3385ff !important;
  446. }
  447. .van-button--warning,
  448. .van-button--danger {
  449. height: 80px !important;
  450. border-radius: 0 !important;
  451. }
  452. .van-goods-action-button--first {
  453. border-right: 1px solid rgba(0, 0, 0, 0.1) !important;
  454. }
  455. }
  456. .van-icon-search {
  457. font-size: 28px;
  458. margin-right: 10px;
  459. }
  460. .top-haveData-bar {
  461. position: absolute !important;
  462. width: 100%;
  463. margin-top: 20px;
  464. top: 0;
  465. left: 0;
  466. z-index: 9;
  467. }
  468. </style>