index.vue 34 KB

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