677c2677ec
- SPA 化:22 个 MPA html 入口与 *-main.ts 合并为 index.html + vue-router(URL 无 .html 后缀), 页面跳转全部 router-link,/new_web_source/xxx.html 旧路径归一为 /xxx - 任务面板统一:共享 TaskCenterPanel/TaskItemCard/TaskStatCards/HistoryTaskLayer, 16 个工具页右侧统一为统计卡 + 当前任务 + 历史任务弹层(任务ID/开始/结束/状态必展示) - 历史记录支持单条删除 + 批量勾选删除(确认框/全选/失败提示) - Java 7 模块(dedupe/convert/split/productrisk/shopmatch/pricetrack/deletebrand) history 接口补齐任务时间字段(VO+Service,复用 biz_file_task 列) - 图片工作台/API 层(brand/permission/user)既有未提交改动一并提交
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import { post } from './http.ts'
|
|
|
|
export function getCurrentUserId() {
|
|
const raw =
|
|
typeof window === "undefined"
|
|
? ""
|
|
: window.localStorage.getItem("uid") || "";
|
|
const value = Number(raw);
|
|
if (!Number.isFinite(value) || value <= 0) {
|
|
throw new Error("未获取到用户ID");
|
|
}
|
|
return value;
|
|
}
|
|
|
|
/** 桌面端登录接口响应 data 段 */
|
|
export interface LoginData {
|
|
token?: string
|
|
userId?: number | string
|
|
username?: string
|
|
[key: string]: unknown
|
|
}
|
|
|
|
export interface LoginResponse {
|
|
success: boolean
|
|
message?: string
|
|
msg?: string
|
|
data?: LoginData
|
|
}
|
|
|
|
/**
|
|
* 桌面端登录(原页面裸 window.fetch('/newApi/login') 收敛到 shared 层:
|
|
* 页面不得直连 /newApi,见 shared-api-allowlist 测试约定)
|
|
*/
|
|
export function loginWithDevice(account: string, password: string, deviceId: string) {
|
|
return post<LoginResponse>(
|
|
'/newApi/login',
|
|
{ username: account, password, deviceId },
|
|
{
|
|
headers: { 'X-Device-Id': deviceId, 'X-Requested-With': 'XMLHttpRequest' },
|
|
},
|
|
)
|
|
}
|