XiangQing.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <template>
  2. <view class="box">
  3. <u-navbar :autoBack="true" bgColor="rgba(255,255,255,0)"></u-navbar>
  4. <view>
  5. <u-swiper
  6. @click="clickImg"
  7. :list="imageList"
  8. imgMode="aspectFill"
  9. :height="200"
  10. :indicator="true"
  11. :autoplay="true"
  12. :circular="true"
  13. indicatorStyle="bottom: 25px"
  14. indicatorMode="dot"
  15. indicatorActiveColor="#fff"
  16. indicatorInactiveColor="rgba(255, 255, 255, 0.35)"
  17. ></u-swiper>
  18. </view>
  19. <view class="box">
  20. <view class="" style="display: flex; align-items: center; margin-left: 28rpx; margin-top: 30rpx">
  21. <view style="color: #640000; margin-right: 20rpx; font-weight: 700; font-size: 36rpx">{{ list.title }}</view>
  22. </view>
  23. <view class="info">
  24. <view style="width: 40%">始建年代: {{ list.age ? list.age : '暂无描述' }}</view>
  25. <view style="width: 40%">文物类型:{{ list.cr_type_text ? list.cr_type_text : '暂无描述' }}</view>
  26. <view style="width: 40%">文物等级:{{ list.level_text }}</view>
  27. <view style="width: 40%">所属区域:{{ citySection }}</view>
  28. </view>
  29. <view style="margin-left: 24rpx; display: flex; align-items: center; margin-top: 40rpx">
  30. <view style="display: flex; align-items: center">
  31. <uni-icons type="location" size="22" color="#940000"></uni-icons>
  32. <!-- <image style="width: 40rpx; height: 40rpx" src="/static/img/map-pin-5-line.png"></image> -->
  33. <view class="item_tit">地点</view>
  34. </view>
  35. </view>
  36. <view class="" @tap="openGuide(list.title, list.address, list.latitude, list.longitude)">
  37. <view
  38. class=""
  39. style="
  40. width: 95%;
  41. margin: auto;
  42. display: flex;
  43. justify-content: space-between;
  44. align-items: center;
  45. height: 80rpx;
  46. margin-top: 15rpx;
  47. color: green;
  48. background-color: #ffffff;
  49. "
  50. >
  51. <view class="text flex" style="background-color: aliceblue">
  52. {{ list.address }}
  53. <uni-icons type="location" size="20"></uni-icons>
  54. </view>
  55. </view>
  56. </view>
  57. <view v-if="list.protected_area != null" style="margin-left: 24rpx; display: flex; align-items: center; margin-top: 40rpx">
  58. <view style="display: flex; align-items: center">
  59. <uni-icons type="map-pin-ellipse" size="22" color="#940000"></uni-icons>
  60. <view class="item_tit">保护区域</view>
  61. </view>
  62. </view>
  63. <view class="u-info">
  64. <u-parse :content="list.protected_area"></u-parse>
  65. </view>
  66. <view v-if="list.intro" style="margin-left: 24rpx; display: flex; align-items: center; margin-top: 40rpx">
  67. <view style="display: flex; align-items: center">
  68. <uni-icons type="calendar" size="22" color="#940000"></uni-icons>
  69. <view class="item_tit">介绍</view>
  70. </view>
  71. </view>
  72. <view class="text">
  73. <u-parse :content="list.intro"></u-parse>
  74. </view>
  75. <view v-if="list.environment != null" style="margin-left: 24rpx; display: flex; align-items: center; margin-top: 40rpx">
  76. <view style="display: flex; align-items: center">
  77. <uni-icons type="home" size="22" color="#940000"></uni-icons>
  78. <view class="item_tit">建筑环境</view>
  79. </view>
  80. </view>
  81. <view class="text">
  82. <u-parse :content="list.environment"></u-parse>
  83. </view>
  84. <view class="" v-if="list.value">
  85. <view style="margin-left: 24rpx; display: flex; align-items: center; margin-top: 40rpx">
  86. <view style="display: flex; align-items: center">
  87. <uni-icons type="medal" size="22" color="#940000"></uni-icons>
  88. <view class="item_tit">文物价值</view>
  89. </view>
  90. </view>
  91. <view class="text">
  92. <u-parse :content="list.value"></u-parse>
  93. </view>
  94. </view>
  95. <view class="" v-if="list.director">
  96. <view style="margin-left: 24rpx; display: flex; align-items: center; margin-top: 40rpx">
  97. <view style="display: flex; align-items: center">
  98. <uni-icons type="auth" size="22" color="#940000"></uni-icons>
  99. <view class="item_tit">文物负责人</view>
  100. </view>
  101. </view>
  102. <view class="text">
  103. <u-parse :content="list.director"></u-parse>
  104. </view>
  105. </view>
  106. </view>
  107. <!-- 构件 -->
  108. <view class="" v-if="association.length > 0">
  109. <view style="margin-left: 24rpx; display: flex; align-items: center; margin-top: 40rpx">
  110. <view style="display: flex; align-items: center">
  111. <uni-icons type="cloud-download" size="22" color="#940000"></uni-icons>
  112. <view class="item_tit">文物相关</view>
  113. </view>
  114. </view>
  115. <view class="jj_btm">
  116. <view @click="$common.navigateTo(item.page)" class="container" v-for="(item, index) in association" :key="item.index">
  117. <view class="mn_box">
  118. <image style="border-radius: 10rpx; width: 100%; height: 100%" :lazy-load="true" :src="item.image"></image>
  119. </view>
  120. <view class="mn_text">{{ item.title }}</view>
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. </template>
  126. <script>
  127. let that = this;
  128. export default {
  129. data() {
  130. return {
  131. list: [],
  132. association: [],
  133. imageList: ['https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/sh_lb1.jpg']
  134. };
  135. },
  136. onLoad(e) {
  137. that = this;
  138. this.getContentDetail(e.id);
  139. },
  140. computed: {
  141. citySection() {
  142. let cityPart;
  143. if (this.list.address) {
  144. const index = this.list.address.indexOf('市');
  145. if (index !== -1) {
  146. // 如果找到了"市",取市后面七个字
  147. cityPart = this.list.address.substring(index + 1, index + 8);
  148. } else {
  149. // 如果没有找到"市",返回整个地址
  150. cityPart = this.list.region_text;
  151. }
  152. } else {
  153. // 如果list.address不存在或为空,也可以设定一个默认值
  154. cityPart = this.list.region_text;
  155. }
  156. return cityPart;
  157. }
  158. },
  159. methods: {
  160. // 详情
  161. getContentDetail(id) {
  162. this.$api.getContentDetail(
  163. {
  164. main_body_id: 1,
  165. id: id
  166. },
  167. function (res) {
  168. // console.log(res, 666666666);
  169. that.list = res.data;
  170. let aa = Object.values(res.data.association_me_list);
  171. that.association = aa.filter((item) => item.title !== '文保牌' && item.main_body_column_name !== '我和文物的故事');
  172. if (res.data.images.length > 0) {
  173. that.imageList = res.data.images;
  174. }
  175. }
  176. );
  177. },
  178. // 图片预览
  179. clickImg(index) {
  180. // console.log(index, 555);
  181. var imgs = this.imageList;
  182. let temp = [imgs[index]];
  183. // console.log('temp', temp);
  184. uni.previewImage({
  185. urls: imgs,
  186. current: index,
  187. success: function (data) {
  188. console.log(data);
  189. },
  190. fail: function (err) {
  191. console.log(err.errMsg);
  192. }
  193. });
  194. },
  195. // 唤起地图
  196. openGuide(name, address, latitude, longitude) {
  197. // 微信小程序
  198. // #ifdef MP-WEIXIN
  199. //console.log('走的这里', item);
  200. wx.openLocation({
  201. latitude: +latitude, // 纬度
  202. longitude: +longitude, // 经度
  203. name: name, // 地址名称
  204. address: address, // 详细地址
  205. success: function (r) {
  206. console.log(r);
  207. },
  208. fail: function (res) {
  209. console.log('拉起失败啦', res);
  210. }
  211. });
  212. // #endif
  213. }
  214. }
  215. };
  216. </script>
  217. <style>
  218. /deep/.u-swiper-indicator__wrapper__dot--active {
  219. width: 5px !important;
  220. }
  221. .box {
  222. min-height: 100%;
  223. height: auto;
  224. width: 100%;
  225. padding-bottom: 50rpx;
  226. background-image: url('https://huli-app.wenlvti.net/app_static/wuyuan/static/shouhu/wyj-feiyi3-001.png');
  227. background-repeat: repeat-y;
  228. background-attachment: fixed;
  229. background-size: 100% 100%;
  230. }
  231. .title {
  232. font-size: 28rpx;
  233. font-weight: 400;
  234. color: #444444;
  235. line-height: 44rpx;
  236. }
  237. .u-info {
  238. font-size: 28rpx;
  239. color: #444444;
  240. line-height: 44rpx;
  241. margin: 20rpx;
  242. text-align: center;
  243. }
  244. .text {
  245. margin: 20rpx;
  246. }
  247. .info {
  248. display: flex;
  249. justify-content: space-between;
  250. flex-wrap: wrap;
  251. margin: 20rpx;
  252. margin-top: 16rpx;
  253. }
  254. .info_item {
  255. }
  256. .info > view {
  257. margin-top: 20rpx;
  258. font-size: 30rpx;
  259. margin-left: 8rpx;
  260. color: #940000;
  261. /* font-weight: 900; */
  262. }
  263. .item_tit {
  264. font-size: 32rpx;
  265. color: #940000;
  266. line-height: 48rpx;
  267. font-weight: 700;
  268. }
  269. .jj_btm {
  270. width: 92%;
  271. margin: auto;
  272. display: flex;
  273. margin-top: 20rpx;
  274. flex-wrap: wrap;
  275. justify-content: space-between;
  276. }
  277. .mn_box {
  278. width: 300rpx;
  279. height: 200rpx;
  280. }
  281. .mn_text {
  282. width: 298rpx;
  283. font-size: 28rpx;
  284. text-align: center;
  285. color: #ffffff;
  286. position: absolute;
  287. top: 160rpx;
  288. left: 2rpx;
  289. line-height: 40rpx;
  290. background: rgba(0, 0, 0, 0.3);
  291. border-radius: 0px 0rpx 10rpx 10rpx;
  292. }
  293. .container {
  294. position: relative;
  295. margin-top: 20rpx;
  296. /* width: 260rpx;
  297. height: 182rpx; */
  298. }
  299. </style>