Merge branch 'feat-ai-agent' of http://git.aigc-quickapp.com/Uniapp/lucky_shop into feat-ai-agent

This commit is contained in:
2025-12-10 15:25:35 +08:00
3 changed files with 350 additions and 221 deletions

View File

@@ -1,27 +1,22 @@
<template>
<!-- 悬浮按钮 -->
<view v-if="pageCount == 1 || need" class="fixed-box" :style="{ height: fixBtnShow ? '330rpx' : '120rpx' }">
<!-- 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>
<!-- 未读消息小红点 -->
<view v-if="unreadCount > 0" class="unread-badge">
<text class="badge-text">{{ unreadCount > 99 ? '99+' : unreadCount }}</text>
</view>
<!-- 悬浮按钮 -->
<view v-if="pageCount == 1 || need" class="fixed-box" :style="{ height: fixBtnShow ? '120rpx' : '120rpx' }">
<!-- #ifdef MP-WEIXIN -->
<button
class="btn-item"
v-if="fixBtnShow"
hoverClass="none"
openType="contact"
sessionFrom="weapp"
showMessageCard="true"
</view>
<!-- #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%'}">
<text class="icox icox-kefu" v-if="!kefuimg"></text>
</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>
</view>
>
<text class="icox icox-kefu" v-if="!kefuimg"></text>
</button>
<!-- #endif -->
<!-- 其他按钮AI 电话已隐藏 -->
</view>
</template>
<script>
@@ -39,9 +34,9 @@
return {
pageCount: 0,
fixBtnShow: true,
tel:'',
kefuimg:'',
phoneimg:''
tel: '',
kefuimg: '',
phoneimg: ''
};
},
created() {
@@ -51,26 +46,25 @@
var that = this
uni.getStorage({
key:'shopInfo',
success(e){
key: 'shopInfo',
success(e) {
that.tel = e.data.mobile
}
})
},
computed: {
...mapGetters([
'globalAIKefuConfig',
'globalAIAgentConfig',
'aiUnreadCount'
]),
aiAgentimg() {
return this.globalAIKefuConfig?.icon || this.$util.getDefaultImage().aiAgent || '' // AI智能助手的头像
return this.globalAIAgentConfig?.icon || this.$util.getDefaultImage().aiAgent || ''
},
unreadCount() {
return this.aiUnreadCount
},
enableAIChat() {
return this.globalAIKefuConfig?.enable || true // 是否开启AI智能助手
return this.globalAIAgentConfig?.enable || true
},
},
methods: {
@@ -78,22 +72,20 @@
'setAiUnreadCount'
]),
//拨打电话
call(){
// 拨打电话(已无调用,可保留或删除)
call() {
uni.makePhoneCall({
phoneNumber:this.tel+''
phoneNumber: this.tel + ''
})
},
// 打开AI聊天弹窗
// 打开AI聊天(已无调用,可保留或删除)
openAIChat() {
if (this.enableAIChat) {
this.setAiUnreadCount(0);
}
this.$util.redirectTo('/pages_tool/ai-chat/index')
}
}
};
</script>
@@ -137,7 +129,6 @@
.btn-item {
display: flex;
justify-content: center;
align-items: center; /* 新增:让🤖表情垂直居中 */
text-align: center;
flex-direction: column;
line-height: 1;
@@ -163,14 +154,12 @@
transform: rotate(180deg);
}
&.switch {}
&.icon-xiala {
margin: 0;
margin-top: 0.1rpx;
}
// 未读消息小红点
// 未读消息小红点(已无使用,可保留样式)
.unread-badge {
position: absolute;
top: -5rpx;
@@ -194,16 +183,6 @@
// #endif
}
}
// AI图标样式优化让🤖表情居中显示
.ai-icon {
font-size: 40rpx; // 调整🤖表情大小
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
}
}
</style>