|
|
|
@ -10,31 +10,48 @@ |
|
|
|
|
<view class="chat-hd" v-if="list.length>0"> |
|
|
|
|
<u-notice-bar style="width: 100%;" :volume-icon="false" mode="horizontal" :list="list"></u-notice-bar> |
|
|
|
|
</view> |
|
|
|
|
<scroll-view class="chat-bd" scroll-y :class="list.length==0?(isOpen?'chat-bd-active1':'chat-bd-active'):(isOpen?'chat-bd-on':'')"> |
|
|
|
|
<view class="item" :class="userId != a.rightUserId?'item-on':''" v-for="(a,index) in chatList" :key="index"> |
|
|
|
|
<template v-if="userId != a.rightUserId"> |
|
|
|
|
<view class="fr"> |
|
|
|
|
<view class="desc">{{a.message}}</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="fl"><image :src="a.leftFaceImage"></image></view> |
|
|
|
|
</template> |
|
|
|
|
<template v-else> |
|
|
|
|
<view class="fl"><image :src="a.rightFaceImage"></image></view> |
|
|
|
|
<view class="fr"> |
|
|
|
|
<view class="name">李大花<text>陪玩师</text></view> |
|
|
|
|
<view class="desc" v-if="a.type == 6 || a.type==3">{{a.message}}</view> |
|
|
|
|
<view class="gift" v-if="a.type == 5">送出礼物<image mode="widthFix" src="/static/logo.png"></image>棒棒糖<text>X3</text></view> |
|
|
|
|
<view class="yinping" v-if="a.type == 1"> |
|
|
|
|
<image src="@/static/chat-03.png"></image> 8” |
|
|
|
|
</view> |
|
|
|
|
<view class="video" v-if="a.type == 2"> |
|
|
|
|
<video src=""></video> |
|
|
|
|
<scroll-view id="wrapper" class="chat-bd" |
|
|
|
|
:class="list.length==0?(isOpen?'chat-bd-active1':'chat-bd-active'):(isOpen?'chat-bd-on':'')" |
|
|
|
|
:scroll-y="true" |
|
|
|
|
:scroll-with-animation="true" |
|
|
|
|
:scroll-top="wrapperScrollHeight" |
|
|
|
|
> |
|
|
|
|
<view id="wrapper"> |
|
|
|
|
<view class="item" :class="userId != a.rightUserId?'item-on':''" v-for="(a,index) in chatList" :key="index"> |
|
|
|
|
<template v-if="userId != a.rightUserId"> |
|
|
|
|
<view class="fr"> |
|
|
|
|
<view class="desc" v-if="a.type == 6 || a.type==3">{{a.message}}</view> |
|
|
|
|
<view class="gift" v-if="a.type == 5">送出礼物<image mode="widthFix" :src="a.message"></image>棒棒糖<text>X{{a.num}}</text></view> |
|
|
|
|
<view class="yinping" v-if="a.type == 1"> |
|
|
|
|
<image :src="a.message"></image> {{a.num}}” |
|
|
|
|
</view> |
|
|
|
|
<view class="video" v-if="a.type == 2"> |
|
|
|
|
<video :src="a.message"></video> |
|
|
|
|
</view> |
|
|
|
|
<view class="img" v-if="a.type == 4"> |
|
|
|
|
<image :src="a.message"></image> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="img" v-if="a.type == 4"> |
|
|
|
|
<image src="/static/pic.jpg"></image> |
|
|
|
|
<view class="fl"><image :src="a.leftFaceImage"></image></view> |
|
|
|
|
</template> |
|
|
|
|
<template v-else> |
|
|
|
|
<view class="fl"><image :src="a.rightFaceImage"></image></view> |
|
|
|
|
<view class="fr"> |
|
|
|
|
<view class="name">{{a.rightNickname}}<text v-if="a.rightRole == 2">陪玩师</text></view> |
|
|
|
|
<view class="desc" v-if="a.type == 6 || a.type==3">{{a.message}}</view> |
|
|
|
|
<view class="gift" v-if="a.type == 5">送出礼物<image mode="widthFix" :src="a.message"></image>棒棒糖<text>X{{a.num}}</text></view> |
|
|
|
|
<view class="yinping" v-if="a.type == 1"> |
|
|
|
|
<image :src="a.message"></image> {{a.num}}” |
|
|
|
|
</view> |
|
|
|
|
<view class="video" v-if="a.type == 2"> |
|
|
|
|
<video :src="a.message"></video> |
|
|
|
|
</view> |
|
|
|
|
<view class="img" v-if="a.type == 4"> |
|
|
|
|
<image :src="a.message"></image> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
</template> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</scroll-view> |
|
|
|
|
<view class="chat-fd"> |
|
|
|
@ -50,10 +67,10 @@ |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="input" v-else> |
|
|
|
|
<view class="star" v-if="isPlay">开始录音</view> |
|
|
|
|
<view class="star" v-else>停止录音</view> |
|
|
|
|
<view class="star" @click="toOpen()" v-if="isPlay">开始录音</view> |
|
|
|
|
<view class="star" @click="toEnd()" v-else>停止录音</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="btn" @click="toSend()"> |
|
|
|
|
<view class="btn" @click="toSend(3)"> |
|
|
|
|
发送 |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
@ -64,12 +81,41 @@ |
|
|
|
|
<image @click="openGift()" src="@/static/chat-liwu.png"></image> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<u-popup v-model="show" mode="top" :mask-close-able='false' :zIndex="5"> |
|
|
|
|
<view class="permissions_box"> |
|
|
|
|
当您使用APP时,为了使用录音的功能,我们需要申请麦克风权限。 |
|
|
|
|
</view> |
|
|
|
|
</u-popup> |
|
|
|
|
<u-popup v-model="show1" mode="bottom" :mask-close-able='false'> |
|
|
|
|
<view class="giftPopup"> |
|
|
|
|
<view class="title">礼物<image @click="closeGift()" src="/static/cha.png"></image></view> |
|
|
|
|
<view class="content"> |
|
|
|
|
<swiper class="swiper" @change="changeswiper"> |
|
|
|
|
<swiper-item v-for="i in giftListNum" :key="i"> |
|
|
|
|
<template v-for="(a,idx) in giftList"> |
|
|
|
|
<view class="item" v-if="(8*(i-1))<idx < 8*i" :key="idx" @click="tabItem(idx)" :class="idx == tabIndex?'item-on':''"> |
|
|
|
|
<image mode="heightFix" :src="a.imgurl"></image> |
|
|
|
|
<view class="txt">{{a.name}}</view> |
|
|
|
|
<view class="num">{{a.price}}金币</view> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
</swiper-item> |
|
|
|
|
</swiper> |
|
|
|
|
<view class="indicator-dots" v-if="giftListNum >= 2"> |
|
|
|
|
<view class="indicator-dots-item" v-for="i in giftListNum" :key="i" :class="[current == i ? 'indicator-dots-active' : '']"></view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
<view class="fd"> |
|
|
|
|
<view class="a">金币:{{balanceInfo.userBalance}}</view> |
|
|
|
|
<view class="b">充值<image src="@/static/icon-arrow.png"></image></view> |
|
|
|
|
<view class="c"> |
|
|
|
|
<input v-model="num" /> |
|
|
|
|
</view> |
|
|
|
|
<view class="btn" @click="toZengsong()">赠送</view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</u-popup> |
|
|
|
|
<insufficient :isCoins="isCoins" /> |
|
|
|
|
</view> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
@ -85,7 +131,12 @@ |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
wrapperScrollHeight: 0, |
|
|
|
|
tabIndex: 0, |
|
|
|
|
id: "", |
|
|
|
|
current: 1, |
|
|
|
|
show1: false, |
|
|
|
|
isCoins: false, |
|
|
|
|
isToggle: true, |
|
|
|
|
isOpen: false, |
|
|
|
|
title: "", |
|
|
|
@ -98,7 +149,11 @@ |
|
|
|
|
img: "", |
|
|
|
|
show: false, |
|
|
|
|
isPlay: true, |
|
|
|
|
|
|
|
|
|
count: 0, |
|
|
|
|
balanceInfo: {}, |
|
|
|
|
num: 1, |
|
|
|
|
giftList: [], |
|
|
|
|
giftListNum: 1 |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
onLoad(o) { |
|
|
|
@ -106,27 +161,126 @@ |
|
|
|
|
this.id = o.id; |
|
|
|
|
this.getUserInfo(); |
|
|
|
|
this.getChatList(); |
|
|
|
|
this.userBalance(); |
|
|
|
|
}, |
|
|
|
|
onReady() { |
|
|
|
|
const that = this; |
|
|
|
|
this.toImLogin() |
|
|
|
|
recorderManager.onStop(function (res) { |
|
|
|
|
that.uploadVideo(res.tempFilePath); |
|
|
|
|
that.uploadAudio(res.tempFilePath); |
|
|
|
|
clearInterval(timer); |
|
|
|
|
that.count = 0 |
|
|
|
|
that.isPlay = true |
|
|
|
|
}); |
|
|
|
|
innerAudioContext.onEnded(res=>{ |
|
|
|
|
that.isPlay = false |
|
|
|
|
}) |
|
|
|
|
// 注册监听“收到单聊消息”的回调 |
|
|
|
|
// //注册监听“收到单聊消息”的回调 |
|
|
|
|
// zim.on('receivePeerMessage', function (zim, { messageList, fromConversationID }) { |
|
|
|
|
// console.log('receivePeerMessage', messageList, fromConversationID); |
|
|
|
|
// }); |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
//发送得内容,type:1.语音 2.视频 3.文字 4图片 5礼物6搭讪 |
|
|
|
|
async giftGiving() { |
|
|
|
|
await this.$api.giftGiving({ |
|
|
|
|
"userId": uni.getStorageSync("userInfo").id, //用户ID |
|
|
|
|
"acceptUserId": this.id, //被送礼之人ID |
|
|
|
|
"giftId": this.giftList[this.tabIndex].id, //礼物ID |
|
|
|
|
"num": this.num //礼物数量 |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
toZengsong() { |
|
|
|
|
const that = this; |
|
|
|
|
if(this.userInfo.isBlack == 1){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "当前用户是黑名单,已限制", |
|
|
|
|
position: "bottom", |
|
|
|
|
icon: "none", |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
if(this.balanceInfo.isBlack >= this.giftList[this.tabIndex].price*that.num){ |
|
|
|
|
that.isCoins = true; |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
that.img = this.giftList[this.tabIndex].id |
|
|
|
|
that.count = that.num |
|
|
|
|
that.toSend(5) |
|
|
|
|
}, |
|
|
|
|
tabItem(index){ |
|
|
|
|
this.tabIndex = index; |
|
|
|
|
}, |
|
|
|
|
async getGift() { |
|
|
|
|
const { code, data } = await this.$api.giftList({ |
|
|
|
|
userId: uni.getStorageSync("userInfo").id, |
|
|
|
|
limit: 999, |
|
|
|
|
page: 1 |
|
|
|
|
}) |
|
|
|
|
if(code == 200){ |
|
|
|
|
this.giftList = data.list; |
|
|
|
|
this.giftListNum = Math.ceil(data.total/8) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
closeGift(){ |
|
|
|
|
this.show1 = false; |
|
|
|
|
this.isOpen = false; |
|
|
|
|
}, |
|
|
|
|
openGift(){ |
|
|
|
|
if(this.userInfo.isBlack == 1){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "当前用户是黑名单,已限制", |
|
|
|
|
position: "bottom", |
|
|
|
|
icon: "none", |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
this.show1 = true; |
|
|
|
|
this.getGift(); |
|
|
|
|
this.isOpen = false; |
|
|
|
|
}, |
|
|
|
|
changeswiper(e){ |
|
|
|
|
this.current = e.detail.current |
|
|
|
|
}, |
|
|
|
|
toEnd() { |
|
|
|
|
recorderManager.stop(); |
|
|
|
|
}, |
|
|
|
|
toToggle() { |
|
|
|
|
this.isToggle = !this.isToggle |
|
|
|
|
this.isOpen = false; |
|
|
|
|
}, |
|
|
|
|
//检查次数 |
|
|
|
|
async userBalance() { |
|
|
|
|
const { code, data } = await this.$api.userBalance({ |
|
|
|
|
userId: uni.getStorageSync("userInfo").id |
|
|
|
|
}) |
|
|
|
|
if(code == 200){ |
|
|
|
|
this.balanceInfo = data |
|
|
|
|
/*** |
|
|
|
|
"videoCoins": 0, //视频可用时长:分钟 |
|
|
|
|
"wordVoiceDiscount": 0, //语音视频文字折扣:0表示不打折 |
|
|
|
|
"voiceCoins": 0, //语音可用时长:分钟 |
|
|
|
|
"wordCoins": 0, //文字可发数量 |
|
|
|
|
"userBalance": 1 //当前用户金币余额 |
|
|
|
|
*/ |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//结算 |
|
|
|
|
async socialConsumption(type) { |
|
|
|
|
await this.$api.socialConsumption({ |
|
|
|
|
userId: uni.getStorageSync("userInfo").id, |
|
|
|
|
sellerId: this.info.userid, |
|
|
|
|
type, |
|
|
|
|
duration: type==1?this.count: "" |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
toOpen(){ |
|
|
|
|
const that = this; |
|
|
|
|
// {"userId":"123","sellerId":"4575676878","type":3} 发送得内容,type:1.语音 2.视频 3.文字 4图片 5礼物6搭讪 |
|
|
|
|
// console.log(111) |
|
|
|
|
// console.log(JSON.stringify({"userId": uni.getStorageSync("userInfo").id,sellerId:this.id, type:3,"topic":"message"})) |
|
|
|
|
// uni.sendSocketMessage({data:JSON.stringify({"userId": uni.getStorageSync("userInfo").id,sellerId:this.id, type:3,"topic":"message"})}); |
|
|
|
|
// return ; |
|
|
|
|
// APP检查权限 |
|
|
|
|
if(uni.getSystemInfoSync().platform == 'android') { |
|
|
|
|
plus.android.checkPermission( |
|
|
|
@ -136,10 +290,7 @@ |
|
|
|
|
that.show=true |
|
|
|
|
}else{ |
|
|
|
|
that.show=false |
|
|
|
|
if(that.isPlay){ |
|
|
|
|
innerAudioContext.pause(); |
|
|
|
|
that.isPlay = false |
|
|
|
|
} |
|
|
|
|
that.toLuyin(); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
error => { |
|
|
|
@ -149,6 +300,18 @@ |
|
|
|
|
that.requestAndroidPermission('android.permission.RECORD_AUDIO') |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
that.toLuyin(); |
|
|
|
|
}, |
|
|
|
|
toLuyin() { |
|
|
|
|
const that = this; |
|
|
|
|
clearInterval(timer) |
|
|
|
|
that.isPlay = false; |
|
|
|
|
timer = setInterval(()=>{ |
|
|
|
|
that.count++ |
|
|
|
|
},1000) |
|
|
|
|
recorderManager.start({ |
|
|
|
|
format: "mp3" |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
recorderAuthModal: function () { |
|
|
|
|
const that = this; |
|
|
|
@ -175,8 +338,22 @@ |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//上传语音 |
|
|
|
|
uploadVideo(filePath) { |
|
|
|
|
const that = this |
|
|
|
|
uploadAudio(filePath) { |
|
|
|
|
const that = this; |
|
|
|
|
if(that.userInfo.isBlack == 1){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "当前用户是黑名单,已限制", |
|
|
|
|
position: "bottom", |
|
|
|
|
icon: "none", |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
if(uni.getStorageSync("userInfo").sex == 1){ |
|
|
|
|
if(that.balanceInfo.wordCoins <= 0){ |
|
|
|
|
that.isCoins=true; |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
uni.uploadFile({ |
|
|
|
|
name: 'file', |
|
|
|
|
url: that.$baseUrl+'/prod-api/common/upload', |
|
|
|
@ -185,6 +362,7 @@ |
|
|
|
|
const {code, fileName, url, msg} = JSON.parse(res.data); |
|
|
|
|
if(code == 200){ |
|
|
|
|
that.img = url |
|
|
|
|
this.toSend(1) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
fail: (err) => { |
|
|
|
@ -194,12 +372,36 @@ |
|
|
|
|
}, |
|
|
|
|
//上传视频 |
|
|
|
|
uploadVideo() { |
|
|
|
|
const that = this |
|
|
|
|
const that = this; |
|
|
|
|
if(that.userInfo.isBlack == 1){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "当前用户是黑名单,已限制", |
|
|
|
|
position: "bottom", |
|
|
|
|
icon: "none", |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
uni.chooseVideo({ |
|
|
|
|
count: 1, |
|
|
|
|
sourceType: ["album", "camera"], |
|
|
|
|
success: (res1) => { |
|
|
|
|
console.log(res1) |
|
|
|
|
that.count = res1.duration; |
|
|
|
|
return ; |
|
|
|
|
if(that.userInfo.isBlack == 1){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "当前用户是黑名单,已限制", |
|
|
|
|
position: "bottom", |
|
|
|
|
icon: "none", |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
if(uni.getStorageSync("userInfo").sex == 1){ |
|
|
|
|
if(that.balanceInfo.wordCoins <= 0){ |
|
|
|
|
that.isCoins=true; |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
uni.uploadFile({ |
|
|
|
|
name: 'file', |
|
|
|
|
url: that.$baseUrl+'/prod-api/common/upload', |
|
|
|
@ -208,6 +410,7 @@ |
|
|
|
|
const {code, fileName, url, msg} = JSON.parse(res.data); |
|
|
|
|
if(code == 200){ |
|
|
|
|
that.img = url |
|
|
|
|
this.toSend(2) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
fail: (err) => { |
|
|
|
@ -223,20 +426,44 @@ |
|
|
|
|
//上传图片 |
|
|
|
|
uploadImg() { |
|
|
|
|
const that = this |
|
|
|
|
if(that.userInfo.isBlack == 1){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "当前用户是黑名单,已限制", |
|
|
|
|
position: "bottom", |
|
|
|
|
icon: "none", |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
uni.chooseImage({ |
|
|
|
|
count: 1, |
|
|
|
|
sizeType: ["original"], //可以指定是原图还是压缩图,默认二者都有 |
|
|
|
|
sourceType: ["album", "camera"], |
|
|
|
|
success: (res1) => { |
|
|
|
|
console.log(res1) |
|
|
|
|
if(that.userInfo.isBlack == 1){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "当前用户是黑名单,已限制", |
|
|
|
|
position: "bottom", |
|
|
|
|
icon: "none", |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
if(uni.getStorageSync("userInfo").sex == 1){ |
|
|
|
|
if(that.balanceInfo.wordCoins <= 0){ |
|
|
|
|
that.isCoins=true; |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
uni.uploadFile({ |
|
|
|
|
name: 'file', |
|
|
|
|
url: that.$baseUrl+'/prod-api/common/upload', |
|
|
|
|
filePath: res1.tempFilePath, |
|
|
|
|
filePath: res1.tempFilePaths[0], |
|
|
|
|
success: (res) => { |
|
|
|
|
//1.语音 2.视频 3.文字 4图片 5礼物 |
|
|
|
|
const {code, fileName, url, msg} = JSON.parse(res.data); |
|
|
|
|
if(code == 200){ |
|
|
|
|
that.img = url |
|
|
|
|
that.toSend(4) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
fail: (err) => { |
|
|
|
@ -249,7 +476,49 @@ |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
toSend() {}, |
|
|
|
|
// 发送得内容,type:1.语音 2.视频 3.文字 4图片 5礼物6搭讪 |
|
|
|
|
async toSend(type) { |
|
|
|
|
const that = this; |
|
|
|
|
if(type == 3){ |
|
|
|
|
if(that.userInfo.isBlack == 1){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "当前用户是黑名单,已限制", |
|
|
|
|
position: "bottom", |
|
|
|
|
icon: "none", |
|
|
|
|
}) |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
if(uni.getStorageSync("userInfo").sex == 1){ |
|
|
|
|
if(that.balanceInfo.wordCoins >= 1){ |
|
|
|
|
that.isCoins=true; |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const { code, data } = await this.$api.chat({ |
|
|
|
|
userId: uni.getStorageSync("userInfo").id, |
|
|
|
|
sellerId: that.id, |
|
|
|
|
type, |
|
|
|
|
num: (that.count+1), |
|
|
|
|
message: type == 3?that.content: that.img |
|
|
|
|
}) |
|
|
|
|
if(code == 200){ |
|
|
|
|
if(type==5){ |
|
|
|
|
this.giftGiving(); |
|
|
|
|
} |
|
|
|
|
that.isOpen = false; |
|
|
|
|
that.isToggle = true; |
|
|
|
|
that.show1 = false; |
|
|
|
|
this.socialConsumption(); |
|
|
|
|
this.getChatList(); |
|
|
|
|
this.userBalance(); |
|
|
|
|
this.content="" |
|
|
|
|
this.count = 0; |
|
|
|
|
this.num = 1; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//登录房间 |
|
|
|
|
toImLogin() { |
|
|
|
|
// zim.login(uni.getStorageSync("userInfo").id, { |
|
|
|
@ -266,9 +535,20 @@ |
|
|
|
|
// }); |
|
|
|
|
}, |
|
|
|
|
async getChatList(){ |
|
|
|
|
const that = this; |
|
|
|
|
const { code, data , msg } = await this.$api.findChatList({formUserId: uni.getStorageSync("userInfo").id,toUserId: this.id}); |
|
|
|
|
if(code == 200){ |
|
|
|
|
this.chatList= data; |
|
|
|
|
setTimeout(()=>{ |
|
|
|
|
let wrapper = uni.createSelectorQuery().in(this).select('#wrapper'); |
|
|
|
|
wrapper.fields({ |
|
|
|
|
size: true, |
|
|
|
|
scrollOffset: true |
|
|
|
|
}, data => { |
|
|
|
|
console.log("得到节点信息" + JSON.stringify(data)); |
|
|
|
|
that.wrapperScrollHeight = data.scrollHeight |
|
|
|
|
}).exec() |
|
|
|
|
},100) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
async getUserInfo() { |
|
|
|
@ -280,7 +560,7 @@ |
|
|
|
|
this.getConfigData(); |
|
|
|
|
}else{ |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: mgs, |
|
|
|
|
title: msg, |
|
|
|
|
position: "bottom", |
|
|
|
|
icon: "none", |
|
|
|
|
}) |
|
|
|
@ -292,16 +572,38 @@ |
|
|
|
|
let res1 = await that.$api.getConfigData({dictType: 'CONFIG_MESSAGE_NOTICE'}); |
|
|
|
|
that.list = [res1.data.content] |
|
|
|
|
}, |
|
|
|
|
//加入黑名单 |
|
|
|
|
async toYichu(type) { |
|
|
|
|
//是否关注 |
|
|
|
|
async toCareOrCancel() { |
|
|
|
|
const { code, data , msg } = await this.$api.careOrCancel({ |
|
|
|
|
userId: uni.getStorageSync("userInfo").id, |
|
|
|
|
sellerId: this.id, |
|
|
|
|
type: this.userInfo.isCare == 0?1:2 |
|
|
|
|
}); |
|
|
|
|
if(code == 200){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: this.userInfo.isCare == 0?"关注成功":"取消关注" |
|
|
|
|
}) |
|
|
|
|
setTimeout(()=>{ |
|
|
|
|
this.getUserInfo(1) |
|
|
|
|
},2000) |
|
|
|
|
}else{ |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: msg, |
|
|
|
|
position: "bottom", |
|
|
|
|
icon: "none", |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//是否加入黑名单 |
|
|
|
|
async toYichu() { |
|
|
|
|
const { code, data } = await this.$api.addOrRemoveBlacklist({ |
|
|
|
|
userId: uni.getStorageSync("userInfo").id, |
|
|
|
|
sellerId: this.id, |
|
|
|
|
type |
|
|
|
|
type: this.userInfo.isBlack == 0?1:2 |
|
|
|
|
}) |
|
|
|
|
if(code == 200){ |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: type == 2?"移除成功":"加入成功" |
|
|
|
|
title:this.userInfo.isBlack == 1?"移除成功":"加入成功" |
|
|
|
|
}) |
|
|
|
|
setTimeout(()=>{ |
|
|
|
|
this.getInfo(); |
|
|
|
@ -309,10 +611,23 @@ |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
toSheet() { |
|
|
|
|
const that = this; |
|
|
|
|
uni.showActionSheet({ |
|
|
|
|
itemList: this.itemList, |
|
|
|
|
success(res){ |
|
|
|
|
console.log(res.tapIndex) |
|
|
|
|
if(res.tapIndex == 0){ |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: "/pages/peiwan/detail?id="+that.id |
|
|
|
|
}) |
|
|
|
|
}else if(res.tapIndex == 1){ |
|
|
|
|
that.toCareOrCancel() |
|
|
|
|
}else if(res.tapIndex == 2){ |
|
|
|
|
uni.navigateTo({ |
|
|
|
|
url: "/pages/users/feedback/index?type=2&id="+that.id |
|
|
|
|
}) |
|
|
|
|
}else if(res.tapIndex == 3){ |
|
|
|
|
that.toYichu() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
@ -328,6 +643,139 @@ |
|
|
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
|
.chat{ |
|
|
|
|
.giftPopup{ |
|
|
|
|
padding: 40rpx 25rpx; |
|
|
|
|
overflow: hidden; |
|
|
|
|
position: relative; |
|
|
|
|
.title{ |
|
|
|
|
text-align: center; |
|
|
|
|
font-weight: 500; |
|
|
|
|
font-size: 36rpx; |
|
|
|
|
color: #333333; |
|
|
|
|
image{ |
|
|
|
|
width: 50rpx; |
|
|
|
|
height: 50rpx; |
|
|
|
|
right: 20rpx; |
|
|
|
|
top: 40rpx; |
|
|
|
|
z-index: 2; |
|
|
|
|
position: absolute; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.content{ |
|
|
|
|
width: 110%; |
|
|
|
|
overflow: hidden; |
|
|
|
|
margin-bottom: 40rpx; |
|
|
|
|
swiper{ |
|
|
|
|
height: 450rpx; |
|
|
|
|
} |
|
|
|
|
.indicator-dots{ |
|
|
|
|
width: 100%; |
|
|
|
|
display: flex; |
|
|
|
|
align-items: center; |
|
|
|
|
justify-content: center; |
|
|
|
|
.indicator-dots-item{ |
|
|
|
|
width: 12rpx; |
|
|
|
|
height: 12rpx; |
|
|
|
|
background: #000000; |
|
|
|
|
border-radius: 50%; |
|
|
|
|
opacity: 0.4; |
|
|
|
|
margin: 0 6rpx; |
|
|
|
|
&.indicator-dots-active{ |
|
|
|
|
width: 30rpx; |
|
|
|
|
height: 12rpx; |
|
|
|
|
background: #000000; |
|
|
|
|
border-radius: 6rpx; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.item{ |
|
|
|
|
width: 166rpx; |
|
|
|
|
height: 180rpx; |
|
|
|
|
background: #F5F5F5; |
|
|
|
|
border-radius: 20rpx; |
|
|
|
|
border: 1px solid #F5F5F5; |
|
|
|
|
text-align: center; |
|
|
|
|
padding: 5rpx; |
|
|
|
|
box-sizing: border-box; |
|
|
|
|
float: left; |
|
|
|
|
margin-right: 13rpx; |
|
|
|
|
margin-top: 30rpx; |
|
|
|
|
image{ |
|
|
|
|
height: 90rpx; |
|
|
|
|
} |
|
|
|
|
.txt{ |
|
|
|
|
white-space: nowrap; |
|
|
|
|
text-overflow: ellipsis; |
|
|
|
|
overflow: hidden; |
|
|
|
|
font-weight: 500; |
|
|
|
|
font-size: 24rpx; |
|
|
|
|
color: #333333; |
|
|
|
|
margin-top: 5rpx; |
|
|
|
|
} |
|
|
|
|
.num{ |
|
|
|
|
overflow: hidden; |
|
|
|
|
font-weight: 500; |
|
|
|
|
font-size: 22rpx; |
|
|
|
|
color: #999; |
|
|
|
|
margin-top: 5rpx; |
|
|
|
|
} |
|
|
|
|
&-on{ |
|
|
|
|
border: 1px solid #000; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.fd{ |
|
|
|
|
display: flex; |
|
|
|
|
align-items: center; |
|
|
|
|
border-top: 1px solid #EAEAEA; |
|
|
|
|
padding-top: 40rpx; |
|
|
|
|
justify-content: space-between; |
|
|
|
|
.a{ |
|
|
|
|
font-weight: 500; |
|
|
|
|
font-size: 30rpx; |
|
|
|
|
color: #333333; |
|
|
|
|
} |
|
|
|
|
.b{ |
|
|
|
|
font-weight: 500; |
|
|
|
|
font-size: 24rpx; |
|
|
|
|
color: #333333; |
|
|
|
|
display: flex; |
|
|
|
|
align-items: center; |
|
|
|
|
image{ |
|
|
|
|
width: 40rpx; |
|
|
|
|
height: 40rpx; |
|
|
|
|
margin-top: -1px; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.c{ |
|
|
|
|
|
|
|
|
|
input{ |
|
|
|
|
width: 166rpx; |
|
|
|
|
background: #FFFFFF; |
|
|
|
|
border-radius: 80rpx; |
|
|
|
|
text-align: center; |
|
|
|
|
border: 1px solid #CCCCCC; |
|
|
|
|
font-weight: 500; |
|
|
|
|
height: 80rpx; |
|
|
|
|
font-size: 30rpx; |
|
|
|
|
color: #333333; |
|
|
|
|
display: block; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.btn{ |
|
|
|
|
width: 166rpx; |
|
|
|
|
line-height: 80rpx; |
|
|
|
|
background: linear-gradient(0deg, #000000, #3D3B38); |
|
|
|
|
box-shadow: 0px 4rpx 18rpx 0px rgba(42,41,39,0.34); |
|
|
|
|
border-radius: 80rpx; |
|
|
|
|
text-align: center; |
|
|
|
|
height: 80rpx; |
|
|
|
|
font-weight: 500; |
|
|
|
|
font-size: 30rpx; |
|
|
|
|
color: #FFFFFF; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
&-navbar{ |
|
|
|
|
width: 100%; |
|
|
|
|
.slot-wrap{ |
|
|
|
@ -477,6 +925,19 @@ |
|
|
|
|
float: right; |
|
|
|
|
background: #EAEBEB; |
|
|
|
|
border-radius: 0px 30rpx 30rpx 30rpx; |
|
|
|
|
margin: 0; |
|
|
|
|
} |
|
|
|
|
.video{ |
|
|
|
|
float: right; |
|
|
|
|
} |
|
|
|
|
.img{ |
|
|
|
|
float: right; |
|
|
|
|
} |
|
|
|
|
.video{ |
|
|
|
|
float: right; |
|
|
|
|
} |
|
|
|
|
.gift{ |
|
|
|
|
float: right; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|