Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
h5-base
Project
Project
Details
Activity
Releases
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
new-sing
h5-base
Commits
3d099048
Commit
3d099048
authored
Mar 16, 2019
by
cys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开发环境鉴权修复
parent
cc46894e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
37 deletions
+57
-37
dev.env.js
config/dev.env.js
+2
-2
index.vue
src/components/buy/index.vue
+1
-1
index.js
src/router/index.js
+12
-22
index.js
src/service/index.js
+42
-12
No files found.
config/dev.env.js
View file @
3d099048
...
@@ -5,10 +5,10 @@ const prodEnv = require('./prod.env');
...
@@ -5,10 +5,10 @@ const prodEnv = require('./prod.env');
module
.
exports
=
merge
(
prodEnv
,
{
module
.
exports
=
merge
(
prodEnv
,
{
NODE_ENV
:
'"development"'
,
NODE_ENV
:
'"development"'
,
API_URL
:
'"http://localhost:8085/"'
,
API_URL
:
'"http://localhost:8085/"'
,
// API_URL: '"https://wechat-test.changchangenglish.com/"',
MAX_FILESIZE
:
'1024*1024*10'
,
MAX_FILESIZE
:
'1024*1024*10'
,
IMAGE_URL_HEAD
:
'"http://cdn.singsingenglish.com/"'
,
IMAGE_URL_HEAD
:
'"http://cdn.singsingenglish.com/"'
,
BUY_URL
:
'"http://wechat-test.changchangenglish.com/#/buyDetail?"'
,
BUY_URL
:
'"http://wechat-test.changchangenglish.com/#/buyDetail?"'
,
AUTHOR_UEL
:
'"http://wechat-test.changchangenglish.com/api/client/login?redirect_url=http://localhost:8085/#/"'
,
AUTHOR_UEL
:
'"http
s
://wechat-test.changchangenglish.com/api/client/login?redirect_url=http://localhost:8085/#/"'
,
REDIRECT_URL
:
'"http://localhost:8085/"'
,
REDIRECT_URL
:
'"http://localhost:8085/"'
,
});
});
src/components/buy/index.vue
View file @
3d099048
...
@@ -142,7 +142,7 @@
...
@@ -142,7 +142,7 @@
return
{
return
{
refBg
:
refBg
,
refBg
:
refBg
,
bindMobile
:{
bindMobile
:{
show
:
fals
e
,
show
:
tru
e
,
mobile
:
''
,
mobile
:
''
,
img_code
:
''
,
img_code
:
''
,
verify_code
:
''
,
verify_code
:
''
,
...
...
src/router/index.js
View file @
3d099048
...
@@ -223,15 +223,6 @@ const router =new Router({
...
@@ -223,15 +223,6 @@ const router =new Router({
noNew
:
true
,
noNew
:
true
,
}
}
},
},
{
path
:
'/shareTime'
,
name
:
'shareTime'
,
component
:
e
=>
require
([
'@/components/shareTime'
],
e
),
meta
:{
skip_login
:
true
,
noNew
:
true
,
}
},
{
{
path
:
'*'
,
path
:
'*'
,
component
:
e
=>
require
([
'@/components/error'
],
e
),
component
:
e
=>
require
([
'@/components/error'
],
e
),
...
@@ -264,11 +255,11 @@ router.beforeEach((to,from,next)=> {
...
@@ -264,11 +255,11 @@ router.beforeEach((to,from,next)=> {
document
.
title
=
'唱唱启蒙英语'
;
document
.
title
=
'唱唱启蒙英语'
;
let
goOn
=
function
(){
let
goOn
=
function
(){
if
(
localStorage
.
getItem
(
'retUrl'
)
&&
localStorage
.
getItem
(
'retUrl'
)
!==
null
&&
localStorage
.
getItem
(
'retUrl'
)
!==
''
){
if
(
localStorage
.
getItem
(
'retUrl'
)
&&
localStorage
.
getItem
(
'retUrl'
)
!==
null
&&
localStorage
.
getItem
(
'retUrl'
)
!==
''
){
console
.
log
(
localStorage
.
getItem
(
'retUrl'
))
let
retUrl
=
localStorage
.
getItem
(
'retUrl'
).
toString
();
let
retUrl
=
localStorage
.
getItem
(
'retUrl'
).
toString
();
localStorage
.
removeItem
(
'retUrl'
);
localStorage
.
removeItem
(
'retUrl'
);
next
(
retUrl
);
next
(
retUrl
);
}
else
{
}
else
{
debugger
next
()
next
()
}
}
};
};
...
@@ -276,13 +267,18 @@ router.beforeEach((to,from,next)=> {
...
@@ -276,13 +267,18 @@ router.beforeEach((to,from,next)=> {
next
()
next
()
}
else
if
(
window
.
location
.
href
.
indexOf
(
'token'
)
>-
1
&&
to
.
name
===
'index'
){
}
else
if
(
window
.
location
.
href
.
indexOf
(
'token'
)
>-
1
&&
to
.
name
===
'index'
){
let
token
=
common
.
getUrlParam
().
token
||
to
.
query
.
token
;
let
token
=
common
.
getUrlParam
().
token
||
to
.
query
.
token
;
console
.
log
(
common
.
getUrlParam
())
console
.
log
(
to
.
name
)
// debugger
store
.
dispatch
(
'setToken'
,
token
);
store
.
dispatch
(
'setToken'
,
token
);
getUserDetailApi
().
then
(
res
=>
{
getUserDetailApi
().
then
(
res
=>
{
// debugger
localStorage
.
setItem
(
'userDesc'
,
JSON
.
stringify
(
res
));
localStorage
.
setItem
(
'userDesc'
,
JSON
.
stringify
(
res
));
sa
.
login
(
res
.
user_id
);
sa
.
login
(
res
.
user_id
);
debugger
goOn
()
goOn
()
}).
catch
(()
=>
{
}).
catch
((
res
)
=>
{
console
.
log
(
res
)
// debugger
if
(
localStorage
.
getItem
(
'userDesc'
)){
if
(
localStorage
.
getItem
(
'userDesc'
)){
goOn
()
goOn
()
}
}
...
@@ -304,17 +300,11 @@ router.beforeEach((to,from,next)=> {
...
@@ -304,17 +300,11 @@ router.beforeEach((to,from,next)=> {
});
});
}
}
}
else
{
}
else
{
debugger
let
query
=
{
retUrl
:
to
.
fullPath
};
let
fullPath
=
to
.
fullPath
;
localStorage
.
setItem
(
'retUrl'
,
to
.
fullPath
);
if
(
window
.
location
.
href
.
indexOf
(
'gdt_vid'
)
>-
1
){
console
.
log
(
process
.
env
.
AUTHOR_UEL
)
if
(
fullPath
.
indexOf
(
'?'
)
>-
1
){
fullPath
+=
"&"
+
common
.
getUrlParam
().
gdt_vid
}
else
{
fullPath
+=
"?"
+
common
.
getUrlParam
().
gdt_vid
}
}
localStorage
.
setItem
(
'retUrl'
,
fullPath
);
if
(
to
.
meta
.
noNew
){
if
(
to
.
meta
.
noNew
){
query
.
is_new_user_url
=
1
;
window
.
location
.
href
=
`
${
process
.
env
.
AUTHOR_UEL
}
`
window
.
location
.
href
=
`
${
process
.
env
.
AUTHOR_UEL
}
`
}
else
{
}
else
{
window
.
location
.
href
=
`
${
process
.
env
.
AUTHOR_UEL
}
&is_new_user_url=1`
window
.
location
.
href
=
`
${
process
.
env
.
AUTHOR_UEL
}
&is_new_user_url=1`
...
...
src/service/index.js
View file @
3d099048
...
@@ -41,7 +41,8 @@ axios.interceptors.request.use(
...
@@ -41,7 +41,8 @@ axios.interceptors.request.use(
}
}
json
.
sing
=
"singsingenglish21000"
;
json
.
sing
=
"singsingenglish21000"
;
if
(
process
.
env
.
NODE_ENV
===
'development'
){
if
(
process
.
env
.
NODE_ENV
===
'development'
){
config
.
params
.
special_token
=
"uncle.cyan.cyan"
;
config
.
params
.
special_token
=
"changchangenglish"
;
// config.params.special_token="uncle.cyan.cyan";
}
}
config
.
params
.
param_token
=
md5
(
JSON
.
stringify
(
json
));
config
.
params
.
param_token
=
md5
(
JSON
.
stringify
(
json
));
}
else
if
(
config
.
url
!==
'/api/admin/login'
){
}
else
if
(
config
.
url
!==
'/api/admin/login'
){
...
@@ -62,7 +63,8 @@ axios.interceptors.request.use(
...
@@ -62,7 +63,8 @@ axios.interceptors.request.use(
}
}
json2
.
sing
=
"singsingenglish21000"
;
json2
.
sing
=
"singsingenglish21000"
;
if
(
process
.
env
.
NODE_ENV
===
'development'
){
if
(
process
.
env
.
NODE_ENV
===
'development'
){
config
.
data
.
special_token
=
"uncle.cyan.cyan"
;
config
.
params
.
special_token
=
"changchangenglish"
;
// config.data.special_token="uncle.cyan.cyan";
}
}
config
.
data
.
param_token
=
md5
(
JSON
.
stringify
(
json2
));
config
.
data
.
param_token
=
md5
(
JSON
.
stringify
(
json2
));
}
}
...
@@ -79,8 +81,13 @@ axios.interceptors.response.use(
...
@@ -79,8 +81,13 @@ axios.interceptors.response.use(
response
=>
{
response
=>
{
if
(
response
.
data
.
code
===
501
){
if
(
response
.
data
.
code
===
501
){
// 登录验证
// 登录验证
localStorage
.
setItem
(
'retUrl'
,
window
.
location
.
href
.
split
(
'#'
)[
1
]);
router
.
push
({
window
.
location
.
href
=
`
${
process
.
env
.
AUTHOR_UEL
}
`
name
:
'author'
,
//从哪个页面跳转
query
:{
retUrl
:
window
.
location
.
href
.
split
(
'#'
)[
1
]
||
''
,
is_new_user_url
:
1
}
})
}
}
return
response
;
return
response
;
},
},
...
@@ -155,8 +162,11 @@ export function fetch(url,params={}){
...
@@ -155,8 +162,11 @@ export function fetch(url,params={}){
if
(
response
.
data
.
code
===
200
){
if
(
response
.
data
.
code
===
200
){
resolve
(
response
.
data
.
data
);
resolve
(
response
.
data
.
data
);
}
else
if
(
response
.
data
.
code
===
501
){
}
else
if
(
response
.
data
.
code
===
501
){
console
.
log
(
process
.
env
.
AUTHOR_UEL
)
reject
(
response
.
data
);
reject
(
response
.
data
);
let
query
=
{
retUrl
:
window
.
location
.
href
.
split
(
'#'
)[
1
]};
localStorage
.
setItem
(
'retUrl'
,
window
.
location
.
href
.
split
(
'#'
)[
1
]);
localStorage
.
setItem
(
'retUrl'
,
window
.
location
.
href
.
split
(
'#'
)[
1
]);
query
.
is_new_user_url
=
1
;
window
.
location
.
href
=
`
${
process
.
env
.
AUTHOR_UEL
}
`
window
.
location
.
href
=
`
${
process
.
env
.
AUTHOR_UEL
}
`
}
else
if
(
response
.
data
.
code
===
503
){
}
else
if
(
response
.
data
.
code
===
503
){
reject
(
response
.
data
);
reject
(
response
.
data
);
...
@@ -197,8 +207,13 @@ export function post(url,data = {}){
...
@@ -197,8 +207,13 @@ export function post(url,data = {}){
resolve
(
response
.
data
.
data
);
resolve
(
response
.
data
.
data
);
}
else
if
(
response
.
data
.
code
===
501
){
}
else
if
(
response
.
data
.
code
===
501
){
reject
(
response
.
data
);
reject
(
response
.
data
);
localStorage
.
setItem
(
'retUrl'
,
window
.
location
.
href
.
split
(
'#'
)[
1
]);
router
.
push
({
window
.
location
.
href
=
`
${
process
.
env
.
AUTHOR_UEL
}
`
name
:
'author'
,
//从哪个页面跳转
query
:{
retUrl
:
window
.
location
.
href
.
split
(
'#'
)[
1
]
||
''
,
is_new_user_url
:
1
}
})
}
else
if
(
response
.
data
.
code
===
503
){
}
else
if
(
response
.
data
.
code
===
503
){
reject
(
response
.
data
);
reject
(
response
.
data
);
}
else
{
}
else
{
...
@@ -226,8 +241,13 @@ export function patch(url,data = {}){
...
@@ -226,8 +241,13 @@ export function patch(url,data = {}){
resolve
(
response
.
data
.
data
);
resolve
(
response
.
data
.
data
);
}
else
if
(
response
.
data
.
code
===
501
){
}
else
if
(
response
.
data
.
code
===
501
){
reject
(
response
.
data
);
reject
(
response
.
data
);
localStorage
.
setItem
(
'retUrl'
,
window
.
location
.
href
.
split
(
'#'
)[
1
]);
router
.
push
({
window
.
location
.
href
=
`
${
process
.
env
.
AUTHOR_UEL
}
`
name
:
'author'
,
//从哪个页面跳转
query
:{
retUrl
:
window
.
location
.
href
.
split
(
'#'
)[
1
]
||
''
,
is_new_user_url
:
1
}
})
}
else
if
(
response
.
data
.
code
===
503
){
}
else
if
(
response
.
data
.
code
===
503
){
reject
(
response
.
data
);
reject
(
response
.
data
);
}
else
{
}
else
{
...
@@ -255,8 +275,13 @@ export function put(url,data = {}){
...
@@ -255,8 +275,13 @@ export function put(url,data = {}){
resolve
(
response
.
data
.
data
);
resolve
(
response
.
data
.
data
);
}
else
if
(
response
.
data
.
code
===
501
){
}
else
if
(
response
.
data
.
code
===
501
){
reject
(
response
.
data
);
reject
(
response
.
data
);
localStorage
.
setItem
(
'retUrl'
,
window
.
location
.
href
.
split
(
'#'
)[
1
]);
router
.
push
({
window
.
location
.
href
=
`
${
process
.
env
.
AUTHOR_UEL
}
`
name
:
'author'
,
//从哪个页面跳转
query
:{
retUrl
:
window
.
location
.
href
.
split
(
'#'
)[
1
]
||
''
,
is_new_user_url
:
1
}
})
}
else
if
(
response
.
data
.
code
===
503
){
}
else
if
(
response
.
data
.
code
===
503
){
reject
(
response
.
data
);
reject
(
response
.
data
);
}
else
{
}
else
{
...
@@ -277,8 +302,13 @@ export function del(url,data = {}){
...
@@ -277,8 +302,13 @@ export function del(url,data = {}){
resolve
(
response
.
data
.
data
);
resolve
(
response
.
data
.
data
);
}
else
if
(
response
.
data
.
code
===
501
){
}
else
if
(
response
.
data
.
code
===
501
){
reject
(
response
.
data
);
reject
(
response
.
data
);
localStorage
.
setItem
(
'retUrl'
,
window
.
location
.
href
.
split
(
'#'
)[
1
]);
router
.
push
({
window
.
location
.
href
=
`
${
process
.
env
.
AUTHOR_UEL
}
`
name
:
'author'
,
//从哪个页面跳转
query
:{
retUrl
:
window
.
location
.
href
.
split
(
'#'
)[
1
]
||
''
,
is_new_user_url
:
1
}
})
}
else
if
(
response
.
data
.
code
===
503
){
}
else
if
(
response
.
data
.
code
===
503
){
reject
(
response
.
data
);
reject
(
response
.
data
);
}
else
{
}
else
{
...
...
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