fix: 未登录用户每次提示上传QR,已登录每月一次
Some checks failed
Test / unit-test (push) Successful in 4s
Test / build-check (push) Successful in 4s
PR Preview / teardown-preview (pull_request) Has been skipped
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Failing after 1m26s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-09 10:12:53 +00:00
parent 1018c1db11
commit e3285f0961

View File

@@ -516,12 +516,19 @@ async function loadBrand() {
} catch {
brand.value = {}
}
// Prompt QR upload at most once per month
// Prompt QR upload: logged-in users once per month, anonymous every time
if (showBrandHint.value) {
const lastPrompt = localStorage.getItem('qr_upload_prompt_time')
const oneMonth = 30 * 24 * 60 * 60 * 1000
if (!lastPrompt || Date.now() - Number(lastPrompt) > oneMonth) {
localStorage.setItem('qr_upload_prompt_time', String(Date.now()))
let shouldPrompt = true
if (authStore.isLoggedIn) {
const lastPrompt = localStorage.getItem('qr_upload_prompt_time')
const oneMonth = 30 * 24 * 60 * 60 * 1000
if (lastPrompt && Date.now() - Number(lastPrompt) < oneMonth) {
shouldPrompt = false
} else {
localStorage.setItem('qr_upload_prompt_time', String(Date.now()))
}
}
if (shouldPrompt) {
const ok = await showConfirm(
'上传你的专属二维码,让配方卡片更专业 ✨',
{ okText: '去上传', cancelText: '下次再说' }