fix: onPageNotFound 兜底防空页崩溃 + 首页/记录页接入 i18n(语言切换覆盖全部3个tab)

这个提交包含在:
Guoguo
2026-07-19 05:31:19 -07:00
父节点 8e11b2da10
当前提交 28c711cd00
修改 8 个文件,包含 125 行新增32 行删除
+12 -8
查看文件
@@ -1,5 +1,6 @@
var ble = require('../../services/ble')
var api = require('../../utils/api')
var i18n = require('../../i18n/index')
var app = getApp()
Page({
@@ -17,6 +18,7 @@ Page({
},
onShow: function () {
i18n.bind(this)
this.checkState()
this._onStatus = this.onBleStatus.bind(this)
this._onBattery = this.onBleBattery.bind(this)
@@ -69,9 +71,11 @@ Page({
})
var p2 = api.getSubscription().then(function (sub) {
var remaining = sub.remaining_days || 0
self.setData({
subscription: sub,
subRemaining: sub.remaining_days || 0
subRemaining: remaining,
subRemainText: i18n.t('home.smartRemain', { days: remaining })
})
}).catch(function (err) {
console.error('getSubscription failed', err)
@@ -111,7 +115,7 @@ Page({
},
onError: function (err) {
self.setData({ connected: false, bleState: 'error' })
wx.showToast({ title: err.msg || '连接失败', icon: 'none' })
wx.showToast({ title: err.msg || i18n.t('home.connectFailed'), icon: 'none' })
}
})
},
@@ -123,12 +127,12 @@ Page({
onManageDevice: function () {
var self = this
wx.showActionSheet({
itemList: ['解绑当前设备'],
itemList: [i18n.t('home.unbindAction')],
success: function (res) {
if (res.tapIndex === 0) {
wx.showModal({
title: '确认解绑',
content: '解绑后将无法使用该设备,确定要解绑吗?',
title: i18n.t('home.unbindConfirmTitle'),
content: i18n.t('home.unbindConfirmText'),
success: function (modalRes) {
if (modalRes.confirm) {
self.doUnbind()
@@ -142,7 +146,7 @@ Page({
doUnbind: function () {
var self = this
wx.showLoading({ title: '解绑中...' })
wx.showLoading({ title: i18n.t('home.unbindLoading') })
ble.disconnect()
api.unbindDevice().then(function () {
wx.hideLoading()
@@ -152,10 +156,10 @@ Page({
deviceInfo: null,
connected: false
})
wx.showToast({ title: '已解绑', icon: 'success' })
wx.showToast({ title: i18n.t('home.unbindDone'), icon: 'success' })
}).catch(function (err) {
wx.hideLoading()
wx.showToast({ title: err.message || '解绑失败', icon: 'none' })
wx.showToast({ title: err.message || i18n.t('home.unbindFailed'), icon: 'none' })
})
},