feat(i18n): 剩余15页全量接入中英(登录/注册/扫码/绑定/佩戴/扫描/治疗/订阅/帮助等)
- 3 个并行 agent 各管 5 页,互不重叠命名空间 - 全 App 18 页均 i18n.bind,22 命名空间/400 键中英对齐 - 动态文案(时长/天数/价格/区域)JS 内 i18n.t 计算;区域标签复用 common.regions
这个提交包含在:
@@ -1,6 +1,7 @@
|
||||
var app = getApp()
|
||||
var http = require('../../utils/request')
|
||||
var config = require('../../config/env')
|
||||
var i18n = require('../../i18n/index')
|
||||
|
||||
var DEFAULT_AVATAR = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI9t2NHfLvvMiaiaCJQn3KP2P0vAHp1QBP0piavhGfhKCARlGd6z1EbR58ibJXKCp5WVlNnojwA/640'
|
||||
|
||||
@@ -9,7 +10,7 @@ function randomNickname() {
|
||||
for (var i = 0; i < 4; i++) {
|
||||
digits += Math.floor(Math.random() * 10)
|
||||
}
|
||||
return '用户' + digits
|
||||
return i18n.t('register.nicknamePrefix') + digits
|
||||
}
|
||||
|
||||
Page({
|
||||
@@ -21,6 +22,10 @@ Page({
|
||||
phone: ''
|
||||
},
|
||||
|
||||
onShow: function () {
|
||||
i18n.bind(this)
|
||||
},
|
||||
|
||||
onLoad: function () {
|
||||
this.setData({
|
||||
statusBarHeight: app.globalData.statusBarHeight,
|
||||
@@ -58,19 +63,19 @@ Page({
|
||||
onGetPhoneNumber: function (e) {
|
||||
var self = this
|
||||
if (!e.detail || !e.detail.code) {
|
||||
wx.showToast({ title: '需要授权手机号才能完成注册', icon: 'none' })
|
||||
wx.showToast({ title: i18n.t('register.phoneRequired'), icon: 'none' })
|
||||
return
|
||||
}
|
||||
self.setData({ loading: true })
|
||||
http.post('/api/v1/user/phone', { code: e.detail.code }).then(function (data) {
|
||||
self.setData({
|
||||
loading: false,
|
||||
phone: '已授权'
|
||||
phone: i18n.t('register.authorized')
|
||||
})
|
||||
wx.showToast({ title: '手机号授权成功', icon: 'success' })
|
||||
wx.showToast({ title: i18n.t('register.phoneAuthSuccess'), icon: 'success' })
|
||||
}).catch(function (err) {
|
||||
self.setData({ loading: false })
|
||||
wx.showToast({ title: err.message || '手机号授权失败', icon: 'none' })
|
||||
wx.showToast({ title: err.message || i18n.t('register.phoneAuthFailed'), icon: 'none' })
|
||||
})
|
||||
},
|
||||
|
||||
@@ -88,13 +93,13 @@ Page({
|
||||
if (data.code === 0 && data.data && data.data.avatar) {
|
||||
resolve(data.data.avatar)
|
||||
} else {
|
||||
reject(new Error(data.message || '上传失败'))
|
||||
reject(new Error(data.message || i18n.t('register.uploadFailed')))
|
||||
}
|
||||
} catch (e) {
|
||||
reject(new Error('上传失败'))
|
||||
reject(new Error(i18n.t('register.uploadFailed')))
|
||||
}
|
||||
},
|
||||
fail: function () { reject(new Error('上传失败')) }
|
||||
fail: function () { reject(new Error(i18n.t('register.uploadFailed'))) }
|
||||
})
|
||||
})
|
||||
},
|
||||
@@ -105,12 +110,12 @@ Page({
|
||||
var avatarUrl = self.data.avatarUrl
|
||||
|
||||
if (!self.data.phone) {
|
||||
wx.showToast({ title: '请先授权手机号', icon: 'none' })
|
||||
wx.showToast({ title: i18n.t('register.phoneFirst'), icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
if (!nickname) {
|
||||
wx.showToast({ title: '请输入昵称', icon: 'none' })
|
||||
wx.showToast({ title: i18n.t('register.nicknameRequired'), icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
@@ -132,11 +137,11 @@ Page({
|
||||
wx.switchTab({ url: '/pages/index/index' })
|
||||
}).catch(function (err) {
|
||||
self.setData({ loading: false })
|
||||
wx.showToast({ title: err.message || '保存失败', icon: 'none' })
|
||||
wx.showToast({ title: err.message || i18n.t('common.saveFailed'), icon: 'none' })
|
||||
})
|
||||
},
|
||||
|
||||
onAgreement: function () {
|
||||
wx.showModal({ title: '提示', content: '用户协议和隐私政策内容建设中', showCancel: false })
|
||||
wx.showModal({ title: i18n.t('register.agreementTitle'), content: i18n.t('register.agreementContent'), showCancel: false })
|
||||
}
|
||||
})
|
||||
|
||||
在新工单中引用
屏蔽一个用户