功能:收口小程序前后台安全与防重复提交

This commit is contained in:
xiaowang
2026-04-20 16:02:57 +08:00
parent eb1c209d79
commit a3df262fae
237 changed files with 14068 additions and 728 deletions
@@ -0,0 +1,28 @@
function ensureStore() {
const app = getApp()
app.globalData.pageDirtyFlags = app.globalData.pageDirtyFlags || {}
return app.globalData.pageDirtyFlags
}
function markDirty(key) {
if (!key) {
return
}
const store = ensureStore()
store[key] = true
}
function consumeDirty(key) {
if (!key) {
return false
}
const store = ensureStore()
const value = Boolean(store[key])
delete store[key]
return value
}
module.exports = {
markDirty,
consumeDirty
}