Files
mytest/mainProject/templates/upload.html
T
2024-06-05 11:36:16 +08:00

94 lines
3.1 KiB
HTML

{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>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/vue.js' %}"></script>
{# <link rel="stylesheet" href="{% static 'css/elementui.css' %}">#}
<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>
<style>
html, body {
width: 80%;
height: 100%;
overflow: hidden;
margin: auto;
}
</style>
</head>
<body>
<div id="app">
<el-card class="box-card">
<div slot="header" class="clearfix">
欢迎您,{% if username == None %} 游客 {% else %} {{ username }} {% endif %},当前已批阅文件:
</div>
<el-table
:data="[tableData]"
border>
<el-table-column
prop="id"
label="文件编号"
width="auto">
</el-table-column>
<el-table-column
prop="title"
label="作业名"
width="auto">
</el-table-column>
<el-table-column
prop="score"
label="分数"
width="auto">
</el-table-column>
<el-table-column
label="操作"
width="auto">
<template slot-scope="scope">
<el-button @click="check(scope.row)" type="text" size="small">查看</el-button>
</template>
</el-table-column>
</el-table>
<div style="height: 14px"></div>
<div class="mb-3" style="margin-left: 450px">
<form enctype="multipart/form-data" method="post"
action="{% url 'mainProject:word_upload' %}">
{% csrf_token %}
<div class="form-group" style="margin-left: 70px">
<div class="form-group">
<input type="file" id="exampleInputFile" name="words" multiple>
</div>
<p class="help-block">支持多文件上传(仅老师)</p>
</div>
<button type="submit" class="btn btn-success" style="width: 50%">提交</button>
</form>
</div>
</el-card>
</div>
</body>
<script type="text/javascript">
new Vue({
el: "#app",
methods: {
check(row) {
location.href = "{% url 'mainProject:download' %}?id= "+row.id
},
mounted(){
}
},
data() {
return {
tableData:{{ word_list|safe }}
}
}
})
</script>
</html>