refactor: 替换多页面国际化文本为硬编码中文内容
移除项目内大部分$lang()国际化调用,替换为直接中文文本,统一前端展示文案
This commit is contained in:
@@ -30,7 +30,7 @@ export default {
|
||||
typeof callback == 'function' && callback(this.authInfo);
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: res.message ? res.message : this.$lang('auth.configError')
|
||||
title: res.message ? res.message : '小程序配置错误'
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ export default {
|
||||
typeof callback == 'function' && callback(this.authInfo);
|
||||
} else {
|
||||
this.$util.showToast({
|
||||
title: res.message ? res.message : this.$lang('auth.configError')
|
||||
title: res.message ? res.message : '小程序配置错误'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*/
|
||||
import IMAGE_CONFIG from './image-config.js';
|
||||
import Platform from './platform.js';
|
||||
import lang from './lang.js';
|
||||
|
||||
export class CustomerService {
|
||||
constructor(vueInstance, externalConfig = null) {
|
||||
@@ -101,16 +100,16 @@ export class CustomerService {
|
||||
|
||||
if (!config || !config.type) {
|
||||
result.isValid = false;
|
||||
result.errors.push(lang('customerService.typeNotConfigured'));
|
||||
result.errors.push('客服类型未配置');
|
||||
return result;
|
||||
}
|
||||
|
||||
if (config.type === 'wxwork') {
|
||||
if (!wxworkConfig || !wxworkConfig.enable) {
|
||||
result.warnings.push(lang('customerService.wxworkNotEnabled'));
|
||||
result.warnings.push('企业微信未启用');
|
||||
}
|
||||
if (!wxworkConfig.contact_url) {
|
||||
result.warnings.push(lang('customerService.wxworkContactUrlNotConfigured'));
|
||||
result.warnings.push('企业微信活码链接未配置');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,12 +138,12 @@ export class CustomerService {
|
||||
// #ifdef H5
|
||||
window.location.href = aiChatUrl;
|
||||
// #endif
|
||||
uni.showToast({ title: lang('customerService.openFailed'), icon: 'none' });
|
||||
uni.showToast({ title: '打开客服失败', icon: 'none' });
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('跳转 AI智能客服异常:', e);
|
||||
uni.showToast({ title: lang('customerService.openFailed'), icon: 'none' });
|
||||
uni.showToast({ title: '打开客服失败', icon: 'none' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +223,7 @@ export class CustomerService {
|
||||
// 检查是否有企业微信配置
|
||||
if (!config.wxwork_url && !config.corpid) {
|
||||
console.error('企业微信配置不完整,缺少 wxwork_url 或 corpid');
|
||||
uni.showToast({ title: lang('customerService.wxworkConfigIncomplete'), icon: 'none' });
|
||||
uni.showToast({ title: '企业微信配置不完整', icon: 'none' });
|
||||
this.fallbackToPhoneCall();
|
||||
return;
|
||||
}
|
||||
@@ -268,12 +267,12 @@ export class CustomerService {
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('【跳转第三方小程序失败】', err);
|
||||
uni.showToast({ title: lang('customerService.thirdMiniAppFailed'), icon: 'none' });
|
||||
uni.showToast({ title: '跳转失败,请稍后重试', icon: 'none' });
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
uni.showToast({ title: lang('customerService.thirdMiniAppOnlyInWechat'), icon: 'none' });
|
||||
uni.showToast({ title: '第三方小程序客服仅在微信小程序中可用', icon: 'none' });
|
||||
// #endif
|
||||
return;
|
||||
}
|
||||
@@ -287,7 +286,7 @@ export class CustomerService {
|
||||
uni.setClipboardData({
|
||||
data: config.third_url,
|
||||
success: () => {
|
||||
uni.showToast({ title: lang('customerService.linkCopiedOpenBrowser'), icon: 'none' });
|
||||
uni.showToast({ title: '链接已复制,请在浏览器打开', icon: 'none' });
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
@@ -353,7 +352,7 @@ export class CustomerService {
|
||||
// #endif
|
||||
// #ifdef MP
|
||||
uni.setClipboardData({ data: serviceUrl });
|
||||
uni.showToast({ title: lang('customerService.linkCopied'), icon: 'none' });
|
||||
uni.showToast({ title: '客服链接已复制', icon: 'none' });
|
||||
// #endif
|
||||
return;
|
||||
}
|
||||
@@ -381,11 +380,11 @@ export class CustomerService {
|
||||
if (res.code === 0 && res.data?.mobile) {
|
||||
uni.makePhoneCall({ phoneNumber: res.data.mobile });
|
||||
} else {
|
||||
uni.showToast({ title: lang('customerService.noPhone'), icon: 'none' });
|
||||
uni.showToast({ title: '暂无客服电话', icon: 'none' });
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({ title: lang('customerService.getPhoneFailed'), icon: 'none' });
|
||||
uni.showToast({ title: '获取客服电话失败', icon: 'none' });
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -393,23 +392,23 @@ export class CustomerService {
|
||||
showNoServicePopup() {
|
||||
const siteInfo = this.vm.$store.state.siteInfo || {};
|
||||
const message = siteInfo?.site_tel
|
||||
? lang('customerService.contactPhone', { phone: siteInfo.site_tel })
|
||||
: lang('customerService.noServiceOffline');
|
||||
uni.showModal({ title: lang('customerService.contactCustomerService'), content: message, showCancel: false });
|
||||
? `请联系客服,客服电话是 ${siteInfo.site_tel}`
|
||||
: '抱歉,商家暂无客服,请线下联系';
|
||||
uni.showModal({ title: '联系客服', content: message, showCancel: false });
|
||||
}
|
||||
|
||||
showConfigErrorPopup(errors) {
|
||||
uni.showModal({
|
||||
title: lang('customerService.configError'),
|
||||
content: lang('customerService.configErrorMsg', { errors: errors.join('\n') }),
|
||||
title: '客服配置错误',
|
||||
content: `配置有误:\n${errors.join('\n')}`,
|
||||
showCancel: false
|
||||
});
|
||||
}
|
||||
|
||||
fallbackToOriginalService() {
|
||||
uni.showModal({
|
||||
title: lang('common.tip'),
|
||||
content: lang('customerService.cannotAddWxwork'),
|
||||
title: '提示',
|
||||
content: '无法直接添加企业微信,是否使用其他方式联系客服?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.openWxworkService(true);
|
||||
@@ -420,8 +419,8 @@ export class CustomerService {
|
||||
|
||||
fallbackToPhoneCall() {
|
||||
uni.showModal({
|
||||
title: lang('common.tip'),
|
||||
content: lang('customerService.onlineServiceUnavailable'),
|
||||
title: '提示',
|
||||
content: '在线客服不可用,是否拨打电话联系客服?',
|
||||
success: (res) => {
|
||||
if (res.confirm) this.makePhoneCall();
|
||||
}
|
||||
@@ -568,12 +567,12 @@ export class CustomerService {
|
||||
// #ifdef H5
|
||||
window.location.href = aiChatUrl;
|
||||
// #endif
|
||||
uni.showToast({ title: lang('customerService.openFailed'), icon: 'none' });
|
||||
uni.showToast({ title: '打开客服失败', icon: 'none' });
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('跳转 AI智能客服异常:', e);
|
||||
uni.showToast({ title: lang('customerService.openFailed'), icon: 'none' });
|
||||
uni.showToast({ title: '打开客服失败', icon: 'none' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,7 +580,7 @@ export class CustomerService {
|
||||
* 打开客服选择对话框(预留方法)
|
||||
*/
|
||||
openCustomerSelectPopupDialog() {
|
||||
uni.showToast({ title: lang('customerService.developing'), icon: 'none' });
|
||||
uni.showToast({ title: '客服选择功能开发中', icon: 'none' });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -611,7 +610,7 @@ export class CustomerService {
|
||||
if (qyweixinUrl) {
|
||||
window.location.href = qyweixinUrl;
|
||||
} else {
|
||||
uni.showToast({ title: lang('customerService.wxworkNotConfigured'), icon: 'none' });
|
||||
uni.showToast({ title: '企业微信客服未配置', icon: 'none' });
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -630,7 +629,7 @@ export class CustomerService {
|
||||
|
||||
if (!validation.isValid) {
|
||||
console.error('客服配置无效:', validation.errors);
|
||||
uni.showToast({ title: lang('customerService.unavailable'), icon: 'none' });
|
||||
uni.showToast({ title: '客服暂不可用', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -647,7 +646,7 @@ export class CustomerService {
|
||||
// #ifdef MP-WEIXIN
|
||||
if (!wxworkConfig?.enable || !wxworkConfig?.contact_url) {
|
||||
console.warn('企业微信配置不完整,使用原生客服');
|
||||
uni.showToast({ title: lang('customerService.wxworkConfigIncomplete'), icon: 'none' });
|
||||
uni.showToast({ title: '企业微信配置不完整', icon: 'none' });
|
||||
}
|
||||
// #endif
|
||||
|
||||
@@ -668,7 +667,7 @@ export class CustomerService {
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('客服处理失败:', error);
|
||||
uni.showToast({ title: lang('customerService.openFailed'), icon: 'none' });
|
||||
uni.showToast({ title: '打开客服失败', icon: 'none' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ export default {
|
||||
}
|
||||
|
||||
this.$util.showToast({
|
||||
title: this.$lang('diy.noCustomPageData')
|
||||
title: '未配置自定义页面数据'
|
||||
});
|
||||
this.diyData = {};
|
||||
return;
|
||||
@@ -560,7 +560,7 @@ export default {
|
||||
if (res.code == 0 && res.data) {
|
||||
this.currentPosition = res.data.formatted_addresses.recommend; // 结合知名地点形成的描述性地址,更具人性化特点
|
||||
} else {
|
||||
this.currentPosition = this.$lang('diy.locationNotObtained');
|
||||
this.currentPosition = '未获取到定位';
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -572,7 +572,7 @@ export default {
|
||||
this.nearestStore = this.defaultStoreInfo;
|
||||
this.nearestStore.show_address = this.nearestStore.full_address.replace(/,/g, ' ') + ' ' + this.nearestStore.address;
|
||||
}
|
||||
if (this.currentPosition == '') this.currentPosition = this.$lang('diy.locationNotObtained');
|
||||
if (this.currentPosition == '') this.currentPosition = '未获取到定位';
|
||||
this.openChooseStorePopup();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2,7 +2,6 @@ import Config from './config.js'
|
||||
import Util from './util.js'
|
||||
import store from '@/store/index.js'
|
||||
import Platform from './platform.js'
|
||||
import lang from './lang.js'
|
||||
|
||||
const { appType, appTypeName } = Platform.getPlatformInfo();
|
||||
|
||||
@@ -10,7 +9,7 @@ export default {
|
||||
sendRequest(params) {
|
||||
if (!Config.baseUrl) {
|
||||
uni.showToast({
|
||||
title: lang('http.domainNotConfigured'),
|
||||
title: '未配置请求域名',
|
||||
'icon': 'none',
|
||||
duration: 10000
|
||||
});
|
||||
@@ -78,7 +77,7 @@ export default {
|
||||
fail: (res) => {
|
||||
if (res.errMsg && res.errMsg == 'request:fail url not in domain list') {
|
||||
uni.showToast({
|
||||
title: lang('http.domainNotInList', { domain: Config.baseUrl }),
|
||||
title: Config.baseUrl + '不在request 合法域名列表中',
|
||||
'icon': 'none',
|
||||
duration: 10000
|
||||
});
|
||||
@@ -89,7 +88,7 @@ export default {
|
||||
complete: (res) => {
|
||||
if ((res.errMsg && res.errMsg != "request:ok") || (res.statusCode && [200, 500].indexOf(res.statusCode) == -1)) {
|
||||
uni.showToast({
|
||||
title: lang('http.requestFailed', { domain: Config.baseUrl }),
|
||||
title: Config.baseUrl + '请求失败',
|
||||
'icon': 'none',
|
||||
duration: 10000
|
||||
});
|
||||
@@ -135,7 +134,7 @@ export default {
|
||||
fail: (res) => {
|
||||
if (res.errMsg && res.errMsg == 'request:fail url not in domain list') {
|
||||
uni.showToast({
|
||||
title: lang('http.domainNotInList', { domain: Config.baseUrl }),
|
||||
title: Config.baseUrl + '不在request 合法域名列表中',
|
||||
'icon': 'none',
|
||||
duration: 10000
|
||||
});
|
||||
@@ -146,7 +145,7 @@ export default {
|
||||
complete: (res) => {
|
||||
if ((res.errMsg && res.errMsg != "request:ok") || (res.statusCode && [200, 500].indexOf(res.statusCode) == -1)) {
|
||||
uni.showToast({
|
||||
title: lang('http.requestFailed', { domain: Config.baseUrl }),
|
||||
title: Config.baseUrl + '请求失败',
|
||||
'icon': 'none',
|
||||
duration: 10000
|
||||
});
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
// 文件分享工具函数
|
||||
import lang from './lang.js';
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 生成文件预览链接
|
||||
@@ -32,7 +30,7 @@ export default {
|
||||
* @param {string} title - 分享标题,默认使用文件名
|
||||
* @param {string} desc - 分享描述,默认使用固定文案
|
||||
*/
|
||||
shareFile(file, title = file.name, desc = lang('share.filePreview') + file.name) {
|
||||
shareFile(file, title = file.name, desc = '查看企业文件:' + file.name) {
|
||||
// 生成文件预览链接
|
||||
const filePreviewUrl = this.generateFilePreviewUrl(file);
|
||||
|
||||
@@ -46,17 +44,17 @@ export default {
|
||||
url: filePreviewUrl
|
||||
}).catch(err => {
|
||||
console.error('分享失败:', err);
|
||||
uni.showToast({ title: lang('share.failed'), icon: 'none' });
|
||||
uni.showToast({ title: '分享失败', icon: 'none' });
|
||||
});
|
||||
} else {
|
||||
// 不支持 Web Share API 的浏览器
|
||||
uni.setClipboardData({
|
||||
data: filePreviewUrl,
|
||||
success: () => {
|
||||
uni.showToast({ title: lang('share.linkCopied'), icon: 'success' });
|
||||
uni.showToast({ title: '链接已复制,请粘贴分享', icon: 'success' });
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({ title: lang('common.copyFailed'), icon: 'none' });
|
||||
uni.showToast({ title: '复制失败', icon: 'none' });
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -65,7 +63,7 @@ export default {
|
||||
// #ifdef MP-WEIXIN
|
||||
// 微信小程序分享
|
||||
uni.showActionSheet({
|
||||
itemList: [lang('share.sendToFriend'), lang('share.sendToMoments')],
|
||||
itemList: ['发送给朋友', '分享到朋友圈'],
|
||||
success: (res) => {
|
||||
if (res.tapIndex === 0) {
|
||||
// 发送给朋友
|
||||
@@ -73,10 +71,10 @@ export default {
|
||||
title: title,
|
||||
path: filePreviewUrl,
|
||||
success: () => {
|
||||
uni.showToast({ title: lang('share.success'), icon: 'success' });
|
||||
uni.showToast({ title: '分享成功', icon: 'success' });
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({ title: lang('share.failed'), icon: 'none' });
|
||||
uni.showToast({ title: '分享失败', icon: 'none' });
|
||||
}
|
||||
});
|
||||
} else if (res.tapIndex === 1) {
|
||||
@@ -85,10 +83,10 @@ export default {
|
||||
title: desc,
|
||||
path: filePreviewUrl,
|
||||
success: () => {
|
||||
uni.showToast({ title: lang('share.success'), icon: 'success' });
|
||||
uni.showToast({ title: '分享成功', icon: 'success' });
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({ title: lang('share.failed'), icon: 'none' });
|
||||
uni.showToast({ title: '分享失败', icon: 'none' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import Config from './config.js'
|
||||
import store from '@/store/index.js'
|
||||
import Http from './http.js'
|
||||
import Platform from './platform.js'
|
||||
import lang from './lang.js'
|
||||
import {
|
||||
Weixin
|
||||
} from 'common/js/wx-jssdk.js';
|
||||
@@ -669,7 +668,7 @@ export default {
|
||||
tMonth = doHandleMonth(tMonth + 1);
|
||||
tDate = doHandleMonth(tDate);
|
||||
|
||||
const week = [lang('common.sunday'), lang('common.monday'), lang('common.tuesday'), lang('common.wednesday'), lang('common.thursday'), lang('common.friday'), lang('common.saturday')]
|
||||
const week = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
|
||||
return {
|
||||
't': time,
|
||||
'y': tYear,
|
||||
@@ -706,7 +705,7 @@ export default {
|
||||
var _data = data;
|
||||
var imgs = [];
|
||||
uni.showLoading({
|
||||
title: lang('common.uploading')
|
||||
title: '图片上传中'
|
||||
})
|
||||
for (var i = 0; i < tempFilePaths.length; i++) {
|
||||
var path = await _self.upload_file_server(tempFilePaths[i], _data, params.path,
|
||||
@@ -715,7 +714,7 @@ export default {
|
||||
if (imgs.length == tempFilePaths.length) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: lang('common.uploadSuccess'),
|
||||
title: '上传成功',
|
||||
icon: 'none'
|
||||
})
|
||||
typeof callback == 'function' && callback(imgs);
|
||||
@@ -725,7 +724,7 @@ export default {
|
||||
fail: err => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: lang('common.uploadFailed'),
|
||||
title: '上传失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
@@ -776,7 +775,7 @@ export default {
|
||||
oInput.style.display = 'none';
|
||||
uni.hideKeyboard();
|
||||
this.showToast({
|
||||
title: lang('common.copySuccess')
|
||||
title: '复制成功'
|
||||
});
|
||||
|
||||
typeof callback == 'function' && callback();
|
||||
@@ -1040,7 +1039,7 @@ export default {
|
||||
});
|
||||
} else {
|
||||
this.showToast({
|
||||
title: lang('common.noCustomerService'),
|
||||
title: '抱歉,商家暂无客服,请线下联系',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user