Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuchentong committed Jul 25, 2024
1 parent d0649cf commit 2d1c1b8
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 22 deletions.
27 changes: 27 additions & 0 deletions src/bootstrap/launch/app.launch.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
function checkAppUpdate() {
const updateManager = uni.getUpdateManager()

updateManager.onUpdateReady(() => {
uni.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: ({ confirm }) => confirm && updateManager.applyUpdate(),
})
})

updateManager.onUpdateFailed(() => {
// 新的版本下载失败
})

updateManager.onCheckForUpdate(({ hasUpdate }) => {
// 请求完新版本信息的回调
if (hasUpdate) {
uni.showToast({
title: '检测到新版本,正在准备更新',
mask: true,
})
}
})
}

function setupAppShare() {
// #ifdef MP-WEIXIN
const descriptor = Object.getOwnPropertyDescriptor(wx, 'onAppRoute')
Expand All @@ -15,5 +41,6 @@ function setupAppShare() {
}

export function appLaunch() {
checkAppUpdate()
setupAppShare()
}
51 changes: 29 additions & 22 deletions src/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,71 +10,78 @@
"path": "pages/calculation-export/index",
"type": "page",
"layout": "default",
"navigationBarTitleText": "计算试题",
"meta": {}
},
{
"path": "pages/calculation-export/questions",
"type": "page"
"type": "page",
"navigationBarTitleText": "计算试题",
"meta": {}
},
{
"path": "pages/calculation-practise/index",
"type": "page",
"layout": "default",
"navigationBarTitleText": "计算练习",
"meta": {}
},
{
"path": "pages/calculation-practise/questions",
"type": "page"
},
{
"path": "pages/page1/index",
"type": "page"
},
{
"path": "pages/page2/index",
"type": "page"
"type": "page",
"navigationBarTitleText": "计算练习",
"meta": {}
},
{
"path": "pages/poetry/index",
"type": "page",
"layout": "default",
"meta": {},
"style": {
"navigationBarTitleText": "诗词",
"navigationStyle": "custom",
"pageOrientation": "auto"
}
},
"meta": {}
},
{
"path": "pages/shulte/index",
"type": "page",
"layout": "default",
"style": {
"navigationBarTitleText": "舒尔特方格"
},
"meta": {}
},
{
"path": "pages/shulte/questions",
"type": "page",
"layout": "default",
"style": {
"navigationBarTitleText": "舒尔特方格"
},
"meta": {}
},
{
"path": "pages/snake/game",
"type": "page"
"type": "page",
"style": {
"navigationBarTitleText": "贪吃蛇"
},
"meta": {}
},
{
"path": "pages/snake/index",
"type": "page",
"layout": "default",
"style": {
"navigationBarTitleText": "贪吃蛇"
},
"meta": {}
},
{
"path": "pages/timer/index",
"type": "page",
"layout": "default",
"meta": {},
"style": {
"navigationBarTitleText": "时钟",
"navigationStyle": "custom",
"pageOrientation": "auto"
}
},
"meta": {}
}
],
"globalStyle": {
Expand All @@ -84,7 +91,7 @@
"backgroundTextStyle": "@bgTxtStyle",
"navigationBarBackgroundColor": "@navBgColor",
"navigationBarTextStyle": "@navTxtStyle",
"navigationStyle": "default"
"navigationStyle": "custom"
},
"subPackages": []
}

0 comments on commit 2d1c1b8

Please sign in to comment.