Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiguangyao
mr-julyedu
Commits
29753187
Commit
29753187
authored
Jun 17, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
第三方登录(没完成)
parent
fb9269ea
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
300 additions
and
62 deletions
+300
-62
package-lock.json
+186
-0
src/App.js
+7
-6
src/components/passport/accountLogin/index.js
+3
-7
src/components/passport/common/LoginWays/index.js
+2
-4
src/components/passport/index.js
+20
-4
src/components/passport/login/index.js
+15
-9
src/router/loading.js
+42
-23
src/router/privateRoute.js
+3
-1
src/setupProxy.js
+1
-1
src/utils/index.js
+11
-5
src/utils/proxy-config.js
+10
-2
No files found.
package-lock.json
View file @
29753187
...
...
@@ -3199,6 +3199,14 @@
}
}
},
"can-promise"
:
{
"version"
:
"0.0.1"
,
"resolved"
:
"https://registry.npmjs.org/can-promise/-/can-promise-0.0.1.tgz"
,
"integrity"
:
"sha512-gzVrHyyrvgt0YpDm7pn04MQt8gjh0ZAhN4ZDyCRtGl6YnuuK6b4aiUTD7G52r9l4YNmxfTtEscb92vxtAlL6XQ=="
,
"requires"
:
{
"window-or-global"
:
"^1.0.1"
}
},
"caniuse-api"
:
{
"version"
:
"3.0.0"
,
"resolved"
:
"https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz"
,
...
...
@@ -4357,6 +4365,11 @@
"randombytes"
:
"^2.0.0"
}
},
"dijkstrajs"
:
{
"version"
:
"1.0.1"
,
"resolved"
:
"https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.1.tgz"
,
"integrity"
:
"sha1-082BIh4+pAdCz83lVtTpnpjdxxs="
},
"dir-glob"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/dir-glob/-/dir-glob-2.0.0.tgz"
,
...
...
@@ -8915,6 +8928,14 @@
"tmpl"
:
"1.0.x"
}
},
"map-age-cleaner"
:
{
"version"
:
"0.1.3"
,
"resolved"
:
"https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz"
,
"integrity"
:
"sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w=="
,
"requires"
:
{
"p-defer"
:
"^1.0.0"
}
},
"map-cache"
:
{
"version"
:
"0.2.2"
,
"resolved"
:
"https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz"
,
...
...
@@ -9963,6 +9984,11 @@
"resolved"
:
"https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz"
,
"integrity"
:
"sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4="
},
"p-is-promise"
:
{
"version"
:
"2.1.0"
,
"resolved"
:
"https://registry.npmjs.org/p-is-promise/-/p-is-promise-2.1.0.tgz"
,
"integrity"
:
"sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg=="
},
"p-limit"
:
{
"version"
:
"1.3.0"
,
"resolved"
:
"https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz"
,
...
...
@@ -10189,6 +10215,11 @@
"resolved"
:
"https://registry.npmjs.org/pn/-/pn-1.1.0.tgz"
,
"integrity"
:
"sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA=="
},
"pngjs"
:
{
"version"
:
"3.4.0"
,
"resolved"
:
"https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz"
,
"integrity"
:
"sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w=="
},
"pnp-webpack-plugin"
:
{
"version"
:
"1.2.1"
,
"resolved"
:
"https://registry.npmjs.org/pnp-webpack-plugin/-/pnp-webpack-plugin-1.2.1.tgz"
,
...
...
@@ -11178,6 +11209,156 @@
"resolved"
:
"https://registry.npmjs.org/q/-/q-1.5.1.tgz"
,
"integrity"
:
"sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc="
},
"qrcode"
:
{
"version"
:
"1.3.3"
,
"resolved"
:
"https://registry.npmjs.org/qrcode/-/qrcode-1.3.3.tgz"
,
"integrity"
:
"sha512-SH7V13AcJusH3GT8bMNOGz4w0L+LjcpNOU/NiOgtBhT/5DoWeZE6D5ntMJnJ84AMkoaM4kjJJoHoh9g++8lWFg=="
,
"requires"
:
{
"can-promise"
:
"0.0.1"
,
"dijkstrajs"
:
"^1.0.1"
,
"isarray"
:
"^2.0.1"
,
"pngjs"
:
"^3.3.0"
,
"yargs"
:
"^12.0.5"
},
"dependencies"
:
{
"camelcase"
:
{
"version"
:
"5.3.1"
,
"resolved"
:
"https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz"
,
"integrity"
:
"sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
},
"execa"
:
{
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmjs.org/execa/-/execa-1.0.0.tgz"
,
"integrity"
:
"sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA=="
,
"requires"
:
{
"cross-spawn"
:
"^6.0.0"
,
"get-stream"
:
"^4.0.0"
,
"is-stream"
:
"^1.1.0"
,
"npm-run-path"
:
"^2.0.0"
,
"p-finally"
:
"^1.0.0"
,
"signal-exit"
:
"^3.0.0"
,
"strip-eof"
:
"^1.0.0"
}
},
"find-up"
:
{
"version"
:
"3.0.0"
,
"resolved"
:
"https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz"
,
"integrity"
:
"sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg=="
,
"requires"
:
{
"locate-path"
:
"^3.0.0"
}
},
"get-stream"
:
{
"version"
:
"4.1.0"
,
"resolved"
:
"https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz"
,
"integrity"
:
"sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w=="
,
"requires"
:
{
"pump"
:
"^3.0.0"
}
},
"invert-kv"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz"
,
"integrity"
:
"sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA=="
},
"isarray"
:
{
"version"
:
"2.0.4"
,
"resolved"
:
"https://registry.npmjs.org/isarray/-/isarray-2.0.4.tgz"
,
"integrity"
:
"sha512-GMxXOiUirWg1xTKRipM0Ek07rX+ubx4nNVElTJdNLYmNO/2YrDkgJGw9CljXn+r4EWiDQg/8lsRdHyg2PJuUaA=="
},
"lcid"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz"
,
"integrity"
:
"sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA=="
,
"requires"
:
{
"invert-kv"
:
"^2.0.0"
}
},
"locate-path"
:
{
"version"
:
"3.0.0"
,
"resolved"
:
"https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz"
,
"integrity"
:
"sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A=="
,
"requires"
:
{
"p-locate"
:
"^3.0.0"
,
"path-exists"
:
"^3.0.0"
}
},
"mem"
:
{
"version"
:
"4.3.0"
,
"resolved"
:
"https://registry.npmjs.org/mem/-/mem-4.3.0.tgz"
,
"integrity"
:
"sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w=="
,
"requires"
:
{
"map-age-cleaner"
:
"^0.1.1"
,
"mimic-fn"
:
"^2.0.0"
,
"p-is-promise"
:
"^2.0.0"
}
},
"mimic-fn"
:
{
"version"
:
"2.1.0"
,
"resolved"
:
"https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz"
,
"integrity"
:
"sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="
},
"os-locale"
:
{
"version"
:
"3.1.0"
,
"resolved"
:
"https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz"
,
"integrity"
:
"sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q=="
,
"requires"
:
{
"execa"
:
"^1.0.0"
,
"lcid"
:
"^2.0.0"
,
"mem"
:
"^4.0.0"
}
},
"p-limit"
:
{
"version"
:
"2.2.0"
,
"resolved"
:
"https://registry.npmjs.org/p-limit/-/p-limit-2.2.0.tgz"
,
"integrity"
:
"sha512-pZbTJpoUsCzV48Mc9Nh51VbwO0X9cuPFE8gYwx9BTCt9SF8/b7Zljd2fVgOxhIF/HDTKgpVzs+GPhyKfjLLFRQ=="
,
"requires"
:
{
"p-try"
:
"^2.0.0"
}
},
"p-locate"
:
{
"version"
:
"3.0.0"
,
"resolved"
:
"https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz"
,
"integrity"
:
"sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ=="
,
"requires"
:
{
"p-limit"
:
"^2.0.0"
}
},
"p-try"
:
{
"version"
:
"2.2.0"
,
"resolved"
:
"https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz"
,
"integrity"
:
"sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
},
"yargs"
:
{
"version"
:
"12.0.5"
,
"resolved"
:
"https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz"
,
"integrity"
:
"sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw=="
,
"requires"
:
{
"cliui"
:
"^4.0.0"
,
"decamelize"
:
"^1.2.0"
,
"find-up"
:
"^3.0.0"
,
"get-caller-file"
:
"^1.0.1"
,
"os-locale"
:
"^3.0.0"
,
"require-directory"
:
"^2.1.1"
,
"require-main-filename"
:
"^1.0.1"
,
"set-blocking"
:
"^2.0.0"
,
"string-width"
:
"^2.0.0"
,
"which-module"
:
"^2.0.0"
,
"y18n"
:
"^3.2.1 || ^4.0.0"
,
"yargs-parser"
:
"^11.1.1"
}
},
"yargs-parser"
:
{
"version"
:
"11.1.1"
,
"resolved"
:
"https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz"
,
"integrity"
:
"sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ=="
,
"requires"
:
{
"camelcase"
:
"^5.0.0"
,
"decamelize"
:
"^1.2.0"
}
}
}
},
"qs"
:
{
"version"
:
"6.5.2"
,
"resolved"
:
"https://registry.npmjs.org/qs/-/qs-6.5.2.tgz"
,
...
...
@@ -14699,6 +14880,11 @@
"string-width"
:
"^1.0.2 || 2"
}
},
"window-or-global"
:
{
"version"
:
"1.0.1"
,
"resolved"
:
"https://registry.npmjs.org/window-or-global/-/window-or-global-1.0.1.tgz"
,
"integrity"
:
"sha1-2+RboqKRqrxW1iz2bEW3+jIpRt4="
},
"wordwrap"
:
{
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz"
,
...
...
src/App.js
View file @
29753187
import
React
,
{
Component
}
from
'react'
import
Routes
from
'./router'
import
cookie
from
'js-cookie'
import
{
http
,
api
}
from
'@/utils'
;
import
{
connect
}
from
'react-redux'
;
import
{
setCurrentUser
}
from
'@/store/userAction'
;
import
{
connect
}
from
"react-redux"
;
import
{
setCurrentUser
}
from
"@/store/userAction"
;
//拦截ajax请求,返回mock数据
...
...
@@ -16,6 +15,7 @@ import './assets/css/index.scss';
// iconfont
import
'./assets/font/iconfont.css'
;
import
{
api
,
http
}
from
"@/utils"
;
class
App
extends
Component
{
...
...
@@ -25,11 +25,13 @@ class App extends Component {
cookie
.
set
(
'plat'
,
'5'
)
http
.
get
(
`
${
api
.
home
}
/m/user_info`
).
then
(
res
=>
{
this
.
props
.
setCurrentUser
(
this
.
store
User
(
res
))
this
.
props
.
setCurrentUser
(
this
.
transform
User
(
res
))
})
}
store
User
=
res
=>
{
transform
User
=
res
=>
{
let
payload
if
(
res
.
data
.
code
===
200
)
{
const
{
...
...
@@ -64,7 +66,6 @@ class App extends Component {
return
payload
}
render
()
{
return
<
Routes
/>
}
...
...
src/components/passport/accountLogin/index.js
View file @
29753187
...
...
@@ -6,6 +6,7 @@ import { compose } from 'redux';
import
{
accountLogin
}
from
'@/store/userAction'
;
import
{
connect
}
from
"react-redux"
;
import
{
isEmpty
}
from
'lodash'
import
{
HeaderBar
}
from
"@/common"
;
import
Header
from
"../common/Header"
;
...
...
@@ -16,11 +17,6 @@ import { Toast } from "antd-mobile";
class
AccountLogin
extends
PureComponent
{
componentDidMount
()
{
console
.
log
(
this
.
props
.
values
);
}
render
()
{
const
{
errors
,
...
...
@@ -28,6 +24,7 @@ class AccountLogin extends PureComponent {
}
=
this
.
props
return
(
<
div
className
=
{
'account-login'
}
>
<
HeaderBar
arrow
=
{
true
}
title
=
{
'登录'
}
/
>
<
Header
/>
<
Form
className
=
"login-info"
>
<
FastField
...
...
@@ -75,10 +72,9 @@ const formikConfig = {
props
.
accountLogin
({
username
,
password
}).
then
(
res
=>
{
console
.
log
(
res
);
if
(
!
res
.
hasError
)
{
let
{
from
}
=
props
.
location
.
state
||
{
from
:
{
pathname
:
'/'
}}
history
.
push
(
from
.
pathname
)
history
.
replace
(
from
.
pathname
)
}
else
{
Toast
.
info
(
res
.
msg
,
2
,
null
,
false
)
}
...
...
src/components/passport/common/LoginWays/index.js
View file @
29753187
...
...
@@ -17,10 +17,8 @@ class LoginWays extends PureComponent {
this
.
props
.
loginWays
.
map
((
item
,
index
)
=>
{
return
(
<
li
key
=
{
index
}
onClick
=
{
this
.
handleClick
.
bind
(
this
,
item
.
text
)}
>
<
a
href
=
{
item
.
url
}
>
<
img
src
=
{
item
.
logo
}
alt
=
""
/>
<
p
>
{
item
.
text
}
<
/p
>
<
/a
>
<
img
src
=
{
item
.
logo
}
alt
=
""
/>
<
p
>
{
item
.
text
}
<
/p
>
<
/li
>
)
})
...
...
src/components/passport/index.js
View file @
29753187
...
...
@@ -8,18 +8,26 @@ import AccountLogin from './accountLogin'
import
ForgotPassword
from
'./forgotPassword'
import
SetPassword
from
'./setPassword'
import
BindingTel
from
'./bindingTel'
import
{
api
}
from
"@/utils"
;
import
{
connect
}
from
"react-redux"
;
import
{
compose
}
from
"redux"
;
import
account
from
'./account.png'
import
qq
from
'./qq.png'
import
sina
from
'./sina.png'
import
wechat
from
'./wechat.png'
import
{
api
,
http
}
from
"@/utils"
;
class
Passport
extends
Component
{
redirect_url
=
location
.
protocol
+
'//'
+
location
.
hostname
componentDidMount
()
{
console
.
log
(
this
.
props
.
location
);
}
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
...
...
@@ -58,7 +66,9 @@ class Passport extends Component {
to
=
{{...
location
,
...{
pathname
:
'/passport/login'
}}}
/
>
<
Route
path
=
{
match
.
url
+
'/login'
}
render
=
{
props
=>
<
Login
{...
props
}
loginWays
=
{
this
.
state
.
loginWays
}
/>}/
>
render
=
{
props
=>
{
return
<
Login
{...
props
}
loginWays
=
{
this
.
state
.
loginWays
}
/
>
}}
/
>
<
Route
path
=
{
match
.
url
+
'/account-login'
}
component
=
{
AccountLogin
}
/
>
<
Route
path
=
{
match
.
url
+
'/forgot-password'
}
component
=
{
ForgotPassword
}
/
>
<
Route
path
=
{
match
.
url
+
'/set-password'
}
component
=
{
SetPassword
}
/
>
...
...
@@ -70,4 +80,10 @@ class Passport extends Component {
}
export
default
WithFullSize
(
Passport
)
\ No newline at end of file
export
default
compose
(
connect
(
state
=>
({
user
:
state
.
user
}),
null
),
WithFullSize
)(
Passport
)
\ No newline at end of file
src/components/passport/login/index.js
View file @
29753187
...
...
@@ -12,7 +12,7 @@ import { connect } from 'react-redux';
import
{
compose
}
from
'redux'
;
import
{
isEmpty
}
from
'lodash'
import
{
Toast
}
from
'antd-mobile'
;
import
{
validateTel
}
from
"@/utils"
;
import
{
validateTel
}
from
"@/utils"
;
class
WechatLogin
extends
Component
{
...
...
@@ -22,18 +22,24 @@ class WechatLogin extends Component {
}
loginWaysClick
=
method
=>
{
console
.
log
(
method
);
const
{
history
}
=
this
.
props
const
{
history
,
loginWays
,
location
}
=
this
.
props
const
item
=
loginWays
.
find
(
item
=>
item
.
text
===
method
)
switch
(
method
)
{
case
'账号登录'
:
history
.
push
(
'/passport/account-login'
)
history
.
push
(
'/passport/account-login'
,
location
.
state
)
break
;
}
/*switch (index) {
case 0:
this.props.history.push('/passport/account-login')
case
'微信'
:
let
{
from
}
=
location
.
state
||
{
from
:
{
pathname
:
'/'
}}
const
redirectURI
=
window
.
location
.
protocol
+
'//'
+
window
.
location
.
hostname
+
from
.
pathname
window
.
location
.
assign
(
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx23dac6775ac82877&redirect_uri=
${
encodeURIComponent
(
redirectURI
)}
&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
)
break
;
}*/
default
:
window
.
location
.
assign
(
item
.
url
)
}
}
getCaptchaInstance
=
instance
=>
{
...
...
src/router/loading.js
View file @
29753187
import
React
from
'react'
;
import
{
connect
}
from
'react-redux'
;
import
React
,
{
Component
}
from
'react'
;
import
{
withRouter
}
from
"react-router-dom"
;
import
{
compose
}
from
"redux
"
;
import
{
api
,
http
,
getParam
,
isLogin
}
from
"@/utils
"
;
class
Loading
extends
Component
{
const
Loading
=
({
user
,
history
,
state
})
=>
{
if
(
Object
.
values
(
user
.
data
).
filter
(
item
=>
!!
item
).
length
!==
0
)
{
history
.
replace
(
location
.
pathname
)
}
else
{
history
.
replace
(
'/passport'
,
{...
state
})
async
componentDidMount
()
{
let
code
=
getParam
(
'code'
)
let
{
history
,
state
,
location
}
=
this
.
props
if
(
code
)
{
http
.
get
(
`
${
api
[
'base-api'
]}
/m/wx_loginInfo/code/
${
code
}
`
)
.
then
(
res
=>
{
console
.
log
(
res
);
})
}
else
{
if
(
isLogin
)
{
console
.
log
(
location
.
pathname
);
// history.replace(location.pathname)
}
else
{
console
.
log
(
state
);
history
.
replace
(
'/passport'
,
{...
state
})
}
}
}
render
()
{
return
(
<
div
className
=
{
'loading'
}
>
loading
...
<
/div
>
);
}
return
(
<
div
className
=
{
'loading'
}
>
loading
...
<
/div
>
);
};
export
default
compose
(
connect
(
state
=>
({
user
:
state
.
user
}),
null
),
withRouter
)(
Loading
);
\ No newline at end of file
}
export
default
withRouter
(
Loading
)
\ No newline at end of file
src/router/privateRoute.js
View file @
29753187
import
React
from
'react'
;
import
{
Route
,
Redirect
}
from
"react-router-dom"
;
import
{
Route
}
from
"react-router-dom"
;
import
{
connect
}
from
"react-redux"
;
import
jsCookie
from
'js-cookie'
import
Loading
from
'./loading'
const
PrivateRoute
=
({
component
:
Component
,
path
,
user
,
...
rest
})
=>
{
let
authenticated
=
jsCookie
.
get
(
'token'
)
&&
jsCookie
.
get
(
'uid'
)
return
(
<
Route
{...
rest
}
render
=
{
props
=>
{
return
authenticated
...
...
src/setupProxy.js
View file @
29753187
...
...
@@ -12,7 +12,7 @@ module.exports = function (app) {
pathRewrite
:
{
[
`^
${
config
[
item
][
'development'
]}
`
]:
''
},
cookieDomainRewrite
:
'localhost'
,
//
cookieDomainRewrite: 'localhost',
...
config
[
item
][
'proxy'
]
}
))
...
...
src/utils/index.js
View file @
29753187
export
{
default
as
http
}
from
'./http'
export
{
default
as
api
}
from
'./api'
export
{
html
,
initCaptcha
,
validateTel
,
validateEmail
,
browser
}
import
jsCookie
from
"js-cookie"
;
export
const
getParam
=
(
key
,
str
)
=>
{
...
...
@@ -87,4 +85,13 @@ const browser = (function () {
isIOS
:
/
\(
i
[^
;
]
+;
(
U;
)?
CPU.+Mac OS X/i
.
test
(
ua
),
isIPad
:
/iPad/i
.
test
(
ua
)
}
})()
\ No newline at end of file
})()
const
isLogin
=
(
function
()
{
return
jsCookie
.
get
(
'uid'
)
&&
jsCookie
.
get
(
'token'
)
})()
export
{
default
as
http
}
from
'./http'
export
{
default
as
api
}
from
'./api'
export
{
html
,
initCaptcha
,
validateTel
,
validateEmail
,
browser
,
isLogin
}
src/utils/proxy-config.js
View file @
29753187
const
config
=
{
const
config
=
{
home
:
{
development
:
'/api'
,
test
:
'http://fast-test.julyedu.com'
,
...
...
@@ -25,11 +25,19 @@ const config = {
production
:
'http://passport.julyedu.com'
,
proxy
:
{}
},
'pay-api'
:{
'pay-api'
:
{
development
:
'/pay-api'
,
test
:
'http://api-test.julyedu.com'
,
production
:
'https://api.julyedu.com'
,
proxy
:
{}
},
'base-api'
:
{
development
:
'/base-api'
,
test
:
'http://api-test.julyedu.com'
,
production
:
'https://api.julyedu.com'
,
proxy
:
{
secure
:
false
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment