XiangQing.vue 9.0 KB

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