Compare commits
45 Commits
e301ddc6ec
...
test/test-
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e480d35df | |||
| bc6d243362 | |||
| a285706112 | |||
| 9c04c031ab | |||
| 0ce929f8a1 | |||
| 61ab9f11bd | |||
| 2747cb49ae | |||
| 9c8ebf8d74 | |||
| e19fef785f | |||
| 92ae114c5c | |||
| b25c366a5b | |||
| 4ad93ceace | |||
| 294856d9ef | |||
| ba2c7d6d64 | |||
| ec9e76fda7 | |||
| 5dba8071e4 | |||
| 19a53ef414 | |||
| e943b11c8f | |||
| e9db54980e | |||
| 3ddcc665b8 | |||
| a981c02baf | |||
| 1c3f759b35 | |||
| bb58866192 | |||
| 069b3c2c07 | |||
| c6fd13956a | |||
| a489e24988 | |||
| 6897fc631b | |||
| 6d23a64aef | |||
| f34533b0c7 | |||
| 72c74f44f0 | |||
| 7f3d9c0f10 | |||
| 37f95e7267 | |||
| d3c630e860 | |||
| c5b57cedeb | |||
| bf24746a7c | |||
| 5ff2925ba1 | |||
| 3dc81e7f53 | |||
| 0417c5c5ed | |||
| b23c21d05b | |||
| 65a24f25bb | |||
| db26a85c8b | |||
| 54c39259a7 | |||
| 15361211b1 | |||
| 2a0935b581 | |||
| b31197a8b4 |
@@ -41,7 +41,13 @@ const localDevConfig = ({
|
|||||||
'local-2': { // 测试平台
|
'local-2': { // 测试平台
|
||||||
uniacid: 2,
|
uniacid: 2,
|
||||||
domain: 'http://localhost:8050/',
|
domain: 'http://localhost:8050/',
|
||||||
},
|
'47': { // 修改弹窗
|
||||||
})['1']; // 选择要使用的环境配置
|
uniacid: 47,
|
||||||
|
domain: 'https://5g.aigc-quickapp.com/',
|
||||||
|
},
|
||||||
|
'2075': { //
|
||||||
|
uniacid: 2075,
|
||||||
|
domain: 'https://xcx.aigc-quickapp.com/',
|
||||||
|
},
|
||||||
|
})['47']; // 选择要使用的环境配置
|
||||||
export default localDevConfig;
|
export default localDevConfig;
|
||||||
@@ -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} 验证结果
|
||||||
@@ -453,6 +462,235 @@ export class CustomerService {
|
|||||||
|
|
||||||
return { ...config, openType };
|
return { ...config, openType };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取客服按钮图标
|
||||||
|
* @returns {String} 图标URL
|
||||||
|
*/
|
||||||
|
getKefuButtonIcon() {
|
||||||
|
const shopInfo = this.vm.shopInfo || {};
|
||||||
|
const config = this.getPlatformConfig();
|
||||||
|
|
||||||
|
if (config?.type === 'aikefu') {
|
||||||
|
return shopInfo.aiAgentimg || '';
|
||||||
|
} else if (config?.type === 'wxwork' || config?.type === 'qyweixin') {
|
||||||
|
return shopInfo.aiAgentimg || '';
|
||||||
|
} else if (config?.type === 'third') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return shopInfo.kefuimg || this.vm.$util?.getDefaultImage()?.kefu || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否为微信官方客服
|
||||||
|
* @returns {Boolean}
|
||||||
|
*/
|
||||||
|
isWeappOfficialKefu() {
|
||||||
|
const config = this.getPlatformConfig();
|
||||||
|
return config?.type === 'weapp';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否为智能客服
|
||||||
|
* @returns {Boolean}
|
||||||
|
*/
|
||||||
|
isAIKefu() {
|
||||||
|
const config = this.getPlatformConfig();
|
||||||
|
return config?.type === 'aikefu';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否为企业微信客服
|
||||||
|
* @returns {Boolean}
|
||||||
|
*/
|
||||||
|
isWxworkKefu() {
|
||||||
|
const config = this.getPlatformConfig();
|
||||||
|
return config?.type === 'wxwork' || config?.type === 'qyweixin';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否为第三方客服
|
||||||
|
* @returns {Boolean}
|
||||||
|
*/
|
||||||
|
isThirdKefu() {
|
||||||
|
const config = this.getPlatformConfig();
|
||||||
|
return config?.type === 'third';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否需要同时显示小程序系统客服
|
||||||
|
* @returns {Boolean}
|
||||||
|
*/
|
||||||
|
shouldShowExtraWeappSystemKefu() {
|
||||||
|
const config = this.getPlatformConfig();
|
||||||
|
return (config?.show_system_service === true || config?.show_system_service === '1') && config?.type !== 'weapp';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算容器高度
|
||||||
|
* @param {Boolean} isLanguageSwitchEnabled 是否启用语言切换
|
||||||
|
* @param {Boolean} showWeappSystemKefu 是否显示小程序系统客服
|
||||||
|
* @param {Boolean} fixBtnShow 是否显示按钮
|
||||||
|
* @returns {String} 高度值(px)
|
||||||
|
*/
|
||||||
|
getContainerHeight(isLanguageSwitchEnabled, showWeappSystemKefu, fixBtnShow) {
|
||||||
|
if (!fixBtnShow) return '160px';
|
||||||
|
|
||||||
|
let buttonCount = 1;
|
||||||
|
if (isLanguageSwitchEnabled) buttonCount++;
|
||||||
|
if (showWeappSystemKefu) buttonCount++;
|
||||||
|
|
||||||
|
const totalRpx = 94 * buttonCount - 14;
|
||||||
|
const pxValue = Math.round(totalRpx * 0.5);
|
||||||
|
|
||||||
|
return `${pxValue}px`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取未读消息数量
|
||||||
|
* @returns {Number}
|
||||||
|
*/
|
||||||
|
getUnreadCount() {
|
||||||
|
return this.vm.$store?.state?.aiUnreadCount || 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拨打电话联系客服
|
||||||
|
* @param {String} phoneNumber 电话号码
|
||||||
|
*/
|
||||||
|
makePhoneCallByNumber(phoneNumber) {
|
||||||
|
if (phoneNumber) {
|
||||||
|
uni.makePhoneCall({ phoneNumber });
|
||||||
|
} else {
|
||||||
|
this.makePhoneCall();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开 AI 智能助手
|
||||||
|
*/
|
||||||
|
openAIChat() {
|
||||||
|
try {
|
||||||
|
if (typeof this.vm.setAiUnreadCount === 'function') {
|
||||||
|
this.vm.setAiUnreadCount(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const aiChatUrl = '/pages_tool/ai-chat/index';
|
||||||
|
|
||||||
|
uni.navigateTo({
|
||||||
|
url: aiChatUrl,
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('跳转 AI 客服失败:', err);
|
||||||
|
// #ifdef H5
|
||||||
|
window.location.href = aiChatUrl;
|
||||||
|
// #endif
|
||||||
|
uni.showToast({ title: '打开客服失败', icon: 'none' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.error('跳转 AI 客服异常:', e);
|
||||||
|
uni.showToast({ title: '打开客服失败', icon: 'none' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开客服选择对话框(预留方法)
|
||||||
|
*/
|
||||||
|
openCustomerSelectPopupDialog() {
|
||||||
|
uni.showToast({ title: '客服选择功能开发中', icon: 'none' });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开客服选择弹出层(ActionSheet)
|
||||||
|
* @param {Array} kefuList 客服列表
|
||||||
|
*/
|
||||||
|
openKefuSelectPopup(kefuList) {
|
||||||
|
const kefuNames = kefuList.map(item => item.name);
|
||||||
|
uni.showActionSheet({
|
||||||
|
itemList: kefuNames,
|
||||||
|
success: (res) => {
|
||||||
|
const selectedKefu = kefuList[res.tapIndex];
|
||||||
|
const cs = createCustomerService(this.vm, selectedKefu);
|
||||||
|
|
||||||
|
if (selectedKefu.isOfficial) {
|
||||||
|
uni.openCustomerServiceConversation({
|
||||||
|
sessionFrom: 'weapp',
|
||||||
|
showMessageCard: true
|
||||||
|
});
|
||||||
|
} else if (selectedKefu.id === 'qyweixin-kefu') {
|
||||||
|
if (uni.getSystemInfoSync().platform === 'wechat') {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages_tool/qyweixin-kefu/index'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const qyweixinUrl = this.vm.shopInfo?.qyweixinUrl;
|
||||||
|
if (qyweixinUrl) {
|
||||||
|
window.location.href = qyweixinUrl;
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: '企业微信客服未配置', icon: 'none' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cs.handleCustomerClick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 核心方法:统一客服入口(带验证和配置检查)
|
||||||
|
* @param {Object} options 选项参数
|
||||||
|
*/
|
||||||
|
handleUnifiedKefuClick(options = {}) {
|
||||||
|
const validation = this.validateConfig();
|
||||||
|
|
||||||
|
console.log('【客服配置验证】', validation);
|
||||||
|
|
||||||
|
if (!validation.isValid) {
|
||||||
|
console.error('客服配置无效:', validation.errors);
|
||||||
|
uni.showToast({ title: '客服暂不可用', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (validation.warnings.length > 0) {
|
||||||
|
console.warn('客服配置警告:', validation.warnings);
|
||||||
|
}
|
||||||
|
|
||||||
|
const platformConfig = this.getPlatformConfig();
|
||||||
|
console.log('【当前客服配置】', platformConfig);
|
||||||
|
|
||||||
|
// 检查企业微信配置
|
||||||
|
if (platformConfig.type === 'wxwork') {
|
||||||
|
const wxworkConfig = this.getWxworkConfig();
|
||||||
|
console.log('【企业微信配置】', wxworkConfig);
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
if (!wxworkConfig?.enable || !wxworkConfig?.contact_url) {
|
||||||
|
console.warn('企业微信配置不完整,使用原生客服');
|
||||||
|
uni.showToast({ title: '企业微信配置不完整', icon: 'none' });
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
if (!wxworkConfig?.contact_url && !platformConfig.wxwork_url) {
|
||||||
|
console.error('企业微信链接未配置');
|
||||||
|
uni.showToast({ title: '企业微信链接未配置', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// 直接调用统一处理方法,由 CustomerService 内部根据配置路由
|
||||||
|
try {
|
||||||
|
this.handleCustomerClick({
|
||||||
|
sendMessageTitle: options.sendMessageTitle || '来自悬浮按钮的咨询',
|
||||||
|
sendMessagePath: options.sendMessagePath || '/pages/index/index'
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('客服处理失败:', error);
|
||||||
|
uni.showToast({ title: '打开客服失败', icon: 'none' });
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
// 是否是英文环境
|
// 是否是英文环境
|
||||||
isEnEnv() {
|
isEnEnv() {
|
||||||
return uni.getStorageSync('lang') === 'en-us';
|
return this.$langConfig.getCurrentLocale() === 'en-us';
|
||||||
},
|
},
|
||||||
themeStyle() {
|
themeStyle() {
|
||||||
return this.$store.state.themeStyle;
|
return this.$store.state.themeStyle;
|
||||||
|
|||||||
@@ -1,161 +1,221 @@
|
|||||||
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') {
|
// 先处理特殊的分包路径
|
||||||
routeParts = [routeParts[1], ...routeParts.slice(2)];
|
if (routeParts[0] === 'pages_tool') {
|
||||||
} else if (routeParts[0] === 'pages_goods') {
|
// pages_tool 分包下的页面,直接使用子目录作为语言包路径
|
||||||
routeParts[0] = 'goods';
|
routeParts = [routeParts[1], ...routeParts.slice(2)];
|
||||||
} else if (routeParts[0] === 'pages_member') {
|
} else if (routeParts[0] === 'pages_goods') {
|
||||||
routeParts[0] = 'member';
|
// pages_goods 分包映射到 goods 目录
|
||||||
} else if (routeParts[0] === 'pages_order') {
|
routeParts[0] = 'goods';
|
||||||
routeParts[0] = 'order';
|
} else if (routeParts[0] === 'pages_member') {
|
||||||
} else if (routeParts[0] === 'pages_promotion') {
|
// pages_member 分包映射到 member 目录
|
||||||
const promotionModules = ['point', 'fenxiao', 'merch'];
|
routeParts[0] = 'member';
|
||||||
if (routeParts[1] && promotionModules.includes(routeParts[1])) {
|
} else if (routeParts[0] === 'pages_order') {
|
||||||
routeParts = [routeParts[1], ...routeParts.slice(2)];
|
// pages_order 分包映射到 order 目录
|
||||||
}
|
routeParts[0] = 'order';
|
||||||
}
|
} else if (routeParts[0] === 'pages_promotion') {
|
||||||
// ---- 处理页面目录映射 <end>----
|
// pages_promotion 分包特殊处理
|
||||||
|
const promotionModules = ['point', 'fenxiao', 'merch'];
|
||||||
if (routeParts[0] === 'pages') {
|
if (routeParts[1] && promotionModules.includes(routeParts[1])) {
|
||||||
routeParts = routeParts.slice(1);
|
routeParts = [routeParts[1], ...routeParts.slice(2)];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return routeParts.join("/");
|
// ---- 处理页面目录映射 <end>----
|
||||||
|
|
||||||
|
// 去掉pages目录,只保留子目录
|
||||||
|
if (routeParts[0] === 'pages') {
|
||||||
|
routeParts = routeParts.slice(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得当前本地语言
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
function getCurrentLocale() {
|
||||||
|
return uni.getStorageSync('lang') || "zh-cn";
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
|
|
||||||
let value = '';
|
/**
|
||||||
let langPath = '';
|
* * 解析多语言
|
||||||
|
* @param {Object} field
|
||||||
|
*/
|
||||||
|
lang(field) {
|
||||||
|
let _page = getCurrentPages()[getCurrentPages().length - 1];
|
||||||
|
if (!_page) return;
|
||||||
|
|
||||||
try {
|
const locale = getCurrentLocale(); // 获得当前本地语言
|
||||||
var lang = loadLangPackSync(locale, 'common');
|
|
||||||
|
|
||||||
let route = _this.route;
|
|
||||||
langPath = processRoutePath(route);
|
|
||||||
|
|
||||||
let currentPageLang = loadLangPackSync(locale, langPath);
|
|
||||||
|
|
||||||
let mergedLang = { ...lang, ...currentPageLang };
|
let value = ''; // 存放解析后的语言值
|
||||||
|
let langPath = ''; // 存放当前页面语言包路径
|
||||||
|
|
||||||
var arr = field.split(".");
|
try {
|
||||||
if (arr.length > 1) {
|
//公共语言包(同步加载)
|
||||||
let temp = mergedLang;
|
var lang = loadLangPackSync(locale, 'common');
|
||||||
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) {
|
|
||||||
console.error('解析语言包失败:', e, { langPath, field, locale });
|
|
||||||
value = field;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arguments.length > 1) {
|
//当前页面语言包(同步加载)
|
||||||
for (var i = 1; i < arguments.length; i++) {
|
let route = _page.route;
|
||||||
value = value.replace("{" + (i - 1) + "}", arguments[i]);
|
langPath = processRoutePath(route);
|
||||||
}
|
|
||||||
}
|
|
||||||
if (value == undefined || (value == 'title' && field == 'title')) value = '';
|
|
||||||
|
|
||||||
if (field == value) {
|
// 加载当前页面语言包
|
||||||
console.warn(`警告: 字段 ${field} 在语言包 ${langPath} 中未找到对应值,使用默认值 ${field} 当前语言: ${locale}`);
|
let currentPageLang = loadLangPackSync(locale, langPath);
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
// 合并语言包
|
||||||
},
|
let mergedLang = { ...lang, ...currentPageLang };
|
||||||
/**
|
|
||||||
* 切换语言
|
|
||||||
*/
|
|
||||||
change(value, url = '/pages_tool/member/index') {
|
|
||||||
let _this = getCurrentPages()[getCurrentPages().length - 1];
|
|
||||||
if (!_this) return;
|
|
||||||
|
|
||||||
uni.setStorageSync("lang", value);
|
// 解析字段
|
||||||
const locale = uni.getStorageSync('lang') || "zh-cn";
|
var arr = field.split(".");
|
||||||
|
if (arr.length > 1) {
|
||||||
|
// 处理嵌套属性,如 common.currencySymbol
|
||||||
|
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) {
|
||||||
for (let key in loadedLangPacks) {
|
console.error('解析语言包失败:', e, { langPath, field, locale });
|
||||||
delete loadedLangPacks[key];
|
value = field;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.refresh();
|
if (arguments.length > 1) {
|
||||||
|
//有参数,需要替换
|
||||||
|
for (var i = 1; i < arguments.length; i++) {
|
||||||
|
value = value.replace("{" + (i - 1) + "}", arguments[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (value == undefined || (value == 'title' && field == 'title')) value = ''; // field
|
||||||
|
|
||||||
if (url) {
|
// 多语言调试,注释后可以关闭控制台输出
|
||||||
uni.reLaunch({ url: url });
|
if (field == value) {
|
||||||
}
|
console.warn(`警告: 字段 ${field} 在语言包 ${langPath} 中未找到对应值,使用默认值 ${field} 当前语言: ${locale}`);
|
||||||
},
|
}
|
||||||
//刷新标题、tabbar
|
|
||||||
refresh() {
|
return value;
|
||||||
let _this = getCurrentPages()[getCurrentPages().length - 1];
|
},
|
||||||
if (!_this) return;
|
/**
|
||||||
const locale = uni.getStorageSync('lang') || "zh-cn";
|
* * 切换语言
|
||||||
|
* @param {String} value 语言值
|
||||||
this.title(this.lang("title"));
|
* @param {String} url 切换后跳转的页面url
|
||||||
},
|
*/
|
||||||
title(str) {
|
change(value, url = '/pages_tool/member/index') {
|
||||||
if (str) {
|
let _page = getCurrentPages()[getCurrentPages().length - 1];
|
||||||
uni.setNavigationBarTitle({
|
if (!_page) return;
|
||||||
title: str
|
|
||||||
});
|
uni.setStorageSync("lang", value);
|
||||||
}
|
const locale = getCurrentLocale();
|
||||||
},
|
|
||||||
// 获取语言包列表
|
// 清空已加载的语言包缓存
|
||||||
list() {
|
for (let key in loadedLangPacks) {
|
||||||
var list = [];
|
if (!key.startsWith(locale)) {
|
||||||
try {
|
delete loadedLangPacks[key];
|
||||||
for (var i = 0; i < langConfig.langList.length; i++) {
|
}
|
||||||
let langType = langConfig.langList[i];
|
}
|
||||||
let item = loadLangPackSync(langType, 'common');
|
|
||||||
list.push({
|
this.refresh();
|
||||||
name: item.common ? item.common.name : langType,
|
|
||||||
value: langType
|
if (url) {
|
||||||
});
|
uni.reLaunch({ url: url });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
},
|
||||||
console.error('获取语言包列表失败:', e);
|
//刷新标题、tabbar
|
||||||
}
|
refresh() {
|
||||||
return list;
|
let _page = getCurrentPages()[getCurrentPages().length - 1];
|
||||||
}
|
if (!_page) return;
|
||||||
}
|
|
||||||
|
const locale = getCurrentLocale();
|
||||||
|
|
||||||
|
this.title(this.lang("title"));
|
||||||
|
|
||||||
|
//设置tabbar的文字语言
|
||||||
|
// uni.setTabBarItem({
|
||||||
|
// index: 0,
|
||||||
|
// text: this.lang("tabBar.home")
|
||||||
|
// });
|
||||||
|
// uni.setTabBarItem({
|
||||||
|
// index: 1,
|
||||||
|
// text: this.lang("tabBar.category")
|
||||||
|
// });
|
||||||
|
// uni.setTabBarItem({
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="video-info">
|
<view class="video-info">
|
||||||
<!-- 视频标题,支持多行显示控制 -->
|
<!-- 视频标题,支持多行显示控制 -->
|
||||||
<view class="video-title" :style="{ '--title-line-clamp': titleLineClamp }">{{ value.videoTitle }}
|
<view class="video-title" :style="[{ '--title-line-clamp': titleLineClamp }]">{{ value.videoTitle }}
|
||||||
</view>
|
</view>
|
||||||
<!-- 视频统计信息 -->
|
<!-- 视频统计信息 -->
|
||||||
<view class="video-stats" v-if="showViewCount && value.showViewCount">{{ value.viewCount }}次观看</view>
|
<view class="video-stats" v-if="showViewCount && value.showViewCount">{{ value.viewCount }}次观看</view>
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="video-info">
|
<view class="video-info">
|
||||||
<!-- 视频标题,支持多行显示控制 -->
|
<!-- 视频标题,支持多行显示控制 -->
|
||||||
<view class="video-title" :style="{ '--title-line-clamp': titleLineClamp }">{{ value.videoTitle }}
|
<view class="video-title" :style="[{ '--title-line-clamp': titleLineClamp }]">{{ value.videoTitle }}
|
||||||
</view>
|
</view>
|
||||||
<!-- 视频统计信息,非列表模式下显示 -->
|
<!-- 视频统计信息,非列表模式下显示 -->
|
||||||
<view class="video-stats" v-if="showViewCount && value.showViewCount && !listMode">{{ value.viewCount }}次观看</view>
|
<view class="video-stats" v-if="showViewCount && value.showViewCount && !listMode">{{ value.viewCount }}次观看</view>
|
||||||
|
|||||||
@@ -317,7 +317,12 @@ export default {
|
|||||||
this.diyGlobalData.value.forEach((item, index) => {
|
this.diyGlobalData.value.forEach((item, index) => {
|
||||||
item.pageStyle = '';
|
item.pageStyle = '';
|
||||||
// 给每个组件增加位置属性,用于定位,搜索、分类导航等定位
|
// 给每个组件增加位置属性,用于定位,搜索、分类导航等定位
|
||||||
item.moduleIndex = index + 1;
|
// 如果是Tab组件内部的子组件,添加tabIndex前缀避免moduleIndex冲突
|
||||||
|
if (this.diyData.tabIndex !== undefined) {
|
||||||
|
item.moduleIndex = `${this.diyData.tabIndex}-${index + 1}`;
|
||||||
|
} else {
|
||||||
|
item.moduleIndex = index + 1;
|
||||||
|
}
|
||||||
|
|
||||||
// 特殊处理搜索框 当显示位置为滚动至顶部固定时,只设置背景颜色
|
// 特殊处理搜索框 当显示位置为滚动至顶部固定时,只设置背景颜色
|
||||||
if (item.componentName == 'Search' && item.positionWay == 'fixed') {
|
if (item.componentName == 'Search' && item.positionWay == 'fixed') {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -156,11 +156,11 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
/deep/.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
::v-deep .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||||
background-color: #000;
|
background-color: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/.uni-popup__wrapper.uni-custom.center .uni-popup__wrapper-box {
|
::v-deep .uni-popup__wrapper.uni-custom.center .uni-popup__wrapper-box {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,41 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<view v-if="pageCount == 1 || need" class="fixed-box"
|
<view v-if="pageCount === 1 || need" class="fixed-box"
|
||||||
:style="[customContainerStyle, {
|
:style="[customContainerStyle, {
|
||||||
height: containerHeight,
|
height: containerHeight,
|
||||||
backgroundImage: bgUrl ? `url( $ {bgUrl})` : '',
|
backgroundImage: bgUrl ? `url(${bgUrl})` : '',
|
||||||
backgroundSize: 'cover'
|
backgroundSize: 'cover'
|
||||||
}]">
|
}]">
|
||||||
|
|
||||||
<!-- ✅ 统一客服入口(根据后台配置自动适配 AI / 企业微信 / 第三方等) -->
|
|
||||||
<!-- 微信官方客服需要使用 button open-type="contact" -->
|
|
||||||
<button
|
|
||||||
v-if="fixBtnShow && isWeappOfficialKefu"
|
|
||||||
class="btn-item common-bg"
|
|
||||||
open-type="contact"
|
|
||||||
:style="{ backgroundImage: currentKefuImg ? `url( $ {currentKefuImg})` : '', backgroundSize: '100% 100%' }"
|
|
||||||
>
|
|
||||||
<text class="ai-icon" v-if="!currentKefuImg">🤖</text>
|
|
||||||
</button>
|
|
||||||
<!-- 其他类型客服使用普通 view -->
|
|
||||||
<view
|
|
||||||
v-else-if="fixBtnShow"
|
|
||||||
class="btn-item common-bg"
|
|
||||||
@click="handleUnifiedKefuClick"
|
|
||||||
:style="{ backgroundImage: currentKefuImg ? `url( $ {currentKefuImg})` : '', backgroundSize: '100% 100%' }"
|
|
||||||
>
|
|
||||||
<text class="ai-icon" v-if="!currentKefuImg">🤖</text>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- ✅ 新增:小程序系统客服按钮(当附加设置开启时显示) -->
|
|
||||||
<button
|
|
||||||
v-if="fixBtnShow && showWeappSystemKefu"
|
|
||||||
class="btn-item common-bg"
|
|
||||||
open-type="contact"
|
|
||||||
:style="{ backgroundImage: currentKefuImg ? `url( $ {currentKefuImg})` : '', backgroundSize: '100% 100%' }"
|
|
||||||
>
|
|
||||||
<text class="ai-icon" v-if="!currentKefuImg">💬</text>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<!-- 中英文切换按钮 -->
|
<!-- 中英文切换按钮 -->
|
||||||
<view
|
<view
|
||||||
v-if="isLanguageSwitchEnabled && fixBtnShow"
|
v-if="isLanguageSwitchEnabled && fixBtnShow"
|
||||||
@@ -44,13 +13,58 @@
|
|||||||
>
|
>
|
||||||
<text>{{ currentLangDisplayName }}</text>
|
<text>{{ currentLangDisplayName }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 微信官方客服按钮-->
|
||||||
|
<button
|
||||||
|
v-if="fixBtnShow && hasValidKefuConfig && isWeappOfficialKefu"
|
||||||
|
class="btn-item common-bg"
|
||||||
|
open-type="contact"
|
||||||
|
:style="{ backgroundImage: currentKefuImg ? `url(${currentKefuImg})` : '', backgroundSize: '100% 100%' }"
|
||||||
|
>
|
||||||
|
<text class="icox icox-kefu" v-if="!kefuimg"></text>
|
||||||
|
</button>
|
||||||
|
|
||||||
<!-- 电话按钮(始终显示) -->
|
<!-- 其他类型客服按钮(智能客服、企业微信等)-->
|
||||||
|
<view
|
||||||
|
v-if="fixBtnShow && hasValidKefuConfig && !isWeappOfficialKefu && !showWeappSystemKefu"
|
||||||
|
class="btn-item common-bg"
|
||||||
|
@click="handleUnifiedKefuClick"
|
||||||
|
:style="{ backgroundImage: currentKefuImg ? `url(${currentKefuImg})` : '', backgroundSize: '100% 100%' }"
|
||||||
|
>
|
||||||
|
<text class="ai-icon" v-if="isAIKefu && !currentKefuImg">🤖</text>
|
||||||
|
<text class="ai-icon" v-if="isWxworkKefu && !currentKefuImg">💬</text>
|
||||||
|
<text class="ai-icon" v-if="!isAIKefu && !isWxworkKefu && !currentKefuImg">👤</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 智能客服按钮(当同时显示小程序系统客服时)-->
|
||||||
|
<view
|
||||||
|
v-if="fixBtnShow && hasValidKefuConfig && !isWeappOfficialKefu && showWeappSystemKefu"
|
||||||
|
class="btn-item common-bg"
|
||||||
|
@click="handleUnifiedKefuClick"
|
||||||
|
:style="{ backgroundImage: currentKefuImg ? `url(${currentKefuImg})` : '', backgroundSize: '100% 100%' }"
|
||||||
|
>
|
||||||
|
<text class="ai-icon" v-if="isAIKefu && !currentKefuImg">🤖</text>
|
||||||
|
<text class="ai-icon" v-if="isWxworkKefu && !currentKefuImg">💬</text>
|
||||||
|
<text class="ai-icon" v-if="!isAIKefu && !isWxworkKefu && !currentKefuImg">👤</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 小程序系统客服按钮 -->
|
||||||
|
<button
|
||||||
|
v-if="fixBtnShow && hasValidKefuConfig && showWeappSystemKefu"
|
||||||
|
class="btn-item common-bg"
|
||||||
|
open-type="contact"
|
||||||
|
:style="{ backgroundImage: currentKefuImg ? `url(${currentKefuImg})` : '', backgroundSize: '100% 100%' }"
|
||||||
|
>
|
||||||
|
<text class="icox icox-kefu" v-if="!kefuimg"></text>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 电话按钮 -->
|
||||||
<view
|
<view
|
||||||
v-if="fixBtnShow"
|
v-if="fixBtnShow"
|
||||||
class="btn-item common-bg"
|
class="btn-item common-bg"
|
||||||
@click="call()"
|
@click="call"
|
||||||
:style="[{ backgroundImage: phoneimg ? `url( $ {phoneimg})` : '', backgroundSize: '100% 100%' }, customButtonStyle]"
|
:style="[{ backgroundImage: phoneimg ? `url(${phoneimg})` : '', backgroundSize: '100% 100%' }, customButtonStyle]"
|
||||||
>
|
>
|
||||||
<text class="iconfont icon-dianhua" v-if="!phoneimg"></text>
|
<text class="iconfont icon-dianhua" v-if="!phoneimg"></text>
|
||||||
</view>
|
</view>
|
||||||
@@ -73,12 +87,7 @@ export default {
|
|||||||
shopInfo: null,
|
shopInfo: null,
|
||||||
currentLangIndex: 0,
|
currentLangIndex: 0,
|
||||||
langIndexMap: {},
|
langIndexMap: {},
|
||||||
kefuList: [
|
customerService: null,
|
||||||
{ id: 'weixin-official', name: '微信官方客服', isOfficial: true, type: 'weapp' },
|
|
||||||
{ id: 'custom-kefu', name: '自定义在线客服', isOfficial: false, type: 'custom' },
|
|
||||||
{ id: 'qyweixin-kefu', name: '企业微信客服', isOfficial: false, type: 'qyweixin' }
|
|
||||||
],
|
|
||||||
selectedKefu: null,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -89,10 +98,10 @@ export default {
|
|||||||
return this.shopInfo?.aiAgentimg || '';
|
return this.shopInfo?.aiAgentimg || '';
|
||||||
},
|
},
|
||||||
kefuimg() {
|
kefuimg() {
|
||||||
return this.shopInfo?.kefuimg || this. $util.getDefaultImage().kefu;
|
return this.shopInfo?.kefuimg || this.$util.getDefaultImage().kefu;
|
||||||
},
|
},
|
||||||
phoneimg() {
|
phoneimg() {
|
||||||
return this.shopInfo?.phoneimg || this. $util.getDefaultImage().phone;
|
return this.shopInfo?.phoneimg || this.$util.getDefaultImage().phone;
|
||||||
},
|
},
|
||||||
tel() {
|
tel() {
|
||||||
return this.shopInfo?.mobile || '';
|
return this.shopInfo?.mobile || '';
|
||||||
@@ -111,58 +120,54 @@ export default {
|
|||||||
return this.shopInfo?.floatingButton?.button || {};
|
return this.shopInfo?.floatingButton?.button || {};
|
||||||
},
|
},
|
||||||
unreadCount() {
|
unreadCount() {
|
||||||
return this. $store.state.aiUnreadCount || 0;
|
const customerService = createCustomerService(this);
|
||||||
|
return customerService.getUnreadCount();
|
||||||
},
|
},
|
||||||
|
|
||||||
// ✅ 新增:根据当前客服类型动态返回图标
|
|
||||||
currentKefuImg() {
|
currentKefuImg() {
|
||||||
if (!this.shopInfo) return '';
|
|
||||||
|
|
||||||
const customerService = createCustomerService(this);
|
const customerService = createCustomerService(this);
|
||||||
const config = customerService.getPlatformConfig();
|
return customerService.getKefuButtonIcon();
|
||||||
|
|
||||||
if (config?.type === 'aikefu') {
|
|
||||||
return this.aiAgentimg;
|
|
||||||
} else if (config?.type === 'wxwork' || config?.type === 'qyweixin') {
|
|
||||||
// 企业微信客服专用图标
|
|
||||||
return this.aiAgentimg;
|
|
||||||
}
|
|
||||||
// 默认客服图标
|
|
||||||
return this.kefuimg;
|
|
||||||
},
|
},
|
||||||
// ✅ 新增:判断是否为微信官方客服
|
|
||||||
isWeappOfficialKefu() {
|
isWeappOfficialKefu() {
|
||||||
if (!this.shopInfo) return false;
|
|
||||||
const customerService = createCustomerService(this);
|
const customerService = createCustomerService(this);
|
||||||
const config = customerService.getPlatformConfig();
|
return customerService.isWeappOfficialKefu();
|
||||||
return config?.type === 'weapp';
|
},
|
||||||
|
isAIKefu() {
|
||||||
|
const customerService = createCustomerService(this);
|
||||||
|
return customerService.isAIKefu();
|
||||||
|
},
|
||||||
|
isWxworkKefu() {
|
||||||
|
const customerService = createCustomerService(this);
|
||||||
|
return customerService.isWxworkKefu();
|
||||||
|
},
|
||||||
|
isThirdKefu() {
|
||||||
|
const customerService = createCustomerService(this);
|
||||||
|
return customerService.isThirdKefu();
|
||||||
},
|
},
|
||||||
// ✅ 新增:判断是否需要同时显示小程序系统客服
|
|
||||||
showWeappSystemKefu() {
|
showWeappSystemKefu() {
|
||||||
if (!this.shopInfo) return false;
|
|
||||||
const customerService = createCustomerService(this);
|
const customerService = createCustomerService(this);
|
||||||
const config = customerService.getPlatformConfig();
|
return customerService.shouldShowExtraWeappSystemKefu();
|
||||||
// 检查附加设置是否开启了同时显示小程序系统客服,且当前客服类型不是小程序系统客服
|
|
||||||
return (config?.show_system_service === true || config?.show_system_service === '1') && config?.type !== 'weapp';
|
|
||||||
},
|
},
|
||||||
//根据显示的按钮数量动态计算容器高度
|
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++;
|
||||||
|
if (this.showWeappSystemKefu) buttonCount++;
|
||||||
return ` $ {pxValue}px`;
|
buttonCount++;
|
||||||
}
|
const totalRpx = 94 * buttonCount - 14;
|
||||||
},
|
const pxValue = Math.round(totalRpx * 0.5);
|
||||||
|
|
||||||
|
return ` $ {pxValue}px`;
|
||||||
|
}
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
shopInfo: {
|
shopInfo: {
|
||||||
handler(newVal) {
|
handler(newVal) {
|
||||||
// 可在此添加额外逻辑(如埋点、通知等),当前无需操作
|
|
||||||
},
|
},
|
||||||
immediate: true
|
immediate: true
|
||||||
}
|
}
|
||||||
@@ -170,7 +175,6 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
this.initLanguage();
|
this.initLanguage();
|
||||||
this.pageCount = getCurrentPages().length;
|
this.pageCount = getCurrentPages().length;
|
||||||
|
|
||||||
uni.getStorage({
|
uni.getStorage({
|
||||||
key: 'shopInfo',
|
key: 'shopInfo',
|
||||||
success: (e) => {
|
success: (e) => {
|
||||||
@@ -181,15 +185,17 @@ export default {
|
|||||||
console.warn('未获取到 shopInfo,使用默认设置');
|
console.warn('未获取到 shopInfo,使用默认设置');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// 初始化 customerService 实例
|
||||||
|
this.customerService = createCustomerService(this);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initLanguage() {
|
initLanguage() {
|
||||||
this.langList = this. $langConfig.list();
|
this.langList = this.$langConfig.list();
|
||||||
this.langIndexMap = {};
|
this.langIndexMap = {};
|
||||||
for (let i = 0; i < this.langList.length; i++) {
|
for (let i = 0; i < this.langList.length; i++) {
|
||||||
this.langIndexMap[i] = this.langList[i].value;
|
this.langIndexMap[i] = this.langList[i].value;
|
||||||
}
|
}
|
||||||
const savedLang = uni.getStorageSync('lang');
|
const savedLang = this.$langConfig.getCurrentLocale();
|
||||||
if (savedLang) {
|
if (savedLang) {
|
||||||
for (let i = 0; i < this.langList.length; i++) {
|
for (let i = 0; i < this.langList.length; i++) {
|
||||||
if (this.langList[i].value === savedLang) {
|
if (this.langList[i].value === savedLang) {
|
||||||
@@ -201,118 +207,37 @@ export default {
|
|||||||
this.currentLangIndex = 0;
|
this.currentLangIndex = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
call() {
|
call() {
|
||||||
if (this.tel) {
|
this.customerService.makePhoneCallByNumber(this.tel);
|
||||||
uni.makePhoneCall({ phoneNumber: this.tel + '' });
|
|
||||||
} else {
|
|
||||||
uni.showToast({ title: '暂无联系电话', icon: 'none' });
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleLanguage() {
|
toggleLanguage() {
|
||||||
this.currentLangIndex = this.currentLangIndex === 0 ? 1 : 0;
|
this.currentLangIndex = this.currentLangIndex === 0 ? 1 : 0;
|
||||||
const targetLang = this.langIndexMap[this.currentLangIndex];
|
const targetLang = this.langIndexMap[this.currentLangIndex];
|
||||||
this. $langConfig.change(targetLang);
|
|
||||||
|
|
||||||
if (uni.getSystemInfoSync().platform === 'browser') {
|
uni.setStorageSync("lang", targetLang);
|
||||||
setTimeout(() => {
|
|
||||||
window.location.reload();
|
const pages = getCurrentPages();
|
||||||
}, 100);
|
const currentPage = pages[pages.length - 1];
|
||||||
}
|
const currentRoute = currentPage.route;
|
||||||
|
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/' + currentRoute
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
// ✅ 核心方法:统一客服入口
|
|
||||||
handleUnifiedKefuClick() {
|
handleUnifiedKefuClick() {
|
||||||
const customerService = createCustomerService(this);
|
this.customerService.handleUnifiedKefuClick({
|
||||||
const validation = customerService.validateConfig();
|
sendMessageTitle: '来自悬浮按钮的咨询',
|
||||||
|
sendMessagePath: '/pages/index/index'
|
||||||
console.log('【客服配置验证】', validation);
|
|
||||||
|
|
||||||
if (!validation.isValid) {
|
|
||||||
console.error('客服配置无效:', validation.errors);
|
|
||||||
uni.showToast({ title: '客服暂不可用', icon: 'none' });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (validation.warnings.length > 0) {
|
|
||||||
console.warn('客服配置警告:', validation.warnings);
|
|
||||||
}
|
|
||||||
|
|
||||||
const platformConfig = customerService.getPlatformConfig();
|
|
||||||
console.log('【当前客服配置】', platformConfig);
|
|
||||||
|
|
||||||
// 检查企业微信配置
|
|
||||||
if (platformConfig.type === 'wxwork') {
|
|
||||||
const wxworkConfig = customerService.getWxworkConfig();
|
|
||||||
console.log('【企业微信配置】', wxworkConfig);
|
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
|
||||||
if (!wxworkConfig?.enable || !wxworkConfig?.contact_url) {
|
|
||||||
console.warn('企业微信配置不完整,使用原生客服');
|
|
||||||
uni.showToast({ title: '企业微信配置不完整', icon: 'none' });
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// #ifdef H5
|
|
||||||
if (!wxworkConfig?.contact_url && !platformConfig.wxwork_url) {
|
|
||||||
console.error('企业微信链接未配置');
|
|
||||||
uni.showToast({ title: '企业微信链接未配置', icon: 'none' });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// 直接调用统一处理方法,由 CustomerService 内部根据配置路由
|
|
||||||
try {
|
|
||||||
customerService.handleCustomerClick({
|
|
||||||
sendMessageTitle: '来自悬浮按钮的咨询',
|
|
||||||
sendMessagePath: '/pages/index/index'
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
console.error('客服处理失败:', error);
|
|
||||||
uni.showToast({ title: '打开客服失败', icon: 'none' });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 以下方法保留用于 actionSheet(如仍需手动选择)
|
|
||||||
openKefuSelectPopup() {
|
|
||||||
const kefuNames = this.kefuList.map(item => item.name);
|
|
||||||
uni.showActionSheet({
|
|
||||||
itemList: kefuNames,
|
|
||||||
success: (res) => {
|
|
||||||
this.selectedKefu = this.kefuList[res.tapIndex];
|
|
||||||
const cs = createCustomerService(this, this.selectedKefu);
|
|
||||||
if (this.selectedKefu.isOfficial) {
|
|
||||||
uni.openCustomerServiceConversation({
|
|
||||||
sessionFrom: 'weapp',
|
|
||||||
showMessageCard: true
|
|
||||||
});
|
|
||||||
} else if (this.selectedKefu.id === 'qyweixin-kefu') {
|
|
||||||
// 处理企业微信客服
|
|
||||||
if (uni.getSystemInfoSync().platform === 'wechat') {
|
|
||||||
// 小程序端:跳转到企业微信客服
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages_tool/qyweixin-kefu/index'
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// H5端:跳转到企业微信链接
|
|
||||||
const qyweixinUrl = this.shopInfo.qyweixinUrl; // 后端返回的企业微信链接
|
|
||||||
if (qyweixinUrl) {
|
|
||||||
window.location.href = qyweixinUrl;
|
|
||||||
} else {
|
|
||||||
uni.showToast({ title: '企业微信客服未配置', icon: 'none' });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
cs.handleCustomerClick();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
.fixed-box {
|
.fixed-box {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 0rpx;
|
right: 0rpx;
|
||||||
@@ -333,16 +258,25 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.btn-item {
|
.btn-item {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
text-align: center;
|
||||||
|
flex-direction: column;
|
||||||
|
line-height: 1;
|
||||||
|
margin: 14rpx 0;
|
||||||
|
transition: 0.1s;
|
||||||
|
color: var(--hover-nav-text-color);
|
||||||
|
border-radius: 50%;
|
||||||
width: 80rpx;
|
width: 80rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
background: #fff;
|
padding: 0;
|
||||||
border-radius: 50%;
|
overflow: hidden;
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
margin: 14rpx 0;
|
|
||||||
box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.common-bg {
|
||||||
|
background-color: var(--hover-nav-bg-color);
|
||||||
|
}
|
||||||
|
|
||||||
.btn-item text {
|
.btn-item text {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
}
|
}
|
||||||
@@ -357,7 +291,6 @@ export default {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin: 14rpx 0;
|
margin: 14rpx 0;
|
||||||
background: #fff;
|
|
||||||
border-radius: 50rpx;
|
border-radius: 50rpx;
|
||||||
width: 80rpx;
|
width: 80rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
@@ -371,22 +304,6 @@ export default {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.unread-badge {
|
|
||||||
position: absolute;
|
|
||||||
top: -5rpx;
|
|
||||||
right: -5rpx;
|
|
||||||
background-color: #ff4544;
|
|
||||||
color: white;
|
|
||||||
border-radius: 20rpx;
|
|
||||||
min-width: 30rpx;
|
|
||||||
height: 30rpx;
|
|
||||||
font-size: 20rpx;
|
|
||||||
line-height: 30rpx;
|
|
||||||
text-align: center;
|
|
||||||
padding: 0 8rpx;
|
|
||||||
box-shadow: 0 2rpx 10rpx rgba(255, 69, 68, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.ai-icon {
|
.ai-icon {
|
||||||
font-size: 40rpx;
|
font-size: 40rpx;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -158,22 +158,48 @@ export default {
|
|||||||
success: (res) => {
|
success: (res) => {
|
||||||
// console.log(res)
|
// console.log(res)
|
||||||
if (res.needAuthorization) {
|
if (res.needAuthorization) {
|
||||||
this.popUp()
|
// 检查本地存储中是否已经同意过隐私政策
|
||||||
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
|
const privacyAgreed = uni.getStorageSync('privacyAgreed');
|
||||||
this.closeOtherPagePopUp(this.disPopUp)
|
if (!privacyAgreed) {
|
||||||
|
this.popUp()
|
||||||
|
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
|
||||||
|
this.closeOtherPagePopUp(this.disPopUp)
|
||||||
|
} else {
|
||||||
|
this.$emit('agree')
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$emit('agree')
|
this.$emit('agree')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$emit('agree')
|
// 检查本地存储中是否已经同意过隐私政策
|
||||||
|
const privacyAgreed = uni.getStorageSync('privacyAgreed');
|
||||||
|
if (privacyAgreed) {
|
||||||
|
this.$emit('agree');
|
||||||
|
} else {
|
||||||
|
this.popUp()
|
||||||
|
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
|
||||||
|
this.closeOtherPagePopUp(this.disPopUp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef QUICKAPP-WEBVIEW
|
// #ifdef QUICKAPP-WEBVIEW
|
||||||
this.getPrivacySettingByQuickApp();
|
this.getPrivacySettingByQuickApp();
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef H5 || WEB
|
||||||
|
// 检查本地存储中是否已经同意过隐私政策
|
||||||
|
const privacyAgreed = uni.getStorageSync('privacyAgreed');
|
||||||
|
if (privacyAgreed) {
|
||||||
|
this.$emit('agree');
|
||||||
|
} else {
|
||||||
|
this.popUp()
|
||||||
|
// 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗
|
||||||
|
this.closeOtherPagePopUp(this.disPopUp)
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
},
|
},
|
||||||
//初始化监听程序
|
//初始化监听程序
|
||||||
curPageShow() {
|
curPageShow() {
|
||||||
@@ -261,6 +287,8 @@ export default {
|
|||||||
this.privacyResolves.clear()
|
this.privacyResolves.clear()
|
||||||
//关闭弹窗
|
//关闭弹窗
|
||||||
this.disPopUp()
|
this.disPopUp()
|
||||||
|
// 保存用户授权状态到本地存储,无论同意还是不同意,都不再重复弹出
|
||||||
|
uni.setStorageSync('privacyAgreed', true);
|
||||||
//退出小程序
|
//退出小程序
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
content: '未同意隐私协议,无法使用相关功能',
|
content: '未同意隐私协议,无法使用相关功能',
|
||||||
@@ -281,10 +309,8 @@ export default {
|
|||||||
//关闭弹窗
|
//关闭弹窗
|
||||||
this.disPopUp()
|
this.disPopUp()
|
||||||
|
|
||||||
// #ifdef QUICKAPP-WEBVIEW || H5 || WEB
|
// 保存用户授权状态到本地存储,用于所有环境
|
||||||
// 保存用户授权状态到本地存储,用于快应用Webview组件中的H5方式处理
|
|
||||||
uni.setStorageSync('privacyAgreed', true);
|
uni.setStorageSync('privacyAgreed', true);
|
||||||
// #endif
|
|
||||||
this.$emit('agree')
|
this.$emit('agree')
|
||||||
},
|
},
|
||||||
//打开弹窗
|
//打开弹窗
|
||||||
|
|||||||
30
pages.json
30
pages.json
@@ -321,6 +321,12 @@
|
|||||||
"navigationBarTitleText": "AI 客服"
|
"navigationBarTitleText": "AI 客服"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "agreement/contenr",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "vr/index",
|
"path": "vr/index",
|
||||||
"style": {
|
"style": {
|
||||||
@@ -912,16 +918,22 @@
|
|||||||
},
|
},
|
||||||
//******************文件模块******************
|
//******************文件模块******************
|
||||||
{
|
{
|
||||||
"path": "files/list",
|
"path": "files/list",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
"navigationStyle": "custom",
|
"navigationStyle": "custom",
|
||||||
// #endif
|
// #endif
|
||||||
"navigationBarTitleText": "查看文件"
|
"navigationBarTitleText": "查看文件"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
},
|
||||||
}
|
{
|
||||||
|
"path": "file-preview/file-preview",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "文件预览"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
"navigationBarTextStyle": "black",
|
"navigationBarTextStyle": "black",
|
||||||
|
|||||||
@@ -1,125 +1,145 @@
|
|||||||
<template>
|
<template>
|
||||||
<view :style="themeColor">
|
<view :style="themeColor">
|
||||||
<view :style="{ backgroundColor: bgColor, minHeight: openBottomNav ? 'calc(100vh - 55px)' : '' }"
|
<view :style="{ backgroundColor: bgColor, minHeight: openBottomNav ? 'calc(100vh - 55px)' : '' }"
|
||||||
class="page-img">
|
class="page-img">
|
||||||
<view class="site-info-box"
|
<view class="site-info-box"
|
||||||
v-if="$util.isWeiXin() && followOfficialAccount && followOfficialAccount.isShow && wechatQrcode">
|
v-if="$util.isWeiXin() && followOfficialAccount && followOfficialAccount.isShow && wechatQrcode">
|
||||||
<view class="site-info">
|
<view class="site-info">
|
||||||
<view class="img-box" v-if="siteInfo.logo_square">
|
<view class="img-box" v-if="siteInfo.logo_square">
|
||||||
<image :src="$util.img(siteInfo.logo_square)" mode="aspectFill"></image>
|
<image :src="$util.img(siteInfo.logo_square)" mode="aspectFill"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="info-box" :style="{ color: '#ffffff' }">
|
<view class="info-box" :style="{ color: '#ffffff' }">
|
||||||
<text class="font-size-base">{{ siteInfo.site_name }}</text>
|
<text class="font-size-base">{{ siteInfo.site_name }}</text>
|
||||||
<text>{{ followOfficialAccount.welcomeMsg }}</text>
|
<text>{{ followOfficialAccount.welcomeMsg }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="dite-button" @click="officialAccountsOpen">{{ isEnEnv ? 'Follow Official Account' : '关注公众号'
|
<view class="dite-button" @click="officialAccountsOpen">{{ isEnEnv ? 'Follow Official Account' : '关注公众号'
|
||||||
}}</view>
|
}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<diy-index-page v-if="topIndexValue" ref="indexPage" :value="topIndexValue" :bgUrl="safeBgUrl"
|
<diy-index-page v-if="topIndexValue" ref="indexPage" :value="topIndexValue" :bgUrl="bgUrl"
|
||||||
:scrollTop="scrollTop" :diyGlobal="diyData.global" class="diy-index-page">
|
:scrollTop="scrollTop" :diyGlobal="diyData.global" class="diy-index-page">
|
||||||
<template v-slot:components>
|
<template v-slot:components>
|
||||||
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop"
|
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop"
|
||||||
:haveTopCategory="true" :followOfficialAccount="followOfficialAccount" />
|
:haveTopCategory="true" :followOfficialAccount="followOfficialAccount" />
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:default>
|
<template v-slot:default>
|
||||||
<ns-copyright v-show="isShowCopyRight" />
|
<ns-copyright v-show="isShowCopyRight" />
|
||||||
</template>
|
</template>
|
||||||
</diy-index-page>
|
</diy-index-page>
|
||||||
|
|
||||||
<view v-else class="bg-index"
|
<view v-else class="bg-index"
|
||||||
:style="{ backgroundImage: backgroundUrlStyle, paddingTop: paddingTop, marginTop: marginTop }">
|
:style="{ backgroundImage: backgroundUrl, paddingTop: paddingTop, marginTop: marginTop }">
|
||||||
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop"
|
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop"
|
||||||
:followOfficialAccount="followOfficialAccount" />
|
:followOfficialAccount="followOfficialAccount" />
|
||||||
<ns-copyright v-show="isShowCopyRight" />
|
<ns-copyright v-show="isShowCopyRight" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<template v-if="adv.advshow != -1">
|
<template v-if="adv.advshow != -1">
|
||||||
<view @touchmove.prevent.stop>
|
<view @touchmove.prevent.stop>
|
||||||
<uni-popup ref="uniPopupWindow" type="center" class="wap-floating" :maskClick="false">
|
<uni-popup ref="uniPopupWindow" type="center" class="wap-floating" :maskClick="false">
|
||||||
<view class="small-bot">
|
<view class="small-bot">
|
||||||
<swiper autoplay="true" :circular="true" indicator-active-color="#fff"
|
<swiper autoplay="true" :circular="true" indicator-active-color="#fff"
|
||||||
indicator-color="rgba(255,255,255,0.6)" :indicator-dots="true" interval="3000">
|
indicator-color="rgba(255,255,255,0.6)" :indicator-dots="true" interval="3000">
|
||||||
<swiper-item v-for="(item, index) in adv.list" :key="index">
|
<swiper-item v-for="(item, index) in adv.list" :key="index">
|
||||||
<image class="slide-image" @click="$util.diyRedirectTo(item.link)" height="100%"
|
<image class="slide-image" @click="$util.diyRedirectTo(item.link)" height="100%"
|
||||||
:src="$util.img(item.imageUrl)" width="100%"></image>
|
:src="$util.img(item.imageUrl)" width="100%"></image>
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
</swiper>
|
</swiper>
|
||||||
<view class="small-bot-close" @click="closePopupWindow">
|
<view bindtap="adverclose" class="small-bot-close" @click="closePopupWindow">
|
||||||
<i class="iconfont icon-round-close" style="color:#fff"></i>
|
<i class="iconfont icon-round-close" style="color:#fff"></i>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 底部tabBar -->
|
<!-- 底部tabBar -->
|
||||||
<view class="page-bottom" v-if="openBottomNav">
|
<view class="page-bottom" v-if="openBottomNav">
|
||||||
<diy-bottom-nav @callback="callback" :name="name" />
|
<diy-bottom-nav @callback="callback" :name="name" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 关注公众号弹窗 -->
|
<!-- 关注公众号弹窗 -->
|
||||||
<view @touchmove.prevent class="official-accounts-inner" v-if="wechatQrcode">
|
<view @touchmove.prevent class="official-accounts-inner" v-if="wechatQrcode">
|
||||||
<uni-popup ref="officialAccountsPopup" type="center">
|
<uni-popup ref="officialAccountsPopup" type="center">
|
||||||
<view class="official-accounts-wrap">
|
<view class="official-accounts-wrap">
|
||||||
<image class="content" :src="$util.img(wechatQrcode)" mode="aspectFit"></image>
|
<image class="content" :src="$util.img(wechatQrcode)" mode="aspectFit"></image>
|
||||||
<text class="desc">关注了解更多</text>
|
<text class="desc">关注了解更多</text>
|
||||||
<text class="close iconfont icon-round-close" @click="officialAccountsClose"></text>
|
<text class="close iconfont icon-round-close" @click="officialAccountsClose"></text>
|
||||||
</view>
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 收藏 -->
|
<!-- 收藏 -->
|
||||||
<uni-popup ref="collectPopupWindow" type="top" class="wap-floating wap-floating-collect">
|
<uni-popup ref="collectPopupWindow" type="top" class="wap-floating wap-floating-collect">
|
||||||
<view v-if="showTip" class="collectPopupWindow"
|
<view v-if="showTip" class="collectPopupWindow"
|
||||||
:style="{ marginTop: (collectTop + statusBarHeight) * 2 + 'rpx' }">
|
:style="{ marginTop: (collectTop + statusBarHeight) * 2 + 'rpx' }">
|
||||||
<image :src="$util.img('public/uniapp/index/collect2.png')" mode="aspectFit" />
|
<image :src="$util.img('public/uniapp/index/collect2.png')" mode="aspectFit" />
|
||||||
<text @click="closeCollectPopupWindow">我知道了</text>
|
<text @click="closeCollectPopupWindow">我知道了</text>
|
||||||
</view>
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
|
|
||||||
<!-- 选择门店弹出框 -->
|
<!-- 选择门店弹出框 -->
|
||||||
<view @touchmove.prevent.stop class="choose-store">
|
<view @touchmove.prevent.stop class="choose-store">
|
||||||
<uni-popup ref="chooseStorePopup" type="center" :maskClick="false" class="choose-store">
|
<uni-popup ref="chooseStorePopup" type="center" :maskClick="false" class="choose-store">
|
||||||
<view class="choose-store-popup">
|
<view class="choose-store-popup">
|
||||||
<view class="head-wrap" @click="closeChooseStorePopup">请确认门店</view>
|
<view class="head-wrap" @click="closeChooseStorePopup">请确认门店</view>
|
||||||
<view class="position-wrap">
|
<view class="position-wrap">
|
||||||
<text class="iconfont icon-dizhi"></text>
|
<text class="iconfont icon-dizhi"></text>
|
||||||
<text class="address">{{ currentPosition }}</text>
|
<text class="address">{{ currentPosition }}</text>
|
||||||
<view class="reposition" @click="reposition"
|
<view class="reposition" @click="reposition"
|
||||||
v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
||||||
<text class="iconfont icon-dingwei"></text>
|
<text class="iconfont icon-dingwei"></text>
|
||||||
<text>重新定位</text>
|
<text>重新定位</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="store-wrap" v-if="nearestStore">
|
<view class="store-wrap" v-if="nearestStore">
|
||||||
<text class="tag">当前门店</text>
|
<text class="tag">当前门店</text>
|
||||||
<view class="store-name">{{ nearestStore.store_name }}</view>
|
<view class="store-name">{{ nearestStore.store_name }}</view>
|
||||||
<view class="address">{{ nearestStore.show_address }}</view>
|
<view class="address">{{ nearestStore.show_address }}</view>
|
||||||
<view class="distance" v-if="nearestStore.distance">
|
<view class="distance" v-if="nearestStore.distance">
|
||||||
<text class="iconfont icon-dizhi"></text>
|
<text class="iconfont icon-dizhi"></text>
|
||||||
<text>{{ nearestStore.distance > 1 ? nearestStore.distance + 'km' :
|
<text>{{ nearestStore.distance > 1 ? nearestStore.distance + 'km' :
|
||||||
nearestStore.distance *
|
nearestStore.distance *
|
||||||
1000 +
|
1000 +
|
||||||
'm' }}</text>
|
'm' }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<button type="primary" @click="enterStore">确认进入</button>
|
<button type="primary" @click="enterStore">确认进入</button>
|
||||||
<view class="other-store" @click="chooseOtherStore"
|
<view class="other-store" @click="chooseOtherStore"
|
||||||
v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
||||||
<text>选择其他门店</text>
|
<text>选择其他门店</text>
|
||||||
<text class="iconfont icon-right"></text>
|
<text class="iconfont icon-right"></text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
</view>
|
</view>
|
||||||
<hover-nav :need="true"></hover-nav>
|
|
||||||
<privacy-popup ref="privacyPopup"></privacy-popup>
|
<hover-nav :need="true"></hover-nav>
|
||||||
<to-top v-if="showTop" @toTop="scrollToTopNative()"></to-top>
|
|
||||||
<ns-login ref="login"></ns-login>
|
<!-- 隐私协议弹窗 UI (新增) -->
|
||||||
</view>
|
<view v-if="showPrivacyModal" class="privacy-modal-mask" @touchmove.prevent>
|
||||||
</view>
|
<view class="privacy-modal-container">
|
||||||
|
<view class="modal-header">用户隐私保护提示</view>
|
||||||
|
<view class="modal-body">
|
||||||
|
<text>感谢您使用本应用,在使用前您应当阅读并同意</text>
|
||||||
|
<text class="link" @click="viewPrivacy('privacy')">《隐私条款》</text>
|
||||||
|
<text class="link" @click="viewPrivacy('agreement')">《用户服务协议》</text>
|
||||||
|
<text>,当点击同意并继续时,即表示您已理解并同意该条款内容,该条款将对您产生法律约束力;如您不同意,将无法继续使用相关功能。</text>
|
||||||
|
</view>
|
||||||
|
<view class="modal-footer">
|
||||||
|
<view class="btn btn-disagree" @click="handleDisagree">不同意</view>
|
||||||
|
<view class="btn btn-agree" @click="handleAgree">同意并继续</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 隐私协议组件 (原有) -->
|
||||||
|
<privacy-popup ref="privacyPopup"></privacy-popup>
|
||||||
|
<to-top v-if="showTop" @toTop="scrollToTopNative()"></to-top>
|
||||||
|
<ns-login ref="login"></ns-login>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -128,40 +148,127 @@ import scroll from '@/common/js/scroll-view.js';
|
|||||||
import indexJs from './public/js/index.js';
|
import indexJs from './public/js/index.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [diyJs, scroll, indexJs],
|
mixins: [diyJs, scroll, indexJs],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
minScrollTop: 100,
|
||||||
|
wechatQrcode: '',
|
||||||
|
diyRoute: '/pages/index/index',
|
||||||
|
showPrivacyModal: false // 新增:控制隐私弹窗显示
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad(option) {
|
||||||
|
// #ifdef H5
|
||||||
|
if (option.module && option.module == 'locationPicker') {
|
||||||
|
option.name = '';
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
this.name = option.name || 'DIY_VIEW_INDEX';
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.getFollowQrcode();
|
||||||
|
// 页面显示时检查隐私设置
|
||||||
|
this.checkPrivacySetting();
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.unsubscribe = this.$eventBus?.onMany([
|
||||||
|
'rubik-cube-tap',
|
||||||
|
'picture-tap',
|
||||||
|
'text-tap',
|
||||||
|
'goods-list-tap',
|
||||||
|
'presale-tap',
|
||||||
|
'notes-tap',
|
||||||
|
'merch-list-tap',
|
||||||
|
'map-tap',
|
||||||
|
'img-ads-tap',
|
||||||
|
'many-goods-list-tap',
|
||||||
|
'search-tap',
|
||||||
|
], this._handleDiyGroupInteractionEvent);
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
if (this.unsubscribe) this.unsubscribe();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 检查隐私弹窗逻辑
|
||||||
|
checkPrivacySetting() {
|
||||||
|
// 模拟检查本地存储,看用户是否已经同意过
|
||||||
|
// 实际项目中请替换为你真实的存储逻辑
|
||||||
|
const hasAgreed = uni.getStorageSync('HAS_AGREED_PRIVACY');
|
||||||
|
if (!hasAgreed) {
|
||||||
|
// 延迟显示,防止遮挡页面渲染
|
||||||
|
setTimeout(() => {
|
||||||
|
this.showPrivacyModal = true;
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 用户点击同意
|
||||||
|
handleAgree() {
|
||||||
|
// 保存同意状态
|
||||||
|
uni.setStorageSync('HAS_AGREED_PRIVACY', true);
|
||||||
|
this.showPrivacyModal = false;
|
||||||
|
},
|
||||||
|
|
||||||
data() {
|
// 用户点击不同意
|
||||||
return {
|
handleDisagree() {
|
||||||
diyData: { global: {}, value: null },
|
// 微信小程序环境下,不同意通常退出小程序
|
||||||
followOfficialAccount: {},
|
// #ifdef MP-WEIXIN
|
||||||
wechatQrcode: '',
|
uni.exitMiniProgram();
|
||||||
adv: { advshow: -1, list: [] },
|
// #endif
|
||||||
// ❌ 不要定义 siteInfo、bgUrl,除非你明确知道它们不会冲突
|
// H5 或 App 下可以提示或直接不显示内容
|
||||||
};
|
// #ifndef MP-WEIXIN
|
||||||
},
|
uni.showToast({
|
||||||
|
title: '您已拒绝协议,无法使用',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
// 这里可以选择关闭页面或保持弹窗
|
||||||
|
// this.showPrivacyModal = false;
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
|
||||||
computed: {
|
// 查看具体条款(可选功能)
|
||||||
// ✅ 安全获取 bgUrl(用于 diy-index-page 的 prop)
|
viewPrivacy(type) {
|
||||||
safeBgUrl() {
|
// 这里可以跳转到具体的条款页面,或者使用你现有的 privacy-popup 组件
|
||||||
// 优先取全局配置中的 bgUrl,没有则用组件自己的 bgUrl(如有),否则为空
|
// 假设你有现成的组件逻辑:
|
||||||
return this.diyData?.global?.bgUrl || this.bgUrl || '';
|
if (this.$refs.privacyPopup) {
|
||||||
},
|
// 假设 privacy-popup 组件有一个 show 方法
|
||||||
|
// this.$refs.privacyPopup.show(type);
|
||||||
|
}
|
||||||
|
uni.showToast({
|
||||||
|
title: '请在此处实现查看条款逻辑',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
// ✅ 安全生成 background-image 样式字符串(用于 fallback 区域)
|
getFollowQrcode() {
|
||||||
backgroundUrlStyle() {
|
if (!this.$util.isWeiXin()) return;
|
||||||
const url = this.diyData?.global?.bgUrl || this.bgUrl || '';
|
this.$api.sendRequest({
|
||||||
return url ? `url(${url})` : 'none';
|
url: '/wechat/api/wechat/followqrcode',
|
||||||
}
|
success: res => {
|
||||||
},
|
if (res.code >= 0 && res.data) {
|
||||||
|
this.wechatQrcode = res.data.qrcode;
|
||||||
// 如果你的 mixin 中已经处理了数据加载,这里可以留空
|
}
|
||||||
// 否则建议在 created/mounted 中初始化默认值或请求数据
|
}
|
||||||
created() {
|
});
|
||||||
// 可选:如果 mixin 没有初始化 diyData,这里再兜底一次
|
},
|
||||||
if (!this.diyData) {
|
officialAccountsOpen() {
|
||||||
this.diyData = { global: {}, value: null };
|
this.$refs.officialAccountsPopup.open();
|
||||||
}
|
},
|
||||||
}
|
officialAccountsClose() {
|
||||||
|
this.$refs.officialAccountsPopup.close();
|
||||||
|
},
|
||||||
|
_handleDiyGroupInteractionEvent(payload) {
|
||||||
|
// #ifdef H5
|
||||||
|
return true;
|
||||||
|
// #endif
|
||||||
|
if (this.storeToken) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
this.$refs.login?.open();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -170,86 +277,153 @@ export default {
|
|||||||
@import './public/css/index.scss';
|
@import './public/css/index.scss';
|
||||||
|
|
||||||
.small-bot {
|
.small-bot {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 122;
|
z-index: 122;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-bot swiper {
|
.small-bot swiper {
|
||||||
width: 560rpx;
|
width: 560rpx;
|
||||||
height: 784rpx;
|
height: 784rpx;
|
||||||
margin: 120rpx auto 0;
|
margin: 120rpx auto 0;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-bot swiper .slide-image {
|
.small-bot swiper .slide-image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-bot-close {
|
.small-bot-close {
|
||||||
width: 66rpx;
|
width: 66rpx;
|
||||||
height: 66rpx;
|
height: 66rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 64rpx;
|
line-height: 64rpx;
|
||||||
font-size: 64rpx;
|
font-size: 64rpx;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
margin: 30rpx auto 0;
|
margin: 30rpx auto 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small-bot-close i {
|
.small-bot-close i {
|
||||||
font-size: 60rpx;
|
font-size: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 新增:隐私弹窗样式 */
|
||||||
|
.privacy-modal-mask {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.6); // 半透明背景
|
||||||
|
z-index: 9999; // 确保层级最高
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.privacy-modal-container {
|
||||||
|
width: 80%;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
padding: 40rpx 30rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-body {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #666;
|
||||||
|
line-height: 1.6;
|
||||||
|
text-align: left;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link {
|
||||||
|
color: #007aff; // 蓝色链接
|
||||||
|
margin: 0 4rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
flex: 1;
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
text-align: center;
|
||||||
|
margin: 0 15rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-disagree {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-agree {
|
||||||
|
background-color: #07c160; // 微信绿
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.swiper /deep/ .uni-swiper-dots-horizontal {
|
.swiper ::v-deep .uni-swiper-dots-horizontal {
|
||||||
left: 40%;
|
left: 40%;
|
||||||
bottom: 40px
|
bottom: 40px
|
||||||
}
|
}
|
||||||
|
|
||||||
.wap-floating>>>.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
.wap-floating>>>.uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||||
background: none !important;
|
background: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.choose-store>>>.goodslist-uni-popup-box {
|
.choose-store>>>.goodslist-uni-popup-box {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/.diy-index-page .uni-popup .uni-popup__wrapper-box {
|
::v-deep .diy-index-page .uni-popup .uni-popup__wrapper-box {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/ .placeholder {
|
::v-deep .placeholder {
|
||||||
height: 0;
|
height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/::-webkit-scrollbar {
|
::v-deep ::-webkit-scrollbar {
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/ .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
::v-deep .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||||
max-height: unset !important;
|
max-height: unset !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/ .mescroll-totop {
|
::v-deep .mescroll-totop {
|
||||||
/* #ifdef H5 */
|
/* #ifdef H5 */
|
||||||
right: 28rpx !important;
|
right: 28rpx !important;
|
||||||
bottom: 200rpx !important;
|
bottom: 200rpx !important;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
/* #ifdef MP-WEIXIN */
|
/* #ifdef MP-WEIXIN */
|
||||||
right: 27rpx !important;
|
right: 27rpx !important;
|
||||||
bottom: 180rpx !important;
|
bottom: 180rpx !important;
|
||||||
/* #endif */
|
/* #endif */
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,82 +1,95 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
minScrollTop: 100, // 设置回到顶端按钮显示要求,最小页面滚动距离
|
minScrollTop: 100, // 设置回到顶端按钮显示要求,最小页面滚动距离
|
||||||
wechatQrcode: '', // 公众号二维码
|
wechatQrcode: "", // 公众号二维码
|
||||||
diyRoute: '/pages/index/index'
|
diyRoute: "/pages/index/index",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
// H5地图选择位置回调数据
|
// H5地图选择位置回调数据
|
||||||
if (option.module && option.module == 'locationPicker') {
|
if (option.module && option.module == "locationPicker") {
|
||||||
option.name = ''; // 清空地址
|
option.name = ""; // 清空地址
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
this.name = option.name || 'DIY_VIEW_INDEX'; // 根据店铺运营模式,打开平台(shop)或者连锁门店(stroe)页面,接口会自行判断
|
this.name = option.name || "DIY_VIEW_INDEX"; // 根据店铺运营模式,打开平台(shop)或者连锁门店(stroe)页面,接口会自行判断
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
// 获取关注公众号二维码
|
||||||
|
this.getFollowQrcode();
|
||||||
|
// 检查隐私设置并显示弹窗
|
||||||
|
this.checkPrivacySetting();
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
// 监听图片、文字、商品列表等组件的点击事件
|
||||||
|
this.unsubscribe = this.$eventBus?.onMany(
|
||||||
|
[
|
||||||
|
"rubik-cube-tap",
|
||||||
|
"picture-tap",
|
||||||
|
"text-tap",
|
||||||
|
"goods-list-tap",
|
||||||
|
"presale-tap",
|
||||||
|
"notes-tap",
|
||||||
|
"merch-list-tap",
|
||||||
|
"map-tap",
|
||||||
|
"img-ads-tap",
|
||||||
|
"many-goods-list-tap",
|
||||||
|
"search-tap",
|
||||||
|
],
|
||||||
|
this._handleDiyGroupInteractionEvent,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
// 移除图片点击事件监听
|
||||||
|
if (this.unsubscribe) this.unsubscribe();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 检查隐私设置
|
||||||
|
checkPrivacySetting() {
|
||||||
|
// 延迟执行,确保组件已经挂载
|
||||||
|
setTimeout(() => {
|
||||||
|
if (this.$refs.privacyPopup) {
|
||||||
|
this.$refs.privacyPopup.proactive();
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
},
|
||||||
|
// 关注公众号
|
||||||
|
getFollowQrcode() {
|
||||||
|
if (!this.$util.isWeiXin()) return;
|
||||||
|
this.$api.sendRequest({
|
||||||
|
url: "/wechat/api/wechat/followqrcode",
|
||||||
|
success: (res) => {
|
||||||
|
if (res.code >= 0 && res.data) {
|
||||||
|
this.wechatQrcode = res.data.qrcode;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
officialAccountsOpen() {
|
||||||
|
this.$refs.officialAccountsPopup.open();
|
||||||
|
},
|
||||||
|
officialAccountsClose() {
|
||||||
|
this.$refs.officialAccountsPopup.close();
|
||||||
|
},
|
||||||
|
// 统一处理点击及触摸事件
|
||||||
|
_handleDiyGroupInteractionEvent(payload) {
|
||||||
|
// #ifdef H5
|
||||||
|
// 如果是 H5 环境,直接返回 true 继续传播
|
||||||
|
return true;
|
||||||
|
// #endif
|
||||||
|
|
||||||
},
|
// 如果已登录,直接返回 true 继续传播
|
||||||
onShow() {
|
if (this.storeToken) {
|
||||||
// 获取关注公众号二维码
|
return true;
|
||||||
this.getFollowQrcode();
|
}
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
// 监听图片、文字、商品列表等组件的点击事件
|
|
||||||
this.unsubscribe = this.$eventBus?.onMany([
|
|
||||||
'rubik-cube-tap',
|
|
||||||
'picture-tap',
|
|
||||||
'text-tap',
|
|
||||||
'goods-list-tap',
|
|
||||||
'presale-tap',
|
|
||||||
'notes-tap',
|
|
||||||
'merch-list-tap',
|
|
||||||
'map-tap',
|
|
||||||
'img-ads-tap',
|
|
||||||
'many-goods-list-tap',
|
|
||||||
'search-tap',
|
|
||||||
], this._handleDiyGroupInteractionEvent);
|
|
||||||
},
|
|
||||||
beforeDestroy() {
|
|
||||||
// 移除图片点击事件监听
|
|
||||||
if (this.unsubscribe) this.unsubscribe();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 关注公众号
|
|
||||||
getFollowQrcode() {
|
|
||||||
if (!this.$util.isWeiXin()) return;
|
|
||||||
this.$api.sendRequest({
|
|
||||||
url: '/wechat/api/wechat/followqrcode',
|
|
||||||
success: res => {
|
|
||||||
if (res.code >= 0 && res.data) {
|
|
||||||
this.wechatQrcode = res.data.qrcode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
officialAccountsOpen() {
|
|
||||||
this.$refs.officialAccountsPopup.open();
|
|
||||||
},
|
|
||||||
officialAccountsClose() {
|
|
||||||
this.$refs.officialAccountsPopup.close();
|
|
||||||
},
|
|
||||||
// 统一处理点击及触摸事件
|
|
||||||
_handleDiyGroupInteractionEvent(payload) {
|
|
||||||
// #ifdef H5
|
|
||||||
// 如果是 H5 环境,直接返回 true 继续传播
|
|
||||||
return true;
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// 如果已登录,直接返回 true 继续传播
|
// 打开登录弹窗
|
||||||
if (this.storeToken) {
|
// console.log('==> _handleDiyGroupInteractionEvent, 未登录,打开登录弹窗', { payload })
|
||||||
return true;
|
this.$refs.login?.open();
|
||||||
}
|
|
||||||
|
|
||||||
// 打开登录弹窗
|
// 阻止事件继续传播
|
||||||
// console.log('==> _handleDiyGroupInteractionEvent, 未登录,打开登录弹窗', { payload })
|
return false;
|
||||||
this.$refs.login?.open();
|
},
|
||||||
|
},
|
||||||
// 阻止事件继续传播
|
};
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -38,8 +38,8 @@
|
|||||||
<!-- AI消息 -->
|
<!-- AI消息 -->
|
||||||
<view v-else class="ai-message">
|
<view v-else class="ai-message">
|
||||||
<view class="avatar">
|
<view class="avatar">
|
||||||
<!-- 直接使用内部固定的AI头像 -->
|
<!-- AI头像使用🤖 -->
|
||||||
<image :src="aiAvatar" mode="aspectFill" />
|
<text>🤖</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="message-content">
|
<view class="message-content">
|
||||||
<!-- AI昵称固定,不可修改 - 左移到气泡上方 -->
|
<!-- AI昵称固定,不可修改 - 左移到气泡上方 -->
|
||||||
@@ -183,19 +183,11 @@
|
|||||||
<view class="input-area">
|
<view class="input-area">
|
||||||
<view class="input-tools">
|
<view class="input-tools">
|
||||||
<button class="tool-btn" @click="showMoreTools">
|
<button class="tool-btn" @click="showMoreTools">
|
||||||
<text class="iconfont icon-plus">📌</text>
|
<text class="iconfont icon-plus">...</text>
|
||||||
</button>
|
</button>
|
||||||
<button class="tool-btn" @click="toggleVoiceInput">
|
<button class="tool-btn" @click="toggleVoiceInput">
|
||||||
<text class="iconfont" :class="voiceInputing ? 'icon-stop' : 'icon-voice'">🎤</text>
|
<text class="iconfont" :class="voiceInputing ? 'icon-stop' : 'icon-voice'">🎤</text>
|
||||||
</button>
|
</button>
|
||||||
<!-- 更换用户头像按钮 -->
|
|
||||||
<button class="tool-btn" @click="openAvatarSelector">
|
|
||||||
<text class="iconfont icon-user">📷</text>
|
|
||||||
</button>
|
|
||||||
<!-- 新增:更换用户昵称按钮 -->
|
|
||||||
<button class="tool-btn" @click="openNicknameEditor">
|
|
||||||
<text class="iconfont icon-edit">✏️</text>
|
|
||||||
</button>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="input-container">
|
<view class="input-container">
|
||||||
@@ -1495,6 +1487,9 @@ $radius-lg: 36rpx;
|
|||||||
background-color: $bg-card;
|
background-color: $bg-card;
|
||||||
border: 2rpx solid #f0f4f8;
|
border: 2rpx solid #f0f4f8;
|
||||||
transition: transform 0.2s ease;
|
transition: transform 0.2s ease;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
transform: scale(1.03);
|
transform: scale(1.03);
|
||||||
@@ -1505,6 +1500,11 @@ $radius-lg: 36rpx;
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
text {
|
||||||
|
font-size: 56rpx;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.message-content {
|
.message-content {
|
||||||
@@ -2070,6 +2070,7 @@ $radius-lg: 36rpx;
|
|||||||
.input-tools {
|
.input-tools {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
|
align-items: flex-start;
|
||||||
|
|
||||||
.tool-btn {
|
.tool-btn {
|
||||||
width: 64rpx;
|
width: 64rpx;
|
||||||
@@ -2077,6 +2078,7 @@ $radius-lg: 36rpx;
|
|||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: $bg-main;
|
background-color: $bg-main;
|
||||||
margin-right: 16rpx;
|
margin-right: 16rpx;
|
||||||
|
margin-top: -8rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="header-right">
|
<view class="header-right">
|
||||||
<button class="menu-btn" v-show="showMenuButton" @click="showMenu">
|
<button class="menu-btn" v-show="showMenuButton" @click="showMenu">
|
||||||
<text class="iconfont icon-ellipsis"></text>
|
<text>⚙️</text>
|
||||||
</button>
|
</button>
|
||||||
<!-- 占位元素,确保布局平衡 -->
|
<!-- 占位元素,确保布局平衡 -->
|
||||||
<view v-show="!showMenuButton" class="placeholder"></view>
|
<view v-show="!showMenuButton" class="placeholder"></view>
|
||||||
@@ -44,6 +44,41 @@
|
|||||||
@product-view="onProductView"
|
@product-view="onProductView"
|
||||||
@input-change="onInputChange" />
|
@input-change="onInputChange" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 设置面板 -->
|
||||||
|
<view v-if="showSettingsPanel" class="settings-popup">
|
||||||
|
<view class="settings-mask" @click="hideSettings"></view>
|
||||||
|
<view class="settings-panel">
|
||||||
|
<view class="settings-header">
|
||||||
|
<text class="settings-title">设置</text>
|
||||||
|
<view class="close-btn" @click="hideSettings">
|
||||||
|
<text>✕</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="settings-content">
|
||||||
|
<view class="setting-item" @click="openAvatarSelector">
|
||||||
|
<view class="setting-icon">
|
||||||
|
<text class="iconfont icon-user">📷</text>
|
||||||
|
</view>
|
||||||
|
<view class="setting-info">
|
||||||
|
<text class="setting-label">更换头像</text>
|
||||||
|
<text class="setting-desc">自定义您的聊天头像</text>
|
||||||
|
</view>
|
||||||
|
<text class="iconfont icon-right">›</text>
|
||||||
|
</view>
|
||||||
|
<view class="setting-item" @click="openNicknameEditor">
|
||||||
|
<view class="setting-icon">
|
||||||
|
<text class="iconfont icon-edit">✏️</text>
|
||||||
|
</view>
|
||||||
|
<view class="setting-info">
|
||||||
|
<text class="setting-label">更换昵称</text>
|
||||||
|
<text class="setting-desc">自定义您的昵称</text>
|
||||||
|
</view>
|
||||||
|
<text class="iconfont icon-right">›</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -81,6 +116,7 @@ export default {
|
|||||||
showCustomNavbar: true, // 是否显示自定义导航栏
|
showCustomNavbar: true, // 是否显示自定义导航栏
|
||||||
showBackButton: false, // 是否显示返回按钮
|
showBackButton: false, // 是否显示返回按钮
|
||||||
showMenuButton: true, // 是否显示设置菜单按钮
|
showMenuButton: true, // 是否显示设置菜单按钮
|
||||||
|
showSettingsPanel: false, // 是否显示设置面板
|
||||||
|
|
||||||
// --- 聊天内容区域 ---
|
// --- 聊天内容区域 ---
|
||||||
scrollViewHeight: '0px',
|
scrollViewHeight: '0px',
|
||||||
@@ -330,9 +366,21 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
showSettings() {
|
showSettings() {
|
||||||
uni.navigateTo({
|
this.showSettingsPanel = true;
|
||||||
url: '/pages/settings/index'
|
},
|
||||||
});
|
|
||||||
|
hideSettings() {
|
||||||
|
this.showSettingsPanel = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
openAvatarSelector() {
|
||||||
|
this.hideSettings();
|
||||||
|
this.$refs.chat.openAvatarSelector();
|
||||||
|
},
|
||||||
|
|
||||||
|
openNicknameEditor() {
|
||||||
|
this.hideSettings();
|
||||||
|
this.$refs.chat.openNicknameEditor();
|
||||||
},
|
},
|
||||||
|
|
||||||
showHelp() {
|
showHelp() {
|
||||||
@@ -511,7 +559,7 @@ export default {
|
|||||||
background-color: white; /* 白色 */
|
background-color: white; /* 白色 */
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 48px;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
@@ -611,4 +659,128 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 设置面板 */
|
||||||
|
.settings-popup {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
|
||||||
|
.settings-mask {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.4);
|
||||||
|
backdrop-filter: blur(6rpx);
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-panel {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
padding: 32rpx;
|
||||||
|
width: calc(100% - 80rpx);
|
||||||
|
max-width: 520rpx;
|
||||||
|
box-shadow: 0 8rpx 36rpx rgba(0, 0, 0, 0.15);
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
.settings-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
border-bottom: 2rpx solid #f0f4f8;
|
||||||
|
padding-bottom: 16rpx;
|
||||||
|
|
||||||
|
.settings-title {
|
||||||
|
font-size: 34rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-btn {
|
||||||
|
width: 56rpx;
|
||||||
|
height: 56rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #f8fafc;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #999;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #e9edf2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16rpx;
|
||||||
|
|
||||||
|
.setting-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 24rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
background-color: #f8fafc;
|
||||||
|
border: 2rpx solid #f0f4f8;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #e9edf2;
|
||||||
|
border-color: #d9e3ed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.setting-icon {
|
||||||
|
width: 72rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #c4e0ff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.setting-info {
|
||||||
|
flex: 1;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4rpx;
|
||||||
|
|
||||||
|
.setting-label {
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.setting-desc {
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconfont.icon-right {
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #ccc;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
"setting": {
|
"setting": {
|
||||||
"urlCheck": true,
|
"urlCheck": true,
|
||||||
"es6": true,
|
"es6": true,
|
||||||
"enhance": false,
|
"enhance": true,
|
||||||
"postcss": true,
|
"postcss": true,
|
||||||
"preloadBackgroundData": false,
|
"preloadBackgroundData": false,
|
||||||
"minified": true,
|
"minified": true,
|
||||||
@@ -39,19 +39,27 @@
|
|||||||
"packNpmManually": false,
|
"packNpmManually": false,
|
||||||
"packNpmRelationList": [],
|
"packNpmRelationList": [],
|
||||||
"minifyWXSS": true,
|
"minifyWXSS": true,
|
||||||
"compileWorklet": false,
|
"condition": true,
|
||||||
|
"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": "3.12.0",
|
"libVersion": "2.16.1",
|
||||||
"appid": "wx29215aa1bd97bbd6",
|
"appid": "wx29215aa1bd97bbd6",
|
||||||
"projectname": "uniapp",
|
"projectname": "uniapp",
|
||||||
|
"debugOptions": {
|
||||||
|
"hidedInDevtools": []
|
||||||
|
},
|
||||||
|
"scripts": {},
|
||||||
|
"staticServerOptions": {
|
||||||
|
"baseURL": "",
|
||||||
|
"servePath": ""
|
||||||
|
},
|
||||||
"isGameTourist": false,
|
"isGameTourist": false,
|
||||||
"condition": {
|
"condition": {
|
||||||
"search": {
|
"search": {
|
||||||
@@ -72,7 +80,5 @@
|
|||||||
"miniprogram": {
|
"miniprogram": {
|
||||||
"list": []
|
"list": []
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"simulatorPluginLibVersion": {},
|
|
||||||
"editorSetting": {}
|
|
||||||
}
|
}
|
||||||
@@ -416,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 {
|
||||||
@@ -440,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