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,
|
...params,
|
||||||
async: false,
|
async: false,
|
||||||
});
|
});
|
||||||
|
console.log('[AI Service] getServiceConfig response:', JSON.stringify(response));
|
||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('[AI Service] getServiceConfig error:', error);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -646,10 +646,13 @@ export default {
|
|||||||
// 1. 尝试从 API 获取远程欢迎语
|
// 1. 尝试从 API 获取远程欢迎语
|
||||||
try {
|
try {
|
||||||
const config = await aiService.getServiceConfig()
|
const config = await aiService.getServiceConfig()
|
||||||
|
console.log('[AI Chat] API getServiceConfig 返回:', JSON.stringify(config))
|
||||||
if (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 remoteText = welcomeInfo?.welcome || ''
|
||||||
const isEnabled = welcomeInfo?.is_enabled
|
const isEnabled = welcomeInfo?.is_enabled
|
||||||
|
console.log('[AI Chat] remoteText:', remoteText, 'isEnabled:', isEnabled)
|
||||||
if (remoteText && isEnabled !== 0 && isEnabled !== false) {
|
if (remoteText && isEnabled !== 0 && isEnabled !== false) {
|
||||||
welcomeText = remoteText
|
welcomeText = remoteText
|
||||||
isMarkdown = true
|
isMarkdown = true
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
initialMessages: [],
|
initialMessages: [],
|
||||||
fallbackWelcome: this.$lang('fallbackWelcome'),
|
fallbackWelcome: '',
|
||||||
|
|
||||||
// --- 系统导航栏/状态栏相关 ---
|
// --- 系统导航栏/状态栏相关 ---
|
||||||
navBarHeight: 44, // uni-page-head 系统导航栏,默认高度为44px
|
navBarHeight: 44, // uni-page-head 系统导航栏,默认高度为44px
|
||||||
@@ -125,6 +125,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async onLoad(options) {
|
async onLoad(options) {
|
||||||
|
this.fallbackWelcome = this.$lang('fallbackWelcome');
|
||||||
|
|
||||||
// ✅ 修改:取消权限校验,允许所有客服类型访问此页面
|
// ✅ 修改:取消权限校验,允许所有客服类型访问此页面
|
||||||
// const hasAccess = this.checkAccessPermission();
|
// const hasAccess = this.checkAccessPermission();
|
||||||
// if (!hasAccess) {
|
// if (!hasAccess) {
|
||||||
|
|||||||
Reference in New Issue
Block a user