mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-08 22:51:25 +08:00
导出功能调整
This commit is contained in:
parent
fcc83a0955
commit
8ae8f52212
@ -30,7 +30,7 @@
|
|||||||
运行
|
运行
|
||||||
</q-tooltip></q-btn
|
</q-tooltip></q-btn
|
||||||
>
|
>
|
||||||
<q-btn flat round color="primary" icon="share">
|
<q-btn v-if="canCommandEdit" flat round color="primary" icon="share">
|
||||||
<q-tooltip anchor="top middle" self="center middle">
|
<q-tooltip anchor="top middle" self="center middle">
|
||||||
导出
|
导出
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
@ -51,7 +51,13 @@
|
|||||||
</q-list>
|
</q-list>
|
||||||
</q-menu>
|
</q-menu>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<q-btn flat round color="red" icon="close" @click="removeCommand"
|
<q-btn
|
||||||
|
v-if="canCommandEdit"
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="red"
|
||||||
|
icon="close"
|
||||||
|
@click="removeCommand"
|
||||||
><q-tooltip anchor="top middle" self="center middle">
|
><q-tooltip anchor="top middle" self="center middle">
|
||||||
删除
|
删除
|
||||||
</q-tooltip></q-btn
|
</q-tooltip></q-btn
|
||||||
@ -59,7 +65,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 未启用的命令文字为灰色 -->
|
<!-- 未启用的命令文字为灰色 -->
|
||||||
<q-card v-ripple :style="isCommandActivated ? '' : 'color:grey'">
|
<q-card
|
||||||
|
@click="handleCardClick"
|
||||||
|
v-ripple
|
||||||
|
:style="isCommandActivated ? '' : 'color:grey'"
|
||||||
|
>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<!-- logo -->
|
<!-- logo -->
|
||||||
<div class="row" :class="cardStyleVars.logoPosition">
|
<div class="row" :class="cardStyleVars.logoPosition">
|
||||||
@ -222,6 +232,12 @@ export default {
|
|||||||
if (cmd.type && cmd.type === "window") return false;
|
if (cmd.type && cmd.type === "window") return false;
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
// 默认命令不可删除
|
||||||
|
canCommandEdit() {
|
||||||
|
if (utools.isDev()) return true;
|
||||||
|
let tags = this.commandInfo.tags;
|
||||||
|
return tags && tags.includes("默认") ? false : true;
|
||||||
|
},
|
||||||
// 匹配类型的颜色
|
// 匹配类型的颜色
|
||||||
cmdBadgeColor() {
|
cmdBadgeColor() {
|
||||||
return (cmdType = "keyword") => {
|
return (cmdType = "keyword") => {
|
||||||
@ -251,6 +267,18 @@ export default {
|
|||||||
}
|
}
|
||||||
return shortStr === str ? shortStr : shortStr + "...";
|
return shortStr === str ? shortStr : shortStr + "...";
|
||||||
},
|
},
|
||||||
|
// 命令卡片点击事件
|
||||||
|
handleCardClick() {
|
||||||
|
// 视图模式下直接运行命令
|
||||||
|
if (this.cardStyle.code === 1) return this.runCommand();
|
||||||
|
if (!this.canCommandEdit)
|
||||||
|
return quickcommand.showMessageBox("默认命令不可编辑", "warning");
|
||||||
|
this.editCommand();
|
||||||
|
},
|
||||||
|
// 编辑命令
|
||||||
|
editCommand() {
|
||||||
|
console.log(this.commandInfo);
|
||||||
|
},
|
||||||
// 运行命令
|
// 运行命令
|
||||||
runCommand() {
|
runCommand() {
|
||||||
utools.redirect(
|
utools.redirect(
|
||||||
|
@ -508,7 +508,13 @@ export default {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
let stringifyCommands = JSON.stringify(this.allQuickCommands);
|
let commandsToExport = JSON.parse(JSON.stringify(this.allQuickCommands));
|
||||||
|
// 不导出默认命令
|
||||||
|
if (!utools.isDev())
|
||||||
|
Object.keys(commandsToExport).forEach((code) => {
|
||||||
|
if (code.includes("default_")) delete commandsToExport[code];
|
||||||
|
});
|
||||||
|
let stringifyCommands = JSON.stringify(commandsToExport);
|
||||||
if (saveAsFile) {
|
if (saveAsFile) {
|
||||||
window.saveFile(stringifyCommands, options);
|
window.saveFile(stringifyCommands, options);
|
||||||
quickcommand.showMessageBox("导出成功!");
|
quickcommand.showMessageBox("导出成功!");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user