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 @@ {{ user.nickname }} - + - + - + - {{ $t('login.return_pre_page') }} + {{ $t('login.login.483nho') }} @@ -44,24 +44,24 @@ - - + + - {{ $t('login.bind_existing_account') }} + {{ $t('login.login.54l805') }} - {{ $t('login.reg_account_and_bind') }} + {{ $t('login.login.q11t73') }} - {{ t('login.login_success_sub_return_pre_page') }} - + {{ $t('login.login.s51ed9') }} + @@ -81,8 +81,8 @@ {{ plugins_thirdpartylogin_user.nickname }} - {{ $t('login.login_bind_user', { platform_name: plugins_thirdpartylogin_user.platform_name }) }} - + {{ $t('login.login.e77788') }}{{ plugins_thirdpartylogin_user.platform_name }}{{ $t('login.login.1i4o86') }} + @@ -91,33 +91,33 @@
- {{ $t('login.account_pwd') }} - {{ $t('login.phone') }} - {{ $t('login.email') }} + {{ $t('login.login.n2pv70') }} + {{ $t('login.login.1p7843') }} + {{ $t('login.login.p54kf1') }} - {{ $t('login.temp_close_login') }} + {{ $t('login.login.3i05ly') }} - - + + - + - + - + - + - + @@ -130,30 +130,31 @@ - - {{ $t('login.login_protocol.0') }} {{ $t('login.login_protocol.1') }} {{ $t('login.login_protocol.2') }} {{ $t('login.login_protocol.3') }}{{ $t('login.login.nddg2x') }}{{ $t('login.login.2v11we') }}{{ $t('login.login.l3r4vr') }}{{ $t('login.login.myno2x') }} - + - {{ $t('login.new_user_reg') }} + {{ $t('login.login.t75ee8') }} - {{ $t('login.retrieve_pwd') }} + {{ $t('login.login.9d8gqi') }} - {{ $t('login.use_auth_auto_login') }} - {{ $t('login.return_pre_page') }} + {{ $t('login.login.tvl242') }} + {{ $t('login.login.483nho') }} - {{ $t('login.other_login_methods') }} + {{ $t('login.login.9q27d8') }} @@ -176,37 +177,37 @@ - {{ $t('login.account_pwd') }} - {{ $t('login.phone') }} - {{ $t('login.email') }} + {{ $t('login.login.n2pv70') }} + {{ $t('login.login.1p7843') }} + {{ $t('login.login.p54kf1') }} - {{ $t('login.temp_close_reg') }} + {{ $t('login.login.t59dho') }} - - + + - + - + - + - + - + - + - + @@ -217,21 +218,24 @@ - {{ $t('login.login_protocol.0') }} {{ $t('login.login_protocol.1') }} {{ $t('login.login_protocol.2') }} {{ $t('login.login_protocol.3') }} + {{ $t('login.login.nddg2x') }}{{ $t('login.login.2v11we') }}{{ $t('login.login.l3r4vr') }}{{ $t('login.login.myno2x') }} + - + - {{ $t('login.now_login') }} + {{ $t('login.login.zy8tc4') }} - {{ $t('login.use_auth_auto_login') }} - {{ $t('login.return_pre_page') }} + {{ $t('login.login.tvl242') }} + {{ $t('login.login.483nho') }} @@ -241,29 +245,29 @@ - + - + - - + + - {{ $t('login.now_login') }} + {{ $t('login.login.zy8tc4') }} - {{ $t('login.now_reg') }} + {{ $t('login.login.b347k4') }} - {{ $t('login.use_auth_auto_login') }} - {{ $t('login.return_pre_page') }} + {{ $t('login.login.tvl242') }} + {{ $t('login.login.483nho') }} @@ -273,7 +277,7 @@ - {{ $t('login.confirm_login_auth_most_service') }} + {{ $t('login.login.836o8e') }} @@ -282,20 +286,23 @@ - {{ $t('login.login_protocol.0') }} {{ $t('login.login_protocol.1') }} {{ $t('login.login_protocol.2') }} {{ $t('login.login_protocol.3') }} + {{ $t('login.login.nddg2x') }}{{ $t('login.login.2v11we') }}{{ $t('login.login.l3r4vr') }}{{ $t('login.login.myno2x') }} - + - + - + - + @@ -311,11 +318,11 @@ - + - + @@ -328,12 +335,12 @@ - {{ $t('confirm') }} + {{ $t('common.confirm') }} - - {{ item }} - + + {{ value }} + @@ -349,15 +356,15 @@ - {{ $t('cancel') }} + {{ $t('common.cancel') }} - {{ $t('login.base_data_error') }} + {{ $t('login.login.pgyv78') }} - + @@ -372,6 +379,11 @@ export default { data() { return { + // 多语言 + systemLocale: '', + applicationLocale: '', + isAndroid: '', + theme_view: app.globalData.get_theme_value_view(), login_static_url: login_static_url, params: null, @@ -381,7 +393,7 @@ form_input_email_value: '', form_input_accounts_value: '', form_input_image_verify_value: '', - verify_submit_text: '获取验证码', + verify_submit_text: this.$t('login.login.s665h5'), verify_loading: false, verify_disabled: false, form_submit_loading: false, @@ -407,16 +419,16 @@ current_opt_form: 'auth', current_opt_type: 'auth', current_opt_type_title: { - auth: '授权用户信息', - bind: '绑定手机', - login_username: '账号密码登录', - login_sms: '手机验证码登录', - login_email: '邮箱验证码登录', - reg_username: '账号密码注册', - reg_sms: '手机验证码注册', - reg_email: '邮箱验证码注册', - forget: '密码找回', - success: '登录成功', + auth: this.$t('login.login.jw378f'), + bind: this.$t('login.login.np9177'), + login_username: this.$t('login.login.725312'), + login_sms: this.$t('login.login.158yg2'), + login_email: this.$t('login.login.r329eu'), + reg_username: this.$t('login.login.39hn6v'), + reg_sms: this.$t('login.login.z13km0'), + reg_email: this.$t('login.login.jc0w0o'), + forget: this.$t('login.login.8tmyuc'), + success: this.$t('login.login.5p23c6'), }, // 第三方登录 plugins_thirdpartylogin_data: null, @@ -426,10 +438,10 @@ // 语言选择 popup_language_status: false, - language_list: ['中国', '美国', '韩国', '日本'], - language_index: 0, + language_list: '', + language_key: '', // 实际提交的语言字段 - language: '简体中文', + language: '', // 暂存的语言字段 language_name: '', @@ -444,9 +456,25 @@ // 页面加载初始化 onLoad(params) { + // 多语言 + let systemInfo = uni.getSystemInfoSync(); + this.systemLocale = systemInfo.language; + this.applicationLocale = uni.getLocale(); + this.isAndroid = systemInfo.platform.toLowerCase() === 'android'; + uni.onLocaleChange((e) => { + this.applicationLocale = e.locale; + }); + var language_key = app.globalData.get_language_value(); + var language_list = this.$t('language'); this.setData({ params: params, + language_list: language_list, + language: language_list[language_key], }); + console.log(language_key); + console.log(this.language); + console.log(this.language_list); + console.log(language_list[language_key]); // 上一个页面记录 var page = app.globalData.prev_page(); @@ -583,13 +611,13 @@ get_user_info_event(e) { // 是否已同意协议 if (!this.agreement_status) { - app.globalData.showToast('请先同意协议'); + app.globalData.showToast(this.$t('login.login.btu2c1')); return false; } // #ifdef MP-WEIXIN uni.getUserProfile({ - desc: '用于完善会员资料', + desc: this.$t('login.login.no8ts6'), lang: 'zh_CN', success: (res) => { this.user_auth_code(res.userInfo); @@ -647,7 +675,7 @@ if ((auth_data || null) != null) { app.globalData.user_auth_login(this, 'user_auth_back_event', null, auth_data); } else { - app.globalData.showToast('授权失败'); + app.globalData.showToast(this.$t('login.login.3nmrg2')); } }, @@ -712,20 +740,20 @@ // 手机号码验证:手机登录、手机注册、手机绑定 if (this.current_opt_type == 'login_sms' || this.current_opt_type == 'reg_sms' || this.current_opt_type == 'bind') { if ((this.form_input_mobile_value || null) == null) { - app.globalData.showToast('请填写手机号码'); + app.globalData.showToast(this.$t('login.login.4c5n8o')); return false; } } // 邮箱验证:邮箱登录、邮箱注册 if (this.current_opt_type == 'login_email' || this.current_opt_type == 'reg_email') { if ((this.form_input_email_value || null) == null) { - app.globalData.showToast('请填写电子邮箱'); + app.globalData.showToast(this.$t('login.login.xak8g1')); return false; } } // 密码找回:邮箱或手机 if (this.current_opt_type == 'forget' && (this.form_input_accounts_value || null) == null) { - app.globalData.showToast('请填写手机或邮箱'); + app.globalData.showToast(this.$t('login.login.ku05ty')); return false; } // 是否开启图片验证码、绑定操作不使用图片验证码 @@ -748,7 +776,7 @@ if (this.current_opt_form != 'bind' && this.current_opt_form != 'bind_verify') { if (this.common_img_verify_state == 1) { if ((this.form_input_image_verify_value || null) == null || this.form_input_image_verify_value.length < 4) { - app.globalData.showToast('请输入有效验证码'); + app.globalData.showToast(this.$t('login.login.7r5h37')); return false; } } @@ -764,7 +792,7 @@ mobile: this.form_input_mobile_value || '', }; if ((post_data.mobile || null) == null) { - app.globalData.showToast('请填写手机号码'); + app.globalData.showToast(this.$t('login.login.4c5n8o')); return false; } } else { @@ -780,7 +808,7 @@ } var accounts = (this.current_opt_type == 'bind_verify' || this.current_opt_type == 'login_sms' || this.current_opt_type == 'reg_sms' ? this.form_input_mobile_value : this.current_opt_type == 'forget' ? this.form_input_accounts_value : this.form_input_email_value) || null; if (accounts == null) { - app.globalData.showToast('请填写账号'); + app.globalData.showToast(this.$t('login.login.24mvbh')); return false; } var post_data = { @@ -793,10 +821,10 @@ // 网络请求 var self = this; uni.showLoading({ - title: '发送中...', + title: this.$t('login.login.s36mk5'), }); this.setData({ - verify_submit_text: '发送中', + verify_submit_text: this.$t('login.login.6881q7'), verify_loading: true, verify_disabled: true, }); @@ -824,19 +852,19 @@ if (temp_time <= 1) { clearInterval(self.temp_clear_time); self.setData({ - verify_submit_text: '获取验证码', + verify_submit_text: this.$t('login.login.s665h5'), verify_disabled: false, }); } else { temp_time--; self.setData({ - verify_submit_text: '剩余 ' + temp_time + ' 秒', + verify_submit_text: this.$t('login.login.n24i5u') + temp_time + this.$t('login.login.4306xr'), }); } }, 1000); } else { this.setData({ - verify_submit_text: '获取验证码', + verify_submit_text: this.$t('login.login.s665h5'), verify_loading: false, verify_disabled: false, form_input_image_verify_value: '', @@ -848,13 +876,13 @@ fail: () => { uni.hideLoading(); this.setData({ - verify_submit_text: '获取验证码', + verify_submit_text: this.$t('login.login.s665h5'), verify_loading: false, verify_disabled: false, form_input_image_verify_value: '', }); this.image_verify_event(image_verify_type); - app.globalData.showToast('网络开小差了哦~'); + app.globalData.showToast(this.$t('login.login.6gojnd')); }, }); }, @@ -873,15 +901,15 @@ e.detail.value['city'] = this.user.city; e.detail.value['gender'] = this.user.gender; var validation = [ - { fields: 'mobile', msg: '请填写手机号码' }, - { fields: 'verify', msg: '请填写验证码' }, + { fields: 'mobile', msg: this.$t('login.login.4c5n8o') }, + { fields: 'verify', msg: this.$t('login.login.01xmab') }, ]; // #ifdef MP - validation.push({ fields: field_openid, msg: '授权id不能为空' }); + validation.push({ fields: field_openid, msg: this.$t('login.login.prqvf1') }); // #endif if (app.globalData.fields_check(e.detail.value, validation)) { uni.showLoading({ - title: '处理中...', + title: this.$t('login.login.4ci850'), }); this.setData({ form_submit_loading: true, @@ -901,7 +929,7 @@ this.setData({ form_submit_loading: false, }); - app.globalData.showToast('网络开小差了哦~'); + app.globalData.showToast(this.$t('login.login.6gojnd')); }, }); } @@ -930,7 +958,7 @@ }; data[field_unionid] = this.user[field_unionid] || ''; uni.showLoading({ - title: '处理中...', + title: this.$t('login.login.4ci850'), }); var self = this; uni.request({ @@ -943,7 +971,7 @@ }, fail: () => { uni.hideLoading(); - app.globalData.showToast('网络开小差了哦~'); + app.globalData.showToast(this.$t('login.login.6gojnd')); }, }); } else { @@ -958,23 +986,23 @@ formLogin(e) { // 是否已同意协议 if (!this.agreement_status) { - app.globalData.showToast('请先同意协议'); + app.globalData.showToast(this.$t('login.login.btu2c1')); return false; } // 数据验证 var validation = []; if (this.current_opt_type == 'login_sms') { - validation.push({ fields: 'accounts', msg: '请输入手机号码' }); + validation.push({ fields: 'accounts', msg: this.$t('login.login.yvj88j') }); } if (this.current_opt_type == 'login_email') { - validation.push({ fields: 'accounts', msg: '请输入电子邮箱' }); + validation.push({ fields: 'accounts', msg: this.$t('login.login.yo6x3p') }); } if (this.current_opt_type == 'login_username') { - validation.push({ fields: 'accounts', msg: '请输入账号' }); - validation.push({ fields: 'pwd', msg: '请输入密码' }); + validation.push({ fields: 'accounts', msg: this.$t('login.login.n7vh75') }); + validation.push({ fields: 'pwd', msg: this.$t('login.login.277w03') }); } if (this.current_opt_type == 'login_sms' || this.current_opt_type == 'login_email' || (this.current_opt_type == 'login_username' && this.home_user_login_img_verify_state == 1)) { - validation.push({ fields: 'verify', msg: '请输入验证码' }); + validation.push({ fields: 'verify', msg: this.$t('login.login.cesl5d') }); } if (app.globalData.fields_check(e.detail.value, validation)) { // 登录方式 @@ -1001,7 +1029,7 @@ // 网络请求 uni.showLoading({ - title: '登录中...', + title: this.$t('login.login.c5wa4u'), }); this.setData({ form_submit_loading: true, @@ -1019,7 +1047,7 @@ this.setData({ form_submit_loading: false, }); - app.globalData.showToast('网络开小差了哦~'); + app.globalData.showToast(this.$t('login.login.6gojnd')); }, }); } @@ -1029,23 +1057,23 @@ formReg(e) { // 是否已同意协议 if (!this.agreement_status) { - app.globalData.showToast('请先同意协议'); + app.globalData.showToast(this.$t('login.login.btu2c1')); return false; } // 数据验证 var validation = []; if (this.current_opt_type == 'reg_sms') { - validation.push({ fields: 'accounts', msg: '请输入手机号码' }); + validation.push({ fields: 'accounts', msg: this.$t('login.login.yvj88j') }); } if (this.current_opt_type == 'reg_email') { - validation.push({ fields: 'accounts', msg: '请输入电子邮箱' }); + validation.push({ fields: 'accounts', msg: this.$t('login.login.yo6x3p') }); } if (this.current_opt_type == 'reg_username') { - validation.push({ fields: 'accounts', msg: '请输入账号' }); - validation.push({ fields: 'pwd', msg: '请输入密码' }); + validation.push({ fields: 'accounts', msg: this.$t('login.login.n7vh75') }); + validation.push({ fields: 'pwd', msg: this.$t('login.login.277w03') }); } if (this.current_opt_type == 'reg_sms' || this.current_opt_type == 'reg_email' || (this.current_opt_type == 'reg_username' && this.home_user_register_img_verify_state == 1)) { - validation.push({ fields: 'verify', msg: '请输入验证码' }); + validation.push({ fields: 'verify', msg: this.$t('login.login.cesl5d') }); } if (app.globalData.fields_check(e.detail.value, validation)) { // 注册方式 @@ -1077,7 +1105,7 @@ // 网络请求 uni.showLoading({ - title: '注册中...', + title: this.$t('login.login.g30ew7'), }); this.setData({ form_submit_loading: true, @@ -1095,7 +1123,7 @@ this.setData({ form_submit_loading: false, }); - app.globalData.showToast('网络开小差了哦~'); + app.globalData.showToast(this.$t('login.login.6gojnd')); }, }); } @@ -1110,14 +1138,14 @@ formForget(e) { // 数据验证 var validation = [ - { fields: 'accounts', msg: '请输入手机或邮箱' }, - { fields: 'verify', msg: '请输入验证码' }, - { fields: 'pwd', msg: '请设置密码' }, + { fields: 'accounts', msg: this.$t('login.login.h0515x') }, + { fields: 'verify', msg: this.$t('login.login.cesl5d') }, + { fields: 'pwd', msg: this.$t('login.login.wysg7k') }, ]; if (app.globalData.fields_check(e.detail.value, validation)) { // 网络请求 uni.showLoading({ - title: '处理中...', + title: this.$t('login.login.4ci850'), }); this.setData({ form_submit_loading: true, @@ -1158,7 +1186,7 @@ this.setData({ form_submit_loading: false, }); - app.globalData.showToast('网络开小差了哦~'); + app.globalData.showToast(this.$t('login.login.6gojnd')); }, }); } @@ -1196,7 +1224,7 @@ this.setData({ form_submit_loading: false, }); - app.globalData.showToast('网络开小差了哦~'); + app.globalData.showToast(this.$t('login.login.6gojnd')); }, }); } else { @@ -1239,7 +1267,7 @@ agreement_event(e) { var value = e.currentTarget.dataset.value || null; if (value == null) { - app.globalData.showToast('协议类型有误'); + app.globalData.showToast(this.$t('login.login.4wc3hr')); return false; } @@ -1247,7 +1275,7 @@ var key = 'agreement_' + value + '_url'; var url = app.globalData.get_config('config.' + key) || null; if (url == null) { - app.globalData.showToast('协议url地址有误'); + app.globalData.showToast(this.$t('login.login.x0nxxf')); return false; } @@ -1362,7 +1390,7 @@ app.globalData.init_config(); var self = this; uni.showLoading({ - title: '加载中...', + title: this.$t('login.login.05h35f'), }); setTimeout(function () { self.init(); @@ -1374,7 +1402,7 @@ plugins_thirdpartylogin_event(e) { // 是否已同意协议 if (!this.agreement_status) { - app.globalData.showToast('请先同意协议'); + app.globalData.showToast(this.$t('login.login.btu2c1')); return false; } this.setData({ @@ -1422,23 +1450,41 @@ checked_language_event(e) { this.setData({ language_name: e.currentTarget.dataset.value, - language_index: e.currentTarget.dataset.index, + language_key: e.currentTarget.dataset.key, }); }, // 提交语言选择 popup_sub_language_event() { + this.language_change(this.language_key); this.setData({ language: this.language_name, popup_language_status: false, }); }, + // 多语言切换 + language_change(key) { + if (this.isAndroid) { + uni.showModal({ + content: this.$t('login.login.d9d11z'), + success: (res) => { + if (res.confirm) { + uni.setLocale(key); + } + }, + }); + } else { + uni.setLocale(key); + this.$i18n.locale = key; + } + }, + // 打开登陆方式弹层 popup_login_open_event() { // 是否已同意协议 if (!this.agreement_status) { - app.globalData.showToast('请先同意协议'); + app.globalData.showToast(this.$t('login.login.btu2c1')); return false; } this.setData({ diff --git a/pages/user-order-detail/user-order-detail.vue b/pages/user-order-detail/user-order-detail.vue index 1d922046..96845b37 100644 --- a/pages/user-order-detail/user-order-detail.vue +++ b/pages/user-order-detail/user-order-detail.vue @@ -13,7 +13,7 @@ {{ detail.address_data.province_name }}{{ detail.address_data.city_name }}{{ detail.address_data.county_name }}{{ detail.address_data.address }} - 查看位置 + {{$t('user-order-detail.user-order-detail.7lp6gw')}} @@ -21,7 +21,7 @@ - 商品信息 + {{$t('user-order-detail.user-order-detail.7f8p26')}} @@ -43,16 +43,16 @@ {{ detail.buy_number_count }}件 合计 {{ detail.currency_data.currency_symbol }}{{ detail.total_price }}{{$t('user-order-detail.user-order-detail.423rmr')}}{{ detail.buy_number_count }}{{$t('user-order-detail.user-order-detail.41ty94')}}{{ detail.currency_data.currency_symbol }}{{ detail.total_price }}{{$t('user-order-detail.user-order-detail.xcj552')}} - {{ site_fictitious.title || '密钥信息' }} + {{ site_fictitious.title || $t('user-order-detail.user-order-detail.y9woor') }} @@ -61,7 +61,7 @@ - 未配置数据 + {{$t('user-order-detail.user-order-detail.7xtnjt')}} @@ -69,11 +69,11 @@ - 取货信息 + {{$t('user-order-detail.user-order-detail.7dikfm')}} - 取货码: - {{ detail.extraction_data.code || '取货码不存在、请联系管理员' }} + {{$t('user-order-detail.user-order-detail.o38952')}} + {{ detail.extraction_data.code || $t('user-order-detail.user-order-detail.hpq62x') }} @@ -81,7 +81,7 @@ - 订单信息 + {{$t('user-order-detail.user-order-detail.0f26j2')}} {{ item.name }} @@ -92,7 +92,7 @@ - 扩展数据 + {{$t('user-order-detail.user-order-detail.ct34n5')}} {{ item.name }} @@ -164,7 +164,7 @@ init() { var self = this; uni.showLoading({ - title: '加载中...', + title: this.$t('login.login.05h35f'), }); this.setData({ data_list_loding_status: 1, @@ -184,27 +184,27 @@ self.setData({ detail: data.data, detail_list: [ - { name: '出货服务', value: data.data.warehouse_name || '' }, - { name: '订单模式', value: data.data.order_model_name || '' }, - { name: '订单编号', value: data.data.order_no || '' }, - { name: '订单状态', value: data.data.status_name || '' }, - { name: '支付状态', value: data.data.pay_status_name || '' }, - { name: '订单单价', value: data.data.price || '' }, - { name: '订单总价', value: data.data.total_price || '' }, - { name: '优惠金额', value: data.data.preferential_price || '' }, - { name: '增加金额', value: data.data.increase_price || '' }, - { name: '支付金额', value: data.data.pay_price || '' }, - { name: '支付方式', value: (data.data.payment_name || '') + ((data.data.is_under_line_text || null) == null || (data.data.payment_name || null) == null ? '' : '(' + data.data.is_under_line_text + ')') }, - { name: '快递公司', value: data.data.express_name || '' }, - { name: '快递单号', value: data.data.express_number || '' }, - { name: '用户留言', value: data.data.user_note || '' }, - { name: '创建时间', value: data.data.add_time || '' }, - { name: '确认时间', value: data.data.confirm_time || '' }, - { name: '支付时间', value: data.data.pay_time || '' }, - { name: '发货时间', value: data.data.delivery_time || '' }, - { name: '收货时间', value: data.data.collect_time || '' }, - { name: '取消时间', value: data.data.cancel_time || '' }, - { name: '关闭时间', value: data.data.close_time || '' }, + { name: this.$t('user-order-detail.user-order-detail.346376'), value: data.data.warehouse_name || '' }, + { name: this.$t('user-order-detail.user-order-detail.io6p5k'), value: data.data.order_model_name || '' }, + { name: this.$t('user-order-detail.user-order-detail.n18sd2'), value: data.data.order_no || '' }, + { name: this.$t('user-order-detail.user-order-detail.yxwu8n'), value: data.data.status_name || '' }, + { name: this.$t('user-order-detail.user-order-detail.23qj7m'), value: data.data.pay_status_name || '' }, + { name: this.$t('user-order-detail.user-order-detail.vg4jb1'), value: data.data.price || '' }, + { name: this.$t('user-order-detail.user-order-detail.2y7l13'), value: data.data.total_price || '' }, + { name: this.$t('user-order-detail.user-order-detail.6ub2j0'), value: data.data.preferential_price || '' }, + { name: this.$t('user-order-detail.user-order-detail.8b18q8'), value: data.data.increase_price || '' }, + { name: this.$t('user-order-detail.user-order-detail.516tlr'), value: data.data.pay_price || '' }, + { name: this.$t('user-order-detail.user-order-detail.0e1sfs'), value: (data.data.payment_name || '') + ((data.data.is_under_line_text || null) == null || (data.data.payment_name || null) == null ? '' : '(' + data.data.is_under_line_text + ')') }, + { name: this.$t('user-order-detail.user-order-detail.12d445'), value: data.data.express_name || '' }, + { name: this.$t('user-order-detail.user-order-detail.2byl8l'), value: data.data.express_number || '' }, + { name: this.$t('user-order-detail.user-order-detail.2b5fc8'), value: data.data.user_note || '' }, + { name: this.$t('user-order-detail.user-order-detail.h2c78h'), value: data.data.add_time || '' }, + { name: this.$t('user-order-detail.user-order-detail.9vivhl'), value: data.data.confirm_time || '' }, + { name: this.$t('user-order-detail.user-order-detail.wn83rn'), value: data.data.pay_time || '' }, + { name: this.$t('user-order-detail.user-order-detail.1674dc'), value: data.data.delivery_time || '' }, + { name: this.$t('user-order-detail.user-order-detail.0i938r'), value: data.data.collect_time || '' }, + { name: this.$t('user-order-detail.user-order-detail.1jpv4n'), value: data.data.cancel_time || '' }, + { name: this.$t('user-order-detail.user-order-detail.8o2of3'), value: data.data.close_time || '' }, ], extension_data: data.data.extension_data || [], site_fictitious: data.site_fictitious || null, @@ -229,9 +229,9 @@ self.setData({ data_list_loding_status: 2, data_bottom_line_status: false, - data_list_loding_msg: '网络开小差了哦~', + data_list_loding_msg: this.$t('login.login.6gojnd'), }); - app.globalData.showToast('网络开小差了哦~'); + app.globalData.showToast(this.$t('login.login.6gojnd')); }, }); }, @@ -241,7 +241,7 @@ var oid = e.currentTarget.dataset.oid || 0; var did = e.currentTarget.dataset.did || 0; if (oid == 0 || did == 0) { - app.globalData.showToast('参数有误'); + app.globalData.showToast(this.$t('user-order-detail.user-order-detail.5k6k56')); return false; } @@ -254,7 +254,7 @@ // 地图查看 address_map_event(e) { if ((this.detail.address_data || null) == null) { - app.globalData.showToast('地址有误'); + app.globalData.showToast(this.$t('user-order-detail.user-order-detail.i876o3')); return false; }