Commit 27e6038a by chenwq

前端配置服务变更

1 parent f11b8875
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"glsx-vue-common": "^1.2.4", "glsx-vue-common": "^1.2.4",
"glsx-vue-components": "^1.0.13", "glsx-vue-components": "^1.0.13",
"js-md5": "^0.7.3", "js-md5": "^0.7.3",
"glsx-common": "^2.10.1",
"node-sass": "^4.9.3", "node-sass": "^4.9.3",
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",
"vee-validate": "^2.1.7", "vee-validate": "^2.1.7",
......
...@@ -8,6 +8,7 @@ import './styles/common.scss' ...@@ -8,6 +8,7 @@ import './styles/common.scss'
// import axios from 'axios' // import axios from 'axios'
import VeeValidate from 'vee-validate' import VeeValidate from 'vee-validate'
import './date.js' import './date.js'
import { utils } from 'glsx-common'
Vue.use(GlsxVueComponents) Vue.use(GlsxVueComponents)
Vue.use(VeeValidate, { Vue.use(VeeValidate, {
...@@ -16,7 +17,7 @@ Vue.use(VeeValidate, { ...@@ -16,7 +17,7 @@ Vue.use(VeeValidate, {
dictionary: { dictionary: {
en: { en: {
messages: { messages: {
required: (field) => `${field}不能为空`, required: field => `${field}不能为空`,
between: (field, data) => `${field}必须在${data[0]}~${data[1]}之间`, between: (field, data) => `${field}必须在${data[0]}~${data[1]}之间`,
confirmed: (field, data) => `${field}必须与${data[0]}相匹配`, confirmed: (field, data) => `${field}必须与${data[0]}相匹配`,
max: (field, data) => `${field}最大长度不能超过${data[0]}`, max: (field, data) => `${field}最大长度不能超过${data[0]}`,
...@@ -105,17 +106,33 @@ var mixin = { ...@@ -105,17 +106,33 @@ var mixin = {
// } // }
} }
} }
const URL = 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config' // const URL = 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config'
const getConfig = (url = URL + '/business_data_config') => { // const getConfig = (url = URL + '/business_data_config') => {
return new Promise(resolve => { // return new Promise(resolve => {
const xhr = new XMLHttpRequest() // const xhr = new XMLHttpRequest()
xhr.onreadystatechange = () => { // xhr.onreadystatechange = () => {
if (xhr.readyState === 4 && xhr.status === 200) { // if (xhr.readyState === 4 && xhr.status === 200) {
resolve({ 'vue': Vue, 'config': JSON.parse(xhr.responseText) }) // resolve({ 'vue': Vue, 'config': JSON.parse(xhr.responseText) })
} // }
// }
// xhr.open('GET', url)
// xhr.send()
// })
// }
const getConfig = () => {
let params = {
moduleName: 'glsx-oss-business-data',
mockUrl:
'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/business_data_config',
httpOptions: {
Headers: { refererurl: location.href },
request: { timeout: 30000 }
} }
xhr.open('GET', url) }
xhr.send() return new Promise((resolve, reject) => {
utils.getConfig(params).then(res => {
resolve({ vue: Vue, config: res })
})
}) })
} }
/* eslint-disable no-new */ /* 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!