vue2-client 1.8.36 → 1.8.38

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/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Change Log
2
2
  > 所有关于本项目的变化都在该文档里。
3
3
 
4
+ **1.8.37 -2024-1-30 @江超**
5
+ - 开发环境增加水印
6
+
4
7
  **1.8.36 -2024-1-25 @江超**
5
8
  - 处理登录时指定资源名的情况
6
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.36",
3
+ "version": "1.8.38",
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
@@ -10,6 +10,7 @@ import { mapState, mapMutations } from 'vuex'
10
10
  import themeUtil from '@vue2-client/utils/themeUtil'
11
11
  import { getI18nKey } from '@vue2-client/utils/routerUtil'
12
12
  import { setSystemVersion } from '@vue2-client/utils/request'
13
+ import createWaterMark from '@vue2-client/utils/waterMark'
13
14
 
14
15
  export default {
15
16
  name: 'App',
@@ -25,6 +26,14 @@ export default {
25
26
  },
26
27
  mounted () {
27
28
  this.setWeekModeTheme(this.weekMode)
29
+ const configStr = localStorage.getItem(process.env.VUE_APP_WEB_CONFIG_KEY)
30
+ if (configStr) {
31
+ const config = JSON.parse()
32
+ if (config.$globalProp.environment === 'dev') {
33
+ // 设置水印
34
+ createWaterMark('开发环境')
35
+ }
36
+ }
28
37
  // 设置系统版本
29
38
  setSystemVersion(this.compatible)
30
39
  // 获取基座应用得路由地址
@@ -126,3 +135,26 @@ export default {
126
135
  #id {
127
136
  }
128
137
  </style>
138
+ <style lang="less">
139
+ .water-mark-wrap {
140
+ position: absolute;
141
+ width: 100%;
142
+ height: 100%;
143
+ z-index: 9999;
144
+ pointer-events: none;
145
+ top: 0;
146
+ left: 0;
147
+ display: flex;
148
+ overflow: hidden;
149
+ flex-wrap: wrap;
150
+ }
151
+ .water-word {
152
+ display: flex;
153
+ align-items: center;
154
+ justify-content: center;
155
+ font-size: 18px;
156
+ color: rgba(8, 8, 8, 0.1);
157
+ transform: rotate(-45deg);
158
+ user-select: none;
159
+ }
160
+ </style>
@@ -43,7 +43,7 @@ module.exports = {
43
43
  // 旧系统路径
44
44
  iframeSrc: '/singlepage/index.html',
45
45
  // 兼容旧版本 V4(最新产品) V3(V3产品) OA(公司OA)
46
- compatible: 'V3',
46
+ compatible: 'V4',
47
47
  // 路由资源名称
48
48
  routeName: '智慧燃气',
49
49
  // 自定义组件集合 格式为组件名: 组件路径(不需要带@/)
@@ -75,7 +75,7 @@ export default {
75
75
  this.loadCacheConfig(this.$router?.options?.routes)
76
76
  this.loadCachedTabs()
77
77
  // 解决单页面为首页时首次登录不加载问题
78
- if (this.$route.meta.singlePage && this.single.length === 0){
78
+ if (this.$route.meta.singlePage && this.single.length === 0) {
79
79
  this.allSinglePages.forEach(item => {
80
80
  if (this.$route.fullPath.includes(item.fullPath)) {
81
81
  this.setSingle(item)
package/src/main.js CHANGED
@@ -1,49 +1,26 @@
1
1
  import Vue from 'vue'
2
2
  import App from './App.vue'
3
3
  import Router from 'vue-router'
4
- import { modules } from '@vue2-client/store'
5
- import '@vue2-client/theme/index.less'
6
- import '@vue2-client/utils/filter'
7
- import 'animate.css/source/animate.css'
8
- import 'moment/locale/zh-cn'
9
- import Viser from 'viser-vue'
10
4
  import Vuex from 'vuex'
11
-
12
- // 插件
13
- import Antd from 'ant-design-vue'
14
- import Plugins from '@vue2-client/base-client/plugins'
15
- import { initI18n } from '@vue2-client/utils/i18n'
16
- import { loadInterceptors } from '@vue2-client/utils/request'
17
- import routes from './router'
18
-
19
- Vue.config.productionTip = false
20
-
21
- const i18n = initI18n('CN', 'US')
22
-
23
- const message = Vue.prototype.$message
5
+ import { routerOptions, modules, i18n, message, bootstrap } from '../index'
24
6
 
25
7
  Vue.use(Router)
26
8
  Vue.use(Vuex)
27
- Vue.use(Antd)
28
- Vue.use(Viser)
29
- Vue.use(Plugins)
30
9
 
10
+ // 创建router store
31
11
  const store = new Vuex.Store({ modules })
32
- const router = new Router({
33
- mode: 'history', // 启用 history 模式
34
- routes: routes // (缩写)相当于 routes: routes
35
- })
12
+ const router = new Router(routerOptions)
36
13
 
37
14
  // 绑定原型,用于amis
38
15
  Vue.$store = store
39
16
  Vue.$router = router
40
17
  Vue.$i18n = i18n
41
18
 
42
- // 加载 axios 拦截器
43
- loadInterceptors({ i18n, message })
44
- new Vue({
45
- router, // 注入路由配置到根实例
46
- store,
47
- i18n,
48
- render: h => h(App),
49
- }).$mount('#app')
19
+ bootstrap({ router, store, i18n, message }).then(() => {
20
+ new Vue({
21
+ router,
22
+ store,
23
+ i18n,
24
+ render: h => h(App)
25
+ }).$mount('#app')
26
+ })
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @description: createWaterMark.js 加水印功能
3
+ */
4
+ let waterMarkDOM
5
+
6
+ const clearWaterMark = () => {
7
+ if (waterMarkDOM) waterMarkDOM.remove()
8
+ }
9
+ /**
10
+ * @description: 创建水印
11
+ * @param waterMarkName 水印内容
12
+ */
13
+ export default function createWaterMark (waterMarkName) {
14
+ clearWaterMark()
15
+ if (!waterMarkName) {
16
+ return
17
+ }
18
+ const width = document.body.clientWidth
19
+ const canvasWidth = width / width / 320
20
+ const fontFamily = window.getComputedStyle(document.body)['font-family']
21
+ const fragment = document.createDocumentFragment()
22
+ waterMarkDOM = document.createElement('div')
23
+ waterMarkDOM.className = 'water-mark-wrap'
24
+ let spanStr = ''
25
+ for (let i = 0; i < 100; i++) {
26
+ spanStr += `<span class="water-word" style=width:${canvasWidth}px;height:200px;font: ${fontFamily}>${waterMarkName}</span>`
27
+ }
28
+ waterMarkDOM.innerHTML = spanStr
29
+ fragment.appendChild(waterMarkDOM)
30
+ document.body.appendChild(fragment)
31
+ }
package/vue.config.js CHANGED
@@ -11,11 +11,11 @@ const productionGzipExtensions = ['js', 'css']
11
11
  const isProd = process.env.NODE_ENV === 'production'
12
12
 
13
13
  // v4 产品演示
14
- // const v3Server = 'http://121.36.106.17:8400'
15
- // const gateway = 'http://192.168.50.77:31466'
14
+ const v3Server = 'http://121.36.106.17:8400'
15
+ const gateway = 'http://192.168.50.67:31567'
16
16
  // v3 铜川
17
- const v3Server = 'http://61.134.55.234:8405'
18
- const gateway = 'http://61.134.55.234:8456/webmeter'
17
+ // const v3Server = 'http://61.134.55.234:8405'
18
+ // const gateway = 'http://61.134.55.234:8456/webmeter'
19
19
  // v3 涉县
20
20
  // const v3Server = 'http://221.193.244.147:9600'
21
21
  // const gateway = 'http://221.193.244.147:9600/webmeter'
@@ -35,7 +35,7 @@ module.exports = {
35
35
  },
36
36
  '/api': {
37
37
  // v3用
38
- pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
38
+ // pathRewrite: { '^/api/af-system/': '/rs/', '^/api/af-iot/': '/rs/' },
39
39
  target: gateway,
40
40
  changeOrigin: true
41
41
  },