import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import axios from 'axios';
import * as qiniu from 'qiniu-js';
import { Drawer, Form, Button, Input, Row, Col, message, Checkbox, Select } from 'antd';
import WangEditor from '../../../Component/WangEditor';
import ImageCrop from '../../../Component/ImageCrop';
import {IMGURL} from '../../../Actions';
axios.defaults.baseURL = 'http://api.saihuitong.com/sas-v1';
const layout = {
labelCol: {
span: 6
},
wrapperCol: {
span: 18
}
};
let coverPicUrl = '',
blob = '',
uploadKey = '',
uploadToken = '',
uploadCoverPic = '';
function uploadCover() {
let name = 'newFile.jpeg';
return axios.get(`/upload/img/token?name=${name}&type=5`);
};
function uploadQiniu(){
const file = new File([blob], uploadKey);
const putExtra = {
fname: '',
params: {},
mimeType: ['image/png', 'image/jpeg', 'image/gif'],
};
const config = {
useCdnDomain: true, //使用cdn加速
};
const observable = qiniu.upload(file, uploadKey, uploadToken, putExtra, config);
observable.subscribe({
next: (result) => {
console.log(result);
},
error: () => {
antd+qiniu React上传图片到七牛服务器
最新推荐文章于 2023-10-16 11:21:57 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)