chore:智能客服的头像换了

This commit is contained in:
2026-04-14 09:42:09 +08:00
parent 611c0b930b
commit 1be7155fe8
3 changed files with 46 additions and 11 deletions

View File

@@ -471,13 +471,11 @@ export class CustomerService {
const shopInfo = this.vm.shopInfo || {};
const config = this.getPlatformConfig();
if (config?.type === 'aikefu') {
return shopInfo.aiAgentimg || '';
} else if (config?.type === 'wxwork' || config?.type === 'qyweixin') {
return shopInfo.aiAgentimg || '';
} else if (config?.type === 'third') {
return '';
// 优先使用指定的智能客服头像
if (config?.type === 'aikefu' || config?.type === 'wxwork' || config?.type === 'qyweixin') {
return '/static/images/image_460671319773954.png';
}
return shopInfo.kefuimg || this.vm.$util?.getDefaultImage()?.kefu || '';
}

View File

@@ -4,7 +4,7 @@
<view class="goods-container">
<!-- AI客服悬浮按钮 -->
<view class="ai-chat-float-btn" @tap.stop="$emit('aiChatClick')" v-if="goodsSkuDetail">
<text class="iconfont">🤖</text>
<image src="/static/images/image_460671319773954.png" mode="aspectFill" class="ai-avatar-icon" />
</view>
<!-- 弹幕 -->
@@ -511,4 +511,9 @@ export default {
.ai-chat-float-btn .iconfont {
font-size: 40rpx;
}
.ai-chat-float-btn .ai-avatar-icon {
width: 100%;
height: 100%;
}
</style>

View File

@@ -50,8 +50,14 @@
<!-- AI消息 -->
<view v-else class="ai-message">
<view class="avatar">
<!-- 豆包风格头像 -->
<image src="https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=cute%20doudou%20style%20AI%20assistant%20avatar%2C%20round%20face%2C%20friendly%20expression%2C%20simple%20style%2C%20white%20background&image_size=square" mode="aspectFill" />
<!-- 智能客服头像 -->
<image
v-if="aiAvatarUrl && !avatarError"
:src="aiAvatarUrl"
mode="aspectFill"
@error="handleAvatarError"
/>
<text v-else class="avatar-emoji">🤖</text>
</view>
<view class="message-content">
<!-- AI昵称固定,不可修改 - 左移到气泡上方 -->
@@ -412,18 +418,25 @@ export default {
streamContent: '',
isStreaming: false,
// 固定AI头像
aiAvatar: '/static/images/ai-avatar.png',
aiAvatar: '/static/images/image_460671319773954.png',
// 本地用户头像(优先使用缓存,无缓存则用默认图)
localUserAvatar: '',
// 默认头像路径
defaultAvatar: '/static/images/default-avatar.png',
// 头像选择弹窗控制
showAvatarSelector: false, // 头像选择弹窗控制
showAvatarSelector: false, // 头像选择弹窗控制
// 新增:用户昵称相关
localUserNickname: '', // 当前用户昵称
defaultNickname: '我', // 默认昵称
showNicknameEditor: false, // 昵称编辑弹窗控制
tempNickname: '', // 昵称编辑临时值
// AI头像配置(可配置,方便后续更换)
// 支持两种方式:
// 1. 使用图片URL:设置为图片链接字符串
// 2. 使用emoji:设置为空字符串或null,将显示默认的🤖
aiAvatarUrl: '/static/images/image_460671319773954.png',
// AI头像错误状态
avatarError: false,
// Dify API相关
currentConversationId: null,
@@ -1435,6 +1448,11 @@ async loadChatHistoryIfExist() {
this.$emit('input-change', e.detail.value)
},
// 处理头像加载失败
handleAvatarError() {
this.avatarError = true
},
// 选择图片
selectImage() {
uni.chooseImage({
@@ -1622,6 +1640,7 @@ $radius-lg: 36rpx;
display: flex;
align-items: center;
justify-content: center;
position: relative;
&:hover {
transform: scale(1.03);
@@ -1637,6 +1656,19 @@ $radius-lg: 36rpx;
font-size: 56rpx;
line-height: 1;
}
.avatar-fallback {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
font-size: 56rpx;
background-color: $bg-card;
}
}
.message-content {