dwh 2 жил өмнө
parent
commit
94b3aee331

+ 12 - 1
src/App.vue

@@ -6,7 +6,18 @@
 		<router-view v-if="!$route.meta.keepAlive"></router-view>
 	</div>
 </template>
-
+<script>
+	export default{
+		mounted() {
+			this.$getStatusBarHeight();
+		},
+		methods:{
+			getStatusBarHeightInvoke(data){
+				this.$toast(JSON.stringify(data));
+			}
+		}
+	}
+</script>
 <style lang="scss">
 @import "./public.scss";
 	*{

+ 44 - 0
src/main.js

@@ -31,6 +31,50 @@ Vue.prototype.$TUIKitTIM = TIM;
 Vue.prototype.$TUIKitEvent = TIM.EVENT;
 Vue.prototype.$TUIKitVersion = TIM.VERSION;
 Vue.prototype.$TUIKitTypes = TIM.TYPES; // 监听系统级事件
+vue.prototype.$getIDFA=()=>{
+	window.webkit.messageHandlers.call.postMessage({
+		api:"com.js.getIDFA",
+		data:{},
+		callback:'idfaInvoke'
+	}) 
+}
+vue.prototype.$getDeviceInfo=()=>{
+	window.webkit.messageHandlers.call.postMessage({
+		api:"com.js.getDeviceInfo",
+		data:{},
+		callback:'deviceInfoInvoke'
+	}) 
+}
+vue.prototype.$getDeviceToken=()=>{
+	window.webkit.messageHandlers.call.postMessage({
+		api:"com.js.deviceToken",
+		data:{},
+		callback:'deviceTokenInvoke'
+	})  
+}
+vue.prototype.$toShare=(img,url)=>{
+	window.webkit.messageHandlers.call.postMessage({
+		api:"com.js.nativeShare",
+		data:{
+			title:'糖果公园',
+			image:img||'https://lmg.jj20.com/up/allimg/4k/s/02/2109242332225H9-0-lp.jpg',
+			link:url
+		},
+		callback:'toShareInvoke'
+	})
+}
+vue.prototype.$toOutLink=(url)=>{
+	window.webkit.messageHandlers.call.postMessage({
+		api:"com.js.urlJump",
+		data:{
+			url:url
+		},
+		callback:'toOutLinkInvoke'
+	}) 
+}
+vue.prototype.$toOutLinkByBrowser=(url)=>{
+	window.location.href=`sugarpark://${encodeURIComponent(url)}`
+}
 new Vue({
   router,
   store,

+ 1 - 1
src/router/index.js

@@ -88,7 +88,7 @@ const routes = [
     path: "/user",
     name: "user",
 	meta:{
-		keepAlive:false
+		keepAlive:true
 	},
     component: ()=>import("../views/friends/user.vue")
   },

+ 70 - 29
src/views/friends/user.vue

@@ -128,7 +128,7 @@
 			<div class="tab-box flex-start">
 				<div class="tab-item" @click="tabClick(0)" >
 					<div class="tab-item-text fw700" :style="{
-					'font-size':`${tabIndex===0?'44rpx':'36rpx'}`,
+					'font-size':`${tabIndex===0?'22px':'18px'}`,
 					'color':`${tabIndex===0?'#ffffff':''}`,
 					'font-weight':`${tabIndex===0?'#ffffff':''}`}">关于{{otherInfo.sex==='Famale'?'她':'他'}}</div>
 				</div>
@@ -139,35 +139,35 @@
 					'color':`${tabIndex===1?'#ffffff':''}`,
 					'font-weight':`${tabIndex===1?'#ffffff':''}`}">动态</div>
 				</div> -->
-				<img :src="`${assetsUrl}friends-circle.png`" mode="aspectFill" class="tab-item-bg" :style="{'left':`${tabIndex*195+15}rpx`}" ></img>
+				<img :src="`${assetsUrl}friends-circle.png`" mode="aspectFill" class="tab-item-bg" :style="{'left':`${tabIndex*195+15}px`}" ></img>
 			</div>
 			<div class="cup-box flex-start">
 				<div class="cup-item flex-center"  v-if="otherInfo.realMan">
-					<img :src="`${assetsUrl}friends-real.png`" mode="aspectFit" class="cup-img" style="width: 76rpx;height: 40rpx;"></img>
+					<img :src="`${assetsUrl}friends-real.png`" mode="aspectFit" class="cup-img" style="width: 38px;height: 20px;"></img>
 					<div class="cup-text font24" >
 						{{otherInfo.sex==='Famale'?'她':'他'}}已完成真人认证
 					</div>
 				</div>
 				<div class="cup-item flex-center"  v-if="otherInfo.vip">
-					<img :src="`${assetsUrl}friends-vip.png`" mode="aspectFit" class="cup-img" style="width: 76rpx;height: 40rpx;"></img>
+					<img :src="`${assetsUrl}friends-vip.png`" mode="aspectFit" class="cup-img" style="width:38px;height: 20px;"></img>
 					<div class="cup-text font24" >
 						{{otherInfo.sex==='Famale'?'她':'他'}}是尊贵的vip用户
 					</div>
 				</div>
 <!-- 				<div class="cup-item flex-center">
-					<img :src="`${assetsUrl}user-cup.png`" mode="aspectFit" class="cup-img" style="width: 40rpx;height: 40rpx;"></img>
+					<img :src="`${assetsUrl}user-cup.png`" mode="aspectFit" class="cup-img" style="width: 20px;height: 20px;"></img>
 					<div class="cup-text font24">
 						重庆市魅力榜第3名
 					</div>
 				</div> -->
 				<div class="cup-item flex-center" v-if="otherInfo.goddess&&otherInfo.realMan">
-					<img :src="`${assetsUrl}user-charm.png`" mode="aspectFit" class="cup-img" style="width: 76rpx;height: 42rpx;"></img>
+					<img :src="`${assetsUrl}user-charm.png`" mode="aspectFit" class="cup-img" style="width: 38px;height: 20px;"></img>
 					<div class="cup-text font24">
 						{{otherInfo.sex==='Famale'?'她':'他'}}已完成真人认证且颜值较高
 					</div>
 				</div>
 				<div class="cup-item flex-center" v-if="!otherInfo.realMan">
-					<img :src="`${assetsUrl}user-no-real.png`" mode="aspectFit" class="cup-img" style="width: 76rpx;height: 42rpx;"></img>
+					<img :src="`${assetsUrl}user-no-real.png`" mode="aspectFit" class="cup-img" style="width: 38px;height: 21px;"></img>
 					<div class="cup-text font24">
 						{{otherInfo.sex==='Famale'?'她':'他'}}未完成真人认证、交友谨慎
 					</div>
@@ -221,7 +221,7 @@
 			</div>
 		</div>
 		<div class="btn-box flex-between">
-			<div class="talk-btn flex-center" :style="{'width':`${isLiked?'100%':'160px'}`}" @click="toTalk">
+			<div class="talk-btn flex-center" :style="{'width':`${isLiked?'100%':'160px'}`}" @click="toTalk(otherInfo.id)">
 				<img :src="`${assetsUrl}user-talk.png`" mode="aspectFit" class="btn-icon"></img>
 				<p class="btn-text font32 fw600">聊一聊</p>
 			</div>
@@ -466,27 +466,68 @@
 					this.likeNum=res.data;
 				})
 			},
