index.vue 33 KB

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