news.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. 'accesskey': "b364b449a18af327867f7edc3431b541"
  71. },
  72. url: this.base_url + "/article/detail",
  73. data: {
  74. id: id,
  75. },
  76. success: (res) => {
  77. // console.log(res)
  78. // console.log(res.data.data.content)
  79. this.content = res.data.data.content
  80. this.file = res.data.data.files
  81. uni.setNavigationBarTitle({
  82. title: res.data.data.sort_info.title
  83. })
  84. this.title = res.data.data.title
  85. }
  86. })
  87. },
  88. yulan(type, path) {
  89. let urls = []
  90. urls.push(path)
  91. if (type == 'png' || type == 'jpg') {
  92. uni.previewImage({
  93. urls: urls,
  94. });
  95. } else {
  96. uni.navigateTo({
  97. url: "../open-file/open-file?href=" + path,
  98. })
  99. }
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss">
  105. .title {
  106. margin: 0 auto;
  107. font-size: 48rpx;
  108. line-height: 90rpx;
  109. font-weight: 500;
  110. width: 700rpx;
  111. text-align: center;
  112. }
  113. .content {
  114. .inner {
  115. margin-bottom: 50rpx;
  116. box-sizing: border-box;
  117. padding: 25rpx;
  118. p {
  119. text-indent: 2rem !important;
  120. }
  121. }
  122. }
  123. .box {
  124. border: 1rpx solid #f0f0f0;
  125. margin: 0 auto;
  126. width: 700rpx;
  127. min-height: 200rpx;
  128. position: relative;
  129. .box_title {
  130. position: absolute;
  131. top: -20rpx;
  132. left: 20rpx;
  133. background-color: #fff;
  134. padding: 0 20rpx;
  135. font-size: 28rpx;
  136. color: #666;
  137. }
  138. .file {
  139. padding: 40rpx 10rpx 0rpx 10rpx;
  140. overflow: hidden;
  141. .item {
  142. float: left;
  143. text-align: center;
  144. width: 220rpx;
  145. height: 120rpx;
  146. margin-bottom: 20rpx;
  147. .icon {}
  148. .name {
  149. font-size: 26rpx;
  150. overflow: hidden;
  151. text-overflow: ellipsis;
  152. display: -webkit-box;
  153. -webkit-line-clamp: 1;
  154. -webkit-box-orient: vertical;
  155. }
  156. }
  157. }
  158. }
  159. </style>