-			toTalk(){
-				console.log(this.userInfo)
-				if(this.userInfo.sex==='Male'&&!this.userInfo.vip){
-					this.payPopupIndex=0;
-					this.showPayPopup=true;
-					return;
-				}
-				if(this.userInfo.sex==='Famale'&&!this.userInfo.realMan){
-					this.popup={
-						content1:'认证后才能开启私聊哦',
-						content2:'给客服回复关键词「真人认证」',
-						tip1:'',
-						tip2:'',
-						btntext:'联系客服去认证'
-					}
-					this.showPopup=true;
-					return;
-				}
-				// uni.navigateTo({
-				// 	url:`/pagesSub/chatting/chatting?conversationid=C2C${this.userInfo.id}`
-				// })
+			toTalk(id){
+				this.$toast.loading({
+				  message: '加载中',
+				  forbidClick: true,
+				  duration:0
+				});
+				let user=JSON.parse(localStorage.getItem('user'));
+				this.$api.public.userDetail({getAlbum:true,completeUser:user,uponUserId:id}).then(res=>{
+					this.$toast.clear();
+					this.otherInfo=res.data;
+					let arr=[],obj={latitude:0,longitude:0};
+					obj.latitude=this.otherInfo.geo.lat;
+					obj.longitude=this.otherInfo.geo.lon;
+					arr.push(obj);
+					wxMapSdk.calculateDistance({
+						mode:'straight',
+						from:{
+							latitude: this.$store.state.latitude,
+							longitude: this.$store.state.longitude
+						},
+						to:arr,
+						success:dists=>{
+						
+							if(dists.message==="query ok"){
+								console.log(dists,this.otherInfo,this.userInfo)
+								for(let j=0;j<dists.result.elements.length;j++){
+									this.otherInfo.distance=(dists.result.elements[j].distance>1000?`${Math.floor(dists.result.elements[j].distance/100)/10}km`:`${dists.result.elements[j].distance}m`)
+								}
+								if(this.userInfo.sex==='Male'&&!this.userInfo.vip){
+									this.payPopupIndex=0;
+									this.showPayPopup=true;
+									return;
+									
+								}
+								if(this.userInfo.sex==='Famale'&&!this.userInfo.realMan){
+									this.popup={
+										content1:'认证后才能开启私聊哦',
+										content2:'给客服回复关键词「真人认证」',
+										tip1:'',
+										tip2:'',
+										btntext:'去认证'
+									}
+									this.showPopup=true;
+									return;
+								}
+								localStorage.setItem('otherInfo',JSON.stringify(this.otherInfo));
+								this.$router.push({name:'chatting',params:{conversationid:`C2C${id}`}})
+							}
+							else{
+								this.$toast('计算距离失败')
+							}
+							
+						},
+						fail:err=>{
+							console.log(err)
+						}
+					})
+					
+					
+				})
+					
+				
 			},
 			getMineDetail(){
 				let user=JSON.parse(localStorage.getItem('user'));

+ 43 - 13
src/views/login/loginByCode.vue

@@ -42,11 +42,32 @@
 					androidMarket:'WechatMP',
 					model:''
 				},
+				getCodeOptions:{
+					authenticate: "authenticate",
+					phone: '',
+					scene: "VerCodeLogin",
+					token: "token",
+					wxLoginInfo:{
+						openId:null,
+						unionId:null
+					}
+				}
 			};
 		},
 		mounted() {
 			this.phone=this.$route.params.phone;
-			this.reGetCode()
+			this.time=60;
+			this.btnStr=`重新获取(${--this.time}s)`
+			this.timer=setInterval(()=>{
+				if(this.time<=1){
+					clearInterval(this.timer);
+					this.timer=null;
+					this.btnStr="重新获取"
+				}
+				else{
+					this.btnStr=`重新获取(${--this.time}s)`
+				}
+			},1000);
 		},
 		methods:{
 			clear(){
@@ -85,18 +106,27 @@
 				}
 			},
 			reGetCode(){
-					this.time=60;
-					this.btnStr=`重新获取(${--this.time}s)`
-					this.timer=setInterval(()=>{
-						if(this.time<=1){
-							clearInterval(this.timer);
-							this.timer=null;
-							this.btnStr="重新获取"
-						}
-						else{
-							this.btnStr=`重新获取(${--this.time}s)`
-						}
-					},1000)
+					
+					if(!this.getCodeOptions.phone){
+						this.$toast('请输入手机号');
+						return;
+					}
+					if(!checkPhone(this.getCodeOptions.phone)){
+						this.$toast('手机号格式不正确');
+						return;
+					}
+					this.$toast.loading({
+					  message: '发送中...',
+					  forbidClick: true,
+					  duration:0
+					});
+					console.log(this.$api)
+					this.$api.login.call4VeriCode(this.getCodeOptions).then(res=>{	
+						this.$toast.clear();
+						this.$router.push({name:'loginByCode',params:{phone:this.getCodeOptions.phone}});
+					}).catch(err=>{
+						console.log(err)
+					})
 			},
 			getMineDetail(regStepNew){
 				let user=JSON.parse(localStorage.getItem('user'));

+ 1 - 1
src/views/messages/messages.vue

@@ -133,7 +133,7 @@
 				return this.$store.state.platform;
 			},
 			mineInfo(){
-				return this.$store.state.userInfo||JSON.parse(localStorage.getItem('userInfo'))
+				return JSON.parse(localStorage.getItem('userInfo'))
 			}
 		},
 		created() {

+ 13 - 20
src/views/test/test.vue

@@ -6,6 +6,7 @@
 		<button @click="toShare">share</button>
 		<button @click="toOutLink">toOutLink</button>
 		<button @click="toOutLinkByBrowser">toOutLinkByBrowser</button>
+		<button @click="getStatusBarHeight">getStatusBarHeight</button>
 	</div>
 </template>
 
@@ -48,12 +49,6 @@
 			window.systemPushInvoke=(data)=>{
 				this.$toast(JSON.stringify(data));
 			};
-			window.toWxPayInvoke=(data)=>{
-				this.$toast(JSON.stringify(data));
-			};
-			window.toAliPayInvoke=(data)=>{
-				this.$toast(JSON.stringify(data));
-			};
 			window.payedInvoke=(data)=>{
 				this.$toast(JSON.stringify(data));
 			};
@@ -62,6 +57,9 @@
 			};
 			window.toOutLinkInvoke=(data)=>{
 				this.$toast(JSON.stringify(data));
+			};
+			window.getStatusBarHeightInvoke=(data)=>{
+				this.$toast(JSON.stringify(data))
 			}
 		},
 		methods:{
@@ -91,20 +89,6 @@
 					callback:'deviceTokenInvoke'
 				}) 
 			},
-			toWxPay(){
-				window.webkit.messageHandlers.call.postMessage({
-					api:"com.js.toWxPay",
-					data:{},
-					callback:'toWxPayInvoke'
-				}) 
-			},
-			toAliPay(){
-				window.webkit.messageHandlers.call.postMessage({
-					api:"com.js.toAliPay",
-					data:{},
-					callback:'toAliPayInvoke'
-				}) 
-			},
 			toShare(){
 				window.webkit.messageHandlers.call.postMessage({
 					api:"com.js.nativeShare",
@@ -127,6 +111,15 @@
 			},
 			toOutLinkByBrowser(){
 				window.location.href=`sugarpark://${encodeURIComponent('https://www.sugarpark.cn')}`
+			},
+			getStatusBarHeight(){//获取状态栏和底部安全距离
+				window.webkit.messageHandlers.call.postMessage({
+					api:"com.js.getStatusBarHeight",
+					data:{
+						url:'https://www.baidu.com'
+					},
+					callback:'getStatusBarHeightInvoke'
+				}) 
 			}
 			
 		}