dev_forum
hjm 6 years ago
parent 46da6fa553
commit 535e47d06d

@ -1,12 +1,16 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { SnackbarHOC, getImageUrl } from 'educoder'; import { SnackbarHOC, getImageUrl } from 'educoder';
import ChangeHeaderPicModal from './ChangeHeaderPicModal'
class AccountNav extends Component { class AccountNav extends Component {
editImg = () => {
this.refs['picModal'].setVisible(true)
}
render() { render() {
// newMain clearfix // newMain clearfix
return ( return (
<div className="headphoto mt14"> <div className="headphoto mt14">
<ChangeHeaderPicModal {...this.props} ref="picModal"></ChangeHeaderPicModal>
<style>{` <style>{`
/* /*
.headphoto { .headphoto {

@ -41,8 +41,9 @@ class ChangeHeaderPicModal extends Component{
// cropper = new Cropper(image, options); // cropper = new Cropper(image, options);
inputImage.value = null; inputImage.value = null;
} else { } else {
// TODO noti
window.alert('Please choose an image file.'); this.props.showNotification && this.props.showNotification("请选择一个图片格式的文件")
// window.alert('Please choose an image file.');
} }
} }
}; };
@ -78,7 +79,9 @@ class ChangeHeaderPicModal extends Component{
.then((response) => { .then((response) => {
// {"status":0,"message":"success","avatar_url":"avatars/User/15739"} // {"status":0,"message":"success","avatar_url":"avatars/User/15739"}
if (response.data.status == 0) { if (response.data.status == 0) {
// TODO noti
this.props.showNotification && this.props.showNotification("修改头像成功")
this.setVisible(false)
} }
}) })
.catch(function (error) { .catch(function (error) {

Loading…
Cancel
Save