index.vue 30 KB

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