优化高度计算

This commit is contained in:
kuaifan 2022-04-22 07:05:20 +08:00
parent 52392e2e0a
commit 0b0e6951e5
5 changed files with 21 additions and 27 deletions

View File

@ -197,6 +197,7 @@ export default {
windowSizeListener() {
this.$store.state.windowWidth = window.innerWidth
this.$store.state.windowHeight = window.innerHeight
this.$store.state.windowMax768 = window.innerWidth <= 768
},

View File

@ -415,7 +415,6 @@ export default {
openMenu: {},
visibleMenu: false,
show768Menu: false,
innerHeight: window.innerHeight,
workReportShow: false,
allUserShow: false,
@ -452,7 +451,6 @@ export default {
this.dialogMsgSubscribe = Store.subscribe('dialogMsgPush', this.addDialogMsg);
//
document.addEventListener('keydown', this.shortcutEvent);
window.addEventListener('resize', this.innerHeightListener);
},
beforeDestroy() {
@ -466,7 +464,6 @@ export default {
}
//
document.removeEventListener('keydown', this.shortcutEvent);
window.removeEventListener('resize', this.innerHeightListener);
},
deactivated() {
@ -493,6 +490,8 @@ export default {
'clientNewVersion',
'cacheTaskBrowse',
'windowHeight',
]),
...mapGetters(['taskData', 'dashboardTask']),
@ -603,9 +602,9 @@ export default {
},
taskStyle() {
const {innerHeight} = this;
const {windowHeight} = this;
return {
maxHeight: (innerHeight - (innerHeight > 900 ? 200 : 70) - 20) + 'px'
maxHeight: (windowHeight - (windowHeight > 900 ? 200 : 70) - 20) + 'px'
}
},
@ -709,10 +708,6 @@ export default {
};
},
innerHeightListener() {
this.innerHeight = window.innerHeight;
},
chackPass() {
if (this.userInfo.changepass === 1) {
this.goForward({name: 'manage-setting-password'});

View File

@ -489,8 +489,6 @@ export default {
nowTime: $A.Time(),
nowInterval: null,
innerHeight: Math.min(1100, window.innerHeight),
msgText: '',
msgFile: [],
navActive: 'dialog',
@ -531,7 +529,6 @@ export default {
this.nowInterval = setInterval(() => {
this.nowTime = $A.Time();
}, 1000);
window.addEventListener('resize', this.innerHeightListener);
//
this.receiveTaskSubscribe = Store.subscribe('receiveTask', () => {
this.receiveShow = true;
@ -540,7 +537,6 @@ export default {
destroyed() {
clearInterval(this.nowInterval);
window.removeEventListener('resize', this.innerHeightListener);
//
if (this.receiveTaskSubscribe) {
this.receiveTaskSubscribe.unsubscribe();
@ -559,7 +555,8 @@ export default {
'taskFiles',
'taskPriority',
'windowMax768'
'windowMax768',
'windowHeight'
]),
projectName() {
@ -619,23 +616,25 @@ export default {
},
dialogStyle() {
const {innerHeight, hasOpenDialog} = this;
if (!innerHeight) {
const {windowHeight, hasOpenDialog} = this;
let height = Math.min(1100, windowHeight)
if (!height) {
return {};
}
if (!hasOpenDialog) {
return {};
}
return {
minHeight: (innerHeight - (innerHeight > 900 ? 200 : 70) - 48) + 'px'
minHeight: (height - (height > 900 ? 200 : 70) - 48) + 'px'
}
},
taskDetailStyle() {
const {modalMode, innerHeight, hasOpenDialog} = this;
const {modalMode, windowHeight, hasOpenDialog} = this;
let height = Math.min(1100, windowHeight)
if (modalMode && hasOpenDialog) {
return {
maxHeight: (innerHeight - (innerHeight > 900 ? 200 : 70) - 30) + 'px'
maxHeight: (height - (height > 900 ? 200 : 70) - 30) + 'px'
}
}
return {}
@ -756,10 +755,6 @@ export default {
},
methods: {
innerHeightListener() {
this.innerHeight = Math.min(1100, window.innerHeight);
},
within24Hours(date) {
return $A.Date(date, true) - this.nowTime < 86400
},

View File

@ -436,7 +436,6 @@ export default {
}
],
tableHeight: 500,
tableMode: $A.getStorageString("fileTableMode"),
columns: [],
@ -505,7 +504,6 @@ export default {
},
mounted() {
this.tableHeight = window.innerHeight - 160;
this.uploadAccept = this.uploadFormat.map(item => {
return '.' + item
}).join(",");
@ -516,7 +514,7 @@ export default {
},
computed: {
...mapState(['userId', 'userToken', 'userIsAdmin', 'userInfo', 'files', 'wsOpenNum']),
...mapState(['userId', 'userToken', 'userIsAdmin', 'userInfo', 'files', 'wsOpenNum', 'windowHeight']),
pid() {
const {folderId} = this.$route.params;
@ -608,6 +606,10 @@ export default {
return ['multiple'];
}
return [];
},
tableHeight() {
return Math.max(300, this.windowHeight - 160)
}
},

View File

@ -2,8 +2,9 @@ const stateData = {
// 是否桌面端
isDesktop: $A.isDesktop(),
// 浏览器宽
// 浏览器宽
windowWidth: window.innerWidth,
windowHeight: window.innerHeight,
// 浏览器宽度≤768返回true
windowMax768: window.innerWidth <= 768,