lhl hace 3 años
padre
commit
a3a1ffa9cd
Se han modificado 7 ficheros con 273 adiciones y 144 borrados
  1. 36 27
      pages/applic/aed.vue
  2. 31 4
      pages/applic/aid.vue
  3. 44 13
      pages/applic/location.vue
  4. 32 0
      pages/fu/axjz.vue
  5. 113 97
      pages/index/index.vue
  6. 15 1
      pages/user/jkjl.vue
  7. 2 2
      pages/user/user.vue

+ 36 - 27
pages/applic/aed.vue

@@ -1,27 +1,9 @@
 <template>
 	<view class="content">
-		<view id="map" class="map">
-			<map @updated='mapChange' id="map_1" ref='map_1' style="width:750rpx;" :style="{'height': height}"
+		<view class="map">
+			<map @updated='mapChange' ref='map_1' style="width:750rpx;" :style="{'height': height}"
 				:latitude="latitude" :longitude="longitude" :markers="marker" @markertap="lookmore"></map>
 		</view>
-		<!-- <scroll-view scroll-y="true" class="scroll-wrapper" :style="{'height': height}" @scrolltolower="loadData">
-			<espempty v-if="loaded && AEDList.length === 0" :tit="'智能AED列表为空'"></espempty>
-			<view class="list-tpl flex" @click="openAddress(item)" v-for="(item, index) in AEDList" :key="item.id">
-				<template>
-					<view class="list-left">
-						<view class="info">
-							<view class="title">{{ item.name }}</view>
-							<view class="addr">地址:{{ item.install_address }}</view>
-						</view>
-					</view>
-					<view class="image">
-						<image src="../../static/img/img10.png"></image>
-						<view class="tip">{{item.distance >= 1000 ? item.range + 'km': item.distance + 'm'}}</view>
-					</view>
-				</template>
-			</view>
-			<uni-load-more :status="loadingType"></uni-load-more>
-		</scroll-view> -->
 		<uni-popup ref="popup" type="bottom" @click="close">
 			<view class="popup_row">
 				<view class="rows">
