功能:同步小程序流程

This commit is contained in:
xiaowang
2026-05-23 18:45:41 +08:00
parent 844516988b
commit 30ae763e18
117 changed files with 8823 additions and 76 deletions
+52
View File
@@ -1,11 +1,35 @@
/**
* Purpose: auth supports app.js by holding or executing the auth page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const auth = require('./utils/auth')
/**
* Purpose: permission supports app.js by holding or executing the permission page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const permission = require('./utils/permission')
const { resetLoading } = require('./utils/loading')
/**
* Purpose: idleSession supports app.js by holding or executing the idle session page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const idleSession = require('./utils/idle-session')
const { IDLE_TIMEOUT_MS, IDLE_WARNING_MS } = require('./utils/config')
/**
* Purpose: permissionApi supports app.js by holding or executing the permission api page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const permissionApi = require('./api/permission')
/**
* Purpose: authApi supports app.js by holding or executing the auth api page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const authApi = require('./api/auth')
/**
* Purpose: buildCurrentShop supports app.js by holding or executing the build current shop page or API role.
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
*/
function buildCurrentShop(userInfo) {
if (!userInfo || !userInfo.shopId) {
return null
@@ -27,6 +51,10 @@ App({
pageDirtyFlags: {}
},
/**
* Purpose: onLaunch supports app.js by holding or executing the on launch page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
onLaunch() {
idleSession.init({
timeoutMs: IDLE_TIMEOUT_MS,
@@ -37,14 +65,26 @@ App({
this.bootstrapSession()
},
/**
* Purpose: onShow supports app.js by holding or executing the on show page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
onShow() {
idleSession.onAppShow()
},
/**
* Purpose: onHide supports app.js by holding or executing the on hide page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
onHide() {
idleSession.onAppHide()
},
/**
* Purpose: bootstrapSession supports app.js by holding or executing the bootstrap session page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
bootstrapSession() {
resetLoading()
@@ -66,6 +106,10 @@ App({
}
},
/**
* Purpose: setPermissionState supports app.js by holding or executing the set permission state page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
setPermissionState(permissions) {
const list = Array.isArray(permissions) ? permissions : []
this.globalData.permissions = list
@@ -91,6 +135,10 @@ App({
return permissions
},
/**
* Purpose: refreshUserInfo supports app.js by holding or executing the refresh user info page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
refreshUserInfo(userInfo) {
auth.updateStoredUserInfo(userInfo)
@@ -104,6 +152,10 @@ App({
this.bootstrapSession()
},
/**
* Purpose: clearAdminSession supports app.js by holding or executing the clear admin session page or API role.
* Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow.
*/
clearAdminSession() {
auth.clearSession()
this.globalData.isLoggedIn = false