浏览代码

add token

lhl 2 年之前
父节点
当前提交
26a331b74c
共有 11 个文件被更改,包括 960 次插入246 次删除
  1. 8 1
      api/index.js
  2. 14 1
      pages.json
  3. 1 1
      pages/applic/aid.vue
  4. 557 0
      pages/applic/yz.vue
  5. 157 145
      pages/category/category.vue
  6. 175 71
      pages/index/index.vue
  7. 38 16
      pages/login/login.vue
  8. 10 11
      pages/login/register.vue
  9. 二进制
      static/icon/img03.png
  10. 二进制
      static/icon/img04.png
  11. 二进制
      static/icon/yz.png

+ 8 - 1
api/index.js

@@ -182,5 +182,12 @@ export function deleteList(data) {
   data
  });
 }
-
+//获取驿站(机构)
+export function getListMechanism(data) {
+	return request({
+		url: '/api/mechanism',
+		method: 'get',
+		data
+	});
+}
 

+ 14 - 1
pages.json

@@ -193,6 +193,19 @@
 				"navigationBarTitleText": "附近救护站"
 			}
 		},
+		{
+			"path": "pages/applic/yz",
+			"style": {
+				// #ifndef MP
+				"app-plus": {
+					"titleNView": false
+				},
+				// #endif
+				"navigationBarBackgroundColor": "#457DBF",
+				"navigationBarTextStyle": "white",
+				"navigationBarTitleText": "附近博爱驿站"
+			}
+		},
 		{
 			"path": "pages/applic/tocontrilist",
 			"style": {
@@ -692,7 +705,7 @@
 	],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",
-		"navigationBarTitleText": "uni-app",
+		"navigationBarTitleText": "武汉市江夏区红十字会",
 		"navigationBarBackgroundColor": "#FFFFFF",
 		"backgroundColor": "#F8F8F8"
 	},

+ 1 - 1
pages/applic/aid.vue

@@ -5,7 +5,7 @@
 				:longitude="longitude" :markers="jhzmarker"></map>
 		</view>
 		<scroll-view scroll-y="true" class="scroll-wrapper" :style="{'height': height}" @scrolltolower="loadData">
-			<espempty v-if="loaded && AEDList.length === 0" :tit="'救护站列表为空'"></espempty>
+			<espempty v-if="loaded && AEDList.length === 0" :tit="'列表为空'"></espempty>
 			<view class="list-tpl flex" @click="openAddress(item)" v-for="(item, index) in AEDList" :key="item.id">
 				<template>
 					<view class="list-left">

+ 557 - 0
pages/applic/yz.vue

