index.vue 31 KB

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