环境变量

This commit is contained in:
2025-05-08 19:40:02 +08:00
parent 2bdaf8a192
commit c9b88574a2
4 changed files with 23 additions and 9 deletions

8
.env.production Normal file
View File

@@ -0,0 +1,8 @@
VITE_OJ=https://oj.xuyue.cc
VITE_CODE=https://code.xuyue.cc
VITE_WEB=https://web.xuyue.cc
VITE_PLAY=https://play.xuyue.cc
VITE_BOOK=https://book.xuyue.cc
VITE_HUABU=https://huabu.xuyue.cc
VITE_PPT=https://ppt.xuyue.cc/py
VITE_PY=https://python.xuyue.cc

5
.env.staging Normal file
View File

@@ -0,0 +1,5 @@
VITE_OJ=http://10.13.114.214:81
VITE_CODE=http://10.13.114.214:82
# VITE_PLAY=http://10.13.114.214:83
VITE_BOOK=http://10.13.114.214:84
VITE_HUABU=http://10.13.114.214:85

18
main.js
View File

@@ -21,46 +21,46 @@ const pins = [
const sites = [ const sites = [
{ {
url: "https://oj.xuyue.cc", url: import.meta.env.VITE_OJ,
title: "判题狗", title: "判题狗",
description: "在线判题网站", description: "在线判题网站",
}, },
{ {
url: "https://code.xuyue.cc", url: import.meta.env.VITE_CODE,
title: "自测猫", title: "自测猫",
description: "代码运行网站", description: "代码运行网站",
}, },
{ {
url: "https://web.xuyue.cc", url: import.meta.env.VITE_WEB,
title: "AI x Web", title: "AI x Web",
description: "AI x Web 新势力", description: "AI x Web 新势力",
}, },
{ {
url: "https://play.xuyue.cc", url: import.meta.env.VITE_PLAY,
title: "限时鸭", title: "限时鸭",
description: "用来练习基本的代码格式", description: "用来练习基本的代码格式",
}, },
{ {
url: "https://book.xuyue.cc", url: import.meta.env.VITE_BOOK,
title: "编程书", title: "编程书",
description: "编程和计算机相关知识汇总", description: "编程和计算机相关知识汇总",
}, },
{ {
url: "https://huabu.xuyue.cc", url: import.meta.env.VITE_HUABU,
title: "白板", title: "白板",
description: "在线板书", description: "在线板书",
}, },
{ {
url: "https://ppt.xuyue.cc/py", url: import.meta.env.VITE_PPT,
title: "Python PPT", title: "Python PPT",
description: "Python 第一学期上课用", description: "Python 第一学期上课用",
}, },
{ {
url: "https://python.xuyue.cc", url: import.meta.env.VITE_PY,
title: "Python 项目", title: "Python 项目",
description: "Python 第二学期上课用", description: "Python 第二学期上课用",
}, },
] ].filter(i => !!i.url)
const item = (site) => ` const item = (site) => `
<a href="${site.url}" target="_blank" class="card"> <a href="${site.url}" target="_blank" class="card">

View File

@@ -6,6 +6,7 @@
"scripts": { "scripts": {
"start": "vite", "start": "vite",
"build": "vite build", "build": "vite build",
"build:staging": "vite build --mode=staging",
"fmt": "prettier --write *.js style.css index.html" "fmt": "prettier --write *.js style.css index.html"
}, },
"devDependencies": { "devDependencies": {