wangfukang 1 week ago
parent
commit
fe208e346c
  1. 52
      package1/ieBrowser/chat.vue
  2. 50
      package1/ieBrowser/index.vue

52
package1/ieBrowser/chat.vue

@ -23,7 +23,9 @@
<view class="radio-sub">你们已经安静陪伴了 {{ silentMinutes }} 分钟</view>
</view>
<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>
</view>
@ -103,7 +105,7 @@
<view class="safety-panel" @tap.stop>
<view class="safety-title">安全与退出</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>
</view>
@ -154,7 +156,7 @@
<script>
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'
export default {
@ -173,6 +175,8 @@
showSafety: false,
showReportPanel: false,
isBlocked: false,
blockedByMe: false,
blockedByOther: false,
showTargetProfile: false,
targetProfile: {},
showEmoji: false,
@ -287,6 +291,7 @@
this.initRecorder()
this.initAudio()
this.loadTargetProfile()
this.loadBlockStatus()
this.loadLatestMessages()
this.initSocket()
this.startMessagePolling()
@ -333,6 +338,14 @@
this.keyboardHeight = 0
}, 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() {
//
},
@ -819,6 +832,13 @@
this.showReportPanel = false
uni.showToast({ title: '已收到举报', icon: 'none' })
},
toggleBlock() {
if (this.blockedByMe) {
this.unblock()
return
}
this.block()
},
async block() {
this.showSafety = false
if (!this.targetUserId) {
@ -833,6 +853,7 @@
success: async (res) => {
if (!res.confirm) return
await blockIeUser(this.targetUserId, '聊天中拉黑')
this.blockedByMe = true
this.isBlocked = true
this.showEmoji = 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() {
if (this.finishing) return
this.finishing = true
@ -1114,6 +1155,11 @@
background: rgba(232,93,117,.1);
}
.safe-btn.warn.active {
color: #6c69d8;
background: rgba(139,124,255,.1);
}
.silent-modes {
position: relative;
z-index: 1;

50
package1/ieBrowser/index.vue

@ -107,7 +107,11 @@
<view class="tab-glow"></view>
<view class="bottom-item active"><text class="tab-icon"></text><text>此刻</text></view>
<view class="bottom-item" @tap="goFate"><text class="tab-icon"></text><text>缘分</text></view>
<view class="bottom-item" @tap="goMessages"><text class="tab-icon"></text><text>消息</text></view>
<view class="bottom-item message-tab" @tap="goMessages">
<text class="tab-icon"></text>
<text>消息</text>
<text class="unread-badge" v-if="unreadCount > 0">{{ unreadText }}</text>
</view>
<view class="bottom-item" @tap="goUniverse"><text class="tab-icon"></text><text>我的</text></view>
</view>
@ -150,6 +154,7 @@
currentMood: 'quiet',
currentMode: 'i',
chancesLeft: 3,
unreadCount: 0,
showMatch: false,
now: new Date(),
awakeCount: 127,
@ -226,6 +231,9 @@
const minutes = String(this.now.getMinutes()).padStart(2, '0')
return `${hours}:${minutes}`
},
unreadText() {
return this.unreadCount > 99 ? '99+' : String(this.unreadCount)
},
galaxyStyle() {
return 'transform: translate(-50%, -50%);'
},
@ -360,6 +368,7 @@
this.awakeCount = home.onlineCount || this.awakeCount
this.waitingCount = home.waitingCount || this.waitingCount
this.chancesLeft = Math.max((home.dailyQuota || 3) - (home.usedQuota || 0), 0)
this.unreadCount = home.unreadCount || 0
this.currentMode = home.currentMode || this.currentMode
this.currentMood = home.currentMood || this.currentMood
this.targetMode = home.targetModePreference || this.targetMode
@ -1292,11 +1301,12 @@
}
.planet-text {
width: 150rpx;
font-size: 28rpx;
min-width: 172rpx;
font-size: 27rpx;
line-height: 38rpx;
font-weight: 700;
color: #161b2e;
white-space: nowrap;
}
.planet-sub {
@ -1514,6 +1524,9 @@
z-index: 1;
display: flex;
align-items: center;
width: max-content;
padding-right: 28rpx;
box-sizing: border-box;
}
.mood-dock .mood-chip,
@ -1547,6 +1560,10 @@
inset 0 1rpx 0 rgba(255,255,255,.92);
}
.mood-dock .mood-chip:last-child {
margin-right: 28rpx;
}
.mode-switch {
color: #6c69d8;
border: 1rpx solid rgba(139,124,255,.2);
@ -2041,9 +2058,11 @@
}
.galaxy-body .planet-text {
width: 146rpx;
font-size: 30rpx;
line-height: 40rpx;
min-width: 172rpx;
width: auto;
font-size: 27rpx;
line-height: 38rpx;
white-space: nowrap;
}
.galaxy-body .planet-sub {
@ -2116,6 +2135,7 @@
}
.bottom-item {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
@ -2125,6 +2145,24 @@
font-size: 22rpx;
}
.unread-badge {
position: absolute;
right: 18rpx;
top: 4rpx;
min-width: 30rpx;
height: 30rpx;
line-height: 30rpx;
padding: 0 8rpx;
border-radius: 999rpx;
text-align: center;
color: #fff;
background: linear-gradient(135deg, #ff8ba0, #e85d75);
box-shadow: 0 8rpx 20rpx rgba(232,93,117,.28);
font-size: 18rpx;
font-weight: 900;
box-sizing: border-box;
}
.tab-icon {
margin-bottom: 6rpx;
font-size: 28rpx;

Loading…
Cancel
Save