修改文件服务地址

This commit is contained in:
何童崇 2022-05-18 16:44:20 +08:00
parent 299fb1358d
commit da0caba73b
1 changed files with 14 additions and 9 deletions

View File

@ -4,6 +4,7 @@ import { getUploadActionUrl, getUrl, appendFileSizeToUploadFileAll } from 'educo
import { locData } from '../../forge/Utils/locData';
import { getStudentApplyInfo, taskList, studentApply, studentApplyEdit } from '../api';
import TextArea from 'antd/lib/input/TextArea';
import { httpUrl } from '../fetch';
import banner from "../img/banner.png";
import studentSvg from "../img/student.png";
import './index.scss';
@ -93,13 +94,13 @@ function Apply(props) {
if (i == 0) {
setFiles([{
name: item.memoAttachment || '已上传文件',
name: item.memoAttachment && item.memoAttachment.fileName || '已上传文件',
id: item.memoAttachmentId,
uid: item.memoAttachmentId
}]);
} else {
setFiles1([{
name: item.memoAttachment || '已上传文件',
name: item.memoAttachment && item.memoAttachment.fileName || '已上传文件',
id: item.memoAttachmentId,
uid: item.memoAttachmentId,
}]);
@ -163,7 +164,7 @@ function Apply(props) {
}
if (userApplyInfo) {
params.id=userApplyInfo.id;
params.id = userApplyInfo.id;
studentApplyEdit(params).then(response => {
if (response && response.message === "success") {
showNotification("修改信息成功");
@ -226,8 +227,11 @@ function Apply(props) {
if (info.file.status === 'uploading' || info.file.status === "done" || info.file.status === 'removed') {
setLoading(true);
if (info.file.status === "done") {
changeTaskItem('memoAttachmentId', info.fileList[0].response.id, i)
// changeTaskItem('memoAttachment', info.fileList[0].name, i)
changeTaskItem('memoAttachmentId', info.fileList[0].response && info.fileList[0].response.data.id, i)
}
if (info.file.status === 'removed') {
console.log(1111)
changeTaskItem('memoAttachmentId', '', i);
}
console.log(info.fileList);
if (i) {
@ -236,6 +240,7 @@ function Apply(props) {
setFiles(appendFileSizeToUploadFileAll(info.fileList).slice(-1));
}
}
if (info.file.status === "done" || info.file.status === 'removed') {
setLoading(false);
}
@ -243,8 +248,8 @@ function Apply(props) {
//
function download(file) {
const fileId = file.id || file.response.id;
window.open(`${getUrl()}/api/attachments/${fileId}`);
const fileId = file.id || file.response.data.id;
window.open(`${httpUrl}/busiAttachments/download/${fileId}`);
}
function addTask(List) {
@ -426,8 +431,8 @@ function Apply(props) {
'memoAttachmentId' + i,
[],
<Upload
accept=".zip,.rar"
action={getUploadActionUrl()}
// action={getUploadActionUrl()}
action={httpUrl + `/busiAttachments/upload`}
fileList={i ? files1 : files}
onChange={(info) => { bookChange(info, i) }}
onDownload={download}