Sfoglia il codice sorgente

项目日志:11.29 地图最近计算

gubai 2 anni fa
parent
commit
1369647ada

+ 60 - 51
pages/goods/goods.vue

xqd xqd xqd xqd xqd xqd xqd xqd
@@ -1,33 +1,36 @@
 <template>
 	<view class="goods">
-		<!-- 背景图 -->
-		<view class="goods-img">
-			<image style="width: 100%; height: 450rpx;" src="http://t9.9026.com/imgs/swiper01.png" mode=""></image>
-		</view>
-		<!-- 内容 -->
-		<view class="main">
-			<view class="search">
-				<u-input placeholder="搜索" border='none'>
-					<template slot="suffix" style='margin-right:40rpx;'>
-						<u-image :showLoading="true" :showError='true' src="/static/icon/search.png" width="40rpx"
-							height="32rpx"></u-image>
-					</template>
-				</u-input>
+		<scroll-view class="scroll-y" @scroll="handleScroll" :scroll-into-view="topItem" scroll-with-animation
+			scroll-y="true">
+			<view id="top"></view>
+			<!-- 背景图 -->
+			<view class="goods-img">
+				<image style="width: 100%; height: 450rpx;" src="http://t9.9026.com/imgs/swiper01.png" mode=""></image>
 			</view>
-			<view class="tab_nav">
-				<view class="navTitle" v-for="(item,index) in items" :key="index">
-					<view class="navTitle-item">
-						<view :class="{'active':isActive === index}" @click="checked(index)">
-							{{item.title}}
+			<!-- 内容 -->
+			<view class="main">
+				<view class="search">
+					<u-input placeholder="搜索" border='none'>
+						<template slot="suffix" style='margin-right:40rpx;'>
+							<u-image :showLoading="true" :showError='true' src="/static/icon/search.png" width="40rpx"
+								height="32rpx"></u-image>
+						</template>
+					</u-input>
+				</view>
+				<view class="tab_nav">
+					<view class="navTitle" v-for="(item,index) in items" :key="index">
+						<view class="navTitle-item">
+							<view :class="{'active':isActive === index}" @click="checked(index)">
+								{{item.title}}
+							</view>
 						</view>
 					</view>
 				</view>
 			</view>
-		</view>
-		<view class="content">
-			<scroll-view @scroll="handleScroll" :scroll-into-view="topItem" scroll-with-animation scroll-y="true">
+			<view class="content">
+
 				<view class="home-hotel-img-content">
-					<view id="top"></view>
+					
 					<view class="home-hotel-img-content-item" v-for="item in goodsList"
 						:style="{marginTop:item.marginTop || 0 }">
 						<image class="home-hotel-img-content-item-img"
@@ -38,33 +41,34 @@
 							<text class="text-main">{{item.title}}</text>
 						</view>
 					</view>
-					<view class="return-btn" v-if="isShow" @click="handleBackTop">
-						<image style="width: 128rpx;height: 128rpx;" src="/static/icon/returntop.png" mode=""></image>
-					</view>
+
 				</view>
-				
-			</scroll-view>
+				<!-- 触底 -->
+				<view class="home-bottom">
+					<uni-load-more :status="status" color="#CCCCCC" :content-text="contentText" />
+				</view>
+
 
-			<!-- <text @click="goGoodsDetail">商品</text>
+
+
+				<!-- <text @click="goGoodsDetail">商品</text>
 			<text @click="goGoodsDetailImg">转盘</text> -->
+			</view>
+		</scroll-view>
+		<view class="return-btn" v-if="isShow" @click="handleBackTop">
+			<image style="width: 128rpx;height: 128rpx;" src="/static/icon/returntop.png" mode=""></image>
 		</view>
-		<!-- 触底 -->
-		<view class="home-bottom">
-			<uni-load-more :status="status" color="#CCCCCC" :content-text="contentText" />
-		</view>
-
 	</view>
 </template>
 
 <script>
