Skip to content

Commit

Permalink
✨完成功能
Browse files Browse the repository at this point in the history
  • Loading branch information
hz wang committed May 17, 2023
1 parent b3b6b80 commit 85090e6
Show file tree
Hide file tree
Showing 15 changed files with 157 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default {
],
userEmail: [
{required: true, message: '请输入电子邮箱', trigger: 'blur'},
// {pattern: '^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$', message: '请输入正确的电子邮箱', trigger: 'blur'}
{pattern: '^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(.[a-zA-Z0-9_-]+)+$', message: '请输入正确的电子邮箱', trigger: 'blur'}
],
userAgainPassword: [
{ validator: checkPassword, trigger: 'blur' }
Expand Down
5 changes: 4 additions & 1 deletion pastecode-ui/src/components/pc-code-status.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default {
else {
this.collectNum --;
}
console.log("userId", this.userId);
this.$axios({
method: "post",
url: `${this.$url}/status/update`,
Expand All @@ -100,6 +100,9 @@ export default {
},
upLike() {
console.log("userId", this.userId);
this.isLike = ! this.isLike;
if (this.isLike) {
this.likesNum ++;
Expand Down
10 changes: 5 additions & 5 deletions pastecode-ui/src/components/pc-header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ export default {
</script>

<style scoped>
/*
text-align 的默认值是 left
利用该属性破坏 父组件的 text-align: center 属性
*/
/*
text-align 的默认值是 left
利用该属性破坏 父组件的 text-align: center 属性
*/
#pc-header {
text-align: left;
}
Expand All @@ -91,7 +91,7 @@ export default {
font-size: 16px;
}
#item-login {
left: 72%;
left: 71%;
}
.el-dropdown-menu {
left: 92% !important;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div id="user-run-code">
<el-empty :image-size="200" v-if="codeRunInfo === null || codeRunInfo.length === 0" description="暂无消息内容"></el-empty>
<el-empty :image-size="200" v-if="codeRunInfo === null || codeRunInfo.length === 0" description="暂无运行内容"></el-empty>
<ul class="infinite-list" v-else>
<li v-for="info in codeRunInfo" class="infinite-list-item">
<span v-if="info.runError !== ''">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div id="user-share-code">
这里是用户分享的所有代码
<el-empty :image-size="200" v-if="dataList === null || dataList.length === 0" description="暂无分享内容"></el-empty>
<el-collapse accordion>
<el-collapse-item v-for="(value, index ) in dataList"
:key="index"
Expand Down
75 changes: 56 additions & 19 deletions pastecode-ui/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ const routes = [
{
path: '/',
name: 'Home',
component: Home
component: Home,
meta: {
title: '贴代码'
}
},
{
path: '/about',
Expand All @@ -26,32 +29,42 @@ const routes = [
{
path: '/admin/',
name: 'Home',
component: () => import('../views/admin/Home')
component: () => import('../views/admin/Home'),
meta: {
title: '系统管理'
}
},
{
path: '/admin/userManagement',
name: 'UserManagement',
component: () => import('../views/admin/UserManagement')
component: () => import('../views/admin/UserManagement'),
meta: {
title: '用户管理'
}
},
{
path: '/admin/codeManagement',
name: 'CodeManagement',
component: () => import('../views/admin/CodeManagement')
component: () => import('../views/admin/CodeManagement'),
meta: {
title: '代码管理'
}
},
{
path: '/admin/logManagement',
name: 'LogManagement',
component: () => import('../views/admin/LogManagement')
component: () => import('../views/admin/LogManagement'),
meta: {
title: '日志管理'
}
},
{
path: '/admin/runManagement',
name: 'RunManagement',
component: () => import('../views/admin/RunManagement')
},
{
path: '/admin/systemSetting',
name: 'SystemSetting',
component: () => import('../views/admin/SystemSetting')
component: () => import('../views/admin/RunManagement'),
meta: {
title: '运行管理'
}
},
]
},
Expand All @@ -61,7 +74,10 @@ const routes = [
*/
path: '/code/id/:id',
name: 'Code',
component: Code
component: Code,
meta: {
title: '查看代码'
}
},
{
path: '/code/title/:codeTitle',
Expand All @@ -71,22 +87,34 @@ const routes = [
{
path: '/login',
name: 'Login',
component: () => import('../views/Login')
component: () => import('../views/Login'),
meta: {
title: '用户登录'
}
},
{
path: '*',
name: "NotFound",
component: () => import('../views/error/NotFound')
component: () => import('../views/error/NotFound'),
meta: {
title: '404 Not Found'
}
},
{
path: '/space/:account',
name: "Space",
component: () => import('../views/Space')
component: () => import('../views/Space'),
meta: {
title: '个人空间'
}
},
{
path: '/register',
name: "Register",
component: () => import('../views/Register')
component: () => import('../views/Register'),
meta: {
title: '用户注册'
}
},
{
path: '/admin',
Expand All @@ -96,17 +124,26 @@ const routes = [
{
path: '/list',
name: 'List',
component: () => import('../views/List')
component: () => import('../views/List'),
meta: {
title: '列表'
}
},
{
path: '/run',
name: 'Run',
component: () => import('../views/Run')
component: () => import('../views/Run'),
meta: {
title: '运行'
}
},
{
path: '/diff',
name: 'Diff',
component: () => import('../views/Diff')
component: () => import('../views/Diff'),
meta: {
title: '比对'
}
}
]

Expand Down
4 changes: 2 additions & 2 deletions pastecode-ui/src/views/Code.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</span>
<span>分享时间:{{ code.codeCreateDate }}</span>
<pc-code-status :code="Object.assign({}, this.code)"></pc-code-status>
<pc-code :code="Object.assign({}, this.code)"></pc-code>
<pc-code :code="Object.assign({}, this.code)" style="width: 80%; margin-left: 10%"></pc-code>

<el-button type="primary" size="mini" @click="copyCode">点我复制代码</el-button>
<el-button type="primary" size="mini" @click="downCode">点我下载源码</el-button>
Expand All @@ -25,7 +25,7 @@
@reload="reload"></update-code-form>
</el-dialog>

<div style="text-align: left" v-if="this.isRun">
<div style="text-align: left;width: 80%; margin-left: 10%" v-if="this.isRun">
<div style="margin: 5px">
<span class="hint">输入</span>
<el-card>
Expand Down
4 changes: 2 additions & 2 deletions pastecode-ui/src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
</div>
<div class="mt-25">
<el-button type="primary" @click="submit()">提交</el-button>
<el-button type="primary" @click="submitHellWorld()" class="ml-5">提交Hello World</el-button>
<el-link :underline="false" @click="clickSearch" class="ml-5 mr-5">搜索代码</el-link>
<!-- <el-button type="primary" @click="submitHellWorld()" class="ml-5">提交Hello World</el-button>-->
<!-- <el-link :underline="false" @click="clickSearch" class="ml-5 mr-5">搜索代码</el-link>-->
</div>
<el-dialog title="搜索代码" :visible.sync="dialogFormVisible">
<el-input
Expand Down
24 changes: 16 additions & 8 deletions pastecode-ui/src/views/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
clearable
v-model="search"
@input="selectCode"
style="width: 80%; margin-left: 10%"
></el-input>
<el-card v-for="code in codeList" style="margin-bottom: 50px" :key="code.codeId">
<el-link id="code-title" :underline="false" @click="goCode(code.codeId)">
Expand Down Expand Up @@ -43,10 +44,10 @@ export default {
},
computed: {
noMore () {
console.log(this.current * this.size, this.total)
return (this.current * this.size) >= this.total
},
disabled () {
console.log(this.loading || this.noMore)
return this.loading || this.noMore
}
Expand All @@ -70,6 +71,18 @@ export default {
},
load() {
if (this.search === '' && this.oldSearch !== '') {
this.codeList = [];
this.current = 1;
console.log("清空1")
}
if (this.search !== this.oldSearch) {
this.current = 1;
this.codeList = [];
console.log("清空2");
}
this.$axios({
url: `${this.$url}/code/pageList`,
method: 'get',
Expand All @@ -78,13 +91,6 @@ export default {
"current": this.current - 1,
}
}).then((response) => {
console.log("this.oldSearch", this.oldSearch)
if (this.search === '' && this.oldSearch !== '') {
this.codeList = [];
}
if (this.search !== '') {
this.codeList = [];
}
this.codeList = this.codeList.concat(response.data.data.records);
this.total = response.data.data.count;
this.oldSearch = this.search;
Expand Down Expand Up @@ -123,6 +129,8 @@ export default {
}
.el-card {
margin-bottom: 0 !important;
width:80%;
margin-left: 10%;
}
#code-title {
text-align: center;
Expand Down
3 changes: 2 additions & 1 deletion pastecode-ui/src/views/Register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export default {
{required: true, message: '请输入密码', trigger: 'blur'}
],
email: [
{ required: true, message: '请输入邮箱', trigger: 'blur' }
{ required: true, message: '请输入邮箱', trigger: 'blur' },
{pattern: '^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$', message: '请输入正确的电子邮箱', trigger: 'blur'}
]
},
}
Expand Down
46 changes: 44 additions & 2 deletions pastecode-ui/src/views/error/NotFound.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
<template>
<div>
<h1>404, 你的页面走丢了!!</h1>
<table>
<tr>
<td>
<table>
<tr>
<td>
<h1>404</h1>
<h3>大事不妙啦!</h3>
<p>你访问的页面不存在或已被删除~<br/>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</template>

Expand All @@ -10,6 +25,33 @@ export default {
}
</script>

<style scoped>
<style>
* {
font-family: "Microsoft Yahei",system-ui;
margin: 0;
font-weight: lighter;
text-decoration: none;
text-align: center;
line-height: 2.2em;
}
html, body {
height: 100%;
}
h1 {
font-size: 100px;
line-height: 1em;
}
table {
width: 100%;
height: 100%;
border: 0;
border-collapse: collapse;
}
th, td {
padding: 0.3em 1em;
}
</style>
10 changes: 10 additions & 0 deletions runCode/code/clear.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cd E:/runCode/code
del cpp-input.txt
del cpp-output.txt
del cpp-error.txt
del java-input.txt
del java-output.txt
del java-error.txt
del python-input.txt
del python-output.txt
del python-error.txt
5 changes: 5 additions & 0 deletions runCode/code/cppRun.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cd E:/runCode/code
g++ -o main main.cpp 2> cpp-error.txt
main < cpp-input.txt > cpp-output.txt
del main.cpp
del main.exe
5 changes: 5 additions & 0 deletions runCode/code/javaRun.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cd E:/runCode/code
javac Main.java 2> java-error.txt
java Main < java-input.txt > java-output.txt 2>> java-error.txt
del Main.java
del Main.class
Loading

0 comments on commit 85090e6

Please sign in to comment.