Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dcxy-system
Project
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
姜雷
dcxy-system
Commits
2b7516a7
Commit
2b7516a7
authored
May 10, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设置建立API为单例模式
parent
9ae290f4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
index.vue
src/containers/login/index.vue
+2
-3
Api.js
src/lib/Api.js
+17
-1
No files found.
src/containers/login/index.vue
View file @
2b7516a7
...
@@ -152,10 +152,9 @@ export default {
...
@@ -152,10 +152,9 @@ export default {
item
=>
item
.
menuCode
===
process
.
env
.
VUE_APP_DASHBOARD_CODE
item
=>
item
.
menuCode
===
process
.
env
.
VUE_APP_DASHBOARD_CODE
);
);
if
(
dashboardPage
&&
this
.
$router
.
options
.
base
===
'/'
)
{
if
(
dashboardPage
&&
this
.
$router
.
options
.
base
===
'/'
)
{
window
.
location
.
href
=
this
.
$router
.
push
({
name
:
'dashboard'
});
location
.
origin
+
'/'
+
dashboardPage
.
menuLink
;
}
else
{
}
else
{
window
.
location
.
href
=
location
.
origin
;
this
.
$router
.
push
({
path
:
'/'
})
;
}
}
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
...
...
src/lib/Api.js
View file @
2b7516a7
...
@@ -102,5 +102,21 @@ const createBaseFetch = config => {
...
@@ -102,5 +102,21 @@ const createBaseFetch = config => {
},
errorHandle
);
},
errorHandle
);
return
service
;
return
service
;
};
};
class
ApiCreator
{
constructor
()
{
return
ApiCreator
.
getInstance
();
}
static
getInstance
()
{
if
(
ApiCreator
.
instance
)
{
}
else
if
(
window
.
ApiCreator
)
{
ApiCreator
.
instance
=
window
.
ApiCreator
;
}
else
{
ApiCreator
.
instance
=
createBaseFetch
;
window
.
ApiCreator
=
ApiCreator
.
instance
;
}
return
ApiCreator
.
instance
;
}
}
export
default
createBaseFetch
;
export
default
new
ApiCreator
()
;
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