index.vue 32 KB

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