Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-system
/
micro-portal
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7c1910f2
authored
Oct 29, 2020
by
冒粤蓉
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix
1 parent
ea0bf46e
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
156 additions
and
85 deletions
src/App.vue
src/components/DesktopLeftSider/Sub/Menu.vue
src/components/DesktopLeftSider/Sub/NavInfoCard.vue
src/components/DesktopRightSider/DesktopRightSider.vue
src/components/DesktopTopSider/Sub/UserButton.vue
src/components/HomeContent/Sub/LoginForm.vue
src/micro/apps.js
src/router/index.js
src/services/Menu.js
src/utils/globalAnt/ant.js
src/utils/http/http.js
src/App.vue
View file @
7c1910f
<
template
>
<
template
>
<div
id=
"app"
>
<a-config-provider
:locale=
"zhCN"
>
<keep-alive>
<div
id=
"app"
>
<div>
<keep-alive>
<dashboard
v-if=
"hasToken"
></dashboard>
<div>
<login
v-else
></login>
<dashboard
v-if=
"hasToken"
></dashboard>
<login
v-else
></login>
<!-- 全局loading提示 -->
<!-- 全局loading提示 -->
<loading
v-if=
"showLoading"
></loading>
<loading
v-if=
"showLoading"
></loading>
</div>
</div>
</keep-alive>
</keep-alive>
</div>
</div>
</a-config-provider>
</
template
>
</
template
>
<
script
>
<
script
>
...
@@ -17,8 +19,6 @@ import Dashboard from '@/views/Dashboard';
...
@@ -17,8 +19,6 @@ import Dashboard from '@/views/Dashboard';
import
Login
from
'@/views/Login'
;
import
Login
from
'@/views/Login'
;
import
Loading
from
'components/Loading/Loading'
;
import
Loading
from
'components/Loading/Loading'
;
// import BaseService from 'services/Base';
import
{
onCreated
,
onMounted
,
computed
,
reactive
,
toRefs
}
from
'vue'
;
import
{
onCreated
,
onMounted
,
computed
,
reactive
,
toRefs
}
from
'vue'
;
import
{
useStore
}
from
'vuex'
;
import
{
useStore
}
from
'vuex'
;
...
@@ -32,14 +32,6 @@ export default {
...
@@ -32,14 +32,6 @@ export default {
},
},
setup
()
{
setup
()
{
const
store
=
useStore
();
const
store
=
useStore
();
// const baseService = new BaseService();
// baseService.getBaseConfig().then((res) => {
// const baseURL = res.axios.baseURL;
// store.dispatch('app/updateBaseURL', baseURL);
// }, (err) => {
// });
let
hasToken
=
computed
(()
=>
{
let
hasToken
=
computed
(()
=>
{
return
!!
store
.
getters
.
token
;
return
!!
store
.
getters
.
token
;
...
...
src/components/DesktopLeftSider/Sub/Menu.vue
View file @
7c1910f
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
style="padding-left: 48px;"
style="padding-left: 48px;"
v-for="cItem in item.children"
v-for="cItem in item.children"
:key="cItem.origin.menuNo"
:key="cItem.origin.menuNo"
@click.stop="cItemClick(cItem.origin.path || '', cItem)">
@click.stop="cItemClick(cItem.origin.path || '', cItem
, item
)">
{{
cItem
.
origin
.
menuName
}}
{{
cItem
.
origin
.
menuName
}}
</li>
</li>
</ul>
</ul>
...
@@ -72,7 +72,7 @@ export default {
...
@@ -72,7 +72,7 @@ export default {
};
};
// 点击二级菜单标题
// 点击二级菜单标题
const
cItemClick
=
(
path
,
cItem
)
=>
{
const
cItemClick
=
(
path
,
cItem
,
parentItem
)
=>
{
const
cOrigin
=
cItem
.
origin
;
const
cOrigin
=
cItem
.
origin
;
// 激活active类
// 激活active类
state
.
menuList
.
forEach
(
ele
=>
{
state
.
menuList
.
forEach
(
ele
=>
{
...
@@ -83,12 +83,14 @@ export default {
...
@@ -83,12 +83,14 @@ export default {
})
})
cItem
.
subItemActive
=
true
;
cItem
.
subItemActive
=
true
;
state
.
curBreadCrumb
.
parent
[
'menuName'
]
=
state
.
curMainTitl
e
;
state
.
curBreadCrumb
.
parent
[
'menuName'
]
=
parentItem
.
origin
.
menuNam
e
;
state
.
curBreadCrumb
.
children
=
[{
state
.
curBreadCrumb
.
children
=
[{
menuName
:
cOrigin
.
menuName
,
menuName
:
cOrigin
.
menuName
,
path
:
cOrigin
.
path
||
''
,
path
:
cOrigin
.
path
||
''
,
active
:
true
active
:
true
}];
}];
path
=
path
?
path
:
'/404'
;
history
.
pushState
(
null
,
path
,
path
);
history
.
pushState
(
null
,
path
,
path
);
}
}
...
...
src/components/DesktopLeftSider/Sub/NavInfoCard.vue
View file @
7c1910f
<
template
>
<
template
>
<div
class=
"info-card"
:class=
"
{ infoActive: !isNavFilterActive }">
<div>
<DownOutlined
class=
"arrow-icon"
@
click=
"downClicked"
/>
<div
class=
"info-card"
:class=
"
{ infoActive: !isNavFilterActive }">
<div
class=
"info-card-content"
:style=
"
{width: collapsed? '80px' : '100%'}">
<!--
<DownOutlined
class=
"arrow-icon"
@
click=
"downClicked"
/>
-->
<!-- 用户卡片头像:缩小时点击会出现用户信息 v-if="collapsed" -->
<div
class=
"info-card-content"
:style=
"
{width: collapsed? '80px' : '100%'}">
<!--
<a-popover
placement=
"right"
v-if=
"collapsed"
>
<!-- 用户卡片头像:缩小时点击会出现用户信息 v-if="collapsed" -->
<template
v-slot:content
>
<!--
<a-popover
placement=
"right"
v-if=
"collapsed"
>
<p>
{{
username
}}
</p>
<template
v-slot:content
>
<p>
{{
professionalTitle
}}
</p>
<p>
{{
username
}}
</p>
</
template
>
<p>
{{
professionalTitle
}}
</p>
<a-avatar
class=
"info-card-avatar"
size=
"large"
:style=
"{marginRight: collapsed? '0' : '15px'}"
>
</
template
>
<a-avatar
class=
"info-card-avatar"
size=
"large"
:style=
"{marginRight: collapsed? '0' : '15px'}"
>
<
template
v-slot:icon
>
<UserOutlined
/>
</
template
>
</a-avatar>
</a-popover>
-->
<!-- 未缩小无点击效果处理 v-if="!collapsed"-->
<a-avatar
class=
"info-card-avatar"
size=
"large"
:style=
"{marginRight: '15px'}"
>
<
template
v-slot:icon
>
<
template
v-slot:icon
>
<UserOutlined
/>
<UserOutlined
/>
</
template
>
</
template
>
</a-avatar>
</a-avatar>
</a-popover>
-->
<!-- 未缩小无点击效果处理 v-if="!collapsed"-->
<div
class=
"flex-column info-card-user"
:style=
"{display: 'block'}"
>
<a-avatar
class=
"info-card-avatar"
size=
"large"
:style=
"{marginRight: '15px'}"
>
<span
class=
"two-line-ellipsis"
>
{{username || '用户名啦啦啦'}}
</span>
<
template
v-slot:icon
>
<span
class=
"two-line-ellipsis"
>
{{professionalTitle || '管理员'}}
</span>
<UserOutlined
/>
</div>
</
template
>
</a-avatar>
<div
class=
"flex-column info-card-user"
:style=
"{display: 'block'}"
>
<span
class=
"two-line-ellipsis"
>
{{username || '用户名啦啦啦'}}
</span>
<span
class=
"two-line-ellipsis"
>
{{professionalTitle || '管理员'}}
</span>
</div>
</div>
</div>
</div>
</div
>
<!-- 菜单搜索 --
>
<!-- 菜单搜索 --
>
<div
class=
"search-menu"
:class=
"{ navActive: isNavFilterActive }"
>
<div
class=
"search-menu"
:class=
"{ navActive: isNavFilterActive }"
>
<a-input
class=
"search-menu-input"
<a-input
class=
"search-menu-input"
v-model:value=
"value"
placeholder=
"菜单搜索"
/>
v-model:value=
"value"
placeholder=
"菜单搜索
"
/>
<UpCircleOutlined
class=
"icon-arrow"
@
click=
"upClicked
"
/>
<
UpCircleOutlined
class=
"icon-arrow"
@
click=
"upClicked"
/
>
<
/div
>
</div>
</div>
</template>
</template>
...
@@ -41,7 +43,7 @@ import {
...
@@ -41,7 +43,7 @@ import {
DownOutlined
,
DownOutlined
,
UserOutlined
UserOutlined
}
from
'@ant-design/icons-vue'
;
}
from
'@ant-design/icons-vue'
;
import
{
reactive
,
toRefs
,
computed
}
from
'vue'
;
import
{
reactive
,
toRefs
,
computed
,
onMounted
}
from
'vue'
;
import
{
useStore
}
from
'vuex'
;
import
{
useStore
}
from
'vuex'
;
export
default
{
export
default
{
...
@@ -73,6 +75,12 @@ export default {
...
@@ -73,6 +75,12 @@ export default {
state
.
isNavFilterActive
=
true
;
state
.
isNavFilterActive
=
true
;
};
};
onMounted
(()
=>
{
const
userInfo
=
store
.
getters
.
userInfo
;
state
.
username
=
userInfo
.
username
;
state
.
professionalTitle
=
userInfo
.
roleName
;
})
return
{
return
{
...
toRefs
(
state
),
...
toRefs
(
state
),
upClicked
,
upClicked
,
...
...
src/components/DesktopRightSider/DesktopRightSider.vue
View file @
7c1910f
...
@@ -11,14 +11,17 @@
...
@@ -11,14 +11,17 @@
{{
item
.
name
}}
{{
item
.
name
}}
</a-breadcrumb-item>
</a-breadcrumb-item>
</a-breadcrumb>
</a-breadcrumb>
<!--
<a-empty
/>
-->
<div
v-show=
"showEmpty"
>
<div
id=
"sub-system-frame"
></div>
<a-empty
:description=
"false"
/>
<h1
class=
"empty-text"
>
暂无数据
</h1>
</div>
<div
v-show=
"!showEmpty"
id=
"sub-system-frame"
ref=
"elmSubMicro"
></div>
</a-layout-content>
</a-layout-content>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
useStore
}
from
'vuex'
;
import
{
useStore
}
from
'vuex'
;
import
{
reactive
,
toRefs
,
computed
}
from
'vue'
;
import
{
reactive
,
toRefs
,
computed
,
watch
,
onMounted
,
ref
}
from
'vue'
;
export
default
{
export
default
{
...
@@ -26,7 +29,30 @@ export default {
...
@@ -26,7 +29,30 @@ export default {
components
:
{
components
:
{
},
},
setup
(
props
,
context
)
{
setup
(
props
,
context
)
{
const
elmSubMicro
=
ref
(
null
);
const
state
=
reactive
({
el_sub_innerH
:
''
});
const
store
=
useStore
();
const
store
=
useStore
();
onMounted
(()
=>
{
state
.
el_sub_innerH
=
elmSubMicro
.
_value
.
innerHTML
;
// 监听子系统挂载的元素内容变化
const
subMircroEle
=
document
.
getElementById
(
'sub-system-frame'
);
subMircroEle
.
addEventListener
(
'DOMNodeInserted'
,
function
(
e
)
{
const
target
=
e
.
currentTarget
,
tarInner
=
target
.
innerHTML
;
if
(
!
state
.
el_sub_innerH
!==
!
tarInner
)
{
state
.
el_sub_innerH
=
target
.
innerHTML
;
}
})
})
const
showEmpty
=
computed
(()
=>
{
return
!
state
.
el_sub_innerH
;
})
const
breadCrumbList
=
computed
(()
=>
{
const
breadCrumbList
=
computed
(()
=>
{
const
curBreadCrumb
=
store
.
getters
.
curBreadCrumb
,
const
curBreadCrumb
=
store
.
getters
.
curBreadCrumb
,
curParent
=
curBreadCrumb
[
'parent'
],
curParent
=
curBreadCrumb
[
'parent'
],
...
@@ -64,6 +90,8 @@ export default {
...
@@ -64,6 +90,8 @@ export default {
return
{
return
{
breadCrumbList
,
breadCrumbList
,
elmSubMicro
,
showEmpty
// routerGo
// routerGo
}
}
}
}
...
@@ -71,6 +99,13 @@ export default {
...
@@ -71,6 +99,13 @@ export default {
</
script
>
</
script
>
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
scoped
>
@import
'styles/variables.less'
;
@import
'styles/variables.less'
;
.ant-empty
{
margin-top
:
200px
;
}
.empty-text
{
text-align
:
center
;
}
.breadcrumb-item
{
.breadcrumb-item
{
cursor
:
context-menu
;
cursor
:
context-menu
;
...
@@ -79,6 +114,10 @@ export default {
...
@@ -79,6 +114,10 @@ export default {
}
}
}
}
#sub-system-frame
{
min-width
:
1190px
;
}
.pointer
{
.pointer
{
//
cursor
:
pointer
;
//
cursor
:
pointer
;
}
}
...
...
src/components/DesktopTopSider/Sub/UserButton.vue
View file @
7c1910f
<
template
>
<
template
>
<a-popover
title=
"我的"
trigger=
"click"
>
<div
class=
"pop-over"
>
<template
slot=
"content"
>
<a-popover
title=
""
trigger=
"click"
>
<p>
登出
</p>
<template
v-slot:content
>
</
template
>
<div
@
click=
"logout"
class=
"pop-over-item"
>
登出
</div>
<a-avatar
class=
"top-nav-right-btn avatar-btn"
:size=
"35"
>
<
template
v-slot:icon
>
<UserOutlined
/>
</
template
>
</
template
>
</a-avatar>
<a-avatar
class=
"top-nav-right-btn avatar-btn"
:size=
"35"
>
</a-popover>
<
template
v-slot:icon
>
<UserOutlined
/>
</
template
>
</a-avatar>
</a-popover>
</div>
</template>
</template>
<
script
>
<
script
>
...
@@ -16,19 +18,40 @@ import {
...
@@ -16,19 +18,40 @@ import {
UserOutlined
UserOutlined
}
from
'@ant-design/icons-vue'
;
}
from
'@ant-design/icons-vue'
;
import
{
reactive
,
toRefs
}
from
'vue'
;
import
{
reactive
,
toRefs
}
from
'vue'
;
import
{
useRouter
}
from
"vue-router"
;
import
{
useStore
}
from
'vuex'
;
export
default
{
export
default
{
name
:
'UserButton'
,
name
:
'UserButton'
,
components
:
{
components
:
{
UserOutlined
UserOutlined
},
setup
()
{
const
store
=
useStore
();
const
router
=
useRouter
();
// 登出操作
const
logout
=
()
=>
{
localStorage
.
removeItem
(
'token'
);
localStorage
.
removeItem
(
'userInfo'
);
store
.
dispatch
(
'app/setToken'
,
''
);
setTimeout
(()
=>
{
window
.
location
.
reload
();
},
300
)
}
return
{
logout
}
}
}
}
}
</
script
>
</
script
>
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
scoped
>
@import
'styles/common.less'
;
@import
'styles/common.less'
;
@import
'styles/variables.less'
;
@import
'styles/variables.less'
;
/
deep
/
.ant-popover-arrow
{
.pop-over-item
{
display
:
none
!important
;
&:active,
&:hover
{
color
:
@
defaultLightBlueColor
;
}
}
}
.avatar-btn
{
.avatar-btn
{
...
...
src/components/HomeContent/Sub/LoginForm.vue
View file @
7c1910f
...
@@ -119,6 +119,7 @@ export default {
...
@@ -119,6 +119,7 @@ export default {
if
(
res
.
code
===
200
)
{
if
(
res
.
code
===
200
)
{
const
{
token
,
user
}
=
res
.
data
;
const
{
token
,
user
}
=
res
.
data
;
localStorage
.
setItem
(
'token'
,
token
);
localStorage
.
setItem
(
'token'
,
token
);
localStorage
.
setItem
(
'userInfo'
,
JSON
.
stringify
(
user
));
store
.
dispatch
(
'app/setUserInfo'
,
user
);
store
.
dispatch
(
'app/setUserInfo'
,
user
);
store
.
dispatch
(
'app/setToken'
,
token
);
store
.
dispatch
(
'app/setToken'
,
token
);
console
.
log
(
'save token'
,
token
);
console
.
log
(
'save token'
,
token
);
...
@@ -134,7 +135,8 @@ export default {
...
@@ -134,7 +135,8 @@ export default {
};
};
const
captchaUrl
=
computed
(()
=>
{
const
captchaUrl
=
computed
(()
=>
{
return
`
${
store
.
getters
.
baseURL
}
/usercenter/captcha?rand=
${
state
.
randomVal
}
`
;
const
getBaseUrlFromStorage
=
localStorage
.
getItem
(
'BASE_URL'
);
return
`
${
store
.
getters
.
baseURL
||
getBaseUrlFromStorage
}
/usercenter/captcha?rand=
${
state
.
randomVal
}
`
;
})
})
const
updateCaptcha
=
debounce
(()
=>
{
const
updateCaptcha
=
debounce
(()
=>
{
...
...
src/micro/apps.js
View file @
7c1910f
...
@@ -2,6 +2,7 @@ import store from '@/store';
...
@@ -2,6 +2,7 @@ import store from '@/store';
import
router
from
'@/router'
;
import
router
from
'@/router'
;
let
defaultApp
=
null
;
let
defaultApp
=
null
;
const
isDev
=
process
.
env
.
NODE_ENV
===
'development'
;
const
apps
=
[
const
apps
=
[
/**
/**
...
@@ -12,7 +13,7 @@ const apps = [
...
@@ -12,7 +13,7 @@ const apps = [
*/
*/
{
{
name
:
"GLSXManagementSystemSub"
,
name
:
"GLSXManagementSystemSub"
,
entry
:
"//localhost:10200"
,
entry
:
isDev
?
"//localhost:10200"
:
''
,
container
:
"#sub-system-frame"
,
container
:
"#sub-system-frame"
,
activeRule
:
"/system"
,
activeRule
:
"/system"
,
props
:
{
props
:
{
...
...
src/router/index.js
View file @
7c1910f
...
@@ -30,17 +30,17 @@ const router = createRouter({
...
@@ -30,17 +30,17 @@ const router = createRouter({
routes
routes
})
})
// const childRoute = ['/vue','/react
'];
const
childRoute
=
[
'/system
'
];
// const isChildRoute = path => childRoute.some(item => path.startsWith(item))
const
isChildRoute
=
path
=>
childRoute
.
some
(
item
=>
path
.
startsWith
(
item
));
// const rawAppendChild = HTMLHeadElement.prototype.appendChild;
// const rawAppendChild = HTMLHeadElement.prototype.appendChild;
// const rawAddEventListener = window.addEventListener;
// const rawAddEventListener = window.addEventListener;
//
router.beforeEach((to, from, next) => {
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
//
// 从子项目跳转到主项目
// 从子项目跳转到主项目
//
if(isChildRoute(from.path) && !isChildRoute(to.path)){
//
if(isChildRoute(from.path) && !isChildRoute(to.path)){
//
HTMLHeadElement.prototype.appendChild = rawAppendChild;
//
HTMLHeadElement.prototype.appendChild = rawAppendChild;
//
window.addEventListener = rawAddEventListener;
//
window.addEventListener = rawAddEventListener;
//
}
//
}
//
next();
//
next();
//
});
});
export
default
router
export
default
router
src/services/Menu.js
View file @
7c1910f
...
@@ -2,11 +2,11 @@ import HTTP from '@/utils/http/http';
...
@@ -2,11 +2,11 @@ import HTTP from '@/utils/http/http';
import
{
API
}
from
'@/config/api'
;
import
{
API
}
from
'@/config/api'
;
export
default
class
MenuService
extends
HTTP
{
export
default
class
MenuService
extends
HTTP
{
getMenuTree
(
params
)
{
getMenuTree
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
axiosGet
({
this
.
axiosGet
({
url
:
API
.
MENU_TREE_ACTION
,
url
:
API
.
MENU_TREE_ACTION
,
data
:
params
,
data
:
{}
,
success
(
data
)
{
success
(
data
)
{
resolve
(
data
);
resolve
(
data
);
},
},
...
...
src/utils/globalAnt/ant.js
View file @
7c1910f
...
@@ -12,7 +12,8 @@ import {
...
@@ -12,7 +12,8 @@ import {
Dropdown
,
Dropdown
,
Spin
,
Spin
,
Breadcrumb
,
Breadcrumb
,
Empty
Empty
,
ConfigProvider
,
}
from
"ant-design-vue"
;
}
from
"ant-design-vue"
;
const
ant
=
{
const
ant
=
{
...
@@ -36,6 +37,7 @@ const ant = {
...
@@ -36,6 +37,7 @@ const ant = {
Vue
.
component
(
Spin
.
name
,
Spin
);
Vue
.
component
(
Spin
.
name
,
Spin
);
Vue
.
component
(
Breadcrumb
.
name
,
Breadcrumb
);
Vue
.
component
(
Breadcrumb
.
name
,
Breadcrumb
);
Vue
.
component
(
Empty
.
name
,
Empty
);
Vue
.
component
(
Empty
.
name
,
Empty
);
Vue
.
component
(
ConfigProvider
.
name
,
ConfigProvider
);
},
},
};
};
...
...
src/utils/http/http.js
View file @
7c1910f
...
@@ -15,17 +15,17 @@ instance.defaults.headers.post['Content-Type'] = 'application/json';
...
@@ -15,17 +15,17 @@ instance.defaults.headers.post['Content-Type'] = 'application/json';
/** 添加请求拦截器 **/
/** 添加请求拦截器 **/
instance
.
interceptors
.
request
.
use
(
config
=>
{
instance
.
interceptors
.
request
.
use
(
config
=>
{
config
.
headers
[
'Authorization'
]
=
localStorage
.
getItem
(
'token'
)
||
''
;
config
.
headers
[
'Authorization'
]
=
localStorage
.
getItem
(
'token'
)
||
''
;
store
.
dispatch
(
'app/showLoading'
,
true
);
//
store.dispatch('app/showLoading', true);
return
config
return
config
},
error
=>
{
},
error
=>
{
console
.
log
(
'请求错误,原因:'
,
error
)
console
.
log
(
'请求错误,原因:'
,
error
)
store
.
dispatch
(
'app/showLoading'
,
false
);
//
store.dispatch('app/showLoading', false);
return
Promise
.
reject
(
error
)
return
Promise
.
reject
(
error
)
})
})
/** 添加响应拦截器 **/
/** 添加响应拦截器 **/
instance
.
interceptors
.
response
.
use
(
response
=>
{
instance
.
interceptors
.
response
.
use
(
response
=>
{
store
.
dispatch
(
'app/showLoading'
,
false
);
//
store.dispatch('app/showLoading', false);
const
serverCode
=
response
.
data
.
code
;
const
serverCode
=
response
.
data
.
code
;
if
(
serverCode
===
200
||
response
.
status
===
200
)
{
if
(
serverCode
===
200
||
response
.
status
===
200
)
{
if
(
serverCode
!==
200
)
{
if
(
serverCode
!==
200
)
{
...
@@ -41,7 +41,7 @@ instance.interceptors.response.use(response => {
...
@@ -41,7 +41,7 @@ instance.interceptors.response.use(response => {
return
Promise
.
reject
(
response
.
data
.
message
)
return
Promise
.
reject
(
response
.
data
.
message
)
}
}
},
error
=>
{
},
error
=>
{
store
.
dispatch
(
'app/showLoading'
,
false
);
//
store.dispatch('app/showLoading', false);
const
errRes
=
error
.
response
;
const
errRes
=
error
.
response
;
if
(
errRes
)
{
if
(
errRes
)
{
const
{
data
,
config
,
status
,
statusText
}
=
errRes
;
const
{
data
,
config
,
status
,
statusText
}
=
errRes
;
...
@@ -97,6 +97,7 @@ const getBaseUrl = () => {
...
@@ -97,6 +97,7 @@ const getBaseUrl = () => {
if
(
resData
)
{
if
(
resData
)
{
const
resBaseURL
=
resData
.
axios
.
baseURL
;
const
resBaseURL
=
resData
.
axios
.
baseURL
;
store
.
dispatch
(
'app/updateBaseURL'
,
resBaseURL
);
store
.
dispatch
(
'app/updateBaseURL'
,
resBaseURL
);
localStorage
.
setItem
(
'BASE_URL'
,
resBaseURL
);
baseFlag
=
!!
resBaseURL
;
baseFlag
=
!!
resBaseURL
;
resolve
(
resBaseURL
);
resolve
(
resBaseURL
);
}
else
{
}
else
{
...
@@ -128,7 +129,8 @@ const HTTP_POST = (baseUrl, options) => {
...
@@ -128,7 +129,8 @@ const HTTP_POST = (baseUrl, options) => {
const
HTTP_GET
=
(
baseUrl
,
options
)
=>
{
const
HTTP_GET
=
(
baseUrl
,
options
)
=>
{
instance
({
instance
({
url
:
baseUrl
+
options
.
url
,
url
:
baseUrl
+
options
.
url
,
method
:
'get'
method
:
'get'
,
params
:
options
.
data
}).
then
((
res
)
=>
{
}).
then
((
res
)
=>
{
options
.
success
(
res
.
data
);
options
.
success
(
res
.
data
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment