import React from 'react'; import { Row, Col, Modal, Form, Input, message } from "antd"; import './topTab.less'; import SpinContainer from '../component/SpinContainer'; import $ from 'jquery/src/ajax'; const TopTab = React.createClass({ getInitialState() { return { username: 'admin', loading: false }; }, logOut() { $.ajax({ method: "get", dataType: "json", url: globalConfig.context + "/login", }).done(function (data) { window.location.href = globalConfig.context + "/admin/login" }); }, onCancel() { this.setState({ visible: false, password: undefined, usedPwd: undefined }) }, changePwd() { this.setState({ loading: true }) $.ajax({ method: "post", dataType: "json", url: globalConfig.context + "/api/admin/updateAdmin", data: { password: this.state.password, usedPwd: this.state.usedPwd, }, success: function(data) { if(data.error && data.error.length) { message.warning(data.error[0].message) }else { message.success("修改密码成功!") this.onCancel() } }.bind(this) }).always( function() { this.setState({ loading: false }); }.bind(this) ); }, componentWillMount () { this.loadData(); }, loadData() { // this.setState({ // loading: true // }); // $.ajax({ // method: "get", // dataType: "json", // crossDomain: false, // url: globalConfig.context + "/api/admin/notice/unreadCount", // success: function (data) { // if (!data.data) { // if (data.error[0] && data.error[0]) { // message.warning(data.error[0].message); // return; // }; // }; // this.setState({ // badge: data.data, // }); // }.bind(this), // }).always(function (data) { // this.setState({ // loading: false // }); // }.bind(this)); }, render() { const FormItem = Form.Item; return (
); } }); export default TopTab;