Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-web
/
authority
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f37b538e
authored
Sep 23, 2024
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
配置服务切换
1 parent
80bf9c29
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
20 deletions
package.json
src/base.js
package.json
View file @
f37b538
...
...
@@ -10,6 +10,7 @@
"dependencies"
:
{
"glsx-vue-common"
:
"^1.1.20"
,
"glsx-vue-components"
:
"^1.0.15"
,
"glsx-common"
:
"^2.10.1"
,
"node-sass"
:
"^4.9.3"
,
"sass-loader"
:
"^7.1.0"
,
"vee-validate"
:
"^2.1.0-beta.11"
,
...
...
src/base.js
View file @
f37b538
...
...
@@ -7,6 +7,7 @@ import 'glsx-vue-components/dist/glsx-vue-components.css'
import
'./styles/role-user-common.scss'
import
'./styles/index.scss'
import
'./date.js'
import
{
utils
}
from
'glsx-common'
import
zh_CN
from
'vee-validate/dist/locale/zh_CN'
import
VeeValidate
,
{
Validator
}
from
'vee-validate'
// import VeeValidate from 'vee-validate'
...
...
@@ -17,7 +18,7 @@ Vue.component('tree', Tree)
const
config
=
{
errorBagName
:
'errorBags'
,
fieldsBagName
:
'fieldBags'
fieldsBagName
:
'fieldBags'
,
}
Vue
.
use
(
VeeValidate
,
config
)
Validator
.
localize
(
'zh_CN'
,
zh_CN
)
...
...
@@ -26,7 +27,7 @@ var mixin = {
data
()
{
return
{
connection
:
null
,
eventBus
:
null
eventBus
:
null
,
}
},
beforeMount
()
{
...
...
@@ -45,36 +46,52 @@ var mixin = {
},
$$on
(
e
)
{
_this
.
eventBus
.
$emit
(
'event'
,
e
)
}
}
}
,
}
,
})
this
.
connection
.
promise
.
then
(
parent
=>
{
this
.
connection
.
promise
.
then
(
(
parent
)
=>
{
const
cfg
=
_this
.
$get_session_config
()
if
(
cfg
)
return
parent
.
getResources
().
then
(
config
=>
{
parent
.
getResources
().
then
(
(
config
)
=>
{
_this
.
$set_session_config
(
config
)
})
})
},
methods
:
{
C2P
(
_event
)
{
this
.
connection
.
promise
.
then
(
parent
=>
{
this
.
connection
.
promise
.
then
(
(
parent
)
=>
{
parent
.
$$emit
(
_event
)
})
}
}
}
,
}
,
}
const
URL
=
'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config'
const
getConfig
=
(
url
=
URL
+
'/authority_common'
)
=>
{
return
new
Promise
(
resolve
=>
{
const
xhr
=
new
XMLHttpRequest
()
xhr
.
onreadystatechange
=
()
=>
{
if
(
xhr
.
readyState
===
4
&&
xhr
.
status
===
200
)
{
resolve
({
'vue'
:
Vue
,
'config'
:
JSON
.
parse
(
xhr
.
responseText
)
})
}
}
xhr
.
open
(
'GET'
,
url
)
xhr
.
send
()
// const URL = 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config'
// const getConfig = (url = URL + '/authority_common') => {
// return new Promise(resolve => {
// const xhr = new XMLHttpRequest()
// xhr.onreadystatechange = () => {
// if (xhr.readyState === 4 && xhr.status === 200) {
// resolve({ 'vue': Vue, 'config': JSON.parse(xhr.responseText) })
// }
// }
// xhr.open('GET', url)
// xhr.send()
// })
// }
const
getConfig
=
()
=>
{
let
params
=
{
moduleName
:
'glsx-oss-authority'
,
mockUrl
:
'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/authority_common'
,
httpOptions
:
{
Headers
:
{
refererurl
:
location
.
href
},
request
:
{
timeout
:
30000
},
},
}
return
new
Promise
((
resolve
,
reject
)
=>
{
utils
.
getConfig
(
params
).
then
((
res
)
=>
{
resolve
({
vue
:
Vue
,
config
:
res
})
})
})
}
/* eslint-disable no-new */
...
...
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