index.vue 32 KB

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