wangfukang 1 week ago
parent
commit
7d6d6fae8e
  1. 29
      package1/ieBrowser/chat.vue
  2. 121
      package1/ieBrowser/index.vue

29
package1/ieBrowser/chat.vue

@ -137,6 +137,10 @@
<text class="profile-info-label">性别</text> <text class="profile-info-label">性别</text>
<text>{{ genderText(targetProfile.gender) }}</text> <text>{{ genderText(targetProfile.gender) }}</text>
</view> </view>
<view class="profile-info">
<text class="profile-info-label">当前状态</text>
<text>{{ profileStateText(targetProfile) }}</text>
</view>
</view> </view>
<view class="profile-intro">{{ targetProfile.intro || companion.prompt || '这个人还没有写介绍。' }}</view> <view class="profile-intro">{{ targetProfile.intro || companion.prompt || '这个人还没有写介绍。' }}</view>
<view class="profile-tags" v-if="targetProfile.interestTags && targetProfile.interestTags.length"> <view class="profile-tags" v-if="targetProfile.interestTags && targetProfile.interestTags.length">
@ -156,7 +160,7 @@
<script> <script>
import ieSocket from '@/common/ieSocket.js' import ieSocket from '@/common/ieSocket.js'
import { finishIeRoom, reportIeRoom, blockIeRoomTarget, unblockIeRoomTarget, getIeRoomBlockStatus, pageIeMessages, sendIeMessage, getIeUserProfile } from '@/common/ieApi.js' import { finishIeRoom, reportIeRoom, blockIeRoomTarget, unblockIeRoomTarget, getIeRoomBlockStatus, pageIeMessages, sendIeMessage, getIeRoomTargetProfile } from '@/common/ieApi.js'
import tui from '@/common/httpRequest.js' import tui from '@/common/httpRequest.js'
export default { export default {
@ -768,6 +772,10 @@
if (gender === 'female') return '女生' if (gender === 'female') return '女生'
return '未设置' return '未设置'
}, },
profileStateText(profile) {
const tags = profile && profile.interestTags && profile.interestTags.length ? profile.interestTags.slice(0, 2).join(' · ') : '此刻在线'
return tags
},
previewTargetPersona(index) { previewTargetPersona(index) {
const images = this.targetProfile.personaImages || [] const images = this.targetProfile.personaImages || []
if (!images.length) return if (!images.length) return
@ -789,12 +797,21 @@
this.showTargetProfile = true this.showTargetProfile = true
}, },
async loadTargetProfile() { async loadTargetProfile() {
if (!this.targetUserId) return if (!this.roomId) return
const profile = await getIeUserProfile(this.targetUserId) const profile = await getIeRoomTargetProfile(this.roomId)
if (!profile) return if (!profile) return
const profileCompleted = profile.profileCompleted === 1 || !!profile.intro || !!profile.avatarUrl || (profile.interestTags && profile.interestTags.length) if (profile.userId) this.targetUserId = profile.userId
const usableProfile = profile.exists !== false && profileCompleted const usableProfile = profile.exists !== false
this.targetProfile = usableProfile ? profile : { this.targetProfile = usableProfile ? {
...profile,
anonymousName: profile.anonymousName || this.companion.name,
avatarText: profile.avatarText || this.companion.avatar,
avatarUrl: profile.avatarUrl || this.companion.avatarUrl,
intro: profile.intro || this.companion.prompt,
currentMode: profile.currentMode || this.roomMode,
interestTags: profile.interestTags || [],
personaImages: profile.personaImages || []
} : {
...profile, ...profile,
anonymousName: this.companion.name, anonymousName: this.companion.name,
avatarText: this.companion.avatar, avatarText: this.companion.avatar,

121
package1/ieBrowser/index.vue

@ -117,19 +117,32 @@
<view class="match-mask" v-if="showMatch" @tap="closeMatch"> <view class="match-mask" v-if="showMatch" @tap="closeMatch">
<view class="match-panel" @tap.stop> <view class="match-panel" @tap.stop>
<scroll-view scroll-y class="match-scroll">
<view class="match-top"> <view class="match-top">
<view class="match-label">半匿名漂流者</view> <view class="match-label">半匿名漂流者</view>
<view class="close" @tap="closeMatch">×</view> <view class="close" @tap="closeMatch">×</view>
</view> </view>
<image class="companion-orb-img" v-if="matchedPerson.avatarUrl" :src="matchedPerson.avatarUrl" mode="aspectFill"></image> <image class="companion-orb-img" v-if="matchedPerson.avatarUrl" :src="matchedPerson.avatarUrl" mode="aspectFill" @tap="previewMatchedPersona(0)"></image>
<view class="companion-orb" v-else :class="currentMode">{{ matchedPerson.avatar }}</view> <view class="companion-orb" v-else :class="matchedPerson.mode || currentMode">{{ matchedPerson.avatar }}</view>
<view class="match-name">{{ matchedPerson.name }}</view> <view class="match-name">{{ matchedPerson.name }}</view>
<view class="match-state">{{ activeMood.label }} · {{ matchedPerson.state }}</view> <view class="match-state">{{ modeText(matchedPerson.mode) }} · {{ genderText(matchedPerson.gender) }}</view>
<view class="match-tags" v-if="matchedPerson.tags && matchedPerson.tags.length">
<text v-for="tag in matchedPerson.tags" :key="tag">{{ tag }}</text>
</view>
<view class="match-state-text">{{ matchedPerson.state }}</view>
<view class="match-quote">{{ matchedPerson.quote }}</view> <view class="match-quote">{{ matchedPerson.quote }}</view>
<view class="match-persona" v-if="matchedPerson.personaImages && matchedPerson.personaImages.length">
<view class="match-section-title">人格卡片</view>
<scroll-view scroll-x class="match-persona-scroll">
<image class="match-persona-image" v-for="(img,index) in matchedPerson.personaImages" :key="img"
:src="img" mode="aspectFill" @tap="previewMatchedPersona(index)"></image>
</scroll-view>
</view>
<view class="match-actions"> <view class="match-actions">
<view class="ghost-btn" @tap="skipMatch">轻轻划过</view> <view class="ghost-btn" @tap="skipMatch">轻轻划过</view>
<view class="solid-btn" @tap="goChat">进入聊天</view> <view class="solid-btn" @tap="goChat">进入聊天</view>
</view> </view>
</scroll-view>
</view> </view>
</view> </view>
@ -145,7 +158,7 @@
</template> </template>
<script> <script>
import { ieHome, updateIeStatus, startIeMatch } from '@/common/ieApi.js' import { ieHome, updateIeStatus, startIeMatch, getIeUserProfile } from '@/common/ieApi.js'
export default { export default {
data() { data() {
@ -416,11 +429,51 @@
avatar: match.avatarText || '◌', avatar: match.avatarText || '◌',
avatarUrl: match.avatarUrl || '', avatarUrl: match.avatarUrl || '',
name: match.anonymousName || '半匿名 漂流者', name: match.anonymousName || '半匿名 漂流者',
mode: match.mode || this.currentMode,
gender: match.gender || '',
tags: match.interestTags || [],
personaImages: match.personaImages || [],
state: match.stateText || '也在等一句轻轻的回应', state: match.stateText || '也在等一句轻轻的回应',
quote: match.quoteText || '可以先安静待一会,不用急着找话题。' quote: match.quoteText || '可以先安静待一会,不用急着找话题。'
} }
await this.loadMatchedProfile(match.targetUserId)
this.showMatch = true this.showMatch = true
}, },
async loadMatchedProfile(targetUserId) {
if (!targetUserId) return
const profile = await getIeUserProfile(targetUserId)
if (!profile || profile.exists === false) return
this.matchedPerson = {
...this.matchedPerson,
avatar: profile.avatarText || this.matchedPerson.avatar,
avatarUrl: profile.avatarUrl || this.matchedPerson.avatarUrl || '',
name: profile.anonymousName || this.matchedPerson.name,
mode: profile.currentMode || this.matchedPerson.mode,
gender: profile.gender || this.matchedPerson.gender,
tags: profile.interestTags || [],
personaImages: profile.personaImages || [],
state: this.profileStateText(profile),
quote: profile.intro || this.matchedPerson.quote
}
},
profileStateText(profile) {
const mode = profile.currentMode === 'e' ? '轻轻热闹' : '安静靠近'
const tags = profile.interestTags && profile.interestTags.length ? profile.interestTags.slice(0, 2).join(' · ') : '此刻在线'
return `${mode} · ${tags}`
},
modeText(mode) {
return mode === 'e' ? 'e 人' : 'i 人'
},
genderText(gender) {
if (gender === 'male') return '男生'
if (gender === 'female') return '女生'
return '性别未设置'
},
previewMatchedPersona(index) {
const images = this.matchedPerson.personaImages || []
if (!images.length) return
uni.previewImage({ urls: images, current: images[index] })
},
closeMatch() { this.showMatch = false }, closeMatch() { this.showMatch = false },
toggleMode() { toggleMode() {
this.currentMode = this.currentMode === 'i' ? 'e' : 'i' this.currentMode = this.currentMode === 'i' ? 'e' : 'i'
@ -961,12 +1014,20 @@
.match-panel { .match-panel {
width: 100%; width: 100%;
padding: 34rpx; max-height: 78vh;
padding: 0;
border: 1rpx solid rgba(255, 255, 255, .76); border: 1rpx solid rgba(255, 255, 255, .76);
border-radius: 46rpx; border-radius: 46rpx;
background: rgba(255, 255, 255, .76); background: rgba(255, 255, 255, .76);
box-sizing: border-box; box-sizing: border-box;
box-shadow: 0 30rpx 90rpx rgba(96, 112, 160, .18); box-shadow: 0 30rpx 90rpx rgba(96, 112, 160, .18);
overflow: hidden;
}
.match-scroll {
max-height: 78vh;
padding: 34rpx;
box-sizing: border-box;
} }
.match-top { .match-top {
@ -1019,6 +1080,31 @@
font-size: 23rpx; font-size: 23rpx;
} }
.match-tags {
margin-top: 18rpx;
text-align: center;
}
.match-tags text {
display: inline-block;
height: 44rpx;
line-height: 44rpx;
padding: 0 16rpx;
margin: 0 8rpx 10rpx;
border-radius: 999rpx;
color: #6c69d8;
background: rgba(139,124,255,.1);
font-size: 21rpx;
font-weight: 700;
}
.match-state-text {
margin-top: 8rpx;
text-align: center;
color: rgba(22,27,46,.54);
font-size: 23rpx;
}
.match-quote { .match-quote {
margin-top: 30rpx; margin-top: 30rpx;
padding: 26rpx; padding: 26rpx;
@ -1029,6 +1115,31 @@
line-height: 42rpx; line-height: 42rpx;
} }
.match-persona {
margin-top: 22rpx;
}
.match-section-title {
margin-bottom: 14rpx;
color: rgba(22,27,46,.62);
font-size: 24rpx;
font-weight: 800;
}
.match-persona-scroll {
white-space: nowrap;
}
.match-persona-image {
display: inline-block;
width: 168rpx;
height: 208rpx;
margin-right: 16rpx;
border-radius: 26rpx;
background: rgba(22,27,46,.06);
box-shadow: 0 14rpx 34rpx rgba(96,112,160,.12);
}
.match-actions { .match-actions {
display: flex; display: flex;
gap: 18rpx; gap: 18rpx;

Loading…
Cancel
Save