2023-09-20 21:33:11 +08:00
|
|
|
<template>
|
|
|
|
<div class="fixed-bottom p-l-5" :class="maxWidth">
|
|
|
|
<el-button @click="handleOpenBlog" class="l p-3" type="text" size="mini" icon="iconfont icon-chuangkoufangda"
|
|
|
|
circle></el-button>
|
2024-07-24 20:02:42 +08:00
|
|
|
<div class="l p-l-10 flex" v-if="newLog">
|
2023-09-20 21:33:11 +08:00
|
|
|
<span class="l m-t-5 m-r-5 logDot" :style="{ background: newLog.color }"></span>
|
|
|
|
<span>{{ newLog.timestamp | parseTime('{h}:{i}:{s}') }}</span>
|
2024-07-24 20:02:42 +08:00
|
|
|
<span class="content m-l-10">{{ newLog.content }}</span>
|
2023-09-20 21:33:11 +08:00
|
|
|
</div>
|
2023-11-09 21:39:50 +08:00
|
|
|
<el-drawer :modal-append-to-body="false" :visible.sync="drawer" direction="btt" size="50%">
|
|
|
|
<template slot="title">
|
|
|
|
<div>
|
|
|
|
<i class="l f-s-18 vm iconfont icon-zengjia m-r-10"></i>
|
|
|
|
<h3>
|
|
|
|
程序日志
|
|
|
|
</h3>
|
|
|
|
</div>
|
|
|
|
</template>
|
2023-09-20 21:33:11 +08:00
|
|
|
<el-timeline :reverse="true" class="p-l-50 p-r-50">
|
|
|
|
<el-timeline-item v-for="(activity, index) in log" :key="index" :icon="activity.icon" :type="activity.type"
|
|
|
|
:color="activity.color" :size="activity.size"
|
|
|
|
:timestamp="activity.timestamp | parseTime('{y}-{m}-{d} {h}:{i}:{s}')">
|
|
|
|
{{ activity.content }}
|
|
|
|
</el-timeline-item>
|
|
|
|
</el-timeline>
|
|
|
|
</el-drawer>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { parseTime } from '@/utils'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'BlogBox',
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
drawer: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
maxWidth () {
|
|
|
|
return this.$store.state.app.isCollapse ? 'min' : 'max'
|
|
|
|
},
|
|
|
|
log () {
|
|
|
|
return this.$store.state.logList
|
|
|
|
},
|
|
|
|
newLog () {
|
|
|
|
return this.$store.state.logList[this.$store.state.logList.length - 1]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleOpenBlog () {
|
|
|
|
this.drawer = true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
created () {
|
|
|
|
},
|
|
|
|
destroyed () {
|
|
|
|
},
|
|
|
|
filters: {
|
|
|
|
parseTime
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.fixed-bottom {
|
|
|
|
position: fixed;
|
|
|
|
bottom: 0;
|
|
|
|
right: 0;
|
|
|
|
z-index: 1002;
|
|
|
|
line-height: 24px;
|
|
|
|
height: 24px;
|
|
|
|
background: #F2F6FC;
|
|
|
|
-webkit-box-shadow: 0 0px 4px rgba(0, 21, 41, 0.3);
|
|
|
|
box-shadow: 0 0px 4px rgba(0, 21, 41, 0.3);
|
|
|
|
font-size: 14px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.max {
|
|
|
|
width: calc(100% - 210px);
|
|
|
|
}
|
|
|
|
|
|
|
|
.min {
|
|
|
|
width: calc(100% - 60px);
|
|
|
|
}
|
|
|
|
|
2024-07-22 03:07:56 +08:00
|
|
|
/* 竖屏模式样式 */
|
|
|
|
@media (orientation: portrait) {
|
|
|
|
.min {
|
|
|
|
width: calc(100% - 0px);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-20 21:33:11 +08:00
|
|
|
.logDot {
|
|
|
|
width: 14px;
|
|
|
|
height: 14px;
|
|
|
|
border-radius: 10px;
|
|
|
|
overflow: hidden;
|
|
|
|
display: block;
|
|
|
|
}
|
2024-07-24 20:02:42 +08:00
|
|
|
|
|
|
|
.timestamp,
|
|
|
|
.content {
|
|
|
|
display: inline-block;
|
|
|
|
/* 确保元素可以应用宽度 */
|
|
|
|
max-width: 60vw;
|
|
|
|
/* 根据需要设置宽度 */
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
2023-09-20 21:33:11 +08:00
|
|
|
</style>
|