添加三个实用功能

This commit is contained in:
fofolee 2022-04-15 17:45:58 +08:00
parent 8794a02f39
commit 4e879e6dc2
5 changed files with 221 additions and 11 deletions

View File

@ -11,6 +11,20 @@ let defaultProfile = {
defaultPrimaryColor: "#009688",
backgroundImg: null,
codeHistory: {},
quickFeatures: {
favFile: {
enable: false,
tag: "文件"
},
favUrl: {
enable: false,
tag: "网址"
},
pluNickName: {
enable: false,
tag: "别名"
},
}
}
let userProfile = UTOOLS.getDB(
UTOOLS.DBPRE.CFG + "preferences"

View File

@ -1,6 +1,6 @@
<template>
<q-menu
max-height="450px"
max-height="480px"
max-width="290px"
transition-show="jump-up"
transition-hide="jump-down"
@ -77,6 +77,108 @@
</q-list>
</q-menu>
</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-section side>
@ -97,7 +199,7 @@
no-header
no-footer
@change="setPrimaryColor"
v-model="$profile.primaryColor"
v-model="primaryColor"
/>
<q-btn
color="primary"
@ -193,6 +295,7 @@ import { ref } from "vue";
import AboutThis from "components/AboutThis";
import PanelSetting from "components/PanelSetting";
import UserInfo from "components/UserInfo";
import features from "../js/options/quickFeatures.js";
export default {
components: {
@ -206,6 +309,8 @@ export default {
selectFile: ref(null),
showAbout: false,
showPanelConf: false,
quickFeatures: this.$profile.quickFeatures,
features: features,
};
},
computed: {
@ -250,17 +355,21 @@ export default {
.querySelectorAll(".q-toggle[aria-checked='true']")
.forEach((x) => x.click());
},
//
setPrimaryColor() {
this.setCssVar("primary", this.$profile.primaryColor);
},
//
resetPrimary() {
this.$profile.primaryColor = this.$profile.defaultPrimaryColor;
this.setPrimaryColor();
},
//
changeBackground(reset = false) {
this.$profile.backgroundImg = reset ? null : this.selectFile.path;
this.configurationPage.$forceUpdate();
},
//
unMarkTag() {
this.$utools.whole.removeFeature(
`panel_${window.hexEncode(this.currentTag)}`
@ -268,6 +377,11 @@ export default {
_.pull(this.$root.$refs.view.activatedQuickPanels, this.currentTag);
quickcommand.showMessageBox("取消收藏成功");
},
//
toggleFeature(type) {
this.$utools.whole.removeFeature(this.features[type].code) ||
this.$utools.whole.setFeature(_.cloneDeep(this.features[type]));
},
},
};
</script>

View 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

View 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>

View File

@ -45,6 +45,11 @@ const routes = [{
name: 'share',
component: () =>
import('pages/ShareCenterPage.vue')
},
{
path: '/feature_:featuretype(\\w+)',
name: 'feature',
component: () => import('pages/quickFeaturesPage.vue')
}
]