From b469c9420efcdb622efa5f7e75b430c0aebd2dbf Mon Sep 17 00:00:00 2001 From: snowykami Date: Sun, 22 Sep 2024 01:38:44 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20docs:=20=E6=B7=BB=E5=8A=A0=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=8F=92=E4=BB=B6=E8=A1=A8=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ISSUE_TEMPLATE/resource_publish_en.yml | 59 +++++++++++++++++++ .../ISSUE_TEMPLATE/resource_publish_zh.yml | 2 +- docs/components/ResStore.vue | 45 ++++++++------ docs/components/scripts/i18n.ts | 2 +- 4 files changed, 87 insertions(+), 21 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/resource_publish_en.yml diff --git a/.github/ISSUE_TEMPLATE/resource_publish_en.yml b/.github/ISSUE_TEMPLATE/resource_publish_en.yml new file mode 100644 index 000000000..7c2139e66 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/resource_publish_en.yml @@ -0,0 +1,59 @@ +name: Publish Resource +title: "Resource: {name}" +description: Publish the resource to the Qingxue Bot official store +labels: [ "Resource" ] +body: + - type: input + id: name + attributes: + label: Name + description: The readable name of the resource pack + placeholder: e.g. Cute UI Resource Pack + validations: + required: true + + - type: input + id: description + attributes: + label: Description + description: A brief description of the resource + placeholder: e.g. Makes the rendering card style more beautiful + validations: + required: true + + - type: input + id: author + attributes: + label: Author + description: The GitHub username of the author + placeholder: e.g. snowykami + validations: + required: true + + - type: input + id: link + attributes: + label: Download Link + description: Direct download link of the resource pack + placeholder: e.g. https://aaa.com/r.zip + validations: + required: true + + - type: input + id: homepage + attributes: + label: Homepage + description: Homepage of the resource pack + placeholder: e.g. https://github.com/user/repo + validations: + required: false + + - type: input + id: tags + attributes: + label: Tags + description: Tags + placeholder: 'e.g. [{"label": "Tag Name", "color": "#ea5252"}]' + value: [ { "label": "Tag Name", "color": "#a2d8f4" } ] + validations: + required: true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/resource_publish_zh.yml b/.github/ISSUE_TEMPLATE/resource_publish_zh.yml index 5cbbca7f0..bb141727f 100644 --- a/.github/ISSUE_TEMPLATE/resource_publish_zh.yml +++ b/.github/ISSUE_TEMPLATE/resource_publish_zh.yml @@ -54,6 +54,6 @@ body: label: 标签 description: 标签 placeholder: 'e.g. [{"label": "标签名", "color": "#ea5252"}]' - value: "[]" + value: [ { "label": "标签名", "color": "#a2d8f4" } ] validations: required: true diff --git a/docs/components/ResStore.vue b/docs/components/ResStore.vue index f7f627306..da446baf3 100644 --- a/docs/components/ResStore.vue +++ b/docs/components/ResStore.vue @@ -2,10 +2,15 @@ import {computed, ref} from 'vue' import ItemCard from './ResItemCard.vue' import ResPubWindow from "./ResPubWindow.vue"; -import {getTextRef} from "./scripts/i18n"; +import {getTextRef, formatLang} from "./scripts/i18n"; import {RepoUrl} from "./scripts/statsApi"; import resourcesJson from "../public/resources.json" +import {useData} from "vitepress"; +// formLang +const lang = computed( + () => formatLang(useData().lang.value) +) // 从public/assets/resources.json加载插件 let filteredItems = computed(() => { @@ -28,10 +33,6 @@ const isPublishWindowOpen = ref(false) let newRes = ref({ name: '', - desc: '', - author: '', - homepage: '', - link: '', }) function openPublishWindow() { @@ -42,10 +43,17 @@ function closePublishWindow() { isPublishWindowOpen.value = false } -const submitForm = () => { + +function submitForm() { const title = encodeURI(`Resource: ${newRes.value.name}`) - let body = encodeURI(`---\nname: ${newRes.value.name}\ndesc: ${newRes.value.desc}\nauthor: ${newRes.value.author}\nhomepage: ${newRes.value.homepage}\nlink: ${newRes.value.link}\n---\n`) - const issueURL = `${RepoUrl}/issues/new?title=${title}&body=${body}` + let submitLang = "" + if (lang.value === "zh") { + submitLang = "zh" + } else { + submitLang = "en" + } + const issueURL = `${RepoUrl}/issues/new?assignees=&labels=Resource&template=resource_publish_${submitLang}.yml&title=${title}` + console.log(issueURL) window.open(issueURL, '_blank') } @@ -54,7 +62,8 @@ const submitForm = () => {