mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2024-11-26 12:55:06 +08:00
🐛 docs: 添加发布插件表单
This commit is contained in:
parent
aa4d930cc4
commit
b469c9420e
59
.github/ISSUE_TEMPLATE/resource_publish_en.yml
vendored
Normal file
59
.github/ISSUE_TEMPLATE/resource_publish_en.yml
vendored
Normal file
@ -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
|
@ -54,6 +54,6 @@ body:
|
|||||||
label: 标签
|
label: 标签
|
||||||
description: 标签
|
description: 标签
|
||||||
placeholder: 'e.g. [{"label": "标签名", "color": "#ea5252"}]'
|
placeholder: 'e.g. [{"label": "标签名", "color": "#ea5252"}]'
|
||||||
value: "[]"
|
value: [ { "label": "标签名", "color": "#a2d8f4" } ]
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
@ -2,10 +2,15 @@
|
|||||||
import {computed, ref} from 'vue'
|
import {computed, ref} from 'vue'
|
||||||
import ItemCard from './ResItemCard.vue'
|
import ItemCard from './ResItemCard.vue'
|
||||||
import ResPubWindow from "./ResPubWindow.vue";
|
import ResPubWindow from "./ResPubWindow.vue";
|
||||||
import {getTextRef} from "./scripts/i18n";
|
import {getTextRef, formatLang} from "./scripts/i18n";
|
||||||
import {RepoUrl} from "./scripts/statsApi";
|
import {RepoUrl} from "./scripts/statsApi";
|
||||||
|
|
||||||
import resourcesJson from "../public/resources.json"
|
import resourcesJson from "../public/resources.json"
|
||||||
|
import {useData} from "vitepress";
|
||||||
|
// formLang
|
||||||
|
const lang = computed(
|
||||||
|
() => formatLang(useData().lang.value)
|
||||||
|
)
|
||||||
|
|
||||||
// 从public/assets/resources.json加载插件
|
// 从public/assets/resources.json加载插件
|
||||||
let filteredItems = computed(() => {
|
let filteredItems = computed(() => {
|
||||||
@ -28,10 +33,6 @@ const isPublishWindowOpen = ref(false)
|
|||||||
|
|
||||||
let newRes = ref({
|
let newRes = ref({
|
||||||
name: '',
|
name: '',
|
||||||
desc: '',
|
|
||||||
author: '',
|
|
||||||
homepage: '',
|
|
||||||
link: '',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function openPublishWindow() {
|
function openPublishWindow() {
|
||||||
@ -42,10 +43,17 @@ function closePublishWindow() {
|
|||||||
isPublishWindowOpen.value = false
|
isPublishWindowOpen.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const submitForm = () => {
|
|
||||||
|
function submitForm() {
|
||||||
const title = encodeURI(`Resource: ${newRes.value.name}`)
|
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`)
|
let submitLang = ""
|
||||||
const issueURL = `${RepoUrl}/issues/new?title=${title}&body=${body}`
|
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')
|
window.open(issueURL, '_blank')
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +62,8 @@ const submitForm = () => {
|
|||||||
<template>
|
<template>
|
||||||
<div class="market">
|
<div class="market">
|
||||||
<h1>{{ getTextRef('resourceStore') }}</h1>
|
<h1>{{ getTextRef('resourceStore') }}</h1>
|
||||||
<div class="search-box-div"><input class="item-search-box" type="text" :placeholder="getTextRef('search')" v-model="search"/></div>
|
<div class="search-box-div"><input class="item-search-box" type="text" :placeholder="getTextRef('search')"
|
||||||
|
v-model="search"/></div>
|
||||||
<div class="store-tabs" style="display: flex">
|
<div class="store-tabs" style="display: flex">
|
||||||
<button class="store-button publish-button" @click="openPublishWindow">{{ getTextRef('publishRes') }}</button>
|
<button class="store-button publish-button" @click="openPublishWindow">{{ getTextRef('publishRes') }}</button>
|
||||||
</div>
|
</div>
|
||||||
@ -67,17 +76,15 @@ const submitForm = () => {
|
|||||||
<form @submit.prevent="submitForm">
|
<form @submit.prevent="submitForm">
|
||||||
<label for="name">{{ getTextRef("resName") }}</label>
|
<label for="name">{{ getTextRef("resName") }}</label>
|
||||||
<input type="text" id="name" v-model="newRes.name" :placeholder="getTextRef('resNameText')"/>
|
<input type="text" id="name" v-model="newRes.name" :placeholder="getTextRef('resNameText')"/>
|
||||||
<label for="desc">{{ getTextRef("resDesc") }}</label>
|
|
||||||
<input type="text" id="desc" v-model="newRes.desc" :placeholder="getTextRef('resDescText')"/>
|
|
||||||
<label for="author">{{ getTextRef("resAuthor") }}</label>
|
|
||||||
<input type="text" id="author" v-model="newRes.author" :placeholder="getTextRef('resAuthorText')"/>
|
|
||||||
<label for="link">{{ getTextRef("resLink") }}</label>
|
|
||||||
<input type="text" id="link" v-model="newRes.link" :placeholder="getTextRef('resLinkText')"/>
|
|
||||||
<label for="homepage">{{ getTextRef("resHomepage") }}</label>
|
|
||||||
<input type="text" id="homepage" v-model="newRes.homepage" :placeholder="getTextRef('resHomepageText')"/>
|
|
||||||
<div class="pub-options" style="display: flex; justify-content: center">
|
<div class="pub-options" style="display: flex; justify-content: center">
|
||||||
<button class="pub-option close" type="button" @click="closePublishWindow">{{ getTextRef("closeButtonText") }}</button>
|
<button class="pub-option close" type="button" @click="closePublishWindow">{{
|
||||||
<button class="pub-option submit" type="submit">{{ getTextRef("submitButtonText") }}</button>
|
getTextRef("closeButtonText")
|
||||||
|
}}
|
||||||
|
</button>
|
||||||
|
<button class="pub-option submit" type="submit" @click="submitForm">{{
|
||||||
|
getTextRef("submitButtonText")
|
||||||
|
}}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</ResPubWindow>
|
</ResPubWindow>
|
||||||
|
@ -91,7 +91,7 @@ function getText(lang: string, key: string): string {
|
|||||||
return i18nData[lang][key];
|
return i18nData[lang][key];
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatLang(lang: string): string {
|
export function formatLang(lang: string): string {
|
||||||
if (lang.includes('-')) {
|
if (lang.includes('-')) {
|
||||||
return lang.split('-')[0];
|
return lang.split('-')[0];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user