chore:合并成一个客服按钮

This commit is contained in:
2025-12-19 11:59:52 +08:00
parent 8103f4c897
commit 3a455bd644
3 changed files with 40 additions and 5 deletions

View File

@@ -1,18 +1,23 @@
<template>
<!-- 悬浮按钮 -->
<view v-if="pageCount == 1 || need" class="fixed-box" :style="{ height: fixBtnShow ? '330rpx' : '120rpx' }">
<button class="btn-item" v-if="fixBtnShow && useOfficialService" hoverClass="none" open-type="contact"
<!-- #ifdef MP-WEIXIN -->
<button class="btn-item" v-if="fixBtnShow" hoverClass="none" open-type="contact"
sessionFrom="weapp" showMessageCard="true"
:style="{ backgroundImage: 'url(' + (kefuimg ? kefuimg : '') + ')', backgroundSize: '100% 100%' }">
<text class="icox icox-kefu" v-if="!kefuimg"></text>
</button>
<!-- #endif -->
<!-- #ifdef H5 -->
<!-- 自定义客服按钮 -->
<button class="btn-item" v-if="fixBtnShow && !useOfficialService" hoverClass="none" @click="contactServicer"
<button class="btn-item" v-if="fixBtnShow" hoverClass="none" @click="contactServicer"
:style="{ backgroundImage: 'url(' + (kefuimg ? kefuimg : '') + ')', backgroundSize: '100% 100%' }">
<text class="icox icox-kefu" v-if="!kefuimg"></text>
</button>
<!-- #endif -->
<!-- AI智能助手 -->
<view class="btn-item" v-if="fixBtnShow && enableAIChat" @click="openAIChat"
<view class="btn-item" v-if="fixBtnShow && enableAIKefuButton" @click="openAIChat"
:style="{ backgroundImage: 'url(' + (aiAgentimg ? aiAgentimg : '') + ')', backgroundSize: '100% 100%' }">
<!-- 核心修改添加🤖表情保留原有判断逻辑 -->
<text class="ai-icon" v-if="!aiAgentimg">🤖</text>
@@ -30,7 +35,7 @@
</template>
<script>
import { createCustomerService } from '@/common/js/ai-service.js';
import { createCustomerService } from '@/common/js/customer-service.js';
import { mapGetters, mapMutations } from 'vuex';
export default {
@@ -59,6 +64,8 @@ export default {
this.customerService = createCustomerService(this);
this.buttonConfig = this.customerService.getButtonConfig();
console.log(`buttonConfig: `, this.buttonConfig);
const that = this;
uni.getStorage({
@@ -80,6 +87,9 @@ export default {
'globalAIKefuConfig',
'aiUnreadCount'
]),
enableAIKefuButton() {
return this.buttonConfig?.type === 'aikefu' && this.enableAIChat;
},
aiAgentimg() {
return this.globalAIKefuConfig?.icon || this.$util.getDefaultImage().aiAgent || '';
},
@@ -141,6 +151,7 @@ export default {
this.$util.redirectTo('/pages_tool/ai-chat/index');
},
contactServicer() {
this.customerService.handleCustomerClick();
}
}