fix: 客户端偶尔出现无法打开文件的情况
This commit is contained in:
parent
b28be29dc8
commit
e89ff02b59
@ -33,7 +33,7 @@ function startBuild(data, publish) {
|
||||
// index.html
|
||||
let indexFile = path.resolve(electronDir, "index.html");
|
||||
let indexString = fs.readFileSync(indexFile, 'utf8');
|
||||
indexString = indexString.replace(`<title></title>`, `<title>${data.name}</title>`);
|
||||
indexString = indexString.replace(/<title>(.*?)<\/title>/g, `<title>${data.name}</title>`);
|
||||
fs.writeFileSync(indexFile, indexString, 'utf8');
|
||||
// package.json Backup
|
||||
fse.copySync(packageFile, packageBakFile)
|
||||
|
@ -601,7 +601,7 @@ export default {
|
||||
const file = this.files.find(({id}) => id == row.id);
|
||||
if (file) {
|
||||
setTimeout(() => {
|
||||
this.$set(file, '_edit', b);
|
||||
this.setEdit(file.id, b)
|
||||
}, 100);
|
||||
}
|
||||
},
|
||||
@ -849,7 +849,7 @@ export default {
|
||||
|
||||
case 'rename':
|
||||
this.$set(item, 'newname', item.name);
|
||||
this.$set(item, '_edit', true);
|
||||
this.setEdit(item.id, true)
|
||||
this.autoBlur(item.id)
|
||||
break;
|
||||
|
||||
@ -1032,18 +1032,18 @@ export default {
|
||||
if (isCreate) {
|
||||
this.$store.dispatch("forgetFile", item.id);
|
||||
} else {
|
||||
this.$set(item, '_edit', false);
|
||||
this.setEdit(item.id, false)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (item.newname == item.name) {
|
||||
this.$set(item, '_edit', false);
|
||||
this.setEdit(item.id, false)
|
||||
return;
|
||||
}
|
||||
if (item._load) {
|
||||
return;
|
||||
}
|
||||
this.$set(item, '_load', true);
|
||||
this.setLoad(item.id, true)
|
||||
this.$store.dispatch("call", {
|
||||
url: 'file/add',
|
||||
data: {
|
||||
@ -1054,21 +1054,35 @@ export default {
|
||||
},
|
||||
}).then(({data, msg}) => {
|
||||
$A.messageSuccess(msg)
|
||||
this.$set(item, '_load', false);
|
||||
this.$set(item, '_edit', false);
|
||||
this.setLoad(item.id, false)
|
||||
this.setEdit(item.id, false)
|
||||
this.$store.dispatch("saveFile", data);
|
||||
if (isCreate) {
|
||||
this.$store.dispatch("forgetFile", item.id);
|
||||
}
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg)
|
||||
this.$set(item, '_load', false);
|
||||
this.setLoad(item.id, false)
|
||||
if (isCreate) {
|
||||
this.$store.dispatch("forgetFile", item.id);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
setEdit(fileId, is) {
|
||||
let item = this.$store.state.files.find(({id}) => id == fileId)
|
||||
if (item) {
|
||||
this.$set(item, '_edit', is);
|
||||
}
|
||||
},
|
||||
|
||||
setLoad(fileId, is) {
|
||||
let item = this.$store.state.files.find(({id}) => id == fileId)
|
||||
if (item) {
|
||||
this.$set(item, '_load', is);
|
||||
}
|
||||
},
|
||||
|
||||
onSearchFocus() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.searchInput.focus({
|
||||
|
@ -427,11 +427,12 @@ export default {
|
||||
dispatch("saveFile", file);
|
||||
});
|
||||
} else if ($A.isJson(data)) {
|
||||
let base = {_load: false, _edit: false};
|
||||
let index = state.files.findIndex(({id}) => id == data.id);
|
||||
if (index > -1) {
|
||||
state.files.splice(index, 1, Object.assign({}, state.files[index], data));
|
||||
state.files.splice(index, 1, Object.assign(base, state.files[index], data));
|
||||
} else {
|
||||
state.files.push(data)
|
||||
state.files.push(Object.assign(base, data))
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -2100,8 +2101,9 @@ export default {
|
||||
}
|
||||
let dialog = state.cacheDialogs.find(({id}) => id == data.dialog_id);
|
||||
// 更新对话列表
|
||||
if (dialog) {
|
||||
if (dialog && state.cacheUnreads[data.id] === undefined) {
|
||||
// 新增未读数
|
||||
state.cacheUnreads[data.id] = true;
|
||||
dialog.unread++;
|
||||
}
|
||||
Store.set('dialogMsgPush', data);
|
||||
|
@ -19,6 +19,7 @@ const stateData = {
|
||||
|
||||
// Dialog
|
||||
cacheDialogs: $A.getStorageArray("cacheDialogs"),
|
||||
cacheUnreads: {},
|
||||
|
||||
// Project
|
||||
cacheProjects: $A.getStorageArray("cacheProjects"),
|
||||
|
@ -35,6 +35,11 @@
|
||||
align-items: center;
|
||||
margin-top: 14px;
|
||||
overflow: auto;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
> li {
|
||||
position: relative;
|
||||
list-style: none;
|
||||
|
Loading…
x
Reference in New Issue
Block a user