fix: 处理回滚后异常代码

This commit is contained in:
韦荣超 2022-03-01 15:47:36 +08:00
parent bc05781edd
commit 0a04d2ee83
4 changed files with 27 additions and 207 deletions

View File

@ -1,8 +1,9 @@
<template> <template>
<div id="calendar" ref="tuiCalendar" class="calendar-wrapper"></div> <div ref="tuiCalendar" className="calendar-wrapper"></div>
</template> </template>
<script> <script>
import Calendar from 'tui-calendar-hi'; import Calendar from 'tui-calendar-hi';
export default { export default {
name: 'Calendar', name: 'Calendar',
props: { props: {
@ -118,21 +119,21 @@ export default {
}, },
theme: { theme: {
handler(newValue) { handler(newValue) {
this.calendarInstance.setTheme(this.cloneData(newValue)); this.calendarInstance.setTheme($A.cloneJSON(newValue));
}, },
deep: true deep: true
}, },
week: { week: {
handler(newValue) { handler(newValue) {
const silent = this.view !== 'week' && this.view !== 'day'; const silent = this.view !== 'week' && this.view !== 'day';
this.calendarInstance.setOptions({week: this.cloneData(newValue)}, silent); this.calendarInstance.setOptions({week: $A.cloneJSON(newValue)}, silent);
}, },
deep: true deep: true
}, },
month: { month: {
handler(newValue) { handler(newValue) {
const silent = this.view !== 'month'; const silent = this.view !== 'month';
this.calendarInstance.setOptions({month: this.cloneData(newValue)}, silent); this.calendarInstance.setOptions({month: $A.cloneJSON(newValue)}, silent);
}, },
deep: true deep: true
}, },
@ -150,14 +151,6 @@ export default {
} }
}, },
mounted() { mounted() {
this.init();
},
beforeDestroy() {
this.calendarInstance.off();
this.calendarInstance.destroy();
},
methods: {
init(){
this.calendarInstance = new Calendar(this.$refs.tuiCalendar, { this.calendarInstance = new Calendar(this.$refs.tuiCalendar, {
defaultView: this.view, defaultView: this.view,
taskView: this.taskView, taskView: this.taskView,
@ -173,14 +166,16 @@ export default {
disableDblClick: this.disableDblClick, disableDblClick: this.disableDblClick,
disableClick: this.disableClick, disableClick: this.disableClick,
isReadOnly: this.isReadOnly, isReadOnly: this.isReadOnly,
usageStatistics: this.usageStatistics, usageStatistics: this.usageStatistics
}); });
this.addEventListeners(); this.addEventListeners();
this.reflectSchedules(); this.reflectSchedules();
}, },
cloneData(data) { beforeDestroy() {
return JSON.parse(JSON.stringify(data)); this.calendarInstance.off();
this.calendarInstance.destroy();
}, },
methods: {
addEventListeners() { addEventListeners() {
for (const eventName of Object.keys(this.$listeners)) { for (const eventName of Object.keys(this.$listeners)) {
this.calendarInstance.on(eventName, (...args) => this.$emit(eventName, ...args)); this.calendarInstance.on(eventName, (...args) => this.$emit(eventName, ...args));

View File

@ -1,37 +0,0 @@
const skinOptionsList = [
{
lable: "默认",
key: "white",
},
{
lable: "暗黑主题",
key: "black",
},
];
const calendarColorList={
white:
{
'common.border': '1px solid #f4f5f5',
'common.holiday.color': '#333',
'common.saturday.color': '#333',
'common.dayname.color': '#333',
'common.backgroundColor':'#ffffff',
},
black:
{
'common.border': '1px solid #ffffff',
'common.holiday.color': '#ffffff',
'common.saturday.color': '#ffffff',
'common.dayname.color': '#ffffff',
'common.backgroundColor':'#171717',
'common.creationGuide.color': '#ffffff',
'common.creationGuide.color': '#ffffff',
'common.today.color': '#ffffff',
},
}
export { skinOptionsList,calendarColorList };

View File

@ -1,9 +1,4 @@
export default { export default {
/**
* 修改当前皮肤类型
*/
setSkinType(state,val){
state.skinType=val
}
} }

View File

@ -1,133 +0,0 @@
//暗黑皮肤
.black {
background-color: #171717;
> .manage-box-menu {
background-color: #202020;
> ul {
> li {
&.menu-project {
>ul{
>li{
&.active {
.project-h1 {
background-color: #b4b3b3;
}
}
}
}
}
color: #ffffff;
&.active {
background-color: #b4b3b3 !important;
}
}
}
.title {
color: #ffffff !important;
}
.manage-box-title {
background-color: #b4b3b3 !important;
color: #ffffff;
}
}
.manage-box-main {
.messenger-select:after {
background-color: #ffffff;
}
.dashboard-wrapper {
color: #ffffff;
}
.dashboard-hello {
color: #ffffff;
}
.dashboard-desc {
color: #ffffff;
}
.dashboard-list {
li {
background-color: #202020;
}
}
.calendar-title {
h1 {
color: #ffffff !important;
}
}
}
.messenger-wrapper {
color: #ffffff;
.dialog {
.active {
background-color: #979595 !important;
}
}
.dialog-box {
span {
color: #ffffff !important;
}
.dialog-text {
color: #ffffff !important;
}
}
.dialog-wrapper {
background-color: #171717;
}
.messenger-nav > p {
color: #ffffff !important;
}
}
.file-wrapper {
.file-nav {
h1 {
color: #ffffff !important;
}
}
.file-navigator {
> ul {
> li {
color: #ffffff !important;
}
}
}
.file-list {
> ul {
> li {
.file-name {
color: #ffffff;
}
}
}
}
}
.page-project {
.project-list {
background-color: #171717;
color: #ffffff;
.project-title {
h1 {
color: #ffffff;
}
}
.project-subtitle {
color: #ffffff;
}
.column-head {
background-color: #202020;
}
.add-column {
background-color: #202020;
color: #ffffff;
}
.task-item {
background-color: #202020 !important;
color: #ffffff !important;
}
.add-placeholder {
color: #ffffff;
}
}
}
}