@@ -0,0 +1,557 @@
+<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"
+				:longitude="longitude" :markers="aedmarker"></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.detailed_address }}</view>
+						</view>
+					</view>
+					<view class="image">
+						<image src="../../static/img/img10.png"></image>
+						<view class="tip" v-if="item.space > 999">>999m</view>
+						<view class="tip" v-else>{{ item.space }}m</view>
+					</view>
+				</template>
+			</view>
+			<uni-load-more :status="loadtype"></uni-load-more>
+		</scroll-view>
+		<uni-popup ref="popup" type="bottom" @click="close">
+			<view class="popup_row">
+				<view class="rows">
+					<view class="rows-item" @click="toGaodeMap">高德地图</view>
+					<!-- <view class="rows-item" @click="tobaiDuMap">百度地图</view> -->
+					<view class="rows-item" @click="totengxunMap">腾讯地图</view>
+				</view>
+			</view>
+		</uni-popup>
+	</view>
+</template>
+
+<script>
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex';
+	import espempty from '@/components/espempty';
+	import uniPopup from '@/components/uni-popup/uni-popup.vue';
+	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
+	import {
+		getdis,
+		tocall,
+		getListMechanism
+	} from '@/api/index.js';
+	import {
+		userinfo
+	} from '@/api/user.js';
+	import {
+		getcomAddress
+	} from '@/api/index.js';
+	export default {
+		components: {
+			uniPopup,
+			espempty,
+			uniLoadMore
+		},
+		//相关配置参数
+		data() {
+			return {
+				aedmarker: [],
+				loaded: false,
+				loadtype: 'more',
+				page: 1,
+				limit: 1000,
+				AEDList: [],
+				height: '',
+				list: [],
+				latitude:"",
+				longitude: "",
+				current: 0,
+				name: '',
+				uid: '',
+				name: '',
+				phone: '',
+				to_phone: '',
+				marker: [],
+				specificAdd: '',
+				addressData: {
+					name: '',
+					mobile: '',
+					latitude: 0, //纬度
+					longitude: 0, //经度
+					address: {
+						province: '',
+						city: '',
+						district: '',
+						detail: '',
+					},
+					area: '',
+					default: false
+				},
+			}
+		},
+		onReady(res) {
+			var _this = this;
+			uni.getSystemInfo({
+				success: resu => {
+					const query = uni.createSelectorQuery();
+					query.select('.scroll-wrapper').boundingClientRect();
+					query.exec(function(res) {
+						console.log(res, 'ddddddddddddd');
+						_this.height = resu.windowHeight - res[0].top + 'px';
+						console.log('打印页面的剩余高度', _this.height);
+					});
+				},
+				fail: res => {}
+			});
+		},
+		onLoad() {
+			let obj = this;
+			console.log('开始加载事件');
+			// obj.loadBaseData();
+			// obj.loadData();
+			try {
+				let locationAddress
+				// #ifdef H5
+				let wxOjb = require('jweixin-module');
+				locationAddress = wxOjb.getLocation;
+				// #endif
+				// #ifdef MP
+				locationAddress = uni.getLocation;
+				// #endif
+				wxOjb.ready(() => {
+					console.log('加载完毕注册事件');
+					locationAddress({
+						type: 'gcj02',
+						success: function(res) {
+							console.log('获取经纬度', res);
+							obj.longitude = res.longitude
+							obj.latitude = res.latitude
+							obj.marker = [{
+								latitude: obj.latitude,
+								longitude: obj.longitude,
+								iconPath: '/static/img/img19.png',
+								width: '45',
+								height: '45',
+							}, ]
+							obj.loadData();
+						},
+						fail(e) {
+							console.log('失败', e);
+							window.location.reload();
+						}
+					});
+				})
+
+			} catch (e) {
+				console.log(e);
+				let locationAddress
+				// #ifdef H5
+				let wxOjb = require('jweixin-module');
+				locationAddress = wxOjb.getLocation;
+				// #endif
+				// #ifdef MP
+				locationAddress = uni.getLocation;
+				// #endif
+				wxOjb.ready(() => {
+					console.log('加载完毕注册事件');
+
+					locationAddress({
+						type: 'gcj02',
+						success: function(res) {
+							console.log('获取经纬度1', res);
+							obj.longitude = res.longitude
+							obj.latitude = res.latitude
+							obj.loadData();
+						},
+						fail(e) {
+							console.log('失败', e);
+						}
+					});
+				})
+
+			}
+		},
+		computed: {
+			...mapState('user', ['hasLogin', 'userInfo'])
+		},
+		methods: {
+			...mapMutations('user', ['setUserInfo']),
+			// 地图渲染完毕事件
+			mapChange(e) {
+				console.log(e);
+			},
+			// 载入数据
+			async loadData() {
+				let obj = this;
+				if(obj.loadtype == 'loading' || obj.loadtype == 'noMore') {
+					return 
+				}
+				obj.loadtype = 'loading'
+				getListMechanism({
+					page: obj.page,
+					limit: obj.limit,
+				}).then(({data}) => {
+					console.log(data, 999);
+					for (let i = 0; i < data.length; i++) {
+						data[i].space = obj.space(obj.latitude, obj.longitude, data[i].latitude, data[i].longitude);
+					}
+					let arr1 = data.sort(obj.sortBy('space')) 
+					obj.AEDList = obj.AEDList.concat(data);
+					console.log(obj.AEDList, 'obj.AEDList+++++++');
+					let arr = data.map(item => ({
+						latitude: item.latitude,
+						longitude: item.longitude,
+						iconPath: '/static/icon/yz.png',
+						width: '35',
+						height: '35',
+						id: item.id,
+						address: item.address
+					}));
+					obj.aedmarker = obj.marker.concat(arr)
+					// obj.markerList = data;
+					obj.loaded = true
+					obj.page++;
+					if (obj.limit == data.length) {
+						obj.loadtype = 'more';
+						
+					} else {
+						obj.loadtype = 'noMore';
+					}
+				})
+			},
+			sortBy(field) {
+				//根据传过来的字段进行排序,y-x 得分从高到低,x-y 从低到高
+				return (x, y) => {
+					return x[field] - y[field]
+				}
+			},
+			space(lat1, lng1, lat2, lng2) {
+				console.log(lat1, lng1, lat2, lng2);
+				var radLat1 = (lat1 * Math.PI) / 180.0;
+				var radLat2 = (lat2 * Math.PI) / 180.0;
+				var a = radLat1 - radLat2;
+				var b = (lng1 * Math.PI) / 180.0 - (lng2 * Math.PI) / 180.0;
+				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)));
+				s = s * 6378.137;
+				s = Math.round(s * 10000) / 10000;
+				return s * 1000; // 单位米
+			},
+			openAddress(item) {
+				let obj = this;
+				obj.latitude2 = item.latitude;
+				obj.longitude2 = item.longitude;
+				obj.address = item.detailed_address;
+				this.$refs.popup.open();
+			},
+			// 调用高德
+			toGaodeMap() {
+				let latitude = this.latitude2;
+				let longitude = this.longitude2;
+				let address = this.address;
+				console.log('选择高德', latitude, longitude, address);
+				window.location.href = `https://uri.amap.com/marker?position=${longitude},${latitude}&name=${address}`;
+			},
+			// 调用腾讯
+			totengxunMap() {
+				let latitude = this.latitude2;
+				let longitude = this.longitude2;
+				let address = this.address;
+				console.log('选择腾讯', latitude, longitude);
+				window.location.href = `http://apis.map.qq.com/uri/v1/marker?marker=coord:${latitude},${longitude};addr:${address}`;
+			},
+			// 调用百度
+			tobaiDuMap() {
+				let latitude = this.latitude2;
+				let longitude = this.longitude2;
+				let latitude6 = this.latitude;
+				let longitude6 = this.longitude;
+				let address = this.address;
+				console.log('选择百度', latitude, longitude);
+				console.log('获取当前经纬度', latitude6, longitude6);
+				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`;
+				//`bdapp://map/navi?location=${longitude},${latitude}&coord_type=gc02&title=${address}&content=${address}&output=html&src=andr.baidu.openAPIdemo `
+			},
+			
+		}
+	}
+</script>
+
+<style lang="scss">
+	body,
+	page {
+		height: 100%;
+		width: 100%;
+		background-color: #fff;
+	}
+
+	.content {
+		height: 100%;
+		width: 100%;
+		background-color: #fff;
+	}
+
+	.map {
+		width: 100%;
+		height: 600rpx;
+	}
+
+	/* #ifdef H5 */
+	.location {
+		overflow-y: scroll; //溢出就滑动起来
+		// z-index: 990;
+		position: fixed;
+		bottom: 0;
+		height: 55%;
+		width: 100%;
+		background-color: #fff;
+		padding: 24rpx;
+
+		//搜索框
+		.Search-box {
+			// z-index: 999;
+			height: 80rpx;
+			// position: fixed;
+			// 		top: 0;
+			// 		left: 0;
+			// 		width: 100%;
+			// background: #FFFFFF;
+			// padding-top: 10rpx;
+			padding-right: 24rpx;
+			padding-left: 24rpx;
+
+			.Search-box-sort {
+				float: left;
+				margin-left: 32rpx;
+				margin-right: 19rpx;
+
+				.sort-text {
+					width: 57rpx;
+					height: 29rpx;
+					font-size: 30rpx;
+					font-weight: 500;
+					color: rgba(51, 51, 51, 1);
+					line-height: 58rpx;
+					margin-right: 19rpx;
+				}
+
+				.sort-img {
+					width: 21rpx;
+					height: 11rpx;
+					margin-bottom: 4rpx;
+				}
+			}
+
+			.Search-box-size {
+				// width:70%;
+				height: 58rpx;
+				border-radius: 32rpx;
+				background-color: #f1f1f1;
+				padding-left: 36rpx;
+				display: flex;
+				align-items: center;
+
+				.box-img {
+					height: 32rpx;
+					width: 32rpx;
+					margin-right: 16rpx;
+				}
+
+				// .box-right{
+				// 	height: 58rpx;
+				// 	// width: 100%;
+				// 	background-color: pink;
+				// }
+
+				.box-word {
+					width: 100%;
+					font-size: 26rpx;
+					font-weight: 500;
+					color: rgba(205, 203, 203, 1);
+					line-height: 55rpx;
+				}
+			}
+		}
+
+		.location-item {
+			z-index: 1000;
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			border-bottom: 1rpx solid #E7E8EA;
+			padding: 15rpx 0;
+
+			.box-left {
+				display: flex;
+
+				.img01 {
+					width: 8rpx;
+					height: 28rpx;
+					margin-right: 18rpx;
+
+					image {
+						width: 8rpx;
+						height: 28rpx;
+					}
+				}
+
+				.img02 {
+					width: 117rpx;
+					height: 117rpx;
+					border-radius: 50%;
+
+					image {
+						width: 117rpx;
+						height: 117rpx;
+						border-radius: 50%;
+					}
+				}
+
+				.info {
+					margin-left: 16rpx;
+
+					.info-header {
+						display: flex;
+						align-items: center;
+
+						.name {
+							font-size: 32rpx;
+							color: #333333;
+						}
+
+						.distance {
+							margin-left: 25rpx;
+							font-size: 28rpx;
+							color: #303133;
+						}
+
+						.location-icon {
+							margin-left: 10rpx;
+							width: 20rpx;
+							height: 26rpx;
+
+							image {
+								width: 20rpx;
+								height: 26rpx;
+								display: inline;
+							}
+						}
+					}
+
+					.address {
+						font-size: 26rpx;
+						color: #333333;
+						margin-top: 33rpx;
+					}
+				}
+			}
+
+			.box-right {
+				.img {
+					height: 107rpx;
+
+					image {
+						width: 107rpx;
+						height: 107rpx;
+					}
+				}
+
+				.called {
+					margin-right: 16rpx;
+					height: 107rpx;
+					line-height: 107rpx;
+					font-size: 28rpx;
+					color: #CB131C;
+				}
+			}
+		}
+	}
+
+	/* #endif */
+
+	.list-tpl {
+		background-color: #ffffff;
+		margin: 25rpx 0rpx;
+		padding: 25rpx 25rpx;
+		font-size: 28rpx;
+		border-radius: 15rpx;
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		border-bottom: 1px solid #f1f1f1;
+
+		.list-left {
+			display: flex;
+			width: 100%;
+
+			.number {
+				font-size: 32rpx;
+				margin-right: 14rpx;
+			}
+
+			.info {
+				width: 100%;
+
+				.title {
+					font-size: 32rpx;
+					color: #222222;
+					font-weight: 500;
+				}
+
+				.addr {
+					width: 400rpx;
+					margin-top: 20rpx;
+					font-size: 20rpx;
+					font-family: PingFang SC;
+					font-weight: 500;
+					color: #999999;
+				}
+			}
+		}
+
+		.image {
+			width: 10%;
+			text-align: center;
+
+			image {
+				width: 50rpx;
+				height: 50rpx;
+			}
+
+			.tip {
+				color: #7f7f7f;
+				font-size: 21rpx;
+			}
+		}
+	}
+	.popup_row {
+		width: 100%;
+		height: 500rpx;
+		background-color: #ffffff;
+		border-radius: 20rpx;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	
+		.rows {
+			width: 100%;
+			padding: 0 24rpx;
+	
+			.rows-item {
+				height: 80rpx;
+				line-height: 80rpx;
+				text-align: center;
+				width: 100%;
+				font-size: 32rpx;
+				color: #303133;
+			}
+		}
+	}
+</style>

