Skip to content

Commit 3e45dab

Browse files
committed
feat(link): 将页面的转跳改为由浏览器打开
增加了“关于”页面 优化了体验 更换了 logo
1 parent 5093868 commit 3e45dab

13 files changed

+879
-50
lines changed

README.md

+29-21
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# Codeforces Client
22

3-
这是一个 codeforces 的本地客户端系统
3+
**Copyleft (c) 2020.Mauve**
4+
5+
## Codeforces 打开好慢,加载题面好慢
6+
7+
这是一个 codeforces 的本地客户端系统。通过减少拉取的数据量来实现加速 codeforces
8+
9+
**注意:本系统仅减少拉取数据量,并非加速拉取**
410

511
使用 vue 进行编译,后对编译后的文件使用 Electron 打包
612

7-
[下载地址](https://github.com/Hukeqing/codeforces-client/releases/tag/0.2.0)
13+
[下载地址](https://github.com/Hukeqing/codeforces-client/releases/tag/0.4.0)
814

915
## 功能列表
1016
- [x] 登录(0.1.0)
@@ -16,31 +22,33 @@
1622
- [x] 本地渲染题面(0.2.0)
1723
- [x] 缓存题面(0.3.0)
1824
- [ ] 查看某次提交记录
19-
- [x] 缓存管理系统
25+
- [x] 缓存管理系统(0.4.0)
2026
- [ ] css 自定义页面
21-
- [x] 解除加载锁定
22-
- [x] 加快获取 XCsrfToken
27+
- [x] 加快获取 XCsrfToken(0.4.0)
28+
- [x] 题面中的链接使用本地浏览器打开(0.5.0)
29+
- [ ] problemset 页面
30+
- [ ] 多语言
31+
- [ ] 将项目转为 electron-vue 项目
2332

2433
## 本地编译使用方法
25-
**由于同源策略,本地使用时会出现同源策略问题**
26-
### Project setup
27-
```
28-
npm install
29-
```
34+
**由于同源策略,如果使用 vue 编译后的文件将会无法正常运行**
3035

31-
#### Compiles and hot-reloads for development
32-
```
33-
npm run serve
34-
```
36+
**若需要正确在本地编译使用请对编译后的文件使用 Electron 第二次编译**
3537

36-
#### Compiles and minifies for production
37-
```
38+
```shell script
39+
git clone https://github.com/Hukeqing/codeforces-client.git
40+
cd codeforces-client
41+
npm install
3842
npm run build
43+
cp ./scr/main/* dist/
44+
npm install
45+
npm run package
3946
```
4047

41-
#### Lints and fixes files
42-
```
43-
npm run lint
44-
```
48+
如果你熟悉 `yarn` 也可以使用 `yarn` 进行编译运行
49+
50+
## 许可证
51+
52+
Codeforces Client 使用 GPL 许可证开源
53+
4554

46-
**若需要正确在本地编译使用请对编译后的文件使用 Electron 第二次编译**

public/favicon.ico

-210 KB
Binary file not shown.

src/components/Home.vue

+14-5
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,24 @@
3333
比赛题目列表
3434
</span>
3535
</el-menu-item>
36-
<el-menu-item index="6">
36+
<el-menu-item index="7">
3737
<span slot="title">
3838
<i class="el-icon-document"></i>
3939
比赛题面
4040
</span>
4141
</el-menu-item>
42-
<el-menu-item index="7">
42+
<el-menu-item index="8">
4343
<span slot="title">
4444
<i class="el-icon-folder"></i>
4545
本地缓存
4646
</span>
4747
</el-menu-item>
48+
<el-menu-item index="9">
49+
<span slot="title">
50+
<i class="el-icon-info"></i>
51+
关于
52+
</span>
53+
</el-menu-item>
4854
</el-menu>
4955
</el-aside>
5056
<el-main id="main">
@@ -54,9 +60,10 @@
5460
<Status v-if="status===3" :user="user"></Status>
5561
<ContestList v-if="status===4" v-on:enterContest="enterContest"></ContestList>
5662
<Contest v-if="status===5" :contestId="contestId" v-on:enterProblem="enterProblem"></Contest>
57-
<Problem v-if="status===6" :contestId="contestId" :problemId="problemId"
63+
<Problem v-if="status===7" :contestId="contestId" :problemId="problemId"
5864
v-on:submitProblem="submitProblem" v-on:loadProblem="loadProblem"></Problem>
59-
<LocalManager v-if="status===7"></LocalManager>
65+
<LocalManager v-if="status===8"></LocalManager>
66+
<Info v-if="status===9"></Info>
6067
</el-main>
6168
</el-container>
6269
</el-container>
@@ -70,6 +77,7 @@ import ContestList from "@/components/ContestList";
7077
import Contest from "@/components/Contest";
7178
import Problem from "@/components/Problem";
7279
import LocalManager from "@/components/LocalManager";
80+
import Info from "@/components/Info";
7381
7482
export default {
7583
name: "Home",
@@ -91,7 +99,8 @@ export default {
9199
ContestList,
92100
Contest,
93101
Problem,
94-
LocalManager
102+
LocalManager,
103+
Info
95104
},
96105
97106
methods: {

src/components/Info.vue

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<template>
2+
<div>
3+
<h1 style="font-size: 50px">
4+
Codeforces Client
5+
</h1>
6+
<h2>
7+
<a href="https://github.com/Hukeqing/codeforces-client" target="_blank"
8+
style="text-decoration:none;color: #3a8ee6; margin-right: 40px">Source Code</a>
9+
<a href="https://github.com/Hukeqing/codeforces-client/releases" target="_blank"
10+
style="text-decoration:none;color: #3a8ee6; margin-left: 40px">Latest Release</a>
11+
</h2>
12+
</div>
13+
</template>
14+
15+
<script>
16+
export default {
17+
name: "Info",
18+
}
19+
</script>
20+
21+
<style scoped>
22+
23+
</style>

src/components/LocalManager.vue

+18-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
v-on:click="removeUser">
55
删除账号信息
66
</el-button>
7+
<span style="margin-left: 60px">总内存占用:{{ (memoryTotal) }} KB(非准确值)</span>
78
<el-table :data="problems"
89
style="width: 100%"
910
v-loading="loading">
@@ -15,7 +16,7 @@
1516
</el-table-column>
1617
<el-table-column
1718
prop="memory"
18-
label="占用内存"
19+
label="占用内存(KB)"
1920
align="center"
2021
min-width="100">
2122
</el-table-column>
@@ -48,22 +49,36 @@ export default {
4849
4950
created() {
5051
this.loading = true
51-
if (window.localStorage.getItem('email') != null)
52+
if (window.localStorage.getItem('email') != null) {
5253
this.account = true
54+
}
5355
if (window.localStorage.savedProblem != null) {
5456
let problemList = window.localStorage.savedProblem
5557
problemList = problemList.split(';')
5658
for (let i = 0; i < problemList.length - 1; ++i) {
5759
let pro = {
5860
id: problemList[i],
59-
memory: window.localStorage.getItem(problemList[i]).length / 1024 + 'KB'
61+
memory: window.localStorage.getItem(problemList[i]).length / 1024
6062
}
6163
this.problems.push(pro)
6264
}
6365
}
6466
this.loading = false
6567
},
6668
69+
computed: {
70+
memoryTotal() {
71+
let total = 0
72+
for (let i = 0; i < this.problems.length; ++i)
73+
total += this.problems[i].memory
74+
if (this.account)
75+
total += (window.localStorage.email.length + window.localStorage.password.length) / 1024
76+
if (window.localStorage.getItem('email') != null)
77+
total += window.localStorage.savedProblem.length / 1024
78+
return total
79+
}
80+
},
81+
6782
methods: {
6883
remove(index) {
6984
window.localStorage.removeItem(this.problems[index].id)

src/components/Login.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
<el-button type="primary" v-on:click="back()" style="width: 120px" round>返回</el-button>
2323
</div>
2424
<div class="inline-div" v-if="user!==''">
25-
<h1 style="font-size: 20px; font-weight: bolder">
26-
已经获取到登录的账号信息
25+
<h1 style="font-size: 18px; font-weight: bolder">
26+
已经获取到登录的账号信息:{{user}}
2727
</h1>
2828
<el-button type="primary" v-on:click="back()" style="width: 120px" round>返回</el-button>
2929
<el-button type="primary" v-on:click="toLogout()" style="width: 120px" round>退出登录</el-button>

src/components/Problem.vue

-11
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,6 @@
6262

6363
</div>
6464
</div>
65-
66-
<el-dialog
67-
title="提示"
68-
:visible.sync="dialogVisible"
69-
width="30%">
70-
<el-input v-model="curLink" :disabled="true"></el-input>
71-
<span slot="footer" class="dialog-footer">
72-
<el-button @click="dialogVisible = false">关 闭</el-button>
73-
<el-button type="primary" @click="dialogVisible = false">复 制</el-button>
74-
</span>
75-
</el-dialog>
7665
</div>
7766
</template>
7867

src/components/Submit.vue

+10-6
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,16 @@ export default {
141141
this.$message.error('当前未登录')
142142
return
143143
}
144-
let loading = this.$loading({
145-
lock: true,
146-
text: '正在提交',
147-
target: document.getElementById('main'),
148-
background: 'rgba(0, 0, 0, 0.7)'
144+
this.$message({
145+
type: 'info',
146+
message: '你的提交正在提交中,你可以继续进行其他操作'
149147
})
148+
// let loading = this.$loading({
149+
// lock: true,
150+
// text: '正在提交',
151+
// target: document.getElementById('main'),
152+
// background: 'rgba(0, 0, 0, 0.7)'
153+
// })
150154
common.getXCsrfToken((e, x) => {
151155
submit.submitCode(x, this.myCid, this.myPid, this.code, this.languageSelect, e => {
152156
if (e) {
@@ -155,7 +159,7 @@ export default {
155159
this.$message.success('提交大概是成功了')
156160
this.$emit('submitOver', {contest: this.myCid, id: this.myPid})
157161
}
158-
loading.close()
162+
// loading.close()
159163
})
160164
})
161165
}

src/main/main.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
const { app, BrowserWindow, Menu, shell } = require('electron')
2+
3+
function createWindow() {
4+
Menu.setApplicationMenu(null)
5+
// 创建浏览器窗口
6+
const win = new BrowserWindow({
7+
width: 800,
8+
height: 600,
9+
webPreferences: {
10+
nodeIntegration: true
11+
}
12+
})
13+
14+
// 并且为你的应用加载index.html
15+
win.loadFile('index.html')
16+
}
17+
18+
// This method will be called when Electron has finished
19+
// initialization and is ready to create browser windows.
20+
// 部分 API 在 ready 事件触发后才能使用。
21+
app.whenReady().then(createWindow)
22+
23+
// Quit when all windows are closed.
24+
app.on('window-all-closed', () => {
25+
// 在 macOS 上,除非用户用 Cmd + Q 确定地退出,
26+
// 否则绝大部分应用及其菜单栏会保持激活。
27+
if (process.platform !== 'darwin') {
28+
app.quit()
29+
}
30+
})
31+
32+
app.on('activate', () => {
33+
// 在macOS上,当单击dock图标并且没有其他窗口打开时,
34+
// 通常在应用程序中重新创建一个窗口。
35+
if (BrowserWindow.getAllWindows().length === 0) {
36+
createWindow()
37+
}
38+
})
39+
40+
app.on('web-contents-created', (e, webContents) => {
41+
webContents.on('new-window', (event, url) => {
42+
event.preventDefault();
43+
shell.openExternal(url);
44+
});
45+
});
46+
47+
// In this file you can include the rest of your app's specific main process
48+
// code. 也可以拆分成几个文件,然后用 require 导入。

0 commit comments

Comments
 (0)