Files
shanxia2.0/miniprogram/config/api.js
T
wuzilongandCursor 006e94ad33 feat(miniprogram): migrate reimburse apply list/form/detail from bx-mobile.
Reuse /reimburses APIs with bx envelope; support multi-line details and draft actions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 23:25:58 +08:00

87 lines
3.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// API 基础配置(山峡化工 miniprogram)
// 本地联调:改为 http://127.0.0.1:8000/api 或电脑局域网 IP
// 生产发版:改为生产网关地址,并执行 npm run release:check-api
const DEV_BASE_URL = 'http://127.0.0.1:8000/api'
let devBaseUrl = DEV_BASE_URL
// 微信小程序真机调试时,localhost 指向手机本机,需使用电脑局域网 IP。
// #ifdef MP-WEIXIN
devBaseUrl = 'http://127.0.0.1:8000/api'
// #endif
export const BASE_URL = devBaseUrl
export const API_BASE = BASE_URL
console.log('[ENV]', 'hardcoded', BASE_URL, API_BASE)
/** 认证相关路径(当前复用 web-admin 公共登录接口) */
export const AUTH_API = {
LOGIN_RSA_PUBLIC_KEY: '/web/auth/login-rsa-public-key',
LOGIN: '/web/auth/login',
LOGOUT: '/web/auth/logout',
CURRENT_USER: '/web/auth/current-user',
REFRESH_TOKEN: '/web/auth/refresh-token',
MENU_CODES: '/web/auth/menu-codes'
}
/**
* 上传接口(multipart,须在 API_ENCRYPT_EXCLUDE_PATHS 中)
* 响应字段兼容 data.url / data.fileUrl;P0 复用管理端附件上传。
* 后续可切换为专用 /mini/.../upload/image。
*/
export const UPLOAD_API = {
IMAGE: '/web/admin/attachment/upload'
}
/** Tab / 业务页路径 */
export const PAGE_PATHS = {
login: '/pages/login/login',
home: '/pages/home/home',
todo: '/pages/todo/todo',
workbench: '/pages/workbench/workbench',
mine: '/pages/mine/mine',
bizPlaceholder: '/pages/common/biz-placeholder',
dbDashboard: '/pages/db/dashboard/index',
dbPlansList: '/pages/db/plans/list',
dbPlansDetail: '/pages/db/plans/detail',
dbInventoryList: '/pages/db/inventory/list',
dbInventoryDetail: '/pages/db/inventory/detail',
dbWeighingList: '/pages/db/weighing/list',
dbWeighingDetail: '/pages/db/weighing/detail',
bxAdvanceApply: '/pages/bx/advance/list',
bxAdvanceApplyForm: '/pages/bx/advance/apply',
bxAdvanceDetail: '/pages/bx/advance/detail',
bxReimburseApply: '/pages/bx/reimburse/list',
bxReimburseApplyForm: '/pages/bx/reimburse/apply',
bxReimburseDetail: '/pages/bx/reimburse/detail',
bxMine: '/pages/bx/mine/list',
bxAll: '/pages/bx/all/list',
bxInvoiceMine: '/pages/bx/invoice/mine',
bxInvoiceAdmin: '/pages/bx/invoice/admin',
bxExpenseItem: '/pages/bx/admin/expense-item',
bxWfAdvance: '/pages/bx/admin/wf-advance',
bxWfReimburse: '/pages/bx/admin/wf-reimburse'
}
/** 工作台菜单 code → 页面路径 */
export const WORKBENCH_ROUTE_MAP = {
'db-dashboard': PAGE_PATHS.dbDashboard,
'db-plans': PAGE_PATHS.dbPlansList,
'db-inventory': PAGE_PATHS.dbInventoryList,
'db-weighing': PAGE_PATHS.dbWeighingList,
'bx-advance-apply': PAGE_PATHS.bxAdvanceApply,
'bx-reimburse-apply': PAGE_PATHS.bxReimburseApply,
'bx-mine': PAGE_PATHS.bxMine,
'bx-all': PAGE_PATHS.bxAll,
'bx-invoice-mine': PAGE_PATHS.bxInvoiceMine,
'bx-invoice-admin': PAGE_PATHS.bxInvoiceAdmin,
'bx-expense-item': PAGE_PATHS.bxExpenseItem,
'bx-wf-advance': PAGE_PATHS.bxWfAdvance,
'bx-wf-reimburse': PAGE_PATHS.bxWfReimburse
}
export const TOKEN_KEY = 'sx_token'
export const REFRESH_TOKEN_KEY = 'sx_refresh_token'
export const USER_INFO_KEY = 'sx_user_info'