Bläddra i källkod

workspace 修正之前点击文件版本号的操作; 文件右键添加创建历史版本;setShareFile接口增加参数;init websocket 增加accountId参数

dev
zhengzhou 4 år sedan
förälder
incheckning
9c6c61e3b6
5 ändrade filer med 35 tillägg och 60 borttagningar
  1. +2
    -2
      src/services/system.js
  2. +23
    -49
      src/views/main_web/workspace/components/file-explorer/index.vue
  3. +7
    -6
      src/views/main_web/workspace/components/file-item.vue
  4. +2
    -2
      src/views/main_web/workspace/service.js
  5. +1
    -1
      src/views/main_web/workspace/workspace.new.vue

+ 2
- 2
src/services/system.js Visa fil

@@ -174,8 +174,8 @@ const system = {
/**
* 通知系统进入当前的工作空间
*/
entryProject: safeCall(async (projName, accountName, fileChangeHandler, initHandler, socketInsHandler, errorHandler = identity) => {
const response = await requestBySocket(io('init'), [accountName, projName].join('|'));
entryProject: safeCall(async (projName, accountId, accountName, fileChangeHandler, initHandler, socketInsHandler, errorHandler = identity) => {
const response = await requestBySocket(io('init'), [accountName, accountId, projName].join('|'));
initHandler(response.data);
const watchSocket = io('subscriptionFileChange');
watchSocket.on('open', () => {


+ 23
- 49
src/views/main_web/workspace/components/file-explorer/index.vue Visa fil

@@ -13,7 +13,6 @@
:key="file.id"
:file="file"
:clientDownLoad="clientDownLoad"
:showFileMilestone="showFileMilestone"
:nodeFolder="currentNodeFolder"
:currentFolder="currentFolder"
@commitFile="showCommitWindow"
@@ -42,7 +41,6 @@
:file="file"
:tempRightFileId="tempRightFileId"
:clientDownLoad="clientDownLoad"
:showFileMilestone="showFileMilestone"
:nodeFolder="currentNodeFolder"
:currentFolder="currentFolder"
@dblclickFile="fileClick(file)"
@@ -108,7 +106,6 @@
:key="file.id"
:file="file"
:clientDownLoad="clientDownLoad"
:showFileMilestone="showFileMilestone"
:nodeFolder="currentNodeFolder"
:currentFolder="currentFolder"
:localFileHashMap="localFileHashMap"
@@ -122,7 +119,6 @@
:key="file.id"
:file="file"
:clientDownLoad="clientDownLoad"
:showFileMilestone="showFileMilestone"
:nodeFolder="currentNodeFolder"
:currentFolder="currentFolder"
@commitFile="showCommitWindow"
@@ -230,7 +226,6 @@
:file="file"
:tempRightFileId="tempRightFileId"
:clientDownLoad="clientDownLoad"
:showFileMilestone="showFileMilestone"
:nodeFolder="currentNodeFolder"
:currentFolder="currentFolder"
@dblclickFile="fileClick(file)"
@@ -633,7 +628,7 @@ export default {
this.fetchFolderFiles();

system.entryProject(
sessionStorage.projName, sessionStorage.accountName,
sessionStorage.projName, sessionStorage.accountId, sessionStorage.accountName,
this.onSocketFileChangeDetected.bind(this),
(localWorkspacePrefix) => { this.localWorkspacePrefix = localWorkspacePrefix;},
socketIns => { this.socketIns = socketIns; },
@@ -1792,27 +1787,28 @@ export default {

const isConflict = (fileLocalIpfsCid && status == "1" && myLocalIpfsCid !== ipfsCid);
console.log(isConflict);
if(isConflict) {
// const text = `${file.modifyName}编辑过您的文件,是继续我上次编辑还是打开${file.modifyName}的编辑?`;
const text = `${file.modifyName}更新了文件,请选择协同版本。`;
this.$confirm(text, "", {
confirmButtonText: "继续提交我的版本",
cancelButtonText: '保留对方版本',
showClose: true,
type: "warning",
customClass: 'conflit-message-box',
}).then(() => {
//点击继续我的编辑 -> 继续完成本次版本的提交 相当于忽略别人编辑过的版本
this.commitFile(false);
})
.catch((err)=> {
//点击了打开XXX的编辑 -> 完成本次版本提交
//但是本次版本提交updateFile(服务端)传递的 historyCurrentIpfsCid 不是websocket接口返回的 而是文件的ipfscid(别人编辑的版本)
this.commitFile(true);
});
} else {
this.commitFile(false);
}
// if(isConflict) {
// // const text = `${file.modifyName}编辑过您的文件,是继续我上次编辑还是打开${file.modifyName}的编辑?`;
// const text = `${file.modifyName}更新了文件,请选择协同版本。`;
// this.$confirm(text, "", {
// confirmButtonText: "继续提交我的版本",
// cancelButtonText: '保留对方版本',
// showClose: true,
// type: "warning",
// customClass: 'conflit-message-box',
// }).then(() => {
// //点击继续我的编辑 -> 继续完成本次版本的提交 相当于忽略别人编辑过的版本
// this.commitFile(false);
// })
// .catch((err)=> {
// //点击了打开XXX的编辑 -> 完成本次版本提交
// //但是本次版本提交updateFile(服务端)传递的 historyCurrentIpfsCid 不是websocket接口返回的 而是文件的ipfscid(别人编辑的版本)
// this.commitFile(true);
// });
// } else {
// this.commitFile(false);
// }
this.commitFile(isConflict);
this.isShowCommitJudgeWindow = false;
this.commitFileControlIpfsCid = '';
this.comitJudgeCom = null;
@@ -1971,28 +1967,6 @@ export default {
system.openFile(filePath);
// this.fetchFolderFiles();
},
/**
* 设置历史文件界面
*/
showFileMilestone: function (file) {
// todo 待修正,思考是否可以放到file组件中去
debugger;
if (file.status == 1 && file.modifyUserID != sessionStorage.userId) {
this.$notify({
message: "其他人编辑中,不能设置历史文件",
type: "warning",
offset: 100,
duration: 5000,
});
return;
}
this.currentMilestone=file;
this.dialogFileHistory = true;
//返回与该文件同名的所有文件并把自己过滤掉
this.listMilestones=this.getMilstoneFile(file);
console.log(this.listMilestones)
this.currentArchID = file.archID;
},
/**
* 右键菜单
*/


+ 7
- 6
src/views/main_web/workspace/components/file-item.vue Visa fil

@@ -144,6 +144,7 @@
<li v-else-if="!isClient && !(oneOf(file.extension,filePreviewList))" class="function-disabled" title="暂时不支持此类文件的预览">在线预览</li>
<!-- 查看历史版本 -->
<li v-if="isClient && isInWorkFolder && fileInLocal" @click.stop="checkMilestoneClick">查看历史版本</li>
<li v-if="isClient && isInWorkFolder && fileInLocal" @click.stop="commitFile">创建历史版本</li>
</ul>
</div>

@@ -184,7 +185,7 @@
<span
v-if="file.version != 1"
class="visontext"
@click="showFileMilestone(file)"
@click="checkMilestoneClick"
>
版本
{{ file.version }}
@@ -243,7 +244,6 @@ export default {
type: Object,
default: () => ({}),
},
showFileMilestone: Function,
localFileHashMap: {
type: Object,
default: () => ({}),
@@ -389,9 +389,10 @@ export default {
// }
},
methods: {
// commitFile() {
// this.$emit('commitFile', this.file, this.fileImgClass);
// },
commitFile() {
this.isFileRightMenuVisible = false;
this.$emit('commitFile', this.file, this.fileImgClass);
},
toggleFileShareStatus() {
this.$emit('change-file-status', this.file);
},
@@ -461,7 +462,7 @@ export default {
this.isFileRightMenuVisible = false;
},
openfileBtnClick() {
this.isFileRightMenuVisible = false;
this.isFileRightMenuVisible = false;
this.$emit('openfileBtnClick', this.file);
},
copyFileBtnClick() {


+ 2
- 2
src/views/main_web/workspace/service.js Visa fil

@@ -195,8 +195,8 @@ export async function queryProjArchiveHistory(archId) {
/**
* 设为协同版本
*/
export async function setShareFile(Id,IpfsCid,ModifyUserId) {
const res = await fetchApi('file/setShareFile', {Id,IpfsCid,ModifyUserId});
export async function setShareFile(Id,IpfsCid,ModifyUserId, Version) {
const res = await fetchApi('file/setShareFile', {Id,IpfsCid,ModifyUserId, Version});
return res;
}



+ 1
- 1
src/views/main_web/workspace/workspace.new.vue Visa fil

@@ -721,7 +721,7 @@ export default {
this.getNestNode();

system.entryProject(
sessionStorage.projName, sessionStorage.accountName,
sessionStorage.projName, sessionStorage.accountId, sessionStorage.accountName,
this.onSocketFileChangeDetected.bind(this),
(localWorkspacePrefix) => { this.localWorkspacePrefix = localWorkspacePrefix;},
socketIns => { this.socketIns = socketIns; },


Laddar…
Avbryt
Spara