+ 157 - 145
pages/category/category.vue

@@ -27,28 +27,33 @@
 				<view class="list-left">
 					姓名:
 				</view>
-				<input type="text" v-model="name" class="list-input" placeholder="请输入您的姓名"/>
+				<input type="text" v-model="name" class="list-input" placeholder="请输入您的姓名" />
 			</view>
 			<view class="list">
 				<view class="list-left">
 					手机:
 				</view>
-				<input type="text" v-model="phone" class="list-input" placeholder='请填写您的联系方式'/>
+				<input type="text" v-model="phone" class="list-input" placeholder='请填写您的联系方式' />
 			</view>
 			<view class="list" @click="getLocation">
 				<view class="list-left">
 					地址:
 				</view>
 				<!-- <picker-address class="box-right" @change="onCityClick">{{ address }}</picker-address> -->
-				<input type="text" v-model="showaddress" class="list-input" placeholder='请选择常用地址'/>
+				<input type="text" v-model="showaddress" class="list-input" placeholder='请选择常用地址' />
 
 			</view>
-			<view class="list" @click="Toshow">
+			<view class="list">
 				<view class="list-left">
 					机构:
 				</view>
-				<!-- <input type="text" v-model="mechanism" @click="tosearch" class="list-input" placeholder='请输入机构关键字'/> -->
-				<input type="text" v-model="mechanism" class="list-input" placeholder='请输入机构关键字' disabled/>
+				<!-- <input type="text" v-model="mechanism" @click="tosearch" class="list-input" placeholder='请输入机构关键字'/> -->
+				<!-- <input type="text" v-model="mechanism" class="list-input" placeholder='请输入机构关键字' disabled/> -->
+				<view class="list-input" style="margin-top: 20rpx;">
+					<picker @change="bindPickerChange" :value="index" :range="array">
+						<view class="uni-input">{{mechanism || '请选择机构'}}</view>
+					</picker>
+				</view>
 			</view>
 
 			<view class="upload-box">
