文件
Guoguo 4466c53c7b feat(i18n): 剩余15页全量接入中英(登录/注册/扫码/绑定/佩戴/扫描/治疗/订阅/帮助等)
- 3 个并行 agent 各管 5 页,互不重叠命名空间
- 全 App 18 页均 i18n.bind,22 命名空间/400 键中英对齐
- 动态文案(时长/天数/价格/区域)JS 内 i18n.t 计算;区域标签复用 common.regions
2026-07-19 06:00:04 -07:00

55 行
1.2 KiB
JavaScript

var i18n = require('../../i18n/index')
Page({
data: {
statusBarHeight: 44,
deviceId: '',
trialDays: 7,
isFreeMode: false,
tipTitle: ''
},
onShow: function () {
i18n.bind(this)
},
updateTip: function () {
this.setData({
tipTitle: this.data.isFreeMode
? i18n.t('bindSuccess.freeModeOpen')
: i18n.t('bindSuccess.trialGranted', { days: this.data.trialDays })
})
},
onBack: function () {
wx.navigateBack({
fail: function () {
wx.reLaunch({ url: '/pages/index/index' })
}
})
},
onLoad: function (options) {
var app = getApp()
this.setData({ statusBarHeight: app.globalData.statusBarHeight })
this.setData({ deviceId: options.device_id || '' })
this.updateTip()
var self = this
var http = require('../../utils/request')
http.get('/api/v1/subscription').then(function (sub) {
if (sub && sub.plan === 'free') {
self.setData({ isFreeMode: true })
self.updateTip()
}
}).catch(function () {})
},
onStart: function () {
wx.redirectTo({ url: '/pages/wear-check/wear-check' })
},
onGoHome: function () {
wx.reLaunch({ url: '/pages/index/index' })
}
})