aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/site/src
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2024-03-02 03:09:10 +0800
committerGitHub <noreply@github.com>2024-03-02 03:09:10 +0800
commitac0dbc5b1c9b48079e3a450794030b3e0bc6096a (patch)
tree13524a98173b4f7b0b19821e9d8f216134f9e061 /site/src
parent679ca51b78cda9044dc8d8eb3fa246fd76cb227e (diff)
downloadHydroRoll-ac0dbc5b1c9b48079e3a450794030b3e0bc6096a.tar.gz
HydroRoll-ac0dbc5b1c9b48079e3a450794030b3e0bc6096a.zip
refactor(site): rewrite with vuejs (#93)
* chore: update package version * Refactor site (#87) * 补全changelog文件 * 补全changelog文件 * 补全changelog文件 * 完成基本的markdown渲染 * 提交新的css (#88) * 补全changelog文件 * 补全changelog文件 * 补全changelog文件 * 完成基本的markdown渲染 * 添加新的css * Refactor site (#92) * 补全changelog文件 * 补全changelog文件 * 补全changelog文件 * 完成基本的markdown渲染 * 添加新的css * 修复倒计时居中 * 初步完成右侧窗口切换 * 优化进度条 * 导入element-plus * 导入element-plus * 导入element-plus * 加入选中提示和禁用提示 * 修改背景颜色 --------- Co-authored-by: 白咕咕 <67865300+baimianxiao@users.noreply.github.com>
Diffstat (limited to 'site/src')
-rw-r--r--site/src/App.vue2
-rw-r--r--site/src/assets/base.css31
-rw-r--r--site/src/assets/main.css41
-rw-r--r--site/src/components/ChangeLog.vue61
-rw-r--r--site/src/components/Left.vue6
-rw-r--r--site/src/components/Right.vue203
-rw-r--r--site/src/components/RightPage1.vue65
-rw-r--r--site/src/main.ts22
-rw-r--r--site/src/vite-env.d.ts3
9 files changed, 418 insertions, 16 deletions
diff --git a/site/src/App.vue b/site/src/App.vue
index bf7fa55..c70a3fa 100644
--- a/site/src/App.vue
+++ b/site/src/App.vue
@@ -1,6 +1,6 @@
<script setup lang="ts">
import Left from './components/Left.vue'
-import TheWelcome from './components/TheWelcome.vue'
+import TheWelcome from './components/Right.vue'
</script>
<template>
diff --git a/site/src/assets/base.css b/site/src/assets/base.css
index 8816868..fe48a2f 100644
--- a/site/src/assets/base.css
+++ b/site/src/assets/base.css
@@ -1,6 +1,8 @@
/* color palette from <https://github.com/vuejs/theme> */
:root {
- --vt-c-white: #ffffff;
+ /*背景色*/
+ /*--vt-c-white: #ffffff;*/
+ --vt-c-white: #001F3A;
--vt-c-white-soft: #f8f8f8;
--vt-c-white-mute: #f2f2f2;
@@ -8,17 +10,24 @@
--vt-c-black-soft: #222222;
--vt-c-black-mute: #282828;
- --vt-c-indigo: #2c3e50;
+ /*文字色*/
+ /*--vt-c-indigo: #2c3e50;*/
+ --vt-c-indigo: rgba(255,255,255,0.5);
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
- --vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
+ /*边框色*/
+ /*--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);*/
+ --vt-c-divider-light-2: rgba(255, 255, 255, 0.12);
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
+ /*小标题色*/
--vt-c-text-light-1: var(--vt-c-indigo);
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
--vt-c-text-dark-1: var(--vt-c-white);
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
+
+ --vt-c-background: #0000aa;
}
/* semantic color variables for this project */
@@ -34,19 +43,21 @@
--color-text: var(--vt-c-text-light-1);
--section-gap: 160px;
+
+ --icon-highlight: linear-gradient(to right, #00F8F3, #00BDEF);
}
@media (prefers-color-scheme: dark) {
:root {
- --color-background: var(--vt-c-black);
- --color-background-soft: var(--vt-c-black-soft);
- --color-background-mute: var(--vt-c-black-mute);
+ --color-background: var(--vt-c-white);
+ --color-background-soft: var(--vt-c-white-soft);
+ --color-background-mute: var(--vt-c-white-mute);
- --color-border: var(--vt-c-divider-dark-2);
- --color-border-hover: var(--vt-c-divider-dark-1);
+ --color-border: var(--vt-c-divider-light-2);
+ --color-border-hover: var(--vt-c-divider-light-1);
- --color-heading: var(--vt-c-text-dark-1);
- --color-text: var(--vt-c-text-dark-2);
+ --color-heading: var(--vt-c-text-light-1);
+ --color-text: var(--vt-c-text-light-1);
}
}
diff --git a/site/src/assets/main.css b/site/src/assets/main.css
index e8667cd..996e651 100644
--- a/site/src/assets/main.css
+++ b/site/src/assets/main.css
@@ -11,13 +11,17 @@
a,
.green {
text-decoration: none;
- color: hsla(160, 100%, 37%, 1);
+ /*高亮色*/
+ /*color: hsla(160, 100%, 37%, 1);*/
+ color: #00BDEF;
transition: 0.4s;
}
@media (hover: hover) {
a:hover {
- background-color: hsla(160, 100%, 37%, 0.2);
+ /*background-color: hsla(160, 100%, 37%, 0.2);*/
+ color: #00F8F3;
+ text-decoration: underline;
}
}
@@ -33,3 +37,36 @@ a,
padding: 0 2rem;
}
}
+
+.item i {
+ background: linear-gradient(to right, #00F8F3, #00BDEF);
+}
+.item{
+ transition: 0.4s;
+}
+.item:hover{
+ background-color:rgba(255,255,255,0.05);
+}
+.details h3,
+.item i{
+ color:#ffffff;
+}
+
+/*滚动条优化*/
+::-webkit-scrollbar-track {
+ background: rgba(0, 0, 0, 0.1);
+ border-radius: 0;
+}
+
+::-webkit-scrollbar {
+ -webkit-appearance: none;
+ width: 6px;
+ height: 6px;
+}
+
+::-webkit-scrollbar-thumb {
+ cursor: pointer;
+ border-radius: 5px;
+ background: rgba(0, 0, 0, 0.15);
+ transition: color 0.2s ease;
+}
diff --git a/site/src/components/ChangeLog.vue b/site/src/components/ChangeLog.vue
new file mode 100644
index 0000000..e58ee39
--- /dev/null
+++ b/site/src/components/ChangeLog.vue
@@ -0,0 +1,61 @@
+<script lang="ts">
+import axios from 'axios';
+
+export default {
+ data() {
+ return {
+ ChangeLogMessage: 'testChangeLogMessage',
+ }
+ },
+ props: {
+ msg: {
+ type: String,
+ require: true
+ },
+ date: {
+ type: Date,
+ default: new Date('2024-07-14T12:00:00Z')
+ }
+ },
+ methods: {
+ getChangeLog() {
+ axios.get('https://api.github.com/repos/HydroRoll-Team/HydroRoll/releases/latest').then(res => {
+
+ this.ChangeLogMessage ="## "+ res.data['tag_name']+"\n"+res.data['body'];
+ console.log(res.data);
+ })
+ }
+ },
+ beforeMount() {
+ this.getChangeLog()
+ }
+
+}
+</script>
+
+
+<template>
+ <div class="details" style="overflow-y:scroll;overflow-x:hidden;height:100%">
+ <h3>
+ ChangeLog
+ </h3>
+ <v-md-preview :text="ChangeLogMessage"></v-md-preview>
+ </div>
+</template>
+
+
+<style scoped>
+
+
+h3 {
+ font-size: 1.2rem;
+ font-weight: 500;
+ margin-bottom: 0.4rem;
+ color: var(--color-heading);
+}
+
+.details {
+ flex: 1;
+ margin-left: 1rem;
+}
+</style>
diff --git a/site/src/components/Left.vue b/site/src/components/Left.vue
index 94a90ec..672ba36 100644
--- a/site/src/components/Left.vue
+++ b/site/src/components/Left.vue
@@ -65,12 +65,18 @@ h3 {
}
.greetings h1,
+.greetings h2 {
+ text-align: center;
+}
.greetings h3 {
text-align: center;
}
@media (min-width: 1024px) {
.greetings h1,
+ .greetings h2 {
+ text-align: left;
+ }
.greetings h3 {
text-align: left;
}
diff --git a/site/src/components/Right.vue b/site/src/components/Right.vue
new file mode 100644
index 0000000..055d11b
--- /dev/null
+++ b/site/src/components/Right.vue
@@ -0,0 +1,203 @@
+<script lang="ts">
+import ChangeLog from './ChangeLog.vue'
+import RightPage1 from './RightPage1.vue'
+import DocumentationIcon from './icons/IconDocumentation.vue'
+
+export default {
+ data() {
+ return {
+ mainPage: 1,
+ changelogDisplay: "",
+ page2Display: "none",
+ page3Display: "none",
+ page4Display: "none",
+ icon1Back: "var(--icon-highlight)",
+ icon2Back: "",
+ icon3Back: "",
+ icon4Back: "",
+ }
+ },
+ components: {
+ ChangeLog,
+ RightPage1,
+ DocumentationIcon
+ },
+ methods: {
+ control_page(type: string, n: number) {
+ if (type == "over") {
+ this.mainPage = n
+ this.change_page(n)
+ }
+ if (type == "click") {
+ this.mainPage = n
+ this.change_page(n)
+ }
+ if (type == "out") {
+ this.change_page(this.mainPage)
+ }
+ },
+ change_page(n: number) {
+ if (n == 1) {
+ this.changelogDisplay = "";
+ this.page2Display = "none";
+ this.page3Display = "none";
+ this.page4Display = "none";
+ this.icon1Back = "var(--icon-highlight)";
+ this.icon2Back = "var(--color-border)";
+ this.icon3Back = "var(--color-border-hover)";
+ this.icon4Back = "var(--color-border-hover)";
+ } else if (n == 2) {
+ this.changelogDisplay = "none";
+ this.page2Display = "";
+ this.page3Display = "none";
+ this.page4Display = "none";
+ this.icon1Back = "var(--color-border)";
+ this.icon2Back = "var(--icon-highlight)";
+ this.icon3Back = "var(--color-border-hover)";
+ this.icon4Back = "var(--color-border-hover)";
+ } else if (n == 3) {
+ this.changelogDisplay = "none";
+ this.page2Display = "none";
+ this.page3Display = "";
+ this.page4Display = "none";
+ this.icon1Back = "var(--color-border)";
+ this.icon2Back = "var(--color-border)";
+ this.icon3Back = "var(--color-border-hover)";
+ this.icon4Back = "var(--color-border-hover)";
+ } else if (n == 4) {
+ this.changelogDisplay = "none";
+ this.page2Display = "none";
+ this.page3Display = "none";
+ this.page4Display = "";
+ this.icon1Back = "var(--color-border)";
+ this.icon2Back = "var(--color-border)";
+ this.icon3Back = "var(--color-border-hover)";
+ this.icon4Back = "var(--color-border-hover)";
+ }
+
+ }
+ }
+}
+
+</script>
+
+<template>
+ <div class="item">
+ <el-tooltip content="ChangeLog" placement="left">
+ <i :style="{background:icon1Back}" @mouseover="control_page('over',1)" @click="control_page('click',1)"
+ @mouseout="control_page('out',1)">
+ <DocumentationIcon/>
+ </i>
+ </el-tooltip>
+ <el-tooltip content="Page2" placement="left">
+ <i :style="{background:icon2Back}" @mouseover="control_page('over',2)" @click="control_page('click',2)"
+ @mouseout="control_page('out',2)">
+ <DocumentationIcon/>
+ </i>
+ </el-tooltip>
+ <el-tooltip content="敬请期待" placement="left">
+ <i :style="{background:icon3Back}" @mouseover="control_page('over',3)" @click="control_page('click',3)"
+ @mouseout="control_page('out',3)">
+ <DocumentationIcon/>
+ </i>
+ </el-tooltip>
+ <el-tooltip content="敬请期待" placement="left">
+ <i :style="{background:icon4Back}" @mouseover="control_page('over',4)" @click="control_page('click',4)"
+ @mouseout="control_page('out',4)">
+ <DocumentationIcon/>
+ </i>
+ </el-tooltip>
+ <div>
+ <ChangeLog :style="{display:changelogDisplay}"/>
+ <RightPage1 title="Test Page 2" :style="{display:page2Display}"/>
+ <RightPage1 title="Test Page 3" :style="{display:page3Display}"/>
+ <RightPage1 title="Test Page 4" :style="{display:page4Display}"/>
+ </div>
+ </div>
+
+</template>
+
+<style>
+
+.item {
+ height: 600px;
+ margin-top: 2rem;
+ display: flex;
+ position: relative;
+}
+
+
+i {
+ display: flex;
+ place-items: center;
+ place-content: center;
+ width: 32px;
+ height: 32px;
+ color: var(--color-text);
+}
+
+
+h3 {
+ font-size: 1.2rem;
+ font-weight: 500;
+ margin-bottom: 0.4rem;
+ color: var(--color-heading);
+}
+
+@media (min-width: 1024px) {
+ .item {
+ margin-top: 0;
+ padding: 0.4rem 0 1rem calc(var(--section-gap) / 2);
+ }
+
+ i {
+ left: -26px;
+ position: absolute;
+ border-radius: 8px;
+ width: 50px;
+ height: 50px;
+ }
+
+ div i:nth-child(1) {
+ top: calc(20% - 25px);
+ }
+
+ div i:nth-child(2) {
+ top: calc(40% - 25px);
+ }
+
+ div i:nth-child(3) {
+ top: calc(60% - 25px);
+ }
+
+ div i:nth-child(4) {
+ top: calc(80% - 25px);
+ }
+
+ .item:before {
+ content: ' ';
+ border-left: 1px solid var(--color-border);
+ position: absolute;
+ left: 0;
+ bottom: calc(50% + 25px);
+ height: calc(50% - 25px);
+ }
+
+ .item:after {
+ content: ' ';
+ border-left: 1px solid var(--color-border);
+ position: absolute;
+ left: 0;
+ top: calc(50% + 25px);
+ height: calc(50% - 25px);
+ }
+
+ .item:first-of-type:before {
+ display: none;
+ }
+
+ .item:last-of-type:after {
+ display: none;
+ }
+}
+</style>
diff --git a/site/src/components/RightPage1.vue b/site/src/components/RightPage1.vue
new file mode 100644
index 0000000..5b93ea8
--- /dev/null
+++ b/site/src/components/RightPage1.vue
@@ -0,0 +1,65 @@
+<script lang="ts">
+import axios from "axios";
+
+export default {
+ data() {
+ return {
+ ChangeLogTagName: "beta",
+ ChangeLogMessage: 'testChangeLogMessage',
+ }
+ },
+ props: {
+ title: {
+ type: String,
+ default: "1",
+ },
+ msg: {
+ type: String,
+ require: true
+ },
+ date: {
+ type: Date,
+ default: new Date('2024-07-14T12:00:00Z')
+ }
+ },
+ methods: {
+ getChangeLog() {
+ axios.get('https://api.github.com/repos/HydroRoll-Team/HydroRoll/releases/latest').then(res => {
+ this.ChangeLogTagName = res.data['tag_name'];
+ this.ChangeLogMessage = res.data['body'];
+ console.log(res.data);
+ })
+ }
+ },
+ beforeMount() {
+ this.getChangeLog()
+ }
+}
+</script>
+
+
+<template>
+ <div class="details" style="overflow-y:scroll;overflow-x:hidden;height:100%">
+ <h3>
+ {{ title }}
+ </h3>
+ <v-md-preview :text="ChangeLogMessage"></v-md-preview>
+ </div>
+</template>
+
+
+<style scoped>
+
+
+h3 {
+ font-size: 1.2rem;
+ font-weight: 500;
+ margin-bottom: 0.4rem;
+ color: var(--color-heading);
+}
+
+.details {
+ flex: 1;
+ margin-left: 1rem;
+}
+</style>
diff --git a/site/src/main.ts b/site/src/main.ts
index 11c062f..6bb9085 100644
--- a/site/src/main.ts
+++ b/site/src/main.ts
@@ -4,19 +4,35 @@
* Bootstraps Vuetify and other plugins then mounts the App`
*/
+
// Components
import App from './App.vue'
-// Composables
+// Composable
import { createApp } from 'vue'
// Plugins
import { registerPlugins } from '@/plugins'
import './assets/main.css'
+import VMdPreview from '@kangc/v-md-editor/lib/preview';
+import '@kangc/v-md-editor/lib/style/preview.css';
+import githubTheme from '@kangc/v-md-editor/lib/theme/github.js';
+import '@kangc/v-md-editor/lib/theme/style/github.css';
+import ElementPlus from 'element-plus'
+import 'element-plus/dist/index.css'
+// highlights
+import hljs from 'highlight.js';
+
+VMdPreview.use(githubTheme, {
+ Hljs: hljs,
+});
-const app = createApp(App)
-registerPlugins(app)
+
+const app = createApp(App)
+app.use(VMdPreview)
+app.use(ElementPlus)
+registerPlugins(app)
app.mount('#app')
diff --git a/site/src/vite-env.d.ts b/site/src/vite-env.d.ts
index 323c78a..7d17c38 100644
--- a/site/src/vite-env.d.ts
+++ b/site/src/vite-env.d.ts
@@ -5,3 +5,6 @@ declare module '*.vue' {
const component: DefineComponent<{}, {}, any>
export default component
}
+declare module '@kangc/v-md-editor/lib/preview';
+declare module '@kangc/v-md-editor/lib/theme/github.js';
+declare module 'prismjs';