index.vue 30 KB

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