index.vue 34 KB

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