Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mould-vuecli3
Project
Project
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
lhfe
mould-vuecli3
Commits
d11265df
Commit
d11265df
authored
Sep 28, 2020
by
lipengcheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: some changes
parent
4be751b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
+4
-6
index.js
src/api/index.js
+3
-5
home.vue
src/views/home.vue
+1
-1
No files found.
src/api/index.js
View file @
d11265df
...
...
@@ -19,14 +19,12 @@ const apiMap = {
login
:
{
method
:
'post'
,
url
:
'/login'
}
}
// const requestMap = {}
function
injectRequest
(
apiObj
)
{
const
request
Obj
=
{}
const
request
Map
=
{}
Object
.
keys
(
apiObj
).
forEach
((
alias
)
=>
{
let
{
method
,
url
,
config
}
=
apiObj
[
alias
]
method
=
method
.
toUpperCase
()
request
Obj
[
alias
]
=
(
dataOrParams
=
{},
instanceConf
=
{})
=>
{
request
Map
[
alias
]
=
(
dataOrParams
=
{},
instanceConf
=
{})
=>
{
const
keyName
=
[
'PUT'
,
'POST'
,
'PATCH'
].
includes
(
method
)
?
'data'
:
'params'
return
request
({
method
,
...
...
@@ -36,7 +34,7 @@ function injectRequest(apiObj) {
})
}
})
return
request
Obj
return
request
Map
}
export
default
injectRequest
(
apiMap
)
src/views/home.vue
View file @
d11265df
...
...
@@ -58,7 +58,7 @@ export default {
async
mounted
()
{
let
xx
=
await
this
.
$api
.
getBanner
({
pageSize
:
20
,
pIndex
:
2
})
console
.
log
(
'xx:'
,
xx
)
let
vv
=
await
this
.
$api
.
login
({
account
:
'18038018084'
,
psw
:
'
2
'
})
let
vv
=
await
this
.
$api
.
login
({
account
:
'18038018084'
,
psw
:
'
123456
'
})
console
.
log
(
'vv:'
,
vv
)
},
methods
:
{
...
...
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