vue2-client 1.8.5 → 1.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import Vue from 'vue'
2
- import { initRouter } from '@vue2-client/router'
2
+ import { initRouter } from '@vue2-client/router/index.js'
3
3
  import { initI18n } from '@vue2-client/utils/i18n'
4
4
  import bootstrap from '@vue2-client/bootstrap'
5
5
  import { modules } from '@vue2-client/store'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.5",
3
+ "version": "1.8.7",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
package/src/App.vue CHANGED
@@ -1,16 +1,110 @@
1
1
  <template>
2
- <div id="app">
2
+ <a-config-provider :locale="locale" :get-popup-container="popContainer">
3
3
  <router-view/>
4
- </div>
4
+ </a-config-provider>
5
5
  </template>
6
6
 
7
7
  <script>
8
+ import { enquireScreen } from '@vue2-client/utils/util'
9
+ import { mapState, mapMutations } from 'vuex'
10
+ import themeUtil from '@vue2-client/utils/themeUtil'
11
+ import { getI18nKey } from '@vue2-client/utils/routerUtil'
12
+ import { setSystemVersion } from '@vue2-client/utils/request'
13
+
8
14
  export default {
9
- name: 'App'
15
+ name: 'App',
16
+ data () {
17
+ return {
18
+ locale: {}
19
+ }
20
+ },
21
+ created () {
22
+ this.setHtmlTitle()
23
+ this.setLanguage(this.lang)
24
+ enquireScreen(isMobile => this.setDevice(isMobile))
25
+ },
26
+ mounted () {
27
+ this.setWeekModeTheme(this.weekMode)
28
+ // 设置系统版本
29
+ setSystemVersion(this.compatible)
30
+ },
31
+ watch: {
32
+ weekMode (val) {
33
+ this.setWeekModeTheme(val)
34
+ },
35
+ lang (val) {
36
+ this.setLanguage(val)
37
+ this.setHtmlTitle()
38
+ },
39
+ $route () {
40
+ this.setHtmlTitle()
41
+ },
42
+ 'theme.mode': {
43
+ immediate: true,
44
+ handler: function (val) {
45
+ if (process.env.NODE_ENV === 'production') {
46
+ const closeMessage = this.$message.loading(`您选择了主题模式 ${val}, 正在切换...`)
47
+ themeUtil.changeThemeColor(this.theme.color, val).then(closeMessage)
48
+ } else {
49
+ this.$message.info('为保证构建性能,关闭开发环境下的主题模式切换')
50
+ }
51
+ }
52
+ },
53
+ 'theme.color': {
54
+ immediate: true,
55
+ handler: function (val) {
56
+ if (process.env.NODE_ENV === 'production') {
57
+ const closeMessage = this.$message.loading(`您选择了主题色 ${val}, 正在切换...`)
58
+ themeUtil.changeThemeColor(val, this.theme.mode).then(closeMessage)
59
+ } else {
60
+ this.$message.info('为保证构建性能,关闭开发环境下的主题色切换')
61
+ }
62
+ }
63
+ },
64
+ layout: function () {
65
+ window.dispatchEvent(new Event('resize'))
66
+ }
67
+ },
68
+ computed: {
69
+ ...mapState('setting', ['layout', 'theme', 'weekMode', 'lang', 'compatible'])
70
+ },
71
+ methods: {
72
+ ...mapMutations('setting', ['setDevice']),
73
+ setWeekModeTheme (weekMode) {
74
+ if (weekMode) {
75
+ document.body.classList.add('week-mode')
76
+ } else {
77
+ document.body.classList.remove('week-mode')
78
+ }
79
+ },
80
+ setLanguage (lang) {
81
+ this.$i18n.locale = lang
82
+ switch (lang) {
83
+ case 'CN':
84
+ this.locale = require('ant-design-vue/es/locale-provider/zh_CN').default
85
+ break
86
+ case 'HK':
87
+ this.locale = require('ant-design-vue/es/locale-provider/zh_TW').default
88
+ break
89
+ case 'US':
90
+ default:
91
+ this.locale = require('ant-design-vue/es/locale-provider/en_US').default
92
+ break
93
+ }
94
+ },
95
+ setHtmlTitle () {
96
+ const route = this.$route
97
+ const key = route.path === '/' ? 'home.name' : getI18nKey(route.matched[route.matched.length - 1].path)
98
+ document.title = process.env.VUE_APP_NAME + ' | ' + this.$t(key)
99
+ },
100
+ popContainer () {
101
+ return document.getElementById('popContainer')
102
+ }
103
+ }
10
104
  }
11
105
  </script>
12
106
 
13
107
  <style lang="less" scoped>
14
- #id{
15
- }
108
+ #id{
109
+ }
16
110
  </style>
@@ -44,9 +44,9 @@
44
44
  </template>
45
45
 
46
46
  <script>
47
- import XAddNativeForm from '@/base-client/components/common/XAddNativeForm/XAddNativeForm.vue'
48
- import { post } from '@/services/api'
49
- import XTable from '@/base-client/components/common/XTable/XTable.vue'
47
+ import XAddNativeForm from '@vue2-client/base-client/components/common/XAddNativeForm/XAddNativeForm.vue'
48
+ import { post } from '@vue2-client/services/api'
49
+ import XTable from '@vue2-client/base-client/components/common/XTable/XTable.vue'
50
50
 
51
51
  export default {
52
52
  name: 'XStepView',
package/vue.config.js CHANGED
@@ -76,14 +76,16 @@ module.exports = {
76
76
  config.performance = {
77
77
  hints: false
78
78
  }
79
- config.plugins.push(
80
- new ThemeColorReplacer({
81
- fileName: 'css/theme-colors-[contenthash:8].css',
82
- matchColors: getThemeColors(),
83
- injectCss: true,
84
- resolveCss
85
- })
86
- )
79
+ if (isProd) {
80
+ config.plugins.push(
81
+ new ThemeColorReplacer({
82
+ fileName: 'css/theme-colors-[contenthash:8].css',
83
+ matchColors: getThemeColors(),
84
+ injectCss: true,
85
+ resolveCss
86
+ })
87
+ )
88
+ }
87
89
  // Ignore all locale files of moment.js
88
90
  config.plugins.push(new webpack.IgnorePlugin({
89
91
  resourceRegExp: /^\.\/locale$/,