79 lines
2.5 KiB
JavaScript
79 lines
2.5 KiB
JavaScript
import request from '@/utils/request'
|
|
|
|
/**
|
|
* 当前登录用户的专家信息 (按 token 拿 userId 查 biz_expert)
|
|
* 返回 biz_expert 完整记录, 含 name / phone / department / title / workUnit 等
|
|
* 若当前用户不是专家 / 没注册过, 返回 null
|
|
*/
|
|
export function getMyExpertProfile() {
|
|
return request({ url: '/business/expert/profile', method: 'get' })
|
|
}
|
|
|
|
/**
|
|
* 批量导入专家 (axios 版, 后端 3 阶段批量: IN查 sys_user → batchInsert → batchInsert biz_expert)
|
|
* 用于"非 el-upload"场景 (比如自定义拖拽 / 直接 fetch).
|
|
*
|
|
* @param {File} file .xlsx / .xls 文件
|
|
* @param {boolean} updateSupport 已存在 phone 是否跳过 (当前实现固定绑定已有 user_id)
|
|
* @returns {Promise<{code,msg,data:ImportResult}>}
|
|
*/
|
|
export function importExpert(file, updateSupport = false) {
|
|
const form = new FormData()
|
|
form.append('file', file)
|
|
return request({
|
|
url: '/business/expert/importData',
|
|
method: 'post',
|
|
data: form,
|
|
params: { updateSupport },
|
|
headers: { 'Content-Type': 'multipart/form-data' }
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 下载专家批量导入模板 (返回 blob, 前端用 a[download] 触发保存)
|
|
*/
|
|
export function downloadExpertImportTpl() {
|
|
return request({
|
|
url: '/business/expert/importTemplate',
|
|
method: 'get',
|
|
responseType: 'blob'
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 批量导入执业证书 (zip 压缩包或单文件): 后端异步处理, 返回 {jobId}.
|
|
* 文件名以手机号命名 (姓名唯一命中兜底), 后端匹配专家并回填 practice_cert_url.
|
|
* 上传成功后轮询 queryUploadProgress(jobId) 读进度与结果.
|
|
*/
|
|
export function importPracticeCert(file) {
|
|
const form = new FormData()
|
|
form.append('file', file)
|
|
return request({
|
|
url: '/business/expert/importPracticeCert',
|
|
method: 'post',
|
|
data: form,
|
|
headers: { 'Content-Type': 'multipart/form-data' }
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 批量导入职称证明 (zip 压缩包或单文件): 同 importPracticeCert, 回填 title_cert_url.
|
|
*/
|
|
export function importTitleCert(file) {
|
|
const form = new FormData()
|
|
form.append('file', file)
|
|
return request({
|
|
url: '/business/expert/importTitleCert',
|
|
method: 'post',
|
|
data: form,
|
|
headers: { 'Content-Type': 'multipart/form-data' }
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 查询批量上传任务进度 (后端异步处理, 前端轮询).
|
|
* @returns {Promise<{code,msg,data:{jobId,done,total,finished,error,message,result}}>}
|
|
*/
|
|
export function queryUploadProgress(jobId) {
|
|
return request({ url: `/business/upload/progress/${jobId}`, method: 'get' })
|
|
} |