Commit f37b538e by chenwq

配置服务切换

1 parent 80bf9c29
......@@ -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",
......
......@@ -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 */
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!