Преглед изворни кода

fix: layout siderbar, cleanup log

liangliangyin пре 4 година
родитељ
комит
e50d66d2d0
7 измењених фајлова са 40 додато и 16 уклоњено
  1. 2 1
      package.json
  2. 0 8
      src/App.vue
  3. 2 1
      src/core/bootstrap.js
  4. 0 1
      src/store/modules/app.js
  5. 18 0
      src/utils/screenLog.js
  6. 9 1
      vue.config.js
  7. 9 4
      yarn.lock

+ 2 - 1
package.json

@@ -11,7 +11,7 @@
     "lint:nofix": "vue-cli-service lint --no-fix"
   },
   "dependencies": {
-    "@ant-design-vue/pro-layout": "^0.2.8",
+    "@ant-design-vue/pro-layout": "^0.2.9",
     "@antv/data-set": "^0.10.2",
     "ant-design-vue": "1.5.5",
     "axios": "^0.19.0",
@@ -52,6 +52,7 @@
     "eslint": "^5.16.0",
     "eslint-plugin-html": "^5.0.0",
     "eslint-plugin-vue": "^5.2.3",
+    "git-revision-webpack-plugin": "^3.0.6",
     "less": "^3.0.4",
     "less-loader": "^5.0.0",
     "opencollective": "^1.0.3",

+ 0 - 8
src/App.vue

@@ -23,14 +23,6 @@ export default {
 
       return this.$i18n.getLocaleMessage(this.$store.getters.lang).antLocale
     }
-  },
-  mounted () {
-    this.test()
-  },
-  methods: {
-    test () {
-      console.log('this', this)
-    }
   }
 }
 </script>

+ 2 - 1
src/core/bootstrap.js

@@ -9,10 +9,11 @@ import {
   TOGGLE_LAYOUT, TOGGLE_NAV_THEME, TOGGLE_WEAK,
   TOGGLE_COLOR, TOGGLE_MULTI_TAB
 } from '@/store/mutation-types'
