index.vue 34 KB

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