|
|
@ -23,7 +23,9 @@ |
|
|
<view class="radio-sub">你们已经安静陪伴了 {{ silentMinutes }} 分钟</view> |
|
|
<view class="radio-sub">你们已经安静陪伴了 {{ silentMinutes }} 分钟</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="safe-actions"> |
|
|
<view class="safe-actions"> |
|
|
<view class="safe-btn warn" @tap="block">加入黑名单</view> |
|
|
<view class="safe-btn warn" :class="{ active: blockedByMe }" @tap="toggleBlock"> |
|
|
|
|
|
{{ blockedByMe ? '解除拉黑' : '加入黑名单' }} |
|
|
|
|
|
</view> |
|
|
<view class="safe-btn" @tap="openReportPanel">举报</view> |
|
|
<view class="safe-btn" @tap="openReportPanel">举报</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
@ -103,7 +105,7 @@ |
|
|
<view class="safety-panel" @tap.stop> |
|
|
<view class="safety-panel" @tap.stop> |
|
|
<view class="safety-title">安全与退出</view> |
|
|
<view class="safety-title">安全与退出</view> |
|
|
<view class="safety-item" @tap="openReportPanel">举报不适内容</view> |
|
|
<view class="safety-item" @tap="openReportPanel">举报不适内容</view> |
|
|
<view class="safety-item" @tap="block">拉黑这个对象</view> |
|
|
<view class="safety-item" @tap="toggleBlock">{{ blockedByMe ? '解除拉黑' : '拉黑这个对象' }}</view> |
|
|
<view class="safety-item quiet" @tap="finishRoom">提前结束陪伴</view> |
|
|
<view class="safety-item quiet" @tap="finishRoom">提前结束陪伴</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
@ -154,7 +156,7 @@ |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import ieSocket from '@/common/ieSocket.js' |
|
|
import ieSocket from '@/common/ieSocket.js' |
|
|
import { finishIeRoom, reportIeRoom, blockIeUser, pageIeMessages, sendIeMessage, getIeUserProfile } from '@/common/ieApi.js' |
|
|
import { finishIeRoom, reportIeRoom, blockIeUser, unblockIeUser, getIeBlockStatus, pageIeMessages, sendIeMessage, getIeUserProfile } from '@/common/ieApi.js' |
|
|
import tui from '@/common/httpRequest.js' |
|
|
import tui from '@/common/httpRequest.js' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
@ -173,6 +175,8 @@ |
|
|
showSafety: false, |
|
|
showSafety: false, |
|
|
showReportPanel: false, |
|
|
showReportPanel: false, |
|
|
isBlocked: false, |
|
|
isBlocked: false, |
|
|
|
|
|
blockedByMe: false, |
|
|
|
|
|
blockedByOther: false, |
|
|
showTargetProfile: false, |
|
|
showTargetProfile: false, |
|
|
targetProfile: {}, |
|
|
targetProfile: {}, |
|
|
showEmoji: false, |
|
|
showEmoji: false, |
|
|
@ -287,6 +291,7 @@ |
|
|
this.initRecorder() |
|
|
this.initRecorder() |
|
|
this.initAudio() |
|
|
this.initAudio() |
|
|
this.loadTargetProfile() |
|
|
this.loadTargetProfile() |
|
|
|
|
|
this.loadBlockStatus() |
|
|
this.loadLatestMessages() |
|
|
this.loadLatestMessages() |
|
|
this.initSocket() |
|
|
this.initSocket() |
|
|
this.startMessagePolling() |
|
|
this.startMessagePolling() |
|
|
@ -333,6 +338,14 @@ |
|
|
this.keyboardHeight = 0 |
|
|
this.keyboardHeight = 0 |
|
|
}, 120) |
|
|
}, 120) |
|
|
}, |
|
|
}, |
|
|
|
|
|
async loadBlockStatus() { |
|
|
|
|
|
if (!this.targetUserId) return |
|
|
|
|
|
const status = await getIeBlockStatus(this.targetUserId) |
|
|
|
|
|
if (!status) return |
|
|
|
|
|
this.blockedByMe = !!status.blockedByMe |
|
|
|
|
|
this.blockedByOther = !!status.blockedByOther |
|
|
|
|
|
this.isBlocked = !!status.blocked |
|
|
|
|
|
}, |
|
|
startTimer() { |
|
|
startTimer() { |
|
|
// 已匹配的陪伴关系可持续聊天,不再自动倒计时结束。 |
|
|
// 已匹配的陪伴关系可持续聊天,不再自动倒计时结束。 |
|
|
}, |
|
|
}, |
|
|
@ -819,6 +832,13 @@ |
|
|
this.showReportPanel = false |
|
|
this.showReportPanel = false |
|
|
uni.showToast({ title: '已收到举报', icon: 'none' }) |
|
|
uni.showToast({ title: '已收到举报', icon: 'none' }) |
|
|
}, |
|
|
}, |
|
|
|
|
|
toggleBlock() { |
|
|
|
|
|
if (this.blockedByMe) { |
|
|
|
|
|
this.unblock() |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
this.block() |
|
|
|
|
|
}, |
|
|
async block() { |
|
|
async block() { |
|
|
this.showSafety = false |
|
|
this.showSafety = false |
|
|
if (!this.targetUserId) { |
|
|
if (!this.targetUserId) { |
|
|
@ -833,6 +853,7 @@ |
|
|
success: async (res) => { |
|
|
success: async (res) => { |
|
|
if (!res.confirm) return |
|
|
if (!res.confirm) return |
|
|
await blockIeUser(this.targetUserId, '聊天中拉黑') |
|
|
await blockIeUser(this.targetUserId, '聊天中拉黑') |
|
|
|
|
|
this.blockedByMe = true |
|
|
this.isBlocked = true |
|
|
this.isBlocked = true |
|
|
this.showEmoji = false |
|
|
this.showEmoji = false |
|
|
this.voiceMode = false |
|
|
this.voiceMode = false |
|
|
@ -840,6 +861,26 @@ |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
async unblock() { |
|
|
|
|
|
this.showSafety = false |
|
|
|
|
|
if (!this.targetUserId) { |
|
|
|
|
|
uni.showToast({ title: '解除对象缺失', icon: 'none' }) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
uni.showModal({ |
|
|
|
|
|
title: '解除拉黑?', |
|
|
|
|
|
content: '解除后可以继续发送消息,也可能再次随机匹配到对方。', |
|
|
|
|
|
confirmText: '解除', |
|
|
|
|
|
confirmColor: '#6c69d8', |
|
|
|
|
|
success: async (res) => { |
|
|
|
|
|
if (!res.confirm) return |
|
|
|
|
|
await unblockIeUser(this.targetUserId) |
|
|
|
|
|
this.blockedByMe = false |
|
|
|
|
|
this.isBlocked = this.blockedByOther |
|
|
|
|
|
uni.showToast({ title: '已解除拉黑', icon: 'none' }) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
async finishRoom() { |
|
|
async finishRoom() { |
|
|
if (this.finishing) return |
|
|
if (this.finishing) return |
|
|
this.finishing = true |
|
|
this.finishing = true |
|
|
@ -1114,6 +1155,11 @@ |
|
|
background: rgba(232,93,117,.1); |
|
|
background: rgba(232,93,117,.1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.safe-btn.warn.active { |
|
|
|
|
|
color: #6c69d8; |
|
|
|
|
|
background: rgba(139,124,255,.1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.silent-modes { |
|
|
.silent-modes { |
|
|
position: relative; |
|
|
position: relative; |
|
|
z-index: 1; |
|
|
z-index: 1; |
|
|
|