index.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450
  1. <template>
  2. <view class="content">
  3. <!-- 轮播 -->
  4. <view class="carousel-section">
  5. <swiper class="carousel" :autoplay="true" :interval="3000" :duration="1000">
  6. <swiper-item v-for="item in carouselList" :key="item.id">
  7. <image :src="baseURL + item.image"></image>
  8. </swiper-item>
  9. </swiper>
  10. </view>
  11. <!-- 分类 -->
  12. <view class="cate-section flex">
  13. <view class="cate-item flex" @click="tocontribution">
  14. <view class="img-wrapper flex">
  15. <image src="../../static/icon/icon1.png" mode="" class="img1"></image>
  16. </view>
  17. <view class="item-title">遗体器官捐献</view>
  18. </view>
  19. <view class="cate-item flex" @click="toapplic">
  20. <view class="img-wrapper flex">
  21. <image src="../../static/icon/icon2.png" mode="" class="img2"></image>
  22. </view>
  23. <view class="item-title">造血干细胞捐献</view>
  24. </view>
  25. <view class="cate-item flex" @click="toOrgan">
  26. <view class="img-wrapper flex">
  27. <image src="../../static/icon/icon3.png" mode="" class="img3"></image>
  28. </view>
  29. <view class="item-title">培训报名</view>
  30. </view>
  31. <view class="cate-item flex" @click="tohelpActi">
  32. <view class="img-wrapper flex">
  33. <image src="../../static/icon/icon4.png" mode="" class="img4"></image>
  34. </view>
  35. <view class="item-title">志愿者登记</view>
  36. </view>
  37. </view>
  38. <!-- 荆州爱心红会 -->
  39. <!-- <view class="red-box">
  40. <top-title :title="'爱心红会'"></top-title>
  41. <view class="red-nav flex">
  42. <view class="left-nav" @click="navTo('/pages/donate/donate')"></view>
  43. <view class="right-nav flex">
  44. <view class="right-top-nav" @click="navTo('/pages/donate/idonate?type=1')"></view>
  45. <view class="right-bottom-nav flex">
  46. <view class="left-item" @click="navTo('/pages/applic/love')"></view>
  47. <view class="right-item" @click="navTo('/pages/applic/science')"></view>
  48. </view>
  49. </view>
  50. </view>
  51. </view> -->
  52. <!-- 低配爱心红会 -->
  53. <view class="red-box">
  54. <top-title :title="'爱心红会'"></top-title>
  55. <view class="red-nav">
  56. <view class="nav-item" @click="navTo('/pages/applic/love')">
  57. <image src="../../static/img/n1.png" mode=""></image>
  58. </view>
  59. <view class="nav-item" @click="navTo('/pages/applic/science')">
  60. <image src="../../static/img/n2.png" mode=""></image>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- sos急救系统 -->
  65. <view class="system">
  66. <top-title :title="'救在身边'" navurl="/pages/applic/location" :show_more="true"></top-title>
  67. <view class="system-map">
  68. <map class="map-box" show-location :markers="jzsbmarker" :scale="scale" :latitude="latitude4"
  69. :longitude="longitude4" ref="map" @markertap="markertap" :show-location="false"></map>
  70. </view>
  71. <view class="" style="padding-top: 80rpx;">
  72. <view v-for="(item,index) in jzsblist" :key="item.id">
  73. <view class="location-item">
  74. <view class="box-left">
  75. <view class="img01">
  76. <image src="../../static/img/line01.png" mode=""></image>
  77. </view>
  78. <view class="img02" v-if="item.info !=null">
  79. <image src="../../static/img/002.png" mode=""></image>
  80. </view>
  81. <view class="img02" v-else>
  82. <image src="../../static/img/002.png" mode=""></image>
  83. </view>
  84. <view class="info">
  85. <view class="info-header">
  86. <view class="name">
  87. 救护员{{ index +1 }}
  88. </view>
  89. <view class="distance">
  90. {{item.range >= 1 ? (item.range + 'km') : (item.distance + 'm')}}
  91. </view>
  92. <view class="location-icon">
  93. <image src="../../static/img/location-icon.png" mode=""></image>
  94. </view>
  95. </view>
  96. <view class="address">
  97. {{ item.address }}
  98. </view>
  99. </view>
  100. </view>
  101. <view class="box-right">
  102. <view class="img" v-if="item.is_create == 0" @click="rescue(item,index)">
  103. <image src="../../static/img/rescue.png" mode=""></image>
  104. </view>
  105. <view class="called" v-else>
  106. 已呼叫
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. <view class="list-box">
  114. <view class="system-title">
  115. <top-title :title="'救护站'" :navurl="'/pages/applic/aid'" :show_more="true"></top-title>
  116. </view>
  117. <view id="container">
  118. <map class="map-box" show-location :markers="jhzmarker" :scale="scale" :latitude="latitude4"
  119. :longitude="longitude4" ref="map" style="height: 450rpx" @markertap="jhzmarkertap"
  120. :show-location="false"></map>
  121. </view>
  122. <view class="">
  123. <view class="list-tpl flex" @click="openAddress(item)" v-for="(item, index) in Mechanism"
  124. :key="item.id">
  125. <template>
  126. <view class="list-left">
  127. <view class="info">
  128. <view class="title">{{ item.name }}</view>
  129. <view class="addr">地址:{{ item.address }}</view>
  130. </view>
  131. </view>
  132. <view class="image">
  133. <image src="../../static/img/img10.png"></image>
  134. <!-- <view class="tip" v-if="item.space > 999">>999m</view> -->
  135. <view class="tip">{{ item.range >=1 ? (item.range + 'km') : (item.distance + 'm') }}</view>
  136. </view>
  137. </template>
  138. </view>
  139. <!-- <uni-load-more :status="loadingType"></uni-load-more> -->
  140. </view>
  141. </view>
  142. <view class="list-box" style="margin-top: 20rpx;">
  143. <view class="system-title">
  144. <top-title :title="'智能AED'" :navurl="'/pages/applic/aed'" :show_more="true"></top-title>
  145. </view>
  146. <view id="container">
  147. <map class="map-box" show-location :markers="aedmarker" :scale="scale" :latitude="latitude4"
  148. :longitude="longitude4" ref="map" style="height: 450rpx" @markertap="aedmarkertap"
  149. :show-location="false"></map>
  150. </view>
  151. <view class="">
  152. <view class="list-tpl flex" @click="openAddress(item)" v-for="(item, index) in AEDList" :key="item.id">
  153. <template>
  154. <view class="list-left">
  155. <view class="info">
  156. <view class="title">{{ item.name }}</view>
  157. <view class="addr">地址:{{ item.address }}</view>
  158. </view>
  159. </view>
  160. <view class="image">
  161. <image src="../../static/img/img10.png"></image>
  162. <view class="tip">{{ item.range >=1 ? (item.range + 'km') : (item.distance + 'm') }}m</view>
  163. </view>
  164. </template>
  165. </view>
  166. </view>
  167. </view>
  168. <uni-popup ref="popup" type="bottom" @click="close">
  169. <view class="popup_row">
  170. <view class="rows">
  171. <view class="rows-item" @click="toGaodeMap">高德地图</view>
  172. <view class="rows-item" @click="tobaiDuMap">百度地图</view>
  173. <view class="rows-item" @click="totengxunMap">腾讯地图</view>
  174. </view>
  175. </view>
  176. </uni-popup>
  177. <uni-popup ref="popup2" type="center" @click="close2">
  178. <view class="popup_row2">
  179. <view class="title">
  180. <view class="title-left">
  181. 请输入您的手机号,等待救援!
  182. </view>
  183. <view class="cancel" @click="cancel">
  184. <image src="../../static/img/cancel1.png" mode=""></image>
  185. </view>
  186. </view>
  187. <view class="inpBox">
  188. <input type="text" value="" placeholder="请输入您的手机号" v-model="to_phone" />
  189. </view>
  190. <view class="inpedit">
  191. 可在方框中修改您的手机号
  192. </view>
  193. <view class="comfirm">
  194. <view class="comfirm1" @click="comfirm1()">
  195. 确认
  196. </view>
  197. </view>
  198. </view>
  199. </uni-popup>
  200. </view>
  201. </template>
  202. <script>
  203. import {
  204. getAed,
  205. getAidList,
  206. getRescuerList,
  207. sos,
  208. geocoder
  209. } from '@/api/category.js'
  210. import {
  211. loadIndexs,
  212. bannerlist,
  213. getListAED,
  214. getDistance,
  215. getListMechanism,
  216. getdis,
  217. tocall
  218. } from '@/api/index.js';
  219. import {
  220. saveUrl,
  221. interceptor
  222. } from '@/utils/loginUtils.js';
  223. import {
  224. mapState,
  225. mapMutations
  226. } from 'vuex';
  227. import {
  228. userinfo
  229. } from '@/api/user.js';
  230. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  231. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  232. import {
  233. getLoca
  234. } from '@/utils/wxAuthorized.js';
  235. import {
  236. getcomAddress
  237. } from '@/api/index.js';
  238. import topTitle from '../../components/top-title/top-title.vue';
  239. export default {
  240. components: {
  241. uniPopup,
  242. uniLoadMore,
  243. topTitle
  244. },
  245. data() {
  246. return {
  247. user_address: '',
  248. shareShow: true,
  249. user_id: '',
  250. rescuers_id: '',
  251. name: '',
  252. uid: '',
  253. phone: '',
  254. to_phone: '',
  255. jzsbmarker: [],
  256. jzsblist: [],
  257. jhzmarker: [],
  258. aedmarker: [],
  259. carouselList: [], //轮播
  260. science: [], //文章列表
  261. page: 1,
  262. limit: 10,
  263. AEDList: [],
  264. Mechanism: [],
  265. latitude2: '',
  266. longitude2: '',
  267. latitude4: '',
  268. longitude4: '',
  269. address: '',
  270. loadingType: 'more',
  271. markerList: [],
  272. marker: [],
  273. longitude: '121.15829821166992',
  274. latitude: '30.044394499237708',
  275. longitude1: '120.553638',
  276. latitude1: '30.547011',
  277. scale: '12', //地图缩放程度
  278. scale1: '15',
  279. showbox: false,
  280. showTEXT: false,
  281. addressData: {
  282. name: '',
  283. mobile: '',
  284. latitude: 0, //纬度
  285. longitude: 0, //经度
  286. address: {
  287. province: '',
  288. city: '',
  289. district: '',
  290. detail: ''
  291. },
  292. area: '',
  293. default: false
  294. }
  295. };
  296. },
  297. onShow() {
  298. saveUrl();
  299. // let token = uni.getStorageSync('token');
  300. console.log(11, this);
  301. if (!this.hasLogin) {
  302. // 登录拦截
  303. // interceptor();
  304. uni.showModal({
  305. title: '登录',
  306. content: '您未登录,是否马上登陆?',
  307. success: e => {
  308. if (e.confirm) {
  309. interceptor();
  310. }
  311. },
  312. fail: e => {
  313. console.log(e);
  314. }
  315. });
  316. } else {
  317. // this.loadData();
  318. }
  319. },
  320. onLoad() {
  321. this.loadIndex()
  322. saveUrl();
  323. let obj = this;
  324. let weichatBrowser = uni.getStorageSync('weichatBrowser')
  325. if (weichatBrowser) {
  326. try {
  327. let locationAddress;
  328. // #ifdef H5
  329. let wxOjb = require('jweixin-module');
  330. locationAddress = wxOjb.getLocation;
  331. // #endif
  332. // #ifdef MP
  333. locationAddress = uni.getLocation;
  334. // #endif
  335. // #ifdef H5
  336. wxOjb.ready(() => {
  337. console.log('加载完毕注册事件');
  338. locationAddress({
  339. type: 'gcj02',
  340. success: function(res) {
  341. console.log('获取经纬度', res);
  342. obj.longitude4 = res.longitude;
  343. obj.latitude4 = res.latitude;
  344. obj.marker = [{
  345. longitude: res.longitude,
  346. latitude: res.latitude,
  347. iconPath: '/static/img/img19.png',
  348. width: '45',
  349. height: '45'
  350. }];
  351. obj.loadData();
  352. },
  353. fail(e) {
  354. console.log('失败', e);
  355. // window.location.reload();
  356. }
  357. });
  358. });
  359. // #endif
  360. // #ifdef MP
  361. locationAddress({
  362. type: 'gcj02',
  363. success: function(res) {
  364. console.log('获取经纬度', res);
  365. obj.longitude4 = res.longitude;
  366. obj.latitude4 = res.latitude;
  367. obj.marker = [{
  368. longitude: res.longitude,
  369. latitude: res.latitude,
  370. iconPath: '/static/img/img19.png',
  371. width: '45',
  372. height: '45'
  373. }];
  374. obj.loadData();
  375. },
  376. fail(e) {
  377. console.log('失败', e);
  378. obj.tishi()
  379. }
  380. });
  381. // #endif
  382. } catch (e) {
  383. let locationAddress;
  384. // #ifdef H5
  385. let wxOjb = require('jweixin-module');
  386. locationAddress = wxOjb.getLocation;
  387. // #endif
  388. // #ifdef MP
  389. locationAddress = uni.getLocation;
  390. // #endif
  391. // #ifdef H5
  392. wxOjb.ready(() => {
  393. console.log('加载完毕注册事件');
  394. locationAddress({
  395. type: 'gcj02',
  396. success: function(res) {
  397. console.log('获取经纬度', res);
  398. obj.longitude4 = res.longitude;
  399. obj.latitude4 = res.latitude;
  400. obj.loadData();
  401. },
  402. fail(e) {
  403. console.log('失败', e);
  404. obj.tishi()
  405. }
  406. });
  407. });
  408. // #endif
  409. // #ifdef MP
  410. locationAddress({
  411. type: 'gcj02',
  412. success: function(res) {
  413. console.log('获取经纬度', res);
  414. obj.longitude4 = res.longitude;
  415. obj.latitude4 = res.latitude;
  416. obj.loadData();
  417. },
  418. fail(e) {
  419. console.log('失败', e);
  420. obj.tishi()
  421. }
  422. });
  423. // #endif
  424. }
  425. } else {
  426. uni.getLocation({
  427. type: 'gcj02',
  428. success: function(res) {
  429. console.log('获取经纬度', res);
  430. obj.longitude4 = res.longitude;
  431. obj.latitude4 = res.latitude;
  432. obj.marker = [{
  433. longitude: res.longitude,
  434. latitude: res.latitude,
  435. iconPath: '/static/img/img19.png',
  436. width: '45',
  437. height: '45'
  438. }];
  439. obj.loadData();
  440. },
  441. fail(e) {
  442. console.log('失败', e);
  443. // window.location.reload();
  444. }
  445. })
  446. }
  447. },
  448. computed: {
  449. ...mapState('user', ['userInfo', 'hasLogin']),
  450. ...mapState(['baseURL']),
  451. },
  452. // 下拉加载
  453. // onReachBottom() {
  454. // this.loadData();
  455. // },
  456. methods: {
  457. ...mapMutations('user', ['setUserInfo']),
  458. loadIndex() {
  459. let obj = this;
  460. loadIndexs({}).then(({
  461. data
  462. }) => {
  463. console.log(data, 'index')
  464. // this.carouselList = data.banner.map((e) => {
  465. // if(e.image.indexOf('http')<0){
  466. // e.image += obj.baseURL
  467. // }
  468. // return e
  469. // }); //轮播图
  470. this.carouselList = data.banner
  471. });
  472. },
  473. tocontribution() {
  474. uni.navigateTo({
  475. // url: "/pages/applic/contribution"
  476. url: '/pages/form/applicationForm'
  477. });
  478. },
  479. //提示
  480. tishi() {
  481. uni.showModal({
  482. title: '提示',
  483. content: '获取当前位置信息失败,是否刷新页面。',
  484. success: function(res) {
  485. if (res.confirm) {
  486. window.location.reload();
  487. console.log('用户点击确定');
  488. } else if (res.cancel) {
  489. console.log('用户点击取消');
  490. }
  491. }
  492. })
  493. },
  494. // 调用高德
  495. toGaodeMap() {
  496. let latitude = this.latitude2;
  497. let longitude = this.longitude2;
  498. let address = this.address;
  499. console.log('选择高德', latitude, longitude, address);
  500. // window.location.href = 'https://uri.amap.com/marker?position=30.537043,120.567191&name=浙江省嘉兴市桐乡市高桥镇高桥大道51号'
  501. window.location.href = `https://uri.amap.com/marker?position=${longitude},${latitude}&name=${address}`;
  502. // window.location.href = `http://uri.amap.com/navigation?from=114.02597366,22.54605355&to=114.029243,22.609562&mode=car&src=nyx_super`
  503. // http://uri.amap.com/navigation?from=" + fromLongitude + "," + fromLatitude + "&to="+ longitude + "," + latitude + "&mode=car&src=nyx_super
  504. },
  505. // 调用腾讯
  506. totengxunMap() {
  507. let latitude = this.latitude2;
  508. let longitude = this.longitude2;
  509. let address = this.address;
  510. console.log('选择腾讯', latitude, longitude);
  511. window.location.href =
  512. `http://apis.map.qq.com/uri/v1/marker?marker=coord:${latitude},${longitude};addr:${address}`;
  513. },
  514. // 调用百度
  515. tobaiDuMap() {
  516. let latitude = this.latitude2;
  517. let longitude = this.longitude2;
  518. let latitude6 = this.latitude4;
  519. let longitude6 = this.longitude4;
  520. let address = this.address;
  521. console.log('选择百度', latitude, longitude);
  522. console.log('获取当前经纬度', latitude6, longitude6);
  523. window.location.href =
  524. `http://api.map.baidu.com/direction?origin=latlng:${latitude6},${longitude6}|name:我的位置&destination=${latitude},${longitude}&mode=driving&region=${address}&output=html&src=webapp.baidu.openAPIdemo`;
  525. //`bdapp://map/navi?location=${longitude},${latitude}&coord_type=gc02&title=${address}&content=${address}&output=html&src=andr.baidu.openAPIdemo `
  526. },
  527. // 调用谷歌
  528. toGoogleMap() {
  529. let latitude = this.latitude2;
  530. let longitude = this.longitude2;
  531. console.log('选择谷歌', latitude, longitude);
  532. },
  533. tolocation() {
  534. uni.navigateTo({
  535. url: '/pages/applic/location'
  536. });
  537. },
  538. toapplic() {
  539. uni.navigateTo({
  540. url: '/pages/applic/appliSystem'
  541. });
  542. },
  543. tohelpActi() {
  544. uni.navigateTo({
  545. // url: "/pages/applic/tohelpActi"
  546. url: '/pages/form/tovolApply'
  547. });
  548. },
  549. toOrgan() {
  550. console.log('kepuxingbaoming');
  551. uni.navigateTo({
  552. url: '/pages/train/index'
  553. });
  554. },
  555. // 点击图标
  556. markertap(e) {
  557. console.log(e.target.markerId);
  558. this.$refs.popup.open();
  559. let obj = this;
  560. for (let i = 0; i < obj.marker.length; i++) {
  561. if (e.target.markerId == obj.marker[i].id) {
  562. obj.latitude2 = obj.marker[i].latitude;
  563. obj.longitude2 = obj.marker[i].longitude;
  564. obj.address = obj.marker[i].address;
  565. }
  566. }
  567. },
  568. aedmarkertap(e) {
  569. console.log(e.target.markerId);
  570. let obj = this;
  571. for (let i = 0; i < obj.aedmarker.length; i++) {
  572. if (e.target.markerId == obj.marker[i].id) {
  573. obj.latitude2 = obj.marker[i].latitude;
  574. obj.longitude2 = obj.marker[i].longitude;
  575. obj.address = obj.marker[i].address;
  576. }
  577. }
  578. obj.$refs.popup.open();
  579. },
  580. jhzmarkertap(e) {
  581. console.log(e.target.markerId);
  582. let obj = this;
  583. for (let i = 0; i < obj.jhzmarker.length; i++) {
  584. if (e.target.markerId == obj.marker[i].id) {
  585. obj.latitude2 = obj.marker[i].latitude;
  586. obj.longitude2 = obj.marker[i].longitude;
  587. obj.address = obj.marker[i].address;
  588. }
  589. }
  590. obj.$refs.popup.open();
  591. },
  592. loadData() {
  593. let obj = this;
  594. console.log('打印当前经纬度', obj.longitude4, obj.latitude4);
  595. geocoder({
  596. latitude: obj.latitude4,
  597. longitude: obj.longitude4
  598. }).then(ress => {
  599. console.log(ress)
  600. obj.user_address = ress.data.result.address
  601. console.log(obj.user_address, 'obj.user_address')
  602. })
  603. userinfo({}).then(({
  604. data
  605. }) => {
  606. obj.setUserInfo(data);
  607. obj.to_phone = data.mobile || ''
  608. });
  609. if (obj.loadingType === 'noMore') {
  610. //防止重复加载
  611. return;
  612. }
  613. // 修改当前对象状态为加载中
  614. obj.loadingType = 'loading';
  615. getAed({
  616. longitude: obj.longitude4,
  617. latitude: obj.latitude4,
  618. page: 1,
  619. limit: 2
  620. }).then(({
  621. data
  622. }) => {
  623. console.log(data, 999);
  624. // obj.AEDList = data
  625. for (let i = 0; i < data.length; i++) {
  626. data[i].space = obj.space(obj.latitude4, obj.longitude4, data[i].latitude, data[i]
  627. .longitude);
  628. }
  629. obj.AEDList = data;
  630. let arr = data.map(item => ({
  631. latitude: item.latitude,
  632. longitude: item.longitude,
  633. iconPath: '/static/img/img014.png',
  634. width: '35',
  635. height: '35',
  636. id: item.id,
  637. address: item.address
  638. }));
  639. obj.aedmarker = obj.marker.concat(arr)
  640. console.log(obj.AEDList, '999++++++++++++++++++++++++++');
  641. obj.markerList = data;
  642. });
  643. getAidList({
  644. page: 1,
  645. limit: 2,
  646. longitude: obj.longitude4,
  647. latitude: obj.latitude4,
  648. }).then(({
  649. data
  650. }) => {
  651. console.log(data, '机构+++++++++++++')
  652. for (let i = 0; i < data.length; i++) {
  653. data[i].space = obj.space(obj.latitude4, obj.longitude4, data[i].latitude, data[i]
  654. .longitude);
  655. }
  656. let arr = data.map(item => ({
  657. latitude: item.latitude,
  658. longitude: item.longitude,
  659. iconPath: '/static/img/img014.png',
  660. width: '35',
  661. height: '35',
  662. id: item.id,
  663. address: item.address
  664. }));
  665. obj.jhzmarker = obj.marker.concat(arr)
  666. obj.Mechanism = data;
  667. console.log(obj.Mechanism, '888++++++++++++++++++++++++++');
  668. })
  669. getRescuerList({
  670. longitude: obj.longitude4,
  671. latitude: obj.latitude4,
  672. page: 1,
  673. limit: 2
  674. }).then((res) => {
  675. let data = res.data;
  676. data = data.slice(0, 2)
  677. console.log('就在身边请求数据', data);
  678. console.log('data.phone333', data.phone)
  679. data = data.map(d => {
  680. return {
  681. ...d,
  682. iscall: true
  683. }
  684. })
  685. obj.jzsblist = data;
  686. let arr = data.map(item => ({
  687. latitude: item.latitude,
  688. longitude: item.longitude,
  689. iconPath: '/static/img/img014.png',
  690. width: '35',
  691. height: '35',
  692. id: item.id,
  693. address: item.address
  694. }))
  695. obj.jzsbmarker = obj.marker.concat(arr)
  696. }).catch(err => {
  697. console.log(err);
  698. });
  699. },
  700. // 导航
  701. openAddress(item) {
  702. let obj = this;
  703. obj.latitude2 = item.latitude;
  704. obj.longitude2 = item.longitude;
  705. obj.address = item.address;
  706. this.$refs.popup.open();
  707. },
  708. Jump(item) {
  709. // console.log(item);
  710. if (item.url != '') {
  711. window.open(item.url);
  712. return;
  713. }
  714. uni.navigateTo({
  715. url: '/pages/applic/info?id=' + item.id
  716. });
  717. },
  718. open() {
  719. this.$refs.popup.open();
  720. },
  721. close() {
  722. this.$refs.popup.close();
  723. },
  724. navTo(url) {
  725. uni.navigateTo({
  726. url
  727. });
  728. },
  729. space(lat1, lng1, lat2, lng2) {
  730. console.log(lat1, lng1, lat2, lng2);
  731. var radLat1 = (lat1 * Math.PI) / 180.0;
  732. var radLat2 = (lat2 * Math.PI) / 180.0;
  733. var a = radLat1 - radLat2;
  734. var b = (lng1 * Math.PI) / 180.0 - (lng2 * Math.PI) / 180.0;
  735. var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math
  736. .pow(Math.sin(b / 2), 2)));
  737. s = s * 6378.137;
  738. s = Math.round(s * 10000) / 10000;
  739. return s * 1000; // 单位米
  740. },
  741. // 立即救援
  742. rescue(item, index) {
  743. let obj = this;
  744. console.log(item, 'jiuzhu item')
  745. uni.showModal({
  746. content: '是否发起求救?',
  747. success: res => {
  748. if (res.confirm) {
  749. this.$refs.popup2.open(item, index);
  750. obj.rescuers_id = item.id
  751. obj.user_id = item.user_id
  752. }
  753. }
  754. })
  755. },
  756. close2() {
  757. this.$refs.popup2.close()
  758. },
  759. comfirm1: function() {
  760. let obj = this
  761. if (obj.to_phone.toString().trim() == '') {
  762. return obj.$api.msg('请输入手机号码')
  763. } else {
  764. console.log('obj.to_phone1111', obj.to_phone)
  765. const reg = /^(\+?0?86-?)?1[\d]\d{9}$/;
  766. if (!reg.test(obj.to_phone)) {
  767. obj.$api.msg('请填写正确的手机号码');
  768. return;
  769. }
  770. sos({
  771. mobile: obj.to_phone,
  772. address: obj.user_address,
  773. latitude: obj.latitude4,
  774. longitude: obj.longitude4,
  775. rescuers_id: obj.rescuers_id,
  776. rescuers_user_id: obj.user_id,
  777. re_url: obj.$store.state.baseURL + '/index/#/pages/applic/rescuerecords'
  778. }).then(res => {
  779. uni.showModal({
  780. title: '请耐心等待救援',
  781. success: res => {
  782. if (res.confirm) {
  783. window.location.reload(); //重新刷新页面
  784. }
  785. }
  786. })
  787. obj.$refs.popup2.close();
  788. })
  789. }
  790. },
  791. }
  792. };
  793. </script>
  794. <style lang="scss">
  795. a {
  796. text-decoration: none;
  797. color: #5f5f5f;
  798. }
  799. .content {
  800. // line-height: 1;
  801. background-color: #ffabab;
  802. // padding-bottom: 60rpx;
  803. }
  804. .popup_row {
  805. width: 100%;
  806. height: 500rpx;
  807. background-color: #ffffff;
  808. border-radius: 20rpx;
  809. display: flex;
  810. justify-content: center;
  811. align-items: center;
  812. .rows {
  813. width: 100%;
  814. padding: 0 24rpx;
  815. .rows-item {
  816. height: 80rpx;
  817. line-height: 80rpx;
  818. text-align: center;
  819. width: 100%;
  820. font-size: 32rpx;
  821. color: #303133;
  822. // border-bottom: 1rpx solid #f0f0f0;
  823. }
  824. // .row-1 {
  825. // margin: auto;
  826. // .first_aid {
  827. // width: 300rpx;
  828. // height: 300rpx;
  829. // }
  830. // }
  831. // .row-2 {
  832. // font-size: 38rpx;
  833. // margin-top: 20rpx;
  834. // }
  835. }
  836. }
  837. .content {
  838. background-color: #f8f8f8;
  839. height: 100%;
  840. /* 头部 轮播图 */
  841. .carousel-section {
  842. // padding-top: 10px;
  843. overflow: hidden;
  844. background-color: #fff;
  845. .carousel {
  846. width: 705rpx;
  847. height: 375rpx;
  848. margin: 0 auto;
  849. border-radius: 20rpx;
  850. overflow: hidden;
  851. .carousel-item {
  852. width: 100%;
  853. height: 100%;
  854. padding-left: 30rpx;
  855. padding-right: 30rpx;
  856. overflow: hidden;
  857. }
  858. image {
  859. width: 100%;
  860. height: 375rpx;
  861. border-radius: 20rpx;
  862. }
  863. }
  864. }
  865. // 分类
  866. .cate-section {
  867. justify-content: space-around;
  868. background-color: #fff;
  869. padding: 46rpx 0 30rpx;
  870. .cate-item {
  871. width: 25%;
  872. flex-direction: column;
  873. text-align: center;
  874. align-items: center;
  875. justify-content: center;
  876. .img-wrapper {
  877. width: 100rpx;
  878. height: 88rpx;
  879. background: #eef4ff;
  880. border-radius: 14rpx;
  881. position: relative;
  882. image {
  883. position: absolute;
  884. left: 50%;
  885. top: 50%;
  886. transform: translate(-50%, -50%);
  887. }
  888. .img1 {
  889. width: 100rpx;
  890. height: 84rpx;
  891. }
  892. .img2 {
  893. width: 100rpx;
  894. height: 85rpx;
  895. }
  896. .img3 {
  897. width: 100rpx;
  898. height: 84rpx;
  899. }
  900. .img4 {
  901. width: 100rpx;
  902. height: 88rpx;
  903. }
  904. }
  905. .item-title {
  906. margin-top: 15rpx;
  907. font-size: 24rpx;
  908. font-family: PingFang SC;
  909. font-weight: 500;
  910. color: #333333;
  911. }
  912. }
  913. }
  914. // 红会科普
  915. .science-section {
  916. width: 100%;
  917. background-color: #ffffff;
  918. margin-top: 18rpx;
  919. padding-top: 30rpx;
  920. .science-title {
  921. display: flex;
  922. justify-content: center;
  923. align-items: center;
  924. padding-bottom: 22rpx;
  925. .title {
  926. width: 285rpx;
  927. height: 64rpx;
  928. background-color: #ca121e;
  929. border-radius: 32rpx;
  930. color: #ffffff;
  931. font-size: 32rpx;
  932. line-height: 64rpx;
  933. text-align: center;
  934. }
  935. image {
  936. width: 68rpx;
  937. height: 43rpx;
  938. margin-left: 16rpx;
  939. margin-right: 16rpx;
  940. }
  941. }
  942. .science-box {
  943. padding-left: 15rpx;
  944. padding-right: 15rpx;
  945. padding-bottom: 20rpx;
  946. border-bottom: 1rpx solid #f0f0f0;
  947. white-space: nowrap;
  948. display: flex;
  949. width: 100%;
  950. // .uni-scroll-view-content{
  951. // display: flex;
  952. // }
  953. .science-content {
  954. // width: 100%;
  955. // display: flex;
  956. display: -webkit-box;
  957. .science-item {
  958. margin-right: 24rpx;
  959. width: 198rpx;
  960. display: flex;
  961. flex-direction: column;
  962. align-items: center;
  963. text-align: center;
  964. image {
  965. width: 100%;
  966. height: 145rpx;
  967. }
  968. .article-title {
  969. width: 198rpx;
  970. color: #333;
  971. font-size: 25rpx;
  972. padding-top: 20rpx;
  973. padding-bottom: 16rpx;
  974. font-weight: 900;
  975. }
  976. .article-content {
  977. width: 198rpx;
  978. color: #999999;
  979. font-size: 18rpx;
  980. overflow: hidden;
  981. text-overflow: ellipsis;
  982. display: -webkit-box;
  983. word-break: break-all;
  984. -webkit-box-orient: vertical;
  985. -webkit-line-clamp: 2;
  986. }
  987. }
  988. }
  989. }
  990. .science-more {
  991. display: flex;
  992. justify-content: center;
  993. align-items: center;
  994. color: #cb131c;
  995. font-size: 30rpx;
  996. padding-top: 18rpx;
  997. padding-bottom: 18rpx;
  998. image {
  999. width: 20rpx;
  1000. height: 27rpx;
  1001. }
  1002. }
  1003. }
  1004. // sos急救中心
  1005. .system {
  1006. width: 100%;
  1007. background-color: #ffffff;
  1008. margin-top: 18rpx;
  1009. padding: 40rpx 30rpx 35rpx 30rpx;
  1010. margin-bottom: 20rpx;
  1011. .system-map {
  1012. margin: 30rpx auto 0;
  1013. width: 689rpx;
  1014. height: 312rpx;
  1015. background-color: #ffffff;
  1016. padding-bottom: 45rpx;
  1017. }
  1018. }
  1019. // AED
  1020. .list-box {
  1021. padding: 0rpx 25rpx 24rpx;
  1022. background-color: #fff;
  1023. .system-title {
  1024. display: flex;
  1025. justify-content: flex-start;
  1026. align-items: center;
  1027. height: 130rpx;
  1028. // padding-bottom: 22rpx;
  1029. background-color: #ffffff;
  1030. .title {
  1031. width: 285rpx;
  1032. height: 64rpx;
  1033. background-color: #ca121e;
  1034. border-radius: 32rpx;
  1035. color: #ffffff;
  1036. font-size: 32rpx;
  1037. line-height: 64rpx;
  1038. text-align: center;
  1039. }
  1040. .img {
  1041. width: 68rpx;
  1042. height: 43rpx;
  1043. margin-left: 16rpx;
  1044. margin-right: 16rpx;
  1045. image {
  1046. width: 68rpx;
  1047. height: 43rpx;
  1048. }
  1049. }
  1050. }
  1051. }
  1052. .map-box {
  1053. width: 100%;
  1054. height: 366rpx;
  1055. }
  1056. .list-tpl {
  1057. background-color: #ffffff;
  1058. margin: 25rpx 0rpx;
  1059. padding: 25rpx 25rpx;
  1060. font-size: 28rpx;
  1061. border-radius: 15rpx;
  1062. display: flex;
  1063. justify-content: space-between;
  1064. align-items: center;
  1065. border-bottom: 1px solid #f1f1f1;
  1066. .list-left {
  1067. display: flex;
  1068. width: 100%;
  1069. .number {
  1070. font-size: 32rpx;
  1071. margin-right: 14rpx;
  1072. }
  1073. .info {
  1074. width: 100%;
  1075. .title {
  1076. font-size: 32rpx;
  1077. color: #222222;
  1078. font-weight: 500;
  1079. }
  1080. .addr {
  1081. width: 400rpx;
  1082. margin-top: 20rpx;
  1083. font-size: 20rpx;
  1084. font-family: PingFang SC;
  1085. font-weight: 500;
  1086. color: #999999;
  1087. }
  1088. }
  1089. }
  1090. .image {
  1091. width: 20%;
  1092. text-align: center;
  1093. image {
  1094. width: 50rpx;
  1095. height: 50rpx;
  1096. }
  1097. .tip {
  1098. color: #7f7f7f;
  1099. font-size: 21rpx;
  1100. }
  1101. }
  1102. }
  1103. }
  1104. // 高配爱心红会
  1105. // .red-box {
  1106. // margin: 20rpx 0;
  1107. // height: 521rpx;
  1108. // padding: 40rpx 23rpx 35rpx 23rpx;
  1109. // background-color: #fff;
  1110. // .red-nav {
  1111. // justify-content: space-between;
  1112. // margin-top: 23rpx;
  1113. // .left-nav {
  1114. // width: 332rpx;
  1115. // height: 392rpx;
  1116. // background: #FFF3F5;
  1117. // background-image: url(../../static/img/m1.png);
  1118. // background-size: 100% 100%;
  1119. // }
  1120. // .right-nav {
  1121. // width: 357rpx;
  1122. // height: 392rpx;
  1123. // flex-direction: column;
  1124. // justify-content: space-between;
  1125. // .right-top-nav {
  1126. // width: 357rpx;
  1127. // height: 204rpx;
  1128. // background: #F6F6FF;
  1129. // background-image: url(../../static/img/m2.png);
  1130. // background-size: 100% 100%;
  1131. // }
  1132. // .right-bottom-nav {
  1133. // width: 357rpx;
  1134. // height: 173rpx;
  1135. // justify-content: space-between;
  1136. // view {
  1137. // width: 171rpx;
  1138. // height: 173rpx;
  1139. // }
  1140. // .left-item {
  1141. // background: #F5EFFE;
  1142. // background-image: url(../../static/img/m3.png);
  1143. // background-size: 100% 100%;
  1144. // }
  1145. // .right-item {
  1146. // background: #EDFEFE;
  1147. // background-image: url(../../static/img/m4.png);
  1148. // background-size: 100% 100%;
  1149. // }
  1150. // }
  1151. // }
  1152. // }
  1153. // }
  1154. // 低配爱心红会
  1155. .red-box {
  1156. margin: 20rpx 0;
  1157. padding: 30rpx 30rpx 40rpx 30rpx;
  1158. background-color: #fff;
  1159. .red-nav {
  1160. padding-top: 25rpx;
  1161. display: flex;
  1162. justify-content: space-between;
  1163. .nav-item {
  1164. width: 330rpx;
  1165. height: 175rpx;
  1166. background: #FFF4F2;
  1167. border-radius: 15rpx;
  1168. image {
  1169. width: 330rpx;
  1170. height: 175rpx;
  1171. }
  1172. }
  1173. }
  1174. }
  1175. .popup_row2 {
  1176. // margin-top: 108rpx;
  1177. height: 440rpx;
  1178. border-radius: 25rpx;
  1179. width: 100%;
  1180. padding: 24rpx;
  1181. background-color: #f8f8f8;
  1182. z-index: 999;
  1183. .title {
  1184. border-bottom: 2rpx solid #F2F2F2;
  1185. color: #E63931;
  1186. font-size: 32rpx;
  1187. padding-left: 4rpx;
  1188. padding-bottom: 16rpx;
  1189. display: flex;
  1190. justify-content: space-between;
  1191. // align-items: center;
  1192. .cancel {
  1193. margin-left: 52rpx;
  1194. width: 36rpx;
  1195. height: 36rpx;
  1196. image {
  1197. width: 36rpx;
  1198. height: 36rpx;
  1199. }
  1200. }
  1201. }
  1202. .inpBox {
  1203. margin-top: 52rpx;
  1204. border: 2px solid #f2f2f2;
  1205. padding: 12rpx 24rpx;
  1206. color: #FF9797;
  1207. border-radius: 8rpx;
  1208. .input-placeholder {
  1209. // height: 70rpx;
  1210. font-size: 32rpx;
  1211. color: #FF9797;
  1212. }
  1213. }
  1214. .inpedit {
  1215. margin-top: 24rpx;
  1216. margin-left: 14rpx;
  1217. font-size: 28rpx;
  1218. color: #FF9797;
  1219. }
  1220. .comfirm {
  1221. display: flex;
  1222. justify-content: flex-end;
  1223. margin-top: 54rpx;
  1224. .comfirm1 {
  1225. padding: 12rpx 24rpx;
  1226. border-radius: 12rpx;
  1227. color: #FFFFFF;
  1228. background-color: #E63931;
  1229. }
  1230. }
  1231. }
  1232. .location-item {
  1233. z-index: 1000;
  1234. display: flex;
  1235. justify-content: space-between;
  1236. align-items: center;
  1237. border-bottom: 1rpx solid #E7E8EA;
  1238. padding: 15rpx 0;
  1239. .box-left {
  1240. display: flex;
  1241. .img01 {
  1242. width: 8rpx;
  1243. height: 28rpx;
  1244. margin-right: 18rpx;
  1245. image {
  1246. width: 8rpx;
  1247. height: 28rpx;
  1248. }
  1249. }
  1250. .img02 {
  1251. width: 117rpx;
  1252. height: 117rpx;
  1253. border-radius: 50%;
  1254. image {
  1255. width: 117rpx;
  1256. height: 117rpx;
  1257. border-radius: 50%;
  1258. }
  1259. }
  1260. .info {
  1261. margin-left: 16rpx;
  1262. .info-header {
  1263. display: flex;
  1264. align-items: center;
  1265. .name {
  1266. font-size: 32rpx;
  1267. color: #333333;
  1268. }
  1269. .distance {
  1270. margin-left: 25rpx;
  1271. font-size: 28rpx;
  1272. color: #303133;
  1273. }
  1274. .location-icon {
  1275. margin-left: 10rpx;
  1276. width: 20rpx;
  1277. height: 26rpx;
  1278. image {
  1279. width: 20rpx;
  1280. height: 26rpx;
  1281. display: inline;
  1282. }
  1283. }
  1284. }
  1285. .address {
  1286. font-size: 26rpx;
  1287. color: #333333;
  1288. margin-top: 33rpx;
  1289. }
  1290. }
  1291. }
  1292. .box-right {
  1293. .img {
  1294. height: 107rpx;
  1295. image {
  1296. width: 107rpx;
  1297. height: 107rpx;
  1298. }
  1299. }
  1300. .called {
  1301. margin-right: 16rpx;
  1302. height: 107rpx;
  1303. line-height: 107rpx;
  1304. font-size: 28rpx;
  1305. color: #CB131C;
  1306. }
  1307. }
  1308. }
  1309. .ewm {
  1310. width: 75rpx;
  1311. height: 75rpx;
  1312. position: absolute;
  1313. right: 10rpx;
  1314. bottom: 200rpx;
  1315. background-color: #fff;
  1316. border-radius: 50%;
  1317. box-shadow: 0 0 10rpx rgba($color: #000000, $alpha: 0.6);
  1318. image {
  1319. width: 50rpx;
  1320. height: 50rpx;
  1321. position: absolute;
  1322. top: 0;
  1323. left: 0;
  1324. bottom: 0;
  1325. right: 0;
  1326. margin: auto;
  1327. }
  1328. .ewm-tit {
  1329. position: absolute;
  1330. bottom: 10rpx;
  1331. font-size: 10rpx;
  1332. }
  1333. .closeEwm {
  1334. width: 40rpx;
  1335. height: 40rpx;
  1336. position: absolute;
  1337. top: -40rpx;
  1338. right: -20rpx;
  1339. image {
  1340. width: 100%;
  1341. height: 100%;
  1342. }
  1343. }
  1344. }
  1345. </style>