Skip to content

Commit 16cc145

Browse files
committed
fix: 链接文档和其它小问题
1 parent ee7a104 commit 16cc145

16 files changed

Lines changed: 202 additions & 48 deletions

File tree

README.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
11
# 专业通关指南
22

3-
现有的专业指南方案如[浙大图灵班学习指南](https://zju-turing.github.io/TuringCourses/)使用 mkdocs,不方便其它专业背景的同学部署和使用。我们试图制作一个方便使用的类似文档系统,支持由培养计划、课表导入课程安排、验证学校邮箱登录、修改指南、提交选课评价等。
3+
## 动机
4+
5+
现有的专业指南方案如[浙大图灵班学习指南](https://zju-turing.github.io/TuringCourses/)使用 mkdocs,不方便其它专业背景的同学部署和使用。我们试图制作一个方便使用的类似文档系统,支持由培养计划、课表导入课程安排、验证学校邮箱登录、修改指南、提交选课评价等。
6+
7+
## 部署
8+
9+
将以下内容保存至 `docker-compose.yml`
10+
11+
```yml
12+
version: '3'
13+
14+
services:
15+
nuxt-app:
16+
image: acfboy/pro-pass-guide:latest
17+
container_name: pro-pass-guide
18+
ports:
19+
- "3000:3000"
20+
volumes:
21+
- ./uploads:/app/uploads
22+
environment:
23+
- NUXT_PUBLIC_SITE_TITLE=兰州大学专业通关指南
24+
- NUXT_PUBLIC_SITE_SUBTITLE=面向全校同学的专业学习经验总结分享平台。凭学校邮箱可注册并提交你的贡献。
25+
- NUXT_MONGO_DB_URL=mongodb://mongo:27017/
26+
- NUXT_PUBLIC_REQUIRED_EMAIL_DOMAIN=限制域名后缀
27+
- NUXT_SESSION_PASSWORD=随机串
28+
- NUXT_MAIL_PASSWORD=邮件 smtp 密码
29+
- NUXT_MAIL_HOST=邮件验证码 smtp 地址
30+
- NUXT_MAIL_USER=邮件账号
31+
- NUXT_MAIL_HOSTNAME=邮件验证码名字
32+
- NUXT_UPLOAD_DIR=/app/uploads
33+
depends_on:
34+
- mongo
35+
restart: always
36+
37+
mongo:
38+
image: mongo:latest
39+
container_name: mongo
40+
volumes:
41+
- ./mongo-data:/data/db
42+
ports:
43+
- "27017:27017"
44+
restart: always
45+
```
46+
47+
然后在目录下运行
48+
49+
```bash
50+
docker compose up
51+
```
52+
53+
访问 localhost:3000 即可看到首页。
54+
55+
## 贡献
56+
57+
项目采用 Nuxt.js 框架,Vuetify 作为前端框架。欢迎任何形式的贡献。

app.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const config = useRuntimeConfig();
2626
2727
const router = useRouter();
2828
29-
// 侧边栏状态管理
3029
const sidebarDrawer = ref(true);
3130
function toggleSidebar() {
3231
sidebarDrawer.value = !sidebarDrawer.value;

components/TopTabs.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
</v-card>
3131
</v-menu>
3232

33-
<v-btn variant="text" class="ml-6" to="/docs/0/0" :active="false">快速开始</v-btn>
33+
<v-btn variant="text" class="ml-6" to="/docs/0/0" :active="false">简介</v-btn>
3434
<div class="top-tabs-searchbar ml-6">
3535
<SearchBar />
3636
</div>

nuxt.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ export default defineNuxtConfig({
4141
},
4242
rehypePlugins: {
4343
"rehype-mathjax": {},
44-
}
44+
},
45+
},
46+
vuetify: {
47+
vuetifyOptions: {
48+
locale: {
49+
locale: "zhHans",
50+
},
51+
localeMessages: ['zhHans'],
52+
},
4553
},
4654
});

pages/docs/[major]/[doc].vue

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
</v-row>
1414
<v-chip v-if="course?.grade" class="mr-1" density="compact" color="green">
1515
<v-icon icon="mdi-star" class="mr-1" />
16-
学分:{{ course?.grade }}
16+
学分:{{ course?.credit }}
1717
</v-chip>
18-
<v-chip v-if="course?.class" class="mr-1" density="compact" color="primary">
18+
<v-chip v-if="course?.class" class="mr-1" density="compact" color="primary">
1919
<v-icon icon="mdi-label-outline" class="mr-1" />
2020
{{ course?.class }}
2121
</v-chip>
@@ -27,22 +27,26 @@
2727
}}
2828
</v-chip>
2929

30-
<MDC v-if="course" class="mt-4" :value="course?.doc_str" tag="article" />
30+
<div class="article">
31+
<MDC v-if="course" class="mt-4" :value="course?.doc_str" tag="article" />
32+
</div>
3133

