style: 优化移动复制重命名

This commit is contained in:
jmal 2023-04-14 00:19:24 +08:00
parent 9698aa2bc0
commit 8665996a80
3 changed files with 25 additions and 21 deletions

View File

@ -346,7 +346,7 @@
size="small" size="small"
@focus="renameInputFocus($event.currentTarget, item.suffix)" @focus="renameInputFocus($event.currentTarget, item.suffix)"
@blur="setInputBlur()" @blur="setInputBlur()"
@keyup.enter.native="rowRename(renameFileName, item)"> @keyup.enter.prevent.native="rowRename(renameFileName, item)">
</el-input> </el-input>
<div v-else> <div v-else>
<div class="grid-item-text"><span>{{ gridFilename(item) }}</span></div> <div class="grid-item-text"><span>{{ gridFilename(item) }}</span></div>
@ -2464,16 +2464,14 @@ export default {
username: this.$store.state.user.name, username: this.$store.state.user.name,
id: row.id id: row.id
}).then(res => { }).then(res => {
if (res.data) { this.renameLoading = false
this.renameLoading = false row.name = newFileName
row.name = newFileName row.suffix = newFileName.replace(/.+\./, "")
row.suffix = newFileName.replace(/.+\./, "") this.fileList[row.index] = row
this.fileList[row.index] = row this.editingIndex = -1
this.editingIndex = -1 this.$message.success("重命名中...")
}
}).then(() => { }).then(() => {
this.$refs.fileListTable.clearSelection() this.$refs.fileListTable.clearSelection()
this.$message.success("重命名成功")
}).catch(() => { }).catch(() => {
this.renameLoading = false this.renameLoading = false
this.editingIndex = -1 this.editingIndex = -1

View File

@ -587,13 +587,11 @@ export default {
newFileName: encodeURI(newFileName), newFileName: encodeURI(newFileName),
username: this.$store.state.user.name, username: this.$store.state.user.name,
id: row.id id: row.id
}).then(res => { }).then(() => {
if (res.data) { this.renameLoading = false
this.renameLoading = false row.name = newFileName
row.name = newFileName this.fileList[row.index] = row
this.fileList[row.index] = row this.editingIndex = -1
this.editingIndex = -1
}
}) })
} else { } else {
this.editingIndex = -1 this.editingIndex = -1

View File

@ -38,18 +38,26 @@ function connect(username,token){
Bus.$emit('msg/synced', msg) Bus.$emit('msg/synced', msg)
} else { } else {
Bus.$emit('msg/file/change', msg) Bus.$emit('msg/file/change', msg)
if ('copyFile' === url) { if ('operationFile' === url) {
let doc = JSON.parse(msg.body) let doc = JSON.parse(msg.body)
if (doc.code === 0) { if (doc.code === 0) {
Bus.$notify({ Bus.$notify({
title: '操作成功', title: `${doc.operation}成功`,
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
message: `<div><p>form:</p><span>${doc.from}</span></div><div><p>to:</p><span>${doc.to}</span></div>`, message: `
type: 'success' <div>
<p>form:</p>
<pre style="word-break: break-all;white-space: pre-wrap;">${doc.from}</pre>
</div>
<div>
<p>to:</p>
<pre style="word-break: break-all;white-space: pre-wrap;">${doc.to}</pre>
</div>`,
type: 'success',
}); });
} else { } else {
Bus.$notify({ Bus.$notify({
title: '操作失败', title: `${doc.operation}失败`,
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
message: `<span>${doc.msg}</span>`, message: `<span>${doc.msg}</span>`,
type: 'error' type: 'error'