news.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="content">
  3. <view class="title">{{title}}</view>
  4. <view v-if="content" class="inner">
  5. <mp-html :content="content" />
  6. </view>
  7. <view class="box" v-if="file.length != 0">
  8. <view class="box_title">附件</view>
  9. <view class="file">
  10. <view class="item" v-for="(item,index) in file" :key="index" @click="yulan(item.type,item.path)">
  11. <view class="icon" v-if="item.type == 'png' || item.type == 'jpg'">
  12. <svg t="1630550850655" class="icon" viewBox="0 0 1024 1024" version="1.1"
  13. xmlns="http://www.w3.org/2000/svg" p-id="3070" width="32" height="32">
  14. <path
  15. d="M651.065224 0.108424H147.708988C113.579671 0.108424 87.985694 25.708424 87.985694 59.831718v904.336564c0 34.129318 25.6 59.723294 59.723294 59.723294h725.172706c34.129318 0 59.723294-25.6 59.723294-59.723294V281.648188L651.065224 0.108424z"
  16. fill="#77D0FF" p-id="3071"></path>
  17. <path
  18. d="M222.418824 489.712941h89.148235c52.001129 0 78.004706 21.985882 78.004706 65.957647 0 44.375341-26.202353 66.56-78.607059 66.56h-53.308235V704.752941h-35.237647V489.712941z m35.237647 30.117647v72.282353h51.2c15.4624 0 26.907106-2.812988 34.334117-8.432941 7.228235-5.824753 10.842353-15.161224 10.842353-28.009412 0-12.649412-3.716518-21.787106-11.143529-27.407059-7.029459-5.619953-18.371765-8.432941-34.032941-8.432941h-51.2z m162.032941-30.117647h35.237647l106.315294 155.105883h1.204706V489.712941h35.538823V704.752941h-34.334117l-107.52-157.214117h-1.204706V704.752941h-35.237647V489.712941z m313.825882-4.21647c27.708235 0 49.495341 6.125929 65.355294 18.371764 15.4624 12.047059 25.100047 30.015247 28.912941 53.910589h-35.538823c-3.011765-13.655341-9.438871-23.991718-19.275294-31.021177-9.836424-6.824659-22.991812-10.24-39.454118-10.24-20.281224 0-36.243576 6.824659-47.887059 20.48-12.848188 14.257694-19.275294 34.635294-19.275294 61.138824 0 25.298824 5.722353 44.772894 17.167059 58.428235 12.450635 14.456471 31.725929 21.684706 57.825882 21.684706 10.24 0 19.877647-1.204706 28.912942-3.614118a94.0032 94.0032 0 0 0 23.190588-9.938823V620.423529h-56.922353v-30.117647h92.16v90.955294c-11.041129 8.836518-24.094118 15.661176-39.152941 20.48-15.661176 4.818824-33.027012 7.228235-52.10353 7.228236-34.135341 0-60.735247-10.842353-79.811764-32.527059-17.667012-20.076424-26.503529-46.1824-26.50353-78.305882 0-32.328282 8.836518-58.831812 26.50353-79.510589 18.474165-22.088282 43.772988-33.129412 75.89647-33.129411z"
  19. fill="#FFFFFF" p-id="3072"></path>
  20. <path
  21. d="M651.065224 221.930918c0 34.123294 25.6 59.717271 59.723294 59.71727h221.81647L651.065224 0.108424v221.822494z"
  22. fill="#A3DEFD" p-id="3073"></path>
  23. </svg>
  24. </view>
  25. <view class="icon" v-else>
  26. <svg t="1630550379380" class="icon" viewBox="0 0 1024 1024" version="1.1"
  27. xmlns="http://www.w3.org/2000/svg" p-id="2191" data-spm-anchor-id="a313x.7781069.0.i1"
  28. width="32" height="32">
  29. <path
  30. d="M901.983331 984.172968c9.771228-9.771228 14.594999-21.892499 14.595-34.01377V301.671216L641.004952 26.097838H154.669888c-12.121271 0-25.108346 4.823771-34.01377 14.594999-7.668559 8.65805-13.110762 19.047711-14.347627 29.684745v884.729073c1.113178 10.637033 5.813262 21.397753 14.347627 29.313686 9.771228 9.771228 21.892499 14.594999 34.01377 14.594999h713.299674c12.121271-0.247373 24.98466-5.071144 34.013769-14.842372z m-259.617828-217.688127h-63.203768l-70.748642-273.718082h-1.978983l-71.243386 273.718082h-63.698515l-104.515038-363.885493h67.285421l68.398599 276.686556h1.978983l71.861819-276.686556H537.974151l71.86182 276.686556h1.978982l68.274913-276.686556h67.285421l-105.009784 363.885493z m0 0"
  31. fill="#6CCBFF" p-id="2192" data-spm-anchor-id="a313x.7781069.0.i0" class=""></path>
  32. <path
  33. d="M916.578331 301.671216H689.613721c-12.121271 0-25.108346-4.823771-34.013769-14.594999-9.771228-8.905423-14.594999-21.892499-14.595-34.01377V26.097838l275.573379 275.573378z m0 0"
  34. fill="#C4EAFF" p-id="2193"></path>
  35. </svg>
  36. </view>
  37. <view class="name">{{item.old_name}}</view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import {
  45. set_base_url
  46. } from '@/common/set_base_url.js'
  47. export default {
  48. data() {
  49. return {
  50. mine_code: "",
  51. title: "",
  52. content: "",
  53. file: [],
  54. base_url: ""
  55. };
  56. },
  57. onLoad(option) {
  58. this.mine_code = option.mine_code
  59. // 根据矿编码切换首页接口不同的请求基础路径
  60. this.base_url = set_base_url(this.mine_code)
  61. this.get_detail(option.id)
  62. },
  63. methods: {
  64. // 文章详情
  65. get_detail(id) {
  66. uni.request({
  67. method: "GET",
  68. header: {
  69. Authorization: this.token
  70. },
  71. url: this.base_url + "/article/detail",
  72. data: {
  73. id: id,
  74. },
  75. success: (res) => {
  76. // console.log(res)
  77. // console.log(res.data.data.content)
  78. this.content = res.data.data.content
  79. this.file = res.data.data.files
  80. uni.setNavigationBarTitle({
  81. title: res.data.data.sort_info.title
  82. })
  83. this.title = res.data.data.title
  84. }
  85. })
  86. },
  87. yulan(type, path) {
  88. let urls = []
  89. urls.push(path)
  90. if (type == 'png' || type == 'jpg') {
  91. uni.previewImage({
  92. urls: urls,
  93. });
  94. } else {
  95. uni.navigateTo({
  96. url: "../open-file/open-file?href=" + path,
  97. })
  98. }
  99. }
  100. }
  101. }
  102. </script>
  103. <style lang="scss">
  104. .title {
  105. margin: 0 auto;
  106. font-size: 48rpx;
  107. line-height: 90rpx;
  108. font-weight: 500;
  109. width: 700rpx;
  110. text-align: center;
  111. }
  112. .content {
  113. .inner {
  114. margin-bottom: 50rpx;
  115. box-sizing: border-box;
  116. padding: 25rpx;
  117. p {
  118. text-indent: 2rem !important;
  119. }
  120. }
  121. }
  122. .box {
  123. border: 1rpx solid #f0f0f0;
  124. margin: 0 auto;
  125. width: 700rpx;
  126. min-height: 200rpx;
  127. position: relative;
  128. .box_title {
  129. position: absolute;
  130. top: -20rpx;
  131. left: 20rpx;
  132. background-color: #fff;
  133. padding: 0 20rpx;
  134. font-size: 28rpx;
  135. color: #666;
  136. }
  137. .file {
  138. padding: 40rpx 10rpx 0rpx 10rpx;
  139. overflow: hidden;
  140. .item {
  141. float: left;
  142. text-align: center;
  143. width: 220rpx;
  144. height: 120rpx;
  145. margin-bottom: 20rpx;
  146. .icon {}
  147. .name {
  148. font-size: 26rpx;
  149. overflow: hidden;
  150. text-overflow: ellipsis;
  151. display: -webkit-box;
  152. -webkit-line-clamp: 1;
  153. -webkit-box-orient: vertical;
  154. }
  155. }
  156. }
  157. }
  158. </style>