标记来自分享的命令

This commit is contained in:
fofolee 2022-05-01 11:25:26 +08:00
parent 46885b29cd
commit 83c277363c
2 changed files with 8 additions and 7 deletions

View File

@ -102,9 +102,7 @@
debounce="200" debounce="200"
filled filled
dense dense
clearable
:autofocus="$root.profile.autofocusSearch" :autofocus="$root.profile.autofocusSearch"
clear-icon="close"
@update:model-value="updateSearch" @update:model-value="updateSearch"
placeholder="搜索,支持拼音首字母" placeholder="搜索,支持拼音首字母"
> >
@ -257,6 +255,8 @@ export default {
switch (this.currentTag) { switch (this.currentTag) {
case "未分类": case "未分类":
return commands.filter((cmd) => !cmd.tags || cmd.tags.length === 0); return commands.filter((cmd) => !cmd.tags || cmd.tags.length === 0);
case "来自分享":
return commands.filter((cmd) => cmd.fromShare);
case "搜索结果": case "搜索结果":
if (this.commandSearchKeyword?.length < 2) return; if (this.commandSearchKeyword?.length < 2) return;
let searchResult = []; let searchResult = [];
@ -291,11 +291,7 @@ export default {
"默认", "默认",
Object.values(this.allQuickCommands).map((x) => x.tags) Object.values(this.allQuickCommands).map((x) => x.tags)
) )
).concat(["未分类"]); ).concat(["未分类", "来自分享"]);
if (allTags.includes("来自分享")) {
_.pull(allTags, "来自分享");
allTags.push("来自分享");
}
allTags.push("搜索结果"); allTags.push("搜索结果");
return allTags; return allTags;
}, },

View File

@ -183,11 +183,16 @@ export default {
if (!code) if (!code)
return quickcommand.showMessageBox("该命令格式有误!", "error"); return quickcommand.showMessageBox("该命令格式有误!", "error");
let pushData = _.cloneDeep(command); let pushData = _.cloneDeep(command);
pushData.fromShare = true;
if (!pushData?.tags.includes("来自分享")) pushData.tags.push("来自分享"); if (!pushData?.tags.includes("来自分享")) pushData.tags.push("来自分享");
this.$root.utools.putDB( this.$root.utools.putDB(
_.cloneDeep(pushData), _.cloneDeep(pushData),
this.$root.utools.DBPRE.QC + code this.$root.utools.DBPRE.QC + code
); );
// 访
utools.ubrowser
.goto(`https://www.yuque.com/${this.releaseRepo}/${code}`)
.run({ show: false });
quickcommand.showMessageBox("导入成功!可到「来自分享」标签查看"); quickcommand.showMessageBox("导入成功!可到「来自分享」标签查看");
}, },
updateSearch() { updateSearch() {