@@ -56,20 +61,14 @@
 					请上传救护员证书或身份证:
 				</view>
 				<view class="upload-right">
-					<image :src="certificates" mode="" class="upload-img" @click.stop="imgsub" v-if="certificates"></image>
-					<image src="../../static/images/upload.png" class="upload-img" mode="" v-if="!certificates" @click.stop="imgsub"></image>
+					<image :src="certificates" mode="" class="upload-img" @click.stop="imgsub" v-if="certificates">
+					</image>
+					<image src="../../static/images/upload.png" class="upload-img" mode="" v-if="!certificates"
+						@click.stop="imgsub"></image>
 				</view>
-			</view>
-			<zhilin-picker
-				v-model="show"
-				:title="title"
-				:data="list"
-				:initSelected="initSelected"
-				:showSearch="true"
-				@change="onChange"
-				@searchInput='onSearchInput'
-				@confirm="onConfirm1"
-			/>
+			</view>
+			<zhilin-picker v-model="show" :title="title" :data="list" :initSelected="initSelected" :showSearch="true"
+				@change="onChange" @searchInput='onSearchInput' @confirm="onConfirm1" />
 		</view>
 		<view class="sub" :class="{ action: loding }" @click="!loding?join():''">
 			马上报名
@@ -77,14 +76,14 @@
 	</view>
 </template>
 
-<script>
-	import {
-		mechanism
+<script>
+	import {
+		mechanism
 	} from '@/api/ask.js'
 	import {
 		getNumber
 	} from '@/api/index.js';
-	import pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
+	import pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
 	import zhilinPicker from "@/components/zhilin-picker/zhilin-picker.vue"
 	import {
 		upload,
@@ -95,27 +94,29 @@
 			pickerAddress,
 		},
 		computed: {
-	
+
 		},
 		data() {
-		
+
 			return {
+				index: 0,
+				array: ['武汉市江夏区红十字会'],
 				longitude: '',
 				latitude: '',
 				name: '',
 				phone: '',
-				mechanism: '',
-				title: '选择机构',
-				show: false,
-				list:[],
-				initSelected: [],
-				searchVal:'',
+				mechanism: '',
+				title: '选择机构',
+				show: false,
+				list: [],
+				initSelected: [],
+				searchVal: '',
 				address: '',
 				certificates: '',
 				loding: false, //是否提交中
 				showaddress: '', //显示用的地址
 				count: 0,
-				 peoplelist: [],
+				peoplelist: [],
 				addressData: {
 					name: '',
 					mobile: '',
@@ -131,22 +132,25 @@
 					default: false
 				},
 			}
-		},
-
-		onShow() {
-			this.loadData();
-		},
-		watch:{
-			searchVal(){
-				this.ListDate();
-			},
 		},
-		methods: {
-			tosearch(){
-				console.log(123)
-				uni.navigateTo({
-					url:'/pages/category/search'
-				})
+		onShow() {
+			this.loadData();
+		},
+		watch: {
+			searchVal() {
+				this.ListDate();
+			},
+		},
+		methods: {
+			bindPickerChange: function(e) {
+				this.index = e.detail.value
+				this.mechanism = this.array[this.index]
+			},
+			tosearch() {
+				console.log(123)
+				uni.navigateTo({
+					url: '/pages/category/search'
+				})
 			},
 			async loadData() {
 				let obj = this;
@@ -176,75 +180,76 @@
 						obj.showaddress = res.address;
 					}
 				});
-			},
-			// 机构
-			Toshow(){
-				console.log('点击选择机构')
-				this.show = true;
-			},
-			onChange(val){
-				let obj = this;
-				console.log(val,'onChange')
-				// let arr = val.split(',');
-				// console.log(999,arr)
-				// obj.hospital = arr[1];
-				// obj.hospital_id = arr[0];
-				// obj.city = arr[2];
-				// obj.city_id = arr[3];
-				// obj.district = arr[4];
-				// obj.district_id = arr[5];
-				// obj.province = arr[6];
-				// obj.province_id = arr[7];
-				// obj.addr = obj.province + obj.city + obj.district;
-				// console.log(obj.hospital,obj.hospital_id)
-				// console.log(obj.city,obj.city_id)
-				// console.log(obj.district,obj.district_id)
-				// console.log(obj.province,obj.province_id)
-			},
-			onSearchInput(val){
-				this.searchVal = val.value;
-			},
-			// 选择机构
-			ListDate() {
-				let obj = this;
-				let data = '';
-				console.log('obj.searchVal',obj.searchVal)
-				if(!obj.searchVal){
-					console.log('!obj.searchVal')
-					data={
-						keyword:'',
-						// sort:'id desc',
-						page:1,
-						limit:1500,
-					}
-				}else{
-					console.log('else')
-					console.log('当前input值',obj.searchVal)
-					data={
-						keyword:obj.searchVal,
-						// sort:'id desc',
-						page:1,
-						limit:1500,
-					}
-				}
-				mechanism(
-					data
-				).then(data => {
-					console.log('请求成功',data)
-					this.list = data.data.map(item => item)
-					// this.show = true
-				})
-				// getHospitalList(data).then(e => {
-				// 	obj.list = e.data.list;
-				// }).catch((e) => {
-				// 	console.log(e)
-				// });
-			},
-			onConfirm1(e) {
-				console.log('点击确认')
-				// let arr = e
-				this.mechanism = e.split(',')[1]
-				this.list = []
+			},
+			// 机构
+			Toshow() {
+				console.log('点击选择机构')
+				this.show = true;
+			},
+			onChange(val) {
+				let obj = this;
+				console.log(val, 'onChange')
+				// let arr = val.split(',');
+				// console.log(999,arr)
+				// obj.hospital = arr[1];
+				// obj.hospital_id = arr[0];
+				// obj.city = arr[2];
+				// obj.city_id = arr[3];
+				// obj.district = arr[4];
+				// obj.district_id = arr[5];
+				// obj.province = arr[6];
+				// obj.province_id = arr[7];
+				// obj.addr = obj.province + obj.city + obj.district;
+				// console.log(obj.hospital,obj.hospital_id)
+				// console.log(obj.city,obj.city_id)
+				// console.log(obj.district,obj.district_id)
+				// console.log(obj.province,obj.province_id)
+			},
+			onSearchInput(val) {
+				this.searchVal = val.value;
+			},
+			// 选择机构
+			ListDate() {
+				let obj = this;
+				let data = '';
+				console.log('obj.searchVal', obj.searchVal)
+				if (!obj.searchVal) {
+					console.log('!obj.searchVal')
+					data = {
+						keyword: '',
+						// sort:'id desc',
+						page: 1,
+						limit: 1500,
+					}
+				} else {
+					console.log('else')
+					console.log('当前input值', obj.searchVal)
+					data = {
+						keyword: obj.searchVal,
+						// sort:'id desc',
+						page: 1,
+						limit: 1500,
+					}
+				}
+				mechanism(
+					data
+				).then(data => {
+					console.log('请求成功', data)
+					this.list = data.data.map(item => item)
+					// this.show = true
+				})
+				// getHospitalList(data).then(e => {
+				// 	obj.list = e.data.list;
+				// }).catch((e) => {
+				// 	console.log(e)
+				// });
+			},
+			onConfirm1(e) {
+				console.log('点击确认')
+				// let arr = e
+				this.mechanism = e.split(',')[1]
+				console.log(this.mechanism);
+				this.list = []
 			},
 			imgsub() {
 				console.log('imgsub')
@@ -259,8 +264,8 @@
 				if (obj.name == '') {
 					obj.$api.msg('请输入您的姓名');
 					return
-				}
-			
+				}
+
 				const reg = /^(\+?0?86-?)?1[\d]\d{9}$/;
 				if (!reg.test(obj.phone)) {
 					obj.$api.msg('请填写正确的手机号码');
@@ -272,7 +277,7 @@
 				}
 
 				if (obj.mechanism == '') {
-					obj.$api.msg('请输入机构关键字');
+					obj.$api.msg('请选择机构');
 					return
 				}
 
@@ -282,12 +287,12 @@
 				}
 				obj.loding = true;
 				addrescuer({
-					name: obj.name,
-					phone: obj.phone,
-					address: obj.showaddress,
-					latitude:obj.addressData.latitude,
-					 longitude:obj.addressData.longitude,
-					mechanism:obj.mechanism,
+					name: obj.name,
+					phone: obj.phone,
+					address: obj.showaddress,
+					latitude: obj.addressData.latitude,
+					longitude: obj.addressData.longitude,
+					mechanism: obj.mechanism,
 					certificates: obj.certificates
 				}).then(data => {
 					obj.loding = false;
@@ -296,19 +301,19 @@
 						obj.name = '',
 							obj.phone = '',
 							obj.showaddress = '',
-							obj.certificates = '',
-							obj.mechanism = '',
-							obj.addressData.latitude = '',
-							obj.addressData.longitude = '',
-							uni.removeStorage({
-							    key: 'institution',
-							    success: function (res) {
-							        console.log('success');
-							    }
-							});
-							uni.navigateTo({
-								url: '../joinSuc/joinNow'
+							obj.certificates = '',
+							obj.mechanism = '',
+							obj.addressData.latitude = '',
+							obj.addressData.longitude = '',
+							uni.removeStorage({
+								key: 'institution',
+								success: function(res) {
+									console.log('success');
+								}
 							});
+						uni.navigateTo({
+							url: '../joinSuc/joinNow'
+						});
 					} else if (data.status == 400) {
 						obj.$api.msg(data.msg);
 					}
@@ -420,9 +425,10 @@
 						height: 100rpx;
 						border-radius: 50%;
 					}
-				}
-				.nickname{
-					margin-top: 12rpx;
+				}
+
+				.nickname {
+					margin-top: 12rpx;
 				}
 			}
 		}
@@ -489,12 +495,12 @@
 				}
 
 				.list-input {
+					display: inline-block;
+
 					padding-left: 24rpx;
 					// margin: 12rpx 0 ;
 
-					// line-height: 66rpx;
-					display: flex;
-					align-items: center;
+
 					width: 100%;
 					font-size: 36rpx;
 					flex: 1;
@@ -503,7 +509,8 @@
 					border-radius: 22rpx;
 					text-align: left;
 					padding-right: 24rpx;
-
+					height: 100rpx !important;
+					// background-color: red;
 					.input-placeholder {
 						height: 70rpx;
 						color: #FF9797;
@@ -530,4 +537,9 @@
 		}
 
 	}
-</style>
+	/deep/ .uni-input-input, .uni-input {
+		height: 70rpx;
+		line-height: 70rpx;
+	}
+	
+</style>

+ 175 - 71
pages/index/index.vue

@@ -3,7 +3,7 @@
 		<!-- 轮播 -->
 		<view class="carousel-section">
 			<swiper class="carousel" :autoplay="true" :interval="3000" :duration="1000">
-				<swiper-item v-for="item in carouselList" :key="item.id">
+				<swiper-item v-for="item in carouselList">
 					<image :src="item.pic"></image>
 				</swiper-item>
 			</swiper>
@@ -56,7 +56,7 @@
 			</view>
 			<scroll-view class="science-box" scroll-x>
 				<view class="science-content">
-					<view class="science-item" v-for="(item, index) in science" :key="index" @click="Jump(item)">
+					<view class="science-item" v-for="(item, index) in science" @click="Jump(item)">
 						<image :src="item.image_input[0]" mode=""></image>
 						<view class="article-title word1_ellipsis">{{ item.title }}</view>
 						<view class="article-content">{{ item.synopsis }}</view>
@@ -83,11 +83,12 @@
 			</view>
 			<view class="system-map">
 				<map @click="tolocation" :show-location="false" class="map-box" id="mapjzsb" :markers="markerjzsb"
-					:scale="scale" :latitude="latitude4" :longitude="longitude4" ref="mapjzsb" style="height: 450rpx"></map>
+					:scale="scale" :latitude="latitude4" :longitude="longitude4" ref="mapjzsb"
+					style="height: 450rpx"></map>
 				<!-- <view class="map-box" @click="tolocation"><image src="../../static/img/map.jpg" mode=""></image></view> -->
 			</view>
 		</view>
-		<view v-for="(item, index) in jzsbList" :key="item.id">
+		<view v-for="(item, index) in jzsbList">
 			<view class="location-item">
 				<view class="box-left">
 					<view class="img01">
@@ -115,6 +116,7 @@
 					<view class="called" v-if="item.is">已呼叫</view>
 				</view>
 			</view>
+			
 		</view>
 		<navigator class="science-more" url="/pages/applic/location">
 			查看更多
@@ -138,7 +140,7 @@
 				</map>
 			</view>
 			<view class="">
-				<view class="list-tpl flex" @click="openAddress(item)" v-for="(item,index) in AEDList" :key="item.id">
+				<view class="list-tpl flex" @click="openAddress(item)" v-for="(item,index) in AEDList">
 					<view class="list-left">
 						<view class="number">{{ index + 1 }}</view>
 						<view class="info">
@@ -146,7 +148,7 @@
 							<view class="addr">地址:{{ item.address }}</view>
 						</view>
 					</view>
-		
+
 					<view class="image">
 						<image src="../../static/img/img10.png"></image>
 						<view class="tip">导航</view>
@@ -154,12 +156,54 @@
 				</view>
 				<!-- <uni-load-more :status="loadingType"></uni-load-more> -->
 			</view>
+			<navigator class="science-more" url="/pages/applic/aid">
+				查看更多
+				<image src="../../static/icon/moreRight.png" mode=""></image>
+				<image src="../../static/icon/moreRight.png" mode=""></image>
+			</navigator>
 		</view>
-		<navigator class="science-more" url="/pages/applic/aid">
-			查看更多
-			<image src="../../static/icon/moreRight.png" mode=""></image>
-			<image src="../../static/icon/moreRight.png" mode=""></image>
-		</navigator>
+
+		<!-- 博爱驿站 -->
+		<view class="list-box">
+			<view class="system-title">
+				<view class="img">
+					<image src="../../static/img/wings-left.png"></image>
+				</view>
+				<view class="title">博爱驿站</view>
+				<view class="img">
+					<image src="../../static/img/wings-right.png"></image>
+				</view>
+			</view>
+			<view id="container">
+				<map class="map-box" id="map" :show-location="false" :markers="yzmarker" :scale='scale'
+					:latitude="latitude4" :longitude="longitude4" ref="map" style="height: 450rpx"
+					@markertap='markertap'>
+				</map>
+			</view>
+			<view class="">
+				<view class="list-tpl flex" @click="openAddress(item)" v-for="(item,index) in yzList">
+					<view class="list-left">
+						<view class="number">{{ index + 1 }}</view>
+						<view class="info">
+							<view class="title">{{ item.name }}</view>
+							<view class="addr">地址:{{ item.detailed_address }}</view>
+						</view>
+					</view>
+
+					<view class="image">
+						<image src="../../static/img/img10.png"></image>
+						<view class="tip">导航</view>
+					</view>
+				</view>
+				<!-- <uni-load-more :status="loadingType"></uni-load-more> -->
+			</view>
+			<navigator class="science-more" url="/pages/applic/yz">
+				查看更多
+				<image src="../../static/icon/moreRight.png" mode=""></image>
+				<image src="../../static/icon/moreRight.png" mode=""></image>
+			</navigator>
+		</view>
+
 		<uni-popup ref="popup" type="bottom" @click="close">
 			<view class="popup_row">
 				<view class="rows">
@@ -210,7 +254,8 @@
 		bannerlist,
 		getListAED,
 		getDistance,
-		getdis
+		getdis,
+		getListMechanism
 	} from '@/api/index.js';
 	import {
 		saveUrl,
@@ -238,6 +283,8 @@
 		},
 		data() {
 			return {
+				yzList: [],
+				yzmarker: [],
 				to_phone: '',
 				jzsbList: [],
 				carouselList: [], //轮播
@@ -455,49 +502,49 @@
 				this.$refs.popups.close();
 			},
 			comfirm1: function() {
-						let obj = this;
-						if (obj.to_phone.toString().trim() == '') {
-							// uni.showModal({
-							// 	title:'输入框为空',
-							// 	// content:JSON.stringify(obj)
-							// })
-						} else {
-							console.log('obj.to_phone1111', obj.to_phone);
-							const reg = /^(\+?0?86-?)?1[\d]\d{9}$/;
-							if (!reg.test(obj.to_phone)) {
-								obj.$api.msg('请填写正确的手机号码');
-								return;
+				let obj = this;
+				if (obj.to_phone.toString().trim() == '') {
+					// uni.showModal({
+					// 	title:'输入框为空',
+					// 	// content:JSON.stringify(obj)
+					// })
+				} else {
+					console.log('obj.to_phone1111', obj.to_phone);
+					const reg = /^(\+?0?86-?)?1[\d]\d{9}$/;
+					if (!reg.test(obj.to_phone)) {
+						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);
+						uni.showModal({
+							title: '请耐心等待救援',
+							success: res => {
+								if (res.confirm) {
+									window.location.reload(); //重新刷新页面
+								}
 							}
-							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);
-								uni.showModal({
-									title: '请耐心等待救援',
-									success: res => {
-										if (res.confirm) {
-											window.location.reload(); //重新刷新页面
-										}
-									}
-								});
-								obj.$refs.popups.close();
-								obj.iscall = false;
-								console.log(123, obj.iscall);
-							});
-						}
-					},
+						});
+						obj.$refs.popups.close();
+						obj.iscall = false;
+						console.log(123, obj.iscall);
+					});
+				}
+			},
 			// 立即救援
 			rescue(item, index) {
 				let obj = this;
@@ -567,6 +614,18 @@
 					url: "/pages/applic/location"
 				})
 			},
