XiangQing.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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 class="box-guanzhu3" v-if="loginShow">
  134. <view class="guanzhu-1" @click="loginPopUp()">点击登录,获取更多资讯</view>
  135. </view>
  136. </view>
  137. </template>
  138. <script>
  139. let that = this;
  140. export default {
  141. data() {
  142. return {
  143. list: [],
  144. association: [],
  145. showadmin: false,
  146. id:0,
  147. loginShow:false,
  148. imageList: ['https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/sh_lb1.jpg']
  149. };
  150. },
  151. onLoad(e) {
  152. that = this;
  153. this.id =e.id;
  154. // this.getContentDetail(e.id);
  155. },
  156. onShow() {
  157. this.user = this.$common.userInfo();
  158. if (this.user === 'undefined' || this.user === '' || this.user === [] || this.user === null || this.user === false) {
  159. /* 跳转到登录页 */
  160. this.loginShow=true;
  161. // this.$common.toLogin();
  162. } else {
  163. // console.log(this.user);
  164. // 如果登录自动打卡
  165. this.loginShow=false;
  166. this.getContentDetail(that.id);
  167. }
  168. },
  169. computed: {
  170. citySection() {
  171. let cityPart;
  172. if (this.list.address) {
  173. const index = this.list.address.indexOf('市');
  174. if (index !== -1) {
  175. // 如果找到了"市",取市后面七个字
  176. cityPart = this.list.address.substring(index + 1, index + 8);
  177. } else {
  178. // 如果没有找到"市",返回整个地址
  179. cityPart = this.list.region_text;
  180. }
  181. } else {
  182. // 如果list.address不存在或为空,也可以设定一个默认值
  183. cityPart = this.list.region_text;
  184. }
  185. return cityPart;
  186. }
  187. },
  188. methods: {
  189. // 详情
  190. getContentDetail(id) {
  191. this.$api.getContentDetail(
  192. {
  193. main_body_id: 1,
  194. id: id
  195. },
  196. function (res) {
  197. // console.log(res, 666666666);
  198. that.list = res.data;
  199. let aa = Object.values(res.data.association_me_list);
  200. that.association = aa.filter((item) => item.title !== '文保牌' && item.main_body_column_name !== '我和文物的故事');
  201. if (res.data.images.length > 0) {
  202. that.imageList = res.data.images;
  203. }
  204. let auth = that.$common.userInfo();
  205. //获取用户权限
  206. if (!(auth === 'undefined' || auth === '' || auth === [] || auth === null || auth === false) && auth.token !== 'undefined') {
  207. that.$api.userManageCrAuth(
  208. {
  209. main_body_id: 1,
  210. cr_code: res.data.code
  211. },
  212. function (res) {
  213. console.log(res);
  214. if (res.data === true) {
  215. that.showadmin = true;
  216. }
  217. }
  218. );
  219. }
  220. }
  221. );
  222. },
  223. loginPopUp(){
  224. this.$common.toLogin();
  225. },
  226. // 图片预览
  227. clickImg(index) {
  228. // console.log(index, 555);
  229. var imgs = this.imageList;
  230. let temp = [imgs[index]];
  231. // console.log('temp', temp);
  232. uni.previewImage({
  233. urls: imgs,
  234. current: index,
  235. success: function (data) {
  236. console.log(data);
  237. },
  238. fail: function (err) {
  239. console.log(err.errMsg);
  240. }
  241. });
  242. },
  243. // 唤起地图
  244. openGuide(name, address, latitude, longitude) {
  245. // 微信小程序
  246. // #ifdef MP-WEIXIN
  247. //console.log('走的这里', item);
  248. wx.openLocation({
  249. latitude: +latitude, // 纬度
  250. longitude: +longitude, // 经度
  251. name: name, // 地址名称
  252. address: address, // 详细地址
  253. success: function (r) {
  254. console.log(r);
  255. },
  256. fail: function (res) {
  257. console.log('拉起失败啦', res);
  258. }
  259. });
  260. // #endif
  261. }
  262. }
  263. };
  264. </script>
  265. <style>
  266. /deep/.u-swiper-indicator__wrapper__dot--active {
  267. width: 5px !important;
  268. }
  269. .box {
  270. min-height: 100%;
  271. height: auto;
  272. width: 100%;
  273. padding-bottom: 50rpx;
  274. background-image: url('https://huli-app.wenlvti.net/app_static/wuyuan/static/shouhu/wyj-feiyi3-001.png');
  275. background-repeat: repeat-y;
  276. background-attachment: fixed;
  277. background-size: 100% 100%;
  278. }
  279. .title {
  280. font-size: 28rpx;
  281. font-weight: 400;
  282. color: #444444;
  283. line-height: 44rpx;
  284. }
  285. .u-info {
  286. font-size: 28rpx;
  287. color: #444444;
  288. line-height: 44rpx;
  289. margin: 20rpx;
  290. text-align: center;
  291. }
  292. .text {
  293. margin: 20rpx;
  294. }
  295. .info {
  296. display: flex;
  297. justify-content: space-between;
  298. flex-wrap: wrap;
  299. margin: 20rpx;
  300. margin-top: 16rpx;
  301. }
  302. .info_item {
  303. }
  304. .info > view {
  305. margin-top: 20rpx;
  306. font-size: 30rpx;
  307. margin-left: 8rpx;
  308. color: #940000;
  309. /* font-weight: 900; */
  310. }
  311. .item_tit {
  312. font-size: 32rpx;
  313. color: #940000;
  314. line-height: 48rpx;
  315. font-weight: 700;
  316. }
  317. .jj_btm {
  318. width: 92%;
  319. margin: auto;
  320. display: flex;
  321. margin-top: 20rpx;
  322. flex-wrap: wrap;
  323. justify-content: space-between;
  324. }
  325. .mn_box {
  326. width: 300rpx;
  327. height: 200rpx;
  328. }
  329. .mn_text {
  330. width: 298rpx;
  331. font-size: 28rpx;
  332. text-align: center;
  333. color: #ffffff;
  334. position: absolute;
  335. top: 160rpx;
  336. left: 2rpx;
  337. line-height: 40rpx;
  338. background: rgba(0, 0, 0, 0.3);
  339. border-radius: 0px 0rpx 10rpx 10rpx;
  340. }
  341. .container {
  342. position: relative;
  343. margin-top: 20rpx;
  344. /* width: 260rpx;
  345. height: 182rpx; */
  346. }
  347. .box-guanzhu3{
  348. background-image: linear-gradient(160deg, rgba(162, 255, 146, 1.0) 0, rgba(84, 218, 255, 1.0) 100%);
  349. border-radius: 52rpx;
  350. height: 55rpx;
  351. display: flex;
  352. flex-direction: row;
  353. justify-self: center;
  354. width: 80%;
  355. position: fixed;
  356. bottom: 95rpx;
  357. right: 66rpx;
  358. z-index: 992;
  359. }
  360. .guanzhu-1{
  361. flex-grow: 5;
  362. text-align: center;
  363. margin-top: 10rpx;
  364. }
  365. </style>