fix: some
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 2m16s

This commit is contained in:
luo
2026-10-13 18:02:13 +08:00
parent 97dec4dc65
commit 697ff9c33c
6 changed files with 263 additions and 54 deletions

View File

@@ -1,6 +1,8 @@
// Local-only visual QA: no request reaches the real backend.
import { preview } from 'vite';
let notificationRead = false;
const server = await preview({
configFile: false,
build: { outDir: 'dist/build/h5' },
@@ -19,6 +21,14 @@ const server = await preview({
expiry_reminder: { remaining_days: 0, expires_at: '2026-10-13T16:00:00Z', level: 'red', level_name: '即将到期' }
};
if (req.url.startsWith('/__mock/notifications')) data = { count: 0, items: [], total: 0 };
if (process.env.H5_MOCK_NOTIFICATIONS === '1') {
if (req.url.startsWith('/__mock/notifications/unread-count')) data = { count: notificationRead ? 0 : 1 };
else if (/^\/__mock\/notifications\/42\/read/.test(req.url)) { notificationRead = true; data = { success: true }; }
else if (req.url.startsWith('/__mock/notifications/read-all')) { notificationRead = true; data = { updated_count: 1 }; }
else if (req.url.startsWith('/__mock/notifications')) data = {
items: [{ id: 42, title: '套餐临期提醒', body: '您的套餐即将到期,请及时续费。', category: 'expiry', severity: 'warning', is_read: notificationRead, created_at: '2026-10-13T08:00:00+08:00' }], total: 1
};
}
const conflict = req.url.startsWith('/__mock/auth/bind-phone');
res.setHeader('Content-Type', 'application/json; charset=utf-8');
res.end(JSON.stringify({ code: conflict ? 1192 : 0, msg: conflict ? '该资产已绑定手机号,如需更换请联系管理员' : 'success', data }));