index.vue 32 KB

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