chore:后台点击不启用,H5和微信小程序不显示
This commit is contained in:
@@ -76,6 +76,15 @@ export class CustomerService {
|
||||
return config && typeof config === 'object' && config.type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否有有效的客服配置(用于判断是否显示客服按钮)
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
hasValidKefuConfig() {
|
||||
const config = this.getPlatformConfig();
|
||||
return config && typeof config === 'object' && config.type && config.type !== 'none';
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证客服配置完整性
|
||||
* @returns {Object} 验证结果
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</view>
|
||||
<!-- 微信官方客服按钮-->
|
||||
<button
|
||||
v-if="fixBtnShow && isWeappOfficialKefu"
|
||||
v-if="fixBtnShow && hasValidKefuConfig && isWeappOfficialKefu"
|
||||
class="btn-item common-bg"
|
||||
open-type="contact"
|
||||
:style="{ backgroundImage: currentKefuImg ? `url(${currentKefuImg})` : '', backgroundSize: '100% 100%' }"
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<!-- 其他类型客服按钮 -->
|
||||
<view
|
||||
v-else-if="fixBtnShow"
|
||||
v-else-if="fixBtnShow && hasValidKefuConfig && !showWeappSystemKefu"
|
||||
class="btn-item common-bg"
|
||||
@click="handleUnifiedKefuClick"
|
||||
:style="{ backgroundImage: currentKefuImg ? `url(${currentKefuImg})` : '', backgroundSize: '100% 100%' }"
|
||||
@@ -35,12 +35,12 @@
|
||||
|
||||
<!-- 小程序系统客服按钮 -->
|
||||
<button
|
||||
v-if="fixBtnShow && showWeappSystemKefu"
|
||||
v-else-if="fixBtnShow && hasValidKefuConfig && showWeappSystemKefu"
|
||||
class="btn-item common-bg"
|
||||
open-type="contact"
|
||||
:style="{ backgroundImage: currentKefuImg ? `url(${currentKefuImg})` : '', backgroundSize: '100% 100%' }"
|
||||
>
|
||||
<text class="ai-icon" v-if="!currentKefuImg">💬</text>
|
||||
<text class="iconfont icon-system-headphone-line" v-if="!currentKefuImg"></text>
|
||||
</button>
|
||||
|
||||
|
||||
@@ -106,30 +106,39 @@ export default {
|
||||
return this.shopInfo?.floatingButton?.button || {};
|
||||
},
|
||||
unreadCount() {
|
||||
return this.customerService?.getUnreadCount() || 0;
|
||||
const customerService = createCustomerService(this);
|
||||
return customerService.getUnreadCount();
|
||||
},
|
||||
currentKefuImg() {
|
||||
return this.customerService?.getKefuButtonIcon() || '';
|
||||
const customerService = createCustomerService(this);
|
||||
return customerService.getKefuButtonIcon();
|
||||
},
|
||||
isWeappOfficialKefu() {
|
||||
return this.customerService?.isWeappOfficialKefu() || false;
|
||||
const customerService = createCustomerService(this);
|
||||
return customerService.isWeappOfficialKefu();
|
||||
},
|
||||
showWeappSystemKefu() {
|
||||
return this.customerService?.shouldShowExtraWeappSystemKefu() || false;
|
||||
const customerService = createCustomerService(this);
|
||||
return customerService.shouldShowExtraWeappSystemKefu();
|
||||
},
|
||||
//根据显示的按钮数量动态计算容器高度
|
||||
containerHeight() {
|
||||
if (!this.fixBtnShow) return '320rpx';
|
||||
|
||||
let buttonCount = 1;
|
||||
if (this.isLanguageSwitchEnabled) buttonCount++;
|
||||
if (this.showWeappSystemKefu) buttonCount++;
|
||||
buttonCount++;
|
||||
const totalRpx = 94 * buttonCount - 14;
|
||||
const pxValue = Math.round(totalRpx * 0.5);
|
||||
return ` $ {pxValue}px`;
|
||||
}
|
||||
},
|
||||
hasValidKefuConfig() {
|
||||
const customerService = createCustomerService(this);
|
||||
return customerService.hasValidKefuConfig();
|
||||
},
|
||||
//根据显示的按钮数量动态计算容器高度
|
||||
containerHeight() {
|
||||
if (!this.fixBtnShow) return '320rpx';
|
||||
|
||||
let buttonCount = 1;
|
||||
if (this.isLanguageSwitchEnabled) buttonCount++;
|
||||
if (this.showWeappSystemKefu) buttonCount++;
|
||||
buttonCount++;
|
||||
const totalRpx = 94 * buttonCount - 14;
|
||||
const pxValue = Math.round(totalRpx * 0.5);
|
||||
|
||||
return ` $ {pxValue}px`;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
shopInfo: {
|
||||
handler(newVal) {
|
||||
|
||||
Reference in New Issue
Block a user