fix: AI智能客服首次使用显示fallbackWelcome的问题

1. 将 config.welcome 改为 config.welcome_info 匹配后端返回字段
2. 修复语言包路径错误:将 () 从 data() 移到 onLoad() 中
   - 原因:data() 执行时 getCurrentPages() 返回的是上一个页面
3. 添加调试日志用于排查 API 返回值
This commit is contained in:
2026-05-26 15:02:35 +08:00
parent bca90e959e
commit f36f9ce992
3 changed files with 9 additions and 2 deletions

View File

@@ -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

View File

@@ -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) {