base.js
2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-03-31 00:05:24
* @LastEditors: limin
* @LastEditTime: 2021-03-31 00:38:50
*/
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import GlsxVueComponents from 'glsx-vue-components'
import 'glsx-vue-components/dist/glsx-vue-components.css'
import './styles/index.css'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import { utils } from 'glsx-common'
Vue.use(ElementUI)
//引用富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
//引入富文本css
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
Vue.use(VueQuillEditor)
// import zh_CN from 'vee-validate/dist/locale/zh_CN'
// const {
// Validator
// } = VeeValidate
// import VueI18n from 'vue-i18n'
// Vue.use(VueI18n)
// const i18n = new VueI18n({
// locale: 'zh_CN'
// })
import '@/components'
import './utils/util.js'
Vue.use(GlsxVueComponents)
var mixin = {
mounted() {
const _this = this
const theme = new this.$Theme()
const connection = this.$Penpal.connectToParent({
methods: {
setTheme(color) {
theme.change(color)
},
height() {
return document.height || document.body.offsetHeight // document.documentElement.clientHeight || document.body.clientHeight //
}
}
})
connection.promise.then(parent => {
const cfg = _this.$get_session_config()
if (cfg) return
parent.getResources().then(config => {
_this.$set_session_config(config)
})
})
}
}
// const URL =
// 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config'
// const getConfig = (url = URL + '/oss_rightsAndInterests') => {
// return new Promise(resolve => {
// const xhr = new XMLHttpRequest()
// xhr.onreadystatechange = () => {
// if (xhr.readyState === 4 && xhr.status === 200) {
// let config = JSON.parse(xhr.responseText)
// window.localStorage.setItem('GLSX_OSS_EQUITY_CONFIG', xhr.responseText)
// resolve({ vue: Vue, config: config })
// }
// }
// xhr.open('GET', url)
// xhr.send()
// })
// }
const getConfig = () => {
let params = {
moduleName: 'glsx-oss-rightsAndInterests',
mockUrl:
'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/oss_rightsAndInterests',
httpOptions: {
Headers: { refererurl: location.href },
request: { timeout: 30000 }
}
}
return new Promise((resolve, reject) => {
utils.getConfig(params).then(res => {
window.localStorage.setItem('GLSX_OSS_EQUITY_CONFIG', JSON.stringify(res))
resolve({ vue: Vue, config: res })
})
})
}
/* eslint-disable no-new */
const render = App => {
window.vm = new Vue({
el: '#app',
mixins: [mixin],
render: h => h(App)
})
}
getConfig()
export default {
render,
getConfig
}