+			space(lat1 = 0, lng1 = 0, lat2, lng2) {
+				console.log(lat1, lng1, lat2, lng2);
+				var radLat1 = (lat1 * Math.PI) / 180.0;
+				var radLat2 = (lat2 * Math.PI) / 180.0;
+				var a = radLat1 - radLat2;
+				var b = (lng1 * Math.PI) / 180.0 - (lng2 * Math.PI) / 180.0;
+				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)));
+				s = s * 6378.137;
+				s = Math.round(s * 10000) / 10000;
+				return s * 1000; // 单位米
+			},
 			toapplic() {
 				uni.navigateTo({
 					url: "/pages/applic/appliSystem"
@@ -675,6 +734,38 @@
 					// 	content: JSON.stringify(obj.marker)
 					// })
 				})
+				getListMechanism({
+					page: 1,
+					limit: 100
+				}).then(({
+					data
+				}) => {
+					console.log(data, '机构+++++++++++++')
+					for (let i = 0; i < data.length; i++) {
+						data[i].space = obj.space(obj.latitude4, obj.longitude4, data[i].latitude, data[i]
+							.longitude);
+					}
+					// 排序
+					let arr1 = data.sort(obj.sortBy('space')) 
+					let arr = arr1.map(item => ({
+						latitude: item.latitude,
+						longitude: item.longitude,
+						iconPath: '/static/icon/yz.png',
+						width: '35',
+						height: '35',
+						id: item.id,
+						address: item.address
+					}));
+					
+					obj.yzmarker = obj.marker1.concat(arr)
+					obj.yzList = arr1.slice(0,3)
+				})
+			},
+			sortBy(field) {
+				//根据传过来的字段进行排序,y-x 得分从高到低,x-y 从低到高
+				return (x, y) => {
+					return x[field] - y[field]
+				}
 			},
 			// 选择当前位置
 			// chooseAddress() {
@@ -713,7 +804,7 @@
 				let obj = this
 				obj.latitude2 = item.latitude
 				obj.longitude2 = item.longitude
-				obj.address = item.address
+				obj.address = item.detailed_address
 				this.$refs.popup.open();
 			},
 			Jump(item) {
@@ -1035,6 +1126,7 @@
 		// AED
 		.list-box {
 			padding: 0rpx 25rpx 24rpx;
+			margin-top: 20rpx;
 			// margin-bottom: 84rpx;
 
 			.system-title {
@@ -1127,6 +1219,7 @@
 			}
 		}
 	}
+
 	.popup_rows {
 		// margin-top: 108rpx;
 		height: 440rpx;
@@ -1135,6 +1228,7 @@
 		padding: 24rpx;
 		background-color: #f8f8f8;
 		z-index: 999;
+
 		.title {
 			border-bottom: 2rpx solid #f2f2f2;
 			color: #e63931;
@@ -1143,39 +1237,46 @@
 			padding-bottom: 16rpx;
 			display: flex;
 			justify-content: space-between;
+
 			// align-items: center;
 			.cancel {
 				margin-left: 52rpx;
 				width: 36rpx;
 				height: 36rpx;
+
 				image {
 					width: 36rpx;
 					height: 36rpx;
 				}
 			}
 		}
+
 		.inpBox {
 			margin-top: 52rpx;
 			border: 2px solid #f2f2f2;
 			padding: 12rpx 24rpx;
 			color: #ff9797;
 			border-radius: 8rpx;
+
 			.input-placeholder {
 				// height: 70rpx;
 				font-size: 32rpx;
 				color: #ff9797;
 			}
 		}
+
 		.inpedit {
 			margin-top: 24rpx;
 			margin-left: 14rpx;
 			font-size: 28rpx;
 			color: #ff9797;
 		}
+
 		.comfirm {
 			display: flex;
 			justify-content: flex-end;
 			margin-top: 54rpx;
+
 			.comfirm1 {
 				padding: 12rpx 24rpx;
 				border-radius: 12rpx;
@@ -1184,6 +1285,7 @@
 			}
 		}
 	}
+
 	.science-more {
 		background-color: #fff;
 		display: flex;
@@ -1193,12 +1295,13 @@
 		font-size: 30rpx;
 		padding-top: 18rpx;
 		padding-bottom: 18rpx;
-	
+
 		image {
 			width: 20rpx;
 			height: 27rpx;
 		}
 	}
+
 	.location-item {
 		// width: 710rpx;
 		background-color: #fff;
@@ -1208,56 +1311,57 @@
 		align-items: center;
 		border-bottom: 1rpx solid #e7e8ea;
 		padding: 15rpx 30rpx;
+
 		// margin: auto;
 		.box-left {
 			display: flex;
-	
+
 			.img01 {
 				width: 8rpx;
 				height: 28rpx;
 				margin-right: 18rpx;
-	
+
 				image {
 					width: 8rpx;
 					height: 28rpx;
 				}
 			}
-	
+
 			.img02 {
 				width: 117rpx;
 				height: 117rpx;
 				border-radius: 50%;
-	
+
 				image {
 					width: 117rpx;
 					height: 117rpx;
 					border-radius: 50%;
 				}
 			}
-	
+
 			.info {
 				margin-left: 16rpx;
-	
+
 				.info-header {
 					display: flex;
 					align-items: center;
-	
+
 					.name {
 						font-size: 32rpx;
 						color: #333333;
 					}
-	
+
 					.distance {
 						margin-left: 25rpx;
 						font-size: 28rpx;
 						color: #303133;
 					}
-	
+
 					.location-icon {
 						margin-left: 10rpx;
 						width: 20rpx;
 						height: 26rpx;
-	
+
 						image {
 							width: 20rpx;
 							height: 26rpx;
@@ -1265,7 +1369,7 @@
 						}
 					}
 				}
-	
+
 				.address {
 					font-size: 26rpx;
 					color: #333333;
@@ -1273,17 +1377,17 @@
 				}
 			}
 		}
-	
+
 		.box-right {
 			.img {
 				height: 107rpx;
-	
+
 				image {
 					width: 107rpx;
 					height: 107rpx;
 				}
 			}
-	
+
 			.called {
 				margin-right: 16rpx;
 				height: 107rpx;
@@ -1293,4 +1397,4 @@
 			}
 		}
 	}
