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
136f54c0
Commit
136f54c0
authored
Mar 26, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加公用处理方法
parent
d39bbbc2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
53 deletions
+52
-53
main.js
src/lib/main.js
+39
-53
utils.js
src/lib/utils.js
+13
-0
No files found.
src/lib/main.js
View file @
136f54c0
...
...
@@ -12,6 +12,7 @@ import { formatRouteLink } from '@/utils/route';
import
storeModule
from
'./storeModule'
;
import
mixinModule
from
'./mixins'
;
import
utilsModule
from
'./utils'
;
const
fetch
=
createBaseFetch
(
{
...
...
@@ -20,58 +21,43 @@ const fetch = createBaseFetch(
store
);
const
createSystem
=
({
routers
,
routeFilter
})
=>
{
class
SystemShell
{
constructor
()
{
this
.
createBaseFetch
=
createBaseFetch
;
this
.
fetch
=
fetch
;
this
.
initSystem
();
}
mixins
=
mixinModule
;
storeModule
=
storeModule
;
initSystem
()
{
routeStore
.
install
(
store
);
extendCom
(
Vue
);
configRoutePermission
(
router
,
store
,
routers
);
Vue
.
config
.
productionTip
=
false
;
}
mount
()
{
/* eslint-disable no-new */
let
app
=
new
Vue
({
el
:
'#app'
,
router
,
store
,
render
:
h
=>
{
let
routes
=
[...
constantRouterMap
];
let
allRoute
=
store
.
getters
.
asyncRoutes
;
if
(
typeof
routeFilter
===
'function'
)
{
allRoute
=
routeFilter
(
allRoute
);
}
if
(
allRoute
&&
allRoute
.
length
)
{
let
addRoute
=
formatRouteLink
(
allRoute
);
for
(
let
index
=
0
;
index
<
addRoute
.
length
;
index
++
)
{
const
element
=
addRoute
[
index
];
if
(
element
.
children
)
{
routes
=
routes
.
concat
(
element
.
children
);
}
class
SystemShell
{
constructor
()
{
this
.
Api
=
fetch
;
this
.
storeModule
=
storeModule
;
this
.
mixinModule
=
mixinModule
;
this
.
utils
=
utilsModule
;
}
createSystem
=
({
routers
,
routeFilter
})
=>
{
routeStore
.
install
(
store
);
extendCom
(
Vue
);
configRoutePermission
(
router
,
store
,
routers
);
Vue
.
config
.
productionTip
=
false
;
let
app
=
new
Vue
({
el
:
'#app'
,
router
,
store
,
render
:
h
=>
{
let
routes
=
[...
constantRouterMap
];
let
allRoute
=
store
.
getters
.
asyncRoutes
;
if
(
typeof
routeFilter
===
'function'
)
{
allRoute
=
routeFilter
(
allRoute
);
}
if
(
allRoute
&&
allRoute
.
length
)
{
let
addRoute
=
formatRouteLink
(
allRoute
);
for
(
let
index
=
0
;
index
<
addRoute
.
length
;
index
++
)
{
const
element
=
addRoute
[
index
];
if
(
element
.
children
)
{
routes
=
routes
.
concat
(
element
.
children
);
}
}
return
<
App
route
=
{
routes
}
allRoutes
=
{
allRoute
}
/>
;
},
});
return
app
;
}
}
const
systemShell
=
new
SystemShell
();
window
.
$$SystemShell
=
systemShell
;
return
systemShell
;
};
export
default
{
createBaseFetch
,
Api
:
fetch
,
createSystem
,
};
}
return
<
App
route
=
{
routes
}
allRoutes
=
{
allRoute
}
/>
;
},
});
return
app
;
};
createBaseFetch
=
createBaseFetch
;
}
export
default
new
SystemShell
();
src/lib/utils.js
0 → 100644
View file @
136f54c0
import
*
as
main
from
'../utils/index'
;
import
*
as
auth
from
'../utils/auth'
;
import
downloadUrl
from
'../utils/download'
;
import
{
getYourIP
}
from
'../utils/getIp'
;
import
*
as
validate
from
'../utils/validate'
;
export
default
{
...
main
,
auth
,
downloadFiles
:
downloadUrl
,
getIp
:
getYourIP
,
validate
,
};
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