|
|
|
<template>
|
|
|
|
<view class="tongcheng">
|
|
|
|
<view class="tongcheng-navbar">
|
|
|
|
<u-navbar title="同城速配" back-icon-color="#ffffff" title-color="#ffffff" :background="background"></u-navbar>
|
|
|
|
</view>
|
|
|
|
<view class="tongcheng-content">
|
|
|
|
<view class="title">开始心电感应吧</view>
|
|
|
|
<view class="desc">马上配发一个{{userInfo.sex==1?'小可爱':'小帅哥'}}</view>
|
|
|
|
<view class="dian">
|
|
|
|
<view class="info" v-if="isSucess <= 2">
|
|
|
|
<image :src="userInfo.faceImage?userInfo.faceImage:userInfo.img"></image>
|
|
|
|
<view class="txt">{{userInfo.nickname}}</view>
|
|
|
|
</view>
|
|
|
|
<view class="user" v-if="isSucess == 3">
|
|
|
|
<view class="item">
|
|
|
|
<image class="avatar" :src="userInfo.faceImage?userInfo.faceImage:userInfo.img"></image>
|
|
|
|
<view class="txt">{{userInfo.nickname}}</view>
|
|
|
|
<view class="sex" :class="userInfo.sex == 1?'nan':'nv'">
|
|
|
|
<image class="icon" v-if="userInfo.sex == 2" src="/static/icon-nv.png"></image>
|
|
|
|
<image class="icon" v-if="userInfo.sex == 1" src="/static/icon-nan.png"></image>
|
|
|
|
{{userInfo.age}}
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="items">
|
|
|
|
<image src="@/static/xin2.png"></image>
|
|
|
|
</view>
|
|
|
|
<view class="item">
|
|
|
|
<image class="avatar" :src="info.faceImage?info.faceImage:info.img"></image>
|
|
|
|
<view class="txt">{{info.nickname}}</view>
|
|
|
|
<view class="sex" :class="info.sex == 1?'nan':'nv'">
|
|
|
|
<image class="icon" v-if="info.sex == 2" src="/static/icon-nv.png"></image>
|
|
|
|
<image class="icon" v-if="info.sex == 1" src="/static/icon-nan.png"></image>
|
|
|
|
{{info.age}}
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="tongcheng-start" v-if="isSucess == 1" @click="toPage(1)">开始匹配</view>
|
|
|
|
<view class="tongcheng-start" v-if="isSucess == 2">匹配中</view>
|
|
|
|
<view class="tongcheng-end" v-if="isSucess == 3">
|
|
|
|
<view class="send" @click="toPage(2)">发送消息</view>
|
|
|
|
<view class="todo" @click="toPage(3)">继续探索</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
let timer = null;
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isSucess: 1,
|
|
|
|
info: {},
|
|
|
|
count: 10,
|
|
|
|
userInfo: {},
|
|
|
|
background: {
|
|
|
|
// 导航栏背景图
|
|
|
|
background: 'url(https://api.lyiyuan.cn/profile/upload/static/tongcheng-bg.png) center top no-repeat',
|
|
|
|
// 还可以设置背景图size属性
|
|
|
|
backgroundSize: '100 auto',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
onLoad() {
|
|
|
|
this.userInfo = uni.getStorageSync("userInfo");
|
|
|
|
this.count = Math.floor(Math.random() * (10 - 1 + 1)) + 1;
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
toPage(index){
|
|
|
|
const that = this;
|
|
|
|
if(index == 1){
|
|
|
|
that.isSucess = 2;
|
|
|
|
timer = setInterval(()=>{
|
|
|
|
if(that.count == 0){
|
|
|
|
clearInterval(timer);
|
|
|
|
that.count = Math.floor(Math.random() * (10 - 1 + 1)) + 1;
|
|
|
|
that.sameCitySpeedDating();
|
|
|
|
}else{
|
|
|
|
that.count --
|
|
|
|
}
|
|
|
|
},1000)
|
|
|
|
}else if(index == 2){
|
|
|
|
this.toChat();
|
|
|
|
}else if(index == 3){
|
|
|
|
that.isSucess = 1;
|
|
|
|
that.count = Math.floor(Math.random() * (10 - 1 + 1)) + 1;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
//去聊天
|
|
|
|
async toChat() {
|
|
|
|
const { code, data } = await this.$api.findZegoToken({
|
|
|
|
userId: uni.getStorageSync("userInfo").id,
|
|
|
|
sellerId: this.info.id
|
|
|
|
})
|
|
|
|
if(code == 200){
|
|
|
|
uni.setStorageSync("chatToken",data.token);
|
|
|
|
uni.navigateTo({
|
|
|
|
url: "/pages/users/chat/index?id="+this.info.id+"&roomId="+data.roomId
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async sameCitySpeedDating() {
|
|
|
|
const { code, data, msg } = await this.$api.sameCitySpeedDating({
|
|
|
|
userId: uni.getStorageSync("userInfo").id,
|
|
|
|
lat: uni.getStorageSync("jingweiInfo").latitude,
|
|
|
|
lon: uni.getStorageSync("jingweiInfo").longitude,
|
|
|
|
city: uni.getStorageSync("jingweiInfo").new_city?uni.getStorageSync("jingweiInfo").new_city:uni.getStorageSync("jingweiInfo").city,
|
|
|
|
})
|
|
|
|
if(code == 200){
|
|
|
|
this.isSucess = 3;
|
|
|
|
this.info = data
|
|
|
|
}else{
|
|
|
|
this.isSucess = 1;
|
|
|
|
uni.showToast({
|
|
|
|
title: msg,
|
|
|
|
position: "bottom",
|
|
|
|
icon: "none",
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onUnload() {
|
|
|
|
clearInterval(timer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.tongcheng{
|
|
|
|
background: #0d0b15 url(https://api.lyiyuan.cn/profile/upload/static/tongcheng-bg.png) center top no-repeat;
|
|
|
|
background-size: 100% auto;
|
|
|
|
overflow: hidden;
|
|
|
|
min-height: 100vh;
|
|
|
|
&-content{
|
|
|
|
text-align: center;
|
|
|
|
.title{
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 48rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
margin-top: 120rpx;
|
|
|
|
}
|
|
|
|
.desc{
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
margin-top: 30rpx;
|
|
|
|
}
|
|
|
|
.dian{
|
|
|
|
width: 555rpx;
|
|
|
|
height: 410rpx;
|
|
|
|
background: url(@/static/tongcheng-xin.png) center top no-repeat;
|
|
|
|
background-size: 100% auto;
|
|
|
|
margin: 0 auto;
|
|
|
|
margin-top: 90rpx;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
.user{
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
margin-top: -10rpx;
|
|
|
|
margin-left: 20rpx;
|
|
|
|
.items{
|
|
|
|
width: 150rpx;
|
|
|
|
margin-top: 40rpx;
|
|
|
|
image{
|
|
|
|
width: 66rpx;
|
|
|
|
height: 52rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.item{
|
|
|
|
width: 130rpx;
|
|
|
|
.avatar{
|
|
|
|
width: 120rpx;
|
|
|
|
height: 120rpx;
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|
|
|
|
.txt{
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
margin-top: 10rpx;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
|
|
|
width: 150rpx;
|
|
|
|
}
|
|
|
|
.sex{
|
|
|
|
width: 120rpx;
|
|
|
|
height: 50rpx;
|
|
|
|
border-radius: 50rpx;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
margin: 0 auto;
|
|
|
|
margin-top: 10rpx;
|
|
|
|
&.nv{
|
|
|
|
background-color: #D750F3;
|
|
|
|
}
|
|
|
|
&.nan{
|
|
|
|
background-color: #6812A8;
|
|
|
|
}
|
|
|
|
image{
|
|
|
|
width: 22rpx;
|
|
|
|
height: 22rpx;
|
|
|
|
margin-right: 10rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.info{
|
|
|
|
text-align: center;
|
|
|
|
margin-left: 60rpx;
|
|
|
|
image{
|
|
|
|
width: 180rpx;
|
|
|
|
height: 180rpx;
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|
|
|
|
.txt{
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
margin-top: 10rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
&-start{
|
|
|
|
position: absolute;
|
|
|
|
left: 50%;
|
|
|
|
margin-left: -150rpx;
|
|
|
|
bottom: 150rpx;
|
|
|
|
z-index: 21;
|
|
|
|
width: 300rpx;
|
|
|
|
height: 90rpx;
|
|
|
|
background: #232030;
|
|
|
|
border-radius: 90rpx;
|
|
|
|
line-height: 90rpx;
|
|
|
|
text-align: center;
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
}
|
|
|
|
&-end{
|
|
|
|
width: 100%;
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
bottom: 70rpx;
|
|
|
|
z-index: 21;
|
|
|
|
.send{
|
|
|
|
width: 300rpx;
|
|
|
|
height: 90rpx;
|
|
|
|
background: #232030;
|
|
|
|
border-radius: 90rpx;
|
|
|
|
line-height: 90rpx;
|
|
|
|
text-align: center;
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
.todo{
|
|
|
|
width: 300rpx;
|
|
|
|
height: 90rpx;
|
|
|
|
line-height: 90rpx;
|
|
|
|
text-align: center;
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|