This commit is contained in:
unknown 2022-06-06 17:20:41 +08:00
parent df61dd91d1
commit 3979bcfb50
13 changed files with 28966 additions and 1242 deletions

26869
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -14,8 +14,10 @@
"mavon-editor": "^2.10.4",
"mui-player": "^1.6.0",
"mui-player-desktop-plugin": "^1.4.2",
"sass-loader": "^7.3.1",
"vue": "^2.6.11",
"vue-router": "3.5.2"
"vue-router": "3.5.2",
"node-sass": "^4.14.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.4.5",

90
src/components/404.vue Normal file
View File

@ -0,0 +1,90 @@
<template>
<div class="site-wrapper site-page--not-found">
<div class="site-content__wrapper">
<div class="site-content">
<h2 class="not-found-title">404</h2>
<p class="not-found-desc">抱歉您访问的页面<em>失联</em> ...</p>
<el-button
type="primary"
class="not-found-btn-gohome"
@click="backOsredm"
>进入首页</el-button
>
</div>
</div>
</div>
</template>
<script>
export default {
methods:{
//
backOsredm(){
window.location.href='https://www.osredm.com'
}
}
};
</script>
<style lang="scss">
.site-wrapper.site-page--not-found {
position: absolute;
top: 60px;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
.site-content__wrapper {
padding: 0;
margin: 0;
background-color: #fff;
}
.site-content {
position: fixed;
top: 15%;
left: 50%;
z-index: 2;
padding: 30px;
text-align: center;
transform: translate(-50%, 0);
}
.not-found-title {
margin: 20px 0 15px;
font-size: 8em;
font-weight: 500;
color: rgb(55, 71, 79);
}
.not-found-desc {
margin: 0 0 30px;
font-size: 26px;
text-transform: uppercase;
color: rgb(118, 131, 143);
> em {
font-style: normal;
color: #ee8145;
}
}
.not-found-btn-gohome {
}
}
.el-button--primary {
color: #fff;
background: #466AFF ;
border-color: #466AFF ;;
}
.el-button--primary:hover, .el-button--primary:focus {
background: #7890ee;
border-color: #7890ee;
}
</style>

View File

