Compare commits
6 Commits
main
...
047cf765da
| Author | SHA1 | Date | |
|---|---|---|---|
| 047cf765da | |||
| 3a30b0817d | |||
| a464a8731f | |||
| 7599a80943 | |||
| 992a01cc76 | |||
| dd09c66215 |
@@ -42,6 +42,6 @@ const localDevConfig = ({
|
|||||||
uniacid: 2,
|
uniacid: 2,
|
||||||
domain: 'http://localhost:8050/',
|
domain: 'http://localhost:8050/',
|
||||||
},
|
},
|
||||||
})['2811']; // 选择要使用的环境配置
|
})['1']; // 选择要使用的环境配置
|
||||||
|
|
||||||
export default localDevConfig;
|
export default localDevConfig;
|
||||||
@@ -60,55 +60,107 @@ export default {
|
|||||||
/**
|
/**
|
||||||
* 流式消息入口(自动适配平台)
|
* 流式消息入口(自动适配平台)
|
||||||
*/
|
*/
|
||||||
async sendStreamMessage(message, onChunk, onComplete) {
|
async sendStreamMessage(message, onChunk, onComplete) {
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
// 微信小程序:降级为普通请求 + 前端打字模拟
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
const socketTask = wx.connectSocket({
|
||||||
const result = await this.sendMessage(message);
|
url: 'wss://dev.aigc-quickapp.com/ws/aikefu',
|
||||||
const content = result.content || '';
|
header: {}
|
||||||
const conversationId = result.conversationId || '';
|
});
|
||||||
|
|
||||||
// 保存会话ID(确保连续对话)
|
let content = '';
|
||||||
if (conversationId) {
|
let conversationId = '';
|
||||||
this.setConversationId(conversationId);
|
let isAuthenticated = false;
|
||||||
}
|
|
||||||
|
socketTask.onOpen(() => {
|
||||||
// 模拟打字效果
|
console.log('WebSocket 连接成功,开始认证...');
|
||||||
let index = 0;
|
socketTask.send({
|
||||||
const chunkSize = 2; // 每次显示2个字符
|
data: JSON.stringify({
|
||||||
return new Promise((resolve) => {
|
action: 'auth',
|
||||||
const timer = setInterval(() => {
|
uniacid: store.state.uniacid || '1',
|
||||||
if (index < content.length) {
|
token: store.state.token || 'test_token',
|
||||||
const chunk = content.substring(index, index + chunkSize);
|
user_id: store.state.memberInfo?.id || 'anonymous'
|
||||||
index += chunkSize;
|
})
|
||||||
if (onChunk) onChunk(chunk);
|
});
|
||||||
} else {
|
});
|
||||||
clearInterval(timer);
|
|
||||||
if (onComplete) {
|
socketTask.onMessage((res) => {
|
||||||
onComplete({
|
try {
|
||||||
content: content,
|
const data = JSON.parse(res.data);
|
||||||
conversation_id: conversationId
|
console.log('收到 WebSocket 消息:', data);
|
||||||
});
|
|
||||||
}
|
if (data.type === 'auth_success') {
|
||||||
resolve({ content, conversation_id: conversationId });
|
console.log('认证成功,发送聊天消息...');
|
||||||
}
|
isAuthenticated = true;
|
||||||
}, 80); // 打字速度:80ms/次
|
socketTask.send({
|
||||||
});
|
data: JSON.stringify({
|
||||||
} catch (error) {
|
action: 'chat',
|
||||||
console.error('小程序流式消息降级失败:', error);
|
uniacid: store.state.uniacid || '1',
|
||||||
if (onComplete) {
|
query: message,
|
||||||
onComplete({ error: error.message || '发送失败' });
|
user_id: store.state.memberInfo?.id || 'anonymous',
|
||||||
}
|
conversation_id: this.getConversationId() || ''
|
||||||
throw error;
|
})
|
||||||
}
|
});
|
||||||
|
} else if (data.type === 'auth_failed') {
|
||||||
|
const errorMsg = '认证失败,请重新登录';
|
||||||
|
console.error(errorMsg, data);
|
||||||
|
reject(new Error(errorMsg));
|
||||||
|
if (onComplete) onComplete({ error: errorMsg });
|
||||||
|
socketTask.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理流式消息块
|
||||||
|
else if (data.type === 'message' || data.event === 'message') {
|
||||||
|
const text = data.answer || data.content || data.text || '';
|
||||||
|
content += text;
|
||||||
|
if (onChunk) onChunk(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理流结束
|
||||||
|
else if (data.event === 'message_end' || data.type === 'message_end') {
|
||||||
|
conversationId = data.conversation_id || '';
|
||||||
|
if (conversationId) {
|
||||||
|
this.setConversationId(conversationId);
|
||||||
|
}
|
||||||
|
if (onComplete) {
|
||||||
|
onComplete({ content, conversation_id: conversationId });
|
||||||
|
}
|
||||||
|
resolve({ content, conversation_id: conversationId });
|
||||||
|
socketTask.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 可选:处理 done
|
||||||
|
else if (data.type === 'done') {
|
||||||
|
console.log('对话完成:', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.error('WebSocket 消息解析失败:', e, '原始数据:', res.data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
socketTask.onError((err) => {
|
||||||
|
const errorMsg = 'WebSocket 连接失败';
|
||||||
|
console.error(errorMsg, err);
|
||||||
|
reject(new Error(errorMsg));
|
||||||
|
if (onComplete) onComplete({ error: errorMsg });
|
||||||
|
});
|
||||||
|
|
||||||
|
socketTask.onClose(() => {
|
||||||
|
console.log('WebSocket 连接已关闭');
|
||||||
|
});
|
||||||
|
|
||||||
|
const timeout = setTimeout(() => {
|
||||||
|
if (!isAuthenticated || content === '') {
|
||||||
|
console.warn('WebSocket 超时,强制关闭');
|
||||||
|
socketTask.close();
|
||||||
|
reject(new Error('AI服务响应超时'));
|
||||||
|
if (onComplete) onComplete({ error: 'AI服务响应超时' });
|
||||||
|
}
|
||||||
|
}, 10000);
|
||||||
|
});
|
||||||
// #endif
|
// #endif
|
||||||
|
},
|
||||||
// #ifdef H5
|
|
||||||
// H5:使用真实流式(EventSource / Fetch)
|
|
||||||
return this.sendHttpStream(message, onChunk, onComplete);
|
|
||||||
// #endif
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTTP 流式请求(仅 H5 使用)
|
* HTTP 流式请求(仅 H5 使用)
|
||||||
*/
|
*/
|
||||||
@@ -131,64 +183,75 @@ export default {
|
|||||||
conversation_id: this.getConversationId() || ''
|
conversation_id: this.getConversationId() || ''
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok || !response.body) {
|
||||||
throw new Error(`HTTP ${response.status}`);
|
throw new Error('无效响应');
|
||||||
}
|
}
|
||||||
if (!response.body) {
|
|
||||||
throw new Error('响应体不可用');
|
|
||||||
}
|
|
||||||
|
|
||||||
const reader = response.body.getReader();
|
const reader = response.body.getReader();
|
||||||
const decoder = new TextDecoder('utf-8');
|
const decoder = new TextDecoder('utf-8');
|
||||||
let buffer = '';
|
let buffer = '';
|
||||||
let content = '';
|
let content = '';
|
||||||
let conversationId = '';
|
let conversationId = '';
|
||||||
|
|
||||||
function processBuffer(buf, callback) {
|
while (true) {
|
||||||
const lines = buf.split('\n');
|
const { done, value } = await reader.read();
|
||||||
buf = lines.pop() || '';
|
if (done) break;
|
||||||
|
|
||||||
|
buffer += decoder.decode(value, { stream: true });
|
||||||
|
|
||||||
|
// 按行分割,保留不完整的最后一行
|
||||||
|
const lines = buffer.split('\n');
|
||||||
|
buffer = lines.pop() || ''; // 未完成的行留到下次
|
||||||
|
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
const trimmed = line.trim();
|
const trimmed = line.trim();
|
||||||
if (trimmed.startsWith('data:')) {
|
if (trimmed.startsWith('data:')) {
|
||||||
const jsonStr = trimmed.slice(5).trim();
|
try {
|
||||||
if (jsonStr) {
|
const jsonStr = trimmed.slice(5).trim();
|
||||||
try {
|
if (jsonStr && jsonStr !== '[DONE]') {
|
||||||
const data = JSON.parse(jsonStr);
|
const data = JSON.parse(jsonStr);
|
||||||
if (data.event === 'message') {
|
if (data.event === 'message') {
|
||||||
const text = data.answer || data.text || '';
|
const text = data.answer || data.text || '';
|
||||||
content += text;
|
content += text;
|
||||||
callback(text);
|
if (onChunk) onChunk(text);
|
||||||
}
|
}
|
||||||
if (data.conversation_id) {
|
if (data.conversation_id) {
|
||||||
conversationId = data.conversation_id;
|
conversationId = data.conversation_id;
|
||||||
}
|
}
|
||||||
if (data.event === 'message_end') {
|
if (data.event === 'message_end') {
|
||||||
// 可选:提前完成
|
// 可提前结束
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
console.warn('解析流数据失败:', e);
|
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('解析失败:', e, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
// 处理最后残留的 buffer(如果有)
|
||||||
const { done, value } = await reader.read();
|
if (buffer.trim().startsWith('data:')) {
|
||||||
if (done) break;
|
try {
|
||||||
buffer += decoder.decode(value, { stream: true });
|
const jsonStr = buffer.trim().slice(5);
|
||||||
buffer = processBuffer(buffer, (chunk) => {
|
if (jsonStr) {
|
||||||
if (onChunk) onChunk(chunk);
|
const data = JSON.parse(jsonStr);
|
||||||
});
|
if (data.event === 'message') {
|
||||||
|
const text = data.answer || '';
|
||||||
|
content += text;
|
||||||
|
if (onChunk) onChunk(text);
|
||||||
|
}
|
||||||
|
if (data.conversation_id) {
|
||||||
|
conversationId = data.conversation_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('最后 buffer 解析失败:', e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onComplete) {
|
if (onComplete) {
|
||||||
onComplete({
|
onComplete({ content, conversation_id: conversationId });
|
||||||
content,
|
|
||||||
conversation_id: conversationId
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return { content, conversation_id: conversationId };
|
return { content, conversation_id: conversationId };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -196,11 +259,6 @@ export default {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
|
||||||
// 理论上不会执行到这里,但防止 fallback
|
|
||||||
return this.sendStreamMessage(message, onChunk, onComplete);
|
|
||||||
// #endif
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,68 +2,13 @@
|
|||||||
* 客服统一处理服务
|
* 客服统一处理服务
|
||||||
* 整合各种客服方式,提供统一的调用接口
|
* 整合各种客服方式,提供统一的调用接口
|
||||||
*/
|
*/
|
||||||
class CustomerService {
|
export class CustomerService {
|
||||||
constructor(vueInstance, externalConfig = {}) {
|
constructor(vueInstance, externalConfig = null) {
|
||||||
if (!vueInstance.$lang) {
|
|
||||||
throw new Error('CustomerService 必须在 Vue 实例中初始化');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.vm = vueInstance;
|
this.vm = vueInstance;
|
||||||
this.externalConfig = externalConfig; // 外部传入的最新配置(优先级最高)
|
this.externalConfig = externalConfig; // 外部传入的最新配置(优先级最高)
|
||||||
this.latestPlatformConfig = null;
|
this.latestPlatformConfig = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSupoortKeFuList() {
|
|
||||||
if (!this.vm) return [];
|
|
||||||
|
|
||||||
const vm = this.vm;
|
|
||||||
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
id: 'weixin-official',
|
|
||||||
name: vm.$lang('customer.weChatKefu'),
|
|
||||||
isOfficial: true,
|
|
||||||
type: 'weapp'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'custom-kefu',
|
|
||||||
name: vm.$lang('customer.systemKefu'),
|
|
||||||
isOfficial: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'qyweixin-kefu',
|
|
||||||
name: vm.$lang('customer.weChatWorkKefu'),
|
|
||||||
isOfficial: false
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 打开客服选择弹窗
|
|
||||||
*/
|
|
||||||
openCustomerSelectPopupDialog() {
|
|
||||||
const kefu_list = this.getSupoortKeFuList();
|
|
||||||
const kefuNames = kefu_list.map(item => item.name);
|
|
||||||
|
|
||||||
uni.showActionSheet({
|
|
||||||
itemList: kefuNames,
|
|
||||||
success: (res) => {
|
|
||||||
const kefu = kefu_list[res.tapIndex];
|
|
||||||
this.externalConfig = kefu ?? this.externalConfig ?? {};
|
|
||||||
if (kefu.isOfficial) {
|
|
||||||
uni.openCustomerServiceConversation({
|
|
||||||
sessionFrom: 'weapp',
|
|
||||||
showMessageCard: true
|
|
||||||
});
|
|
||||||
} else if (kefu.id === 'custom-kefu') {
|
|
||||||
this.handleCustomerClick();
|
|
||||||
} else if (kefu.id === 'qyweixin-kefu') {
|
|
||||||
this.handleQyWeixinKefuClick();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 强制刷新配置(支持传入外部配置)
|
* 强制刷新配置(支持传入外部配置)
|
||||||
* @param {Object} externalConfig 外部最新配置
|
* @param {Object} externalConfig 外部最新配置
|
||||||
@@ -83,28 +28,29 @@ class CustomerService {
|
|||||||
return this.latestPlatformConfig;
|
return this.latestPlatformConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 优先级:外部传入的最新配置 > vuex配置 > 空对象
|
// 优先级:外部传入 > vuex store > 空对象
|
||||||
const servicerConfig = this.externalConfig || this.vm.$store.state.servicerConfig || {};
|
const servicerConfig = this.externalConfig || this.vm.$store.state.servicerConfig || {};
|
||||||
console.log(`【实时客服配置】`, servicerConfig);
|
console.log(`【实时客服配置】`, servicerConfig);
|
||||||
|
|
||||||
let platformConfig = null;
|
let platformConfig = null;
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
platformConfig = servicerConfig.h5 ? (typeof servicerConfig.h5 === 'object' ? servicerConfig.h5 : null) : null;
|
platformConfig = servicerConfig.h5 && typeof servicerConfig.h5 === 'object' ? servicerConfig.h5 : null;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
platformConfig = servicerConfig.weapp ? (typeof servicerConfig.weapp === 'object' ? servicerConfig.weapp : null) : null;
|
platformConfig = servicerConfig.weapp && typeof servicerConfig.weapp === 'object' ? servicerConfig.weapp : null;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP-ALIPAY
|
// #ifdef MP-ALIPAY
|
||||||
platformConfig = servicerConfig.aliapp ? (typeof servicerConfig.aliapp === 'object' ? servicerConfig.aliapp : null) : null;
|
platformConfig = servicerConfig.aliapp && typeof servicerConfig.aliapp === 'object' ? servicerConfig.aliapp : null;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef PC
|
// #ifdef PC
|
||||||
platformConfig = servicerConfig.pc ? (typeof servicerConfig.pc === 'object' ? servicerConfig.pc : null) : null;
|
platformConfig = servicerConfig.pc && typeof servicerConfig.pc === 'object' ? servicerConfig.pc : null;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// 处理空数组情况(你的配置中pc/aliapp是空数组,转为null)
|
// 防止空数组被当作有效配置
|
||||||
if (Array.isArray(platformConfig)) {
|
if (Array.isArray(platformConfig)) {
|
||||||
platformConfig = null;
|
platformConfig = null;
|
||||||
}
|
}
|
||||||
@@ -144,32 +90,18 @@ class CustomerService {
|
|||||||
warnings: []
|
warnings: []
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!config) {
|
if (!config || !config.type) {
|
||||||
result.isValid = false;
|
|
||||||
result.errors.push('客服配置不存在');
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.type === 'aikefu') {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!config.type) {
|
|
||||||
result.isValid = false;
|
result.isValid = false;
|
||||||
result.errors.push('客服类型未配置');
|
result.errors.push('客服类型未配置');
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.type === 'wxwork') {
|
if (config.type === 'wxwork') {
|
||||||
if (!wxworkConfig) {
|
if (!wxworkConfig || !wxworkConfig.enable) {
|
||||||
result.isValid = false;
|
result.warnings.push('企业微信未启用');
|
||||||
result.errors.push('企业微信配置不存在');
|
}
|
||||||
} else {
|
if (!wxworkConfig.contact_url) {
|
||||||
if (!wxworkConfig.enable) {
|
result.warnings.push('企业微信活码链接未配置');
|
||||||
result.warnings.push('企业微信功能未启用');
|
|
||||||
}
|
|
||||||
if (!wxworkConfig.contact_url) {
|
|
||||||
result.warnings.push('企业微信活码链接未配置,将使用原有客服方式');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,16 +109,39 @@ class CustomerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转到AI客服页面
|
* 跳转到 AI 客服页面(Dify)
|
||||||
*/
|
*/
|
||||||
openAIKeFuService() {
|
openDifyService() {
|
||||||
const vm = this.vm;
|
try {
|
||||||
vm.$util.redirectTo(vm.$util.AI_CHAT_PAGE_URL);
|
// 清除未读数(如果存在)
|
||||||
|
if (typeof this.vm.setAiUnreadCount === 'function') {
|
||||||
|
this.vm.setAiUnreadCount(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ✅ 修正路径:必须与 pages.json 中注册的路径一致
|
||||||
|
const aiChatUrl = '/pages_tool/ai-chat/index';
|
||||||
|
|
||||||
|
// ✅ 使用 navigateTo 保留返回栈(体验更好)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: aiChatUrl,
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('跳转 AI 客服失败:', err);
|
||||||
|
// H5 兜底
|
||||||
|
// #ifdef H5
|
||||||
|
window.location.href = aiChatUrl;
|
||||||
|
// #endif
|
||||||
|
uni.showToast({ title: '打开客服失败', icon: 'none' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.error('跳转 AI 客服异常:', e);
|
||||||
|
uni.showToast({ title: '打开客服失败', icon: 'none' });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理客服点击事件
|
* 处理客服点击事件(统一入口)
|
||||||
* @param {Object} options 选项参数
|
* @param {Object} options 选项参数(用于消息卡片等)
|
||||||
*/
|
*/
|
||||||
handleCustomerClick(options = {}) {
|
handleCustomerClick(options = {}) {
|
||||||
const validation = this.validateConfig();
|
const validation = this.validateConfig();
|
||||||
@@ -201,51 +156,61 @@ class CustomerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const config = this.getPlatformConfig();
|
const config = this.getPlatformConfig();
|
||||||
const { niushop = {}, sendMessageTitle = '', sendMessagePath = '', sendMessageImg = '' } = options || {};
|
console.log('【当前客服配置】', config);
|
||||||
|
console.log('【客服类型】', config.type);
|
||||||
|
|
||||||
|
const { niushop = {}, sendMessageTitle = '', sendMessagePath = '', sendMessageImg = '' } = options;
|
||||||
|
|
||||||
if (config.type === 'none') {
|
if (config.type === 'none') {
|
||||||
this.showNoServicePopup();
|
this.showNoServicePopup();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 核心分支:根据最新的type处理
|
// 核心路由:根据 type 决定行为
|
||||||
switch (config.type) {
|
switch (config.type) {
|
||||||
case 'aikefu':
|
case 'aikefu':
|
||||||
this.openAIKeFuService();
|
console.log('【跳转 AI 客服】目标路径: /pages_tool/ai-chat/index');
|
||||||
|
this.openDifyService();
|
||||||
break;
|
break;
|
||||||
case 'wxwork':
|
case 'wxwork':
|
||||||
|
console.log('【跳转企业微信客服】');
|
||||||
this.openWxworkService(false, config, options);
|
this.openWxworkService(false, config, options);
|
||||||
break;
|
break;
|
||||||
case 'third':
|
case 'third':
|
||||||
|
console.log('【跳转第三方客服】');
|
||||||
|
this.openThirdService(config);
|
||||||
|
break;
|
||||||
|
case 'miniprogram':
|
||||||
|
console.log('【跳转第三方小程序客服】');
|
||||||
this.openThirdService(config);
|
this.openThirdService(config);
|
||||||
break;
|
break;
|
||||||
case 'niushop':
|
case 'niushop':
|
||||||
|
console.log('【跳转牛商客服】');
|
||||||
this.openNiushopService(niushop);
|
this.openNiushopService(niushop);
|
||||||
break;
|
break;
|
||||||
case 'weapp':
|
case 'weapp':
|
||||||
|
console.log('【跳转微信官方客服】');
|
||||||
this.openWeappService(config, options);
|
this.openWeappService(config, options);
|
||||||
break;
|
break;
|
||||||
case 'aliapp':
|
case 'aliapp':
|
||||||
|
console.log('【跳转支付宝客服】');
|
||||||
this.openAliappService(config);
|
this.openAliappService(config);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
console.error('【未知客服类型】', config.type);
|
||||||
this.makePhoneCall();
|
this.makePhoneCall();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// ================== 各类型客服实现 ==================
|
||||||
* 打开企业微信客服
|
|
||||||
* @param {boolean} useOriginalService 是否使用原有客服方式
|
|
||||||
* @param {Object} servicerConfig 客服配置
|
|
||||||
* @param {Object} options 选项参数
|
|
||||||
*/
|
|
||||||
openWxworkService(useOriginalService = false, servicerConfig = null, options = {}) {
|
openWxworkService(useOriginalService = false, servicerConfig = null, options = {}) {
|
||||||
const config = servicerConfig || this.getPlatformConfig();
|
const config = servicerConfig || this.getPlatformConfig();
|
||||||
const wxworkConfig = this.getWxworkConfig();
|
const wxworkConfig = this.getWxworkConfig();
|
||||||
const { sendMessageTitle = '', sendMessagePath = '', sendMessageImg = '' } = options || {};
|
const { sendMessageTitle = '', sendMessagePath = '', sendMessageImg = '' } = options;
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
if (wxworkConfig?.enable && wxworkConfig?.contact_url && !useOriginalService) {
|
if (!useOriginalService && wxworkConfig?.enable && wxworkConfig?.contact_url) {
|
||||||
wx.navigateToMiniProgram({
|
wx.navigateToMiniProgram({
|
||||||
appId: 'wxeb490c6f9b154ef9',
|
appId: 'wxeb490c6f9b154ef9',
|
||||||
path: `pages/contacts/externalContactDetail?url=${encodeURIComponent(wxworkConfig.contact_url)}`,
|
path: `pages/contacts/externalContactDetail?url=${encodeURIComponent(wxworkConfig.contact_url)}`,
|
||||||
@@ -256,9 +221,16 @@ class CustomerService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// 检查是否有企业微信配置
|
||||||
|
if (!config.wxwork_url && !config.corpid) {
|
||||||
|
console.error('企业微信配置不完整,缺少 wxwork_url 或 corpid');
|
||||||
|
uni.showToast({ title: '企业微信配置不完整', icon: 'none' });
|
||||||
|
this.fallbackToPhoneCall();
|
||||||
|
return;
|
||||||
|
}
|
||||||
wx.openCustomerServiceChat({
|
wx.openCustomerServiceChat({
|
||||||
extInfo: { url: config.wxwork_url },
|
extInfo: { url: config.wxwork_url || '' },
|
||||||
corpId: config.corpid,
|
corpId: config.corpid || '',
|
||||||
showMessageCard: true,
|
showMessageCard: true,
|
||||||
sendMessageTitle,
|
sendMessageTitle,
|
||||||
sendMessagePath,
|
sendMessagePath,
|
||||||
@@ -268,227 +240,181 @@ class CustomerService {
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
if (wxworkConfig?.enable && wxworkConfig?.contact_url) {
|
if (!useOriginalService && wxworkConfig?.enable && wxworkConfig?.contact_url) {
|
||||||
window.location.href = wxworkConfig.contact_url;
|
window.location.href = wxworkConfig.contact_url;
|
||||||
} else if (config.wxwork_url) {
|
} else if (config.wxwork_url) {
|
||||||
location.href = config.wxwork_url;
|
window.location.href = config.wxwork_url;
|
||||||
} else {
|
} else {
|
||||||
this.fallbackToPhoneCall();
|
this.fallbackToPhoneCall();
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 打开第三方客服
|
|
||||||
* @param {Object} config 客服配置
|
|
||||||
*/
|
|
||||||
openThirdService(config) {
|
openThirdService(config) {
|
||||||
|
console.log('【第三方客服配置】', config);
|
||||||
|
console.log('【配置字段】', Object.keys(config));
|
||||||
|
|
||||||
|
// 支持多种可能的字段名
|
||||||
|
const miniAppId = config.mini_app_id || config.miniAppId || config.appid || config.appId || config.app_id;
|
||||||
|
const miniAppPath = config.mini_app_path || config.miniAppPath || config.path || config.page_path || '';
|
||||||
|
|
||||||
|
console.log('【解析后的小程序配置】AppID:', miniAppId, 'Path:', miniAppPath);
|
||||||
|
|
||||||
|
// 优先处理第三方微信小程序客服
|
||||||
|
if (miniAppId) {
|
||||||
|
console.log('【跳转第三方小程序】AppID:', miniAppId, 'Path:', miniAppPath);
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
wx.navigateToMiniProgram({
|
||||||
|
appId: miniAppId,
|
||||||
|
path: miniAppPath,
|
||||||
|
success: () => {
|
||||||
|
console.log('【跳转第三方小程序成功】');
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('【跳转第三方小程序失败】', err);
|
||||||
|
uni.showToast({ title: '跳转失败,请稍后重试', icon: 'none' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
// #ifdef H5
|
||||||
|
uni.showToast({ title: '第三方小程序客服仅在微信小程序中可用', icon: 'none' });
|
||||||
|
// #endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理第三方链接客服
|
||||||
if (config.third_url) {
|
if (config.third_url) {
|
||||||
|
console.log('【跳转第三方链接】', config.third_url);
|
||||||
|
// #ifdef H5
|
||||||
window.location.href = config.third_url;
|
window.location.href = config.third_url;
|
||||||
|
// #endif
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: config.third_url,
|
||||||
|
success: () => {
|
||||||
|
uni.showToast({ title: '链接已复制,请在浏览器打开', icon: 'none' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
} else {
|
} else {
|
||||||
|
console.error('【第三方客服配置不完整】缺少 mini_app_id 或 third_url');
|
||||||
this.fallbackToPhoneCall();
|
this.fallbackToPhoneCall();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 打开牛商客服
|
|
||||||
* @param {Object} niushop 牛商参数
|
|
||||||
*/
|
|
||||||
openNiushopService(niushop) {
|
openNiushopService(niushop) {
|
||||||
if (Object.keys(niushop).length > 0) {
|
if (Object.keys(niushop).length > 0 && this.vm.$util?.redirectTo) {
|
||||||
this.vm.$util.redirectTo('/pages_tool/chat/room', niushop);
|
this.vm.$util.redirectTo('/pages_tool/chat/room', niushop);
|
||||||
} else {
|
} else {
|
||||||
this.makePhoneCall();
|
this.makePhoneCall();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 打开微信小程序客服
|
|
||||||
* @param {Object} config 客服配置
|
|
||||||
* @param {Object} options 选项参数
|
|
||||||
*/
|
|
||||||
openWeappService(config, options = {}) {
|
openWeappService(config, options = {}) {
|
||||||
if (!this.shouldUseCustomService(config)) {
|
// 如果 useOfficial 为 true 或 undefined,则使用原生系统客服(由 button open-type="contact" 触发)
|
||||||
console.log('使用官方微信小程序客服');
|
// 此方法仅用于自定义跳转(如 useOfficial: false)
|
||||||
|
if (config.useOfficial !== false) {
|
||||||
|
// 不做任何事,应由 <button open-type="contact"> 触发
|
||||||
|
console.log('使用微信官方客服,请确保按钮为 <button open-type="contact">');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('使用自定义微信小程序客服');
|
|
||||||
this.handleCustomWeappService(config, options);
|
this.handleCustomWeappService(config, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理自定义微信小程序客服
|
|
||||||
* @param {Object} config 客服配置
|
|
||||||
* @param {Object} options 选项参数
|
|
||||||
*/
|
|
||||||
handleCustomWeappService(config, options = {}) {
|
handleCustomWeappService(config, options = {}) {
|
||||||
const { sendMessageTitle = '', sendMessagePath = '', sendMessageImg = '' } = options || {};
|
|
||||||
|
|
||||||
if (config.customServiceUrl) {
|
if (config.customServiceUrl) {
|
||||||
let url = config.customServiceUrl;
|
let url = config.customServiceUrl;
|
||||||
const params = [];
|
const params = [];
|
||||||
|
const { sendMessageTitle, sendMessagePath, sendMessageImg } = options;
|
||||||
if (sendMessageTitle) params.push(`title=${encodeURIComponent(sendMessageTitle)}`);
|
if (sendMessageTitle) params.push(`title=${encodeURIComponent(sendMessageTitle)}`);
|
||||||
if (sendMessagePath) params.push(`path=${encodeURIComponent(sendMessagePath)}`);
|
if (sendMessagePath) params.push(`path=${encodeURIComponent(sendMessagePath)}`);
|
||||||
if (sendMessageImg) params.push(`img=${encodeURIComponent(sendMessageImg)}`);
|
if (sendMessageImg) params.push(`img=${encodeURIComponent(sendMessageImg)}`);
|
||||||
|
|
||||||
if (params.length > 0) {
|
if (params.length > 0) {
|
||||||
url += (url.includes('?') ? '&' : '?') + params.join('&');
|
url += (url.includes('?') ? '&' : '?') + params.join('&');
|
||||||
}
|
}
|
||||||
|
uni.navigateTo({ url });
|
||||||
uni.navigateTo({
|
|
||||||
url: url,
|
|
||||||
fail: (err) => {
|
|
||||||
console.error('跳转自定义客服页面失败:', err);
|
|
||||||
this.tryThirdPartyService(config, options);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tryThirdPartyService(config, options);
|
this.tryThirdPartyService(config, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 尝试使用第三方客服
|
|
||||||
* @param {Object} config 客服配置
|
|
||||||
* @param {Object} options 选项参数
|
|
||||||
*/
|
|
||||||
tryThirdPartyService(config, options = {}) {
|
tryThirdPartyService(config, options = {}) {
|
||||||
if (config.thirdPartyServiceUrl) {
|
// 支持第三方微信小程序客服
|
||||||
// #ifdef H5
|
if (config.thirdPartyMiniAppId || config.mini_app_id) {
|
||||||
window.open(config.thirdPartyServiceUrl, '_blank');
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
if (config.thirdPartyMiniAppId) {
|
wx.navigateToMiniProgram({
|
||||||
wx.navigateToMiniProgram({
|
appId: config.thirdPartyMiniAppId || config.mini_app_id,
|
||||||
appId: config.thirdPartyMiniAppId,
|
path: config.thirdPartyMiniAppPath || config.mini_app_path || ''
|
||||||
path: config.thirdPartyMiniAppPath || '',
|
});
|
||||||
fail: (err) => {
|
|
||||||
console.error('跳转第三方小程序失败:', err);
|
|
||||||
this.fallbackToPhoneCall();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
uni.setClipboardData({
|
|
||||||
data: config.thirdPartyServiceUrl,
|
|
||||||
success: () => {
|
|
||||||
uni.showModal({
|
|
||||||
title: '客服链接已复制',
|
|
||||||
content: '客服链接已复制到剪贴板,请在浏览器中粘贴访问',
|
|
||||||
showCancel: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// #endif
|
// #endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 支持第三方链接客服
|
||||||
|
if (config.thirdPartyServiceUrl || config.third_url) {
|
||||||
|
const serviceUrl = config.thirdPartyServiceUrl || config.third_url;
|
||||||
|
// #ifdef H5
|
||||||
|
window.open(serviceUrl, '_blank');
|
||||||
|
// #endif
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
uni.setClipboardData({ data: serviceUrl });
|
||||||
|
uni.showToast({ title: '客服链接已复制', icon: 'none' });
|
||||||
|
// #endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.fallbackToPhoneCall();
|
this.fallbackToPhoneCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 降级到电话客服
|
|
||||||
*/
|
|
||||||
fallbackToPhoneCall() {
|
|
||||||
uni.showModal({
|
|
||||||
title: '联系客服',
|
|
||||||
content: '在线客服暂时不可用,是否拨打电话联系客服?',
|
|
||||||
success: (res) => {
|
|
||||||
if (res.confirm) {
|
|
||||||
this.makePhoneCall();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 打开支付宝小程序客服
|
|
||||||
* @param {Object} config 客服配置
|
|
||||||
*/
|
|
||||||
openAliappService(config) {
|
openAliappService(config) {
|
||||||
console.log('支付宝小程序客服', config);
|
if (config.type === 'aikefu') {
|
||||||
switch (config.type) {
|
this.openDifyService();
|
||||||
case 'aikefu':
|
} else if (config.type === 'third') {
|
||||||
this.openAIKeFuService();
|
this.openThirdService(config);
|
||||||
break;
|
} else {
|
||||||
case 'third':
|
// 支付宝原生客服由 button open-type="contact" 触发,此处不处理
|
||||||
this.openThirdService(config);
|
console.log('使用支付宝官方客服');
|
||||||
break;
|
|
||||||
default:
|
|
||||||
console.log('使用支付宝官方客服');
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// ================== 辅助方法 ==================
|
||||||
* 拨打电话
|
|
||||||
*/
|
|
||||||
makePhoneCall(mobileNumber) {
|
|
||||||
if (mobileNumber) {
|
|
||||||
return uni.makePhoneCall({
|
|
||||||
phoneNumber: mobileNumber
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 从缓存中获取电话信息
|
makePhoneCall() {
|
||||||
uni.getStorage({
|
this.vm.$api.sendRequest({
|
||||||
key: 'shopInfo',
|
url: '/api/site/shopcontact',
|
||||||
success: (res) => {
|
success: res => {
|
||||||
const shopInfo = res.data;
|
if (res.code === 0 && res.data?.mobile) {
|
||||||
const mobile = shopInfo?.mobile ?? '';
|
uni.makePhoneCall({ phoneNumber: res.data.mobile });
|
||||||
if (mobile) {
|
|
||||||
uni.makePhoneCall({
|
|
||||||
phoneNumber: mobile
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({ title: '暂无客服电话', icon: 'none' });
|
||||||
title: '暂无客服电话',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
uni.showToast({ title: '获取客服电话失败', icon: 'none' });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 显示无客服弹窗
|
|
||||||
*/
|
|
||||||
showNoServicePopup() {
|
showNoServicePopup() {
|
||||||
const siteInfo = this.vm.$store.state.siteInfo || {};
|
const siteInfo = this.vm.$store.state.siteInfo || {};
|
||||||
const message = siteInfo?.site_tel
|
const message = siteInfo?.site_tel
|
||||||
? `请联系客服,客服电话是${siteInfo.site_tel}`
|
? `请联系客服,客服电话是 ${siteInfo.site_tel}`
|
||||||
: '抱歉,商家暂无客服,请线下联系';
|
: '抱歉,商家暂无客服,请线下联系';
|
||||||
|
uni.showModal({ title: '联系客服', content: message, showCancel: false });
|
||||||
uni.showModal({
|
|
||||||
title: '联系客服',
|
|
||||||
content: message,
|
|
||||||
showCancel: false
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 显示配置错误弹窗
|
|
||||||
* @param {Array} errors 错误列表
|
|
||||||
*/
|
|
||||||
showConfigErrorPopup(errors) {
|
showConfigErrorPopup(errors) {
|
||||||
const message = errors.join('\n');
|
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '配置错误',
|
title: '客服配置错误',
|
||||||
content: `客服配置有误:\n${message}`,
|
content: `配置有误:\n${errors.join('\n')}`,
|
||||||
showCancel: false
|
showCancel: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 降级处理:使用原有客服方式
|
|
||||||
*/
|
|
||||||
fallbackToOriginalService() {
|
fallbackToOriginalService() {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '无法直接添加企业微信客服,是否使用其他方式联系客服?',
|
content: '无法直接添加企业微信,是否使用其他方式联系客服?',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
this.openWxworkService(true);
|
this.openWxworkService(true);
|
||||||
@@ -497,9 +423,19 @@ class CustomerService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fallbackToPhoneCall() {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '在线客服不可用,是否拨打电话联系客服?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) this.makePhoneCall();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取客服按钮配置
|
* 获取按钮配置(用于 template 中 v-if / open-type 判断)
|
||||||
* @returns {Object} 按钮配置
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
getButtonConfig() {
|
getButtonConfig() {
|
||||||
const config = this.getPlatformConfig();
|
const config = this.getPlatformConfig();
|
||||||
@@ -507,39 +443,24 @@ class CustomerService {
|
|||||||
|
|
||||||
let openType = '';
|
let openType = '';
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
if (config.type === 'weapp') {
|
if (config.type === 'weapp' && config.useOfficial !== false) {
|
||||||
openType = config.useOfficial !== false ? 'contact' : '';
|
openType = 'contact';
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP-ALIPAY
|
// #ifdef MP-ALIPAY
|
||||||
if (config.type === 'aliapp') openType = 'contact';
|
if (config.type === 'aliapp') openType = 'contact';
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
return { ...config, openType };
|
return { ...config, openType };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断是否应该使用自定义客服处理
|
|
||||||
* @param {Object} config 客服配置
|
|
||||||
* @returns {boolean} 是否使用自定义客服
|
|
||||||
*/
|
|
||||||
shouldUseCustomService(config) {
|
|
||||||
// #ifdef MP-WEIXIN
|
|
||||||
if (config?.type === 'weapp') {
|
|
||||||
return config.useOfficial === false;
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建客服服务实例
|
* 创建客服服务实例
|
||||||
* @param {Object} vueInstance Vue实例
|
* @param {Object} vueInstance Vue 实例(通常是 this)
|
||||||
* @param {Object} externalConfig 外部最新配置
|
* @param {Object} externalConfig 可选:外部传入的最新配置(如从 DIY 数据中提取)
|
||||||
* @returns {CustomerService} 客服服务实例
|
* @returns {CustomerService}
|
||||||
*/
|
*/
|
||||||
export function createCustomerService(vueInstance, externalConfig = {}) {
|
export function createCustomerService(vueInstance, externalConfig = null) {
|
||||||
return new CustomerService(vueInstance, externalConfig);
|
return new CustomerService(vueInstance, externalConfig);
|
||||||
}
|
}
|
||||||
@@ -30,12 +30,12 @@ function processRoutePath(route) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ---- 处理页面目录映射 <end>----
|
// ---- 处理页面目录映射 <end>----
|
||||||
|
|
||||||
// 去掉pages目录,只保留子目录
|
// 去掉pages目录,只保留子目录
|
||||||
if (routeParts[0] === 'pages') {
|
if (routeParts[0] === 'pages') {
|
||||||
routeParts = routeParts.slice(1);
|
routeParts = routeParts.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return routeParts.join("/");
|
return routeParts.join("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,14 +54,6 @@ function loadLangPackSync(lang, path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得当前本地语言
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
function getCurrentLocale() {
|
|
||||||
return uni.getStorageSync('lang') || "zh-cn";
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
langList: langConfig.langList,
|
langList: langConfig.langList,
|
||||||
|
|
||||||
@@ -69,7 +61,9 @@ export default {
|
|||||||
* 获得当前本地语言
|
* 获得当前本地语言
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
getCurrentLocale,
|
getCurrentLocale() {
|
||||||
|
return uni.getStorageSync('lang') || "zh-cn";
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* * 解析多语言
|
* * 解析多语言
|
||||||
@@ -79,7 +73,7 @@ export default {
|
|||||||
let _page = getCurrentPages()[getCurrentPages().length - 1];
|
let _page = getCurrentPages()[getCurrentPages().length - 1];
|
||||||
if (!_page) return;
|
if (!_page) return;
|
||||||
|
|
||||||
const locale = getCurrentLocale(); // 获得当前本地语言
|
const locale = this.getCurrentLocale(); // 获得当前本地语言
|
||||||
|
|
||||||
let value = ''; // 存放解析后的语言值
|
let value = ''; // 存放解析后的语言值
|
||||||
let langPath = ''; // 存放当前页面语言包路径
|
let langPath = ''; // 存放当前页面语言包路径
|
||||||
@@ -87,11 +81,11 @@ export default {
|
|||||||
try {
|
try {
|
||||||
//公共语言包(同步加载)
|
//公共语言包(同步加载)
|
||||||
var lang = loadLangPackSync(locale, 'common');
|
var lang = loadLangPackSync(locale, 'common');
|
||||||
|
|
||||||
//当前页面语言包(同步加载)
|
//当前页面语言包(同步加载)
|
||||||
let route = _page.route;
|
let route = _page.route;
|
||||||
langPath = processRoutePath(route);
|
langPath = processRoutePath(route);
|
||||||
|
|
||||||
// 加载当前页面语言包
|
// 加载当前页面语言包
|
||||||
let currentPageLang = loadLangPackSync(locale, langPath);
|
let currentPageLang = loadLangPackSync(locale, langPath);
|
||||||
|
|
||||||
@@ -116,7 +110,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
value = mergedLang[field] !== undefined ? mergedLang[field] : field;
|
value = mergedLang[field] !== undefined ? mergedLang[field] : field;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('解析语言包失败:', e, { langPath, field, locale });
|
console.error('解析语言包失败:', e, { langPath, field, locale });
|
||||||
value = field;
|
value = field;
|
||||||
@@ -132,7 +126,7 @@ export default {
|
|||||||
|
|
||||||
// 多语言调试,注释后可以关闭控制台输出
|
// 多语言调试,注释后可以关闭控制台输出
|
||||||
if (field == value) {
|
if (field == value) {
|
||||||
console.warn(`警告: 字段 ${field} 在语言包 ${langPath} 中未找到对应值,使用默认值 ${field} 当前语言: ${locale}`);
|
console.warn(`警告: 字段 ${field} 在语言包 ${langPath} 中未找到对应值,使用默认值 ${field} 当前语言: ${locale}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
@@ -147,7 +141,7 @@ export default {
|
|||||||
if (!_page) return;
|
if (!_page) return;
|
||||||
|
|
||||||
uni.setStorageSync("lang", value);
|
uni.setStorageSync("lang", value);
|
||||||
const locale = getCurrentLocale();
|
const locale = this.getCurrentLocale();
|
||||||
|
|
||||||
// 清空已加载的语言包缓存
|
// 清空已加载的语言包缓存
|
||||||
for (let key in loadedLangPacks) {
|
for (let key in loadedLangPacks) {
|
||||||
@@ -167,8 +161,8 @@ export default {
|
|||||||
let _page = getCurrentPages()[getCurrentPages().length - 1];
|
let _page = getCurrentPages()[getCurrentPages().length - 1];
|
||||||
if (!_page) return;
|
if (!_page) return;
|
||||||
|
|
||||||
const locale = getCurrentLocale();
|
const locale = this.getCurrentLocale();
|
||||||
|
|
||||||
this.title(this.lang("title"));
|
this.title(this.lang("title"));
|
||||||
|
|
||||||
//设置tabbar的文字语言
|
//设置tabbar的文字语言
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,43 +1,57 @@
|
|||||||
<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: fixBtnShow ? '400rpx' : '320rpx',
|
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 v-if="isLanguageSwitchEnabled && fixBtnShow" class="btn-item common-bg" @click="toggleLanguage">
|
<view
|
||||||
|
v-if="isLanguageSwitchEnabled && fixBtnShow"
|
||||||
|
class="btn-item common-bg"
|
||||||
|
@click="toggleLanguage"
|
||||||
|
>
|
||||||
<text>{{ currentLangDisplayName }}</text>
|
<text>{{ currentLangDisplayName }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- AI 智能助手 -->
|
|
||||||
<view v-if="fixBtnShow && enableAIChat" class="btn-item common-bg" @click="openAIChat"
|
|
||||||
:style="{ backgroundImage: aiAgentimg ? `url(${aiAgentimg})` : '', backgroundSize: '100% 100%' }">
|
|
||||||
<text class="ai-icon" v-if="!aiAgentimg">🤖</text>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 微信小程序客服按钮 -->
|
|
||||||
<!-- #ifdef MP-WEIXIN -->
|
|
||||||
<button class="btn-item common-bg" hoverClass="none" openType="contact" sessionFrom="weapp" showMessageCard="true"
|
|
||||||
:style="[{ backgroundImage: kefuimg ? `url(${kefuimg})` : '', backgroundSize: '100% 100%' }, customButtonStyle]">
|
|
||||||
<text class="icox icox-kefu" v-if="!kefuimg"></text>
|
|
||||||
</button>
|
|
||||||
<!-- #endif -->
|
|
||||||
|
|
||||||
<!-- 普通客服(仅当未启用 AI 时显示) -->
|
|
||||||
<!-- #ifdef H5 -->
|
|
||||||
<template v-if="fixBtnShow">
|
|
||||||
<button class="btn-item common-bg" hoverClass="none" @click="openCustomerSelectPopup"
|
|
||||||
:style="[{ backgroundImage: kefuimg ? `url(${kefuimg})` : '', backgroundSize: '100% 100%' }, customButtonStyle]">
|
|
||||||
<text class="icox icox-kefu" v-if="!kefuimg"></text>
|
|
||||||
</button>
|
|
||||||
</template>
|
|
||||||
<!-- #endif -->
|
|
||||||
|
|
||||||
<!-- 电话按钮(始终显示) -->
|
<!-- 电话按钮(始终显示) -->
|
||||||
<view v-if="fixBtnShow" class="btn-item common-bg" @click="call()"
|
<view
|
||||||
:style="[{ backgroundImage: phoneimg ? `url(${phoneimg})` : '', backgroundSize: '100% 100%' }, customButtonStyle]">
|
v-if="fixBtnShow"
|
||||||
|
class="btn-item common-bg"
|
||||||
|
@click="call()"
|
||||||
|
: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>
|
||||||
|
|
||||||
@@ -56,16 +70,18 @@ export default {
|
|||||||
return {
|
return {
|
||||||
pageCount: 0,
|
pageCount: 0,
|
||||||
fixBtnShow: true,
|
fixBtnShow: true,
|
||||||
|
|
||||||
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: {
|
||||||
// 安全读取 shopInfo 中的字段,避免 undefined 报错
|
|
||||||
bgUrl() {
|
bgUrl() {
|
||||||
return this.shopInfo?.bgUrl || '';
|
return this.shopInfo?.bgUrl || '';
|
||||||
},
|
},
|
||||||
@@ -73,10 +89,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 || '';
|
||||||
@@ -84,9 +100,6 @@ export default {
|
|||||||
isLanguageSwitchEnabled() {
|
isLanguageSwitchEnabled() {
|
||||||
return !!this.shopInfo?.ischina;
|
return !!this.shopInfo?.ischina;
|
||||||
},
|
},
|
||||||
enableAIChat() {
|
|
||||||
return !!this.shopInfo?.enableAIChat;
|
|
||||||
},
|
|
||||||
currentLangDisplayName() {
|
currentLangDisplayName() {
|
||||||
const lang = this.langIndexMap[this.currentLangIndex];
|
const lang = this.langIndexMap[this.currentLangIndex];
|
||||||
return lang === 'zh-cn' ? 'EN' : 'CN';
|
return lang === 'zh-cn' ? 'EN' : 'CN';
|
||||||
@@ -96,30 +109,87 @@ export default {
|
|||||||
},
|
},
|
||||||
customButtonStyle() {
|
customButtonStyle() {
|
||||||
return this.shopInfo?.floatingButton?.button || {};
|
return this.shopInfo?.floatingButton?.button || {};
|
||||||
|
},
|
||||||
|
unreadCount() {
|
||||||
|
return this. $store.state.aiUnreadCount || 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
// ✅ 新增:根据当前客服类型动态返回图标
|
||||||
|
currentKefuImg() {
|
||||||
|
if (!this.shopInfo) return '';
|
||||||
|
|
||||||
|
const customerService = createCustomerService(this);
|
||||||
|
const config = customerService.getPlatformConfig();
|
||||||
|
|
||||||
|
if (config?.type === 'aikefu') {
|
||||||
|
return this.aiAgentimg;
|
||||||
|
} else if (config?.type === 'wxwork' || config?.type === 'qyweixin') {
|
||||||
|
// 企业微信客服专用图标
|
||||||
|
return this.aiAgentimg;
|
||||||
|
}
|
||||||
|
// 默认客服图标
|
||||||
|
return this.kefuimg;
|
||||||
|
},
|
||||||
|
// ✅ 新增:判断是否为微信官方客服
|
||||||
|
isWeappOfficialKefu() {
|
||||||
|
if (!this.shopInfo) return false;
|
||||||
|
const customerService = createCustomerService(this);
|
||||||
|
const config = customerService.getPlatformConfig();
|
||||||
|
return config?.type === 'weapp';
|
||||||
|
},
|
||||||
|
// ✅ 新增:判断是否需要同时显示小程序系统客服
|
||||||
|
showWeappSystemKefu() {
|
||||||
|
if (!this.shopInfo) return false;
|
||||||
|
const customerService = createCustomerService(this);
|
||||||
|
const config = customerService.getPlatformConfig();
|
||||||
|
// 检查附加设置是否开启了同时显示小程序系统客服,且当前客服类型不是小程序系统客服
|
||||||
|
return (config?.show_system_service === true || config?.show_system_service === '1') && config?.type !== 'weapp';
|
||||||
|
},
|
||||||
|
//根据显示的按钮数量动态计算容器高度
|
||||||
|
containerHeight() {
|
||||||
|
if (!this.fixBtnShow) return '320rpx';
|
||||||
|
|
||||||
|
let buttonCount = 1;
|
||||||
|
if (this.isLanguageSwitchEnabled) buttonCount++;
|
||||||
|
if (this.showWeappSystemKefu) buttonCount++;
|
||||||
|
buttonCount++;
|
||||||
|
const totalRpx = 94 * buttonCount - 14;
|
||||||
|
const pxValue = Math.round(totalRpx * 0.5);
|
||||||
|
|
||||||
|
return ` $ {pxValue}px`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
shopInfo: {
|
||||||
|
handler(newVal) {
|
||||||
|
// 可在此添加额外逻辑(如埋点、通知等),当前无需操作
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.customerService = createCustomerService(this);
|
|
||||||
this.initLanguage();
|
this.initLanguage();
|
||||||
|
this.pageCount = getCurrentPages().length;
|
||||||
|
|
||||||
uni.getStorage({
|
uni.getStorage({
|
||||||
key: 'shopInfo',
|
key: 'shopInfo',
|
||||||
success: (e) => {
|
success: (e) => {
|
||||||
|
console.log('【调试】当前 shopInfo:', e.data);
|
||||||
this.shopInfo = e.data;
|
this.shopInfo = e.data;
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
console.warn('未获取到 shopInfo,使用默认设置');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
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 = this.$langConfig.getCurrentLocale();
|
const savedLang = uni.getStorageSync('lang');
|
||||||
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) {
|
||||||
@@ -131,43 +201,118 @@ export default {
|
|||||||
this.currentLangIndex = 0;
|
this.currentLangIndex = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* 电话联系客服
|
|
||||||
*/
|
|
||||||
call() {
|
call() {
|
||||||
this.customerService.makePhoneCall(this.tel);
|
if (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);
|
||||||
|
|
||||||
// 调用语言切换逻辑(设置 storage + 清空缓存)
|
if (uni.getSystemInfoSync().platform === 'browser') {
|
||||||
this.$langConfig.change(targetLang);
|
setTimeout(() => {
|
||||||
|
window.location.reload();
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
// ✅ 核心方法:统一客服入口
|
||||||
* 打开 AI 智能助手
|
handleUnifiedKefuClick() {
|
||||||
*/
|
const customerService = createCustomerService(this);
|
||||||
openAIChat() {
|
const validation = customerService.validateConfig();
|
||||||
this.$util.redirectTo(this.$util.AI_CHAT_PAGE_URL);
|
|
||||||
|
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);
|
||||||
openCustomerSelectPopup() {
|
uni.showActionSheet({
|
||||||
this.customerService.openCustomerSelectPopupDialog();
|
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 lang="scss" scoped>
|
<style scoped>
|
||||||
.fixed-box {
|
.fixed-box {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 0rpx;
|
right: 0rpx;
|
||||||
@@ -188,27 +333,16 @@ 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: 40rpx;
|
|
||||||
width: 80rpx;
|
width: 80rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
padding: 0;
|
background: #fff;
|
||||||
overflow: hidden;
|
border-radius: 50%;
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
@@ -223,6 +357,7 @@ 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;
|
||||||
@@ -236,7 +371,21 @@ 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;
|
||||||
|
|||||||
30
pages.json
30
pages.json
@@ -321,12 +321,6 @@
|
|||||||
"navigationBarTitleText": "AI 客服"
|
"navigationBarTitleText": "AI 客服"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"path": "agreement/contenr",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "vr/index",
|
"path": "vr/index",
|
||||||
"style": {
|
"style": {
|
||||||
@@ -918,22 +912,16 @@
|
|||||||
},
|
},
|
||||||
//******************文件模块******************
|
//******************文件模块******************
|
||||||
{
|
{
|
||||||
"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,159 +1,167 @@
|
|||||||
<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>
|
||||||
|
|
||||||
<!-- <view class="page-header" v-if="diyData.global && diyData.global.navBarSwitch" :style="{ backgroundImage: bgImg }">
|
<diy-index-page v-if="topIndexValue" ref="indexPage" :value="topIndexValue" :bgUrl="safeBgUrl"
|
||||||
<ns-navbar :title-color="textNavColor" :data="diyData.global" :scrollTop="scrollTop" :isBack="false"/>
|
:scrollTop="scrollTop" :diyGlobal="diyData.global" class="diy-index-page">
|
||||||
</view> -->
|
<template v-slot:components>
|
||||||
|
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop"
|
||||||
|
:haveTopCategory="true" :followOfficialAccount="followOfficialAccount" />
|
||||||
|
</template>
|
||||||
|
<template v-slot:default>
|
||||||
|
<ns-copyright v-show="isShowCopyRight" />
|
||||||
|
</template>
|
||||||
|
</diy-index-page>
|
||||||
|
|
||||||
<diy-index-page v-if="topIndexValue" ref="indexPage" :value="topIndexValue" :bgUrl="bgUrl"
|
<view v-else class="bg-index"
|
||||||
:scrollTop="scrollTop" :diyGlobal="diyData.global" class="diy-index-page">
|
:style="{ backgroundImage: backgroundUrlStyle, paddingTop: paddingTop, marginTop: marginTop }">
|
||||||
<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"
|
:followOfficialAccount="followOfficialAccount" />
|
||||||
:haveTopCategory="true" :followOfficialAccount="followOfficialAccount" />
|
<ns-copyright v-show="isShowCopyRight" />
|
||||||
</template>
|
</view>
|
||||||
<template v-slot:default>
|
|
||||||
<ns-copyright v-show="isShowCopyRight" />
|
|
||||||
</template>
|
|
||||||
</diy-index-page>
|
|
||||||
|
|
||||||
<view v-else class="bg-index"
|
<template v-if="adv.advshow != -1">
|
||||||
:style="{ backgroundImage: backgroundUrl, paddingTop: paddingTop, marginTop: marginTop }">
|
<view @touchmove.prevent.stop>
|
||||||
<diy-group ref="diyGroup" v-if="diyData.value" :diyData="diyData" :scrollTop="scrollTop"
|
<uni-popup ref="uniPopupWindow" type="center" class="wap-floating" :maskClick="false">
|
||||||
:followOfficialAccount="followOfficialAccount" />
|
<view class="small-bot">
|
||||||
<ns-copyright v-show="isShowCopyRight" />
|
<swiper autoplay="true" :circular="true" indicator-active-color="#fff"
|
||||||
</view>
|
indicator-color="rgba(255,255,255,0.6)" :indicator-dots="true" interval="3000">
|
||||||
|
<swiper-item v-for="(item, index) in adv.list" :key="index">
|
||||||
|
<image class="slide-image" @click="$util.diyRedirectTo(item.link)" height="100%"
|
||||||
|
:src="$util.img(item.imageUrl)" width="100%"></image>
|
||||||
|
</swiper-item>
|
||||||
|
</swiper>
|
||||||
|
<view class="small-bot-close" @click="closePopupWindow">
|
||||||
|
<i class="iconfont icon-round-close" style="color:#fff"></i>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template v-if="adv.advshow != -1">
|
<!-- 底部tabBar -->
|
||||||
<view @touchmove.prevent.stop>
|
<view class="page-bottom" v-if="openBottomNav">
|
||||||
<uni-popup ref="uniPopupWindow" type="center" class="wap-floating" :maskClick="false">
|
<diy-bottom-nav @callback="callback" :name="name" />
|
||||||
<view class="small-bot">
|
</view>
|
||||||
<!-- <view class="adver-time" wx:if="{{startadv.params.style=='default'&&startadv.params.canclose==1}}">
|
|
||||||
<view bindtap="adverclose">跳过</view>
|
|
||||||
<view class="time">{{clock}}s</view>
|
|
||||||
</view>
|
|
||||||
<view class="adver-time" wx:if="{{startadv.params.style=='default'&&startadv.params.canclose==0}}">
|
|
||||||
<view class="time" style="line-height: 64rpx;">{{clock}}s</view>
|
|
||||||
</view> -->
|
|
||||||
<swiper autoplay="true" :circular="true" indicator-active-color="#fff"
|
|
||||||
indicator-color="rgba(255,255,255,0.6)" :indicator-dots="true" interval="3000">
|
|
||||||
<swiper-item v-for="(item, index) in adv.list" :key="index">
|
|
||||||
<image class="slide-image" @click="$util.diyRedirectTo(item.link)" height="100%"
|
|
||||||
:src="$util.img(item.imageUrl)" width="100%"></image>
|
|
||||||
<!-- <image bindtap="adverclose" class="slide-image" height="100%" src="{{item.imgurl}}" width="100%" wx:if="{{item.click==1}}"></image> -->
|
|
||||||
</swiper-item>
|
|
||||||
</swiper>
|
|
||||||
<view bindtap="adverclose" class="small-bot-close" @click="closePopupWindow">
|
|
||||||
<i class="iconfont icon-round-close" style="color:#fff"></i>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- <view class="image-wrap">
|
|
||||||
<swiper class="swiper" style="width:100%;height: 1200rpx;" :autoplay="true" interval="3000" circular="true" :indicator-dots="true" indicator-color="#000" indicator-active-color="red">
|
|
||||||
<swiper-item class="swiper-item" v-for="(item, index) in adv.list" :key="index" v-if="item.imageUrl" @click="$util.diyRedirectTo(item.link)">
|
|
||||||
<view class="item">
|
|
||||||
<image :src="$util.img(item.imageUrl)" mode="aspectFit" :show-menu-by-longpress="true"/>
|
|
||||||
</view>
|
|
||||||
</swiper-item>
|
|
||||||
</swiper>
|
|
||||||
</view>
|
|
||||||
<text class="iconfont icon-round-close" @click="closePopupWindow"></text> -->
|
|
||||||
</uni-popup>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- 底部tabBar -->
|
<!-- 关注公众号弹窗 -->
|
||||||
<view class="page-bottom" v-if="openBottomNav">
|
<view @touchmove.prevent class="official-accounts-inner" v-if="wechatQrcode">
|
||||||
<diy-bottom-nav @callback="callback" :name="name" />
|
<uni-popup ref="officialAccountsPopup" type="center">
|
||||||
</view>
|
<view class="official-accounts-wrap">
|
||||||
|
<image class="content" :src="$util.img(wechatQrcode)" mode="aspectFit"></image>
|
||||||
|
<text class="desc">关注了解更多</text>
|
||||||
|
<text class="close iconfont icon-round-close" @click="officialAccountsClose"></text>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- 关注公众号弹窗 -->
|
<!-- 收藏 -->
|
||||||
<view @touchmove.prevent class="official-accounts-inner" v-if="wechatQrcode">
|
<uni-popup ref="collectPopupWindow" type="top" class="wap-floating wap-floating-collect">
|
||||||
<uni-popup ref="officialAccountsPopup" type="center">
|
<view v-if="showTip" class="collectPopupWindow"
|
||||||
<view class="official-accounts-wrap">
|
:style="{ marginTop: (collectTop + statusBarHeight) * 2 + 'rpx' }">
|
||||||
<image class="content" :src="$util.img(wechatQrcode)" mode="aspectFit"></image>
|
<image :src="$util.img('public/uniapp/index/collect2.png')" mode="aspectFit" />
|
||||||
<text class="desc">关注了解更多</text>
|
<text @click="closeCollectPopupWindow">我知道了</text>
|
||||||
<text class="close iconfont icon-round-close" @click="officialAccountsClose"></text>
|
</view>
|
||||||
</view>
|
</uni-popup>
|
||||||
</uni-popup>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 收藏 -->
|
<!-- 选择门店弹出框 -->
|
||||||
<uni-popup ref="collectPopupWindow" type="top" class="wap-floating wap-floating-collect">
|
<view @touchmove.prevent.stop class="choose-store">
|
||||||
<view v-if="showTip" class="collectPopupWindow"
|
<uni-popup ref="chooseStorePopup" type="center" :maskClick="false" class="choose-store">
|
||||||
:style="{ marginTop: (collectTop + statusBarHeight) * 2 + 'rpx' }">
|
<view class="choose-store-popup">
|
||||||
<image :src="$util.img('public/uniapp/index/collect2.png')" mode="aspectFit" />
|
<view class="head-wrap" @click="closeChooseStorePopup">请确认门店</view>
|
||||||
<text @click="closeCollectPopupWindow">我知道了</text>
|
<view class="position-wrap">
|
||||||
</view>
|
<text class="iconfont icon-dizhi"></text>
|
||||||
</uni-popup>
|
<text class="address">{{ currentPosition }}</text>
|
||||||
|
<view class="reposition" @click="reposition"
|
||||||
<!-- 选择门店弹出框,定位当前位置,展示最近的一个门店 -->
|
v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
||||||
<view @touchmove.prevent.stop class="choose-store">
|
<text class="iconfont icon-dingwei"></text>
|
||||||
<uni-popup ref="chooseStorePopup" type="center" :maskClick="false" class="choose-store">
|
<text>重新定位</text>
|
||||||
<view class="choose-store-popup">
|
</view>
|
||||||
<view class="head-wrap" @click="closeChooseStorePopup">请确认门店</view>
|
</view>
|
||||||
<view class="position-wrap">
|
<view class="store-wrap" v-if="nearestStore">
|
||||||
<text class="iconfont icon-dizhi"></text>
|
<text class="tag">当前门店</text>
|
||||||
<text class="address">{{ currentPosition }}</text>
|
<view class="store-name">{{ nearestStore.store_name }}</view>
|
||||||
<view class="reposition" @click="reposition"
|
<view class="address">{{ nearestStore.show_address }}</view>
|
||||||
v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
<view class="distance" v-if="nearestStore.distance">
|
||||||
<text class="iconfont icon-dingwei"></text>
|
<text class="iconfont icon-dizhi"></text>
|
||||||
<text>重新定位</text>
|
<text>{{ nearestStore.distance > 1 ? nearestStore.distance + 'km' :
|
||||||
</view>
|
nearestStore.distance *
|
||||||
</view>
|
1000 +
|
||||||
<view class="store-wrap" v-if="nearestStore">
|
'm' }}</text>
|
||||||
<text class="tag">当前门店</text>
|
</view>
|
||||||
<view class="store-name">{{ nearestStore.store_name }}</view>
|
</view>
|
||||||
<view class="address">{{ nearestStore.show_address }}</view>
|
<button type="primary" @click="enterStore">确认进入</button>
|
||||||
<view class="distance" v-if="nearestStore.distance">
|
<view class="other-store" @click="chooseOtherStore"
|
||||||
<text class="iconfont icon-dizhi"></text>
|
v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
||||||
<text>{{ nearestStore.distance > 1 ? nearestStore.distance + 'km' :
|
<text>选择其他门店</text>
|
||||||
nearestStore.distance *
|
<text class="iconfont icon-right"></text>
|
||||||
1000 +
|
</view>
|
||||||
'm' }}</text>
|
</view>
|
||||||
</view>
|
</uni-popup>
|
||||||
</view>
|
</view>
|
||||||
<button type="primary" @click="enterStore">确认进入</button>
|
<hover-nav :need="true"></hover-nav>
|
||||||
<view class="other-store" @click="chooseOtherStore"
|
<privacy-popup ref="privacyPopup"></privacy-popup>
|
||||||
v-if="globalStoreConfig && globalStoreConfig.is_allow_change == 1">
|
<to-top v-if="showTop" @toTop="scrollToTopNative()"></to-top>
|
||||||
<text>选择其他门店</text>
|
<ns-login ref="login"></ns-login>
|
||||||
<text class="iconfont icon-right"></text>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
</uni-popup>
|
|
||||||
</view>
|
|
||||||
<hover-nav :need="true"></hover-nav>
|
|
||||||
<!-- 隐私协议 -->
|
|
||||||
<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>
|
||||||
|
|
||||||
|
|
||||||
import diyJs from '@/common/js/diy.js';
|
import diyJs from '@/common/js/diy.js';
|
||||||
import scroll from '@/common/js/scroll-view.js';
|
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 {
|
||||||
|
diyData: { global: {}, value: null },
|
||||||
|
followOfficialAccount: {},
|
||||||
|
wechatQrcode: '',
|
||||||
|
adv: { advshow: -1, list: [] },
|
||||||
|
// ❌ 不要定义 siteInfo、bgUrl,除非你明确知道它们不会冲突
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
// ✅ 安全获取 bgUrl(用于 diy-index-page 的 prop)
|
||||||
|
safeBgUrl() {
|
||||||
|
// 优先取全局配置中的 bgUrl,没有则用组件自己的 bgUrl(如有),否则为空
|
||||||
|
return this.diyData?.global?.bgUrl || this.bgUrl || '';
|
||||||
|
},
|
||||||
|
|
||||||
|
// ✅ 安全生成 background-image 样式字符串(用于 fallback 区域)
|
||||||
|
backgroundUrlStyle() {
|
||||||
|
const url = this.diyData?.global?.bgUrl || this.bgUrl || '';
|
||||||
|
return url ? `url(${url})` : 'none';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 如果你的 mixin 中已经处理了数据加载,这里可以留空
|
||||||
|
// 否则建议在 created/mounted 中初始化默认值或请求数据
|
||||||
|
created() {
|
||||||
|
// 可选:如果 mixin 没有初始化 diyData,这里再兜底一次
|
||||||
|
if (!this.diyData) {
|
||||||
|
this.diyData = { global: {}, value: null };
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -162,85 +170,86 @@ 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;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.swiper ::v-deep .uni-swiper-dots-horizontal {
|
.swiper /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%;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .diy-index-page .uni-popup .uni-popup__wrapper-box {
|
/deep/.diy-index-page .uni-popup .uni-popup__wrapper-box {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .placeholder {
|
/deep/ .placeholder {
|
||||||
height: 0;
|
height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep ::-webkit-scrollbar {
|
/deep/::-webkit-scrollbar {
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
/deep/ .sku-layer .uni-popup__wrapper.uni-custom .uni-popup__wrapper-box {
|
||||||
max-height: unset !important;
|
max-height: unset !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .mescroll-totop {
|
/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>
|
||||||
Reference in New Issue
Block a user