detail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <!-- 原项目丢了 省事直接cv一下老项目代码 -->
  2. <template>
  3. <div class="wrapper" ref="wrapper">
  4. <div id="reportdtl" v-if="isshow" :style="{backgroundColor:reportInfo.CanvasColor}">
  5. <!-- <div class="top-header">
  6. <div class="title">{{reportInfo.Title}}</div>
  7. <div class="flex">
  8. <span>{{reportInfo.Author}}</span>
  9. <span>{{reportInfo.PublishTime}}</span>
  10. </div>
  11. </div> -->
  12. <div>
  13. <div class="html-head-img-box" v-if="reportInfo && !!reportInfo.NeedSplice && reportInfo.HeadImg">
  14. <img :src="reportInfo.HeadImg" alt="" style="display:block;width:100%">
  15. <div class="head-layout-item" v-for="item in headImgStyle" :key="item.value"
  16. :style="{fontFamily:item.family,fontSize:(item.size*2)+'px',fontWeight:item.weight,textAlign:item.align,color:item.color,
  17. width:item.width,height:item.height,left:item.left,top:item.top
  18. }">
  19. {{ layoutBaseInfo[item.value] }}
  20. </div>
  21. </div>
  22. <div class="no-layout-img-box" v-if="reportInfo && !!reportInfo.NeedSplice && (!reportInfo.HeadImg) && (!reportInfo.EndImg)">
  23. <header>{{reportInfo.Title}}</header>
  24. <div style=" box-sizing:border-box; color:#666; font-size:24px; overflow:hidden;">
  25. <span>{{ reportInfo.Author}}</span>
  26. <span style="float:right;">{{reportInfo.CreateTime}}</span>
  27. </div>
  28. </div>
  29. <div class="abstract" v-if="reportInfo && !!reportInfo.NeedSplice">
  30. <div>摘要: <span v-html="reportInfo.Abstract"></span></div>
  31. </div>
  32. <div id="resetcss" style="overflow:hidden;" v-html="reportInfo.Content"></div>
  33. <div class="html-end-img-box" v-if="reportInfo && !!reportInfo.NeedSplice && reportInfo.EndImg">
  34. <img :src="reportInfo.EndImg" alt="" style="display:block;width:100%">
  35. <div class="head-layout-item" v-for="item in endImgStyle" :key="item.value"
  36. :style="{fontFamily:item.family,fontSize:(item.size*2)+'px',fontWeight:item.weight,textAlign:item.align,color:item.color,
  37. width:item.width,height:item.height,left:item.left,top:item.top
  38. }">
  39. {{ layoutBaseInfo[item.value] }}
  40. </div>
  41. </div>
  42. <!-- <div id="resetcss">
  43. <ul>
  44. <li v-for="(html, index) in realContent" :key="index" v-html="html"></li>
  45. </ul>
  46. </div> -->
  47. <div id="tipsAlert">
  48. <div
  49. style="
  50. width: 100%;
  51. padding: 0.8rem 0.66rem 2.2rem;
  52. box-sizing: border-box;
  53. font: 0.52rem/0.8rem 'PingFang-SC-Regular';
  54. color: #666;
  55. background: #fff;
  56. overflow: scroll;
  57. position: relative;
  58. border-radius: 0.2rem;
  59. "
  60. >
  61. <!-- <h1 style="font:0.64rem '微软雅黑'; color:#333; text-align:center; margin-bottom:0.34rem;">免责声明</h1> -->
  62. <h1 style="font: 0.64rem 'PingFang-SC-Regular'; color: #333; text-align: center; margin-bottom: 0.34rem">免责声明</h1>
  63. <!-- <p>
  64. 1、本报告仅供弘则弥道(上海)投资咨询有限公司正式签约的机构客户使用,不会仅因接收人/接受机构收到本报告而将其视为客户。
  65. </p>
  66. <p>
  67. 2、本报告根据国际和行业通行的准则,以合法渠道获得这些信息,尽可能保证可靠、准确和完整,但并不保证报告所述信息的准确性和完整性,也不保证本报告所包含的信息或建议在本报告发出后不会发生任何变更。本报告中所提供的信息仅供参考。
  68. </p>
  69. <p>
  70. 3、报告中的内容不对投资者做出的最终操作建议做任何的担保,也没有任何形式的分享投资收益或者分担投资损失的书面或口头承诺。不作为客户在投资、法律、会计或税务等方面的最终操作建议,也不作为道义的、责任的和法律的依据或者凭证,无论是否已经明示或者暗示。
  71. </p>
  72. <p>
  73. 4、在任何情况下,本公司不对客户/接受人/接受机构因使用报告中内容所引致的一切损失负责任,客户/接受人/接受机构需自行承担全部风险。
  74. </p> -->
  75. <div class="disclaimer" v-html="Disclaimer"></div>
  76. <p @click="hideTips" style="position: absolute; bottom: 0; left: 0; right: 0; font-size: 0.56rem; line-height: 1.6rem; color: #2680eb; text-align: center; border-top: 1px solid #eaeaea">
  77. 知道了
  78. </p>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. <div style="width: 30px; position: fixed; right: 0.6rem; bottom: 2.4rem; z-index: 100">
  84. <img src="~@/assets/img/returntop.png" @click="goTop" style="width: 30px; margin-bottom: 0.2rem" />
  85. </div>
  86. </div>
  87. </template>
  88. <script>
  89. import { smartReportDetail } from "@/api/api.js";
  90. import _ from "lodash";
  91. import wxShare from "../utils/wxShare.js";
  92. export default {
  93. data() {
  94. return {
  95. id: this.$route.query.code || "",
  96. isshow: false,
  97. /**
  98. * NeedSplice 0-不需要 1-需要
  99. */
  100. reportInfo: {},
  101. reportlist: [],
  102. totalContent: [],
  103. realContent: [],
  104. page_no: 0,
  105. pageSize: 20, //默认初始加载50个p标签
  106. total_page: 0,
  107. Disclaimer: "",
  108. headImgStyle:null,//版头style
  109. endImgStyle:null,//版尾style
  110. layoutBaseInfo:{
  111. 研报标题:'',
  112. 研报作者:'',
  113. 创建时间:''
  114. }
  115. };
  116. },
  117. mounted() {
  118. wx.ready(function(){
  119. wx.hideOptionMenu();
  120. });
  121. this.getreportdetail();
  122. window.addEventListener("scroll", this.loadMoreHandle);
  123. window.addEventListener('resize',this.pageResize)
  124. },
  125. destroyed() {
  126. window.removeEventListener("scroll", this.loadMoreHandle);
  127. window.removeEventListener('resize',this.pageResize)
  128. },
  129. updated() {
  130. // $('#resetcss').css({font:"0.76rem/1.5 '微软雅黑'",color:"#333",letterSpacing:"0.05rem"});
  131. // $("#resetcss")
  132. // .find("img")
  133. // .css({ display: "block", margin: "0 auto", maxWidth: "100%" });
  134. // $("#resetcss")
  135. // .find("video")
  136. // .css({ display: "block", margin: "0 auto", maxWidth: "100%" });
  137. // $("#resetcss")
  138. // .find("p")
  139. // .css({
  140. // margin: "0 auto 0",
  141. // font: "0.7rem/1.5 'PingFang-SC-Regular'",
  142. // color: "#333",
  143. // letterSpacing: "0.08rem",
  144. // lineHeight: "1.3rem",
  145. // });
  146. /* $("#resetcss")
  147. .find("span")
  148. .css({
  149. font: "0.7rem/1.5 'PingFang-SC-Regular'",
  150. letterSpacing: "0.08rem",
  151. lineHeight: "1.3rem",
  152. }); */
  153. // $("#resetcss")
  154. // .find("span.fr-emoticon")
  155. // .css({
  156. // width: "20px",
  157. // height: "20px",
  158. // backgroundRepeat: "no-repeat",
  159. // backgroundSize: "cover",
  160. // display: "inline-block",
  161. // verticalAlign: "middle",
  162. // });
  163. // $("#resetcss").find("ol").css({ listStyleType: "disc" });
  164. // $("#resetcss")
  165. // .find("pre")
  166. // .css({ display: "block", whiteSpace: "pre-wrap" });
  167. },
  168. methods: {
  169. pageResize(){
  170. const el=document.getElementById('reportdtl')
  171. const windowWid=document.body.clientWidth
  172. if(windowWid<800){
  173. el.style.transform=`scale(${windowWid/800})`
  174. // el.style.
  175. }
  176. },
  177. showTips() {
  178. //免责声明显示
  179. $("#tipsAlert").animate({ top: 0 });
  180. },
  181. hideTips() {
  182. //免责声明收起
  183. $("#tipsAlert").animate({ top: "-120rem" });
  184. },
  185. goTop() {
  186. document.body.scrollTop = document.documentElement.scrollTop = 0;
  187. },
  188. async getreportdetail() {
  189. const { Data, Ret } = await smartReportDetail({ ReportCode: this.id });
  190. document.title = (Data && Data.H5ShareName) || "研报";
  191. if (Ret !== 200) return;
  192. // console.log('data',Data)
  193. let H5ShareName = Data.H5ShareName;
  194. let H5ReportShareImg = Data.H5ReportShareImg;
  195. let wxShareTitle = !!Data.Hz
  196. ? "【第" + Data.Report.Stage + "期|FICC" + "】" + Data.Report.Title + "(" + Data.Report.CreateTime.substring(5, 7) + Data.Report.CreateTime.substring(8, 10) + ")"
  197. : Data.Report.Title + "(" + Data.Report.CreateTime.substring(5, 7) + Data.Report.CreateTime.substring(8, 10) + ")";
  198. this.reportInfo = Data.Report || {};
  199. this.headImgStyle=this.reportInfo.HeadStyle?JSON.parse(this.reportInfo.HeadStyle):[]
  200. this.headImgStyle.map(st =>{
  201. st.value=st.value || st.label
  202. })
  203. this.endImgStyle=this.reportInfo.EndStyle?JSON.parse(this.reportInfo.EndStyle):[]
  204. this.endImgStyle.map(st =>{
  205. st.value=st.value || st.label
  206. })
  207. this.layoutBaseInfo['研报标题']=this.reportInfo.Title
  208. this.layoutBaseInfo['研报作者']=this.reportInfo.Author
  209. this.layoutBaseInfo['创建时间']=this.reportInfo.CreateTime
  210. this.Disclaimer = Data.Disclaimer || "";
  211. this.isshow = true;
  212. this.$nextTick(()=>{
  213. this.pageResize()
  214. })
  215. this.splitContentHandle(this.reportInfo.Content);
  216. $(document).on("click", "#resetcss img", function (event) {
  217. let imgArray = [];
  218. let curImageSrc = $(this).attr("src");
  219. let oParent = $(this).parent();
  220. if (curImageSrc && !oParent.attr("href")) {
  221. $("#resetcss img").each(function (index, el) {
  222. let itemSrc = $(this).attr("src");
  223. imgArray.push(itemSrc);
  224. });
  225. wx.previewImage({ current: curImageSrc, urls: imgArray });
  226. }
  227. });
  228. wxShare(document.location.href, H5ShareName || document.title, wxShareTitle, H5ReportShareImg, 0);
  229. },
  230. /*内容分割*/
  231. splitContentHandle(content) {
  232. const regex = new RegExp(`<div[^>]*class="?report-drag-item-wrap"?>`);
  233. const arr = content.split(regex);
  234. this.totalContent = arr.map((_) => _ + "<div class='report-drag-item-wrap'>");
  235. this.realContent = this.totalContent.slice(0, this.pageSize);
  236. this.total_page = parseInt(this.totalContent.length / this.pageSize) + 1;
  237. // console.log(this.realContent, this.totalContent);
  238. },
  239. /* 加载下一页内容 */
  240. loadContent() {
  241. this.realContent = this.realContent.concat(this.totalContent.slice(this.page_no * this.pageSize, (this.page_no + 1) * this.pageSize));
  242. },
  243. loadMoreHandle: _.throttle(function () {
  244. if (this.page_no >= this.total_page) return;
  245. const scrollTop = document.documentElement.scrollTop || document.body.scrollTop; // 滚动的高度
  246. const clientHeight = document.documentElement.clientHeight || document.body.clientHeight; // 可视高度
  247. const scrollHeight = document.body.scrollHeight; // 总高度
  248. if (scrollHeight - scrollTop - clientHeight < 500) {
  249. console.log("触底");
  250. this.page_no = this.page_no + 1;
  251. this.loadContent();
  252. }
  253. }, 300),
  254. },
  255. };
  256. </script>
  257. <style lang="scss">
  258. body{
  259. line-height: normal;
  260. }
  261. .wrapper {
  262. position: relative;
  263. // overflow: hidden;
  264. height: 100%;
  265. #noaccess {
  266. width: 100%;
  267. height: 12rem;
  268. padding: 5rem 0.6rem 1rem;
  269. box-sizing: border-box;
  270. text-align: center;
  271. position: absolute;
  272. bottom: 0;
  273. background: url(~@/assets/img/accessbg.png) no-repeat;
  274. background-size: 100% auto;
  275. overflow: hidden;
  276. > a,
  277. button {
  278. width: 12rem;
  279. height: 2rem;
  280. background: url(~@/assets/img/newbtn600.png) no-repeat;
  281. background-size: 100% 100%;
  282. font-size: 0.48rem;
  283. color: #fff;
  284. border: none;
  285. margin-top: 1.5rem;
  286. }
  287. }
  288. }
  289. #reportdtl {
  290. font-size: 14px;
  291. background: #fff;
  292. overflow: auto;
  293. width: 800px;
  294. padding: 20px 20px 20px 44px;
  295. margin: 0 auto;
  296. .top-header {
  297. background-image: url("@/assets/img/smart_report_bg01.png");
  298. background-size: cover;
  299. background-repeat: no-repeat;
  300. background-position: center;
  301. padding: 16px;
  302. color: #fff;
  303. .title {
  304. font-size: 16px;
  305. margin-bottom: 10px;
  306. }
  307. .flex {
  308. font-size: 12px;
  309. display: flex;
  310. justify-content: space-between;
  311. }
  312. }
  313. .html-head-img-box,.html-end-img-box{
  314. position: relative;
  315. .head-layout-item{
  316. position: absolute;
  317. overflow: hidden;
  318. box-sizing: border-box
  319. }
  320. }
  321. .no-layout-img-box{
  322. header{
  323. padding:10px 0; box-sizing:border-box; font-size:28px; font-weight:500; color:#333; background:#fff;
  324. }
  325. }
  326. .abstract{
  327. padding:10px 0; box-sizing:border-box; font-size:22px; line-height:36px;
  328. div{
  329. padding: 10px 20px;
  330. box-sizing: border-box;
  331. background: rgba(20, 121, 253, 0.1);
  332. color: #4099ef;
  333. border-radius: 10px;
  334. }
  335. }
  336. // table {
  337. // border-top: 1px solid #ccc;
  338. // border-left: 1px solid #ccc;
  339. // border-collapse: collapse;
  340. // th,
  341. // td {
  342. // border-right: 1px solid #ccc;
  343. // border-bottom: 1px solid #ccc;
  344. // padding: 0.1rem 0.2rem;
  345. // box-sizing: border-box;
  346. // }
  347. // }
  348. #resetcss {
  349. pre {
  350. white-space: pre-wrap;
  351. }
  352. .report-drag-item-wrap{
  353. padding: 6px;
  354. margin-bottom: 3px;
  355. }
  356. }
  357. // #element .element .element-content .main-container .content tbody td {
  358. // padding: 0.01rem 0;
  359. // word-break: break-all;
  360. // }
  361. #tipsAlert {
  362. width: 100%;
  363. height: 100%;
  364. padding: 15% 1rem;
  365. box-sizing: border-box;
  366. position: fixed;
  367. top: -120rem;
  368. left: 0;
  369. background: rgba(0, 0, 0, 0.6);
  370. z-index: 200;
  371. display: none;
  372. .disclaimer {
  373. font-size: 0.58rem;
  374. }
  375. }
  376. }
  377. @media screen and (max-width:800px){
  378. #reportdtl{
  379. position: absolute;
  380. transform-origin: 0 0;
  381. }
  382. }
  383. </style>