diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index b42e2fc..5f3b8e9 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -346,7 +346,7 @@ size="small" @focus="renameInputFocus($event.currentTarget, item.suffix)" @blur="setInputBlur()" - @keyup.enter.native="rowRename(renameFileName, item)"> + @keyup.enter.prevent.native="rowRename(renameFileName, item)">
{{ gridFilename(item) }}
@@ -2464,16 +2464,14 @@ export default { username: this.$store.state.user.name, id: row.id }).then(res => { - if (res.data) { - this.renameLoading = false - row.name = newFileName - row.suffix = newFileName.replace(/.+\./, "") - this.fileList[row.index] = row - this.editingIndex = -1 - } + this.renameLoading = false + row.name = newFileName + row.suffix = newFileName.replace(/.+\./, "") + this.fileList[row.index] = row + this.editingIndex = -1 + this.$message.success("重命名中...") }).then(() => { this.$refs.fileListTable.clearSelection() - this.$message.success("重命名成功") }).catch(() => { this.renameLoading = false this.editingIndex = -1 diff --git a/src/views/home/mobile/index.vue b/src/views/home/mobile/index.vue index 0be1001..d56f733 100644 --- a/src/views/home/mobile/index.vue +++ b/src/views/home/mobile/index.vue @@ -587,13 +587,11 @@ export default { newFileName: encodeURI(newFileName), username: this.$store.state.user.name, id: row.id - }).then(res => { - if (res.data) { - this.renameLoading = false - row.name = newFileName - this.fileList[row.index] = row - this.editingIndex = -1 - } + }).then(() => { + this.renameLoading = false + row.name = newFileName + this.fileList[row.index] = row + this.editingIndex = -1 }) } else { this.editingIndex = -1 diff --git a/src/websocket/sockJS.js b/src/websocket/sockJS.js index 80a16b8..8c3794b 100644 --- a/src/websocket/sockJS.js +++ b/src/websocket/sockJS.js @@ -38,18 +38,26 @@ function connect(username,token){ Bus.$emit('msg/synced', msg) } else { Bus.$emit('msg/file/change', msg) - if ('copyFile' === url) { + if ('operationFile' === url) { let doc = JSON.parse(msg.body) if (doc.code === 0) { Bus.$notify({ - title: '操作成功', + title: `${doc.operation}成功`, dangerouslyUseHTMLString: true, - message: `

form:

${doc.from}

to:

${doc.to}
`, - type: 'success' + message: ` +
+

form:

+
${doc.from}
+
+
+

to:

+
${doc.to}
+
`, + type: 'success', }); } else { Bus.$notify({ - title: '操作失败', + title: `${doc.operation}失败`, dangerouslyUseHTMLString: true, message: `${doc.msg}`, type: 'error'