index.vue 32 KB

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