-</style>
+</style>

+ 38 - 16
pages/login/login.vue

@@ -1,15 +1,15 @@
 <template>
 	<view class="container">
 		<view class="top">
-			<view class="login">登录</view>
+			<!-- <view class="login">登录</view> -->
 		</view>
 		<view class="center">
 			<view class="login_input">
-				<image class="img" src="https://zhxc2030.com/img/img08.png"></image>
+				<image class="img" src="../../static/icon/img03.png"></image>
 				<input class="input"  v-model="username" focus placeholder="请输入手机号" />
 			</view>
 			<view class="login_input">
-				<image class="img" src="https://zhxc2030.com/img/img67.png"></image>
+				<image class="img" src="../../static/icon/img04.png"></image>
 				<input class="input"   type="password" v-model="passward" placeholder="请输入密码"  />
 			</view>
 
@@ -21,8 +21,8 @@
 			<view class="register_buttom" @click="register">
 				注册账号
 			</view>
-
-			<view class="login_else">
+			<view class="login" >登录</view>
+			<!-- <view class="login_else">
 				<view class="login_else_border">
 
 				</view>
@@ -30,16 +30,16 @@
 				<view class="login_else_border">
 
 				</view>
-			</view>
+			</view> -->
 
            <!-- 微信登录 -->
-		   <view class="login_wx" @click="appLogin">
+		   <!-- <view class="login_wx" @click="appLogin">
 		   	<image src="https://zhxc2030.com/img/wxlogin.png"></image>
 			
 		   </view>
 		   <view class="login_wx_text" >
 		   	微信登录
-		   </view>
+		   </view> -->
 		</view>
 	</view>
 </template>
@@ -50,8 +50,8 @@ import { login,getUserInfo } from '@/api/login.js';
 export default {
 	data() {
 		return {
-			username: '',
-			passward: '',
+			username: '13245678912',
+			passward: '132456',
 			// #ifdef APP-PLUS
 			// 保存当前是否为微信浏览器
 			weixinB:false,
@@ -60,6 +60,9 @@ export default {
 	},
 	onLoad() {
 		this.weixinB=uni.getStorageSync('weichatBrowser')
+		if(this.username && this.passward) {
+			this.toLogin()
+		}
 	},
 	methods: {
 		//微信登录
@@ -148,9 +151,13 @@ export default {
 </script>
 
 <style lang="scss">
+	page {
+		background-color: $base-color;
+		height: auto;
+		min-height: 100%;
+	}
 	.container {
 		line-height: 1;
-
 		.top {
 			width: 750rpx;
 			height: 500rpx;
@@ -175,13 +182,18 @@ export default {
 		.center {
 			z-index: 9;
 			width: 700rpx;
-			height: 840rpx;
+			height: 550rpx;
+			padding-bottom: 40rpx;
 			background-color: #FFFFFF;
 			border-radius: 20rpx;
-			margin-top: -150rpx;
-			margin-left: 24rpx;
+			// margin-top: -150rpx;
+			// margin-left: 24rpx;
 			position: absolute;
-
+			top: 0;
+			left: 0;
+			right: 0;
+			bottom: 0;
+			margin: auto;
 			.login_input {
 				width: 560rpx;
 				display: flex;
@@ -228,7 +240,17 @@ export default {
 				font-weight: 500;
 				color: $base-color;
 			}
-		
+			.login {
+				position: absolute;
+				top: -100rpx;
+				right: 0;
+				left: 0;
+				margin: auto;
+				font-size: 36rpx;
+				font-weight: bold;
+				color:  #FFFFFF;
+				text-align: center;
+			}
 		     .login_else{
 				 width: 560rpx;
 				 margin: 0 auto;

+ 10 - 11
pages/login/register.vue

@@ -19,13 +19,12 @@
 				<view class="login_img"><image src="/static/icon/img07.png"></image></view>
 				<view class="login_name"><input class="uni-input" type="text" v-model="invitation" focus placeholder="请输入邀请码" /></view>
 			</view> -->
-			<view class="login_input flex">
-				<!-- <view class="login_img"><image src="/static/icon/img06.png"></image></view> -->
+			<!-- <view class="login_input flex">
 				<view class="login_name flex">
 					<input class="uni-input width" v-model="code" focus placeholder="请输入验证码" />
 					<view class="code" @click="verification">{{ countDown == 0 ? '获取验证码' : countDown }}</view>
 				</view>
-			</view>
+			</view> -->
 			<view><button type="green" @click="register" class="uni-button uni-button-red">注册</button></view>
 			<!-- <view class="forget" @click="forget">忘记密码?</view> -->
 			<view class="forget" @click="login">已有账号?立即登录。</view>
@@ -80,14 +79,14 @@ export default {
 				obj.$api.msg('两次密码不正确');
 				return;
 			}
-			if ((obj.invitation = '')) {
-				obj.$api.msg('请输入邀请码');
-				return;
-			}
-			if (obj.code == '') {
-				obj.$api.msg('请输入验证码');
-				return;
-			}
+			// if ((obj.invitation = '')) {
+			// 	obj.$api.msg('请输入邀请码');
+			// 	return;
+			// }
+			// if (obj.code == '') {
+			// 	obj.$api.msg('请输入验证码');
+			// 	return;
+			// }
 
 			register({
 				account: obj.phone, //账号

二进制
static/icon/img03.png


二进制
static/icon/img04.png


二进制
static/icon/yz.png