diff --git a/electron/build.js b/electron/build.js index 3d80b636..e4df0609 100644 --- a/electron/build.js +++ b/electron/build.js @@ -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(``, `${data.name}`); + indexString = indexString.replace(/(.*?)<\/title>/g, `<title>${data.name}`); fs.writeFileSync(indexFile, indexString, 'utf8'); // package.json Backup fse.copySync(packageFile, packageBakFile) diff --git a/resources/assets/js/pages/manage/file.vue b/resources/assets/js/pages/manage/file.vue index db7dcc8a..bfb298ed 100644 --- a/resources/assets/js/pages/manage/file.vue +++ b/resources/assets/js/pages/manage/file.vue @@ -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({ diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 9ac183d1..ee1de82d 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -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); diff --git a/resources/assets/js/store/state.js b/resources/assets/js/store/state.js index fd3ad9c4..b199af2b 100644 --- a/resources/assets/js/store/state.js +++ b/resources/assets/js/store/state.js @@ -19,6 +19,7 @@ const stateData = { // Dialog cacheDialogs: $A.getStorageArray("cacheDialogs"), + cacheUnreads: {}, // Project cacheProjects: $A.getStorageArray("cacheProjects"), diff --git a/resources/assets/sass/pages/components/project-dialog.scss b/resources/assets/sass/pages/components/project-dialog.scss index 057ce964..c9975be7 100644 --- a/resources/assets/sass/pages/components/project-dialog.scss +++ b/resources/assets/sass/pages/components/project-dialog.scss @@ -35,6 +35,11 @@ align-items: center; margin-top: 14px; overflow: auto; + + &::-webkit-scrollbar { + display: none; + } + > li { position: relative; list-style: none;