index.vue 31 KB

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