JZ_xiangQing.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <view class="box">
  3. <view class="top_bg">
  4. <topBox></topBox>
  5. <view @click="backBtn" class="back">⬅返回上一级</view>
  6. </view>
  7. <view class="box_left">
  8. <image style="width: 100%; height: 100%" :src="list.image"></image>
  9. </view>
  10. <view class="box_right">
  11. <view class="banner">
  12. <view class="right_tit">
  13. <view class="">
  14. {{ list.title }}
  15. </view>
  16. <view class="info">
  17. <view style="width: 50%">始建年代:{{ list.age }}</view>
  18. <view style="width: 50%">文物类型:{{ list.cr_type }}</view>
  19. <view style="width: 50%">文物等级:{{ list.level }}</view>
  20. <view style="width: 50%">所属区域:{{ list.region }}</view>
  21. </view>
  22. </view>
  23. <view class="" style="font-size: 10px; color: #aa734d">文物介绍:</view>
  24. <view class="right_txt">
  25. <view class="jieshao">
  26. {{ list.intro ? list.intro : '暂无介绍' | removeHTMLTag }}
  27. </view>
  28. </view>
  29. <view class="" style="font-size: 10px; color: #aa734d">文物价值:</view>
  30. <view class="" style="width: 105%; height: 30%; overflow: hidden">
  31. <view v-if="list.value" class="jieshao" style="width: 95%; height: 30%">
  32. {{ list.value | removeHTMLTag }}
  33. </view>
  34. <view v-else class="" style="font-size: 12px; color: rgba(170, 115, 77, 0.5)">暂无评估</view>
  35. </view>
  36. <view class="btm_box">
  37. <scroll-view v-if="list.images" scroll-x="true" style="width: 100%; height: 100%; display: flex; white-space: nowrap">
  38. <view class="container" @click="clickImg(index)" v-for="(item, index) in list.images" :key="item.index">
  39. <view class="mn_box">
  40. <image style="width: 100%; height: 100%" :src="item"></image>
  41. </view>
  42. </view>
  43. </scroll-view>
  44. <view v-else class="mn_box2">
  45. <image @click="clickImg" style="width: 100%; height: 100%" :src="list.image"></image>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. let that;
  54. export default {
  55. data() {
  56. return {
  57. list: []
  58. };
  59. },
  60. onLoad(o) {
  61. that = this;
  62. this.getContentDetails(o.id);
  63. },
  64. filters: {
  65. removeHTMLTag(str) {
  66. str = str.replace(/<\/?[^>]*>/g, ''); // 去除HTML tag
  67. str = str.replace(/[ | ]*\n/g, '\n'); // 去除行尾空白
  68. str = str.replace(/\n[\s| | ]*\r/g, '\n'); //去除多余空行
  69. str = str.replace(/ /gi, ''); // 去掉
  70. const arrEntities = {
  71. lt: '<',
  72. gt: '>',
  73. nbsp: ' ',
  74. amp: '&',
  75. quot: '"'
  76. }; // 转义符换成普通字符
  77. str = str.replace(/&(lt|gt|nbsp|amp|quot);/gi, function (all, t) {
  78. return arrEntities[t];
  79. });
  80. return str;
  81. }
  82. },
  83. methods: {
  84. // 详情
  85. getContentDetails(id) {
  86. this.$api.getContentDetails(
  87. {
  88. main_body_id: 1,
  89. id: id
  90. },
  91. function (res) {
  92. that.list = res.data;
  93. }
  94. );
  95. },
  96. clickImg(i) {
  97. let img = [];
  98. img.push(this.list.image);
  99. uni.previewImage({
  100. urls: this.list.images ? this.list.images : img, //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
  101. current: this.list.images[i] // 当前显示图片的http链接,默认是第一个
  102. });
  103. },
  104. backBtn() {
  105. uni.navigateBack({
  106. delta: 1
  107. });
  108. }
  109. }
  110. };
  111. </script>
  112. <style>
  113. .box {
  114. display: flex;
  115. width: 100%;
  116. height: 100vh;
  117. box-sizing: border-box;
  118. }
  119. /deep/.MsoNormal span {
  120. font-size: 12px !important;
  121. letter-spacing: 0.2em !important;
  122. font-weight: 400 !important;
  123. color: #aa734d !important;
  124. /* line-height: 70rpx !important; */
  125. }
  126. /deep/.MsoNormal {
  127. font-size: 12px !important;
  128. letter-spacing: 0.2em !important;
  129. font-weight: 400 !important;
  130. color: #aa734d !important;
  131. /* line-height: 70rpx !important; */
  132. }
  133. /deep/._undefined span {
  134. font-size: 12px !important;
  135. letter-spacing: 0.2em !important;
  136. font-weight: 400 !important;
  137. color: #aa734d !important;
  138. /* line-height: 70rpx !important; */
  139. }
  140. .back {
  141. width: 12%;
  142. height: 20%;
  143. margin-left: 5%;
  144. margin-top: -4%;
  145. font-size: 12px;
  146. }
  147. .info {
  148. width: 125%;
  149. font-size: 10px;
  150. display: flex;
  151. flex-wrap: wrap;
  152. justify-content: space-between;
  153. }
  154. .img {
  155. width: 100%;
  156. height: 100%;
  157. }
  158. .box_left {
  159. width: 40%;
  160. height: 100%;
  161. /* background: url('https://huli-app.wenlvti.net/app_static/minnanhun/image/jz_img.png') no-repeat center;
  162. background-size: 100% 100%; */
  163. }
  164. .box_right {
  165. flex: 1;
  166. height: 100%;
  167. margin-left: -10%;
  168. z-index: 1;
  169. background: linear-gradient(90deg, rgba(240, 235, 222, 0.1) 0%, #f0ebde 15%, #f0ebde 100%);
  170. }
  171. .top_bg {
  172. height: 16%;
  173. width: 100%;
  174. position: absolute;
  175. color: #ffffff;
  176. z-index: 2;
  177. background: linear-gradient(10deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.2) 100%);
  178. }
  179. .right_tit {
  180. width: 80%;
  181. letter-spacing: 0.3em;
  182. font-size: 14px;
  183. color: #aa734d;
  184. }
  185. .banner {
  186. width: 70%;
  187. height: 72%;
  188. margin-left: 25%;
  189. margin-top: 13%;
  190. }
  191. .right_txt {
  192. width: 100%;
  193. height: 30%;
  194. font-weight: 400;
  195. box-sizing: border-box;
  196. margin: 0 0 2% 0;
  197. overflow: hidden;
  198. }
  199. @keyframes wordsLoop {
  200. 0% {
  201. transform: translateY(0);
  202. -webkit-transform: translateY(0);
  203. }
  204. 100% {
  205. transform: translateY(-100%);
  206. -webkit-transform: translateY(-100%);
  207. }
  208. }
  209. @-webkit-keyframes wordsLoop {
  210. 0% {
  211. transform: translateY(0);
  212. -webkit-transform: translateY(0);
  213. }
  214. 100% {
  215. transform: translateY(-100%);
  216. -webkit-transform: translateY(-100%);
  217. }
  218. }
  219. .jieshao {
  220. font-size: 12px;
  221. line-height: 20px;
  222. color: rgba(170, 115, 77, 0.5);
  223. animation: 40s wordsLoop linear infinite normal;
  224. }
  225. .btm_box {
  226. width: 100%;
  227. height: 30%;
  228. }
  229. .container {
  230. width: 18%;
  231. height: 100%;
  232. position: relative;
  233. display: inline-block;
  234. margin-right: 2%;
  235. text-align: center;
  236. /* margin-top: 5%; */
  237. }
  238. .mn_box {
  239. width: 100%;
  240. height: 100%;
  241. margin-left: 2%;
  242. box-sizing: border-box;
  243. border: 2px solid #fed57d;
  244. }
  245. .mn_box2 {
  246. width: 20%;
  247. height: 100%;
  248. margin-left: 2%;
  249. box-sizing: border-box;
  250. border: 2px solid #fed57d;
  251. }
  252. </style>