@ -65,37 +65,37 @@ export default {
handleSelect(key, keyPath) {
switch (key){
case "home":
pageUtils.openPage(this.$router,"/home")
pageUtils.openPage(this.$router,"/" + this.$route.params.compId + "/home")
break;
case "chat":
pageUtils.openPage(this.$router,"/chat")
pageUtils.openPage(this.$router,"/" +this.$route.params.compId +"/chat")
break;
case "guide":
pageUtils.openPage(this.$router,"/guide")
pageUtils.openPage(this.$router,"/" +this.$route.params.compId +"/guide")
break;
case "apply":
pageUtils.openPage(this.$router,"/apply")
pageUtils.openPage(this.$router,"/" +this.$route.params.compId +"/apply")
break;
case "submit":
pageUtils.openPage(this.$router,"/submit")
pageUtils.openPage(this.$router,"/" +this.$route.params.compId +"/submit")
break;
case "chart":
pageUtils.openPage(this.$router,"/chart")
pageUtils.openPage(this.$router,"/" +this.$route.params.compId +"/chart")
break;
case "contact":
pageUtils.openPage(this.$router,"/contact")
pageUtils.openPage(this.$router,"/" +this.$route.params.compId +"/contact")
break;
case "applyList":
pageUtils.openPage(this.$router,"/applyList")
pageUtils.openPage(this.$router,"/" +this.$route.params.compId +"/applyList")
break;
case "submitList":
pageUtils.openPage(this.$router,"/submitList")
pageUtils.openPage(this.$router,"/" +this.$route.params.compId +"/submitList")
break;
case "notice":
pageUtils.openPage(this.$router,"/notice")
pageUtils.openPage(this.$router,"/" +this.$route.params.compId +"/notice")
break;
case "rank":
pageUtils.openPage(this.$router,"/rank")
pageUtils.openPage(this.$router,"/" +this.$route.params.compId +"/rank")
break;
}
// console.log(key)

212
src/components/Login.vue Normal file
View File

@ -0,0 +1,212 @@
<template>
<div class="loginWraper">
<!-- v-bind:model的缩写 绑定登录表格
表单验证规则 自己设定
获取登录表格元素 this.longinForm -->
<el-form
:model="loginForm"
:rules="Rules"
ref="loginForm"
label-position="left"
label-width="0px"
class="login-container"
>
<h3 class="title"></h3>
<el-form-item prop="adminName" class="a">
<el-input
type="text"
v-model="loginForm.adminName"
auto-complete="off"
placeholder="账号"
></el-input>
</el-form-item>
<el-form-item prop="adminPass">
<el-input
type="password"
v-model="loginForm.adminPass"
auto-complete="off"
placeholder="密码"
></el-input>
</el-form-item>
<!-- 验证码 -->
<el-form-item>
<el-col :span="12">
<el-form-item prop="captcha">
<el-input
type="test"
v-model="loginForm.captcha"
auto-complete="off"
placeholder="验证码, 单击图片刷新"
style="width: 100%"
>
</el-input>
</el-form-item>
</el-col>
<el-col class="line" :span="1">&nbsp;</el-col>
<el-col :span="11">
<el-form-item>
<img
style="width: 70%"
class="pointer"
:src="loginForm.src"
@click="refreshCaptcha()"
/>
</el-form-item>
</el-col>
</el-form-item>
<el-form-item style="width: 100%">
<el-button
type="primary"
style="width: 48%"
@click.native.prevent="reset()"
> </el-button
>
<!-- 主要按钮 -->
<el-button
type="primary"
style="width: 48%"
@click.native.prevent="login()"
> </el-button
>
</el-form-item>
</el-form>
<div class="footer"><p>@ 1703050328 张启磊</p></div>
</div>
</template>
<script>
import Cookies from "js-cookie";
export default {
name: "Login",
data() {
//
return {
logining: false,
loginForm: {
//
adminName: "",
adminPass: "",
captcha: "",
src: "http://localhost:8088/graduate_evaluate/createPicCode",
},
Rules: {
//
adminName: [{ required: true, message: "请输入账号", trigger: "blur" }],
adminPass: [{ required: true, message: "请输入密码", trigger: "blur" }],
captcha: [{ required: true, message: "请输入验证码", trigger: "blur" }],
},
};
},
methods: {
//
login() {
let adminInfo = {
picCode: this.loginForm.captcha,
adminName: this.loginForm.adminName,
adminPass: this.loginForm.adminPass,
};
this.$api.login
.login(adminInfo)
.then((res) => {
console.log(res);
if (res.code != 0) {
alert(res.message);
this.loginForm.src =
"http://localhost:8088/graduate_evaluate/createPicCode?t=" +
new Date().getTime();
return false;
}
Cookies.set("token", res.data.token); // tokenCookie
sessionStorage.setItem("name", res.data.adminName); //
sessionStorage.setItem("pass", res.data.adminPass);
sessionStorage.setItem("rank", res.data.adminRank);
this.$router.push("/"); //
})
.catch(function (res) {
alert(res);
this.refreshCaptcha();
});
},
//
refreshCaptcha: function () {
this.loginForm.src =
"http://localhost:8088/graduate_evaluate/createPicCode?t=" +
new Date().getTime();
},
//
reset() {
this.$refs.loginForm.resetFields();
},
},
};
</script>
<style scoped lang="scss">
.login-container {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 20px;
background-clip: padding-box;
margin: 150px auto;
width: 350px;
padding: 35px 35px 15px 35px;
background: #fff;
opacity: 0.9;
border: 1px solid #eaeaea;
box-shadow: 0 0 25px #cac6c6;
.title {
margin: 0px auto 40px auto;
text-align: center;
color: #000000;
}
}
</style>
<style>
.loginWraper {
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
background: url(../../assets/Pic/loginPic.jpg) no-repeat;
background-size: cover;
}
.login-container .el-input {
width: 350px;
left: 10px;
}
.login-container .el-form-item__error {
padding-left: 10px;
}
.footer {
font-size: 18px;
}
.el-button--primary {
color: #fff;
background: rgb(66, 166, 199);
border-color: rgb(66, 166, 199);;
}
.el-button--primary:hover, .el-button--primary:focus {
background: #7890ee;
border-color: #7890ee;
}
</style>

View File

@ -6,8 +6,7 @@ import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import Axios from "axios"
import http from './utils/http/index'
import api from './utils/http/index'
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
@ -19,7 +18,7 @@ import * as echarts from 'echarts';
import moment from "moment"; */
Vue.use(http)
Vue.use(api)
Vue.prototype.$axios = Axios

View File

@ -27,7 +27,7 @@
<script>
// import 'mavon-editor/dist/css/index.css'
import Video from "@/components/Video";
import pageUtils from "@/utils/pageUtils";
export default {
name: "Home",
components: {
@ -41,6 +41,17 @@ export default {
videoWidth: "100%",
content:'测试内容测试内容测试内容'
}
},
methods:{
checkComp(){
pageUtils.checkComp(this.$router,this.$route.params.compId,this.$api)
}
},
mounted() {
this.checkComp()
}
}
</script>

View File

@ -12,7 +12,7 @@ let routes = [
children:[
{
// 赛事首页
path: "/home",
path: "/:compId/home",
component: () => import("@/pages/Home/Home"),
meta: {
title: '红山开源社区'
@ -20,7 +20,7 @@ let routes = [
},
{
// 赛事首页编辑
path: "/homeEdit",
path: "/:compId/homeEdit",
component: () => import("@/pages/Home/HomeEdit"),
meta: {
title: '红山开源社区'
@ -28,7 +28,7 @@ let routes = [
},
{
// 赛事指南
path: "/guide",
path: "/:compId/guide",
component: () => import("@/pages/Guide/Guide"),
meta: {
title: '红山开源社区'
@ -36,7 +36,7 @@ let routes = [
},
{
// 赛事指南编辑
path: "/guideEdit",
path: "/:compId/guideEdit",
component: () => import("@/pages/Guide/GuideEdit"),
meta: {
title: '红山开源社区'
@ -44,7 +44,7 @@ let routes = [
},
{
// 通知公告
path: "/notice",
path: "/:compId/notice",
component: () => import("@/pages/Notice/Notice"),
meta: {
title: '红山开源社区'
@ -52,7 +52,7 @@ let routes = [
},
{
// 通知公告编辑
path: "/noticeEdit",
path: "/:compId/noticeEdit",
component: () => import("@/pages/Notice/NoticeEdit"),
meta: {
title: '红山开源社区'
@ -60,7 +60,7 @@ let routes = [
},
{
// 参赛报名
path: "/apply",
path: "/:compId/apply",
component: () => import("@/pages/Apply/Apply"),
meta: {
title: '红山开源社区'
@ -68,7 +68,7 @@ let routes = [
},
{
// 作品提交
path: "/submit",
path: "/:compId/submit",
component: () => import("@/pages/Submit/Submit"),
meta: {
title: '红山开源社区'
@ -76,7 +76,7 @@ let routes = [
},
{
// 数据统计
path: "/chart",
path: "/:compId/chart",
component: () => import("@/pages/Data/Chart"),
meta: {
title: '红山开源社区'
@ -84,7 +84,7 @@ let routes = [
},
{
// 排行榜
path: "/rank",
path: "/:compId/rank",
component: () => import("@/pages/Data/Rank"),
meta: {
title: '红山开源社区'
@ -92,7 +92,7 @@ let routes = [
},
{
// 交流互动
path: "/chat",
path: "/:compId/chat",
component: () => import("@/pages/Chat/Chat"),
meta: {
title: '红山开源社区'
@ -100,7 +100,7 @@ let routes = [
},
{
// 交流互动编辑
path: "/chatEdit",
path: "/:compId/chatEdit",
component: () => import("@/pages/Chat/ChatEdit"),
meta: {
title: '红山开源社区'
@ -108,7 +108,7 @@ let routes = [
},
{
// 联系我们
path: "/contactUs",
path: "/:compId/contactUs",
component: () => import("@/pages/ContactUs/ContactUs"),
meta: {
title: '红山开源社区'
@ -116,7 +116,7 @@ let routes = [
},
{
// 联系我们编辑
path: "/contactUsEdit",
path: "/:compId/contactUsEdit",
component: () => import("@/pages/ContactUs/ContactUsEdit"),
meta: {
title: '红山开源社区'
@ -124,7 +124,7 @@ let routes = [
},
{
// 报名列表
path: "/applyList",
path: "/:compId/applyList",
component: () => import("@/pages/Manage/ApplyList"),
meta: {
title: '红山开源社区'
@ -132,7 +132,7 @@ let routes = [
},
{
// 作品列表
path: "/submitList",
path: "/:compId/submitList",
component: () => import("@/pages/Manage/SubmitList"),
meta: {
title: '红山开源社区'
@ -154,6 +154,11 @@ let routes = [
},
}
]
},
{
path: '/404',
component:() => import("@/components/404"),
name: '404'
}
]

View File

@ -4,6 +4,7 @@ import config from './config' // 倒入默认配置
import router from '../../router'
import { Message } from 'element-ui'
export default function $axios (options) {
return new Promise((resolve, reject) => {
const instance = axios.create({
@ -23,12 +24,12 @@ export default function $axios (options) {
// Tip: 2
// 带上 token , 可以结合 vuex 或者重 localStorage
let token = localStorage.getItem("systemToken")
if (token) {
config.headers.accessToken = token
}else {
router.push('/login')
}
// let token = localStorage.getItem("systemToken")
// if (token) {
// config.headers.accessToken = token
// }else {
// router.push('/login')
// }
// if (store.getters.token) {
// config.headers['X-Token'] = getToken() // 让每个请求携带token--['X-Token']为自定义key 请根据实际情况自行修改
// } else {
@ -76,7 +77,7 @@ export default function $axios (options) {
let data;
// IE9时response.data是undefined因此需要使用response.request.responseText(Stringify后的字符串)
if(response.data == undefined){
data = response.request.responseText
data = JSON.parse(response.request.responseText)
} else{
data = response.data
}

View File

@ -23,9 +23,19 @@ export const mock = data => {
})
};
export const getComp = data => {
return axios({
url: '/comp/getCompByCompId',
method: 'post',
data
})
};
// 默认全部倒出
// 根据需要进行
export default {
query,
mock
mock,
getComp
}

View File

@ -1,10 +1,47 @@
import { Message } from 'element-ui'
// Header导航栏页面更改
function openPage(router,path){
function openPage(router, path){
router.push({
path: path
});
}
// 检测竞赛是否存在
function checkComp(router,compId, http){
var compInfo = {
compId
}
http.getComp(compInfo).then((res)=>{
console.log(res)
if (res.status === 0) {
//存在竞赛 但是要检测是否正式上线
if (res.data.online === true) {
//正式上线 可以显示页面
}else {
// 未正式上线需要拦截等操作跳转404
Message.warning("该竞赛还未上线")
//TODO: 可添加判断是否为白名单用户进行测试工作
router.push({
path: '/404'
});
}
}else {
// 不存在该竞赛 提示 并跳转404
Message.warning("不存在该竞赛")
router.push({
path: '/404'
});
}
})
}
export default {
openPage
openPage,
checkComp
}

View File

@ -14,7 +14,7 @@ module.exports = {
port:8020,
proxy: {
'/api': {
target: 'http://localhost:8081',
target: 'http://localhost:8010',
changeOrigin: true,
pathRewrite: {
'^/api': ''

2886
yarn.lock

File diff suppressed because it is too large Load Diff