index.vue 32 KB

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