开发存档
Former-commit-id: a52163c9c3dad22bdb40f020967e4f94edba9323 [formerly a52163c9c3dad22bdb40f020967e4f94edba9323 [formerly a52163c9c3dad22bdb40f020967e4f94edba9323 [formerly a52163c9c3dad22bdb40f020967e4f94edba9323 [formerly b393934c68c9a9fe59b96135512380c69c85f6fa [formerly 5760d5421930a548c6a3980ad76f79e9d8103027]]]]] Former-commit-id: 5577a549703aca87a8052549d2ed6de11abac845 Former-commit-id: a29a725d6512f9c03ee9670e5764d42335de21a5 Former-commit-id: 100e09fae2c373d4e7a662460c55da1fa7d3a22a [formerly f4e93720482bb8c31fc3effb1b74cb78aa691647] Former-commit-id: 13acfdec41ae665da4cfb5ae19160fd3a1e2fa44 Former-commit-id: babbed7319218019876bbf1b76c03ddf68886835 Former-commit-id: 642437c40f03db3ac8340ffee916c18cca9ebdc0 Former-commit-id: c8535dc780a1dd5aee99769d1863ba799221bdc6 Former-commit-id: 286ba818b9545ad4d34c67085ee342f99263cf9d
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# 更新日志
|
||||
|
||||
## v1.1.6
|
||||
|
||||
* [ 新增 ] 新增加了多页控制组件 tab 按钮上的右键操作菜单,现在你可以在 D2Admin 中像使用浏览器一样操作多标签页
|
||||
|
||||
## v1.1.5
|
||||
|
||||
* [ 修改 ] vue-cli3 项目重构,目录调整
|
||||
|
||||
@@ -5,7 +5,8 @@ import UaParser from 'ua-parser-js'
|
||||
import { version } from '../../package.json'
|
||||
|
||||
let util = {
|
||||
cookies: {}
|
||||
cookies: {},
|
||||
log: {}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,20 +74,55 @@ util.isOneOf = function (ele, targetArr) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 返回这个样式的颜色值
|
||||
* @param {String} type 样式名称 [ primary | success | warning | danger | text ]
|
||||
*/
|
||||
util.typeColor = function (type = 'default') {
|
||||
let color = ''
|
||||
switch (type) {
|
||||
case 'default': color = '35495E'; break
|
||||
case 'primary': color = '#3488ff'; break
|
||||
case 'success': color = '#43B883'; break
|
||||
case 'warning': color = '#e6a23c'; break
|
||||
case 'danger': color = '#f56c6c'; break
|
||||
default:; break
|
||||
}
|
||||
return color
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 打印一个 “胶囊” 样式的信息
|
||||
* @param {String} title title text
|
||||
* @param {String} info info text
|
||||
* @param {String} type style
|
||||
*/
|
||||
util.logCapsule = function (title, info) {
|
||||
util.log.capsule = function (title, info, type = 'primary') {
|
||||
console.log(
|
||||
`%c ${title} %c ${info} %c`,
|
||||
'background:#29384b; padding: 1px; border-radius: 3px 0 0 3px; color: #fff',
|
||||
'background:#3488ff; padding: 1px; border-radius: 0 3px 3px 0; color: #fff',
|
||||
'background:#35495E; padding: 1px; border-radius: 3px 0 0 3px; color: #fff;',
|
||||
`background:${util.typeColor(type)}; padding: 1px; border-radius: 0 3px 3px 0; color: #fff;`,
|
||||
'background:transparent'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 打印彩色文字
|
||||
*/
|
||||
util.log.colorful = function (textArr) {
|
||||
console.log(
|
||||
`%c ${textArr.map(t => t.text).join(' %c ')}`,
|
||||
...textArr.map(t => `color: ${util.typeColor(t.type)};`)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 打印 danger 样式的文字
|
||||
*/
|
||||
util.log.error = function (text) {
|
||||
util.log.colorful([{ text, type: 'danger' }])
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 检查版本更新
|
||||
* @param {Object} vm vue
|
||||
@@ -100,7 +136,7 @@ util.checkUpdate = function (vm) {
|
||||
let versionGet = res.tag_name
|
||||
const update = semver.lt(version, versionGet)
|
||||
if (update) {
|
||||
util.logCapsule('D2Admin', `New version ${res.name}`)
|
||||
util.log.capsule('D2Admin', `New version ${res.name}`)
|
||||
console.log(`版本号: ${res.tag_name} | 详情${res.html_url}`)
|
||||
vm.$store.commit('d2adminReleasesUpdateSet', true)
|
||||
}
|
||||
@@ -115,7 +151,7 @@ util.checkUpdate = function (vm) {
|
||||
* @description 显示版本信息
|
||||
*/
|
||||
util.showInfo = function showInfo () {
|
||||
util.logCapsule('D2Admin', `v${version}`)
|
||||
util.log.capsule('D2Admin', `v${version}`)
|
||||
console.log('Github https://github.com/d2-projects/d2-admin')
|
||||
console.log('Doc http://d2admin.fairyever.com/zh/')
|
||||
}
|
||||
|
||||
@@ -15,8 +15,9 @@ import util from '@/libs/util.js'
|
||||
import store from '@/store/index'
|
||||
import '@/assets/svg-icons'
|
||||
import '@/components'
|
||||
import '@/plugin/axios'
|
||||
import '@/mock/register'
|
||||
import '@/plugin/axios'
|
||||
import pluginError from '@/plugin/error'
|
||||
import pluginImport from '@/plugin/import'
|
||||
import pluginExport from '@/plugin/export'
|
||||
import pluginOpen from '@/plugin/open'
|
||||
@@ -29,6 +30,7 @@ import { frameInRoutes } from '@/router/routes'
|
||||
Vue.use(ElementUI)
|
||||
Vue.use(VCharts)
|
||||
Vue.use(contentmenu)
|
||||
Vue.use(pluginError)
|
||||
Vue.use(pluginImport)
|
||||
Vue.use(pluginExport)
|
||||
Vue.use(pluginOpen)
|
||||
@@ -61,6 +63,10 @@ new Vue({
|
||||
this.$store.commit('d2adminLoginSuccessLoad')
|
||||
// 初始化全屏监听
|
||||
this.fullscreenListenerInit()
|
||||
window.onerror = function (message, url, line, column, error) {
|
||||
console.log('onerror')
|
||||
console.log(message, url, line, column, error)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 监听路由 控制侧边栏显示
|
||||
|
||||
@@ -45,6 +45,14 @@ export default {
|
||||
{ path: `${pre}db/public`, title: '公用数据', icon: 'users' }
|
||||
]
|
||||
},
|
||||
{
|
||||
path: `${pre}log`,
|
||||
title: '日志',
|
||||
icon: 'bullseye',
|
||||
children: [
|
||||
{ path: `${pre}log/error`, title: '错误捕捉', icon: 'bug' }
|
||||
]
|
||||
},
|
||||
{ path: `${pre}env`, title: '环境信息', icon: 'exclamation-circle' }
|
||||
])('/demo/playground/')
|
||||
}
|
||||
|
||||
17
src/pages/demo/playground/log/error/index.vue
Normal file
17
src/pages/demo/playground/log/error/index.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<d2-container>
|
||||
<template slot="header">错误信息</template>
|
||||
<p class="d2-mt-0">请打开浏览器控制台,然后点击下面的按钮</p>
|
||||
<el-button type="danger" @click="handleNewError">触发一个错误</el-button>
|
||||
</d2-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
methods: {
|
||||
handleNewError () {
|
||||
console.log(a)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
21
src/plugin/error/index.js
Normal file
21
src/plugin/error/index.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import store from '@/store'
|
||||
import util from '@/libs/util'
|
||||
|
||||
export default {
|
||||
install (Vue, options) {
|
||||
Vue.config.errorHandler = function (err, vm, info) {
|
||||
Vue.nextTick(() => {
|
||||
store.commit('d2adminLogAdd', {
|
||||
err, vm, info
|
||||
})
|
||||
util.log.capsule('D2Admin', 'ErrorHandler', 'danger')
|
||||
util.log.error('>>>>> err')
|
||||
console.log(err)
|
||||
util.log.error('>>>>> vm')
|
||||
console.log(vm)
|
||||
util.log.error('>>>>> info')
|
||||
console.log(info)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
0fa9b5a2bdc57841e4f19831dc3e2a913399a280
|
||||
51f901f963b0802a69efe93ef5d40b60bcd1a2fd
|
||||
@@ -1 +1 @@
|
||||
f6b747b5dbf484da5c8b5876c9d54212c90c3550
|
||||
1325e2be4603dde2cf094397e4fca98a542e4ba5
|
||||
Reference in New Issue
Block a user