导出时添加用户名

This commit is contained in:
fofolee 2022-04-13 21:23:46 +08:00
parent ec6e8bbabf
commit b4aa6f9837
2 changed files with 10 additions and 5 deletions

View File

@ -310,7 +310,7 @@ export default {
toggleCommandActivated() { toggleCommandActivated() {
let event = { let event = {
data: this.commandInfo.features.code, data: this.commandInfo.features.code,
type:"toggle" type: "toggle",
}; };
event.type = this.isCommandActivated ? "disable" : "enable"; event.type = this.isCommandActivated ? "disable" : "enable";
this.$emit("commandChanged", event); this.$emit("commandChanged", event);
@ -327,16 +327,21 @@ export default {
}); });
}); });
}, },
getAuthedCmd() {
let command = _.cloneDeep(this.commandInfo);
if (!command.authorName) command.authorName = utools.getUser().nickname;
return command;
},
// //
exportCommandRaw() { exportCommandRaw() {
utools.copyText(JSON.stringify(this.commandInfo, null, 4)) && utools.copyText(JSON.stringify(this.getAuthedCmd(), null, 4)) &&
quickcommand.showMessageBox("已复制到剪贴板"); quickcommand.showMessageBox("已复制到剪贴板");
}, },
// //
exportCommandFile() { exportCommandFile() {
window.saveFile(JSON.stringify(this.commandInfo), { window.saveFile(JSON.stringify(this.getAuthedCmd()), {
title: "选择保存位置", title: "选择保存位置",
defaultPath: `${this.commandInfo.features.explain}.json`, defaultPath: `${this.getAuthedCmd().features.explain}.json`,
filters: [{ name: "json", extensions: ["json"] }], filters: [{ name: "json", extensions: ["json"] }],
}); });
}, },

View File

@ -18,7 +18,7 @@
:name="tag" :name="tag"
:content-class=" :content-class="
tag === '搜索结果' || activatedQuickPanels.includes(tag) tag === '搜索结果' || activatedQuickPanels.includes(tag)
? 'text-indigo-10 text-weight-bolder' ? 'text-blue-7 text-weight-bolder'
: '' : ''
" "
v-show="!(tag === '搜索结果' && commandSearchKeyword?.length < 2)" v-show="!(tag === '搜索结果' && commandSearchKeyword?.length < 2)"