113 lines
4.1 KiB
HTML
113 lines
4.1 KiB
HTML
{% load static %}
|
|
<!Doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>首页</title>
|
|
<link rel="stylesheet" href="{% static 'js/bootstrap-5.3.0/css/bootstrap.css' %}">
|
|
<script src="{% static 'js/jquery.js' %}"></script>
|
|
<script src="{% static 'js/echarts.min.js' %}"></script>
|
|
<script src="{% static 'js/vue.js' %}"></script>
|
|
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
|
|
<!-- 引入组件库 -->
|
|
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
|
|
|
|
</head>
|
|
<style>
|
|
{% block css %}
|
|
.navbar {
|
|
justify-content: space-between;
|
|
border-radius: 0;
|
|
}
|
|
|
|
.mb-3 {
|
|
width: 50%;
|
|
}
|
|
{% endblock %}
|
|
|
|
</style>
|
|
|
|
<body style="overflow:hidden">
|
|
<div id="app" style="width: 100%;height: 90%">
|
|
<nav class="navbar navbar-expand-lg bg-body-tertiary" style="height: 100px">
|
|
<a class="navbar-brand" style="font-size: 36px">Python课程作业自动批改系统</a>
|
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText"
|
|
aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarText">
|
|
</div>
|
|
{% if username == None %}
|
|
<button @click="openLogin()" class="btn btn-success">登录</button>
|
|
<button @click="register()" id="register" class="btn btn-light">注册</button>
|
|
{% elif username != None %}
|
|
<button @click="logout()" id="logout" class="btn btn-light">退出</button>
|
|
{% endif %}
|
|
</nav>
|
|
<el-row class="tac" style="height: 1400px">
|
|
<el-col :span="3" style="height: 100%">
|
|
<el-menu
|
|
default-active="/upload/"
|
|
class="el-menu-vertical-demo"
|
|
background-color="#545c64"
|
|
text-color="#fff"
|
|
active-text-color="#ffd04b"
|
|
style="height: 100%"
|
|
@select="handleSelect"
|
|
>
|
|
<el-menu-item index="/upload/" style="height: 100px">
|
|
<i class="el-icon-menu"></i>
|
|
<span slot="title" style="font-size: 24px">在线批改</span>
|
|
</el-menu-item>
|
|
{% if profession != '0' and profession %}
|
|
<el-menu-item index="/score/" style="height: 100px">
|
|
<i class="el-icon-menu"></i>
|
|
<span slot="title" style="font-size: 24px">成绩统计</span>
|
|
</el-menu-item>
|
|
{% endif %}
|
|
<el-menu-item index="/user_page/" style="height: 100px">
|
|
<i class="el-icon-menu"></i>
|
|
<span slot="title" style="font-size: 24px">个人主页</span>
|
|
</el-menu-item>
|
|
</el-menu>
|
|
</el-col>
|
|
<el-col :span="21" style="height: 100%">
|
|
<div style="height: 60px"></div>
|
|
<iframe id="mainiframe" name="mainiframe" width="100%" height="95%"
|
|
src="{% url 'mainProject:upload' %}" ></iframe>
|
|
</el-col>
|
|
</el-row>
|
|
</div>
|
|
|
|
</body>
|
|
<script type="text/javascript">
|
|
new Vue({
|
|
el: "#app",
|
|
data() {
|
|
return {
|
|
|
|
}
|
|
},
|
|
methods: {
|
|
openLogin() {
|
|
location.href = {% url 'mainProject:login_page' %}
|
|
},
|
|
logout(){
|
|
location.href = '/logout'
|
|
},
|
|
register(){
|
|
location.href = '/register_page'
|
|
},
|
|
handleSelect(key, keyPath) {
|
|
if (key === '/upload/') {
|
|
$('#mainiframe').attr('src', {% url 'mainProject:upload' %})
|
|
} else if(key === '/score/') {
|
|
$('#mainiframe').attr('src', {% url 'mainProject:static_page' %})
|
|
}else{
|
|
$('#mainiframe').attr('src', {% url 'mainProject:user_page' %})
|
|
}
|
|
}
|
|
}
|
|
})
|
|
</script>
|
|
</html> |