Compare commits
10 Commits
047cf765da
...
e301ddc6ec
| Author | SHA1 | Date | |
|---|---|---|---|
| e301ddc6ec | |||
| a560ad4a5d | |||
| 7f7a18803f | |||
| 42563d7184 | |||
| 14a903f42a | |||
| c9f8614927 | |||
| fe9303bf4c | |||
| e4dfd0ae11 | |||
| 7037d0b083 | |||
| e8a79bd245 |
@@ -7,7 +7,7 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 是否是英文环境
|
// 是否是英文环境
|
||||||
isEnEnv() {
|
isEnEnv() {
|
||||||
return this.$langConfig.getCurrentLocale() === 'en-us';
|
return uni.getStorageSync('lang') === 'en-us';
|
||||||
},
|
},
|
||||||
themeStyle() {
|
themeStyle() {
|
||||||
return this.$store.state.themeStyle;
|
return this.$store.state.themeStyle;
|
||||||
@@ -65,6 +65,10 @@ export default {
|
|||||||
componentRefresh() {
|
componentRefresh() {
|
||||||
return this.$store.state.componentRefresh;
|
return this.$store.state.componentRefresh;
|
||||||
},
|
},
|
||||||
|
// AI客服配置
|
||||||
|
globalAIKefuConfig() {
|
||||||
|
return this.$store.state.globalAIKefuConfig;
|
||||||
|
},
|
||||||
// 客服配置
|
// 客服配置
|
||||||
servicerConfig() {
|
servicerConfig() {
|
||||||
return this.$store.state.servicerConfig;
|
return this.$store.state.servicerConfig;
|
||||||
|
|||||||
@@ -1,215 +1,161 @@
|
|||||||
import { langConfig } from './config-external.js';
|
import { langConfig } from './config-external.js';
|
||||||
|
|
||||||
|
|
||||||
// 缓存已加载的语言包
|
// 缓存已加载的语言包
|
||||||
const loadedLangPacks = {};
|
const loadedLangPacks = {};
|
||||||
|
|
||||||
// 处理页面目录映射
|
// 处理页面目录映射
|
||||||
function processRoutePath(route) {
|
function processRoutePath(route) {
|
||||||
let routeParts = route.split("/");
|
let routeParts = route.split("/");
|
||||||
|
|
||||||
// ---- 处理页面目录映射 <begin> 分包造成的,需要根据实际目录结构进行映射----
|
// ---- 处理页面目录映射 <begin> 分包造成的,需要根据实际目录结构进行映射----
|
||||||
// 先处理特殊的分包路径
|
if (routeParts[0] === 'pages_tool') {
|
||||||
if (routeParts[0] === 'pages_tool') {
|
routeParts = [routeParts[1], ...routeParts.slice(2)];
|
||||||
// pages_tool 分包下的页面,直接使用子目录作为语言包路径
|
} else if (routeParts[0] === 'pages_goods') {
|
||||||
routeParts = [routeParts[1], ...routeParts.slice(2)];
|
routeParts[0] = 'goods';
|
||||||
} else if (routeParts[0] === 'pages_goods') {
|
} else if (routeParts[0] === 'pages_member') {
|
||||||
// pages_goods 分包映射到 goods 目录
|
routeParts[0] = 'member';
|
||||||
routeParts[0] = 'goods';
|
} else if (routeParts[0] === 'pages_order') {
|
||||||
} else if (routeParts[0] === 'pages_member') {
|
routeParts[0] = 'order';
|
||||||
// pages_member 分包映射到 member 目录
|
} else if (routeParts[0] === 'pages_promotion') {
|
||||||
routeParts[0] = 'member';
|
const promotionModules = ['point', 'fenxiao', 'merch'];
|
||||||
} else if (routeParts[0] === 'pages_order') {
|
if (routeParts[1] && promotionModules.includes(routeParts[1])) {
|
||||||
// pages_order 分包映射到 order 目录
|
routeParts = [routeParts[1], ...routeParts.slice(2)];
|
||||||
routeParts[0] = 'order';
|
}
|
||||||
} else if (routeParts[0] === 'pages_promotion') {
|
}
|
||||||
// pages_promotion 分包特殊处理
|
// ---- 处理页面目录映射 <end>----
|
||||||
const promotionModules = ['point', 'fenxiao', 'merch'];
|
|
||||||
if (routeParts[1] && promotionModules.includes(routeParts[1])) {
|
|
||||||
routeParts = [routeParts[1], ...routeParts.slice(2)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ---- 处理页面目录映射 <end>----
|
|
||||||
|
|
||||||
// 去掉pages目录,只保留子目录
|
if (routeParts[0] === 'pages') {
|
||||||
if (routeParts[0] === 'pages') {
|
routeParts = routeParts.slice(1);
|
||||||
routeParts = routeParts.slice(1);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return routeParts.join("/");
|
return routeParts.join("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载语言包(同步方式)
|
// 加载语言包(同步方式)
|
||||||
function loadLangPackSync(lang, path) {
|
function loadLangPackSync(lang, path) {
|
||||||
try {
|
try {
|
||||||
if (loadedLangPacks[`${lang}_${path}`]) {
|
if (loadedLangPacks[`${lang}_${path}`]) {
|
||||||
return loadedLangPacks[`${lang}_${path}`];
|
return loadedLangPacks[`${lang}_${path}`];
|
||||||
}
|
}
|
||||||
const langData = require(`@/lang/${lang}/${path}.js`).lang;
|
const langData = require(`@/lang/${lang}/${path}.js`).lang;
|
||||||
loadedLangPacks[`${lang}_${path}`] = langData;
|
loadedLangPacks[`${lang}_${path}`] = langData;
|
||||||
return langData;
|
return langData;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`加载语言包 ${lang}/${path} 失败:`, error);
|
console.error(`加载语言包 ${lang}/${path} 失败:`, error);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
langList: langConfig.langList,
|
langList: langConfig.langList,
|
||||||
|
/**
|
||||||
|
* 解析多语言
|
||||||
|
*/
|
||||||
|
lang(field) {
|
||||||
|
let _this = getCurrentPages()[getCurrentPages().length - 1];
|
||||||
|
if (!_this) return;
|
||||||
|
|
||||||
/**
|
const locale = uni.getStorageSync('lang') || "zh-cn";
|
||||||
* 获得当前本地语言
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
getCurrentLocale() {
|
|
||||||
return uni.getStorageSync('lang') || "zh-cn";
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
let value = '';
|
||||||
* * 解析多语言
|
let langPath = '';
|
||||||
* @param {Object} field
|
|
||||||
*/
|
|
||||||
lang(field) {
|
|
||||||
let _page = getCurrentPages()[getCurrentPages().length - 1];
|
|
||||||
if (!_page) return;
|
|
||||||
|
|
||||||
const locale = this.getCurrentLocale(); // 获得当前本地语言
|
try {
|
||||||
|
var lang = loadLangPackSync(locale, 'common');
|
||||||
|
|
||||||
let value = ''; // 存放解析后的语言值
|
let route = _this.route;
|
||||||
let langPath = ''; // 存放当前页面语言包路径
|
langPath = processRoutePath(route);
|
||||||
|
|
||||||
try {
|
let currentPageLang = loadLangPackSync(locale, langPath);
|
||||||
//公共语言包(同步加载)
|
|
||||||
var lang = loadLangPackSync(locale, 'common');
|
|
||||||
|
|
||||||
//当前页面语言包(同步加载)
|
let mergedLang = { ...lang, ...currentPageLang };
|
||||||
let route = _page.route;
|
|
||||||
langPath = processRoutePath(route);
|
|
||||||
|
|
||||||
// 加载当前页面语言包
|
var arr = field.split(".");
|
||||||
let currentPageLang = loadLangPackSync(locale, langPath);
|
if (arr.length > 1) {
|
||||||
|
let temp = mergedLang;
|
||||||
|
let found = true;
|
||||||
|
for (let key of arr) {
|
||||||
|
if (temp[key] !== undefined) {
|
||||||
|
temp = temp[key];
|
||||||
|
} else {
|
||||||
|
found = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
value = found ? temp : field;
|
||||||
|
} else {
|
||||||
|
value = mergedLang[field] !== undefined ? mergedLang[field] : field;
|
||||||
|
}
|
||||||
|
|
||||||
// 合并语言包
|
} catch (e) {
|
||||||
let mergedLang = { ...lang, ...currentPageLang };
|
console.error('解析语言包失败:', e, { langPath, field, locale });
|
||||||
|
value = field;
|
||||||
|
}
|
||||||
|
|
||||||
// 解析字段
|
if (arguments.length > 1) {
|
||||||
var arr = field.split(".");
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
if (arr.length > 1) {
|
value = value.replace("{" + (i - 1) + "}", arguments[i]);
|
||||||
// 处理嵌套属性,如 common.currencySymbol
|
}
|
||||||
let temp = mergedLang;
|
}
|
||||||
let found = true;
|
if (value == undefined || (value == 'title' && field == 'title')) value = '';
|
||||||
for (let key of arr) {
|
|
||||||
if (temp[key] !== undefined) {
|
|
||||||
temp = temp[key];
|
|
||||||
} else {
|
|
||||||
found = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
value = found ? temp : field;
|
|
||||||
} else {
|
|
||||||
value = mergedLang[field] !== undefined ? mergedLang[field] : field;
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (e) {
|
if (field == value) {
|
||||||
console.error('解析语言包失败:', e, { langPath, field, locale });
|
console.warn(`警告: 字段 ${field} 在语言包 ${langPath} 中未找到对应值,使用默认值 ${field} 当前语言: ${locale}`);
|
||||||
value = field;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (arguments.length > 1) {
|
return value;
|
||||||
//有参数,需要替换
|
},
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
/**
|
||||||
value = value.replace("{" + (i - 1) + "}", arguments[i]);
|
* 切换语言
|
||||||
}
|
*/
|
||||||
}
|
change(value, url = '/pages_tool/member/index') {
|
||||||
if (value == undefined || (value == 'title' && field == 'title')) value = ''; // field
|
let _this = getCurrentPages()[getCurrentPages().length - 1];
|
||||||
|
if (!_this) return;
|
||||||
|
|
||||||
// 多语言调试,注释后可以关闭控制台输出
|
uni.setStorageSync("lang", value);
|
||||||
if (field == value) {
|
const locale = uni.getStorageSync('lang') || "zh-cn";
|
||||||
console.warn(`警告: 字段 ${field} 在语言包 ${langPath} 中未找到对应值,使用默认值 ${field} 当前语言: ${locale}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
// ✅ 关键修复:清空所有语言包缓存(不再保留任何旧缓存)
|
||||||
},
|
for (let key in loadedLangPacks) {
|
||||||
/**
|
delete loadedLangPacks[key];
|
||||||
* * 切换语言
|
}
|
||||||
* @param {String} value 语言值
|
|
||||||
* @param {String} url 切换后跳转的页面url
|
|
||||||
*/
|
|
||||||
change(value, url = '/pages_tool/member/index') {
|
|
||||||
let _page = getCurrentPages()[getCurrentPages().length - 1];
|
|
||||||
if (!_page) return;
|
|
||||||
|
|
||||||
uni.setStorageSync("lang", value);
|
this.refresh();
|
||||||
const locale = this.getCurrentLocale();
|
|
||||||
|
|
||||||
// 清空已加载的语言包缓存
|
if (url) {
|
||||||
for (let key in loadedLangPacks) {
|
uni.reLaunch({ url: url });
|
||||||
if (!key.startsWith(locale)) {
|
}
|
||||||
delete loadedLangPacks[key];
|
},
|
||||||
}
|
//刷新标题、tabbar
|
||||||
}
|
refresh() {
|
||||||
|
let _this = getCurrentPages()[getCurrentPages().length - 1];
|
||||||
|
if (!_this) return;
|
||||||
|
const locale = uni.getStorageSync('lang') || "zh-cn";
|
||||||
|
|
||||||
this.refresh();
|
this.title(this.lang("title"));
|
||||||
|
},
|
||||||
if (url) {
|
title(str) {
|
||||||
uni.reLaunch({ url: url });
|
if (str) {
|
||||||
}
|
uni.setNavigationBarTitle({
|
||||||
},
|
title: str
|
||||||
//刷新标题、tabbar
|
});
|
||||||
refresh() {
|
}
|
||||||
let _page = getCurrentPages()[getCurrentPages().length - 1];
|
},
|
||||||
if (!_page) return;
|
// 获取语言包列表
|
||||||
|
list() {
|
||||||
const locale = this.getCurrentLocale();
|
var list = [];
|
||||||
|
try {
|
||||||
this.title(this.lang("title"));
|
for (var i = 0; i < langConfig.langList.length; i++) {
|
||||||
|
let langType = langConfig.langList[i];
|
||||||
//设置tabbar的文字语言
|
let item = loadLangPackSync(langType, 'common');
|
||||||
// uni.setTabBarItem({
|
list.push({
|
||||||
// index: 0,
|
name: item.common ? item.common.name : langType,
|
||||||
// text: this.lang("tabBar.home")
|
value: langType
|
||||||
// });
|
});
|
||||||
// uni.setTabBarItem({
|
}
|
||||||
// index: 1,
|
} catch (e) {
|
||||||
// text: this.lang("tabBar.category")
|
console.error('获取语言包列表失败:', e);
|
||||||
// });
|
}
|
||||||
// uni.setTabBarItem({
|
return list;
|
||||||
// index: 2,
|
}
|
||||||
// text: this.lang("tabBar.cart")
|
|
||||||
// });
|
|
||||||
// uni.setTabBarItem({
|
|
||||||
// index: 3,
|
|
||||||
// text: this.lang("tabBar.member")
|
|
||||||
// });
|
|
||||||
},
|
|
||||||
title(str) {
|
|
||||||
if (str) {
|
|
||||||
uni.setNavigationBarTitle({
|
|
||||||
title: str,
|
|
||||||
success: function (res) {
|
|
||||||
},
|
|
||||||
fail: function (err) {
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 获取语言包列表
|
|
||||||
list() {
|
|
||||||
var list = [];
|
|
||||||
try {
|
|
||||||
//公共语言包
|
|
||||||
for (var i = 0; i < langConfig.langList.length; i++) {
|
|
||||||
let langType = langConfig.langList[i];
|
|
||||||
let item = loadLangPackSync(langType, 'common');
|
|
||||||
list.push({
|
|
||||||
name: item.common ? item.common.name : langType,
|
|
||||||
value: langType
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('获取语言包列表失败:', e);
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -104,7 +104,7 @@
|
|||||||
},
|
},
|
||||||
"router" : {
|
"router" : {
|
||||||
"mode" : "history",
|
"mode" : "history",
|
||||||
"base" : "/hwappx/2811/"
|
"base" : "/hwappx/common/"
|
||||||
},
|
},
|
||||||
"title" : "",
|
"title" : "",
|
||||||
"devServer" : {
|
"devServer" : {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="ai-chat-page" :style="wrapperPageStyle">
|
<view class="container" :style="wrapperPageStyle">
|
||||||
<!--自定义导航头部 -->
|
<!--自定义导航头部 -->
|
||||||
<view class="custom-navbar" ref="pageHeader" v-if="showCustomNavbar">
|
<view class="custom-navbar" ref="pageHeader" v-if="showCustomNavbar">
|
||||||
<view class="header-left">
|
<view class="header-left">
|
||||||
@@ -51,12 +51,11 @@
|
|||||||
import { mapGetters, mapMutations } from 'vuex'
|
import { mapGetters, mapMutations } from 'vuex'
|
||||||
import navigationHelper from '@/common/js/navigation';
|
import navigationHelper from '@/common/js/navigation';
|
||||||
import { EventSafety } from '@/common/js/event-safety';
|
import { EventSafety } from '@/common/js/event-safety';
|
||||||
|
|
||||||
import aiChatMessage from './ai-chat-message.vue';
|
import aiChatMessage from './ai-chat-message.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
aiChatMessage,
|
aiChatMessage
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -86,11 +85,11 @@ export default {
|
|||||||
// --- 聊天内容区域 ---
|
// --- 聊天内容区域 ---
|
||||||
scrollViewHeight: '0px',
|
scrollViewHeight: '0px',
|
||||||
|
|
||||||
|
|
||||||
// 事件处理器引用(用于清理)
|
// 事件处理器引用(用于清理)
|
||||||
safeEventHandlers: new Map()
|
safeEventHandlers: new Map()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
'globalAIKefuConfig'
|
'globalAIKefuConfig'
|
||||||
@@ -109,7 +108,7 @@ export default {
|
|||||||
},
|
},
|
||||||
wrapperPageStyle() {
|
wrapperPageStyle() {
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
return `top: ${this.navBarHeight + 'px'};`
|
return `top: $ {this.navBarHeight + 'px'};`
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
@@ -121,35 +120,42 @@ export default {
|
|||||||
wrapperChatContentStyle() {
|
wrapperChatContentStyle() {
|
||||||
return {
|
return {
|
||||||
height: this.containerHeight,
|
height: this.containerHeight,
|
||||||
paddingTop: this.showCustomNavbar ? '0' : (this.navHeight + 'px')
|
paddingTop: this.showCustomNavbar ? '0' : (this.navBarHeight + 'px')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async onLoad(options) {
|
async onLoad(options) {
|
||||||
await this.initPage(options)
|
// ✅ 修改:取消权限校验,允许所有客服类型访问此页面
|
||||||
|
// const hasAccess = this.checkAccessPermission();
|
||||||
|
// if (!hasAccess) {
|
||||||
|
// // 如果校验失败,不继续初始化
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
this. $langConfig.title('AI智能客服');
|
||||||
|
this.initChat();
|
||||||
},
|
},
|
||||||
|
|
||||||
async onReady() {
|
async onReady() {
|
||||||
await this.initNavigation()
|
await this.initNavigation();
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
|
// 可在此补充逻辑(如刷新未读数)
|
||||||
},
|
},
|
||||||
|
|
||||||
onHide() {
|
onHide() {
|
||||||
|
// 页面隐藏时可暂停音频等
|
||||||
},
|
},
|
||||||
|
|
||||||
onUnload() {
|
onUnload() {
|
||||||
this.cleanup()
|
this.cleanup();
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
// ========== 安全事件处理 ==========
|
// ========== 安全事件处理 ==========
|
||||||
setupSafeEventListeners() {
|
setupSafeEventListeners() {
|
||||||
// 使用 EventSafety 包装事件处理器
|
|
||||||
const safeHandlers = {
|
const safeHandlers = {
|
||||||
serviceRequest: EventSafety.wrapEventHandler(
|
serviceRequest: EventSafety.wrapEventHandler(
|
||||||
this.handleServiceRequest.bind(this),
|
this.handleServiceRequest.bind(this),
|
||||||
@@ -165,124 +171,100 @@ export default {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 注册事件监听
|
this. $on('service.requestComponentInfo', safeHandlers.serviceRequest);
|
||||||
this.$on('service.requestComponentInfo', safeHandlers.serviceRequest)
|
this. $on('navigation.requestInfo', safeHandlers.navigationRequest);
|
||||||
this.$on('navigation.requestInfo', safeHandlers.navigationRequest)
|
this. $on('component.interaction', safeHandlers.componentInteraction);
|
||||||
this.$on('component.interaction', safeHandlers.componentInteraction)
|
|
||||||
|
|
||||||
// 保存处理器引用用于清理
|
this.safeEventHandlers.set('serviceRequest', safeHandlers.serviceRequest);
|
||||||
this.safeEventHandlers.set('serviceRequest', safeHandlers.serviceRequest)
|
this.safeEventHandlers.set('navigationRequest', safeHandlers.navigationRequest);
|
||||||
this.safeEventHandlers.set('navigationRequest', safeHandlers.navigationRequest)
|
this.safeEventHandlers.set('componentInteraction', safeHandlers.componentInteraction);
|
||||||
this.safeEventHandlers.set('componentInteraction', safeHandlers.componentInteraction)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setupNavigationEvents() {
|
setupNavigationEvents() {
|
||||||
// 监听窗口大小变化
|
|
||||||
uni.onWindowResize((res) => {
|
uni.onWindowResize((res) => {
|
||||||
console.log('窗口大小变化:', res.size)
|
console.log('窗口大小变化:', res.size);
|
||||||
this.calculateScrollViewHeight()
|
this.calculateScrollViewHeight();
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// ========== 事件处理方法 ==========
|
// ========== 事件处理方法 ==========
|
||||||
|
|
||||||
async handleServiceRequest(event) {
|
async handleServiceRequest(event) {
|
||||||
console.log('处理服务请求:', EventSafety.extractEventData(event))
|
console.log('处理服务请求:', EventSafety.extractEventData(event));
|
||||||
|
|
||||||
// 安全地检查事件目标
|
|
||||||
if (event.matches('.service-component') ||
|
if (event.matches('.service-component') ||
|
||||||
event.detail?.componentType === 'service') {
|
event.detail?.componentType === 'service') {
|
||||||
await this.processServiceRequest(event)
|
await this.processServiceRequest(event);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async handleNavigationRequest(event) {
|
async handleNavigationRequest(event) {
|
||||||
console.log('处理导航请求:', event.type)
|
console.log('处理导航请求:', event.type);
|
||||||
|
this.emitNavigationInfo(event);
|
||||||
// 提供导航信息
|
|
||||||
this.emitNavigationInfo(event)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
handleComponentInteraction(event) {
|
handleComponentInteraction(event) {
|
||||||
console.log('处理组件交互:', event.detail)
|
console.log('处理组件交互:', event.detail);
|
||||||
|
this.processComponentInteraction(event);
|
||||||
// 安全地处理组件交互
|
|
||||||
this.processComponentInteraction(event)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEventError(error, event) {
|
handleEventError(error, event) {
|
||||||
console.error('事件处理错误:', {
|
console.error('事件处理错误:', {
|
||||||
error: error.message,
|
error: error.message,
|
||||||
eventType: event?.type,
|
eventType: event?.type,
|
||||||
component: this.$options.name
|
component: this. $options.name
|
||||||
})
|
});
|
||||||
|
|
||||||
this.showError('操作失败,请重试')
|
this.showError('操作失败,请重试');
|
||||||
},
|
},
|
||||||
|
|
||||||
// ========== 初始化页面 ==========
|
// ========== 初始化页面 ==========
|
||||||
async initPage(options = {}) {
|
initChat() {
|
||||||
this.$langConfig.title('AI智能客服');
|
console.log('AI聊天页面初始化');
|
||||||
this.initChat()
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// 初始化导航栏相关配置
|
|
||||||
async initNavigation() {
|
async initNavigation() {
|
||||||
try {
|
try {
|
||||||
// 获取导航栏高度
|
this.navBarHeight = await navigationHelper.getNavigationHeight(this, {forceRefresh: false});
|
||||||
this.navBarHeight = await navigationHelper.getNavigationHeight(this, {forceRefresh: false})
|
this.statusBarHeight = navigationHelper.getStatusBarHeight();
|
||||||
|
this.calculateScrollViewHeight();
|
||||||
// 获取状态栏高度
|
this.setupNavigationEvents();
|
||||||
this.statusBarHeight = navigationHelper.getStatusBarHeight()
|
|
||||||
|
|
||||||
// 计算滚动视图高度
|
|
||||||
this.calculateScrollViewHeight()
|
|
||||||
|
|
||||||
// 注册导航相关事件
|
|
||||||
this.setupNavigationEvents()
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('初始化导航栏失败:', error)
|
console.error('初始化导航栏失败:', error);
|
||||||
this.setFallbackNavigationValues()
|
this.setFallbackNavigationValues();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 计算滚动视图高度
|
|
||||||
calculateScrollViewHeight() {
|
calculateScrollViewHeight() {
|
||||||
const safeArea = navigationHelper.getSafeAreaInsets()
|
const safeArea = navigationHelper.getSafeAreaInsets();
|
||||||
const bottomInset = safeArea.bottom || 0
|
const bottomInset = safeArea.bottom || 0;
|
||||||
const inputHeight = 120 // 输入区域高度
|
const inputHeight = 120;
|
||||||
|
this.scrollViewHeight = `calc(100vh - $ {this.navBarHeight + this.statusBarHeight + inputHeight + bottomInset}px)`;
|
||||||
this.scrollViewHeight = `calc(100vh - ${this.navBarHeight + this.statusBarHeight + inputHeight + bottomInset}px)`
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 备用高度设置
|
|
||||||
setFallbackNavigationValues() {
|
setFallbackNavigationValues() {
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
this.navBarHeight = 44
|
this.navBarHeight = 44;
|
||||||
this.statusBarHeight = 20
|
this.statusBarHeight = 20;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
this.navBarHeight = 44
|
this.navBarHeight = 44;
|
||||||
this.statusBarHeight = 0
|
this.statusBarHeight = 0;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
this.navBarHeight = 88
|
this.navBarHeight = 88;
|
||||||
this.statusBarHeight = 44
|
this.statusBarHeight = 44;
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
// 清理事件监听器
|
|
||||||
this.safeEventHandlers.forEach((handler, eventType) => {
|
this.safeEventHandlers.forEach((handler, eventType) => {
|
||||||
this.$off(eventType, handler)
|
this. $off(eventType, handler);
|
||||||
})
|
});
|
||||||
this.safeEventHandlers.clear()
|
this.safeEventHandlers.clear();
|
||||||
|
console.log('组件清理完成');
|
||||||
console.log('组件清理完成')
|
|
||||||
},
|
},
|
||||||
|
|
||||||
showError(message) {
|
showError(message) {
|
||||||
@@ -290,19 +272,12 @@ export default {
|
|||||||
title: message,
|
title: message,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
})
|
});
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
// 初始化聊天
|
|
||||||
initChat() {
|
|
||||||
// 可以在这里加载历史消息
|
|
||||||
console.log('AI聊天页面初始化')
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 返回上一页
|
// 返回上一页
|
||||||
goBack() {
|
goBack() {
|
||||||
uni.navigateBack()
|
uni.navigateBack();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 显示菜单
|
// 显示菜单
|
||||||
@@ -312,59 +287,54 @@ export default {
|
|||||||
success: (res) => {
|
success: (res) => {
|
||||||
switch (res.tapIndex) {
|
switch (res.tapIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
this.clearChat()
|
this.clearChat();
|
||||||
break
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this.exportChat()
|
this.exportChat();
|
||||||
break
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.showSettings()
|
this.showSettings();
|
||||||
break
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.showHelp()
|
this.showHelp();
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 清空聊天
|
|
||||||
clearChat() {
|
clearChat() {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '确定要清空聊天记录吗?',
|
content: '确定要清空聊天记录吗?',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
this.$refs.chat.clearMessages()
|
this. $refs.chat.clearMessages();
|
||||||
// 重新添加欢迎消息
|
this. $refs.chat.addMessage({
|
||||||
this.$refs.chat.addMessage({
|
|
||||||
id: Date.now(),
|
id: Date.now(),
|
||||||
role: 'ai',
|
role: 'ai',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
content: '聊天记录已清空,有什么可以帮助您的吗?',
|
content: '聊天记录已清空,有什么可以帮助您的吗?',
|
||||||
timestamp: Date.now()
|
timestamp: Date.now()
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 导出聊天记录
|
|
||||||
exportChat() {
|
exportChat() {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '功能开发中',
|
title: '功能开发中',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 显示设置
|
|
||||||
showSettings() {
|
showSettings() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/settings/index'
|
url: '/pages/settings/index'
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 显示帮助
|
|
||||||
showHelp() {
|
showHelp() {
|
||||||
const helpMessage = {
|
const helpMessage = {
|
||||||
id: Date.now(),
|
id: Date.now(),
|
||||||
@@ -391,27 +361,18 @@ export default {
|
|||||||
- **复制**: 长按消息可复制内容
|
- **复制**: 长按消息可复制内容
|
||||||
- **转发**: 支持消息转发功能`,
|
- **转发**: 支持消息转发功能`,
|
||||||
timestamp: Date.now()
|
timestamp: Date.now()
|
||||||
}
|
};
|
||||||
this.$refs.chat.addMessage(helpMessage)
|
this. $refs.chat.addMessage(helpMessage);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 用户发送消息
|
|
||||||
onMessageSent(message) {
|
onMessageSent(message) {
|
||||||
console.log('用户发送消息:', message)
|
console.log('用户发送消息:', message);
|
||||||
|
|
||||||
// 使用AI服务获取回复
|
|
||||||
// AI聊天组件内部已经集成了AI服务,这里只需要监听事件
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// AI回复消息
|
|
||||||
onAIResponse(message) {
|
onAIResponse(message) {
|
||||||
console.log('AI回复消息:', message)
|
console.log('AI回复消息:', message);
|
||||||
|
|
||||||
// 可以在这里处理AI回复后的逻辑
|
|
||||||
// 比如记录对话、更新状态等
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 生成AI回复
|
|
||||||
generateAIResponse(userMessage) {
|
generateAIResponse(userMessage) {
|
||||||
const responses = [
|
const responses = [
|
||||||
'我理解您的需求,让我为您详细解答。',
|
'我理解您的需求,让我为您详细解答。',
|
||||||
@@ -419,133 +380,142 @@ export default {
|
|||||||
'根据您的问题,我建议您可以考虑以下几个方面:',
|
'根据您的问题,我建议您可以考虑以下几个方面:',
|
||||||
'这个问题很常见,让我为您提供一些解决方案。',
|
'这个问题很常见,让我为您提供一些解决方案。',
|
||||||
'我明白您的困惑,让我帮您分析一下。'
|
'我明白您的困惑,让我帮您分析一下。'
|
||||||
]
|
];
|
||||||
|
|
||||||
const randomResponse = responses[Math.floor(Math.random() * responses.length)]
|
const randomResponse = responses[Math.floor(Math.random() * responses.length)];
|
||||||
|
|
||||||
const aiMessage = {
|
const aiMessage = {
|
||||||
id: Date.now(),
|
id: Date.now(),
|
||||||
role: 'ai',
|
role: 'ai',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
content: `${randomResponse}\n\n您的问题"${userMessage.content}"我已经收到,正在为您处理中...`,
|
content: ` $ {randomResponse}\n\n您的问题" $ {userMessage.content}"我已经收到,正在为您处理中...`,
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
actions: [
|
actions: [
|
||||||
{ type: 'like', count: 0 },
|
{ type: 'like', count: 0 },
|
||||||
{ type: 'dislike', count: 0 }
|
{ type: 'dislike', count: 0 }
|
||||||
]
|
]
|
||||||
}
|
};
|
||||||
|
|
||||||
this.$refs.chat.addMessage(aiMessage)
|
this. $refs.chat.addMessage(aiMessage);
|
||||||
this.$emit('ai-response', aiMessage)
|
this. $emit('ai-response', aiMessage);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 操作按钮点击
|
|
||||||
onActionClick({ action, message }) {
|
onActionClick({ action, message }) {
|
||||||
console.log('操作点击:', action, message)
|
|
||||||
|
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case 'like':
|
case 'like':
|
||||||
uni.showToast({
|
uni.showToast({ title: '感谢您的反馈!', icon: 'success' });
|
||||||
title: '感谢您的反馈!',
|
break;
|
||||||
icon: 'success'
|
|
||||||
})
|
|
||||||
break
|
|
||||||
case 'dislike':
|
case 'dislike':
|
||||||
uni.showToast({
|
uni.showToast({ title: '我们会改进服务', icon: 'none' });
|
||||||
title: '我们会改进服务',
|
break;
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 历史消息加载完成
|
|
||||||
onHistoryLoaded(messages) {
|
onHistoryLoaded(messages) {
|
||||||
console.log('历史消息加载完成:', messages.length)
|
console.log('历史消息加载完成:', messages.length);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 文件预览
|
|
||||||
onFilePreview(message) {
|
onFilePreview(message) {
|
||||||
console.log('文件预览:', message)
|
uni.showToast({ title: '打开文件: ' + message.fileName, icon: 'none' });
|
||||||
uni.showToast({
|
|
||||||
title: '打开文件: ' + message.fileName,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 音频播放
|
|
||||||
onAudioPlay(message) {
|
onAudioPlay(message) {
|
||||||
console.log('音频播放:', message)
|
console.log('音频播放:', message);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 音频暂停
|
|
||||||
onAudioPause(message) {
|
onAudioPause(message) {
|
||||||
console.log('音频暂停:', message)
|
console.log('音频暂停:', message);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 视频播放
|
|
||||||
onVideoPlay(message) {
|
onVideoPlay(message) {
|
||||||
console.log('视频播放:', message)
|
console.log('视频播放:', message);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 视频暂停
|
|
||||||
onVideoPause(message) {
|
onVideoPause(message) {
|
||||||
console.log('视频暂停:', message)
|
console.log('视频暂停:', message);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 链接打开
|
|
||||||
onLinkOpen(message) {
|
onLinkOpen(message) {
|
||||||
console.log('链接打开:', message)
|
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '打开链接',
|
title: '打开链接',
|
||||||
content: `确定要打开链接:${message.url} 吗?`,
|
content: `确定要打开链接: $ {message.url} 吗?`,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
window.open(message.url, '_blank')
|
window.open(message.url, '_blank');
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
plus.runtime.openURL(message.url)
|
plus.runtime.openURL(message.url);
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 商品查看
|
|
||||||
onProductView(message) {
|
onProductView(message) {
|
||||||
console.log('商品查看:', message)
|
uni.showToast({ title: '查看商品: ' + message.title, icon: 'none' });
|
||||||
uni.showToast({
|
|
||||||
title: '查看商品: ' + message.title,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 输入内容变化
|
|
||||||
onInputChange(value) {
|
onInputChange(value) {
|
||||||
console.log('输入内容:', value)
|
console.log('输入内容:', value);
|
||||||
|
},
|
||||||
|
|
||||||
|
// ✅ 新增:权限校验(核心修复)
|
||||||
|
checkAccessPermission() {
|
||||||
|
const servicerConfig = this. $store.state.servicerConfig;
|
||||||
|
|
||||||
|
// 如果配置未加载,延迟重试(最多3次,防白屏)
|
||||||
|
if (!servicerConfig) {
|
||||||
|
console.warn('【AI客服】servicerConfig 未加载,200ms后重试...');
|
||||||
|
setTimeout(() => {
|
||||||
|
this.checkAccessPermission();
|
||||||
|
}, 200);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let currentType = 'none';
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
currentType = servicerConfig?.weapp?.type || 'none';
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
currentType = servicerConfig?.h5?.type || 'none';
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
if (currentType !== 'aikefu') {
|
||||||
|
uni.showToast({ title: '当前客服类型不支持此页面', icon: 'none' });
|
||||||
|
setTimeout(() => {
|
||||||
|
const pages = getCurrentPages();
|
||||||
|
if (pages.length > 1) {
|
||||||
|
uni.navigateBack();
|
||||||
|
} else {
|
||||||
|
// 回到首页(假设首页是 tab 页)
|
||||||
|
uni.switchTab({ url: '/pages/index/index' });
|
||||||
|
}
|
||||||
|
}, 1500);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
||||||
/* 引入图标字体 */
|
/* 引入图标字体 */
|
||||||
@import url('@/common/css/iconfont.css');
|
@import url('/common/css/iconfont.css');
|
||||||
|
|
||||||
/* 页面样式 */
|
/* 页面样式 */
|
||||||
.ai-chat-page {
|
.container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background-color: #f8f8f8;
|
background-color: white; /* 白色 */
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 自定义导航头部 */
|
/* 自定义导航头部 */
|
||||||
.custom-navbar {
|
.custom-navbar {
|
||||||
@@ -553,7 +523,7 @@ export default {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 20rpx 30rpx;
|
padding: 20rpx 30rpx;
|
||||||
background-color: white;
|
background-color: #c4e0ff; /* 浅蓝色 */
|
||||||
border-bottom: 2rpx solid #eeeeee;
|
border-bottom: 2rpx solid #eeeeee;
|
||||||
|
|
||||||
.header-left {
|
.header-left {
|
||||||
@@ -565,7 +535,7 @@ export default {
|
|||||||
width: 60rpx;
|
width: 60rpx;
|
||||||
height: 60rpx;
|
height: 60rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: #f8f8f8;
|
background-color: #ffffff; /* 白色按钮 */
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -610,7 +580,7 @@ export default {
|
|||||||
width: 60rpx;
|
width: 60rpx;
|
||||||
height: 60rpx;
|
height: 60rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: #f8f8f8;
|
background-color: #ffffff; /* 白色按钮 */
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -634,18 +604,11 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 底部tabBar占位样式 */
|
/* 底部tabBar占位样式 */
|
||||||
.page-bottom {
|
.page-bottom {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
"setting": {
|
"setting": {
|
||||||
"urlCheck": true,
|
"urlCheck": true,
|
||||||
"es6": true,
|
"es6": true,
|
||||||
"enhance": true,
|
"enhance": false,
|
||||||
"postcss": true,
|
"postcss": true,
|
||||||
"preloadBackgroundData": false,
|
"preloadBackgroundData": false,
|
||||||
"minified": true,
|
"minified": true,
|
||||||
@@ -39,27 +39,19 @@
|
|||||||
"packNpmManually": false,
|
"packNpmManually": false,
|
||||||
"packNpmRelationList": [],
|
"packNpmRelationList": [],
|
||||||
"minifyWXSS": true,
|
"minifyWXSS": true,
|
||||||
"condition": true,
|
"compileWorklet": false,
|
||||||
"swc": false,
|
|
||||||
"disableSWC": true,
|
|
||||||
"minifyWXML": true,
|
"minifyWXML": true,
|
||||||
"compileWorklet": true,
|
|
||||||
"localPlugins": false,
|
"localPlugins": false,
|
||||||
"disableUseStrict": false,
|
"disableUseStrict": false,
|
||||||
"useCompilerPlugins": false
|
"useCompilerPlugins": false,
|
||||||
|
"condition": false,
|
||||||
|
"swc": false,
|
||||||
|
"disableSWC": true
|
||||||
},
|
},
|
||||||
"compileType": "miniprogram",
|
"compileType": "miniprogram",
|
||||||
"libVersion": "2.16.1",
|
"libVersion": "3.12.0",
|
||||||
"appid": "wx29215aa1bd97bbd6",
|
"appid": "wx29215aa1bd97bbd6",
|
||||||
"projectname": "uniapp",
|
"projectname": "uniapp",
|
||||||
"debugOptions": {
|
|
||||||
"hidedInDevtools": []
|
|
||||||
},
|
|
||||||
"scripts": {},
|
|
||||||
"staticServerOptions": {
|
|
||||||
"baseURL": "",
|
|
||||||
"servePath": ""
|
|
||||||
},
|
|
||||||
"isGameTourist": false,
|
"isGameTourist": false,
|
||||||
"condition": {
|
"condition": {
|
||||||
"search": {
|
"search": {
|
||||||
@@ -80,5 +72,7 @@
|
|||||||
"miniprogram": {
|
"miniprogram": {
|
||||||
"list": []
|
"list": []
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"simulatorPluginLibVersion": {},
|
||||||
|
"editorSetting": {}
|
||||||
}
|
}
|
||||||
4
site.js
4
site.js
@@ -1,4 +1,4 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
baseUrl: "https://xcx6.aigc-quickapp.com/",//修改域名
|
baseUrl: "https://dev.aigc-quickapp.com/",//修改域名
|
||||||
uniacid: 2811,//后台对应uniacid
|
uniacid: 1,//后台对应uniacid
|
||||||
};
|
};
|
||||||
@@ -65,6 +65,7 @@ const store = new Vuex.Store({
|
|||||||
bottomNavHidden: false, // 底部导航是否隐藏,true:隐藏,false:显示
|
bottomNavHidden: false, // 底部导航是否隐藏,true:隐藏,false:显示
|
||||||
aiUnreadCount: 10, // AI未读消息数量
|
aiUnreadCount: 10, // AI未读消息数量
|
||||||
globalAIKefuConfig: null, // AI客服配置
|
globalAIKefuConfig: null, // AI客服配置
|
||||||
|
customerServiceType: 'ai',
|
||||||
globalStoreConfig: null, // 门店配置
|
globalStoreConfig: null, // 门店配置
|
||||||
globalStoreInfo: null, // 门店信息
|
globalStoreInfo: null, // 门店信息
|
||||||
defaultStoreInfo: null, // 默认门店
|
defaultStoreInfo: null, // 默认门店
|
||||||
@@ -159,6 +160,9 @@ const store = new Vuex.Store({
|
|||||||
state.globalAIKefuConfig = value;
|
state.globalAIKefuConfig = value;
|
||||||
uni.setStorageSync('globalAIKefuConfig', value); // 初始化数据调用
|
uni.setStorageSync('globalAIKefuConfig', value); // 初始化数据调用
|
||||||
},
|
},
|
||||||
|
setCustomerServiceType(state, type) {
|
||||||
|
state.customerServiceType = type;
|
||||||
|
},
|
||||||
setGlobalStoreConfig(state, value) {
|
setGlobalStoreConfig(state, value) {
|
||||||
state.globalStoreConfig = value;
|
state.globalStoreConfig = value;
|
||||||
uni.setStorageSync('globalStoreConfig', value); // 初始化数据调用
|
uni.setStorageSync('globalStoreConfig', value); // 初始化数据调用
|
||||||
@@ -412,7 +416,7 @@ const store = new Vuex.Store({
|
|||||||
},
|
},
|
||||||
// 生成主题颜色CSS变量
|
// 生成主题颜色CSS变量
|
||||||
themeColorSet() {
|
themeColorSet() {
|
||||||
// console.log('样式颜色设置...');
|
console.log('样式颜色设置...');
|
||||||
let theme = this.state.themeStyle;
|
let theme = this.state.themeStyle;
|
||||||
if (!theme?.main_color || !theme?.aux_color) return;
|
if (!theme?.main_color || !theme?.aux_color) return;
|
||||||
try {
|
try {
|
||||||
@@ -436,7 +440,7 @@ const store = new Vuex.Store({
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('设置主题颜色失败', e);
|
console.error('设置主题颜色失败', e);
|
||||||
}
|
}
|
||||||
// console.log('themeColor => ', this.state.themeColor);
|
console.log('themeColor => ', this.state.themeColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user