日志区分颜色

Former-commit-id: aeb2b84bf8da5275a1e8eafc9079954dd41bf80c [formerly aeb2b84bf8da5275a1e8eafc9079954dd41bf80c [formerly aeb2b84bf8da5275a1e8eafc9079954dd41bf80c [formerly aeb2b84bf8da5275a1e8eafc9079954dd41bf80c [formerly 350c8c6514e327fbab5060978b4b7523a098f6d0 [formerly 17c340c2f594b545b945d52cc1a8647348ae3389]]]]]
Former-commit-id: 52db1bdfa3c024dfe218c09e9cf75747b6abb038
Former-commit-id: b2f85a553a4e78de0daa8c18c3d332e5b92510b1
Former-commit-id: ecd4f39b10208f44d030bfaba635e21215053ebc [formerly e68563d7da177cf374736e7f0b8170f0e407a9f4]
Former-commit-id: 2f8af3f79a52372c93e4b27d1f034d214edcd64d
Former-commit-id: 960bd7e3d8cfb67e152c07312ff68652114d480b
Former-commit-id: 9a716fc01315ad5e1064d9c64b671cdc36301721
Former-commit-id: 02d7d4a0e3aab9bfc0318e5dfbe355f306d1f9c3
Former-commit-id: 0c0c46088a4e916e3cd9c1099594b3e1a15bce46
This commit is contained in:
liyang
2019-03-21 22:51:22 +08:00
parent 20c30520f0
commit 780c5071ed
3 changed files with 16 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ export default {
// store 追加 log
store.dispatch('d2admin/log/push', {
message: `${info}: ${error.message}`,
type: 'error',
type: 'danger',
meta: {
error,
instance

View File

@@ -8,7 +8,7 @@ export default {
// 错误日志
// + 日志条目的属性
// - message 必须 日志信息
// - type 非必须 类型 success | warning | info | error
// - type 非必须 类型 success | warning | info(默认) | error
// - time 必须 日志记录时间
// - meta 非必须 其它携带信息
log: []
@@ -36,7 +36,7 @@ export default {
* @param {String} param type {String} 类型
* @param {Object} param meta {Object} 附带的信息
*/
push ({ rootState, commit }, { message, type, meta }) {
push ({ rootState, commit }, { message, type = 'info', meta }) {
commit('push', {
message,
type,

View File

@@ -16,7 +16,7 @@
v-for="(logItem, logIndex) in log"
:key="logIndex">
<span class="log-time">{{logItem.time}}</span>
<span class="log-message">{{logItem.message}}</span>
<span class="log-message" :class="`log-message--${logItem.type}`">{{logItem.message}}</span>
</p>
</section>
</d2-container>
@@ -79,6 +79,18 @@ export default {
}
.log-message {
color: $color-text-normal;
&.log-message--success {
color: $color-success;
}
&.log-message--warning {
color: $color-warning;
}
&.log-message--info {
color: $color-info;
}
&.log-message--danger {
color: $color-danger;
}
}
}
}