index.vue 30 KB

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