变量名调整

This commit is contained in:
fofolee 2022-04-02 19:33:55 +08:00
parent 18c93af8a3
commit 3422a23087
2 changed files with 57 additions and 41 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="wrapper" :style="isCommandActivated ? '' : 'color:#9e9e9ea6'"> <div class="wrapper" :style="isCommandActivated ? '' : 'color:##9e9e9ea6'">
<div> <div>
<!-- 开关 --> <!-- 开关 -->
<div class="absolute" style="z-index: 1; left: 20px; bottom: 16px"> <div class="absolute" style="z-index: 1; left: 20px; bottom: 16px">
@ -46,18 +46,18 @@
<q-card-section> <q-card-section>
<!-- logo --> <!-- logo -->
<div class="row"> <div class="row">
<q-img width="48px" :src="quickcommand.features.icon" /> <q-img width="48px" :src="commandInfo.features.icon" />
</div> </div>
<!-- 名称 --> <!-- 名称 -->
<div class="row justify-end"> <div class="row justify-end">
<div class="text-h6 ellipsis"> <div class="text-h6 ellipsis">
{{ quickcommand.features.explain }} {{ commandInfo.features.explain }}
</div> </div>
</div> </div>
<!-- 匹配模式 --> <!-- 匹配模式 -->
<div class="row justify-end q-gutter-xs"> <div class="row justify-end q-gutter-xs">
<div class="scrollArea"> <div class="matchTypesBox">
<span v-for="cmd in quickcommand.features.cmds" :key="cmd"> <span v-for="cmd in commandInfo.features.cmds" :key="cmd">
<span v-if="typeof cmd === 'string'"> <span v-if="typeof cmd === 'string'">
<q-badge rounded color="teal" <q-badge rounded color="teal"
><q-icon class="q-mr-xs" name="font_download" />{{ ><q-icon class="q-mr-xs" name="font_download" />{{
@ -135,14 +135,14 @@
<!-- 语言类型及适配系统 --> <!-- 语言类型及适配系统 -->
<div class="row justify-end items-center q-gutter-xs"> <div class="row justify-end items-center q-gutter-xs">
<span <span
:style="'color:' + allProgrammings[quickcommand.program].color" :style="'color:' + allProgrammings[commandInfo.program].color"
></span ></span
> >
<span class="text-subtitle2">{{ quickcommand.program }}</span <span class="text-subtitle2">{{ commandInfo.program }}</span
><span>|</span> ><span>|</span>
<img <img
width="16" width="16"
v-for="platform in quickcommand.features.platform" v-for="platform in commandInfo.features.platform"
:key="platform" :key="platform"
:src="'/img/' + platform + '.svg'" :src="'/img/' + platform + '.svg'"
/> />
@ -167,29 +167,29 @@ export default {
computed: { computed: {
canCommandRun() { canCommandRun() {
return ( return (
this.quickcommand.features.cmds.filter((x) => x.length).length && this.commandInfo.features.cmds.filter((x) => x.length).length &&
this.isCommandActivated this.isCommandActivated
); );
}, },
}, },
props: { props: {
quickcommand: Object, commandInfo: Object,
activated: Boolean, activated: Boolean,
}, },
methods: { methods: {
runCommand() { runCommand() {
utools.redirect( utools.redirect(
this.quickcommand.features.cmds.filter((x) => x.length)[0] this.commandInfo.features.cmds.filter((x) => x.length)[0]
); );
}, },
toggleCommandActivated() { toggleCommandActivated() {
let event = { let event = {
type: "disable", type: "disable",
data: this.quickcommand.features.code, data: this.commandInfo.features.code,
}; };
if (!UTOOLS.whole.removeFeature(this.quickcommand.features.code)) { if (!UTOOLS.whole.removeFeature(this.commandInfo.features.code)) {
UTOOLS.whole.setFeature( UTOOLS.whole.setFeature(
JSON.parse(JSON.stringify(this.quickcommand.features)) JSON.parse(JSON.stringify(this.commandInfo.features))
); );
event.type = "enable"; event.type = "enable";
} }
@ -198,8 +198,8 @@ export default {
removeCommand() { removeCommand() {
quickcommand.showConfirmBox("删除这个快捷命令").then((x) => { quickcommand.showConfirmBox("删除这个快捷命令").then((x) => {
if (!x) return; if (!x) return;
let code = this.quickcommand.features.code; let code = this.commandInfo.features.code;
utools.copyText(JSON.stringify(this.quickcommand, null, 4)); utools.copyText(JSON.stringify(this.commandInfo, null, 4));
UTOOLS.delDB(UTOOLS.DBPRE.QC + code); UTOOLS.delDB(UTOOLS.DBPRE.QC + code);
UTOOLS.whole.removeFeature(code); UTOOLS.whole.removeFeature(code);
this.isCommandAlive = false; this.isCommandAlive = false;
@ -213,13 +213,13 @@ export default {
}); });
}, },
exportCommandRaw() { exportCommandRaw() {
utools.copyText(JSON.stringify(this.quickcommand, null, 4)) && utools.copyText(JSON.stringify(this.commandInfo, null, 4)) &&
quickcommand.showMessageBox("已复制到剪贴板"); quickcommand.showMessageBox("已复制到剪贴板");
}, },
exportCommandFile() { exportCommandFile() {
window.saveFile(JSON.stringify(this.quickcommand), { window.saveFile(JSON.stringify(this.commandInfo), {
title: "选择保存位置", title: "选择保存位置",
defaultPath: `${this.quickcommand.features.explain}.json`, defaultPath: `${this.commandInfo.features.explain}.json`,
filters: [{ name: "json", extensions: ["json"] }], filters: [{ name: "json", extensions: ["json"] }],
}); });
}, },
@ -241,7 +241,7 @@ export default {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.scrollArea { .matchTypesBox {
height: 23px; height: 23px;
width: 60%; width: 60%;
overflow: hidden; overflow: hidden;

View File

@ -1,34 +1,35 @@
<template> <template>
<div> <div>
<!-- 标签栏 -->
<q-tabs <q-tabs
v-model="currentTag" v-model="currentTag"
vertical vertical
class="text-teal fixed-left" class="text-teal fixed-left"
style="width: 80px; border-right: 1px solid #0000001f" :style="{
width: tabBarWidth,
boxShadow: barShadow,
zIndex: 1,
}"
> >
<!-- 所有标签 --> <!-- 所有标签 -->
<q-tab <q-tab v-for="tag in allQuickCommandTags" :key="tag" :name="tag">
v-for="tag in allQuickCommandTags" <div class="flex items-center">
:key="tag" <q-icon
:name="tag"
:label="tag"
>
<div>
<q-badge
v-if="activatedQuickPanels.includes(tag)" v-if="activatedQuickPanels.includes(tag)"
floating name="star"
rounded style="margin-right: 2px"
color="teal" />{{ tag }}
><q-icon name="near_me"
/></q-badge>
</div> </div>
</q-tab> </q-tab>
</q-tabs> </q-tabs>
<!-- 标签对应的面板 --> <!-- 面板 -->
<q-tab-panels <q-tab-panels
animated animated
class="fixed-right" class="fixed-right"
style="left: 80px" :style="{
bottom: footerBarHeight,
left: tabBarWidth,
}"
v-model="currentTag" v-model="currentTag"
transition-prev="slide-down" transition-prev="slide-down"
transition-next="slide-up" transition-next="slide-up"
@ -43,21 +44,32 @@
> >
<div class="row center"> <div class="row center">
<CommandCard <CommandCard
v-for="quickcommand in currentTagQuickCommands" v-for="commandInfo in currentTagQuickCommands"
:key="quickcommand.features.code" :key="commandInfo.features.code"
:quickcommand="quickcommand" :commandInfo="commandInfo"
:activated=" :activated="
activatedQuickCommandFeatureCodes.includes( activatedQuickCommandFeatureCodes.includes(
quickcommand.features.code commandInfo.features.code
) )
" "
@commandChanged="commandChanged" @commandChanged="commandChanged"
style="width: 50%" :style="{
width: cmmandCardWidth,
}"
class="relative-position q-pa-sm" class="relative-position q-pa-sm"
></CommandCard> ></CommandCard>
</div> </div>
</q-tab-panel> </q-tab-panel>
</q-tab-panels> </q-tab-panels>
<!-- 底栏 -->
<div
class="fixed-bottom"
:style="{
height: footerBarHeight,
left: tabBarWidth,
boxShadow: barShadow,
}"
></div>
</div> </div>
</template> </template>
@ -73,6 +85,10 @@ export default {
activatedQuickCommandFeatureCodes: [], activatedQuickCommandFeatureCodes: [],
activatedQuickPanels: [], activatedQuickPanels: [],
allQuickCommands: [], allQuickCommands: [],
cmmandCardWidth: "33%",
tabBarWidth: "80px",
footerBarHeight: "35px",
barShadow: "2px 0 5px 2px #0000001f",
}; };
}, },
computed: { computed: {