上传图片地址

This commit is contained in:
caicai8 2020-04-23 14:53:03 +08:00
parent 0502fb1317
commit 0b4c83d640
2 changed files with 15 additions and 11 deletions

View File

@ -263,15 +263,18 @@ class CoderRootDirectory extends Component{
http_url:branchLastCommit && branchLastCommit.http_url,
isSpin: true
})
const { pathname } = this.props.location;
if(pathname && pathname.indexOf("/filesurl/")>-1){
let url =pathname.split("filesurl/")[1];
this.setState({
filePath:url
})
this.getFileDetail(url,branchLastCommit && branchLastCommit.name);
}else{
this.getProjectRoot( branchLastCommit && branchLastCommit.name );
if(branchLastCommit){
const { pathname } = this.props.location;
if(pathname && pathname.indexOf("/filesurl/")>-1){
let url =pathname.split("filesurl/")[1];
this.setState({
filePath:url
})
this.getFileDetail(url, branchLastCommit.name);
}else{
this.getProjectRoot( branchLastCommit.name );
}
// this.props.history.location.search.replace( branchLastCommit.name );
}
}
render(){

View File

@ -19,7 +19,8 @@ import deepEqual from './deepEqual.js'
import { fetchUploadImage } from '../../services/ojService.js';
import ImageBlot from './ImageBlot';
import FillBlot from './FillBlot';
import LinkBlot from './link-blot'
import LinkBlot from './link-blot';
import { getImageUrl } from 'educoder';
var Size = Quill.import('attributors/style/size');
Size.whitelist = ['14px', '16px', '18px', '20px', false];
var fonts = ['Microsoft-YaHei', 'SimSun', 'SimHei', 'KaiTi', 'FangSong'];
@ -174,7 +175,7 @@ function QuillForEditor({
const result = await fetchUploadImage(formData);
// 获取上传图片的url
if (result.data && result.data.id) {
fileUrl = (`https://testforgeplus.trustie.net/api/attachments/${result.data.id}`);
fileUrl = (getImageUrl(`api/attachments/${result.data.id}`));
}
// 根据id获取文件路径
const { width, height } = imgAttrs;