This commit is contained in:
fofolee 2022-04-12 19:19:05 +08:00
parent 7264db7a5d
commit 8c5996bc93
7 changed files with 65 additions and 34 deletions

View File

@ -493,10 +493,14 @@ window.getMatchedFilesFix = payload => {
}
window.saveFile = (content, file) => {
if (file instanceof Object) {
file = utools.showSaveDialog(file)
if (file instanceof Object) file = utools.showSaveDialog(file)
if (!file) return false
try {
fs.writeFileSync(file, content)
return true
} catch (error) {
return false
}
file && fs.writeFileSync(file, content)
}
window.getSelectFile = hwnd => {

View File

@ -1,6 +1,6 @@
<template>
<router-view v-slot="{ Component }">
<component :ref="$route.name" :is="Component" />
<component ref="view" :is="Component" />
</router-view>
</template>

View File

@ -186,7 +186,6 @@ export default {
resultMaxLength: 10000,
showSidebar: this.action.type !== "run",
isRunCodePage: this.action.type === "run",
configurationPage: this.$root.$refs.configuration,
commandString: this.$q.platform.is.mac ? "⌘" : "ctrl",
};
},
@ -198,9 +197,12 @@ export default {
this.$refs.sidebar?.init();
},
computed: {
configurationPage() {
return this.$root.$refs.view;
},
allQuickCommandTags() {
return _.without(
this.configurationPage?.allQuickCommandTags,
this.configurationPage.allQuickCommandTags,
"默认",
"未分类",
"搜索结果"

View File

@ -6,7 +6,10 @@
transition-hide="jump-down"
>
<!-- 用户信息 -->
<UserInfo />
<UserInfo
:allQuickCommandsLength="allQuickCommandsLength"
:allFeaturesLength="allFeaturesLength"
/>
<!-- 菜单 -->
<q-list>
<!-- 导入 -->
@ -173,7 +176,7 @@
</q-dialog>
<!-- 面板视图弹窗 -->
<q-dialog v-model="showPanelConf">
<PanelSetting />
<PanelSetting :isTagStared="isTagStared" />
</q-dialog>
</q-menu>
</template>
@ -193,17 +196,23 @@ export default {
},
data() {
return {
configurationPage: this.$root.$refs.configuration,
setCssVar: setCssVar,
selectFile: ref(null),
showAbout: false,
showPanelConf: false,
panelConf: {
name: "",
description: "",
},
};
},
computed: {
configurationPage() {
return this.$root.$refs.view;
},
allQuickCommandsLength() {
return Object.keys(this.configurationPage.allQuickCommands).length;
},
allFeaturesLength() {
return this.configurationPage.activatedQuickCommandFeatureCodes.length;
},
},
mounted() {
window.configurationMenu = this;
},

View File

@ -11,3 +11,16 @@
</q-card-actions>
</q-card>
</template>
<script>
export default {
data() {
return {
panelConf: {
name: "",
description: "",
},
};
},
};
</script>

View File

@ -20,14 +20,14 @@
<div class="column items-start q-gutter-xs">
<q-chip dense square>
<q-avatar color="indigo" text-color="white">{{
Object.keys(configurationPage.allQuickCommands).length
allQuickCommandsLength
}}</q-avatar>
Quickcommands
<q-tooltip>当前拥有的快捷命令</q-tooltip>
</q-chip>
<q-chip dense square>
<q-avatar color="green-8" text-color="white">{{
configurationPage.activatedQuickCommandFeatureCodes.length
allFeaturesLength
}}</q-avatar>
Features
<q-tooltip>当前启用的快捷命令</q-tooltip>
@ -67,8 +67,11 @@ export default {
number: 1,
process: 0.4,
},
configurationPage: this.$root.$refs.configuration,
};
},
props: {
allFeaturesLength: Number,
allQuickCommandsLength: Number,
},
};
</script>

View File

@ -478,7 +478,7 @@ export default {
});
let stringifyCommands = JSON.stringify(commandsToExport);
if (saveAsFile) {
window.saveFile(stringifyCommands, options);
window.saveFile(stringifyCommands, options) &&
quickcommand.showMessageBox("导出成功!");
} else {
utools.copyText(stringifyCommands);