32-
<v-divider class="mt-6"/>
34+
<v-divider class="mt-6" />
3335

3436
<v-sheet style="border-left: red solid 4px;" class="mt-6 pl-4" variant="text">
3537
<span>
3638
<p class="text-disabled">
3739
<v-icon class="mr-1">mdi-pencil</v-icon>
3840
发现错误?想一起完善?
39-
<a style="color: blue" class="text-decoration-none cursor-pointer" @click="navigateTo(`/edit/${majorId}/${docId}`)">编辑此页</a>
41+
<a style="color: blue" class="text-decoration-none cursor-pointer"
42+
@click="navigateTo(`/edit/${majorId}/${docId}`)">编辑此页</a>
4043
</p>
41-
44+
4245
<p class="text-disabled">
4346
<v-icon class="mr-1">mdi-code-braces</v-icon>
4447
网站功能不够完善,我想贡献!
45-
<a href="https://github.com/Acfboy/ProPassGuide" class=" text-decoration-none">在 Github 上贡献代码</a>
48+
<a href="https://github.com/Acfboy/ProPassGuide" class=" text-decoration-none">在 Github
49+
上贡献代码</a>
4650
</p>
4751
</span>
4852
</v-sheet>
@@ -51,8 +55,10 @@
5155

5256
</v-row>
5357
<v-navigation-drawer floating location="right" class="position-fixed">
58+
<template #prepend>
59+
<p class="text-h6 mt-4">目录</p>
60+
</template>
5461
<div v-if="toc.length" class="toc-container mt-4">
55-
<div class="toc-title">目录</div>
5662
<ul class="toc-list">
5763
<li v-for="item in toc" :key="item.id" :class="{ 'active-toc': activeTocId === item.id }"
5864
:style="{ paddingLeft: (item.level - 1) * 16 + 'px' }">
@@ -88,6 +94,16 @@ const { data: course } = await useAsyncData(`major-${majorId}-${docId}`, () =>
8894
})
8995
);
9096
97+
if (course.value?.link) {
98+
course.value = await
99+
requestFetch<CourseWithDbId>("/api/courses/doc", {
100+
method: "GET",
101+
query: {
102+
major: course.value.link.major_id,
103+
course: course.value.link.course_id,
104+
}
105+
})
106+
}
91107
92108
interface TocItem {
93109
level: number;
@@ -183,6 +199,7 @@ h4 a,
183199
h5 a,
184200
h6 a {
185201
color: black;
202+
font-weight: 500;
186203
text-decoration: none;
187204
}
188205
@@ -239,4 +256,16 @@ h6 {
239256
border-left: #1565c0 solid 2px;
240257
font-size: 0.98rem;
241258
}
259+
260+
.article p {
261+
line-height: 1.8;
262+
}
263+
264+
265+
.article li {
266+
line-height: 1.8;
267+
margin-left: 1em;
268+
margin-top: 0.5em;
269+
margin-bottom: 0.5em;
270+
}
242271
</style>

pages/edit/[major].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const requestFetch = useRequestFetch();
119119
/**
120120
* 分年级和类别的课程列表
121121
*/
122-
const { data: listItems } = await useAsyncData(`major-${majorId}`, () =>
122+
const { data: listItems } = await useAsyncData(`major-${majorId}-edit`, () =>
123123
requestFetch<CourseInfo[]>("/api/courses", {
124124
method: "GET",
125125
query: {

pages/edit/[major]/[doc].vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
</v-snackbar>
137137
</div>
138138
<div v-else>
139-
<v-row justify="center">
139+
<v-row justify="center" class="mt-8">
140140
<v-sheet class="pa-4 ma-4 text-center mx-auto" elevation="12" max-width="600" rounded="lg" width="100%">
141141
<v-icon class="mb-5" color="success" icon="mdi-check-circle" size="112"/>
142142

@@ -447,6 +447,7 @@ h3 a,
447447
h4 a,
448448
h5 a,
449449
h6 a {
450+
font-weight: 400;
450451
color: black;
451452
text-decoration: none;
452453
}

pages/index.vue

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,11 @@
55
<p class="text-h2 font-weight-bold mb-4">{{ runtimeConfig.public.siteTitle }}</p>
66
<p class="text-disabled text-h6">{{ runtimeConfig.public.siteSubtitle }}</p>
77
<div class="mt-4">
8-
<v-btn class="ma-4" variant="flat" size="large" color="primary" @click="navigateTo('/docs/0/0')">快速上手</v-btn>
8+
<v-btn class="ma-4" variant="flat" size="large" color="primary" @click="navigateTo('/docs/0/0')">简介</v-btn>
99
<v-btn class="ma-4" variant="outlined" size="large" color="primary" @click="navigateTo('/signup')">立即注册</v-btn>
1010
</div>
1111
</v-col>
1212
</v-row>
13-
14-
<!-- <v-row>
15-
<v-col>
16-
<v-btn>快速上手</v-btn>
17-
</v-col>
18-
<v-col>
19-
<v-btn>立即注册</v-btn>
20-
</v-col>
21-
</v-row> -->
2213
</v-container>
2314
</template>
2415

pages/review/docs/[id].vue

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<template>
22
<div ref="totalSpace" style="height: 100%;">
3-
{{ errorPrompt }}
43
<v-row ref="row1Space" class="ml-1 mr-1 mt-4">
54
<v-col>
65
<v-text-field v-if="proposalWithDoc" v-model="proposalWithDoc.proposal.course_name" variant="outlined"
@@ -76,21 +75,21 @@
7675
</v-col>
7776
</v-row>
7877
<v-row v-if="proposalWithDoc && proposalWithDoc.proposal.link && !proposalWithDoc.proposal.del_id"
79-
justify="center" class="ml-1 mr-1">
80-
<button v-if="proposalWithDoc.oriDoc.link"
78+
justify="center" class="ma-4">
79+
<v-btn v-if="proposalWithDoc.oriDoc.link"
8180
:to="`/docs/${proposalWithDoc.oriDoc.link.major_id}/${proposalWithDoc.oriDoc.link.course_id}`">
8281
查看原先指向的页面
83-
</button>
84-
<button class="ml-2"
82+
</v-btn>
83+
<v-btn class="ml-2"
8584
:to="`/docs/${proposalWithDoc.proposal.link.major_id}/${proposalWithDoc.proposal.link.course_id}`">
8685
查看更新后指向的页面
87-
</button>
86+
</v-btn>
8887
</v-row>
8988
<v-row v-if="proposalWithDoc && proposalWithDoc.proposal.del_id">
90-
<button class="ma-2"
89+
<v-btn class="ma-2"
9190
:to="`/docs/${proposalWithDoc.proposal.major_id}/${proposalWithDoc.proposal.course_id}`">
9291
查看要删除的页面
93-
</button>
92+
</v-btn>
9493
</v-row>
9594

9695
<v-row v-if="proposalWithDoc && !proposalWithDoc.proposal.link" ref="row3Space" class="ml-4 mr-4 mt-4">

pages/user.vue

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,32 @@
1616
</v-card-item>
1717

1818
<v-card-text v-if="data">
19-
<v-row class="ma-2">
19+
<v-row>
2020
<v-col class=" text-center">
21-
<p class="text-h2"> {{ data.doc.length + data.major.length }}</p>
21+
<p class="text-h3"> {{ data.doc.length + data.major.length }}</p>
2222

2323
<p class="text-center text-disabled mt-2" color="success"><v-icon
2424
class="mr-2">mdi-file-outline</v-icon>提交申请
2525
</p>
2626
</v-col>
2727
<v-col class=" text-center">
28-
<p class="text-h2"> {{data.doc.filter(c => c.proposal?.accept === true).length +
28+
<p class="text-h3"> {{data.doc.filter(c => c.proposal?.accept === true).length +
2929
data.major.filter(c => c.proposal?.accept === true).length}}</p>
3030

3131
<p class="text-center text-disabled mt-2" color="success"><v-icon
3232
class="mr-2">mdi-check-all</v-icon>通过申请
3333
</p>
3434
</v-col>
3535
<v-col class=" text-center">
36-
<p class="text-h2"> {{data.doc.filter(c => (typeof c.proposal?.accept) === "string").length
36+
<p class="text-h3"> {{data.doc.filter(c => (typeof c.proposal?.accept) === "string").length
3737
+
3838
data.major.filter(c => (typeof c.proposal?.accept) === "string").length}}</p>
3939
<p class="text-center text-disabled mt-2" color="success"><v-icon
4040
class="mr-2">mdi-close</v-icon>被拒绝
4141
</p>
4242
</v-col>
4343
<v-col class=" text-center">
44-
<p class="text-h2"> {{data.doc.filter(c => c.proposal?.accept === false).length +
44+
<p class="text-h3"> {{data.doc.filter(c => c.proposal?.accept === false).length +
4545
data.major.filter(c => c.proposal?.accept === false).length}}</p>
4646
<p class="text-center text-disabled mt-2" color="success"><v-icon
4747
class="mr-2">mdi-loading</v-icon>待审核
@@ -53,7 +53,6 @@
5353
</v-card-text>
5454
<v-divider/>
5555
<v-card-text>
56-
5756
<v-data-table :items="tableItems">
5857
<template #item.状态="{ value }">
5958
<v-icon v-if="value === true" color="success">mdi-check</v-icon>

0 commit comments

Comments
 (0)