index.vue 34 KB

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