Skip to content

Commit 16d111c

Browse files
committed
7.6
1 parent a563307 commit 16d111c

4 files changed

Lines changed: 7 additions & 37 deletions

File tree

src/common/getFromUrl.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import { name } from 'store/storages/cookieStorage';
2-
3-
function getQueryVariable(name) {
1+
function getQueryVariable(variable) {
42
let query = window.location.search.substring(1);
53
let vars = query.split('&');
64
for (let i = 0; i < vars.length; i++) {
7-
var pair = vars[i].split('=');
8-
if (pair[0] == name) {
5+
let pair = vars[i].split('=');
6+
if (pair[0] === variable) {
97
return pair[1];
108
}
119
}

src/common/service.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import 'whatwg-fetch';
22
import Notification from 'rc-notification';
3-
import getCookie from './cookie';
4-
import getFromUrl from './getFromUrl';
5-
63
function Fetch(url, opt = {}) {
74
opt.method = opt.method || 'GET';
85
opt.headers = {};

src/pages/login/login.js

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,9 @@ import Service from '../../common/service';
88
import Layout from '../../component/layout';
99
import Button from '../../component/common/button/button';
1010
import Input from '../../component/common/input/input';
11+
import getFromUrl from '../../common/getFromUrl';
1112

1213
class 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) {

src/pages/register/register.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { Component } from 'react';
22
import './register.css';
33
import { Link } from 'react-router-dom';
4-
// import Background from '../../images/login.png';
54
import Service from '../../common/service';
65
import Notification from 'rc-notification';
76
import 'rc-notification/assets/index.css';

0 commit comments

Comments
 (0)