-
 	export default {
 
 		data() {
 			return {
 				// 返回的按钮是否显示
-				isShow: true,
-				topItem: '' ,//返回顶部的标记点
+				isShow: false,
+				topItem: '', //返回顶部的标记点
 				goodsList: [{
 						img: 'http://t9.9026.com/imgs/goodsimg01.png',
 						text: '中秋佳节五仁月饼,惊喜特供,限时抢购',
@@ -86,7 +90,7 @@
 						text: '中秋佳节五仁月饼,惊喜特供,限时抢购',
 						title: '环球洲际',
 						short: '',
-					},{
+					}, {
 						img: 'http://t9.9026.com/imgs/goodsimg01.png',
 						text: '中秋佳节五仁月饼,惊喜特供,限时抢购',
 						title: '环球洲际',
@@ -107,7 +111,7 @@
 						text: '中秋佳节五仁月饼,惊喜特供,限时抢购',
 						title: '环球洲际',
 						short: '',
-					},{
+					}, {
 						img: 'http://t9.9026.com/imgs/goodsimg01.png',
 						text: '中秋佳节五仁月饼,惊喜特供,限时抢购',
 						title: '环球洲际',
@@ -128,7 +132,7 @@
 						text: '中秋佳节五仁月饼,惊喜特供,限时抢购',
 						title: '环球洲际',
 						short: '',
-					},{
+					}, {
 						img: 'http://t9.9026.com/imgs/goodsimg01.png',
 						text: '中秋佳节五仁月饼,惊喜特供,限时抢购',
 						title: '环球洲际',
@@ -185,31 +189,30 @@
 		// 	this.shortLong()
 		// 	console.log(this)
 		// },
-		onLoad(){
+		onLoad() {
 			this.shortLong()
 			this.getGoodsList()
 		},
 		methods: {
-			
-			getGoodsList(){
+
+			getGoodsList() {
 				this.$api.product.getProducts({
-					type:1,
+					type: 1,
 					page: 0
 				}).then(res => {
 					console.log(res);
 				})
 			},
-			
+
 			handleScroll(e) {
-				console.log(111);
 				//只有scrollTop有用,先拿scrollTop
 				let {
 					scrollTop
 				} = e.detail
-				
+
 				console.log(scrollTop);
 				//滑动大于500让按钮显示
-				this.isShow = scrollTop > 200
+				this.isShow = scrollTop > 500
 				//因为点第二次不行,这里记得重置清空一下
 				this.topItem = ''
 			},
@@ -296,6 +299,13 @@
 
 	}
 
+
+	.scroll-y {
+		height: 100vh;
+	}
+
+
+
 	.content {
 		background-color: #FFF;
 		padding: 20rpx 30rpx;
@@ -348,15 +358,14 @@
 				}
 			}
 		}
-
-		.return-btn {
+	}
+	
+.return-btn {
 			position: fixed;
 			bottom: 140rpx;
 			right: 14rpx;
 
 		}
-	}
-
 
 
 

+ 30 - 20
pages/index/index.vue

xqd xqd xqd xqd
@@ -108,8 +108,8 @@
 
 		<!-- 酒店品牌图片 -->
 		<view class="home-brand-img">
-			<uni-swiper-dot :info="info" mode="default" :dots-styles="dotsStylesBand">
-				<swiper class="swiper-box" circular>
+			<uni-swiper-dot :info="info" mode="default" :current="current2" :dots-styles="dotsStylesBand">
+				<swiper class="swiper-box" circular @change="change2">
 					<swiper-item v-for="(items ,index) in info" :key="index">
 						<view v-for="(item ,j) in items" :key="j" class="swiper-item"
 							@click="goGoodsDetail(item.pic_url)">
@@ -217,6 +217,23 @@
 							name: '酒店预订'
 						}
 					],
+					[{
+							img: 'http://t9.9026.com/imgs/swiper01.png',
+							name: '酒店预订'
+						},
+						{
+							img: 'http://t9.9026.com/imgs/swiper01.png',
+							name: '酒店预订'
+						},
+						{
+							img: 'http://t9.9026.com/imgs/swiper01.png',
+							name: '酒店预订'
+						},
+						{
+							img: 'http://t9.9026.com/imgs/swiper01.png',
+							name: '酒店预订'
+						}
+					],
 
 				],
 				dotsStyles: {
@@ -393,6 +410,9 @@
 			change1(e) {
 				this.current1 = e.detail.current;
 			},
+			change2(e){
+				this.current2 = e.detail.current;
+			}
 
 		}
 	}
@@ -642,27 +662,17 @@
 		background-color: #f9f9f9;
 	}
 
-	.home-banner-img {
-		
-			::v-deep .uni-swiper__dots-box{
-				bottom: 20px !important;
-			}
-			
-			// ::v-deep .uni-swiper__dots-item {
-			// 	width: 22rpx !important;
-			// 	height: 2rpx !important;
-			// }
-			// ::v-deep .uni-swiper__dots-bar {
-			// 	width: 22rpx !important;
-			// 	height: 2rpx !important;
-			// }
-		
-	}
-
 	.home-brand-img {
 		padding: 0 30rpx;
 		background-color: #f9f9f9;
-
+		::v-deep .uni-swiper__dots-item {
+			width: 22rpx !important;
+			height: 2rpx !important;
+		}
+		::v-deep .uni-swiper__dots-bar {
+			width: 22rpx !important;
+			height: 2rpx !important;
+		}
 		.swiper-box {
 			background-color: #f9f9f9;
 			height: 200rpx;

+ 33 - 22
pages/login/login.vue

xqd xqd xqd xqd
@@ -15,7 +15,8 @@
 			</view>
 			<view class="item" @click="getmsg">
 				<image src="/static/icon/wechart.png" mode="scaleToFill"></image>
-				<text>微信登录</text>
+				<text v-if="!isLoginOff">微信登录</text>
+				<text v-if="isLoginOff">授权登录</text>
 			</view>
 		</view>
 
@@ -39,6 +40,7 @@
 	export default {
 		data() {
 			return {
+				isLoginOff:false,
 				modal: {
 					show: false,
 					title: '用户信息获取',
@@ -51,7 +53,9 @@
 				data: {}
 			}
 		},
-		onLoad() {},
+		onLoad() {
+			this.isLoginOff = this.$store.getters.userInfo
+		},
 		methods: {
 			//提交微信名称和头像
 			handleConfirmWechatUserInfo() {
@@ -107,27 +111,34 @@
 			},
 			//获取微信登录的code码
 			getmsg() {
-				uni.login({
-					provider: uni.$u.platform,
-					success: res => {
-						this.getCode().then((data) => {
-							const params = {
-								code: res.code,
-								iv: data.iv,
-								encryptData: data.encryptData
-							}
-							console.log(params);
-							this.$api.my.myLogin(params).then(res => {
-								let {
-									token
-								} = res.data
-								this.$store.dispatch('user/token', token)
-								this.handleGetWechatUserInfo()
-								this.handleConfirmWechatUserInfo()
+				if(this.isLoginOff){
+					uni.switchTab({
+						url: '/pages/my/my'
+					})
+				}else{
+					uni.login({
+						provider: uni.$u.platform,
+						success: res => {
+							this.getCode().then((data) => {
+								const params = {
+									code: res.code,
+									iv: data.iv,
+									encryptData: data.encryptData
+								}
+								console.log(params);
+								this.$api.my.myLogin(params).then(res => {
+									let {
+										token
+									} = res.data
+									this.$store.dispatch('user/token', token)
+									this.handleGetWechatUserInfo()
+									this.handleConfirmWechatUserInfo()
+								})
 							})
-						})
-					}
-				})
+						}
+					})
+				}
+				
 			},
 
 		}

+ 24 - 0
pages/map/map.vue

xqd
@@ -326,6 +326,30 @@
 		},
 
 		methods: {
+			//计算酒店距离我的位置--int
+			calcDistanceFromHotel({x0,y0},{x1,y1}){
+				//x0,y0是我的坐标(经纬度)
+				//x1,y1是酒店坐标(经纬度)
+				return Math.sqrt(Math.pow(Math.abs(x1-x0),2)+Math.pow(Math.abs(y1-y0),2));//返回距离
+			},
+			//遍历所有酒店,并计算出酒店分别与我的距离--数组
+			setEachHotelDistance(hotelArray=[],{x0,y0}){
+				hotelArray.map(item=>{
+					item.distanceToMe=this.calcDistanceFromHotel({x0,y0},{x1:item.longitude,y1:item.latitude})
+					return item;
+				})
+				return hotelArray;
+				
+			},
+			//筛选出距离我最近的酒店--对象
+			getMinDistanceHotel({x0,y0}){
+				this.markers=this.setEachHotelDistance(this.markers,{x0,y0});
+				this.markers.sort((prev,next)=>{
+					return prev.distanceToMe-next.distanceToMe;
+				})
+				return this.markers[0];
+			},
+			//-------------------------------------
 			getList() {
 				this.$api.hotel.getHotelList({
 					page: 1

+ 1 - 0
pages/my/my.vue

xqd
@@ -170,6 +170,7 @@
 				this.$api.my.update({avatar: this.modal.avatar, nickname: this.modal.nickname}).then(res=>{
 					  this.$hideLoading()  
 					  this.$store.dispatch('user/info', res.data)
+					  this.admin = this.$store.getters.userInfo
 					  this.modal.show = false
 				})
 			},

+ 55 - 43
pages/my/setting/setting.vue

xqd xqd
@@ -25,48 +25,50 @@
 </template>
 
 <script>
-	export default{
-		data(){
-			return{
-				
+	export default {
+		data() {
+			return {
+
 			}
 		},
-		methods:{
+		methods: {
 			// 跳转隐私政策
-			goPrivacy(){
+			goPrivacy() {
 				uni.navigateTo({
-					url:'/pages/my/protocol/PrivacyPolicy'
+					url: '/pages/my/protocol/PrivacyPolicy'
 				})
 			},
 			// 跳转用户协议
-			goUser(){
+			goUser() {
 				uni.navigateTo({
-					url:'/pages/my/protocol/UserAgreement'
+					url: '/pages/my/protocol/UserAgreement'
 				})
 			},
 			// 跳转核销中心
-			goVerfication(){
+			goVerfication() {
 				uni.navigateTo({
-					url:'/pages/my/verification/verification'
+					url: '/pages/my/verification/verification'
 				})
 			},
 			// 退出登录
-			loginOut(){
-				if(this.$store.getters.token){
-					this.$store.dispatch("user/info", null)
-					this.$store.dispatch("user/token", null)
-					uni.removeStorageSync('auth_token')
-					uni.removeStorageSync('userInfo')
+			loginOut() {
+				if (this.$store.getters.token) {
+					//记录用户曾经登录过
+					this.$store.getters.userInfo.isLoginOff = true
+					this.$store.dispatch("user/info", this.$store.getters.userInfo)
+					// this.$store.dispatch("user/token", null)
+					// uni.removeStorageSync('auth_token')
+					// uni.removeStorageSync('userInfo')
 					uni.reLaunch({
 						url:'/pages/login/login'
 					})
-				}else{
+				} else {
 					uni.showToast({
-						title:'请先登录!',
-						icon:'error'
+						title: '请先登录!',
+						icon: 'error'
 					})
 				}
-				
+
 			}
 		}
 	}
@@ -75,80 +77,90 @@
 <style lang="scss" scoped>
 	$pageColor:#F9F9F9;
 	$bgColor:#FFFFFF;
-	@mixin flexlayout{
+
+	@mixin flexlayout {
 		display: flex;
 		align-items: center;
 		justify-content: center;
 	}
-	.setting{
+
+	.setting {
 		height: 100%;
 		background: $pageColor;
 	}
-	.cell{
+
+	.cell {
 		width: 750rpx;
 		height: 336rpx;
 		border-radius: 16rpx;
-		padding:0 30rpx;
-		background:$bgColor ;
+		padding: 0 30rpx;
+		background: $bgColor;
 		margin-bottom: 48rpx;
-		.cell_item{
+
+		.cell_item {
 			box-sizing: border-box;
 			height: 110rpx;
 			width: 690rpx;
-			border-bottom:solid  2rpx #F0F0F0;
+			border-bottom: solid 2rpx #F0F0F0;
 			display: flex;
 			align-items: center;
 			position: relative;
-			text{
+
+			text {
 				font-size: 30rpx;
 				font-family: PingFang-SC-Medium, PingFang-SC;
 				font-weight: 500;
 				color: #000000;
 			}
-			image{
-				width: 12rpx ;
+
+			image {
+				width: 12rpx;
 				height: 20rpx;
 				position: absolute;
 				right: 0rpx;
-				top:46rpx;
+				top: 46rpx;
 			}
 		}
-		.cell_item:nth-last-child(1){
+
+		.cell_item:nth-last-child(1) {
 			box-sizing: border-box;
 			height: 110rpx;
 			width: 690rpx;
-			border-bottom:solid  0rpx #F0F0F0;
+			border-bottom: solid 0rpx #F0F0F0;
 			display: flex;
 			align-items: center;
 			position: relative;
-			text{
+
+			text {
 				font-size: 30rpx;
 				font-family: PingFang-SC-Medium, PingFang-SC;
 				font-weight: 500;
 				color: #000000;
 			}
-			image{
-				width: 12rpx ;
+
+			image {
+				width: 12rpx;
 				height: 20rpx;
 				position: absolute;
 				right: 0rpx;
-				top:46rpx;
+				top: 46rpx;
 			}
 		}
-		
+
 	}
-	.btn{
+
+	.btn {
 		width: 690rpx;
 		height: 92rpx;
 		background: $bgColor;
 		border-radius: 16rpx;
 		margin-left: 30rpx;
-		@include flexlayout()
-		text{
+
+		@include flexlayout() text {
 			font-size: 28rpx;
 			font-family: PingFang-SC-Medium, PingFang-SC;
 			font-weight: 500;
 			color: #333333;
 		}
 	}
-</style>
+</style>

File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/.sourcemap/mp-weixin/common/main.js.map


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/.sourcemap/mp-weixin/pages/goods/goods.js.map


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/.sourcemap/mp-weixin/pages/index/index.js.map


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/.sourcemap/mp-weixin/pages/login/login.js.map


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/.sourcemap/mp-weixin/pages/map/map.js.map


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/.sourcemap/mp-weixin/pages/my/my.js.map


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/.sourcemap/mp-weixin/pages/my/setting/setting.js.map


+ 7 - 4
unpackage/dist/dev/mp-weixin/pages/goods/goods.js

xqd xqd xqd
@@ -219,14 +219,18 @@ __webpack_require__.r(__webpack_exports__);
 //
 //
 //
+//
+//
+//
+//
+//
 var _default =
-
 {
 
   data: function data() {
     return {
       // 返回的按钮是否显示
-      isShow: true,
+      isShow: false,
       topItem: '', //返回顶部的标记点
       goodsList: [{
         img: 'http://t9.9026.com/imgs/goodsimg01.png',
@@ -364,7 +368,6 @@ var _default =
     },
 
     handleScroll: function handleScroll(e) {
-      console.log(111);
       //只有scrollTop有用,先拿scrollTop
       var
       scrollTop =
@@ -372,7 +375,7 @@ var _default =
 
       console.log(scrollTop);
       //滑动大于500让按钮显示
-      this.isShow = scrollTop > 200;
+      this.isShow = scrollTop > 500;
       //因为点第二次不行,这里记得重置清空一下
       this.topItem = '';
     },

File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages/goods/goods.wxml


+ 4 - 1
unpackage/dist/dev/mp-weixin/pages/goods/goods.wxss

xqd xqd
@@ -35,6 +35,9 @@
   font-family: PingFang-SC-Heavy, PingFang-SC;
   overflow-x: scroll;
 }
+.scroll-y.data-v-5566b618 {
+  height: 100vh;
+}
 .content.data-v-5566b618 {
   background-color: #FFF;
   padding: 20rpx 30rpx;
@@ -81,7 +84,7 @@
   font-size: 24rpx;
   color: #999999;
 }
-.content .return-btn.data-v-5566b618 {
+.return-btn.data-v-5566b618 {
   position: fixed;
   bottom: 140rpx;
   right: 14rpx;

+ 20 - 0
unpackage/dist/dev/mp-weixin/pages/index/index.js

xqd xqd
@@ -360,6 +360,23 @@ __webpack_require__.r(__webpack_exports__);
         name: '酒店预订' }],
 
 
+      [{
+        img: 'http://t9.9026.com/imgs/swiper01.png',
+        name: '酒店预订' },
+
+      {
+        img: 'http://t9.9026.com/imgs/swiper01.png',
+        name: '酒店预订' },
+
+      {
+        img: 'http://t9.9026.com/imgs/swiper01.png',
+        name: '酒店预订' },
+
+      {
+        img: 'http://t9.9026.com/imgs/swiper01.png',
+        name: '酒店预订' }],
+
+
       [{
         img: 'http://t9.9026.com/imgs/swiper01.png',
         name: '酒店预订' },
@@ -552,6 +569,9 @@ __webpack_require__.r(__webpack_exports__);
     // 切换轮播图指示点
     change1: function change1(e) {
       this.current1 = e.detail.current;
+    },
+    change2: function change2(e) {
+      this.current2 = e.detail.current;
     } } };exports.default = _default;
 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))
 

File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages/index/index.wxml


+ 8 - 3
unpackage/dist/dev/mp-weixin/pages/index/index.wxss

xqd
@@ -223,13 +223,18 @@ page.data-v-57280228 {
   height: 124rpx;
   background-color: #f9f9f9;
 }
-.home-banner-img.data-v-57280228  .uni-swiper__dots-box {
-  bottom: 20px !important;
-}
 .home-brand-img.data-v-57280228 {
   padding: 0 30rpx;
   background-color: #f9f9f9;
 }
+.home-brand-img.data-v-57280228  .uni-swiper__dots-item {
+  width: 22rpx !important;
+  height: 2rpx !important;
+}
+.home-brand-img.data-v-57280228  .uni-swiper__dots-bar {
+  width: 22rpx !important;
+  height: 2rpx !important;
+}
 .home-brand-img .swiper-box.data-v-57280228 {
   background-color: #f9f9f9;
   height: 200rpx;

+ 31 - 20
unpackage/dist/dev/mp-weixin/pages/login/login.js

xqd xqd xqd
@@ -192,10 +192,12 @@ __webpack_require__.r(__webpack_exports__);
 //
 //
 //
+//
 var _default =
 {
   data: function data() {
     return {
+      isLoginOff: false,
       modal: {
         show: false,
         title: '用户信息获取',
@@ -208,7 +210,9 @@ var _default =
       data: {} };
 
   },
-  onLoad: function onLoad() {},
+  onLoad: function onLoad() {
+    this.isLoginOff = this.$store.getters.userInfo;
+  },
   methods: {
     //提交微信名称和头像
     handleConfirmWechatUserInfo: function handleConfirmWechatUserInfo() {var _this = this;
@@ -264,26 +268,33 @@ var _default =
     },
     //获取微信登录的code码
     getmsg: function getmsg() {var _this3 = this;
-      uni.login({
-        provider: uni.$u.platform,
-        success: function success(res) {
-          _this3.getCode().then(function (data) {
-            var params = {
-              code: res.code,
-              iv: data.iv,
-              encryptData: data.encryptData };
-
-            console.log(params);
-            _this3.$api.my.myLogin(params).then(function (res) {var
-
-              token =
-              res.data.token;
-              _this3.$store.dispatch('user/token', token);
-              _this3.handleGetWechatUserInfo();
-              _this3.handleConfirmWechatUserInfo();
+      if (this.isLoginOff) {
+        uni.switchTab({
+          url: '/pages/my/my' });
+
+      } else {
+        uni.login({
+          provider: uni.$u.platform,
+          success: function success(res) {
+            _this3.getCode().then(function (data) {
+              var params = {
+                code: res.code,
+                iv: data.iv,
+                encryptData: data.encryptData };
+
+              console.log(params);
+              _this3.$api.my.myLogin(params).then(function (res) {var
+
+                token =
+                res.data.token;
+                _this3.$store.dispatch('user/token', token);
+                _this3.handleGetWechatUserInfo();
+                _this3.handleConfirmWechatUserInfo();
+              });
             });
-          });
-        } });
+          } });
+
+      }
 
     } } };exports.default = _default;
 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))

+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/login/login.wxml

xqd
@@ -1 +1 @@
-<view class="login data-v-b237504c"><view class="img data-v-b237504c"><image src="http://t9.9026.com/imgs/loginBg.png" mode="scaleToFill" class="data-v-b237504c"></image></view><view class="title data-v-b237504c"><view class="line data-v-b237504c"></view><view class="logintype data-v-b237504c"><text class="data-v-b237504c">登录方式</text></view><view class="line data-v-b237504c"></view></view><view class="typebtn data-v-b237504c"><view data-event-opts="{{[['tap',[['goYouyue',['$event']]]]]}}" class="item data-v-b237504c" bindtap="__e"><image src="/static/icon/youyue.png" mode="scaleToFill" class="data-v-b237504c"></image><text class="data-v-b237504c">加入优悦会</text></view><view data-event-opts="{{[['tap',[['getmsg',['$event']]]]]}}" class="item data-v-b237504c" bindtap="__e"><image src="/static/icon/wechart.png" mode="scaleToFill" class="data-v-b237504c"></image><text class="data-v-b237504c">微信登录</text></view></view><u-modal vue-id="35a7246c-1" show="{{modal.show}}" title="{{modal.title}}" show-confirm-button="{{false}}" class="data-v-b237504c" bind:__l="__l" vue-slots="{{['default']}}"><view class="data-v-b237504c"><button class="avatar data-v-b237504c" open-type="chooseAvatar" data-event-opts="{{[['chooseavatar',[['handleChooseAvatar',['$event']]]]]}}" bindchooseavatar="__e"><image class="user-avatar data-v-b237504c" style="height:176rpx;width:176rpx;border-radius:50%;" src="{{modal.avatar?modal.avatar:'/static/icon/avatar.png'}}"></image></button><input class="avatar data-v-b237504c" type="nickname" placeholder="填写昵称" data-event-opts="{{[['change',[['handleChangeNickname',['$event']]]]]}}" value="{{modal.nickname}}" bindchange="__e"/><button data-event-opts="{{[['tap',[['handleConfirmWechatUserInfo',['$event']]]]]}}" class="confirm data-v-b237504c" bindtap="__e">提交</button></view></u-modal></view>
+<view class="login data-v-b237504c"><view class="img data-v-b237504c"><image src="http://t9.9026.com/imgs/loginBg.png" mode="scaleToFill" class="data-v-b237504c"></image></view><view class="title data-v-b237504c"><view class="line data-v-b237504c"></view><view class="logintype data-v-b237504c"><text class="data-v-b237504c">登录方式</text></view><view class="line data-v-b237504c"></view></view><view class="typebtn data-v-b237504c"><view data-event-opts="{{[['tap',[['goYouyue',['$event']]]]]}}" class="item data-v-b237504c" bindtap="__e"><image src="/static/icon/youyue.png" mode="scaleToFill" class="data-v-b237504c"></image><text class="data-v-b237504c">加入优悦会</text></view><view data-event-opts="{{[['tap',[['getmsg',['$event']]]]]}}" class="item data-v-b237504c" bindtap="__e"><image src="/static/icon/wechart.png" mode="scaleToFill" class="data-v-b237504c"></image><block wx:if="{{!isLoginOff}}"><text class="data-v-b237504c">微信登录</text></block><block wx:if="{{isLoginOff}}"><text class="data-v-b237504c">授权登录</text></block></view></view><u-modal vue-id="35a7246c-1" show="{{modal.show}}" title="{{modal.title}}" show-confirm-button="{{false}}" class="data-v-b237504c" bind:__l="__l" vue-slots="{{['default']}}"><view class="data-v-b237504c"><button class="avatar data-v-b237504c" open-type="chooseAvatar" data-event-opts="{{[['chooseavatar',[['handleChooseAvatar',['$event']]]]]}}" bindchooseavatar="__e"><image class="user-avatar data-v-b237504c" style="height:176rpx;width:176rpx;border-radius:50%;" src="{{modal.avatar?modal.avatar:'/static/icon/avatar.png'}}"></image></button><input class="avatar data-v-b237504c" type="nickname" placeholder="填写昵称" data-event-opts="{{[['change',[['handleChangeNickname',['$event']]]]]}}" value="{{modal.nickname}}" bindchange="__e"/><button data-event-opts="{{[['tap',[['handleConfirmWechatUserInfo',['$event']]]]]}}" class="confirm data-v-b237504c" bindtap="__e">提交</button></view></u-modal></view>

+ 29 - 5
unpackage/dist/dev/mp-weixin/pages/map/map.js

xqd xqd
@@ -500,13 +500,37 @@ __webpack_require__.r(__webpack_exports__);
   },
 
   methods: {
-    getList: function getList() {var _this = this;
+    //计算酒店距离我的位置--int
+    calcDistanceFromHotel: function calcDistanceFromHotel(_ref, _ref2) {var x0 = _ref.x0,y0 = _ref.y0;var x1 = _ref2.x1,y1 = _ref2.y1;
+      //x0,y0是我的坐标(经纬度)
+      //x1,y1是酒店坐标(经纬度)
+      return Math.sqrt(Math.pow(Math.abs(x1 - x0), 2) + Math.pow(Math.abs(y1 - y0), 2)); //返回距离
+    },
+    //遍历所有酒店,并计算出酒店分别与我的距离--数组
+    setEachHotelDistance: function setEachHotelDistance() {var _this = this;var hotelArray = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];var _ref3 = arguments.length > 1 ? arguments[1] : undefined,x0 = _ref3.x0,y0 = _ref3.y0;
+      hotelArray.map(function (item) {
+        item.distanceToMe = _this.calcDistanceFromHotel({ x0: x0, y0: y0 }, { x1: item.longitude, y1: item.latitude });
+        return item;
+      });
+      return hotelArray;
+
+    },
+    //筛选出距离我最近的酒店--对象
+    getMinDistanceHotel: function getMinDistanceHotel(_ref4) {var x0 = _ref4.x0,y0 = _ref4.y0;
+      this.markers = this.setEachHotelDistance(this.markers, { x0: x0, y0: y0 });
+      this.markers.sort(function (prev, next) {
+        return prev.distanceToMe - next.distanceToMe;
+      });
+      return this.markers[0];
+    },
+    //-------------------------------------
+    getList: function getList() {var _this2 = this;
       this.$api.hotel.getHotelList({
         page: 1 }).
       then(function (res) {
-        _this.hotelList = res.data.data;
-        console.log(_this.hotelList);
-        _this.markers = _this.hotelList.map(function (item) {
+        _this2.hotelList = res.data.data;
+        console.log(_this2.hotelList);
+        _this2.markers = _this2.hotelList.map(function (item) {
           return {
             id: item.id,
             latitude: item.latitude,
@@ -522,7 +546,7 @@ __webpack_require__.r(__webpack_exports__);
 
 
         });
-        console.log(_this.markers);
+        console.log(_this2.markers);
       });
     },
     //去预定页面

+ 1 - 0
unpackage/dist/dev/mp-weixin/pages/my/my.js

xqd
@@ -327,6 +327,7 @@ __webpack_require__.r(__webpack_exports__);
       this.$api.my.update({ avatar: this.modal.avatar, nickname: this.modal.nickname }).then(function (res) {
         _this.$hideLoading();
         _this.$store.dispatch('user/info', res.data);
+        _this.admin = _this.$store.getters.userInfo;
         _this.modal.show = false;
       });
     },

+ 6 - 4
unpackage/dist/dev/mp-weixin/pages/my/setting/setting.js

xqd
@@ -187,10 +187,12 @@ var _default =
     // 退出登录
     loginOut: function loginOut() {
       if (this.$store.getters.token) {
-        this.$store.dispatch("user/info", null);
-        this.$store.dispatch("user/token", null);
-        uni.removeStorageSync('auth_token');
-        uni.removeStorageSync('userInfo');
+        //记录用户曾经登录过
+        this.$store.getters.userInfo.isLoginOff = true;
+        this.$store.dispatch("user/info", this.$store.getters.userInfo);
+        // this.$store.dispatch("user/token", null)
+        // uni.removeStorageSync('auth_token')
+        // uni.removeStorageSync('userInfo')
         uni.reLaunch({
           url: '/pages/login/login' });
 

+ 2 - 2
unpackage/dist/dev/mp-weixin/pages/my/setting/setting.wxss

xqd xqd
@@ -40,7 +40,7 @@
   box-sizing: border-box;
   height: 110rpx;
   width: 690rpx;
-  border-bottom: solid  2rpx #F0F0F0;
+  border-bottom: solid 2rpx #F0F0F0;
   display: flex;
   align-items: center;
   position: relative;
@@ -62,7 +62,7 @@
   box-sizing: border-box;
   height: 110rpx;
   width: 690rpx;
-  border-bottom: solid  0rpx #F0F0F0;
+  border-bottom: solid 0rpx #F0F0F0;
   display: flex;
   align-items: center;
   position: relative;

Some files were not shown because too many files changed in this diff