chore:增加了粉色机器人头像

This commit is contained in:
2025-12-08 18:09:38 +08:00
parent 7dbf455341
commit d489f352db

View File

@@ -1,213 +1,209 @@
<template> <template>
<!-- 悬浮按钮 --> <!-- 悬浮按钮 -->
<view v-if="pageCount == 1 || need" class="fixed-box" :style="{ height: fixBtnShow ? '330rpx' : '120rpx' }"> <view v-if="pageCount == 1 || need" class="fixed-box" :style="{ height: fixBtnShow ? '330rpx' : '120rpx' }">
<!-- <view class="btn-item" v-if="fixBtnShow" @click="$util.redirectTo('/pages/index/index')"> --> <!-- AI智能助手 -->
<view class="btn-item" v-if="fixBtnShow && enableAIChat" @click="openAIChat" :style="{backgroundImage:'url('+(aiAgentimg?aiAgentimg:'')+')',backgroundSize:'100% 100%'}">
<!-- AI智能助手 --> <!-- 核心修改添加🤖表情保留原有判断逻辑 -->
<view class="btn-item" v-if="fixBtnShow && enableAIChat" @click="openAIChat" :style="{backgroundImage:'url('+(aiAgentimg?aiAgentimg:'')+')',backgroundSize:'100% 100%'}"> <text class="ai-icon" v-if="!aiAgentimg">🤖</text>
<text class="ai-icon" v-if="!aiAgentimg"></text> <!-- 未读消息小红点 -->
<!-- 未读消息小红点 --> <view v-if="unreadCount > 0" class="unread-badge">
<view v-if="unreadCount > 0" class="unread-badge"> <text class="badge-text">{{ unreadCount > 99 ? '99+' : unreadCount }}</text>
<text class="badge-text">{{ unreadCount > 99 ? '99+' : unreadCount }}</text> </view>
</view> </view>
</view>
<!-- #ifdef MP-WEIXIN -->
<!-- #ifdef MP-WEIXIN --> <button class="btn-item" v-if="fixBtnShow" hoverClass="none" openType="contact" sessionFrom="weapp" showMessageCard="true" :style="{backgroundImage:'url('+(kefuimg?kefuimg:'')+')',backgroundSize:'100% 100%'}">
<button class="btn-item" v-if="fixBtnShow" hoverClass="none" openType="contact" sessionFrom="weapp" showMessageCard="true" :style="{backgroundImage:'url('+(kefuimg?kefuimg:'')+')',backgroundSize:'100% 100%'}"> <text class="icox icox-kefu" v-if="!kefuimg"></text>
<text class="icox icox-kefu" v-if="!kefuimg"></text> </button>
<!-- <view>首页</view> --> <!-- #endif -->
</button>
<!-- #endif --> <!-- 电话 -->
<view class="btn-item" v-if="fixBtnShow" @click="call()" :style="{backgroundImage:'url('+(phoneimg?phoneimg:'')+')',backgroundSize:'100% 100%'}">
<!-- 电话 --> <text class="iconfont icon-dianhua" v-if="!phoneimg"></text>
<view class="btn-item" v-if="fixBtnShow" @click="call()" :style="{backgroundImage:'url('+(phoneimg?phoneimg:'')+')',backgroundSize:'100% 100%'}"> </view>
<text class="iconfont icon-dianhua" v-if="!phoneimg"></text> </view>
<!-- <view>我的</view> --> </template>
</view>
<script>
<!-- <view class="btn-item icon-xiala" v-if="fixBtnShow" @click="fixBtnShow ? (fixBtnShow = false) : (fixBtnShow = true)"> import { mapGetters, mapMutations } from 'vuex'
<text class="iconfont icon-unfold"></text>
</view> export default {
<view class="btn-item switch" v-else :class="{ show: fixBtnShow }" name: 'hover-nav',
@click="fixBtnShow ? (fixBtnShow = false) : (fixBtnShow = true)"> props: {
<view class="">快捷</view> need: {
<view>导航</view> type: Boolean,
</view> --> default: false
</view> },
</template> },
data() {
<script> return {
import { mapGetters, mapMutations } from 'vuex' pageCount: 0,
fixBtnShow: true,
export default { tel:'',
name: 'hover-nav', kefuimg:'',
props: { phoneimg:''
need: { };
type: Boolean, },
default: false created() {
}, this.kefuimg = this.$util.getDefaultImage().kefu
}, this.phoneimg = this.$util.getDefaultImage().phone
data() { this.pageCount = getCurrentPages().length;
return {
pageCount: 0, var that = this
fixBtnShow: true, uni.getStorage({
tel:'', key:'shopInfo',
kefuimg:'', success(e){
phoneimg:'' that.tel = e.data.mobile
}; }
}, })
created() {
this.kefuimg = this.$util.getDefaultImage().kefu },
this.phoneimg = this.$util.getDefaultImage().phone computed: {
this.pageCount = getCurrentPages().length; ...mapGetters([
'globalAIKefuConfig',
'aiUnreadCount'
var that = this ]),
uni.getStorage({ aiAgentimg() {
key:'shopInfo', return this.globalAIKefuConfig?.icon || this.$util.getDefaultImage().aiAgent || '' // AI智能助手的头像
success(e){ },
that.tel = e.data.mobile unreadCount() {
} return this.aiUnreadCount
}) },
enableAIChat() {
}, return this.globalAIKefuConfig?.enable || true // 是否开启AI智能助手
computed: { },
...mapGetters([ },
'globalAIKefuConfig', methods: {
'aiUnreadCount' ...mapMutations([
]), 'setAiUnreadCount'
aiAgentimg() { ]),
return this.globalAIKefuConfig?.icon || this.$util.getDefaultImage().aiAgent || '' // AI智能助手的头像
}, //拨打电话
unreadCount() { call(){
return this.aiUnreadCount uni.makePhoneCall({
}, phoneNumber:this.tel+''
enableAIChat() { })
return this.globalAIKefuConfig?.enable || true // 是否开启AI智能助手 },
},
}, // 打开AI聊天弹窗
methods: { openAIChat() {
...mapMutations([ if (this.enableAIChat) {
'setAiUnreadCount' this.setAiUnreadCount(0);
]), }
//拨打电话 this.$util.redirectTo('/pages_tool/ai-chat/index')
call(){ }
uni.makePhoneCall({
phoneNumber:this.tel+'' }
}) };
}, </script>
// 打开AI聊天弹窗 <style lang="scss">
openAIChat() { .container-box {
if (this.enableAIChat) { width: 100%;
this.setAiUnreadCount(0);
} .item-wrap {
border-radius: 10rpx;
this.$util.redirectTo('/pages_tool/ai-chat/index')
} .image-box {
border-radius: 10rpx;
} }
};
</script> image {
width: 100%;
<style lang="scss"> height: auto;
.container-box { border-radius: 10rpx;
width: 100%; will-change: transform;
}
.item-wrap { }
border-radius: 10rpx; }
.image-box { //悬浮按钮
border-radius: 10rpx; .fixed-box {
} position: fixed;
right: 0rpx;
image { bottom: 200rpx;
width: 100%; z-index: 10;
height: auto; border-radius: 120rpx;
border-radius: 10rpx; padding: 20rpx 0;
will-change: transform; display: flex;
} justify-content: center;
} flex-direction: column;
} width: 100rpx;
box-sizing: border-box;
//悬浮按钮 transition: 0.3s;
.fixed-box { overflow: hidden;
position: fixed;
right: 0rpx; .btn-item {
bottom: 200rpx; display: flex;
z-index: 10; justify-content: center;
// background: #fff; align-items: center; /* 新增:让🤖表情垂直居中 */
// box-shadow: 2rpx 2rpx 22rpx rgba(0, 0, 0, 0.3); text-align: center;
border-radius: 120rpx; flex-direction: column;
padding: 20rpx 0; line-height: 1;
display: flex; margin: 14rpx 0;
justify-content: center; transition: 0.1s;
flex-direction: column; background: #fff;
width: 100rpx; border-radius: 50rpx;
box-sizing: border-box; width: 80rpx;
transition: 0.3s; height: 80rpx;
overflow: hidden; padding: 0;
position: relative;
.btn-item { text {
display: flex; font-size: 36rpx;
justify-content: center; font-weight: bold;
text-align: center; }
flex-direction: column;
line-height: 1; view {
margin: 14rpx 0; font-size: 26rpx;
transition: 0.1s; font-weight: bold;
background: #fff; }
border-radius: 50rpx;
width: 80rpx; &.show {
height: 80rpx; transform: rotate(180deg);
padding: 0; }
position: relative;
text { &.switch {}
font-size: 36rpx;
font-weight: bold; &.icon-xiala {
} margin: 0;
margin-top: 0.1rpx;
view { }
font-size: 26rpx;
font-weight: bold; // 未读消息小红点
} .unread-badge {
position: absolute;
&.show { top: -5rpx;
transform: rotate(180deg); right: -5rpx;
} background-color: #ff4544;
color: white;
&.switch {} border-radius: 20rpx;
min-width: 30rpx;
&.icon-xiala { height: 30rpx;
margin: 0; font-size: 10rpx;
margin-top: 0.1rpx; line-height: 30rpx;
} text-align: center;
padding: 0 8rpx;
// 未读消息小红点 z-index: 1;
.unread-badge { box-shadow: 0 2rpx 10rpx rgba(255, 69, 68, 0.3);
position: absolute;
top: -5rpx; .badge-text {
right: -5rpx; font-size: 8rpx;
background-color: #ff4544; // #ifdef MP-WEIXIN
color: white; font-size: 20rpx;
border-radius: 20rpx; // #endif
min-width: 30rpx; }
height: 30rpx; }
font-size: 10rpx;
line-height: 30rpx; // AI图标样式优化让🤖表情居中显示
text-align: center; .ai-icon {
padding: 0 8rpx; font-size: 40rpx; // 调整🤖表情大小
z-index: 1; display: flex;
box-shadow: 0 2rpx 10rpx rgba(255, 69, 68, 0.3); align-items: center;
justify-content: center;
.badge-text { width: 100%;
font-size: 8rpx; height: 100%;
// #ifdef MP-WEIXIN }
font-size: 20rpx; }
// #endif }
}
}
}
}
</style> </style>