Commit f6940e6a authored by 张子雨's avatar 张子雨

feat: 增加时间戳

parent 0e1045f4
import { Upload, Icon, Modal, message, Button } from 'antd';
import { Upload, Icon, Modal, message, Button, notification } from 'antd';
import React, { useState, useEffect } from 'react';
import config from '../../../../config/env.config';
import styles from '../style.less';
......@@ -46,6 +46,7 @@ class PicturesWall extends React.Component {
};
customRequest = ({ file, onError, onSuccess }) => {
if (file.name) {
const lastFile = file.name.split('.');
const index = lastFile.length - 1;
const types = ['pdf', 'doc', 'docx', 'zip', 'rar', 'png', 'jpeg'];
......@@ -53,14 +54,22 @@ class PicturesWall extends React.Component {
message.error('文件格式错误!');
return;
}
}
const vm = this;
const name = file.name + file.uid;
const observable = qiniu.upload(file, file.name, token);
// eslint-disable-next-line new-cap
const data = file.name + new Date().getTime();
const observable = qiniu.upload(file, data, token);
const observer = {
next() {
// ...
},
error() {
error(t) {
if (t.code === 614) {
notification.error({
message: '文件名重复,请更换文件名。',
});
}
onError(file);
// ...
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment