feat(M08-A): 接入顾客端选店下单入口

This commit is contained in:
Codex
2026-06-24 21:26:32 +08:00
parent c90f6e34a1
commit 4ac2c960e4
20 changed files with 734 additions and 32 deletions
+44
View File
@@ -0,0 +1,44 @@
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
const root = new URL('..', import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1');
const read = (path) => readFileSync(join(root, path), 'utf8');
const appJson = JSON.parse(read('miniapp/app.json'));
for (const page of [
'pages/index/index',
'pages/store/detail',
'pages/room/detail'
]) {
assert.ok(appJson.pages.includes(page), `${page} must be registered`);
}
const env = read('miniapp/config/env.js');
assert.match(env, /https:\/\/api\.txyundm\.cn/);
assert.doesNotMatch(env, /localhost|127\.0\.0\.1|http:\/\//);
const api = read('miniapp/utils/api.js');
assert.match(api, /\/auth\/wechat-login/);
assert.match(api, /authorization: `Bearer \$\{token\}`/);
const index = read('miniapp/pages/index/index.js');
assert.match(index, /\/stores\?\$\{query\}/);
assert.match(index, /openStore/);
const store = read('miniapp/pages/store/detail.js');
assert.match(store, /\/stores\/\$\{encodeURIComponent\(storeId\)\}/);
assert.match(store, /\/stores\/\$\{encodeURIComponent\(storeId\)\}\/rooms/);
assert.match(store, /\/stores\/\$\{encodeURIComponent\(this\.data\.storeId\)\}\/wifi/);
const room = read('miniapp/pages/room/detail.js');
for (const route of [
'/pricing/quote',
'/orders/reserve',
'/payments',
'/test-complete'
]) {
assert.match(room, new RegExp(route.replace('/', '\\/')));
}
console.log('PASS: M08-A miniapp customer pages use fixed domain and real app-api calls.');