S3 前端收尾泳道收官(FE-6+结算页面族): 盘点修正=views 31 页 S1-B 已搬零残留(归档仓逐文件比对),实际交付四件——FE-D34 利润分析页(views/stats/profit 双 Tab+汇总条[应收/成本分摊/返点/平台净利]+正负着色+口径诚实标注常驻;路由 /stats/profit roles=后端平台门同口径;api settle.ts +profitUsers/profitChannels;vitest 2 件=api 契约+组件挂载);FE-6 Mock 下线(浏览器通道全链移除:main.ts worker 分支/mocks/browser.ts/mockServiceWorker.js/VITE_API_MODE/LoginView 演示提示/Makefile 口径;msw 移 devDependencies 仅存 vitest 层 138 用例不破;packageManager 钉 pnpm12.18.0+lockfile 同步);FE-6 权限矩阵走查(role-menu-matrix.spec.ts 五角色×33 菜单固化快照,未登记新菜单=红,8 件);FE-6 性能(manualChunks:主包 1.27MB/410KB→业务 entry ~19KB+element-plus 341KB+vue-vendor 62KB 全 gzip 逐 chunk<500KB;LCP 真浏览器实测受阻=本机 chromium newPage 即 Target crashed 3 轮全崩 dmesg 无痕,产物口径代替+诚实标注);FE-6 CI+镜像化(ci.yml +web-test job;web/Dockerfile=dist 产物镜像 nginx1.27——容器内 npm 带宽 22~49KiB/s 全量依赖不可行形态裁决,make web-image=宿主 build+nginx 打包;nginx.conf.template envsubst API_UPSTREAM/gzip/SPA fallback/资产强缓存;容器冒烟 root/SPA/反代401/gzip+immutable 全过 镜像50.2MB;deploy/k8s/web.yaml NodePort 30081 备档 kind 未装随 S5 apply);门禁 eslint0/vue-tsc0/vitest 148 全绿(26 文件;guard 菜单 31→32 显式更)/build 9.64s;真机 dev 重启无 msw 引用+proxy→gw 401 应答;验收单 s3-closeout.md(两项环境受阻如实标注)+CHANGELOG+memory-bank 回填
This commit is contained in:
@@ -1,2 +1 @@
|
||||
VITE_API_MODE=real
|
||||
VITE_API_BASE_URL=/api/v1
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# web/Dockerfile S3·FE-6:前端镜像化(**dist 产物镜像**,nginx:alpine)。
|
||||
# 形态裁决:不做容器内 node 构建——本机容器内 npm 生态带宽实测 22~49KiB/s
|
||||
# (npmjs 与 npmmirror 皆然,全量依赖 ~250MB 不可行);构建前置=宿主/CI 的
|
||||
# vite build(make web-image 自动执行,CI web-test job 同链)。镜像只关心产物。
|
||||
# 运行态:静态资源 + SPA fallback + /api 反代(${API_UPSTREAM},默认
|
||||
# go-sms-gateway:8080=k8s 集群内服务名;docker 独立跑时 -e API_UPSTREAM=host:port)。
|
||||
FROM nginx:1.27-alpine
|
||||
COPY web/nginx.conf.template /etc/nginx/templates/default.conf.template
|
||||
COPY web/dist /usr/share/nginx/html
|
||||
ENV API_UPSTREAM=go-sms-gateway:8080
|
||||
EXPOSE 80
|
||||
@@ -1,6 +0,0 @@
|
||||
import { setupWorker } from 'msw/browser'
|
||||
import { handlers } from './handlers'
|
||||
import { fe2Handlers } from './fe2-handlers'
|
||||
import { fe4DetailHandlers, fe4Handlers, fe4HistoryHandlers, fe4RepushHandlers, fe4UplinkHandlers, smsDownlinkHandlers } from './fe4-handlers'
|
||||
|
||||
export const worker = setupWorker(...handlers, ...fe2Handlers, ...fe4Handlers, ...fe4DetailHandlers, ...fe4HistoryHandlers, ...fe4UplinkHandlers, ...fe4RepushHandlers, ...smsDownlinkHandlers)
|
||||
@@ -0,0 +1,35 @@
|
||||
# nginx.conf.template S3·FE-6:envsubst 模板(官方 nginx 镜像 /etc/nginx/templates
|
||||
# 机制,${API_UPSTREAM} 启动注入)。gzip 常开(vite 产物 gzip 后最大 chunk 341KB,
|
||||
# FE-6 单包<500KB 以传输字节计)。
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
gzip on;
|
||||
gzip_types text/css application/javascript application/json image/svg+xml;
|
||||
gzip_min_length 1024;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# hash 文件名资源:一年强缓存(vite contenthash,发版自动失效)
|
||||
location /assets/ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# SPA 路由 fallback
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# API 反代至网关(k8s 内=Service 名;独立容器=-e API_UPSTREAM 覆盖)
|
||||
location /api/ {
|
||||
proxy_pass http://${API_UPSTREAM};
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
client_max_body_size 20m;
|
||||
}
|
||||
}
|
||||
+2
-6
@@ -3,6 +3,7 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"packageManager": "pnpm@12.18.0",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
@@ -21,7 +22,6 @@
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"axios": "^1.7.2",
|
||||
"element-plus": "^2.7.6",
|
||||
"msw": "^2.3.1",
|
||||
"pinia": "^2.1.7",
|
||||
"vue": "^3.4.29",
|
||||
"vue-router": "^4.3.3"
|
||||
@@ -34,6 +34,7 @@
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-vue": "^9.27.0",
|
||||
"jsdom": "^24.1.0",
|
||||
"msw": "^2.3.1",
|
||||
"playwright": "^1.63.0",
|
||||
"prettier": "^3.3.2",
|
||||
"sass": "^1.77.6",
|
||||
@@ -41,10 +42,5 @@
|
||||
"vite": "^5.3.1",
|
||||
"vitest": "^1.6.0",
|
||||
"vue-tsc": "^2.0.22"
|
||||
},
|
||||
"msw": {
|
||||
"workerDirectory": [
|
||||
"public"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+177
-425
File diff suppressed because it is too large
Load Diff
@@ -1,361 +0,0 @@
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
|
||||
/**
|
||||
* Mock Service Worker.
|
||||
* @see https://github.com/mswjs/msw
|
||||
* - Please do NOT modify this file.
|
||||
*/
|
||||
|
||||
const PACKAGE_VERSION = '2.15.0'
|
||||
const INTEGRITY_CHECKSUM = '03cb67ac84128e63d7cd722a6e5b7f1e'
|
||||
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
||||
const activeClientIds = new Set()
|
||||
|
||||
addEventListener('install', function () {
|
||||
self.skipWaiting()
|
||||
})
|
||||
|
||||
addEventListener('activate', function (event) {
|
||||
event.waitUntil(self.clients.claim())
|
||||
})
|
||||
|
||||
addEventListener('message', async function (event) {
|
||||
const clientId = Reflect.get(event.source || {}, 'id')
|
||||
|
||||
if (!clientId || !self.clients) {
|
||||
return
|
||||
}
|
||||
|
||||
const client = await self.clients.get(clientId)
|
||||
|
||||
if (!client) {
|
||||
return
|
||||
}
|
||||
|
||||
const allClients = await self.clients.matchAll({
|
||||
type: 'window',
|
||||
})
|
||||
|
||||
switch (event.data) {
|
||||
case 'KEEPALIVE_REQUEST': {
|
||||
sendToClient(client, {
|
||||
type: 'KEEPALIVE_RESPONSE',
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
case 'INTEGRITY_CHECK_REQUEST': {
|
||||
sendToClient(client, {
|
||||
type: 'INTEGRITY_CHECK_RESPONSE',
|
||||
payload: {
|
||||
packageVersion: PACKAGE_VERSION,
|
||||
checksum: INTEGRITY_CHECKSUM,
|
||||
},
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
case 'MOCK_ACTIVATE': {
|
||||
activeClientIds.add(clientId)
|
||||
|
||||
sendToClient(client, {
|
||||
type: 'MOCKING_ENABLED',
|
||||
payload: {
|
||||
client: {
|
||||
id: client.id,
|
||||
frameType: client.frameType,
|
||||
},
|
||||
},
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
case 'CLIENT_CLOSED': {
|
||||
activeClientIds.delete(clientId)
|
||||
|
||||
const remainingClients = allClients.filter((client) => {
|
||||
return client.id !== clientId
|
||||
})
|
||||
|
||||
// Unregister itself when there are no more clients
|
||||
if (remainingClients.length === 0) {
|
||||
self.registration.unregister()
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
addEventListener('fetch', function (event) {
|
||||
const requestInterceptedAt = Date.now()
|
||||
|
||||
// Bypass navigation requests.
|
||||
if (event.request.mode === 'navigate') {
|
||||
return
|
||||
}
|
||||
|
||||
// Opening the DevTools triggers the "only-if-cached" request
|
||||
// that cannot be handled by the worker. Bypass such requests.
|
||||
if (
|
||||
event.request.cache === 'only-if-cached' &&
|
||||
event.request.mode !== 'same-origin'
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
// Bypass all requests when there are no active clients.
|
||||
// Prevents the self-unregistered worked from handling requests
|
||||
// after it's been terminated (still remains active until the next reload).
|
||||
if (activeClientIds.size === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
const requestId = crypto.randomUUID()
|
||||
event.respondWith(handleRequest(event, requestId, requestInterceptedAt))
|
||||
})
|
||||
|
||||
/**
|
||||
* @param {FetchEvent} event
|
||||
* @param {string} requestId
|
||||
* @param {number} requestInterceptedAt
|
||||
*/
|
||||
async function handleRequest(event, requestId, requestInterceptedAt) {
|
||||
const client = await resolveMainClient(event)
|
||||
const requestCloneForEvents = event.request.clone()
|
||||
const response = await getResponse(
|
||||
event,
|
||||
client,
|
||||
requestId,
|
||||
requestInterceptedAt,
|
||||
)
|
||||
|
||||
// Send back the response clone for the "response:*" life-cycle events.
|
||||
// Ensure MSW is active and ready to handle the message, otherwise
|
||||
// this message will pend indefinitely.
|
||||
if (client && activeClientIds.has(client.id)) {
|
||||
const serializedRequest = await serializeRequest(requestCloneForEvents)
|
||||
|
||||
// Omit the body of server-sent event stream responses.
|
||||
// Cloning such responses would prevent client-side stream cancelations
|
||||
// from reaching the original stream (a teed stream only cancels its
|
||||
// source once both of its branches cancel) and would buffer the
|
||||
// entire stream into the unconsumed clone indefinitely.
|
||||
const isEventStreamResponse = response.headers
|
||||
.get('content-type')
|
||||
?.toLowerCase()
|
||||
.startsWith('text/event-stream')
|
||||
|
||||
// Clone the response so both the client and the library could consume it.
|
||||
const responseClone = isEventStreamResponse ? null : response.clone()
|
||||
|
||||
sendToClient(
|
||||
client,
|
||||
{
|
||||
type: 'RESPONSE',
|
||||
payload: {
|
||||
isMockedResponse: IS_MOCKED_RESPONSE in response,
|
||||
request: {
|
||||
id: requestId,
|
||||
...serializedRequest,
|
||||
},
|
||||
response: {
|
||||
type: response.type,
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
headers: Object.fromEntries(response.headers.entries()),
|
||||
body: responseClone ? responseClone.body : null,
|
||||
},
|
||||
},
|
||||
},
|
||||
responseClone && responseClone.body
|
||||
? [serializedRequest.body, responseClone.body]
|
||||
: [],
|
||||
)
|
||||
}
|
||||
|
||||
return response
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the main client for the given event.
|
||||
* Client that issues a request doesn't necessarily equal the client
|
||||
* that registered the worker. It's with the latter the worker should
|
||||
* communicate with during the response resolving phase.
|
||||
* @param {FetchEvent} event
|
||||
* @returns {Promise<Client | undefined>}
|
||||
*/
|
||||
async function resolveMainClient(event) {
|
||||
const client = await self.clients.get(event.clientId)
|
||||
|
||||
if (activeClientIds.has(event.clientId)) {
|
||||
return client
|
||||
}
|
||||
|
||||
if (client?.frameType === 'top-level') {
|
||||
return client
|
||||
}
|
||||
|
||||
const allClients = await self.clients.matchAll({
|
||||
type: 'window',
|
||||
})
|
||||
|
||||
return allClients
|
||||
.filter((client) => {
|
||||
// Get only those clients that are currently visible.
|
||||
return client.visibilityState === 'visible'
|
||||
})
|
||||
.find((client) => {
|
||||
// Find the client ID that's recorded in the
|
||||
// set of clients that have registered the worker.
|
||||
return activeClientIds.has(client.id)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {FetchEvent} event
|
||||
* @param {Client | undefined} client
|
||||
* @param {string} requestId
|
||||
* @param {number} requestInterceptedAt
|
||||
* @returns {Promise<Response>}
|
||||
*/
|
||||
async function getResponse(event, client, requestId, requestInterceptedAt) {
|
||||
// Clone the request because it might've been already used
|
||||
// (i.e. its body has been read and sent to the client).
|
||||
const requestClone = event.request.clone()
|
||||
|
||||
function passthrough() {
|
||||
// Cast the request headers to a new Headers instance
|
||||
// so the headers can be manipulated with.
|
||||
const headers = new Headers(requestClone.headers)
|
||||
|
||||
// Remove the "accept" header value that marked this request as passthrough.
|
||||
// This prevents request alteration and also keeps it compliant with the
|
||||
// user-defined CORS policies.
|
||||
const acceptHeader = headers.get('accept')
|
||||
if (acceptHeader) {
|
||||
const values = acceptHeader.split(',').map((value) => value.trim())
|
||||
const filteredValues = values.filter(
|
||||
(value) => value !== 'msw/passthrough',
|
||||
)
|
||||
|
||||
if (filteredValues.length > 0) {
|
||||
headers.set('accept', filteredValues.join(', '))
|
||||
} else {
|
||||
headers.delete('accept')
|
||||
}
|
||||
}
|
||||
|
||||
return fetch(requestClone, { headers })
|
||||
}
|
||||
|
||||
// Bypass mocking when the client is not active.
|
||||
if (!client) {
|
||||
return passthrough()
|
||||
}
|
||||
|
||||
// Bypass initial page load requests (i.e. static assets).
|
||||
// The absence of the immediate/parent client in the map of the active clients
|
||||
// means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet
|
||||
// and is not ready to handle requests.
|
||||
if (!activeClientIds.has(client.id)) {
|
||||
return passthrough()
|
||||
}
|
||||
|
||||
// Notify the client that a request has been intercepted.
|
||||
const serializedRequest = await serializeRequest(event.request)
|
||||
const clientMessage = await sendToClient(
|
||||
client,
|
||||
{
|
||||
type: 'REQUEST',
|
||||
payload: {
|
||||
id: requestId,
|
||||
interceptedAt: requestInterceptedAt,
|
||||
...serializedRequest,
|
||||
},
|
||||
},
|
||||
[serializedRequest.body],
|
||||
)
|
||||
|
||||
switch (clientMessage.type) {
|
||||
case 'MOCK_RESPONSE': {
|
||||
return respondWithMock(clientMessage.data)
|
||||
}
|
||||
|
||||
case 'PASSTHROUGH': {
|
||||
return passthrough()
|
||||
}
|
||||
}
|
||||
|
||||
return passthrough()
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Client} client
|
||||
* @param {any} message
|
||||
* @param {Array<Transferable>} transferrables
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
function sendToClient(client, message, transferrables = []) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const channel = new MessageChannel()
|
||||
|
||||
channel.port1.onmessage = (event) => {
|
||||
if (event.data && event.data.error) {
|
||||
return reject(event.data.error)
|
||||
}
|
||||
|
||||
resolve(event.data)
|
||||
}
|
||||
|
||||
client.postMessage(message, [
|
||||
channel.port2,
|
||||
...transferrables.filter(Boolean),
|
||||
])
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Response} response
|
||||
* @returns {Response}
|
||||
*/
|
||||
function respondWithMock(response) {
|
||||
// Setting response status code to 0 is a no-op.
|
||||
// However, when responding with a "Response.error()", the produced Response
|
||||
// instance will have status code set to 0. Since it's not possible to create
|
||||
// a Response instance with status code 0, handle that use-case separately.
|
||||
if (response.status === 0) {
|
||||
return Response.error()
|
||||
}
|
||||
|
||||
const mockedResponse = new Response(response.body, response)
|
||||
|
||||
Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, {
|
||||
value: true,
|
||||
enumerable: true,
|
||||
})
|
||||
|
||||
return mockedResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Request} request
|
||||
*/
|
||||
async function serializeRequest(request) {
|
||||
return {
|
||||
url: request.url,
|
||||
mode: request.mode,
|
||||
method: request.method,
|
||||
headers: Object.fromEntries(request.headers.entries()),
|
||||
cache: request.cache,
|
||||
credentials: request.credentials,
|
||||
destination: request.destination,
|
||||
integrity: request.integrity,
|
||||
redirect: request.redirect,
|
||||
referrer: request.referrer,
|
||||
referrerPolicy: request.referrerPolicy,
|
||||
body: await request.arrayBuffer(),
|
||||
keepalive: request.keepalive,
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,47 @@ export interface GenerateResult {
|
||||
skipped: number
|
||||
}
|
||||
|
||||
// ---- 利润分析(S2-D5;金额=元) ----
|
||||
|
||||
/** 用户利润行(revenue=时间线价收入;cost=通道成本占比分摊;rebate=直线下级返点 R4)。 */
|
||||
export interface UserProfitRow {
|
||||
account_id: number
|
||||
username: string
|
||||
role: string
|
||||
success_count: number
|
||||
revenue: number
|
||||
cost: number
|
||||
rebate: number
|
||||
profit: number
|
||||
}
|
||||
|
||||
/** 用户利润汇总(与列表同 scope)。 */
|
||||
export interface UserProfitSummary {
|
||||
count: number
|
||||
total_revenue: number
|
||||
total_cost: number
|
||||
total_rebate: number
|
||||
platform_profit: number
|
||||
}
|
||||
|
||||
/** 用户利润结果集。 */
|
||||
export interface UserProfitResult {
|
||||
list: UserProfitRow[]
|
||||
total: number
|
||||
summary: UserProfitSummary
|
||||
}
|
||||
|
||||
/** 通道利润行(revenue=全平台用户收入×通道成功占比分摊;cost=通道时间线价直算)。 */
|
||||
export interface ChannelProfitRow {
|
||||
channel_id: number
|
||||
name: string
|
||||
upstream_id: number
|
||||
success_count: number
|
||||
revenue: number
|
||||
cost: number
|
||||
profit: number
|
||||
}
|
||||
|
||||
interface Paged<T> { total: number; list: T[] }
|
||||
|
||||
export const settleApi = {
|
||||
@@ -95,6 +136,12 @@ export const settleApi = {
|
||||
post<SettleLadder>('/settle/ladder', body),
|
||||
deleteLadder: (id: number) => del<null>(`/settle/ladder/${id}`),
|
||||
updateLadder: (id: number, body: { tier_from?: number; price?: number }) => put<null>(`/settle/ladder/${id}`, body),
|
||||
|
||||
// ---- 利润分析(D5;平台角色端点) ----
|
||||
profitUsers: (params: { date_from: string; date_to: string; parent_id?: number; page?: number; page_size?: number }) =>
|
||||
get<UserProfitResult>('/stats/profit/users', params),
|
||||
profitChannels: (params: { date_from: string; date_to: string; channel_id?: number; page?: number; page_size?: number }) =>
|
||||
get<{ list: ChannelProfitRow[]; total: number }>('/stats/profit/channels', params),
|
||||
}
|
||||
|
||||
/** 导出下载(文件流需带 Authorization,axios JSON 拦截器不适配,走 fetch+blob)。 */
|
||||
|
||||
+2
-5
@@ -45,11 +45,8 @@ async function bootstrap() {
|
||||
setupDirectives(app)
|
||||
setupRouterGuard(router)
|
||||
|
||||
// Mock 模式:仅开发态启用 msw(VITE_API_MODE=real 时直连后端)
|
||||
if (import.meta.env.DEV && import.meta.env.VITE_API_MODE === 'mock') {
|
||||
const { worker } = await import('../mocks/browser')
|
||||
await worker.start({ onUnhandledRequest: 'bypass' })
|
||||
}
|
||||
// S3·FE-6:浏览器 Mock 通道已下线(单一 real 模式直连网关);msw 仅保留
|
||||
// 于 vitest 层(mocks/node.ts,测试隔离服务器)。
|
||||
|
||||
await router.isReady()
|
||||
app.mount('#app')
|
||||
|
||||
@@ -69,6 +69,7 @@ export const asyncRoutes: RouteRecordRaw[] = [
|
||||
|
||||
{ path: 'stats/user', name: 'stats-user', component: () => import('@/views/coming/ComingSoon.vue'), meta: { title: '用户统计', icon: 'DataLine', menu: true, group: '统计结算', roles: ['admin', 'ops', 'service'] } },
|
||||
{ path: 'stats/channel', name: 'stats-channel', component: () => import('@/views/coming/ComingSoon.vue'), meta: { title: '通道统计', icon: 'TrendCharts', menu: true, group: '统计结算', roles: ['admin', 'ops'] } },
|
||||
{ path: 'stats/profit', name: 'stats-profit', component: () => import('@/views/stats/profit/index.vue'), meta: { title: '利润分析', icon: 'Coin', menu: true, group: '统计结算', roles: ['admin', 'ops', 'service'], subtitle: '用户利润(含下级返点)· 通道利润 · 平台净利' } },
|
||||
{ path: 'settle', name: 'settle', component: () => import('@/views/settle/index.vue'), meta: { title: '结算管理', icon: 'Wallet', menu: true, group: '统计结算', roles: ['admin', 'ops'] } },
|
||||
|
||||
{ path: 'logs', name: 'logs', component: () => import('@/views/coming/ComingSoon.vue'), meta: { title: '日志报表', icon: 'Document', menu: true, group: '系统管理', roles: ['admin', 'ops', 'service'] } },
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
<div class="glass-card login-card animate-slide-up">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-position="top" @keyup.enter="submit">
|
||||
<el-form-item label="用户名" prop="username">
|
||||
<el-input v-model="form.username" size="large" :placeholder="isMock ? '账号 · admin' : '请输入用户名'" data-testid="login-username" />
|
||||
<el-input v-model="form.username" size="large" placeholder="请输入用户名" data-testid="login-username" />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input v-model="form.password" type="password" size="large" show-password :placeholder="isMock ? '密码 · ·······' : '请输入密码'" data-testid="login-password" />
|
||||
<el-input v-model="form.password" type="password" size="large" show-password placeholder="请输入密码" data-testid="login-password" />
|
||||
</el-form-item>
|
||||
<el-button type="primary" size="large" class="login-btn btn-gradient" :loading="loading" data-testid="login-submit" @click="submit">
|
||||
{{ loading ? '登录中…' : '登 录' }}
|
||||
@@ -34,8 +34,6 @@
|
||||
</el-form>
|
||||
<!-- E5:安全提示(demo login-sec) -->
|
||||
<p class="login-sec">连续 5 次失败将锁定 15 分钟</p>
|
||||
<!-- C1:演示账号提示仅 mock 模式显示(与 main.ts worker 启用条件一致) -->
|
||||
<p v-if="isMock" class="login-tip">Mock 账号:admin/admin123 · customer/123456</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -54,8 +52,6 @@ const route = useRoute()
|
||||
const userStore = useUserStore()
|
||||
const formRef = ref<FormInstance>()
|
||||
const loading = ref(false)
|
||||
// C1:mock 演示提示只在开发态 mock 模式出现(生产 real 模式不泄露演示账号)
|
||||
const isMock = import.meta.env.DEV && import.meta.env.VITE_API_MODE === 'mock'
|
||||
|
||||
const form = reactive({ username: '', password: '' })
|
||||
const rules: FormRules = {
|
||||
@@ -139,5 +135,4 @@ async function submit() {
|
||||
.login-card { padding: 32px; }
|
||||
.login-btn { width: 100%; margin-top: 8px; letter-spacing: 0.04em; }
|
||||
.login-sec { color: var(--gosms-text-secondary); font-size: var(--gosms-fs-sm); text-align: center; margin: 14px 0 0; }
|
||||
.login-tip { color: var(--gosms-text-secondary); font-size: var(--gosms-fs-base); text-align: center; margin: 6px 0 0; }
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
<template>
|
||||
<div class="page-stack">
|
||||
<section class="card pf-card">
|
||||
<div class="pf-head">
|
||||
<div>
|
||||
<span class="card-head-title">利润分析</span>
|
||||
<el-tag size="small" type="warning" class="pf-badge">FE-D34 · S3</el-tag>
|
||||
</div>
|
||||
<span class="pf-sub">用户利润(含下级返点 R4)· 通道利润 —— S2-D5 /stats/profit 双端点</span>
|
||||
</div>
|
||||
|
||||
<div class="pf-filters">
|
||||
<el-date-picker v-model="range" type="daterange" range-separator="至" start-placeholder="开始" end-placeholder="结束"
|
||||
value-format="YYYY-MM-DD" style="width: 260px" @change="reload" />
|
||||
<el-input-number v-if="tab === 'users'" v-model="parentId" :min="0" placeholder="上级账号(0=全平台)"
|
||||
:controls="false" style="width: 150px" @change="loadUsers" />
|
||||
<el-input-number v-else v-model="channelId" :min="0" placeholder="通道ID(0=全部)" :controls="false"
|
||||
style="width: 140px" @change="loadChannels" />
|
||||
<el-button type="primary" :loading="tab === 'users' ? loading.users : loading.channels" @click="reload">查询</el-button>
|
||||
</div>
|
||||
|
||||
<el-tabs v-model="tab" class="pf-tabs" @tab-change="reload">
|
||||
<!-- Tab1 用户利润 -->
|
||||
<el-tab-pane label="用户利润" name="users">
|
||||
<div v-if="summary" class="pf-summary">
|
||||
<div class="pf-sum-item"><span class="pf-sum-label">应收(时间线价)</span><span class="pf-sum-val">{{ money(summary.total_revenue) }}</span></div>
|
||||
<div class="pf-sum-item"><span class="pf-sum-label">通道成本(分摊)</span><span class="pf-sum-val">{{ money(summary.total_cost) }}</span></div>
|
||||
<div class="pf-sum-item"><span class="pf-sum-label">代理返点(让利)</span><span class="pf-sum-val">{{ money(summary.total_rebate) }}</span></div>
|
||||
<div class="pf-sum-item pf-sum-key"><span class="pf-sum-label">平台净利</span><span class="pf-sum-val">{{ money(summary.platform_profit) }}</span></div>
|
||||
<div class="pf-sum-item"><span class="pf-sum-label">账号数</span><span class="pf-sum-val">{{ summary.count }}</span></div>
|
||||
</div>
|
||||
<el-table v-loading="loading.users" :data="userRows" size="small">
|
||||
<el-table-column prop="account_id" label="账号ID" width="90" />
|
||||
<el-table-column prop="username" label="用户名" min-width="110" show-overflow-tooltip />
|
||||
<el-table-column prop="role" label="角色" width="90" />
|
||||
<el-table-column prop="success_count" label="成功条数" width="100" sortable />
|
||||
<el-table-column label="收入(元)" width="110" align="right">
|
||||
<template #default="{ row }">{{ money(row.revenue) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="成本分摊(元)" width="120" align="right">
|
||||
<template #default="{ row }">{{ money(row.cost) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="返点(元)" width="100" align="right">
|
||||
<template #default="{ row }">{{ money(row.rebate) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="利润(元)" width="110" align="right" sortable prop="profit">
|
||||
<template #default="{ row }">
|
||||
<span :class="row.profit >= 0 ? 'pf-pos' : 'pf-neg'">{{ money(row.profit) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #empty><el-empty description="窗口内无消耗账号" /></template>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
|
||||
<!-- Tab2 通道利润 -->
|
||||
<el-tab-pane label="通道利润" name="channels">
|
||||
<el-table v-loading="loading.channels" :data="channelRows" size="small">
|
||||
<el-table-column prop="channel_id" label="通道ID" width="90" />
|
||||
<el-table-column prop="name" label="通道名称" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column label="上家" width="90">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.upstream_id > 0" size="small">#{{ row.upstream_id }}</el-tag>
|
||||
<span v-else class="pf-dim">未绑</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="success_count" label="成功条数" width="110" sortable />
|
||||
<el-table-column label="收入分摊(元)" width="120" align="right">
|
||||
<template #default="{ row }">{{ money(row.revenue) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="成本(元)" width="110" align="right">
|
||||
<template #default="{ row }">{{ money(row.cost) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="利润(元)" width="110" align="right" sortable prop="profit">
|
||||
<template #default="{ row }">
|
||||
<span :class="row.profit >= 0 ? 'pf-pos' : 'pf-neg'">{{ money(row.profit) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #empty><el-empty description="窗口内无通道消耗" /></template>
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<el-alert class="pf-note" type="info" :closable="false"
|
||||
title="口径:收入=Σ日成功×价格时间线(阶梯为月结覆写项,不进分析,与账单金额差=口径差异);成本与通道收入=按成功条数占比分摊(无账号×通道交叉粒度事实源);返点=直线下级结算额×其返点率(R4,历史不重算)" />
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { settleApi, type UserProfitRow, type UserProfitSummary, type ChannelProfitRow } from '@/api/settle'
|
||||
|
||||
defineOptions({ name: 'StatsProfitView' })
|
||||
|
||||
const tab = ref<'users' | 'channels'>('users')
|
||||
const parentId = ref(0)
|
||||
const channelId = ref(0)
|
||||
const userRows = ref<UserProfitRow[]>([])
|
||||
const channelRows = ref<ChannelProfitRow[]>([])
|
||||
const summary = ref<UserProfitSummary | null>(null)
|
||||
const loading = reactive({ users: false, channels: false })
|
||||
|
||||
// 缺省窗口=本月 1 号~今天(与后端缺省口径一致)。
|
||||
const pad = (n: number) => String(n).padStart(2, '0')
|
||||
const monthStart = () => {
|
||||
const d = new Date()
|
||||
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-01`
|
||||
}
|
||||
const today = () => {
|
||||
const d = new Date()
|
||||
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`
|
||||
}
|
||||
const range = ref<[string, string] | null>([monthStart(), today()])
|
||||
|
||||
const money = (n: number) => Number(n ?? 0).toFixed(2)
|
||||
|
||||
function windowParams() {
|
||||
const r = range.value ?? [monthStart(), today()]
|
||||
return { date_from: r[0], date_to: r[1], page: 1, page_size: 50 }
|
||||
}
|
||||
|
||||
async function loadUsers() {
|
||||
loading.users = true
|
||||
try {
|
||||
const params = { ...windowParams(), ...(parentId.value > 0 ? { parent_id: parentId.value } : {}) }
|
||||
const res = await settleApi.profitUsers(params)
|
||||
userRows.value = res.list ?? []
|
||||
summary.value = res.summary ?? null
|
||||
} catch (e) { ElMessage.error((e as Error).message) } finally { loading.users = false }
|
||||
}
|
||||
|
||||
async function loadChannels() {
|
||||
loading.channels = true
|
||||
try {
|
||||
const params = { ...windowParams(), ...(channelId.value > 0 ? { channel_id: channelId.value } : {}) }
|
||||
const res = await settleApi.profitChannels(params)
|
||||
channelRows.value = res.list ?? []
|
||||
} catch (e) { ElMessage.error((e as Error).message) } finally { loading.channels = false }
|
||||
}
|
||||
|
||||
function reload() {
|
||||
if (tab.value === 'users') loadUsers()
|
||||
else loadChannels()
|
||||
}
|
||||
|
||||
onMounted(() => { loadUsers(); loadChannels() })
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.pf-card { padding: 16px 20px; }
|
||||
.pf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
|
||||
.pf-badge { margin-left: 8px; }
|
||||
.pf-sub { color: var(--gosms-text-muted); font-size: var(--gosms-fs-base); }
|
||||
.pf-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
|
||||
.pf-tabs { margin-top: 4px; }
|
||||
.pf-summary { display: flex; gap: 26px; flex-wrap: wrap; align-items: center; padding: 10px 14px; margin-bottom: 10px; border-radius: 8px; background: var(--gosms-bg-soft, rgba(127, 127, 127, 0.08)); }
|
||||
.pf-sum-item { display: flex; flex-direction: column; gap: 2px; }
|
||||
.pf-sum-label { color: var(--gosms-text-muted); font-size: 12px; }
|
||||
.pf-sum-val { font-size: 16px; font-weight: 600; }
|
||||
.pf-sum-key .pf-sum-val { color: var(--el-color-primary); }
|
||||
.pf-pos { color: var(--el-color-success); }
|
||||
.pf-neg { color: var(--el-color-danger); }
|
||||
.pf-dim { color: var(--gosms-text-muted); }
|
||||
.pf-note { margin-top: 12px; }
|
||||
</style>
|
||||
@@ -2,13 +2,13 @@ import { describe, expect, it } from 'vitest'
|
||||
import { accessibleRoutes } from '@/router/guard'
|
||||
|
||||
describe('路由权限过滤 accessibleRoutes', () => {
|
||||
it('admin 直通全部业务路由(30 模块菜单,含 FE-2 通道与策略五入口+D19 定时任务+D20 模板管理+D22 结果反馈+D23 短信聚合页+D24 下行记录+D27 上行记录+D28 回执工具)', () => {
|
||||
it('admin 直通全部业务路由(31 模块菜单,含 FE-2 通道与策略五入口+D19 定时任务+D20 模板管理+D22 结果反馈+D23 短信聚合页+D24 下行记录+D27 上行记录+D28 回执工具+S3·FE-D34 利润分析)', () => {
|
||||
const all = accessibleRoutes(['admin'])
|
||||
const menus = all.flatMap((r) => (r.children ?? []).filter((c) => c.meta?.menu))
|
||||
expect(menus.length).toBe(31)
|
||||
// FE-2/D23 关键入口在菜单(D11 上家/D14 通道组/D16 导流+报备/D19 定时任务/D20 模板管理/D22 结果反馈/D23 聚合页)
|
||||
expect(menus.length).toBe(32)
|
||||
// FE-2/D23/S3 关键入口在菜单(D11 上家/D14 通道组/D16 导流+报备/D19 定时任务/D20 模板管理/D22 结果反馈/D23 聚合页/FE-D34 利润分析)
|
||||
const names = menus.map((m) => m.name)
|
||||
for (const want of ['channel-upstream', 'channel-group', 'policy-route', 'policy-report', 'sms-timer', 'sms-template', 'sms-result', 'sms-home', 'record-down']) {
|
||||
for (const want of ['channel-upstream', 'channel-group', 'policy-route', 'policy-report', 'sms-timer', 'sms-template', 'sms-result', 'sms-home', 'record-down', 'stats-profit']) {
|
||||
expect(names).toContain(want)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
// profit-view.spec.ts S3·FE-D34:利润分析页(msw 局部 handler,不动全局种子——
|
||||
// 与 settle 页同策略:结算域端点走真库联调,组件测试用 server.use 注入契约)。
|
||||
// 锁定:双端点参数契约(date_from/date_to/parent_id/channel_id)、汇总条渲染、
|
||||
// 利润正负着色、口径说明常驻(诚实标注)。
|
||||
import { describe, expect, it, afterEach } from 'vitest'
|
||||
import { http, HttpResponse } from 'msw'
|
||||
import { mount, flushPromises } from '@vue/test-utils'
|
||||
import ElementPlus from 'element-plus'
|
||||
import { server } from '../mocks/node'
|
||||
import StatsProfitView from '../src/views/stats/profit/index.vue'
|
||||
import { settleApi } from '../src/api/settle'
|
||||
|
||||
const usersData = {
|
||||
list: [
|
||||
{ account_id: 1, username: 'root', role: 'group', success_count: 100, revenue: 10, cost: 4, rebate: 1.0, profit: 7 },
|
||||
{ account_id: 12, username: 'a12', role: 'customer', success_count: 10, revenue: 0, cost: 0.4, rebate: 0, profit: -0.4 },
|
||||
],
|
||||
total: 2,
|
||||
summary: { count: 2, total_revenue: 10, total_cost: 4.4, total_rebate: 1.0, platform_profit: 4.6 },
|
||||
}
|
||||
const channelsData = {
|
||||
list: [{ channel_id: 9101, name: 'c1', upstream_id: 7, success_count: 150, revenue: 24, cost: 6, profit: 18 }],
|
||||
total: 1,
|
||||
}
|
||||
|
||||
let lastUsersQuery = ''
|
||||
let lastChannelsQuery = ''
|
||||
function stubProfit() {
|
||||
server.use(
|
||||
http.get('*/api/v1/stats/profit/users', ({ request }) => {
|
||||
lastUsersQuery = request.url
|
||||
return HttpResponse.json({ code: 'ISC:000', msg: '成功', data: usersData })
|
||||
}),
|
||||
http.get('*/api/v1/stats/profit/channels', ({ request }) => {
|
||||
lastChannelsQuery = request.url
|
||||
return HttpResponse.json({ code: 'ISC:000', msg: '成功', data: channelsData })
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
afterEach(() => server.resetHandlers())
|
||||
|
||||
describe('FE-D34 利润分析', () => {
|
||||
it('api 契约:用户/通道端点参数与响应结构', async () => {
|
||||
stubProfit()
|
||||
const users = await settleApi.profitUsers({ date_from: '2026-11-01', date_to: '2026-11-30', parent_id: 10 })
|
||||
expect(users.summary.platform_profit).toBe(4.6)
|
||||
expect(users.list[0].rebate).toBe(1.0)
|
||||
expect(lastUsersQuery).toContain('date_from=2026-11-01')
|
||||
expect(lastUsersQuery).toContain('parent_id=10')
|
||||
const channels = await settleApi.profitChannels({ date_from: '2026-11-01', date_to: '2026-11-30', channel_id: 2 })
|
||||
expect(channels.list[0].profit).toBe(18)
|
||||
expect(lastChannelsQuery).toContain('channel_id=2')
|
||||
})
|
||||
|
||||
it('组件:双 Tab 数据渲染+汇总条+利润正负着色+口径说明', async () => {
|
||||
stubProfit()
|
||||
const w = mount(StatsProfitView, { global: { plugins: [ElementPlus] } })
|
||||
await flushPromises()
|
||||
const text = w.text()
|
||||
// 汇总条:平台净利 4.60 与账号数。
|
||||
expect(text).toContain('平台净利')
|
||||
expect(text).toContain('4.60')
|
||||
// 用户行:正利润 7.00 / 负利润 -0.40(无价账号)。
|
||||
expect(text).toContain('7.00')
|
||||
expect(text).toContain('-0.40')
|
||||
// 口径说明常驻(分摊/阶梯不进分析/返点 R4)。
|
||||
expect(text).toContain('占比分摊')
|
||||
expect(text).toContain('不进分析')
|
||||
expect(w.find('.pf-neg').exists()).toBe(true)
|
||||
// 通道 Tab 数据在挂载时一并加载。
|
||||
expect(w.html()).toContain('18.00')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,72 @@
|
||||
// role-menu-matrix.spec.ts S3·FE-6:五角色×全菜单权限矩阵走查(自动化快照)。
|
||||
// 预期矩阵为**人工确认后的固化表**(非 routes.ts 同源推导)——任何人改动路由
|
||||
// roles 都会在此暴露,走查语义=矩阵变更必须显式过目(与后端 casbin 五角色门对齐)。
|
||||
// 语义基准:资金/通道/结算页=admin/ops;service=运营执行;group/customer=业务
|
||||
// 与记录自助,不见平台资金信息(与后端 statsIsPlatform/ordersList/profit 平台门一致)。
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { accessibleRoutes } from '@/router/guard'
|
||||
|
||||
type Roles = 'admin' | 'ops' | 'service' | 'group' | 'customer'
|
||||
const ALL: Roles[] = ['admin', 'ops', 'service', 'group', 'customer']
|
||||
|
||||
/** 预期矩阵:菜单 name → 允许角色(S3 固化,含 FE-D34 利润分析)。 */
|
||||
const MATRIX: Record<string, Roles[]> = {
|
||||
home: ALL,
|
||||
notice: ['admin', 'ops', 'service', 'group'],
|
||||
'account-list': ['admin', 'ops'],
|
||||
audit: ['admin', 'ops', 'service'],
|
||||
'sms-home': ALL, 'sms-batch': ALL, 'sms-personal': ALL, 'sms-timer': ALL,
|
||||
'sms-result': ALL, 'sms-template': ALL, 'sms-downlink-detail': ALL,
|
||||
video: ['admin', 'ops'], csp: ['admin', 'ops'], nullfilter: ['admin', 'ops'], shortlink: ['admin', 'ops'],
|
||||
'record-down': ALL, 'record-up': ALL,
|
||||
'record-repush': ['admin', 'ops', 'service'],
|
||||
channel: ['admin', 'ops'], 'channel-upstream': ['admin', 'ops'], 'channel-group': ['admin', 'ops'],
|
||||
policy: ['admin', 'ops'], 'policy-route': ['admin', 'ops'], 'policy-report': ['admin', 'ops'],
|
||||
contacts: ALL,
|
||||
'stats-user': ['admin', 'ops', 'service'], 'stats-channel': ['admin', 'ops'],
|
||||
'stats-profit': ['admin', 'ops', 'service'], settle: ['admin', 'ops'],
|
||||
logs: ['admin', 'ops', 'service'], system: ['admin'], faq: ALL,
|
||||
}
|
||||
|
||||
/** 实测:某角色经守卫过滤后的可见菜单集合。 */
|
||||
function visibleMenus(role: Roles): Set<string> {
|
||||
return new Set(
|
||||
accessibleRoutes([role])
|
||||
.flatMap((r) => r.children ?? [])
|
||||
.filter((c) => c.meta?.menu)
|
||||
.map((c) => String(c.name)),
|
||||
)
|
||||
}
|
||||
|
||||
describe('S3·FE-6 五角色×全菜单权限矩阵', () => {
|
||||
const roles: Roles[] = ['admin', 'ops', 'service', 'group', 'customer']
|
||||
|
||||
it.each(roles)('角色 %s 可见菜单与矩阵一致', (role) => {
|
||||
const visible = visibleMenus(role)
|
||||
for (const [name, allow] of Object.entries(MATRIX)) {
|
||||
const want = allow.includes(role)
|
||||
expect(visible.has(name), `${role} × ${name}:期望${want ? '可见' : '不可见'}`).toBe(want)
|
||||
}
|
||||
})
|
||||
|
||||
it('矩阵覆盖全部菜单项(新增菜单未登记矩阵=本测试红,走查强制过目)', () => {
|
||||
const adminVisible = visibleMenus('admin')
|
||||
for (const name of adminVisible) expect(MATRIX[name], `菜单 ${name} 未登记矩阵`).toBeDefined()
|
||||
expect(adminVisible.size).toBe(Object.keys(MATRIX).length)
|
||||
})
|
||||
|
||||
it('资金与平台配置页对 group/customer 关闭(语义抽样:settle/stats-profit/channel/system)', () => {
|
||||
for (const role of ['group', 'customer'] as Roles[]) {
|
||||
const visible = visibleMenus(role)
|
||||
for (const denied of ['settle', 'stats-profit', 'stats-channel', 'channel', 'channel-upstream', 'system', 'account-list', 'audit']) {
|
||||
expect(visible.has(denied), `${role} 不应见 ${denied}`).toBe(false)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
it('system 配置仅 admin', () => {
|
||||
for (const role of ['ops', 'service', 'group', 'customer'] as Roles[]) {
|
||||
expect(visibleMenus(role).has('system')).toBe(false)
|
||||
}
|
||||
})
|
||||
})
|
||||
+14
-1
@@ -7,10 +7,23 @@ export default defineConfig({
|
||||
resolve: {
|
||||
alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) },
|
||||
},
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
// S3·FE-6 单包<500KB(gzip):主包曾 1.27MB(裸)/410KB(gzip)——
|
||||
// element-plus 全量与 vue 系拆 vendor chunk,业务主包独立小包;
|
||||
// 页面级全部动态 import(路由懒加载已有),首屏只拉 entry+两 vendor。
|
||||
manualChunks: {
|
||||
'element-plus': ['element-plus', '@element-plus/icons-vue'],
|
||||
'vue-vendor': ['vue', 'vue-router', 'pinia', 'axios'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
server: {
|
||||
port: 5173,
|
||||
proxy: {
|
||||
// real 模式时代理到本地网关;mock 模式由 msw 在浏览器网络层拦截。
|
||||
// real 模式时代理到本地网关(S3 起 Mock 已下线,单一 real 通道)。
|
||||
// 网关自 Day42 起按 configs/config.dev.yaml 稳定监听 :8080
|
||||
// (历史 8081 为当时 8080 被宿主机旧进程占用时的临时 env 覆盖,已废弃)。
|
||||
'/api': { target: 'http://127.0.0.1:8080', changeOrigin: true },
|
||||
|
||||
Reference in New Issue
Block a user