Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(frontend): 锁屏前在 TOTP 页面锁屏后小程序 js 报异常 #35

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v1.1.7 - TBD

### fixed

- fix(frontend): 锁屏前在 TOTP 页面锁屏后小程序 js 报异常(#35)

## v1.1.6

### optimized
Expand Down
10 changes: 4 additions & 6 deletions miniprogram/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,18 @@ App<GlobalData>({
logger.error('小程序更新下载异常')
})
},
onError(e: string) {
async onError(e: string) {
logger.error('小程序异常', e)

wx.showToast({ title: '小程序异常', icon: 'error' })
await wx.showToast({ title: '小程序异常', icon: 'error' })
},
onUnhandledRejection(e: AppOnUnhandledRejection) {
async onUnhandledRejection(e: AppOnUnhandledRejection) {
if (e.reason instanceof EE) {
wx.showToast({ title: e.reason.message || MESSAGE[e.reason.code], icon: 'error' })
await wx.showToast({ title: e.reason.message || MESSAGE[e.reason.code], icon: 'error' })

return
}

logger.error('未知错误', e)

wx.showToast({ title: '未知错误', icon: 'error' })
}
})
4 changes: 2 additions & 2 deletions miniprogram/pages/totp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ Page({
.catch((e) => {
this.setData({ toptipError: e.message })
})
.finally(async () => {
await wx.hideLoading()
.finally(() => {
wx.hideLoading().catch()
})
},
async create() {
Expand Down
3 changes: 2 additions & 1 deletion miniprogram/pages/user/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import utils from '@utils/user'
import type { GlobalData } from 'miniprogram/types/app'

const app = getApp<IGlobalData>()
const app = getApp<GlobalData>()

Page({
data: {
Expand Down