连云港陪玩陪聊
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

280 lines
6.8 KiB

3 months ago
<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>
1 month ago
<view class="desc">马上配发一个{{userInfo.sex==1?'小可爱':'小帅哥'}}</view>
3 months ago
<view class="dian">
1 month ago
<view class="info" v-if="isSucess <= 2">
<image :src="userInfo.faceImage?userInfo.faceImage:userInfo.img"></image>
<view class="txt">{{userInfo.nickname}}</view>
3 months ago
</view>
1 month ago
<view class="user" v-if="isSucess == 3">
3 months ago
<view class="item">
1 month ago
<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}}
3 months ago
</view>
</view>
<view class="items">
<image src="@/static/xin2.png"></image>
</view>
<view class="item">
1 month ago
<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}}
3 months ago
</view>
</view>
</view>
</view>
</view>
1 month ago
<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>
3 months ago
</view>
</view>
</template>
<script>
1 month ago
let timer = null;
3 months ago
export default {
data() {
return {
1 month ago
isSucess: 1,
info: {},
1 month ago
count: 10,
1 month ago
userInfo: {},
3 months ago
background: {
// 导航栏背景图
1 month ago
background: 'url(https://api.lyiyuan.cn/profile/upload/static/tongcheng-bg.png) center top no-repeat',
3 months ago
// 还可以设置背景图size属性
backgroundSize: '100 auto',
},
};
1 month ago
},
onLoad() {
this.userInfo = uni.getStorageSync("userInfo");
1 month ago
this.count = Math.floor(Math.random() * (10 - 1 + 1)) + 1;
1 month ago
},
methods: {
toPage(index){
const that = this;
if(index == 1){
that.isSucess = 2;
timer = setInterval(()=>{
if(that.count == 0){
clearInterval(timer);
1 month ago
that.count = Math.floor(Math.random() * (10 - 1 + 1)) + 1;
1 month ago
that.sameCitySpeedDating();
}else{
that.count --
}
},1000)
}else if(index == 2){
this.toChat();
}else if(index == 3){
that.isSucess = 1;
1 month ago
that.count = Math.floor(Math.random() * (10 - 1 + 1)) + 1;
1 month ago
}
},
//去聊天
async toChat() {
const { code, data } = await this.$api.findZegoToken({
userId: uni.getStorageSync("userInfo").id,
1 month ago
sellerId: this.info.id
1 month ago
})
if(code == 200){
uni.setStorageSync("chatToken",data.token);
uni.navigateTo({
1 month ago
url: "/pages/users/chat/index?id="+this.info.id+"&roomId="+data.roomId
1 month ago
})
}
},
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);
3 months ago
}
}
</script>
<style scoped lang="scss">
.tongcheng{
1 month ago
background: #0d0b15 url(https://api.lyiyuan.cn/profile/upload/static/tongcheng-bg.png) center top no-repeat;
3 months ago
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>