dbcltips.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view class="zcbox">
  3. <view class="flex1 zctop">
  4. <view class="tit">皖源融资担保有限公司担保材料清单</view>
  5. <rich-text :nodes="content"></rich-text>
  6. </view>
  7. <!-- <view class="flex0 zcfbtns">
  8. <view class="rzbtn" @click="getDownFn">一键下载模板</view>
  9. </view> -->
  10. </view>
  11. </template>
  12. <script>
  13. import {getDocumentList} from "@/api/mine/work.js"
  14. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  15. import config from '@/config'
  16. const baseUrlimg=config.baseUrl
  17. export default{
  18. components:{},
  19. data(){
  20. return{
  21. content:"",
  22. }
  23. },
  24. onLoad() {
  25. this.getDocumentList()
  26. },
  27. methods:{
  28. checkPermi, checkRole,
  29. getDownFn(){
  30. },
  31. getDocumentList(){
  32. var params={
  33. explainType:1
  34. }
  35. getDocumentList(params).then(res=>{
  36. if(res.code==200){
  37. var list=res.rows;
  38. if(list&&list.length){
  39. var content=list[0].explainContent;
  40. // this.content=content;
  41. this.content=this.formatRichText(content);
  42. }
  43. }
  44. })
  45. },
  46. //解析富文本方法
  47. formatRichText(html) {
  48. let newContent = html.replace(/<img[^>]*>/gi, function(match, capture) {
  49. match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '').replace(/style=""/gi, '');
  50. match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
  51. match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
  52. return match;
  53. });
  54. newContent = newContent.replace(/style="[^"]+"/gi, function(match, capture) {
  55. match = match.replace(/width:[^;]+;/gi, 'max-width:100%;').replace(/width:[^;]+;/gi, 'max-width:100%;');
  56. return match;
  57. });
  58. newContent = newContent.replace(/<br[^>]*\/>/gi, '');
  59. newContent = newContent.replace(/\<img src="/gi,
  60. '<img style="max-width:100%;height:auto;display:block;margin:10rpx auto;" src="' +baseUrlimg);
  61. return newContent;
  62. },
  63. }
  64. }
  65. </script>
  66. <style>
  67. page{background:#ffffff;}
  68. </style>
  69. <style lang="scss" scoped>
  70. .zcbox{
  71. display: flex;flex-direction: column;height: 100vh;
  72. .zctop{
  73. overflow: auto;padding: 52rpx 36rpx 0;
  74. .tit{
  75. font-size: 30rpx;color: #222327;font-weight: bold;text-align: center;margin-bottom: 24rpx;
  76. }
  77. }
  78. .zcfbtns{padding:40rpx 36rpx 60rpx;}
  79. }
  80. </style>