提交 ceef84ce authored 作者: 王鹏飞's avatar 王鹏飞

chore: 修改OSS上传地址

上级 65a895a2
......@@ -23,7 +23,7 @@ export function getSignature() {
// 图片上传
export function uploadFile(data: Record<string, any>) {
return httpRequest
.post('https://webapp-pub.oss-cn-beijing.aliyuncs.com', data, {
.post(data.host || 'https://webapp-pub.ezijing.com', data, {
withCredentials: false,
headers: { 'Content-Type': 'multipart/form-data' }
})
......
......@@ -20,6 +20,7 @@ const ImageUploadHandler = (blobInfo: any) =>
const { accessid, policy, signature, host } = response
const params = {
key,
host,
OSSAccessKeyId: accessid,
policy,
signature,
......
......@@ -42,6 +42,7 @@ const handleHttpRequest: UploadProps['httpRequest'] = async xhr => {
const signature: Record<string, any> = await getSignature()
const params = {
key,
host: signature.host,
OSSAccessKeyId: signature.accessid,
policy: signature.policy,
signature: signature.signature,
......@@ -50,7 +51,7 @@ const handleHttpRequest: UploadProps['httpRequest'] = async xhr => {
file: xhr.file
}
return axios
.post('https://webapp-pub.oss-cn-beijing.aliyuncs.com', Object.assign(params, xhr.data), {
.post(params.host || 'https://webapp-pub.ezijing.com', Object.assign(params, xhr.data), {
headers: { 'Content-Type': 'multipart/form-data' },
onUploadProgress(progress: any) {
progress.percent = progress.total > 0 ? (progress.loaded / progress.total) * 100 : 0
......@@ -116,7 +117,7 @@ const handlePreview: UploadProps['onPreview'] = uploadFile => {
<template>
<el-upload
action="https://webapp-pub.oss-cn-beijing.aliyuncs.com"
action="https://webapp-pub.ezijing.com"
:show-file-list="showFileList"
:http-request="handleHttpRequest"
:before-upload="handleBeforeUpload"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论