index.vue 32 KB

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