fix: AI智能客服首次使用显示fallbackWelcome的问题
1. 将 config.welcome 改为 config.welcome_info 匹配后端返回字段 2. 修复语言包路径错误:将 () 从 data() 移到 onLoad() 中 - 原因:data() 执行时 getCurrentPages() 返回的是上一个页面 3. 添加调试日志用于排查 API 返回值
This commit is contained in:
@@ -547,8 +547,10 @@ export default {
|
||||
...params,
|
||||
async: false,
|
||||
});
|
||||
console.log('[AI Service] getServiceConfig response:', JSON.stringify(response));
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error('[AI Service] getServiceConfig error:', error);
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -646,10 +646,13 @@ export default {
|
||||
// 1. 尝试从 API 获取远程欢迎语
|
||||
try {
|
||||
const config = await aiService.getServiceConfig()
|
||||
console.log('[AI Chat] API getServiceConfig 返回:', JSON.stringify(config))
|
||||
if (config) {
|
||||
const welcomeInfo = config.welcome
|
||||
const welcomeInfo = config.welcome_info
|
||||
console.log('[AI Chat] welcomeInfo:', JSON.stringify(welcomeInfo))
|
||||
const remoteText = welcomeInfo?.welcome || ''
|
||||
const isEnabled = welcomeInfo?.is_enabled
|
||||
console.log('[AI Chat] remoteText:', remoteText, 'isEnabled:', isEnabled)
|
||||
if (remoteText && isEnabled !== 0 && isEnabled !== false) {
|
||||
welcomeText = remoteText
|
||||
isMarkdown = true
|
||||
|
||||
@@ -86,7 +86,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
initialMessages: [],
|
||||
fallbackWelcome: this.$lang('fallbackWelcome'),
|
||||
fallbackWelcome: '',
|
||||
|
||||
// --- 系统导航栏/状态栏相关 ---
|
||||
navBarHeight: 44, // uni-page-head 系统导航栏,默认高度为44px
|
||||
@@ -125,6 +125,8 @@ export default {
|
||||
},
|
||||
|
||||
async onLoad(options) {
|
||||
this.fallbackWelcome = this.$lang('fallbackWelcome');
|
||||
|
||||
// ✅ 修改:取消权限校验,允许所有客服类型访问此页面
|
||||
// const hasAccess = this.checkAccessPermission();
|
||||
// if (!hasAccess) {
|
||||
|
||||
Reference in New Issue
Block a user