1. 诊所管理

This commit is contained in:
李琦
2026-06-18 10:20:24 +08:00
parent 3f6da79ece
commit 73d535378e
32 changed files with 1859 additions and 136 deletions

View File

@@ -1,8 +1,8 @@
import { prepareImagePath } from '@/common/js/image-compress.js'
import { uploadLegacyAdminImage, uploadBusinessChatFileApi, extractUploadUrl } from '@/api/upload.js'
import { uploadToOss } from '@/common/js/oss-upload.js'
/**
* 选择并上传图片(压缩 + old-admin-img 接口
* 选择并上传图片(压缩 + OSS 直传
* @param {{ count?: number }} options count>1 时依次上传多张,返回 url 数组
*/
export function pickAndUploadImage(options = {}) {
@@ -26,11 +26,8 @@ export function pickAndUploadImage(options = {}) {
size: files.find((f) => f.path === path)?.size,
})
if (!prepared) continue
const url = await uploadLegacyAdminImage({
filePath: prepared.path,
name: 'file',
})
urls.push(url)
const result = await uploadToOss({ filePath: prepared.path })
urls.push(result.url)
}
uni.hideLoading()
if (!urls.length) {
@@ -66,20 +63,11 @@ function getUserDataPath() {
}
async function uploadSignFilePath(filePath) {
let url = null
try {
const res = await uploadBusinessChatFileApi({ filePath, name: 'file' })
url = extractUploadUrl(res)
} catch (e) {
// 回退与证照相同的上传接口
}
if (!url) {
url = await uploadLegacyAdminImage({ filePath, name: 'file' })
}
if (!url) {
const result = await uploadToOss({ filePath })
if (!result || !result.url) {
throw new Error('上传成功但未返回地址')
}
return url
return result.url
}
/**