index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. <template>
  2. <view class="container">
  3. <view class="swiper">
  4. <view class="swiper-box">
  5. <swiper circular="true" autoplay="true" @change="swiperChange">
  6. <swiper-item v-for="swiper in banner" :key="swiper.id" @click="ToBanner(swiper)"><image :src="swiper.pic"></image></swiper-item>
  7. </swiper>
  8. <view class="indicator"><view class="dots" v-for="(swiper, index) in banner" :class="[swiperCurrent >= index ? 'on' : '']" :key="index"></view></view>
  9. </view>
  10. </view>
  11. <view class="item-box flex">
  12. <view class="item-tpl" @click="navTo('/pages/donation/index')">
  13. <image src="/static/img/img01.png"></image>
  14. <view class="tip-text">走进红十字</view>
  15. </view>
  16. <view class="item-tpl" @click="navTo('/pages/contribution/index')">
  17. <image src="/static/img/img02.png"></image>
  18. <view class="tip-text">爱心捐赠</view>
  19. </view>
  20. <view class="item-tpl" @click="navTo('/pages/train/index')">
  21. <image src="/static/img/img03.png"></image>
  22. <view class="tip-text">救护培训报名</view>
  23. </view>
  24. <view class="item-tpl" @click="navTo('/pages/volunteer/index')">
  25. <image src="/static/img/img04.png"></image>
  26. <view class="tip-text">红十字志愿者</view>
  27. </view>
  28. </view>
  29. <view class="item-box flex">
  30. <view class="item-tpl" @click="navTo('/pages/hematopoiesis/index')">
  31. <image src="/static/img/img05.png"></image>
  32. <view class="tip-text">造血干细胞入库</view>
  33. </view>
  34. <view class="item-tpl" @click="organ">
  35. <image src="/static/img/img06.png"></image>
  36. <view class="tip-text">器官捐献登记</view>
  37. </view>
  38. <view class="item-tpl">
  39. <image src=""></image>
  40. <view class="tip-text"></view>
  41. </view>
  42. <view class="item-tpl">
  43. <image src=""></image>
  44. <view class="tip-text"></view>
  45. </view>
  46. </view>
  47. <view class="list-box">
  48. <view class="top-title flex">
  49. <view class="">AED导航</view>
  50. <!-- <image @click="ToShow" v-if="showbox == true" src="../../static/img/img08.png"></image>
  51. <image @click="ToShow" v-if="showbox == false" src="../../static/img/img07.png"></image> -->
  52. </view>
  53. <view id="container">
  54. <map class="map-box" id="map"
  55. show-location
  56. :markers="marker"
  57. :scale='scale'
  58. :latitude="latitude"
  59. :longitude="longitude" ref="map">
  60. </map>
  61. </view>
  62. <view class="">
  63. <view class="list-tpl flex" v-for="(item,index) in AEDlist" @click="openAddress(item.log,item.lat,item.address)">
  64. <view class="">{{ index + 1 }}</view>
  65. <view class="info">
  66. <view class="title">AED设备</view>
  67. <view class="addr">地址:{{item.add}}</view>
  68. </view>
  69. <view class="image">
  70. <image src="/static/img/img10.png"></image>
  71. <view class="tip">导航</view>
  72. </view>
  73. </view>
  74. <!-- <view class="list-tpl flex" @click="openAddress('2')">
  75. <view class="">2</view>
  76. <view class="info">
  77. 经度longitude,纬度 latitude
  78. <view class="title">AED设备</view>
  79. <view class="addr">地址:桐乡市汽车站候车室</view>
  80. </view>
  81. <view class="image">
  82. <image src="/static/img/img10.png"></image>
  83. <view class="tip">导航</view>
  84. </view>
  85. </view> -->
  86. <!-- <view class="list-tpl flex" @click="openAddress('3')">
  87. <view class="">3</view>
  88. <view class="info">
  89. <view class="title">AED设备</view>
  90. <view class="addr">地址:桐乡市公共服务中心1号楼1楼大厅</view>
  91. </view>
  92. <view class="image">
  93. <image src="/static/img/img10.png"></image>
  94. <view class="tip">导航</view>
  95. </view>
  96. </view> -->
  97. <!-- <view class="list-tpl flex" @click="openAddress('4')">
  98. <view class="">4</view>
  99. <view class="info">
  100. <view class="title">AED设备</view>
  101. <view class="addr">地址:桐乡市凤凰湖志愿驿站内</view>
  102. </view>
  103. <view class="image">
  104. <image src="/static/img/img10.png"></image>
  105. <view class="tip">导航</view>
  106. </view>
  107. </view> -->
  108. </view>
  109. </view>
  110. <view class="list-box">
  111. <view class="top-title flex">
  112. <view class="">应急救援队导航</view>
  113. </view>
  114. <view v-for="item in emergencyList" :key="item.id">
  115. <view id="container" >
  116. <map class="map-box" id="map"
  117. show-location
  118. :markers="item.volunteer"
  119. :scale='item.scale1'
  120. :latitude="item.lat"
  121. :longitude="item.long" ref="map">
  122. </map>
  123. </view>
  124. <!-- {{item.long}}{{item.lat}}{{item.addr}} -->
  125. <view class="">
  126. <view class="list-tpl flex" @click="openAddress(item.long,item.lat,item.addr)">
  127. <view class="">1</view>
  128. <view class="info">
  129. <view class="title">{{ item.title}}</view>
  130. <view class="addr">地址:{{item.addr}}</view>
  131. <view class="">电话:{{ item.phone}}</view>
  132. </view>
  133. <view class="image">
  134. <image src="/static/img/img10.png"></image>
  135. <view class="tip">导航</view>
  136. </view>
  137. </view>
  138. </view>
  139. </view>
  140. <!-- <view>
  141. <view id="container">
  142. <map class="map-box" id="map"
  143. show-location
  144. :markers="volunteer1"
  145. :scale='scale1'
  146. :latitude="latitude1"
  147. :longitude="longitude1" ref="map">
  148. </map>
  149. </view>
  150. <view class="">
  151. <view class="list-tpl flex" @click="openAddress()">
  152. <view class="">2</view>
  153. <view class="info">
  154. <view class="title">桐乡市红十字雄鹰应急救援队</view>
  155. <view class="addr">地址:浙江省嘉兴市桐乡市崇南路</view>
  156. <view class="">电话:周海 13067691111</view>
  157. </view>
  158. <view class="image">
  159. <image src="/static/img/img10.png"></image>
  160. <view class="tip">导航</view>
  161. </view>
  162. </view>
  163. </view>
  164. </view> -->
  165. </view>
  166. <uni-popup ref="popup" type="bottom" @click="close">
  167. <view class="popup_row">
  168. <view class="rows">
  169. <view class="rows-item" @click="toGaodeMap(longitude6,latitude6,address6)">
  170. 高德地图
  171. </view>
  172. <view class="rows-item" @click="tobaiDuMap(longitude6,latitude6,address6)">
  173. 百度地图
  174. </view>
  175. <view class="rows-item" @click="totengxunMap(longitude6,latitude6,address6)">
  176. 腾讯地图
  177. </view>
  178. </view>
  179. </view>
  180. </uni-popup>
  181. </view>
  182. </template>
  183. <script>
  184. import { loadIndexs } from '@/api/index.js';
  185. import { openMap } from '@/utils/rocessor.js';
  186. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  187. export default {
  188. components: {
  189. uniPopup
  190. },
  191. data() {
  192. return {
  193. // 经度longitude,纬度 latitude
  194. longitude4: '', // 当前经纬度
  195. latitude4: '',
  196. longitude6:'',
  197. latitude6:'',
  198. address6:'',
  199. AEDlist:[
  200. { id:0, add:'桐乡市高铁候车室', log: '120.567191', lat:'30.537043',address:'浙江省嘉兴市桐乡市高桥镇高桥大道51号'},
  201. { id:1, add:'桐乡市汽车站候车室',log: '120.575595', lat:'30.611975',address:"浙江省嘉兴市桐乡市世纪大道1号"},
  202. { id:2, add:'桐乡市公共服务中心1号楼1楼大厅',log: '120.581151', lat:'30.635102',address:"浙江省嘉兴市桐乡市康民东路58号"},
  203. { id:3, add:'桐乡市凤凰湖志愿驿站内',log: '120.583390', lat:'30.640531',address:"浙江省嘉兴市桐乡市凤凰湖翰墨竞芳广场"}
  204. ],
  205. swiperCurrent: 0, //轮播图
  206. banner:[],//轮播图
  207. marker: [
  208. {
  209. latitude:"30.537043",
  210. longitude:'120.567191',
  211. iconPath:'/static/img/img014.png',
  212. width:'35',
  213. height:'35',
  214. },
  215. {
  216. latitude:'30.611975',
  217. longitude:"120.575595",
  218. iconPath:'/static/img/img014.png',
  219. width:'35',
  220. height:'35',
  221. },
  222. {
  223. latitude:'30.635102',
  224. longitude:"120.581151",
  225. iconPath:'/static/img/img014.png',
  226. width:'35',
  227. height:'35',
  228. },
  229. {
  230. latitude:'30.640531',
  231. longitude:"120.583390",
  232. iconPath:'/static/img/img014.png',
  233. height:'35',
  234. }],
  235. volunteer: [{
  236. longitude:'120.558686',
  237. latitude:"30.633273",
  238. iconPath:'/static/img/img014.png',
  239. width:'35',
  240. height:'35',
  241. }],
  242. volunteer1: [{
  243. longitude:'120.553638',
  244. latitude:"30.547011",
  245. iconPath:'../../static/img/img014.png',
  246. width:'35',
  247. height:'35',
  248. }],
  249. emergencyList:[
  250. {
  251. id:0,
  252. long:"120.558686",
  253. lat:"30.633273",
  254. scale1:'15',
  255. addr:'桐乡市梧桐街道杨家门迎风一期 23幢',
  256. phone:'张剑 13819058997',
  257. title:'桐乡市红十字应急救援志愿服务队',
  258. volunteer: [{
  259. longitude:'120.558686',
  260. latitude:"30.633273",
  261. iconPath:'/static/img/img014.png',
  262. width:'35',
  263. height:'35',
  264. }],
  265. },
  266. {
  267. id:1,
  268. long:"120.553638",
  269. lat:"30.547011",
  270. scale1:'15',
  271. addr:'浙江省嘉兴市桐乡市崇南路',
  272. phone:'周海 13067691111',
  273. title:'桐乡市红十字雄鹰应急救援队',
  274. volunteer: [{
  275. longitude:'120.553638',
  276. latitude:"30.547011",
  277. iconPath:'/static/img/img014.png',
  278. width:'35',
  279. height:'35',
  280. }],
  281. }
  282. ],
  283. longitude:'120.558686',
  284. latitude:"30.633273",
  285. longitude1:'120.553638',
  286. latitude1:"30.547011",
  287. scale:'12',//地图缩放程度
  288. scale1:'15',
  289. showbox:false,
  290. showTEXT:false
  291. };
  292. },
  293. onLoad() {
  294. let obj = this;
  295. obj.loadDate();
  296. uni.getLocation({
  297. type: 'wgs84',
  298. success: function (res) {
  299. console.log('当前位置的经度:' + res.longitude);
  300. console.log('当前位置的纬度:' + res.latitude);
  301. obj.longitude4 = res.longitude
  302. obj.latitude4 = res.latitude
  303. obj.loadDate();
  304. },
  305. fail(e) {
  306. console.log('获取当前位置失败', e);
  307. }
  308. });
  309. // let locationAddress
  310. // // #ifdef H5
  311. // let wxOjb = require('jweixin-module');
  312. // locationAddress = wxOjb.getLocation;
  313. // // #endif
  314. // // #ifdef MP
  315. // locationAddress = uni.getLocation;
  316. // // #endif
  317. // console.log(locationAddress,'获取对象数据')
  318. // // #ifdef H5
  319. // wxOjb.ready(() => {
  320. // console.log('加载完毕注册事件');
  321. // locationAddress({
  322. // type: 'wgs84',
  323. // success: function(res) {
  324. // console.log('获取经纬度', res);
  325. // obj.longitude4 = res.longitude
  326. // obj.latitude4 = res.latitude
  327. // obj.loadDate();
  328. // },
  329. // fail(e) {
  330. // console.log('失败', e);
  331. // }
  332. // });
  333. // })
  334. // // #endif
  335. // // #ifdef MP
  336. // locationAddress({
  337. // type: 'wgs84',
  338. // success: function(res) {
  339. // console.log('获取经纬度', res);
  340. // obj.longitude4 = res.longitude
  341. // obj.latitude4 = res.latitude
  342. // obj.loadDate();
  343. // },
  344. // fail(e) {
  345. // console.log('失败', e);
  346. // }
  347. // });
  348. // // #endif
  349. },
  350. methods: {
  351. //获取轮播图数据
  352. loadDate(){
  353. let obj = this;
  354. loadIndexs({}).then(function(e) {
  355. obj.banner = e.data.banner
  356. });
  357. },
  358. navTo(url) {
  359. uni.navigateTo({
  360. url
  361. });
  362. },
  363. //轮播图跳转
  364. ToBanner(e){
  365. console.log(e.url)
  366. uni.navigateTo({
  367. url: e.url
  368. });
  369. },
  370. //AED导航
  371. ToShow(){
  372. this.showbox = !this.showbox;
  373. },
  374. //应急救援队导航
  375. ToShowTEXT(){
  376. this.showTEXT = !this.showTEXT;
  377. },
  378. // 调用高德
  379. toGaodeMap(longitude6,latitude6,address6) {
  380. console.log('longitude6,latitude6,address6',longitude6,latitude6,address6)
  381. let latitude = latitude6
  382. let longitude = longitude6
  383. let address = address6
  384. console.log('选择高德', latitude, longitude, address)
  385. window.location.href = `https://uri.amap.com/marker?position=${longitude},${latitude}&name=${address}`
  386. },
  387. // 调用腾讯
  388. totengxunMap(longitude6,latitude6,address6) {
  389. let latitude = latitude6
  390. let longitude = longitude6
  391. let address = address6
  392. console.log('选择腾讯', latitude, longitude,address)
  393. window.location.href = `http://apis.map.qq.com/uri/v1/marker?marker=coord:${latitude},${longitude};addr:${address}`;
  394. },
  395. // 调用百度
  396. tobaiDuMap(longitude6,latitude6,address6) {
  397. let latitude = this.latitude4
  398. let longitude = this.longitude4
  399. let latitude2 = latitude6
  400. let longitude2 = longitude6
  401. let address = address6
  402. console.log('选择百度', latitude2, longitude2,address)
  403. console.log('获取当前经纬度', latitude, longitude)
  404. window.location.href =
  405. `http://api.map.baidu.com/direction?origin=latlng:${latitude},${longitude}|name:我的位置&destination=${latitude2},${longitude2}&mode=driving&region=${ address }&output=html&src=webapp.baidu.openAPIdemo`
  406. },
  407. openAddress(log,lat,address){
  408. this.longitude6 = log,
  409. this.latitude6 = lat,
  410. this.address6 = address
  411. console.log('log',log)
  412. console.log('lat',lat)
  413. console.log('address6',this.address6)
  414. this.$refs.popup.open();
  415. // if(type == '1'){
  416. // window.location.href = 'http://apis.map.qq.com/uri/v1/marker?marker=coord:30.537043,120.567191;addr:浙江省嘉兴市桐乡市高桥镇高桥大道51号'
  417. // }
  418. // if(type == '2'){
  419. // window.location.href = 'http://apis.map.qq.com/uri/v1/marker?marker=coord:30.611975,120.575595;addr:浙江省嘉兴市桐乡市世纪大道1号 '
  420. // }
  421. // if(type == '3'){
  422. // window.location.href = 'http://apis.map.qq.com/uri/v1/marker?marker=coord:30.635102,120.581151;addr:浙江省嘉兴市桐乡市康民东路58号'
  423. // }
  424. // if(type == '4'){
  425. // window.location.href = 'http://apis.map.qq.com/uri/v1/marker?marker=coord:30.640531,120.583390;addr:浙江省嘉兴市桐乡市凤凰湖翰墨竞芳广场'
  426. // }
  427. // if(type == 'volunteer'){
  428. // window.location.href = 'http://apis.map.qq.com/uri/v1/marker?marker=coord:30.633273,120.558686;addr:浙江省嘉兴市桐乡市梧桐街道杨家门迎风一期 23幢'
  429. // }
  430. // if(type == 'volunteer1'){
  431. // window.location.href = 'http://apis.map.qq.com/uri/v1/marker?marker=coord:30.547011,120.553638;addr:浙江省嘉兴市桐乡市崇南路'
  432. // }
  433. },
  434. //轮播图
  435. swiperChange(e) {
  436. const index = e.detail.current;
  437. this.swiperCurrent = index;
  438. },
  439. //造血干细胞入库
  440. organ(){
  441. window.location.href = "https://register.codac.org.cn/wx/notice.aspx"
  442. }
  443. }
  444. };
  445. </script>
  446. <style lang="scss">
  447. page {
  448. background:linear-gradient(180deg,rgba(255,255,255,1) 0%,rgba(242,242,242,1) 100%);
  449. }
  450. .top_header{
  451. color: #FFFFFF;
  452. width: 100%;
  453. text-align: center;
  454. padding: 15rpx 0rpx;
  455. padding: 25rpx !important;
  456. }
  457. //轮播图
  458. .swiper {
  459. width: 100%;
  460. display: flex;
  461. justify-content: center;
  462. .swiper-box {
  463. width: 100%;
  464. height: 360rpx;
  465. overflow: hidden;
  466. position: relative;
  467. z-index: 1;
  468. swiper {
  469. width: 100%;
  470. height: 100%;
  471. swiper-item {
  472. image {
  473. width: 100%;
  474. height: 100%;
  475. }
  476. }
  477. }
  478. .indicator {
  479. position: absolute;
  480. bottom: 20upx;
  481. left: 20upx;
  482. background-color: rgba(255, 255, 255, 0.4);
  483. width: 150upx;
  484. height: 5upx;
  485. border-radius: 3upx;
  486. overflow: hidden;
  487. display: flex;
  488. .dots {
  489. width: 0upx;
  490. background-color: rgba(255, 255, 255, 1);
  491. transition: all 0.3s ease-out;
  492. &.on {
  493. width: (100%/3);
  494. }
  495. }
  496. }
  497. }
  498. }
  499. .item-box{
  500. width: 100%;
  501. font-size: 24rpx;
  502. padding: 25rpx 25rpx 0rpx 25rpx;
  503. color: #222222;
  504. .item-tpl{
  505. text-align: center;
  506. padding-bottom: 35rpx;
  507. font-size: 21rpx;
  508. color: #222222;
  509. width: 25%;
  510. image{
  511. width: 68rpx;
  512. height: 64rpx;
  513. }
  514. .tip-text{
  515. }
  516. }
  517. }
  518. .list-box{
  519. padding: 25rpx 25rpx;
  520. .top-title{
  521. color: #222222;
  522. font-size: 34rpx;
  523. margin-bottom: 25rpx;
  524. image{
  525. width: 36rpx;
  526. height: 36rpx;
  527. }
  528. }
  529. }
  530. .map-box{
  531. width: 100%;
  532. height: 366rpx;
  533. border: 2prx solid #F2F2F2;
  534. box-shadow: 5px 15px 15px 5px #F2F2F2;
  535. }
  536. .list-tpl{
  537. background-color: #FFFFFF;
  538. margin: 25rpx 0rpx;
  539. padding: 25rpx 25rpx;
  540. font-size: 28rpx;
  541. border-radius: 15rpx;
  542. .info{
  543. width:75%;
  544. .title{
  545. font-size: 32rpx;
  546. color: #222222;
  547. font-weight:500;
  548. }
  549. .addr{
  550. padding: 10rpx 0rpx;
  551. }
  552. }
  553. .image{
  554. width: 10%;
  555. text-align: center;
  556. image{
  557. width: 50rpx;
  558. height: 50rpx;
  559. }
  560. .tip{
  561. color: #7F7F7F;
  562. font-size: 21rpx;
  563. }
  564. }
  565. }
  566. .popup_row {
  567. width: 100%;
  568. height: 500rpx;
  569. background-color: #ffffff;
  570. border-radius: 20rpx 20rpx 0 0;
  571. display: flex;
  572. justify-content: center;
  573. align-items: center;
  574. .rows {
  575. width: 100%;
  576. padding: 0 24rpx;
  577. .rows-item {
  578. height: 80rpx;
  579. line-height: 80rpx;
  580. text-align: center;
  581. width: 100%;
  582. font-size: 32rpx;
  583. color: #303133;
  584. }
  585. }
  586. }
  587. </style>