index.vue 36 KB

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