use rsbuild instead of vite

This commit is contained in:
2025-09-05 11:00:55 +08:00
parent 80552924df
commit 84d798c01f
21 changed files with 1342 additions and 1098 deletions

View File

@@ -255,4 +255,4 @@ export function deleteTutorial(id: number) {
export function setTutorialVisibility(id: number, is_public: boolean) {
return http.put("admin/tutorial/visibility", { id, is_public })
}
}

View File

@@ -99,7 +99,7 @@ const abnormalServers = computed(() =>
)
const websiteConfig = reactive({
website_base_url: import.meta.env.VITE_OJ_URL,
website_base_url: import.meta.env.PUBLIC_OJ_URL,
website_name: "判题狗",
website_name_shortcut: "判题狗",
website_footer: "所有权归属于徐越,感谢青岛大学开源 OJ 系统,感谢开源社区",

View File

@@ -40,4 +40,4 @@ async function handleDelete() {
</n-popconfirm>
</n-flex>
</template>
<style scoped></style>
<style scoped></style>

View File

@@ -87,7 +87,11 @@ onMounted(init)
/>
</n-form-item>
<n-form-item label="顺序">
<n-input-number style="width: 100px" v-model:value="tutorial.order" :min="0" />
<n-input-number
style="width: 100px"
v-model:value="tutorial.order"
:min="0"
/>
</n-form-item>
<n-form-item label="可见">
<n-switch v-model:value="tutorial.is_public" />

13
src/env.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
/// <reference types="@rsbuild/core/types" />
interface ImportMetaEnv {
readonly PUBLIC_MAXKB_URL: string
readonly PUBLIC_OJ_URL: string
readonly PUBLIC_CODE_URL: string
readonly PUBLIC_JUDGE0_URL: string
readonly PUBLIC_ICONIFY_URL: string
}
interface ImportMeta {
readonly env: ImportMetaEnv
}

View File

@@ -34,8 +34,8 @@ app.use(router)
app.use(pinia)
app.mount("#app")
if (!!import.meta.env.VITE_ICONIFY_URL) {
if (!!import.meta.env.PUBLIC_ICONIFY_URL) {
addAPIProvider("", {
resources: [import.meta.env.VITE_ICONIFY_URL],
resources: [import.meta.env.PUBLIC_ICONIFY_URL],
})
}

View File

@@ -239,4 +239,4 @@ export function getTutorial(id: number) {
export function getTutorials() {
return http.get("tutorials")
}
}

View File

@@ -92,7 +92,7 @@ async function select(key: string) {
copy()
break
case "test":
window.open(import.meta.env.VITE_CODE_URL, "_blank")
window.open(import.meta.env.PUBLIC_CODE_URL, "_blank")
break
}
}
@@ -103,7 +103,7 @@ function changeLanguage(v: LANGUAGE) {
}
function gotoTestCat() {
const url = import.meta.env.VITE_CODE_URL
const url = import.meta.env.PUBLIC_CODE_URL
window.open(url, "_blank")
}
</script>

5
src/shims.d.ts vendored
View File

@@ -1,5 +0,0 @@
declare module "*.md" {
import type { ComponentOptions } from "vue"
const Component: ComponentOptions
export default Component
}

View File

@@ -2,7 +2,7 @@ import axios from "axios"
import { decode, encode } from "./functions"
import { Code } from "./types"
const http = axios.create({ baseURL: import.meta.env.VITE_JUDGE0_URL })
const http = axios.create({ baseURL: import.meta.env.PUBLIC_JUDGE0_URL })
export async function createTestSubmission(code: Code, input: string) {
const encodedCode = encode(code.value)

View File

@@ -384,7 +384,7 @@ export interface Tutorial {
is_public: boolean
order: number
type: "python" | "c"
created_by?: User
created_by?: User
updated_at?: Date
created_at?: Date
}
}

13
src/vite-env.d.ts vendored
View File

@@ -1,13 +0,0 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_MAXKB_URL: string
readonly VITE_OJ_URL: string
readonly VITE_CODE_URL: string
readonly VITE_JUDGE0_URL: string
readonly VITE_ICONIFY_URL: string
}
interface ImportMeta {
readonly env: ImportMetaEnv
}