dev_forum
hjm 5 years ago
parent 32ea657e61
commit 4abaf0d192

@ -2,7 +2,7 @@ import React, { Component } from "react";
import { Modal } from "antd"; import { Modal } from "antd";
import axios from 'axios' import axios from 'axios'
import ModalWrapper from "../../courses/common/ModalWrapper" import ModalWrapper from "../../courses/common/ModalWrapper"
import { Cropper } from 'educoder' import { Cropper, getUrl } from 'educoder'
const imageId = 'changeHeaderPic' const imageId = 'changeHeaderPic'
const previewId = 'changeHeader_imagePreview' const previewId = 'changeHeader_imagePreview'
@ -120,7 +120,8 @@ class ChangeHeaderPicModal extends Component{
render(){ render(){
const { course_lists } = this.state const { course_lists } = this.state
const { moduleName } = this.props const { moduleName, current_user } = this.props
const userHeaderImgUrl = `${getUrl()}/images/${current_user.image_url}`
return( return(
<ModalWrapper <ModalWrapper
ref="modalWrapper" ref="modalWrapper"
@ -170,6 +171,7 @@ class ChangeHeaderPicModal extends Component{
<div className="cropperWrap"> <div className="cropperWrap">
<Cropper <Cropper
imageSrc={''} imageSrc={''}
initPreviewUrl={userHeaderImgUrl}
ref="cropper" ref="cropper"
imageId={imageId} imageId={imageId}
previewId="changeHeader_imagePreview" previewId="changeHeader_imagePreview"
@ -181,7 +183,9 @@ class ChangeHeaderPicModal extends Component{
className="df previewWrap" style ={{flexDirection: 'column'}} className="df previewWrap" style ={{flexDirection: 'column'}}
> >
<div> <div>
<div id="changeHeader_imagePreview"></div> <div id="changeHeader_imagePreview">
{userHeaderImgUrl && <img src={userHeaderImgUrl}></img>}
</div>
<div className="tip">头像预览</div> <div className="tip">头像预览</div>
</div> </div>
<label id="uploadBtn" for="inputImage"> <label id="uploadBtn" for="inputImage">

Loading…
Cancel
Save