mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-09 23:16:18 +08:00
添加三个实用功能
This commit is contained in:
parent
8794a02f39
commit
4e879e6dc2
@ -11,6 +11,20 @@ let defaultProfile = {
|
|||||||
defaultPrimaryColor: "#009688",
|
defaultPrimaryColor: "#009688",
|
||||||
backgroundImg: null,
|
backgroundImg: null,
|
||||||
codeHistory: {},
|
codeHistory: {},
|
||||||
|
quickFeatures: {
|
||||||
|
favFile: {
|
||||||
|
enable: false,
|
||||||
|
tag: "文件"
|
||||||
|
},
|
||||||
|
favUrl: {
|
||||||
|
enable: false,
|
||||||
|
tag: "网址"
|
||||||
|
},
|
||||||
|
pluNickName: {
|
||||||
|
enable: false,
|
||||||
|
tag: "别名"
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let userProfile = UTOOLS.getDB(
|
let userProfile = UTOOLS.getDB(
|
||||||
UTOOLS.DBPRE.CFG + "preferences"
|
UTOOLS.DBPRE.CFG + "preferences"
|
||||||
@ -19,7 +33,7 @@ Object.assign(defaultProfile, userProfile)
|
|||||||
|
|
||||||
// "async" is optional;
|
// "async" is optional;
|
||||||
// more info on params: https://v2.quasar.dev/quasar-cli/boot-files
|
// more info on params: https://v2.quasar.dev/quasar-cli/boot-files
|
||||||
export default boot(async({
|
export default boot(async ({
|
||||||
app
|
app
|
||||||
}) => {
|
}) => {
|
||||||
app.config.globalProperties.$utools = UTOOLS
|
app.config.globalProperties.$utools = UTOOLS
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<q-menu
|
<q-menu
|
||||||
max-height="450px"
|
max-height="480px"
|
||||||
max-width="290px"
|
max-width="290px"
|
||||||
transition-show="jump-up"
|
transition-show="jump-up"
|
||||||
transition-hide="jump-down"
|
transition-hide="jump-down"
|
||||||
@ -77,6 +77,108 @@
|
|||||||
</q-list>
|
</q-list>
|
||||||
</q-menu>
|
</q-menu>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
<!-- 实用功能 -->
|
||||||
|
<q-item clickable>
|
||||||
|
<q-item-section side>
|
||||||
|
<q-icon name="keyboard_arrow_left" />
|
||||||
|
</q-item-section>
|
||||||
|
<q-item-section>实用功能</q-item-section>
|
||||||
|
<q-menu anchor="top end" self="top start">
|
||||||
|
<q-list>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section side>
|
||||||
|
<q-icon name="folder_special" />
|
||||||
|
</q-item-section>
|
||||||
|
<q-input
|
||||||
|
dense
|
||||||
|
prefix="快速收藏文件至"
|
||||||
|
suffix="标签"
|
||||||
|
outlined
|
||||||
|
input-class="text-center"
|
||||||
|
style="width: 280px"
|
||||||
|
autofocus
|
||||||
|
v-model="quickFeatures.favFile.tag"
|
||||||
|
type="text"
|
||||||
|
>
|
||||||
|
<template v-slot:append>
|
||||||
|
<q-toggle
|
||||||
|
@click="toggleFeature('favFile')"
|
||||||
|
v-model="quickFeatures.favFile.enable"
|
||||||
|
checked-icon="check"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<q-tooltip
|
||||||
|
>启用后,选中文件可以通过超级面板快速将文件收藏到「{{
|
||||||
|
quickFeatures.favFile.tag
|
||||||
|
}}」标签
|
||||||
|
</q-tooltip>
|
||||||
|
</q-input>
|
||||||
|
</q-item>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section side>
|
||||||
|
<q-icon name="bookmarks" />
|
||||||
|
</q-item-section>
|
||||||
|
<q-input
|
||||||
|
dense
|
||||||
|
prefix="快速收藏网址至"
|
||||||
|
suffix="标签"
|
||||||
|
outlined
|
||||||
|
input-class="text-center"
|
||||||
|
style="width: 280px"
|
||||||
|
autofocus
|
||||||
|
v-model="quickFeatures.favUrl.tag"
|
||||||
|
type="text"
|
||||||
|
>
|
||||||
|
<template v-slot:append>
|
||||||
|
<q-toggle
|
||||||
|
@click="toggleFeature('favUrl')"
|
||||||
|
v-model="quickFeatures.favUrl.enable"
|
||||||
|
checked-icon="check"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<q-tooltip
|
||||||
|
>启用后,在浏览器界面可以通过超级面板快速将网址收藏到「{{
|
||||||
|
quickFeatures.favUrl.tag
|
||||||
|
}}」标签
|
||||||
|
</q-tooltip>
|
||||||
|
</q-input>
|
||||||
|
</q-item>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section side>
|
||||||
|
<q-icon name="drive_file_rename_outline" />
|
||||||
|
</q-item-section>
|
||||||
|
<q-input
|
||||||
|
dense
|
||||||
|
prefix="新建插件别名至"
|
||||||
|
suffix="标签"
|
||||||
|
outlined
|
||||||
|
input-class="text-center"
|
||||||
|
style="width: 280px"
|
||||||
|
autofocus
|
||||||
|
v-model="quickFeatures.pluNickName.tag"
|
||||||
|
type="text"
|
||||||
|
>
|
||||||
|
<template v-slot:append>
|
||||||
|
<q-toggle
|
||||||
|
@click="toggleFeature('pluNickName')"
|
||||||
|
v-model="quickFeatures.pluNickName.enable"
|
||||||
|
checked-icon="check"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<q-tooltip
|
||||||
|
>启用后,在主输入框输入「插件别名」可以快速设置插件别名<br />
|
||||||
|
并将所有设置的别名保存至「{{
|
||||||
|
quickFeatures.pluNickName.tag
|
||||||
|
}}」标签
|
||||||
|
</q-tooltip>
|
||||||
|
</q-input>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
|
</q-menu>
|
||||||
|
</q-item>
|
||||||
<!-- 选项 -->
|
<!-- 选项 -->
|
||||||
<q-item clickable>
|
<q-item clickable>
|
||||||
<q-item-section side>
|
<q-item-section side>
|
||||||
@ -97,7 +199,7 @@
|
|||||||
no-header
|
no-header
|
||||||
no-footer
|
no-footer
|
||||||
@change="setPrimaryColor"
|
@change="setPrimaryColor"
|
||||||
v-model="$profile.primaryColor"
|
v-model="primaryColor"
|
||||||
/>
|
/>
|
||||||
<q-btn
|
<q-btn
|
||||||
color="primary"
|
color="primary"
|
||||||
@ -193,6 +295,7 @@ import { ref } from "vue";
|
|||||||
import AboutThis from "components/AboutThis";
|
import AboutThis from "components/AboutThis";
|
||||||
import PanelSetting from "components/PanelSetting";
|
import PanelSetting from "components/PanelSetting";
|
||||||
import UserInfo from "components/UserInfo";
|
import UserInfo from "components/UserInfo";
|
||||||
|
import features from "../js/options/quickFeatures.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -206,6 +309,8 @@ export default {
|
|||||||
selectFile: ref(null),
|
selectFile: ref(null),
|
||||||
showAbout: false,
|
showAbout: false,
|
||||||
showPanelConf: false,
|
showPanelConf: false,
|
||||||
|
quickFeatures: this.$profile.quickFeatures,
|
||||||
|
features: features,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -250,17 +355,21 @@ export default {
|
|||||||
.querySelectorAll(".q-toggle[aria-checked='true']")
|
.querySelectorAll(".q-toggle[aria-checked='true']")
|
||||||
.forEach((x) => x.click());
|
.forEach((x) => x.click());
|
||||||
},
|
},
|
||||||
|
// 设置主题色
|
||||||
setPrimaryColor() {
|
setPrimaryColor() {
|
||||||
this.setCssVar("primary", this.$profile.primaryColor);
|
this.setCssVar("primary", this.$profile.primaryColor);
|
||||||
},
|
},
|
||||||
|
// 重置主题色
|
||||||
resetPrimary() {
|
resetPrimary() {
|
||||||
this.$profile.primaryColor = this.$profile.defaultPrimaryColor;
|
this.$profile.primaryColor = this.$profile.defaultPrimaryColor;
|
||||||
this.setPrimaryColor();
|
this.setPrimaryColor();
|
||||||
},
|
},
|
||||||
|
// 修改面板视图背景
|
||||||
changeBackground(reset = false) {
|
changeBackground(reset = false) {
|
||||||
this.$profile.backgroundImg = reset ? null : this.selectFile.path;
|
this.$profile.backgroundImg = reset ? null : this.selectFile.path;
|
||||||
this.configurationPage.$forceUpdate();
|
this.configurationPage.$forceUpdate();
|
||||||
},
|
},
|
||||||
|
// 取消收藏
|
||||||
unMarkTag() {
|
unMarkTag() {
|
||||||
this.$utools.whole.removeFeature(
|
this.$utools.whole.removeFeature(
|
||||||
`panel_${window.hexEncode(this.currentTag)}`
|
`panel_${window.hexEncode(this.currentTag)}`
|
||||||
@ -268,6 +377,11 @@ export default {
|
|||||||
_.pull(this.$root.$refs.view.activatedQuickPanels, this.currentTag);
|
_.pull(this.$root.$refs.view.activatedQuickPanels, this.currentTag);
|
||||||
quickcommand.showMessageBox("取消收藏成功");
|
quickcommand.showMessageBox("取消收藏成功");
|
||||||
},
|
},
|
||||||
|
// 实用功能
|
||||||
|
toggleFeature(type) {
|
||||||
|
this.$utools.whole.removeFeature(this.features[type].code) ||
|
||||||
|
this.$utools.whole.setFeature(_.cloneDeep(this.features[type]));
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
48
src/js/options/quickFeatures.js
Normal file
48
src/js/options/quickFeatures.js
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
const quickFeatures = {
|
||||||
|
favFile: {
|
||||||
|
code: "feature_favFile",
|
||||||
|
explain: "快速将选中的文件收藏到快捷命令当中",
|
||||||
|
cmds: [{
|
||||||
|
label: "收藏文件",
|
||||||
|
type: "files",
|
||||||
|
match: "/.*+/i",
|
||||||
|
}, ],
|
||||||
|
icon: "img/feature/file.png",
|
||||||
|
platform: ["win32", "darwin", "linux"],
|
||||||
|
|
||||||
|
},
|
||||||
|
favUrl: {
|
||||||
|
code: "feature_favUrl",
|
||||||
|
explain: "快速将选中的网址收藏到快捷命令当中",
|
||||||
|
cmds: [{
|
||||||
|
label: "收藏网址",
|
||||||
|
type: "window",
|
||||||
|
match: {
|
||||||
|
app: [
|
||||||
|
"chrome.exe",
|
||||||
|
"firefox.exe",
|
||||||
|
"MicrosoftEdge.exe",
|
||||||
|
"iexplore.exe",
|
||||||
|
"msedge.exe",
|
||||||
|
"Google Chrome.app",
|
||||||
|
"Safari.app",
|
||||||
|
"Microsoft Edge.app",
|
||||||
|
"chrome",
|
||||||
|
"firefox",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}, ],
|
||||||
|
icon: "img/feature/url.png",
|
||||||
|
platform: ["win32", "darwin", "linux"],
|
||||||
|
|
||||||
|
},
|
||||||
|
pluNickName: {
|
||||||
|
code: "feature_pluNickName",
|
||||||
|
explain: "为插件设置别名",
|
||||||
|
cmds: ["插件别名"],
|
||||||
|
icon: "img/feature/plugin.png",
|
||||||
|
platform: ["win32", "darwin", "linux"],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default quickFeatures
|
29
src/pages/quickFeaturesPage.vue
Normal file
29
src/pages/quickFeaturesPage.vue
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
featureType: this.$route.params.featuretype,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
switch (this.featureType) {
|
||||||
|
case "pluNickName":
|
||||||
|
this.showNickNameSetting();
|
||||||
|
break;
|
||||||
|
case "favFile":
|
||||||
|
break;
|
||||||
|
case "favUrl":
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showNickNameSetting() {
|
||||||
|
quickcommand
|
||||||
|
.showInputBox(["插件的功能关键字", "要设置的别名"], "插件别名设置")
|
||||||
|
.then((res) => {});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
@ -2,49 +2,54 @@ const routes = [{
|
|||||||
path: '/configuration',
|
path: '/configuration',
|
||||||
name: 'configuration',
|
name: 'configuration',
|
||||||
component: () =>
|
component: () =>
|
||||||
import ('pages/ConfigurationPage.vue')
|
import('pages/ConfigurationPage.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/code',
|
path: '/code',
|
||||||
name: 'code',
|
name: 'code',
|
||||||
component: () =>
|
component: () =>
|
||||||
import ('pages/RunCodePage.vue')
|
import('pages/RunCodePage.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/newcommand',
|
path: '/newcommand',
|
||||||
name: 'newcommand',
|
name: 'newcommand',
|
||||||
component: () =>
|
component: () =>
|
||||||
import ('pages/ConfigurationPage.vue')
|
import('pages/ConfigurationPage.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/:type(default|files|img|key|regex|window|professional)_:uid(\\w+)',
|
path: '/:type(default|files|img|key|regex|window|professional)_:uid(\\w+)',
|
||||||
name: 'command',
|
name: 'command',
|
||||||
component: () =>
|
component: () =>
|
||||||
import ('pages/CommandPage.vue')
|
import('pages/CommandPage.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/panel_:tags(\\w+)',
|
path: '/panel_:tags(\\w+)',
|
||||||
name: 'panel',
|
name: 'panel',
|
||||||
component: () =>
|
component: () =>
|
||||||
import ('pages/ConfigurationPage.vue')
|
import('pages/ConfigurationPage.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/needupdate',
|
path: '/needupdate',
|
||||||
name: 'needupdate',
|
name: 'needupdate',
|
||||||
props: true,
|
props: true,
|
||||||
component: () =>
|
component: () =>
|
||||||
import ('pages/updateWarningPage.vue')
|
import('pages/updateWarningPage.vue')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/loading',
|
path: '/loading',
|
||||||
name: 'loading',
|
name: 'loading',
|
||||||
component: () =>
|
component: () =>
|
||||||
import ('pages/LoadingPage.vue')
|
import('pages/LoadingPage.vue')
|
||||||
}, {
|
}, {
|
||||||
path: '/share',
|
path: '/share',
|
||||||
name: 'share',
|
name: 'share',
|
||||||
component: () =>
|
component: () =>
|
||||||
import ('pages/ShareCenterPage.vue')
|
import('pages/ShareCenterPage.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/feature_:featuretype(\\w+)',
|
||||||
|
name: 'feature',
|
||||||
|
component: () => import('pages/quickFeaturesPage.vue')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user