+import { printANSI } from '@/utils/screenLog'
 import defaultSettings from '@/config/defaultSettings'
 
 export default function Initializer () {
-  console.log(`API_URL: ${process.env.VUE_APP_API_BASE_URL}`)
+  printANSI() // 请自行一处改行.  please remove this line
 
   store.commit(TOGGLE_LAYOUT, storage.get(TOGGLE_LAYOUT, defaultSettings.layout))
   store.commit(TOGGLE_FIXED_HEADER, storage.get(TOGGLE_FIXED_HEADER, defaultSettings.fixedHeader))

+ 0 - 1
src/store/modules/app.js

@@ -73,7 +73,6 @@ const app = {
       storage.set(TOGGLE_WEAK, mode)
     },
     [APP_LANGUAGE]: (state, lang, antd = {}) => {
-      console.log('lang', lang)
       state.lang = lang
       state._antLocale = antd
       storage.set(APP_LANGUAGE, lang)

+ 18 - 0
src/utils/screenLog.js

@@ -0,0 +1,18 @@
+/* eslint-disable */
+export const printANSI = () => {
+  // console.clear()
+  console.log('[Antd Pro] created()')
+  // ASCII - ANSI Shadow
+  let text = `
+ █████╗ ███╗   ██╗████████╗██████╗     ██████╗ ██████╗  ██████╗ 
+██╔══██╗████╗  ██║╚══██╔══╝██╔══██╗    ██╔══██╗██╔══██╗██╔═══██╗
+███████║██╔██╗ ██║   ██║   ██║  ██║    ██████╔╝██████╔╝██║   ██║
+██╔══██║██║╚██╗██║   ██║   ██║  ██║    ██╔═══╝ ██╔══██╗██║   ██║
+██║  ██║██║ ╚████║   ██║   ██████╔╝    ██║     ██║  ██║╚██████╔╝
+╚═╝  ╚═╝╚═╝  ╚═══╝   ╚═╝   ╚═════╝     ╚═╝     ╚═╝  ╚═╝ ╚═════╝ 
+\t\t\t\t\tPublished ${APP_VERSION}-${GIT_HASH} @ antdv.com
+\t\t\t\t\tBuild date: ${BUILD_DATE}`
+  console.log(`%c${text}`, 'color: #fc4d50')
+  console.log('%c感谢使用 Antd Vue Pro!', 'color: #000; font-size: 14px;    font-family: Hiragino Sans GB,Microsoft YaHei,\\\\5FAE\\8F6F\\96C5\\9ED1,Droid Sans Fallback,Source Sans,Wenquanyi Micro Hei,WenQuanYi Micro Hei Mono,WenQuanYi Zen Hei,Apple LiGothic Medium,SimHei,ST Heiti,WenQuanYi Zen Hei Sharp,sans-serif;')
+  console.log('%cThanks for using Antd Vue Pro!', 'color: #fff; font-size: 14px; font-weight: 300; text-shadow:#000 1px 0 0,#000 0 1px 0,#000 -1px 0 0,#000 0 -1px 0;')
+}

+ 9 - 1
vue.config.js

@@ -1,5 +1,8 @@
 const path = require('path')
 const webpack = require('webpack')
+const GitRevisionPlugin = require('git-revision-webpack-plugin')
+const GitRevision = new GitRevisionPlugin()
+const buildDate = JSON.stringify(new Date().toLocaleString())
 const createThemeColorReplacerPlugin = require('./config/plugin.config')
 
 function resolve (dir) {
@@ -32,7 +35,12 @@ const vueConfig = {
     // webpack plugins
     plugins: [
       // Ignore all locale files of moment.js
-      new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
+      new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
+      new webpack.DefinePlugin({
+        APP_VERSION: `"${require('./package.json').version}"`,
+        GIT_HASH: JSON.stringify(GitRevision.version()),
+        BUILD_DATE: buildDate
+      })
     ],
     // if prod, add externals
     externals: isProd ? assetsCDN.externals : {}

+ 9 - 4
yarn.lock

@@ -2,10 +2,10 @@
 # yarn lockfile v1
 
 
-"@ant-design-vue/pro-layout@^0.2.8":
-  version "0.2.8"
-  resolved "https://registry.npm.taobao.org/@ant-design-vue/pro-layout/download/@ant-design-vue/pro-layout-0.2.8.tgz?cache=0&sync_timestamp=1589509677371&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40ant-design-vue%2Fpro-layout%2Fdownload%2F%40ant-design-vue%2Fpro-layout-0.2.8.tgz#671249fde066640197c8ca0697cb292a9ea22baa"
-  integrity sha1-ZxJJ/eBmZAGXyMoGl8spKp6iK6o=
+"@ant-design-vue/pro-layout@^0.2.9":
+  version "0.2.9"
+  resolved "https://registry.npm.taobao.org/@ant-design-vue/pro-layout/download/@ant-design-vue/pro-layout-0.2.9.tgz?cache=0&sync_timestamp=1589537984599&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40ant-design-vue%2Fpro-layout%2Fdownload%2F%40ant-design-vue%2Fpro-layout-0.2.9.tgz#eb6d439322fe50ff0add454bf24eab6342f92e75"
+  integrity sha1-621DkyL+UP8K3UVL8k6rY0L5LnU=
   dependencies:
     ant-design-vue "^1.5.3"
     classnames "^2.2.6"
@@ -5233,6 +5233,11 @@ getpass@^0.1.1:
   dependencies:
     assert-plus "^1.0.0"
 
+git-revision-webpack-plugin@^3.0.6:
+  version "3.0.6"
+  resolved "https://registry.npm.taobao.org/git-revision-webpack-plugin/download/git-revision-webpack-plugin-3.0.6.tgz#5dd6c6829fae05b405059dea6195b23875d69d4d"
+  integrity sha1-XdbGgp+uBbQFBZ3qYZWyOHXWnU0=
+
 glob-parent@^3.1.0:
   version "3.1.0"
   resolved "https://registry.npm.taobao.org/glob-parent/download/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae"