From 73030417395e03be56eb420dddab4d806d52a7ad Mon Sep 17 00:00:00 2001
From: sws <1141121512@qq.com>
Date: Fri, 24 Nov 2023 09:58:09 +0800
Subject: [PATCH] =?UTF-8?q?1.=E5=A4=9A=E8=AF=AD=E8=A8=80=202023.11.23?=
=?UTF-8?q?=E5=91=A8=E5=9B=9B--sws?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.vue | 94 ++---
i18n_tools.config.js | 17 +-
lang/en.json | 134 ++++++++
lang/index.js | 10 +-
lang/zh-Hans.json | 134 ++++++++
main.js | 3 +-
pages/login/login.vue | 320 ++++++++++--------
pages/user-order-detail/user-order-detail.vue | 76 ++---
8 files changed, 556 insertions(+), 232 deletions(-)
create mode 100644 lang/en.json
create mode 100644 lang/zh-Hans.json
diff --git a/App.vue b/App.vue
index a4acf973..f88f434d 100644
--- a/App.vue
+++ b/App.vue
@@ -39,6 +39,11 @@
// 紫色 purple #623cec
default_theme: 'red',
+ // 多语言列表
+ // 增加或者减少语言时
+ // 1.新增一个对象,按照当前格式新增
+ // 2.去lang里面各个文件去新增语言翻译
+ default_language: 'zh-Hans',
// 公共配置
// 分享及转发使用页面设置的默认图片及系统默认图片(0 否, 1 是)
@@ -88,18 +93,12 @@
is_home_search_scan: 1,
// tabbar页面
- tabbar_pages: [
- '/pages/index/index',
- '/pages/goods-category/goods-category',
- '/pages/cart/cart',
- '/pages/user/user'
- ],
-
+ tabbar_pages: ['/pages/index/index', '/pages/goods-category/goods-category', '/pages/cart/cart', '/pages/user/user'],
// 数据缓存key
// 场景值
cache_scene_key: 'cache_scene_key',
-
+
// uuid缓存key
cache_user_uuid_key: 'cache_user_uuid_key',
@@ -1072,7 +1071,7 @@
} else {
this.showToast(res.data.msg);
// 首次则再次初始化配置
- if(status == 0) {
+ if (status == 0) {
this.init_config(1);
}
}
@@ -1080,7 +1079,7 @@
fail: () => {
this.showToast('网络开小差了哦~');
// 首次则再次初始化配置
- if(status == 0) {
+ if (status == 0) {
this.init_config(1);
}
},
@@ -1164,7 +1163,7 @@
this.showToast('请复制地址到网页地图中查看!');
return false;
// #endif
-
+
// 参数判断
if (lng == undefined || lat == undefined || lng == '' || lat == '') {
this.showToast('坐标有误');
@@ -1175,17 +1174,17 @@
// #ifdef MP-WEIXIN
// 微信小程序使用【腾讯位置服务路线规划】插件
- if(this.data.is_weixin_open_location_use_plugins == 1) {
+ if (this.data.is_weixin_open_location_use_plugins == 1) {
var key = this.get_config('config.common_tencent_map_ak') || null;
- if(key != null) {
+ if (key != null) {
var plugin = requirePlugin('routePlan');
var end_point = JSON.stringify({
- name: name || '地理位置',
+ name: name || '地理位置',
longitude: lng,
- latitude: lat
+ latitude: lat,
});
uni.navigateTo({
- url: 'plugin://routePlan/route-plan?key=' + key + '&referer=' + this.get_application_title() + '&endPoint=' + end_point+'&themeColor=' + this.get_theme_color() + '&navigation=1'
+ url: 'plugin://routePlan/route-plan?key=' + key + '&referer=' + this.get_application_title() + '&endPoint=' + end_point + '&themeColor=' + this.get_theme_color() + '&navigation=1',
});
return false;
}
@@ -1197,7 +1196,7 @@
address: address || '',
scale: scale || 18,
longitude: lng,
- latitude: lat
+ latitude: lat,
});
},
@@ -1270,7 +1269,7 @@
this.call_tel(value.substr(6));
// 默认切换或跳转页面
} else {
- if(this.is_page(value)) {
+ if (this.is_page(value)) {
if (this.is_tabbar_pages(value)) {
var temp = value.split('?');
if (temp.length > 1 && (temp[1] || null) != null) {
@@ -1293,7 +1292,7 @@
}
}
} else {
- this.showToast('未知数据('+value+')');
+ this.showToast('未知数据(' + value + ')');
}
}
}
@@ -1969,10 +1968,10 @@
}
return color_obj[theme];
},
-
+
// 获取主题页面标识
get_theme_value_view() {
- return 'theme-'+this.get_theme_value();
+ return 'theme-' + this.get_theme_value();
},
// 获取主题
@@ -2105,12 +2104,12 @@
var status = 0;
// 存在数据值
var value = null;
- for(var i in rules) {
- if(url.indexOf(rules[i]) != -1) {
+ for (var i in rules) {
+ if (url.indexOf(rules[i]) != -1) {
var temp = url.split(rules[i]);
- if(temp.length > 1) {
+ if (temp.length > 1) {
temp = temp[1].split('.');
- if(temp.length > 0 && (temp[0] || null) != null) {
+ if (temp.length > 0 && (temp[0] || null) != null) {
value = temp[0];
}
}
@@ -2118,7 +2117,7 @@
break;
}
}
- return {status: status, value: value};
+ return { status: status, value: value };
},
// 扫码解析处理
@@ -2126,16 +2125,16 @@
var self = this;
uni.scanCode({
success: function (res) {
- if(res.result !== '') {
+ if (res.result !== '') {
var value = res.result;
// 是否为url地址
- if(self.is_url(value)) {
+ if (self.is_url(value)) {
// 是否为商品地址
var goods_arr = ['/goods-', '/goods/index/id/', '=goods/index/id/'];
var goods_ret = self.web_url_value_mate(value, goods_arr);
- if(goods_ret.status == 1 && goods_ret.value != null) {
+ if (goods_ret.status == 1 && goods_ret.value != null) {
uni.navigateTo({
- url: '/pages/goods-detail/goods-detail?id='+goods_ret.value,
+ url: '/pages/goods-detail/goods-detail?id=' + goods_ret.value,
});
return;
}
@@ -2143,9 +2142,9 @@
// 是否为多商户店铺详情地址
var shop_arr = ['/shop-index-detail-', '/plugins/index/pluginsname/shop/pluginscontrol/index/pluginsaction/detail/id/', '=plugins/index/pluginsname/shop/pluginscontrol/index/pluginsaction/detail/id/'];
var shop_ret = self.web_url_value_mate(value, shop_arr);
- if(shop_ret.status == 1 && shop_ret.value != null) {
+ if (shop_ret.status == 1 && shop_ret.value != null) {
uni.navigateTo({
- url: '/pages/plugins/shop/detail/detail?id='+shop_ret.value,
+ url: '/pages/plugins/shop/detail/detail?id=' + shop_ret.value,
});
return;
}
@@ -2153,19 +2152,19 @@
// 是否为扫码收款
var scanpay_arr = ['/scanpay-index-index', 'plugins/index/pluginsname/scanpay/pluginscontrol/index/pluginsaction/index', 'plugins/index/pluginsname/scanpay', '/scanpay'];
var scanpay_ret = self.web_url_value_mate(value, scanpay_arr);
- if(scanpay_ret.status == 1) {
+ if (scanpay_ret.status == 1) {
var url = '/pages/plugins/scanpay/index/index';
- if(scanpay_ret.value != null) {
+ if (scanpay_ret.value != null) {
var first = scanpay_ret.value.substr(0, 1);
- if(first == '-') {
+ if (first == '-') {
var temp = scanpay_ret.value.substr(1).split('/');
- if(temp.length == 3) {
- url += '?id='+temp[0]+'&type='+temp[2];
+ if (temp.length == 3) {
+ url += '?id=' + temp[0] + '&type=' + temp[2];
}
- } else if(first == '/') {
+ } else if (first == '/') {
var temp = scanpay_ret.value.substr(1).split('/');
- if(temp.length == 4) {
- url += '?id='+temp[1]+'&type='+temp[3];
+ if (temp.length == 4) {
+ url += '?id=' + temp[1] + '&type=' + temp[3];
}
}
}
@@ -2174,13 +2173,13 @@
});
return;
}
-
+
// 是否为扫码登录
var thirdpartylogin_arr = ['/thirdpartylogin-scan-index-', 'plugins/index/pluginsname/thirdpartylogin/pluginscontrol/scan/pluginsaction/index'];
var thirdpartylogin_ret = self.web_url_value_mate(value, thirdpartylogin_arr);
- if(thirdpartylogin_ret.status == 1 && thirdpartylogin_ret.value != null) {
+ if (thirdpartylogin_ret.status == 1 && thirdpartylogin_ret.value != null) {
uni.navigateTo({
- url: '/pages/plugins/thirdpartylogin/index/index?id='+thirdpartylogin_ret.value,
+ url: '/pages/plugins/thirdpartylogin/index/index?id=' + thirdpartylogin_ret.value,
});
return;
}
@@ -2193,7 +2192,12 @@
}
},
});
- }
+ },
+
+ // 获取当前语言
+ get_language_value() {
+ return uni.getLocale() || this.data.default_language;
+ },
},
// 初始化完成时触发(全局只触发一次)
@@ -2239,4 +2243,4 @@
@import './common/css/plugins.css';
@import './common/css/lib.css';
@import './common/css/theme.css';
-
\ No newline at end of file
+
diff --git a/i18n_tools.config.js b/i18n_tools.config.js
index 8e588231..8ca534ea 100644
--- a/i18n_tools.config.js
+++ b/i18n_tools.config.js
@@ -1,11 +1,12 @@
module.exports = {
- entry: [''], // 提取、还原、遗漏扫描入口文件夹,可以配置多个,默认是 src
- outDir: 'lang', // i18n 输出文件夹 默认是 src/locales
- outShow:2, //输出文件展示结构 1 扁平化结构 2树级结构 默认扁平化
- exclude: ['lang'], // 不提取的文件夹, 默认是 ['src/locales']
- extensions: ['.vue', '.js', '.ts'], // 提取的文件后缀名,默认是 ['.js', '.vue', '.ts']
- filename: 'zh', // 输出的文件名,默认为 zh_cn
- extname: 'json', // 输出的文件后缀名默认为 js ,支持json和js(js格式为 module.exports = {} 或 export default {}),
- langList: ['en','spa','cht'] // 翻译目标语言列表,默认是 ['en'] 具体语种请自行查看。注意:使用不同的翻译接口,需要更换对应的语言编码,腾讯翻译、火山翻译、谷歌翻译语言编码大致相同,百度要特别注意,与上述3种翻译有不同的语言编码
+ entry: [''], // 提取、还原、遗漏扫描入口文件夹,可以配置多个,默认是 src
+ outDir: 'lang', // i18n 输出文件夹 默认是 src/locales
+ outShow: 2, //输出文件展示结构 1 扁平化结构 2树级结构 默认扁平化
+ exclude: ['lang'], // 不提取的文件夹, 默认是 ['src/locales']
+ extensions: ['.vue', '.js', '.ts'], // 提取的文件后缀名,默认是 ['.js', '.vue', '.ts']
+ filename: 'zh-Hans', // 输出的文件名,默认为 zh_cn
+ extname: 'json', // 输出的文件后缀名默认为 js ,支持json和js(js格式为 module.exports = {} 或 export default {}),
+ // langList: ['en', 'spa', 'cht'] // 翻译目标语言列表,默认是 ['en'] 具体语种请自行查看。注意:使用不同的翻译接口,需要更换对应的语言编码,腾讯翻译、火山翻译、谷歌翻译语言编码大致相同,百度要特别注意,与上述3种翻译有不同的语言编码
+ langList: ['en'] // 翻译目标语言列表,默认是 ['en'] 具体语种请自行查看。注意:使用不同的翻译接口,需要更换对应的语言编码,腾讯翻译、火山翻译、谷歌翻译语言编码大致相同,百度要特别注意,与上述3种翻译有不同的语言编码
}
\ No newline at end of file
diff --git a/lang/en.json b/lang/en.json
new file mode 100644
index 00000000..a1c1fbb0
--- /dev/null
+++ b/lang/en.json
@@ -0,0 +1,134 @@
+{
+ "language": {
+ "zh-Hans": "Simplified Chinese",
+ "cht": "Traditional Chinese",
+ "en": "United States",
+ "spa": "Spanish"
+ },
+ "common": {
+ "confirm": "confirm",
+ "cancel": "cancel"
+ },
+ "login": {
+ "login": {
+ "725312": "Account password login",
+ "tfl656": "Confirm Binding",
+ "483nho": "Return to previous page",
+ "31r6p2": "Mobile verification code",
+ "p3kxy2": "Get your phone number and log in with one click",
+ "54l805": "Bind existing account",
+ "q11t73": "Register an account and bind it",
+ "s51ed9": "Successfully logged in, please click to return to the previous page",
+ "e77788": "Login account will be automatically bound",
+ "1i4o86": "user",
+ "su75o5": "cancel",
+ "n2pv70": "Account",
+ "1p7843": "mobile phone",
+ "p54kf1": "mailbox",
+ "3i05ly": "Temporarily closed login",
+ "nddg2x": "Read and agree",
+ "2v11we": "《Service Agreement》",
+ "l3r4vr": "And",
+ "myno2x": "《Privacy Policy》",
+ "i1deai": "Confirm login",
+ "t75ee8": "New User Registration",
+ "9d8gqi": "Retrieve password",
+ "tvl242": "Use authorization to automatically log in",
+ "9q27d8": "Other login methods",
+ "t59dho": "Temporarily closed registration",
+ "hvunf8": "Confirm Registration",
+ "zy8tc4": "Log in now",
+ "7z29x2": "Confirm submission",
+ "b347k4": "Register Now",
+ "836o8e": "Confirm login authorization to provide you with better service",
+ "pgyv78": "There is an error in the basic data. If it is not automatically loaded, please manually click to load!",
+ "6fe6ra": "Load basic data",
+ "28k91h": "Mobile phone number",
+ "t3951j": "Verification code",
+ "qe8a37": "User name/phone/email",
+ "08fchn": "Login password",
+ "db1rf4": "E-mail",
+ "6yfr9g": "user name",
+ "d178m0": "Mobile/email",
+ "9wx3ch": "Set login password",
+ "s665h5": "Obtain verification code",
+ "jw378f": "Authorized User Information",
+ "np9177": "Bind phone",
+ "158yg2": "Login with mobile verification code",
+ "r329eu": "Email verification code login",
+ "39hn6v": "Account password registration",
+ "z13km0": "Mobile verification code registration",
+ "jc0w0o": "Email verification code registration",
+ "8tmyuc": "Password retrieval",
+ "5p23c6": "Login successful",
+ "btu2c1": "Please agree to the agreement first",
+ "no8ts6": "Used to improve member information",
+ "3nmrg2": "privilege grant failed",
+ "4c5n8o": "Please fill in your phone number",
+ "xak8g1": "Please fill in the email address",
+ "ku05ty": "Please fill in your phone or email address",
+ "7r5h37": "Please enter a valid verification code",
+ "24mvbh": "Please fill in the account number",
+ "s36mk5": "Sending",
+ "6881q7": "Sending",
+ "n24i5u": "surplus",
+ "4306xr": "second",
+ "6gojnd": "The internet has wandered off~",
+ "01xmab": "Please fill in the verification code",
+ "prqvf1": "Authorization ID cannot be empty",
+ "4ci850": "Processing",
+ "yvj88j": "Please enter your phone number",
+ "yo6x3p": "Please enter an email address",
+ "n7vh75": "Please enter an account",
+ "277w03": "Please enter the password",
+ "cesl5d": "Please enter the verification code",
+ "c5wa4u": "Logging in",
+ "g30ew7": "Registering",
+ "h0515x": "Please enter your phone or email address",
+ "wysg7k": "Please set password",
+ "4wc3hr": "Incorrect protocol type",
+ "x0nxxf": "Protocol URL address is incorrect",
+ "05h35f": "Loading",
+ "d9d11z": "Are you sure to switch to multiple languages!"
+ }
+ },
+ "user-order-detail": {
+ "user-order-detail": {
+ "346376": "Shipping Services",
+ "7lp6gw": "View Location",
+ "7f8p26": "Product Information",
+ "423rmr": "common",
+ "41ty94": "Total pieces",
+ "xcj552": "element",
+ "7xtnjt": "Unconfigured data",
+ "7dikfm": "Pickup information",
+ "o38952": "Pickup code:",
+ "0f26j2": "Order Information",
+ "ct34n5": "Extended Data",
+ "y9woor": "Key Information",
+ "hpq62x": "The pickup code does not exist. Please contact the administrator",
+ "io6p5k": "Order Mode",
+ "n18sd2": "Order number",
+ "yxwu8n": "Order Status",
+ "23qj7m": "Payment status",
+ "vg4jb1": "Order unit price",
+ "2y7l13": "Total order price",
+ "6ub2j0": "Discount amount",
+ "8b18q8": "Increase amount",
+ "516tlr": "Payment amount",
+ "0e1sfs": "Payment method",
+ "12d445": "Express delivery company",
+ "2byl8l": "Express tracking number",
+ "2b5fc8": "guest book ",
+ "h2c78h": "Creation time",
+ "9vivhl": "Confirmation time",
+ "wn83rn": "Payment time",
+ "1674dc": "Delivery time",
+ "0i938r": "Receiving time",
+ "1jpv4n": "Cancel time",
+ "8o2of3": "Closing time",
+ "5k6k56": "Parameter error",
+ "i876o3": "Incorrect address"
+ }
+ }
+}
\ No newline at end of file
diff --git a/lang/index.js b/lang/index.js
index 2147fd97..96bbc9b2 100644
--- a/lang/index.js
+++ b/lang/index.js
@@ -1,6 +1,10 @@
+import zhHans from './zh-Hans.json'
+// import cht from './cht.json'
import en from './en.json'
-import zh from './zh.json'
+// import spa from './spa.json'
export default {
- en,
- zh
+ "zh-Hans": zhHans,
+ // cht,
+ en,
+ // spa
}
diff --git a/lang/zh-Hans.json b/lang/zh-Hans.json
new file mode 100644
index 00000000..3c3adff8
--- /dev/null
+++ b/lang/zh-Hans.json
@@ -0,0 +1,134 @@
+{
+ "language": {
+ "zh-Hans": "简体中文",
+ "zh-Hant": "繁体中文",
+ "en": "美国",
+ "spa": "西班牙语"
+ },
+ "common": {
+ "confirm": "确认",
+ "cancel": "取消"
+ },
+ "login": {
+ "login": {
+ "725312": "账号密码登录",
+ "tfl656": "确认绑定",
+ "483nho": "返回上一页",
+ "31r6p2": "手机验证码",
+ "p3kxy2": "获取手机号码一键登录",
+ "54l805": "绑定已有账号",
+ "q11t73": "注册账号并绑定",
+ "s51ed9": "已成功登录、请点击返回上一页",
+ "e77788": "登录帐号将自动绑定",
+ "1i4o86": "用户",
+ "su75o5": "取消",
+ "n2pv70": "账号",
+ "1p7843": "手机",
+ "p54kf1": "邮箱",
+ "3i05ly": "暂时关闭了登录",
+ "nddg2x": "阅读并同意",
+ "2v11we": "《服务协议》",
+ "l3r4vr": "与",
+ "myno2x": "《隐私权政策》",
+ "i1deai": "确认登录",
+ "t75ee8": "新用户注册",
+ "9d8gqi": "找回密码",
+ "tvl242": "使用授权自动登录",
+ "9q27d8": "其他登陆方式",
+ "t59dho": "暂时关闭了注册",
+ "hvunf8": "确认注册",
+ "zy8tc4": "立即登录",
+ "7z29x2": "确认提交",
+ "b347k4": "立即注册",
+ "836o8e": "确认登录授权,为您提供更优质的服务",
+ "pgyv78": "基础数据有误,如未自动加载则请手动点击加载!",
+ "6fe6ra": "加载基础数据",
+ "28k91h": "手机号码",
+ "t3951j": "验证码",
+ "qe8a37": "用户名/手机/邮箱",
+ "08fchn": "登录密码",
+ "db1rf4": "电子邮箱",
+ "6yfr9g": "用户名",
+ "d178m0": "手机/邮箱",
+ "9wx3ch": "设置登录密码",
+ "s665h5": "获取验证码",
+ "jw378f": "授权用户信息",
+ "np9177": "绑定手机",
+ "158yg2": "手机验证码登录",
+ "r329eu": "邮箱验证码登录",
+ "39hn6v": "账号密码注册",
+ "z13km0": "手机验证码注册",
+ "jc0w0o": "邮箱验证码注册",
+ "8tmyuc": "密码找回",
+ "5p23c6": "登录成功",
+ "btu2c1": "请先同意协议",
+ "no8ts6": "用于完善会员资料",
+ "3nmrg2": "授权失败",
+ "4c5n8o": "请填写手机号码",
+ "xak8g1": "请填写电子邮箱",
+ "ku05ty": "请填写手机或邮箱",
+ "7r5h37": "请输入有效验证码",
+ "24mvbh": "请填写账号",
+ "s36mk5": "发送中...",
+ "6881q7": "发送中",
+ "n24i5u": "剩余",
+ "4306xr": "秒",
+ "6gojnd": "网络开小差了哦~",
+ "01xmab": "请填写验证码",
+ "prqvf1": "授权id不能为空",
+ "4ci850": "处理中...",
+ "yvj88j": "请输入手机号码",
+ "yo6x3p": "请输入电子邮箱",
+ "n7vh75": "请输入账号",
+ "277w03": "请输入密码",
+ "cesl5d": "请输入验证码",
+ "c5wa4u": "登录中...",
+ "g30ew7": "注册中...",
+ "h0515x": "请输入手机或邮箱",
+ "wysg7k": "请设置密码",
+ "4wc3hr": "协议类型有误",
+ "x0nxxf": "协议url地址有误",
+ "05h35f": "加载中...",
+ "d9d11z": "是否确定切换多语言!"
+ }
+ },
+ "user-order-detail": {
+ "user-order-detail": {
+ "346376": "出货服务",
+ "7lp6gw": "查看位置",
+ "7f8p26": "商品信息",
+ "423rmr": "共",
+ "41ty94": "件 合计",
+ "xcj552": "元",
+ "7xtnjt": "未配置数据",
+ "7dikfm": "取货信息",
+ "o38952": "取货码:",
+ "0f26j2": "订单信息",
+ "ct34n5": "扩展数据",
+ "y9woor": "密钥信息",
+ "hpq62x": "取货码不存在、请联系管理员",
+ "io6p5k": "订单模式",
+ "n18sd2": "订单编号",
+ "yxwu8n": "订单状态",
+ "23qj7m": "支付状态",
+ "vg4jb1": "订单单价",
+ "2y7l13": "订单总价",
+ "6ub2j0": "优惠金额",
+ "8b18q8": "增加金额",
+ "516tlr": "支付金额",
+ "0e1sfs": "支付方式",
+ "12d445": "快递公司",
+ "2byl8l": "快递单号",
+ "2b5fc8": "用户留言",
+ "h2c78h": "创建时间",
+ "9vivhl": "确认时间",
+ "wn83rn": "支付时间",
+ "1674dc": "发货时间",
+ "0i938r": "收货时间",
+ "1jpv4n": "取消时间",
+ "8o2of3": "关闭时间",
+ "5k6k56": "参数有误",
+ "i876o3": "地址有误"
+ }
+ }
+}
\ No newline at end of file
diff --git a/main.js b/main.js
index 515a4756..06aa76db 100644
--- a/main.js
+++ b/main.js
@@ -9,7 +9,8 @@ import share from './common/js/common/share';
import messages from './lang/index'
import VueI18n from 'vue-i18n';
let i18nConfig = {
- locale: uni.getLocale() || 'zh',
+ locale: uni.getLocale(),
+ silentTranslationWarn: true,
messages
}
Vue.use(VueI18n)
diff --git a/pages/login/login.vue b/pages/login/login.vue
index e098f536..db7c991a 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -21,15 +21,15 @@