user-service-detail.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. <meta http-equiv="Cache-Control" content="no-siteapp">
  15. <link rel="stylesheet" href="./static/css/main.css">
  16. <style>
  17. .service-detail img{width:100%;max-width:100%;float:left;}
  18. .service-detail,
  19. .service-detail p,
  20. .service-detail div{overflow:hidden;}
  21. </style>
  22. </head>
  23. <body class="bgcfff pt0 pb0" style="padding-top:0;">
  24. <div id="app">
  25. <van-nav-bar class="user_rank_explan_title user_title_normal" left-arrow title="问题详情" @click-left="backpage" v-if="toptitleisshow">
  26. <template #left> <img src="./static/images/left.png" alt=""></template>
  27. </van-nav-bar>
  28. <div class="pt16 pb16 pl16 pr16 bb8f7f7f7 top_line" v-cloak>
  29. <div class="f18 c333 b">{{articleinfo.Title}}</div>
  30. </div>
  31. <div class="service-detail pl16 pr16">
  32. <div class="f14 c666" v-html="articleinfo.Content" @click="isOK &amp;&amp; clickimg(0)"></div>
  33. </div>
  34. </div>
  35. <script src="./static/js/klm-vv.min.js"></script>
  36. <script src="./static/js/appfunc.min.js"></script>
  37. <script src="./static/js/klm-axios-config.js"></script>
  38. <script src="./static/js/publicfn.js"></script>
  39. <script>
  40. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  41. // 可以通过下面的方式手动注册
  42. Vue.use(vant.Lazyload);
  43. // 在 #app 标签下渲染一个按钮组件
  44. let app = new Vue({
  45. el: '#app',
  46. data() {
  47. return {
  48. toptitleisshow,
  49. active: 0,
  50. articleinfo:{
  51. Title:'',
  52. Content:''
  53. },
  54. isShow: false,
  55. imgsrc:'',
  56. imgelement:[],
  57. isOK:true,
  58. };
  59. },
  60. created() {
  61. this.type = browsertype.versions.ios ? 'ios' : 'android';
  62. this.getarticledetail();
  63. },
  64. updated(){
  65. },
  66. methods: {
  67. //- 截取参数函数
  68. getUrlParam(name){
  69. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
  70. var r = window.location.search.substr(1).match(reg); //匹配目标参数
  71. if (r != null) return unescape(r[2]);
  72. return null; //返回参数值
  73. },
  74. async getarticledetail(){
  75. const that = this;
  76. const Id = PublicLib.getCookieInfo('articleId') ? PublicLib.getCookieInfo('articleId') : that.getUrlParam('Id');
  77. const res = await getRequest('api/v1/servicecenter/detail?t='+Math.random(6),JSON.stringify({Id}));
  78. if(res.status !== '1') return tips('获取文章详情失败,请重试!');
  79. that.articleinfo = res.data;
  80. var imgReg = /(\/|http)[^>]+\.(jpg|jpeg|png|gif)/g;
  81. that.imgsrc=res.data.Content.match(imgReg);
  82. setTimeout(()=>{
  83. const imgel = document.querySelectorAll('.service-detail p');
  84. imgel.forEach((item,index)=>{
  85. if(item.children.length === 1 && item.children[0].nodeName === 'IMG'){
  86. that.imgelement.push(item)
  87. };
  88. });
  89. that.imgelement.forEach((item,i)=>{
  90. that.isOK = false;
  91. item.addEventListener('click',function(){
  92. that.clickimg(i);
  93. });
  94. })
  95. },500);
  96. },
  97. //- 返回上一个页面
  98. backpage(){
  99. PublicLib.GoBack({Level:1});
  100. },
  101. clickimg(index = 0){
  102. if(typeof(index) == 'number'){
  103. if(!this.imgsrc){
  104. return;
  105. };
  106. PublicLib.PhotoBrowser(index,this.imgsrc);
  107. };
  108. }
  109. }
  110. });
  111. </script>
  112. </body>
  113. </html>