notice-detail.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>消息列表-消息中心-创业帮</title>
  6. <meta name="keywords" content="消息列表-消息中心-创业帮">
  7. <meta name="description" content="消息列表-消息中心-创业帮">
  8. <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  11. <meta content="telephone=no" name="format-detection">
  12. <meta content="email=no" name="format-detection">
  13. <meta name="apple-mobile-web-app-title" content="消息列表-消息中心-创业帮">
  14. <link rel="stylesheet" href="./static/css/main.css">
  15. <style>
  16. img{width:100%;}
  17. div{line-height:1.5}
  18. </style>
  19. </head>
  20. <body class="back-color pb0 pt0">
  21. <div id="app" v-cloak>
  22. <van-nav-bar class="user_rank_explan_title user_title_normal bottom_line" :title="noticetitle" v-if="toptitleisshow" @click-left="goback" left-arrow>
  23. <template #left> <img src="./static/images/left.png" alt=""></template>
  24. </van-nav-bar>
  25. <div class="pl16 pr16 top_line" v-html="noticedetail.Content" @click="isOK &amp;&amp; clickimg(0)" @touchstart="gtouchstart" @touchend="gtouchend" @touchmove="gtouchmove"></div>
  26. </div>
  27. <script src="./static/js/klm-vv.min.js"></script>
  28. <script src="./static/js/appfunc.min.js"></script>
  29. <script src="./static/js/klm-axios-config.js"></script>
  30. <script src="./static/js/publicfn.js"></script>
  31. <script>
  32. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  33. // 可以通过下面的方式手动注册
  34. Vue.use(vant.Lazyload);
  35. // 在 #app 标签下渲染一个按钮组件
  36. let app = new Vue({
  37. el: '#app',
  38. data() {
  39. return {
  40. toptitleisshow,
  41. noticetitle:'',
  42. noticedetail:'',
  43. imgsrc:'',
  44. imgelement:[],
  45. isOK:true,
  46. };
  47. },
  48. created() {
  49. this.getnoticelist();
  50. //- this.readflag();
  51. },
  52. methods: {
  53. async getnoticelist(){
  54. const that = this;
  55. //- PublicLib.ShowLoading({Message:''});
  56. const Id = PublicLib.getCookieInfo('noticeArticleDetail');
  57. let requestUrl = '';
  58. if(PublicLib.getCookieInfo('noticeType') === '个人消息'){
  59. requestUrl = 'api/v1/msgpersonal/detail?t='+Math.random(6);
  60. }else{
  61. requestUrl = 'api/v1/msgplacard/detail?t='+Math.random(6);
  62. };
  63. const res = await getRequest(requestUrl,JSON.stringify({Id}));
  64. if(res.status !== '1') return;
  65. //- PublicLib.HideLoading();
  66. this.noticedetail = res.data;
  67. PublicLib.SetTitle({Title:res.data.Title});
  68. var imgReg = /(\/|http)[^>]+\.(jpg|jpeg|png|gif)/g;
  69. that.imgsrc=res.data.Content.match(imgReg);
  70. setTimeout(()=>{
  71. const imgel = document.querySelectorAll('.service-detail p');
  72. imgel.forEach((item,index)=>{
  73. if(item.children.length === 1 && item.children[0].nodeName === 'IMG'){
  74. that.imgelement.push(item)
  75. };
  76. });
  77. that.imgelement.forEach((item,i)=>{
  78. that.isOK = false;
  79. item.addEventListener('click',function(){
  80. that.clickimg(i);
  81. });
  82. })
  83. },500);
  84. },
  85. gtouchstart(){
  86. const that = this;
  87. this.timeOutEvent = setTimeout(()=>{
  88. that.longPress()
  89. },500);
  90. },
  91. gtouchend(){
  92. clearTimeout(this.timeOutEvent);
  93. },
  94. gtouchmove(){
  95. clearTimeout(this.timeOutEvent);
  96. this.timeOutEvent = 0;
  97. },
  98. longPress(){
  99. this.timeOutEvent = 0;
  100. PublicLib.SaveToSd({PicPath:this.imgsrc[0]});
  101. // 下载分享图片
  102. },
  103. readflag(){
  104. const Id = PublicLib.getCookieInfo('noticeArticleDetail');
  105. let requestUrl = '';
  106. if(PublicLib.getCookieInfo('noticeType') === '个人消息'){
  107. requestUrl = 'api/v1/msgpersonal/read?t='+Math.random(6);
  108. }else{
  109. requestUrl = 'api/v1/msgplacard/read?t='+Math.random(6);
  110. };
  111. const UserId = PublicLib.getCookieInfo('userId');
  112. postRequest(requestUrl,JSON.stringify({Id,UserId}));
  113. },
  114. goback(){
  115. PublicLib.GoBack({Level:1});
  116. },
  117. clickimg(index = 0){
  118. if(typeof(index) == 'number'){
  119. PublicLib.PhotoBrowser(index,this.imgsrc);
  120. };
  121. }
  122. }
  123. });
  124. </script>
  125. </body>
  126. </html>