index.vue 33 KB

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