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