@@ -8,33 +8,9 @@ import Service from '../../common/service';
88import Layout from '../../component/layout' ;
99import Button from '../../component/common/button/button' ;
1010import Input from '../../component/common/input/input' ;
11+ import getFromUrl from '../../common/getFromUrl' ;
1112
1213class Login extends Component {
13- // componentDidMount() {
14- // if (localStorage.getItem('checked')) {
15- // Service.Login(
16- // localStorage.getItem('username'),
17- // localStorage.getItem('password')
18- // ).then(res => {
19- // if (res !== null && res !== undefined) {
20- // let landing = 'pass.muxi-tech.xyz/';
21- // if (landing) {
22- // window.location.href =
23- // 'http://' +
24- // landing +
25- // 'landing/?username=' +
26- // localStorage.getItem('username') +
27- // '&token=' +
28- // res.token +
29- // '&id=' +
30- // res.user_id;
31- // }
32- // } else {
33- // this.failed = true;
34- // }
35- // });
36- // }
37- // }
3814 componentDidMount ( ) {
3915 if ( localStorage . getItem ( 'checked' ) ) {
4016 Service . refreshtoken (
@@ -88,11 +64,11 @@ class Login extends Component {
8864 console . log ( username , password , isChecked ) ;
8965 if ( username && password ) {
9066 Service . getOauthCode ( username , password ) . then ( res => {
91- if ( res . code == 20102 ) {
67+ if ( res . code === 20102 ) {
9268 this . alert ( '用户不存在' ) ;
93- } else if ( res . code == 20301 ) {
69+ } else if ( res . code === 20301 ) {
9470 this . alert ( '密码错误' ) ;
95- } else if ( res . code == 0 ) {
71+ } else if ( res . code === 0 ) {
9672 this . alert ( '登录成功,正在跳转' ) ;
9773 //如果用户勾选下次自动登录,保存此次登录信息
9874 if ( isChecked ) {
0 commit comments