连云港陪玩陪聊
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.
 
 
 
 
 
 
chunwan/pages/pipei/shipin/index.vue

475 lines
11 KiB

<template>
<view class="tongcheng">
<view class="tongcheng-navbar">
<u-navbar :title="title" back-icon-color="#ffffff" title-color="#ffffff" :background="background"></u-navbar>
</view>
<view class="tongcheng-content">
<view class="title" v-if="isSucess == 1">正在寻找新朋友...</view>
<view class="desc" v-if="isSucess == 1">当前用户过多,请耐心等待</view>
<view class="desc1" v-else>{{isSucess == 1?'你有一条新的缘分!':'匹配成功,马上开始这段缘分吧!'}}</view>
<view class="dian" v-if="isSucess == 1">
<view class="user">
<view class="item">
<image class="avatar" :src="userInfo.faceImage?userInfo.faceImage:userInfo.img"></image>
<view class="txt">{{userInfo.nickname}}</view>
</view>
<view class="items">
<image src="@/static/yuyin-xin2.png"></image>
</view>
<view class="item">
<view class="pic">
<image class="avatar1" src="@/static/nan.png"></image>
<image class="avatar2" src="@/static/nv.png"></image>
</view>
</view>
</view>
</view>
<view class="dian-on" v-if="isSucess == 2">
<view class="info">
<image :src="info.faceImage?info.faceImage:info.img"></image>
<view class="name">{{info.nickname}}</view>
<view class="txt">{{info.age}}/{{info.height}}</view>
</view>
<view class="tag">
<view class="titles">个性签名:</view>
<view class="descs">
<text>{{info.declaration}}</text>
</view>
</view>
</view>
</view>
<view class="tongcheng-end" v-if="isSucess == 1">
<view class="send">茫茫人海,今天和你相遇</view>
<view class="todo" @click="toBack()">
<image src="@/static/yuyin-cha.png"></image>
</view>
</view>
<!-- <view class="tongcheng-start"> -->
<!-- <view class="item" @click="toggleMenu(1)">
<image src="@/static/yuyin-01.png" v-if="isMakefeng"></image><image v-else src="@/static/yuyin-01-on.png"></image>麦克风{{isMakefeng?'开启':'已关'}}
</view>
<view class="item" @click="toggleMenu(2)">
<image src="@/static/yuyin-03.png" v-if="isYangshengqi"></image><image v-else src="@/static/yuyin-03-on.png"></image>扬声器{{isYangshengqi?'开启':'已关'}}
</view>
<view class="item" @click="toggleMenu(6)">
<image src="@/static/yuyin-04.png" v-if="isShexiangtou"></image><image v-else src="@/static/yuyin-04-on.png"></image>摄像头{{isShexiangtou?'开启':'已关'}}
</view> -->
<!-- <view class="item"></view> -->
<!-- <view class="items">
<image @click="toggleMenu(4)" src="@/static/yuyin-02.png"></image>
<image @click="toggleMenu(5)" class="off" src="@/static/yuyin-off.png"></image>
</view> -->
<!-- <view class="item"></view> -->
<!-- </view> -->
<view class="tongcheng-start" v-if="isSucess == 2">
<view class="item" @click="toPage(1)">
<image src="@/static/yuyin-02.png"></image>换一个
</view>
<view class="item">
<image src="@/static/yuyin-05.png"></image>{{isSucess == 2?'等待中':'立即进入'}}
</view>
</view>
<!-- <view class="tongcheng-video">
<view class="other"></view>
<view class="content"></view>
</view> -->
</view>
</template>
<script>
let timer = null;
export default {
data() {
return {
info: {},
count: 10,
userInfo: {},
isJieshou: false,
title: "视频速配",
isShexiangtou: true,
isMakefeng: true,
isYangshengqi: true,
isSucess: 1,
background: {
// 导航栏背景图
background: 'url(https://api.lyiyuan.cn/profile/upload/static/yuyin-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;
this.toPage(1)
},
onReady() {
this.watchSocket();
},
methods: {
watchSocket() {
const that = this;
uni.$on("jiantingTiaozhuan",function (obj) {
console.log("watchSocket",obj)
if(obj.topic == 'message'){
if(obj.type>= 8){
if(uni.getStorageSync("userInfo").id == obj.sellerId){
if(obj.type == 10){
setTimeout(()=>{that.toPage(2,obj.userId)},500)
}else if(obj.type == 11){
that.isSucess = 1
that.toPage(1);
}
}
}
}
});
},
toBack() {
clearInterval(timer);
uni.navigateBack({
delta: 1
})
},
toPage(index,id){
const that = this;
if(index == 1){
that.isSucess = 1;
clearInterval(timer);
timer = setInterval(()=>{
if(that.count == 0){
clearInterval(timer);
that.count = Math.floor(Math.random() * (10 - 1 + 1)) + 1;
that.userSpeedDating();
}else{
that.count --
}
},1000)
}else if(index == 2){
this.toChat(id);
}else if(index == 3){
that.isSucess = 1;
that.count = Math.floor(Math.random() * (10 - 1 + 1)) + 1;
}
},
//去视频聊天
async toChat(id) {
console.log("toChat",uni.getStorageSync("userInfo").id , id)
uni.navigateTo({
url: "/pages/pipei/shipin/detail?type=2&id="+id
})
},
async userSpeedDating() {
const { code, data, msg } = await this.$api.userSpeedDating({
userId: uni.getStorageSync("userInfo").id,
type: 2,
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 = 2;
this.info = data
uni.sendSocketMessage({data:JSON.stringify({
"userId": uni.getStorageSync("userInfo").id,
sellerId: data.id,
type: 9,
"topic":"message"
})})
}else{
this.isSucess = 1;
uni.showToast({
title: msg,
position: "bottom",
icon: "none",
})
}
},
toggleMenu(index){
if(index == 1){
this.isMakefeng = !this.isMakefeng
}else if(index == 2){
this.isYangshengqi = !this.isYangshengqi
}else if(index == 3){
this.isJieshou = !this.isJieshou
this.title = (this.isJieshou == false?"视频速配":'00:59')
}else if(index == 4){
uni.navigateBack({
delta: 1
})
}else if(index == 6){
this.isShexiangtou = !this.isShexiangtou
}
},
}
}
</script>
<style scoped lang="scss">
.tongcheng{
background: #0d0b15 url(https://api.lyiyuan.cn/profile/upload/static/yuyin-bg.png) center top no-repeat;
background-size: 100% auto;
overflow: hidden;
min-height: 100vh;
&-video{
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 20;
background-color: #000;
.other{
width: 280rpx;
height: 340rpx;
position: absolute;
right: 25rpx;
top: 200rpx;
z-index: 2;
background: #FFFFFF;
border-radius: 20rpx;
}
}
&-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;
}
.desc1{
font-weight: 500;
font-size: 30rpx;
color: #FFFFFF;
margin-top: 120rpx;
}
.dian{
width: 648rpx;
height: 648rpx;
background: url(@/static/yuyin-bg2.png) center top no-repeat;
background-size: 100% auto;
margin: 0 auto;
margin-top: 50rpx;
display: flex;
align-items: center;
justify-content: center;
.user{
display: flex;
align-items: center;
justify-content: space-between;
margin-top: -10rpx;
margin-left: 20rpx;
.items{
width: 290rpx;
position: relative;
z-index: 5;
image{
width: 290rpx;
height: 86rpx;
}
}
.item{
width: 180rpx;
position: relative;
height: 180rpx;
.avatar{
width: 180rpx;
height: 180rpx;
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: 180rpx;
}
.pic{
width: 180rpx;
position: relative;
left: -30rpx;
z-index: 2;
.avatar1{
width: 180rpx;
height: 180rpx;
border-radius: 50%;
opacity: 0.5;
position: absolute;
left: 0;
top: 0;
z-index: 3;
}
.avatar2{
width: 180rpx;
height: 180rpx;
border-radius: 50%;
opacity: 0.3;
position: absolute;
left: 30rpx;
top: 0;
z-index: 2;
}
}
}
}
}
.dian-on{
width: 648rpx;
min-height: 648rpx;
background: url(@/static/yuyin-bg2.png) center top no-repeat;
background-size: 100% auto;
margin: 0 auto;
margin-top: 150rpx;
.tag{
width: 660rpx;
height: 330rpx;
background: rgba(35, 32, 48, 0.36);
border-radius: 20rpx;
margin: 0 auto;
padding: 30rpx;
box-sizing: border-box;
text-align: left;
margin-top: 30rpx;
.titles{
font-weight: bold;
font-size: 30rpx;
color: #FFFFFF;
}
.descs{
line-height: 45rpx;
font-weight: 400;
font-size: 24rpx;
color: #B8B7BC;
margin-top: 20rpx;
}
}
.info{
width: 100%;
text-align: center;
overflow: hidden;
image{
width: 180rpx;
height: 180rpx;
border-radius: 50%;
}
.name{
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
margin-top: 10rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
overflow: hidden;
text-align: center;
margin-top: 10rpx;
}
.btn{
width: 170rpx;
line-height: 56rpx;
background: linear-gradient(0deg, #FF9124, #BD4700);
border-radius: 56rpx;
font-weight: bold;
font-size: 30rpx;
color: #FFFFFF;
margin: 0 auto;
margin-top: 20rpx;
}
.txt{
font-weight: 500;
font-size: 26rpx;
color: #FFFFFF;
margin-top: 20rpx;
opacity: 0.3;
}
}
}
}
&-start{
width: 100%;
position: absolute;
left: 0;
bottom: 130rpx;
z-index: 21;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
.item{
width: 33.3%;
font-weight: 500;
font-size: 24rpx;
color: rgba(255, 255, 255, 0.4);
text-align: center;
image{
width: 130rpx;
height: 130rpx;
display: block;
margin: 0 auto;
border-radius: 50%;
margin-bottom: 20rpx;
}
font-size: 30rpx;
color: #FFFFFF;
}
.items{
width: 33.3%;
display: flex;
margin-top: 70rpx;
position: relative;
image{
width: 130rpx;
height: 130rpx;
display: block;
margin: 0 auto;
margin-bottom: 20rpx;
}
.off{
width: 49rpx;
height: 44rpx;
position: absolute;
left: 260rpx;
top: 50%;
margin-top: -28rpx;
z-index: 2;
}
}
}
&-end{
width: 100%;
position: absolute;
left: 0;
bottom: 140rpx;
z-index: 21;
.send{
width: 100%;
text-align: center;
font-weight: 500;
font-size: 30rpx;
color: #FFFFFF;
}
.todo{
width: 100%;
text-align: center;
margin-top: 30rpx;
image{
width: 60rpx;
height: 60rpx;
}
}
}
}
</style>