feat(pda): connect online picking workflow

This commit is contained in:
2026-08-11 11:31:05 +08:00
parent fc1944fb7e
commit be776c8efa
16 changed files with 440 additions and 82 deletions
+36
View File
@@ -0,0 +1,36 @@
import { API_ROOT } from '@/config/runtime.js'
function authRequest(path, data) {
return new Promise((resolve, reject) => {
uni.request({
url: `${API_ROOT}${path}`,
method: 'POST',
data,
success(response) {
const body = response.data || {}
if (String(body.code ?? response.statusCode) !== '200') {
const error = new Error(body.message || '认证服务请求失败')
error.code = body.code || response.statusCode
error.requestId = body.requestId || response.header?.['X-Request-Id'] || response.header?.['x-request-id']
error.traceId = body.traceId || response.header?.['X-Trace-Id'] || response.header?.['x-trace-id']
reject(error)
return
}
resolve(body.data)
},
fail(error) {
const next = new Error(error.errMsg || '网络连接失败')
next.network = true
reject(next)
}
})
})
}
export function login(username, password) {
return authRequest('/auth/login', { username, password })
}
export function refresh(refreshToken) {
return authRequest('/auth/refresh', { refreshToken })
}