Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
visualcloud
/
Vmatrix-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ad8aece5
authored
Nov 21, 2019
by
hank
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
492b637f
2af77db9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
31 additions
and
17 deletions
+31
-17
.env.development
+1
-1
.env.production
+1
-1
.env.test
+14
-0
mock/user.js
+4
-5
package.json
+1
-0
src/api/user.js
+4
-4
src/store/modules/user.js
+3
-3
src/utils/request.js
+2
-2
src/utils/requestMock.js
+1
-1
src/views/template/template-add-detail.vue
+0
-0
No files found.
.env.development
View file @
ad8aece5
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
ENV = 'development'
ENV = 'development'
# base api
# base api
VUE_APP_BASE_API = 'http
s://manager.bdideal.com
'
VUE_APP_BASE_API = 'http
://39.97.179.60:8092
'
VUE_APP_BASE_API_MOCK = '/dev-api'
VUE_APP_BASE_API_MOCK = '/dev-api'
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
...
...
.env.production
View file @
ad8aece5
...
@@ -2,5 +2,5 @@
...
@@ -2,5 +2,5 @@
ENV = 'production'
ENV = 'production'
# base api
# base api
VUE_APP_BASE_API = '
/prod-api
'
VUE_APP_BASE_API = '
https://manager.bdideal.com
'
.env.test
0 → 100644
View file @
ad8aece5
# just a flag
ENV
=
'production'
# base api
VUE_APP_BASE_API
=
'http://39.97.179.60:8092'
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.
# It only does one thing by converting all import() to require().
# This configuration can significantly increase the speed of hot updates,
# when you have a large number of pages.
# Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js
VUE_CLI_BABEL_TRANSPILE_MODULES
=
true
mock/user.js
View file @
ad8aece5
...
@@ -26,7 +26,7 @@ const users = {
...
@@ -26,7 +26,7 @@ const users = {
export
default
[
export
default
[
// user login
// user login
{
{
url
:
'/
user
/login'
,
url
:
'/
publics
/login'
,
type
:
'post'
,
type
:
'post'
,
response
:
config
=>
{
response
:
config
=>
{
const
{
username
}
=
config
.
body
const
{
username
}
=
config
.
body
...
@@ -49,7 +49,7 @@ export default [
...
@@ -49,7 +49,7 @@ export default [
// get user info
// get user info
{
{
url
:
'/
user
/info\.*'
,
url
:
'/
publics/get
/info\.*'
,
type
:
'get'
,
type
:
'get'
,
response
:
config
=>
{
response
:
config
=>
{
const
{
token
}
=
config
.
query
const
{
token
}
=
config
.
query
...
@@ -64,15 +64,14 @@ export default [
...
@@ -64,15 +64,14 @@ export default [
}
}
return
{
return
{
code
:
20000
,
info
data
:
info
}
}
}
}
},
},
// user logout
// user logout
{
{
url
:
'/
user
/logout'
,
url
:
'/
publics
/logout'
,
type
:
'post'
,
type
:
'post'
,
response
:
_
=>
{
response
:
_
=>
{
return
{
return
{
...
...
package.json
View file @
ad8aece5
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
"scripts"
:
{
"scripts"
:
{
"dev"
:
"vue-cli-service serve"
,
"dev"
:
"vue-cli-service serve"
,
"build:prod"
:
"vue-cli-service build"
,
"build:prod"
:
"vue-cli-service build"
,
"build:test"
:
"vue-cli-service build --mode test"
,
"build:stage"
:
"vue-cli-service build --mode staging"
,
"build:stage"
:
"vue-cli-service build --mode staging"
,
"preview"
:
"node build/index.js --preview"
,
"preview"
:
"node build/index.js --preview"
,
"lint"
:
"eslint --fix --ext .js,.vue src"
,
"lint"
:
"eslint --fix --ext .js,.vue src"
,
...
...
src/api/user.js
View file @
ad8aece5
import
request
from
'@/utils/request
Mock.js
'
import
request
from
'@/utils/request'
export
function
login
(
data
)
{
export
function
login
(
data
)
{
return
request
({
return
request
({
url
:
'/
user
/login'
,
url
:
'/
publics
/login'
,
method
:
'post'
,
method
:
'post'
,
data
data
})
})
...
@@ -10,7 +10,7 @@ export function login(data) {
...
@@ -10,7 +10,7 @@ export function login(data) {
export
function
getInfo
(
token
)
{
export
function
getInfo
(
token
)
{
return
request
({
return
request
({
url
:
'/
user
/info'
,
url
:
'/
publics/get
/info'
,
method
:
'get'
,
method
:
'get'
,
params
:
{
token
}
params
:
{
token
}
})
})
...
@@ -18,7 +18,7 @@ export function getInfo(token) {
...
@@ -18,7 +18,7 @@ export function getInfo(token) {
export
function
logout
()
{
export
function
logout
()
{
return
request
({
return
request
({
url
:
'/
user
/logout'
,
url
:
'/
publics
/logout'
,
method
:
'post'
method
:
'post'
})
})
}
}
src/store/modules/user.js
View file @
ad8aece5
...
@@ -35,8 +35,8 @@ const actions = {
...
@@ -35,8 +35,8 @@ const actions = {
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
login
({
username
:
username
.
trim
(),
password
:
password
}).
then
(
response
=>
{
login
({
username
:
username
.
trim
(),
password
:
password
}).
then
(
response
=>
{
const
{
data
}
=
response
const
{
data
}
=
response
commit
(
'SET_TOKEN'
,
data
.
token
)
commit
(
'SET_TOKEN'
,
data
)
setToken
(
data
.
token
)
setToken
(
data
)
resolve
()
resolve
()
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
reject
(
error
)
reject
(
error
)
...
@@ -48,7 +48,7 @@ const actions = {
...
@@ -48,7 +48,7 @@ const actions = {
getInfo
({
commit
,
state
})
{
getInfo
({
commit
,
state
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
getInfo
(
state
.
token
).
then
(
response
=>
{
getInfo
(
state
.
token
).
then
(
response
=>
{
const
{
data
}
=
response
const
data
=
response
if
(
!
data
)
{
if
(
!
data
)
{
reject
(
'Verification failed, please Login again.'
)
reject
(
'Verification failed, please Login again.'
)
...
...
src/utils/request.js
View file @
ad8aece5
...
@@ -7,7 +7,7 @@ import { getToken } from '@/utils/auth'
...
@@ -7,7 +7,7 @@ import { getToken } from '@/utils/auth'
const
service
=
axios
.
create
({
const
service
=
axios
.
create
({
baseURL
:
process
.
env
.
VUE_APP_BASE_API
,
// url = base url + request url
baseURL
:
process
.
env
.
VUE_APP_BASE_API
,
// url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests
// withCredentials: true, // send cookies when cross-domain requests
timeout
:
10000
// request timeout
timeout
:
10000
000
// request timeout
})
})
// request interceptor
// request interceptor
...
@@ -44,7 +44,7 @@ service.interceptors.response.use(
...
@@ -44,7 +44,7 @@ service.interceptors.response.use(
*/
*/
response
=>
{
response
=>
{
const
res
=
response
.
data
const
res
=
response
.
data
console
.
log
(
res
.
code
,
res
.
code
!==
'
undefined
'
,
String
(
res
.
code
))
console
.
log
(
res
.
code
,
res
.
code
!==
'
0
'
,
String
(
res
.
code
))
// if the custom code is not 20000, it is judged as an error.
// if the custom code is not 20000, it is judged as an error.
if
(
res
.
code
!==
'0'
&&
res
.
code
)
{
if
(
res
.
code
!==
'0'
&&
res
.
code
)
{
Message
({
Message
({
...
...
src/utils/requestMock.js
View file @
ad8aece5
...
@@ -5,7 +5,7 @@ import { getToken } from '@/utils/auth'
...
@@ -5,7 +5,7 @@ import { getToken } from '@/utils/auth'
// create an axios instance
// create an axios instance
const
service
=
axios
.
create
({
const
service
=
axios
.
create
({
baseURL
:
process
.
env
.
VUE_APP_BASE_API_MOCK
,
// url = base url + request url
baseURL
:
process
.
env
.
VUE_APP_BASE_API_MOCK
||
''
,
// url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests
// withCredentials: true, // send cookies when cross-domain requests
timeout
:
10000
// request timeout
timeout
:
10000
// request timeout
})
})
...
...
src/views/template/template-add-detail.vue
View file @
ad8aece5
This diff is collapsed.
Click to expand it.
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