@@ -198,10 +180,36 @@
 			getLocal() {
 				let obj = this;
 				console.log('ddddddddddddddddddddddddd')
-				let wxOjb = require('jweixin-module');
-				wxOjb.ready(() => {
-					console.log('加载完毕注册事件');
-					wxOjb.getLocation({
+				let weichatBrowser = uni.getStorageSync('weichatBrowser')
+				if(weichatBrowser) {
+					let wxOjb = require('jweixin-module');
+					wxOjb.ready(() => {
+						console.log('加载完毕注册事件');
+						wxOjb.getLocation({
+							type: 'gcj02',
+							success(e) {
+								console.log(e)
+								obj.latitude = Math.abs(e.latitude)
+								obj.longitude = Math.abs(e.longitude)
+								console.log('本地坐标', obj.latitude, obj.longitude)
+								let item = {
+									id: 0,
+									latitude: obj.latitude,
+									longitude: obj.longitude,
+									iconPath: '/static/img/img19.png',
+									width: '35',
+									height: '35',
+								}
+								obj.marker.push(item)
+								obj.loadData()
+							},
+							fail(err) {
+								obj.getLocal()
+							}
+						})
+					})
+				}else {
+					uni.getLocation({
 						type: 'gcj02',
 						success(e) {
 							console.log(e)
@@ -223,7 +231,8 @@
 							obj.getLocal()
 						}
 					})
-				})
+				}
+				
 				
 			},
 			// 地图渲染完毕事件
@@ -593,7 +602,7 @@
 	.aedxq-wrap {
 		margin: auto;
 		width: 710rpx;
-		height: 462rpx;
+		min-height: 400rpx;
 		border-radius: 20rpx;
 		padding: 0 25rpx;
 		background-color: rgba($color: #000000, $alpha: 0.9);
@@ -603,7 +612,7 @@
 		.xq-top {
 			padding-top: 25rpx;
 			width: 660rpx;
-			height: 297rpx;
+			min-height: 210rpx;
 			border-bottom: 1px solid #fff;
 
 			.aed-name {

+ 31 - 4
pages/applic/aid.vue

@@ -193,9 +193,35 @@
 			getLocal() {
 				let obj = this;
 				console.log('ddddddddddddddddddddddddd')
-				let wxOjb = require('jweixin-module');
-				wxOjb.ready(()=> {
-					wxOjb.getLocation({
+				let weichatBrowser = uni.getStorageSync('weichatBrowser')
+				if(weichatBrowser) {
+					let wxOjb = require('jweixin-module');
+					wxOjb.ready(()=> {
+						wxOjb.getLocation({
+							type: 'gcj02',
+							success(e) {
+								console.log(e)
+								obj.latitude = Math.abs(e.latitude)
+								obj.longitude = Math.abs(e.longitude)
+								console.log('本地坐标', obj.latitude, obj.longitude)
+								let item = {
+									id: 0,
+									latitude: obj.latitude,
+									longitude: obj.longitude,
+									iconPath: '/static/img/img19.png',
+									width: '35',
+									height: '35',
+								}
+								obj.marker.push(item)
+								obj.loadData()
+							},
+							fail(err) {
+								obj.getLocal()
+							}
+						})
+					})
+				}else {
+					uni.getLocation({
 						type: 'gcj02',
 						success(e) {
 							console.log(e)
@@ -217,7 +243,8 @@
 							obj.getLocal()
 						}
 					})
-				})
+				}
+				
 			},
 			// 地图渲染完毕事件
 			mapChange(e) {

+ 44 - 13
pages/applic/location.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="content">
-		<view id="map" class="map">
-			<map @updated='mapChange' id="map_1" ref='map_1' style="width:750rpx; height: 600rpx" :latitude="latitude"
+		<view class="map">
+			<map @updated='mapChange' ref='map_1' style="width:750rpx; height: 600rpx" :latitude="latitude"
 				:longitude="longitude" :markers="marker"></map>
 		</view>
 		<view class="location">
@@ -157,10 +157,45 @@
 			// 获取本地坐标
 			getLocal() {
 				let obj = this;
-				let wxOjb = require('jweixin-module');
-				wxOjb.ready(() => {
-					console.log('加载完毕注册事件');
-					wxOjb.getLocation({
+				
+				let weichatBrowser = uni.getStorageSync('weichatBrowser')
+				if(weichatBrowser) {
+					let wxOjb = require('jweixin-module');
+					wxOjb.ready(() => {
+						console.log('加载完毕注册事件');
+						wxOjb.getLocation({
+							type: 'gcj02',
+							success(e) {
+								console.log(e)
+								obj.latitude = Math.abs(e.latitude)
+								obj.longitude = Math.abs(e.longitude)
+								console.log('本地坐标', obj.latitude, obj.longitude)
+								geocoder({
+									latitude: obj.latitude,
+									longitude: obj.longitude
+								}).then(res => {
+									console.log(res)
+									obj.user_address = res.data.result.address
+									console.log(obj.user_address, 'obj.user_address')
+								})
+								let item = {
+									id: 0,
+									latitude: obj.latitude,
+									longitude: obj.longitude,
+									iconPath: '/static/img/img19.png',
+									width: '35',
+									height: '35',
+								}
+								obj.marker.push(item)
+								obj.getRescuerList(obj.latitude, obj.longitude)
+							},
+							fail(err) {
+								obj.getLocal()
+							}
+						})
+					})
+				}else {
+					uni.getLocation({
 						type: 'gcj02',
 						success(e) {
 							console.log(e)
@@ -190,13 +225,9 @@
 							obj.getLocal()
 						}
 					})
-				})
-				uni.getLocation({
-					type: 'gcj02',
-					success(e) {
-						
-					}
-				})
+				}
+				
+				
 			},
 			// 获取救援者列表
 			getRescuerList(lat, lon) {

+ 32 - 0
pages/fu/axjz.vue

@@ -1,5 +1,10 @@
 <template>
 	<view class="container">
+		<scroll-view class="scroll-list" scroll-x style="margin-bottom: 10rpx;">
+			<view class="scoll-box" v-for="(itemz,indez) in navList" :key="indez" :class="{ active: indez == currentIndex }" @click="tabtap1(itemz,indez)">
+				<view class="scoll-name">{{ itemz.name }}</view>
+			</view>
+		</scroll-view>
 		<scroll-view class="scroll-list" scroll-x>
 			<view class="scoll-box" v-for="(ls,index) in cationList" :key="index" :class="{ active: index === tabCurrentIndex }" @click="tabtap(ls.id,index)">
 				<view class="scoll-name">{{ ls.name }}</view>
@@ -90,6 +95,24 @@
 		},
 		data() {
 			return {
+				currentIndex: 0,
+				navList: [{
+					name: '未帮扶',
+					type: 1
+				},
+				{
+					name: '帮扶中',
+					type: 2
+				},
+				{
+					name: '公示中',
+					type: 3
+				},
+				{
+					name: '已完结',
+					type: 4
+				}
+				],
 				category_id: 0,
 				tabCurrentIndex:0,
 				page: 1, //当前页数
@@ -193,6 +216,15 @@
 				obj.list = [];
 				obj.loadData()
 			},
+			tabtap1(item,index) {
+				console.log(item)
+				this.type = item.type;
+				this.currentIndex = index
+				this.page = 1;
+				this.loadingType = 'more';
+				this.list = [];
+				this.loadData()
+			},
 			toDetail(item) {
 				uni.navigateTo({
 					url: '/pages/fu/fuInfo?id=' + item.id

+ 113 - 97
pages/index/index.vue

@@ -55,7 +55,7 @@
 		<view class="system">
 			<top-title :title="'救在身边'" navurl="/pages/applic/location" :show_more="true"></top-title>
 			<view class="system-map">
-				<map class="map-box" id="map" show-location :markers="jzsbmarker" :scale="scale" :latitude="latitude4"
+				<map class="map-box" show-location :markers="jzsbmarker" :scale="scale" :latitude="latitude4"
 					:longitude="longitude4" ref="map" @markertap="markertap" :show-location="false"></map>
 			</view>
 			<view class="" style="padding-top: 80rpx;">
@@ -92,7 +92,7 @@
 							<view class="img" v-if="item.is_create == 0"  @click="rescue(item,index)">
 								<image src="../../static/img/rescue.png" mode=""></image>
 							</view>
-							<view class="called" v-if="item.is">
+							<view class="called" v-else>
 								已呼叫
 							</view>
 						</view>
@@ -105,7 +105,7 @@
 				<top-title :title="'救护站'" :navurl="'/pages/applic/aid'" :show_more="true"></top-title>
 			</view>
 			<view id="container">
-				<map class="map-box" id="map" show-location :markers="jhzmarker" :scale="scale" :latitude="latitude4"
+				<map class="map-box" show-location :markers="jhzmarker" :scale="scale" :latitude="latitude4"
 					:longitude="longitude4" ref="map" style="height: 450rpx" @markertap="jhzmarkertap" :show-location="false"></map>
 			</view>
 			<view class="">
@@ -133,7 +133,7 @@
 				<top-title :title="'智能AED'" :navurl="'/pages/applic/aed'" :show_more="true"></top-title>
 			</view>
 			<view id="container">
-				<map class="map-box" id="map" show-location :markers="aedmarker" :scale="scale" :latitude="latitude4"
+				<map class="map-box" show-location :markers="aedmarker" :scale="scale" :latitude="latitude4"
 					:longitude="longitude4" ref="map" style="height: 450rpx" @markertap="aedmarkertap" :show-location="false"></map>
 			</view>
 			<view class="">
@@ -192,7 +192,8 @@
 	import {
 		getAed,
 		getAidList,
-		getRescuerList
+		getRescuerList,
+		sos,
 	} from '@/api/category.js'
 	import {
 		loadIndexs,
@@ -231,6 +232,7 @@
 		},
 		data() {
 			return {
+				user_id: '',
 				rescuers_id: '',
 				name: '',
 				uid: '',
@@ -298,24 +300,52 @@
 					}
 				});
 			} else {
+				
 				// this.loadData();
 			}
 		},
 		onLoad() {
+			this.loadIndex()
 			saveUrl();
 			let obj = this;
-			try {
-				let locationAddress;
-				// #ifdef H5
-				let wxOjb = require('jweixin-module');
-				locationAddress = wxOjb.getLocation;
-				// #endif
-				// #ifdef MP
-				locationAddress = uni.getLocation;
-				// #endif
-				// #ifdef H5
-				wxOjb.ready(() => {
-					console.log('加载完毕注册事件');
+			let weichatBrowser = uni.getStorageSync('weichatBrowser')
+			if(weichatBrowser) {
+				try {
+					let locationAddress;
+					// #ifdef H5
+					let wxOjb = require('jweixin-module');
+					locationAddress = wxOjb.getLocation;
+					// #endif
+					// #ifdef MP
+					locationAddress = uni.getLocation;
+					// #endif
+					// #ifdef H5
+					wxOjb.ready(() => {
+						console.log('加载完毕注册事件');
+						locationAddress({
+							type: 'gcj02',
+							success: function(res) {
+								console.log('获取经纬度', res);
+								obj.longitude4 = res.longitude;
+								obj.latitude4 = res.latitude;
+								obj.marker = [{
+									longitude: res.longitude,
+									latitude: res.latitude,
+									iconPath: '/static/img/img19.png',
+									width: '45',
+									height: '45'
+								}];
+								obj.loadData();
+							},
+							fail(e) {
+								console.log('失败', e);
+								// window.location.reload();
+							}
+						});
+					});
+					// #endif
+				
+					// #ifdef MP
 					locationAddress({
 						type: 'gcj02',
 						success: function(res) {
@@ -333,47 +363,38 @@
 						},
 						fail(e) {
 							console.log('失败', e);
-							// window.location.reload();
 							obj.tishi()
 						}
 					});
-				});
-				// #endif
-
-				// #ifdef MP
-				locationAddress({
-					type: 'gcj02',
-					success: function(res) {
-						console.log('获取经纬度', res);
-						obj.longitude4 = res.longitude;
-						obj.latitude4 = res.latitude;
-						obj.marker = [{
-							longitude: res.longitude,
-							latitude: res.latitude,
-							iconPath: '/static/img/img19.png',
-							width: '45',
-							height: '45'
-						}];
-						obj.loadData();
-					},
-					fail(e) {
-						console.log('失败', e);
-						obj.tishi()
-					}
-				});
-				// #endif
-			} catch (e) {
-				let locationAddress;
-				// #ifdef H5
-				let wxOjb = require('jweixin-module');
-				locationAddress = wxOjb.getLocation;
-				// #endif
-				// #ifdef MP
-				locationAddress = uni.getLocation;
-				// #endif
-				// #ifdef H5
-				wxOjb.ready(() => {
-					console.log('加载完毕注册事件');
+					// #endif
+				} catch (e) {
+					let locationAddress;
+					// #ifdef H5
+					let wxOjb = require('jweixin-module');
+					locationAddress = wxOjb.getLocation;
+					// #endif
+					// #ifdef MP
+					locationAddress = uni.getLocation;
+					// #endif
+					// #ifdef H5
+					wxOjb.ready(() => {
+						console.log('加载完毕注册事件');
+						locationAddress({
+							type: 'gcj02',
+							success: function(res) {
+								console.log('获取经纬度', res);
+								obj.longitude4 = res.longitude;
+								obj.latitude4 = res.latitude;
+								obj.loadData();
+							},
+							fail(e) {
+								console.log('失败', e);
+								obj.tishi()
+							}
+						});
+					});
+					// #endif
+					// #ifdef MP
 					locationAddress({
 						type: 'gcj02',
 						success: function(res) {
@@ -387,24 +408,31 @@
 							obj.tishi()
 						}
 					});
-				});
-				// #endif
-				// #ifdef MP
-				locationAddress({
+					// #endif
+				}
+			}else {
+				uni.getLocation({
 					type: 'gcj02',
 					success: function(res) {
 						console.log('获取经纬度', res);
 						obj.longitude4 = res.longitude;
 						obj.latitude4 = res.latitude;
+						obj.marker = [{
+							longitude: res.longitude,
+							latitude: res.latitude,
+							iconPath: '/static/img/img19.png',
+							width: '45',
+							height: '45'
+						}];
 						obj.loadData();
 					},
 					fail(e) {
 						console.log('失败', e);
-						obj.tishi()
+						// window.location.reload();
 					}
-				});
-				// #endif
+				})
 			}
+			
 		},
 		computed: {
 			...mapState('user', ['userInfo', 'baseURL', 'hasLogin']),
@@ -416,6 +444,14 @@
 		// },
 		methods: {
 			...mapMutations('user', ['setUserInfo']),
+			loadIndex() {
+				loadIndexs({}).then(({
+					data
+				}) => {
+					console.log(data,'index')
+					this.carouselList = data.banner; //轮播图
+				});
+			},
 			tocontribution() {
 				uni.navigateTo({
 					// url: "/pages/applic/contribution"
@@ -543,18 +579,8 @@
 					data
 				}) => {
 					obj.setUserInfo(data);
-					loadIndexs({}).then(({
-						data
-					}) => {
-						console.log(data,'index')
-						obj.carouselList = data.banner; //轮播图
-						bannerlist().then(({
-							data
-						}) => {
-							console.log(data);
-							obj.science = data;
-						});
-					});
+					obj.to_phone = data.mobile || ''
+					
 				});
 				if (obj.loadingType === 'noMore') {
 					//防止重复加载
@@ -695,20 +721,20 @@
 					content: '是否发起求救?',
 					success: res => {
 						if (res.confirm) {
-							this.$refs.popup.open(item, index);
+							this.$refs.popup2.open(item, index);
 							obj.rescuers_id = item.id
 							obj.user_id = item.user_id
 						}
 					}
 				})
 			},
+			close2() {
+				this.$refs.popup2.close()
+			},
 			comfirm1: function() {
 				let obj = this
 				if (obj.to_phone.toString().trim() == '') {
-					// uni.showModal({
-					// 	title:'输入框为空',
-					// 	// content:JSON.stringify(obj)
-					// })
+					return obj.$api.msg('请输入手机号码')
 				} else {
 					console.log('obj.to_phone1111', obj.to_phone)
 					const reg = /^(\+?0?86-?)?1[\d]\d{9}$/;
@@ -716,22 +742,14 @@
 						obj.$api.msg('请填写正确的手机号码');
 						return;
 					}
-					console.log('name:', obj.name)
-					console.log('uid:', obj.uid)
-					console.log('phone', obj.phone)
-					console.log('to_phone', obj.to_phone)
-					console.log('longitude', obj.longitude)
-					console.log('latitude', obj.latitude)
-					console.log('iscall', obj.iscall)
-					tocall({
-						name: obj.name,
-						uid: obj.uid,
-						phone: obj.phone,
-						longitude: obj.longitude4,
-						latitude: obj.latitude4,
-						to_phone: obj.to_phone
-					}).then((data) => {
-						console.log(99988, data)
+					sos({
+						mobile: obj.to_phone,
+						address: obj.user_address,
+						latitude: obj.latitude,
+						longitude: obj.longitude,
+						rescuers_id: obj.rescuers_id,
+						rescuers_user_id: obj.user_id
+					}).then(res => {
 						uni.showModal({
 							title: '请耐心等待救援',
 							success: res => {
@@ -741,8 +759,6 @@
 							}
 						})
 						obj.$refs.popup2.close();
-						obj.iscall = false
-						console.log(123, obj.iscall)
 					})
 				}
 			},

+ 15 - 1
pages/user/jkjl.vue

@@ -3,7 +3,7 @@
 		<view class="jg" style="height: 20rpx;">
 			
 		</view>
-		<view class="love-item" v-for="item in list" :key="item.id">
+		<view class="love-item" v-for="item in list" :key="item.id" @click="navto(item)">
 			<view class="">
 				证书编号:{{item.SN}}
 			</view>
@@ -53,6 +53,16 @@
 			this.getMyloveList()
 		},
 		methods:{
+			navto(item) {
+				let date = new Date(item.paytime*1000)
+				let year = date.getFullYear()
+				let month = date.getMonth() >= 9 ? date.getMonth() + 1 : '0' + (date
+					.getMonth() + 1)
+				let day = date.getDate() >= 10 ? date.getDate() : '0' + date.getDate()
+				uni.navigateTo({
+					url: '/pages/form/donaSuccess?money=' + item.amount + '&name=' + item.contact + '&time=' + year + '年' + month + '月' + day + '日' 
+				})
+			},
 			getMyloveList() {
 				let obj = this
 				getMyloveList({
@@ -78,5 +88,9 @@
 	.love-item {
 		padding: 10rpx;
 		margin-bottom: 20rpx;
+		width: 700rpx;
+		margin: auto;
+		border-radius: 20rpx;
+		box-shadow: 0px 0px 5rpx rgba($color: #fa7e67, $alpha: 0.6);
 	}
 </style>

+ 2 - 2
pages/user/user.vue

@@ -39,7 +39,7 @@
 					>
 				</view>
 			</view>
-			<!-- <view class="nav-item flex" @click="tojkjl">
+			<view class="nav-item flex" @click="tojkjl">
 				<view class="item-left flex">
 					<image src="../../static/icon/i6.png" mode="" class="img1"></image>
 					<view class="title">捐款记录</view>
@@ -47,7 +47,7 @@
 				<view class="item-right">
 					>
 				</view>
-			</view> -->
+			</view>
 			<view class="nav-item flex" @click="commonaddress">
 				<view class="item-left flex">
 					<image src="../../static/icon/i8.png" mode="" class="img3"></image>