index.vue 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295
  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" 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 :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 = 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. });
  640. },
  641. // 导航
  642. openAddress(item) {
  643. let obj = this;
  644. obj.latitude2 = item.latitude;
  645. obj.longitude2 = item.longitude;
  646. obj.address = item.address;
  647. this.$refs.popup.open();
  648. },
  649. Jump(item) {
  650. // console.log(item);
  651. if (item.url != '') {
  652. window.open(item.url);
  653. return;
  654. }
  655. uni.navigateTo({
  656. url: '/pages/applic/info?id=' + item.id
  657. });
  658. },
  659. open() {
  660. this.$refs.popup.open();
  661. },
  662. close() {
  663. this.$refs.popup.close();
  664. },
  665. navTo(url) {
  666. uni.navigateTo({
  667. url
  668. });
  669. },
  670. space(lat1, lng1, lat2, lng2) {
  671. console.log(lat1, lng1, lat2, lng2);
  672. var radLat1 = (lat1 * Math.PI) / 180.0;
  673. var radLat2 = (lat2 * Math.PI) / 180.0;
  674. var a = radLat1 - radLat2;
  675. var b = (lng1 * Math.PI) / 180.0 - (lng2 * Math.PI) / 180.0;
  676. var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math
  677. .pow(Math.sin(b / 2), 2)));
  678. s = s * 6378.137;
  679. s = Math.round(s * 10000) / 10000;
  680. return s * 1000; // 单位米
  681. },
  682. // 立即救援
  683. rescue(item, index) {
  684. let obj = this;
  685. uni.showModal({
  686. content: '是否发起求救?',
  687. success: res => {
  688. if (res.confirm) {
  689. this.$refs.popup2.open(item, index);
  690. obj.name = item.name;
  691. obj.uid = item.uid;
  692. obj.phone = item.phone;
  693. obj.iscall = false
  694. console.log('点击救援时item.phone:', obj.phone)
  695. }
  696. }
  697. })
  698. },
  699. comfirm1: function() {
  700. let obj = this
  701. if (obj.to_phone.toString().trim() == '') {
  702. // uni.showModal({
  703. // title:'输入框为空',
  704. // // content:JSON.stringify(obj)
  705. // })
  706. } else {
  707. console.log('obj.to_phone1111', obj.to_phone)
  708. const reg = /^(\+?0?86-?)?1[\d]\d{9}$/;
  709. if (!reg.test(obj.to_phone)) {
  710. obj.$api.msg('请填写正确的手机号码');
  711. return;
  712. }
  713. console.log('name:', obj.name)
  714. console.log('uid:', obj.uid)
  715. console.log('phone', obj.phone)
  716. console.log('to_phone', obj.to_phone)
  717. console.log('longitude', obj.longitude)
  718. console.log('latitude', obj.latitude)
  719. console.log('iscall', obj.iscall)
  720. tocall({
  721. name: obj.name,
  722. uid: obj.uid,
  723. phone: obj.phone,
  724. longitude: obj.longitude,
  725. latitude: obj.latitude,
  726. to_phone: obj.to_phone
  727. }).then((data) => {
  728. console.log(99988, data)
  729. uni.showModal({
  730. title: '请耐心等待救援',
  731. success: res => {
  732. if (res.confirm) {
  733. window.location.reload(); //重新刷新页面
  734. }
  735. }
  736. })
  737. obj.$refs.popup2.close();
  738. obj.iscall = false
  739. console.log(123, obj.iscall)
  740. })
  741. }
  742. },
  743. }
  744. };
  745. </script>
  746. <style lang="scss">
  747. a {
  748. text-decoration: none;
  749. color: #5f5f5f;
  750. }
  751. .content {
  752. // line-height: 1;
  753. background-color: #ffabab;
  754. // padding-bottom: 60rpx;
  755. }
  756. .popup_row {
  757. width: 100%;
  758. height: 500rpx;
  759. background-color: #ffffff;
  760. border-radius: 20rpx;
  761. display: flex;
  762. justify-content: center;
  763. align-items: center;
  764. .rows {
  765. width: 100%;
  766. padding: 0 24rpx;
  767. .rows-item {
  768. height: 80rpx;
  769. line-height: 80rpx;
  770. text-align: center;
  771. width: 100%;
  772. font-size: 32rpx;
  773. color: #303133;
  774. // border-bottom: 1rpx solid #f0f0f0;
  775. }
  776. // .row-1 {
  777. // margin: auto;
  778. // .first_aid {
  779. // width: 300rpx;
  780. // height: 300rpx;
  781. // }
  782. // }
  783. // .row-2 {
  784. // font-size: 38rpx;
  785. // margin-top: 20rpx;
  786. // }
  787. }
  788. }
  789. .content {
  790. background-color: #f8f8f8;
  791. height: 100%;
  792. /* 头部 轮播图 */
  793. .carousel-section {
  794. // padding-top: 10px;
  795. overflow: hidden;
  796. background-color: #fff;
  797. .carousel {
  798. width: 690rpx;
  799. height: 320rpx;
  800. border-radius: 30rpx;
  801. margin: 0 auto;
  802. .carousel-item {
  803. width: 100%;
  804. height: 100%;
  805. padding-left: 30rpx;
  806. padding-right: 30rpx;
  807. overflow: hidden;
  808. }
  809. image {
  810. width: 100%;
  811. height: 320rpx;
  812. border-radius: 30rpx;
  813. }
  814. }
  815. }
  816. // 红会科普
  817. .science-section {
  818. width: 100%;
  819. background-color: #ffffff;
  820. margin-top: 18rpx;
  821. padding-top: 30rpx;
  822. .science-title {
  823. display: flex;
  824. justify-content: center;
  825. align-items: center;
  826. padding-bottom: 22rpx;
  827. .title {
  828. width: 285rpx;
  829. height: 64rpx;
  830. background-color: #ca121e;
  831. border-radius: 32rpx;
  832. color: #ffffff;
  833. font-size: 32rpx;
  834. line-height: 64rpx;
  835. text-align: center;
  836. }
  837. image {
  838. width: 68rpx;
  839. height: 43rpx;
  840. margin-left: 16rpx;
  841. margin-right: 16rpx;
  842. }
  843. }
  844. .science-box {
  845. padding-left: 15rpx;
  846. padding-right: 15rpx;
  847. padding-bottom: 20rpx;
  848. border-bottom: 1rpx solid #f0f0f0;
  849. white-space: nowrap;
  850. display: flex;
  851. width: 100%;
  852. // .uni-scroll-view-content{
  853. // display: flex;
  854. // }
  855. .science-content {
  856. // width: 100%;
  857. // display: flex;
  858. display: -webkit-box;
  859. .science-item {
  860. margin-right: 24rpx;
  861. width: 198rpx;
  862. display: flex;
  863. flex-direction: column;
  864. align-items: center;
  865. text-align: center;
  866. image {
  867. width: 100%;
  868. height: 145rpx;
  869. }
  870. .article-title {
  871. width: 198rpx;
  872. color: #333;
  873. font-size: 25rpx;
  874. padding-top: 20rpx;
  875. padding-bottom: 16rpx;
  876. font-weight: 900;
  877. }
  878. .article-content {
  879. width: 198rpx;
  880. color: #999999;
  881. font-size: 18rpx;
  882. overflow: hidden;
  883. text-overflow: ellipsis;
  884. display: -webkit-box;
  885. word-break: break-all;
  886. -webkit-box-orient: vertical;
  887. -webkit-line-clamp: 2;
  888. }
  889. }
  890. }
  891. }
  892. .science-more {
  893. display: flex;
  894. justify-content: center;
  895. align-items: center;
  896. color: #cb131c;
  897. font-size: 30rpx;
  898. padding-top: 18rpx;
  899. padding-bottom: 18rpx;
  900. image {
  901. width: 20rpx;
  902. height: 27rpx;
  903. }
  904. }
  905. }
  906. // sos急救中心
  907. .system {
  908. width: 100%;
  909. background-color: #ffffff;
  910. margin-top: 18rpx;
  911. padding: 40rpx 30rpx 35rpx 30rpx;
  912. margin-bottom: 20rpx;
  913. .system-map {
  914. margin: 30rpx auto 0;
  915. width: 689rpx;
  916. height: 312rpx;
  917. background-color: #ffffff;
  918. // padding: 0 30rpx;
  919. padding-bottom: 45rpx;
  920. // .map-box {
  921. // width: 100%;
  922. // height: 312rpx;
  923. // // background-color: #fff;
  924. // }
  925. }
  926. }
  927. // AED
  928. .list-box {
  929. padding: 0rpx 25rpx 24rpx;
  930. // margin-bottom: 84rpx;
  931. background-color: #fff;
  932. .system-title {
  933. display: flex;
  934. justify-content: flex-start;
  935. align-items: center;
  936. height: 130rpx;
  937. // padding-bottom: 22rpx;
  938. background-color: #ffffff;
  939. .title {
  940. width: 285rpx;
  941. height: 64rpx;
  942. background-color: #ca121e;
  943. border-radius: 32rpx;
  944. color: #ffffff;
  945. font-size: 32rpx;
  946. line-height: 64rpx;
  947. text-align: center;
  948. }
  949. .img {
  950. width: 68rpx;
  951. height: 43rpx;
  952. margin-left: 16rpx;
  953. margin-right: 16rpx;
  954. image {
  955. width: 68rpx;
  956. height: 43rpx;
  957. }
  958. }
  959. }
  960. }
  961. .map-box {
  962. // background-color: #FFFFFF;
  963. width: 100%;
  964. height: 366rpx;
  965. // border: 2rpx solid #F2F2F2;
  966. box-shadow: 5px 15px 15px 5px #f2f2f2;
  967. }
  968. .list-tpl {
  969. background-color: #ffffff;
  970. margin: 25rpx 0rpx;
  971. padding: 25rpx 25rpx;
  972. font-size: 28rpx;
  973. border-radius: 15rpx;
  974. display: flex;
  975. justify-content: space-between;
  976. align-items: center;
  977. border-bottom: 1px solid #f1f1f1;
  978. .list-left {
  979. display: flex;
  980. width: 100%;
  981. .number {
  982. font-size: 32rpx;
  983. margin-right: 14rpx;
  984. }
  985. .info {
  986. width: 100%;
  987. .title {
  988. font-size: 32rpx;
  989. color: #222222;
  990. font-weight: 500;
  991. }
  992. .addr {
  993. width: 400rpx;
  994. margin-top: 20rpx;
  995. font-size: 20rpx;
  996. font-family: PingFang SC;
  997. font-weight: 500;
  998. color: #999999;
  999. }
  1000. }
  1001. }
  1002. .image {
  1003. width: 10%;
  1004. text-align: center;
  1005. image {
  1006. width: 50rpx;
  1007. height: 50rpx;
  1008. }
  1009. .tip {
  1010. color: #7f7f7f;
  1011. font-size: 21rpx;
  1012. }
  1013. }
  1014. }
  1015. }
  1016. .red-box {
  1017. margin: 20rpx 0;
  1018. // height: 393rpx;
  1019. padding: 30rpx 30rpx 40rpx 30rpx;
  1020. background-color: #fff;
  1021. .red-nav {
  1022. padding-top: 25rpx;
  1023. display: flex;
  1024. justify-content: space-between;
  1025. .nav-item {
  1026. width: 330rpx;
  1027. height: 175rpx;
  1028. background: #FFF4F2;
  1029. border-radius: 15rpx;
  1030. image {
  1031. width: 330rpx;
  1032. height: 175rpx;
  1033. }
  1034. }
  1035. }
  1036. }
  1037. // 分类
  1038. .cate-section {
  1039. justify-content: space-around;
  1040. background-color: #fff;
  1041. padding: 0rpx 0 30rpx;
  1042. .cate-item {
  1043. flex-grow: 0;
  1044. width: 25%;
  1045. flex-direction: column;
  1046. text-align: center;
  1047. align-items: center;
  1048. justify-content: center;
  1049. .img-wrapper {
  1050. width: 149rpx;
  1051. height: 149rpx;
  1052. background: #FFFFFF;
  1053. // box-shadow: 0rpx 0rpx 16rpx 2rpx rgba(255, 124, 177, 0.11);
  1054. border-radius: 20rpx;
  1055. position: relative;
  1056. image {
  1057. width: 149rpx;
  1058. height: 149rpx;
  1059. position: absolute;
  1060. left: 50%;
  1061. top: 50%;
  1062. transform: translate(-50%, -50%);
  1063. }
  1064. }
  1065. .item-title {
  1066. // margin-top: 15rpx;
  1067. font-size: 24rpx;
  1068. font-family: PingFang SC;
  1069. font-weight: 500;
  1070. color: #333333;
  1071. }
  1072. }
  1073. }
  1074. .location-item {
  1075. z-index: 1000;
  1076. display: flex;
  1077. justify-content: space-between;
  1078. align-items: center;
  1079. border-bottom: 1rpx solid #E7E8EA;
  1080. padding: 15rpx 0;
  1081. .box-left {
  1082. display: flex;
  1083. .img01 {
  1084. width: 8rpx;
  1085. height: 28rpx;
  1086. margin-right: 18rpx;
  1087. image {
  1088. width: 8rpx;
  1089. height: 28rpx;
  1090. }
  1091. }
  1092. .img02 {
  1093. width: 117rpx;
  1094. height: 117rpx;
  1095. border-radius: 50%;
  1096. image {
  1097. width: 117rpx;
  1098. height: 117rpx;
  1099. border-radius: 50%;
  1100. }
  1101. }
  1102. .info {
  1103. margin-left: 16rpx;
  1104. .info-header {
  1105. display: flex;
  1106. align-items: center;
  1107. .name {
  1108. font-size: 32rpx;
  1109. color: #333333;
  1110. }
  1111. .distance {
  1112. margin-left: 25rpx;
  1113. font-size: 28rpx;
  1114. color: #303133;
  1115. }
  1116. .location-icon {
  1117. margin-left: 10rpx;
  1118. width: 20rpx;
  1119. height: 26rpx;
  1120. image {
  1121. width: 20rpx;
  1122. height: 26rpx;
  1123. display: inline;
  1124. }
  1125. }
  1126. }
  1127. .address {
  1128. font-size: 26rpx;
  1129. color: #333333;
  1130. margin-top: 33rpx;
  1131. }
  1132. }
  1133. }
  1134. .box-right {
  1135. .img {
  1136. height: 107rpx;
  1137. image {
  1138. width: 107rpx;
  1139. height: 107rpx;
  1140. }
  1141. }
  1142. .called {
  1143. margin-right: 16rpx;
  1144. height: 107rpx;
  1145. line-height: 107rpx;
  1146. font-size: 28rpx;
  1147. color: #CB131C;
  1148. }
  1149. }
  1150. }
  1151. .popup_row2 {
  1152. // margin-top: 108rpx;
  1153. height: 440rpx;
  1154. border-radius: 25rpx;
  1155. width: 100%;
  1156. padding: 24rpx;
  1157. background-color: #f8f8f8;
  1158. z-index: 999;
  1159. .title {
  1160. border-bottom: 2rpx solid #F2F2F2;
  1161. color: #E63931;
  1162. font-size: 32rpx;
  1163. padding-left: 4rpx;
  1164. padding-bottom: 16rpx;
  1165. display: flex;
  1166. justify-content: space-between;
  1167. // align-items: center;
  1168. .cancel {
  1169. margin-left: 52rpx;
  1170. width: 36rpx;
  1171. height: 36rpx;
  1172. image {
  1173. width: 36rpx;
  1174. height: 36rpx;
  1175. }
  1176. }
  1177. }
  1178. .inpBox {
  1179. margin-top: 52rpx;
  1180. border: 2px solid #f2f2f2;
  1181. padding: 12rpx 24rpx;
  1182. color: #FF9797;
  1183. border-radius: 8rpx;
  1184. .input-placeholder {
  1185. // height: 70rpx;
  1186. font-size: 32rpx;
  1187. color: #FF9797;
  1188. }
  1189. }
  1190. .inpedit {
  1191. margin-top: 24rpx;
  1192. margin-left: 14rpx;
  1193. font-size: 28rpx;
  1194. color: #FF9797;
  1195. }
  1196. .comfirm {
  1197. display: flex;
  1198. justify-content: flex-end;
  1199. margin-top: 54rpx;
  1200. .comfirm1 {
  1201. padding: 12rpx 24rpx;
  1202. border-radius: 12rpx;
  1203. color: #FFFFFF;
  1204. background-color: #E63931;
  1205. }
  1206. }
  1207. }
  1208. </style>