index.vue 30 KB

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