Selaa lähdekoodia

文件右键菜单位置修复

master
kim131 4 vuotta sitten
vanhempi
commit
ee73e68a08
2 muutettua tiedostoa jossa 30 lisäystä ja 8 poistoa
  1. +21
    -7
      src/views/main_web/workspace/components/file-item.vue
  2. +9
    -1
      src/views/main_web/workspace/workspace.new.vue

+ 21
- 7
src/views/main_web/workspace/components/file-item.vue Näytä tiedosto

@@ -1,12 +1,12 @@
<template> <template>
<div> <div>
<el-tooltip
<el-tooltip
:content="file.strToolTip" :content="file.strToolTip"
:disabled="!file.strToolTip" :disabled="!file.strToolTip"
placement="right" placement="right"
effect="light" effect="light"
> >
<div class="yiyun_wenjian_list">
<div class="yiyun_wenjian_list" @contextmenu.prevent.stop="fileRightBtnClick">
<div> <div>
<!-- 非图片文件图标 --> <!-- 非图片文件图标 -->
<div <div
@@ -15,14 +15,12 @@
:class="`${file.extension}-mid ${ :class="`${file.extension}-mid ${
fileIsLoading || (isInWorkFolder && otherUserIsWorking) || showDownloadMask ? 'toumin' : '' fileIsLoading || (isInWorkFolder && otherUserIsWorking) || showDownloadMask ? 'toumin' : ''
}`" }`"
@contextmenu.prevent.stop="fileRightBtnClick"
/> />
<!-- 图片文件图标 --> <!-- 图片文件图标 -->
<div <div
v-else v-else
class="defultImage-mid img_bg-mid" class="defultImage-mid img_bg-mid"
:class=" fileIsLoading || (isInWorkFolder && otherUserIsWorking) || showDownloadMask ? 'toumin' : ''" :class=" fileIsLoading || (isInWorkFolder && otherUserIsWorking) || showDownloadMask ? 'toumin' : ''"
@contextmenu.prevent.stop="fileRightBtnClick"
> >
<div class="file_Im gbox-mid"> <div class="file_Im gbox-mid">
<img v-lazy="file.alias" alt class="file_Img" /> <img v-lazy="file.alias" alt class="file_Img" />
@@ -41,7 +39,6 @@
<!-- 如果不在工作中 且上一次的修改者不是自己说明文件已经被更新 本地需要下载 --> <!-- 如果不在工作中 且上一次的修改者不是自己说明文件已经被更新 本地需要下载 -->
<!-- 待下载 状态蒙板 --> <!-- 待下载 状态蒙板 -->
<div <div
@contextmenu.prevent.stop="fileRightBtnClick($event), rightShowMenu($event, file, 1)"
class="downloadIcon" class="downloadIcon"
@click="clientDownLoad(file, 1)" @click="clientDownLoad(file, 1)"
v-if="showDownloadMask" v-if="showDownloadMask"
@@ -63,7 +60,6 @@
</div> </div>
<!-- 上传中 状态蒙板 todo: 调整样式--> <!-- 上传中 状态蒙板 todo: 调整样式-->
<div <div
@contextmenu.prevent.stop="fileRightBtnClick($event), rightShowMenu($event, file, 1)"
class="downloadIcon" class="downloadIcon"
v-if="loadingState.type === UPLOADING" v-if="loadingState.type === UPLOADING"
> >
@@ -231,8 +227,16 @@ export default {
loadingState: { loadingState: {
type: Object, type: Object,
default: () => ({}), default: () => ({}),
},
tempRightFileId: {
type: String,
default: ''
} }
}, },
mounted() {
this.downLoadIconHeight = document.querySelector('.downloadIcon').offsetHeight;
this.domFileName = document.querySelector('.yiyunwenjian_name');
},
data() { data() {
return { return {
isClient: system.isClient, isClient: system.isClient,
@@ -244,6 +248,8 @@ export default {
isFileRightMenuVisible: false,//控制文件右键菜单显示与隐藏 isFileRightMenuVisible: false,//控制文件右键菜单显示与隐藏
fileRightMenuLeft: 0,//文件右键菜单位置 fileRightMenuLeft: 0,//文件右键菜单位置
fileRightMenuTop: 0, fileRightMenuTop: 0,
downLoadIconHeight: 0,
domFileName: null,
}; };
}, },
computed: { computed: {
@@ -300,7 +306,12 @@ export default {
fileRightBtnClick(e) { fileRightBtnClick(e) {
this.isFileRightMenuVisible = true; this.isFileRightMenuVisible = true;
this.fileRightMenuLeft = e.offsetX; this.fileRightMenuLeft = e.offsetX;
this.fileRightMenuTop = e.offsetY;
if(e.target === this.domFileName) {
this.fileRightMenuTop = e.offsetY + this.downLoadIconHeight;
} else {
this.fileRightMenuTop = e.offsetY
}
this.$emit('oneFileRightBtnClick', this.file.id);
}, },
closeFileRightMenu() { closeFileRightMenu() {
this.isFileRightMenuVisible = false; this.isFileRightMenuVisible = false;
@@ -322,6 +333,9 @@ export default {
document.body.removeEventListener("click", this.closeFileRightMenu); document.body.removeEventListener("click", this.closeFileRightMenu);
} }
}, },
tempRightFileId(val) {
this.isFileRightMenuVisible = (val === this.file.id);
}
} }
}; };
</script> </script>


+ 9
- 1
src/views/main_web/workspace/workspace.new.vue Näytä tiedosto

@@ -100,6 +100,8 @@
@dblclick.native="fileClick(file)" @dblclick.native="fileClick(file)"
@openfileBtnClick="fileClick(file)" @openfileBtnClick="fileClick(file)"
@copyFileBtnClick="copyWorkFileBtnClick(file)" @copyFileBtnClick="copyWorkFileBtnClick(file)"
@oneFileRightBtnClick="oneFileRightBtnClick"
:tempRightFileId="tempRightFileId"
:localFileHashMap="localFileHashMap" :localFileHashMap="localFileHashMap"
:loadingState="localFileLoadStateMap[file.id]" :loadingState="localFileLoadStateMap[file.id]"
/> />
@@ -369,6 +371,8 @@ export default {
* } * }
*/ */
localFileLoadStateMap: {}, localFileLoadStateMap: {},

tempRightFileId: "", // 存储点击了右键菜单的id
}; };
}, },
mounted: function () { mounted: function () {
@@ -405,6 +409,10 @@ export default {
} }
}, },
methods: { methods: {
// 接收到了一个文件的右键菜单点击事件
oneFileRightBtnClick(id) {
this.tempRightFileId = id;
},
removeMilestone(filesList){ removeMilestone(filesList){
return filesList.filter(file=>{ return filesList.filter(file=>{
return file.milestone != 2; return file.milestone != 2;
@@ -1068,7 +1076,7 @@ export default {
copyFile.modifyTime = new Date(); copyFile.modifyTime = new Date();
copyFile.createUserId = sessionStorage.userId; copyFile.createUserId = sessionStorage.userId;
copyFile.createTime = new Date(); copyFile.createTime = new Date();
console.log(copyFile);
// console.log(copyFile);


const addFileRes = await services.addFile(copyFile); const addFileRes = await services.addFile(copyFile);
this.fetchFolderFiles(); this.fetchFolderFiles();


Ladataan…
Peruuta
Tallenna