Commit 0169dfed by 宋珺琪

多选题、修改不用cookie、

parent 23171b4a
......@@ -29,10 +29,13 @@ export default {
}).then(res=>{
let resData = res.data.data
if(resData != null) {
this.$cookies.set("cname", resData.studentName)
this.$cookies.set("cid", resData.studentId)
this.$cookies.set("role", resData.role)
this.$router.push({path: '/answer?examCode=20190001'})
this.$router.push({
path: '/answer?examCode=20190001',
query:{
cname:resData.studentName,
cid: resData.studentId,
role:resData.role
}})
}
if(resData == null) { //错误提示
this.$message({
......
......@@ -9,7 +9,17 @@
<li><i class="iconfont icon-menufold icon20" ref="toggle" @click="slider_flag = !slider_flag"></i></li>
<li>{{examData.type}}-{{examData.source}}</li>
<li>{{userInfo.name}}</li>
<li><router-link to="/scoreTable" class = "router1">个人统计</router-link></li>
<li>
<router-link
:to="{
path: '/scoreTable',
query: {
cid: this.$route.query.cid,
cname:this.$route.query.cname,
role:this.$route.query.role
}}" class="router1">个人统计
</router-link>
</li>
<li><i class="iconfont icon-arrLeft icon20"></i></li>
</ul>
</div>
......@@ -217,7 +227,7 @@ export default {
}
},
created() {
this.getCookies()
this.getUrlParams()
this.getExamData()
this.showTime()
},
......@@ -242,10 +252,13 @@ export default {
// 拼接
return year+"-"+month+"-"+day+" "+hours+":"+minutes+":"+seconds;
},
getCookies() { //获取cookie
this.userInfo.name = this.$cookies.get("cname")
this.userInfo.id = this.$cookies.get("cid")
let role = this.$cookies.get("role")
getUrlParams() { //从路由上获取参数
this.userInfo.name = this.$route.query.cname
this.userInfo.id = this.$route.query.cid
let role = this.$route.query.role
console.log(this.userInfo.name)
console.log(this.userInfo.id)
console.log(role)
if(role == "0"){
this.roleflag = true;
}
......@@ -580,7 +593,7 @@ export default {
}).then(res => {
if(res.data.code == 200) {
console.log("关闭当前页面")
window.open("http://www.xz.cq/#/home","_self")
// window.open("http://www.xz.cq/#/home","_self")
// http://localhost:8088/#/jumplogin
// this.$router.push("/answer")
// 模拟用户按下 Alt+F4 快捷键,并调用 window.close() 方法来关闭当前窗口
......@@ -601,9 +614,6 @@ export default {
})
}
},
/* closeCurrentWindow(){
window.close();
},*/
showTime() { //倒计时
setInterval(() => {
this.time -= 1
......@@ -619,123 +629,6 @@ export default {
}
},1000 * 60)
},
/* MoreTrueOrFalse(boo){
if (boo){
//定位目标元素,并获取它的样式对象:
var myElement = document.querySelector(".is-checked");
var inputElement = myElement.querySelector('.el-checkbox__input');
var innerElement = inputElement.querySelector('.el-checkbox__inner');
console.log(innerElement)
// 创建一个<style>标签
var styleTag = document.createElement('style');
document.head.appendChild(styleTag);
// 动态生成的内联样式规则
styleTag.innerHTML = `
.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner::before {
content: "";
position: absolute;
top: -10px;
left: 3px;
width: 12px;
height: 25px;
border: 2px solid transparent;
border-bottom: 5px solid #f50808;
border-right: 5px solid #fa0909;
transform: rotate(45deg);
}`;
// 将样式规则应用到页面上的元素
innerElement.classList.add('styleTag');
}else {
}
},
//动态添加是否对错
OnetrueOrFalse(boo){
if (boo){
/!* var myElements = document.querySelectorAll(".el-radio__input");
var uncheckedElements = Array.from(myElements).filter(function(element) {
return !element.classList.contains('is-checked');
});
console.log(uncheckedElements)
var styleTag2 = document.createElement('style2');
document.head.appendChild(styleTag2);
// 动态生成的内联样式规则
styleTag2.innerHTML = `
.el-radio__input.is-disabled .el-radio__inner::before {
content: "×";
position: absolute;
top: -8px;
left: -5px;
color: #f50808;
font-size: 30px;
text-shadow:
-1px -1px 0 #f50808,
1px -1px 0 #f50808,
-1px 1px 0 #f50808,
1px 1px 0 #f50808;
}`;
uncheckedElements.forEach(e=>{
var innerElements = e.querySelectorAll(".el-radio__inner");
Array.from(innerElements).forEach(function(element) {
console.log(element)
element.classList.add("style2");
});
})*!/
//定位目标元素,并获取它的样式对象:
var myElement = document.querySelector(".is-checked");
var inputElement = myElement.querySelector('.el-radio__input');
var innerElement = inputElement.querySelector('.el-radio__inner');
// console.log(innerElement)
// 创建一个<style>标签
var styleTag = document.createElement('style');
document.head.appendChild(styleTag);
// 动态生成的内联样式规则
styleTag.innerHTML = `
.el-radio__input.is-disabled.is-checked .el-radio__inner::before {
content: "";
position: absolute;
top: -20px;
left: 3px;
width: 10px;
height: 25px;
border: 2px solid transparent;
border-bottom: 5px solid #f50808;
border-right: 5px solid #fa0909;
transform: rotate(45deg);
}`;
// 将样式规则应用到页面上的元素
console.log(innerElement)
innerElement.classList.add('style');
}else {
var myElement = document.querySelector(".is-checked");
var inputElement = myElement.querySelector('.el-radio__input');
var innerElement = inputElement.querySelector('.el-radio__inner');
console.log(innerElement)
// 创建一个<style>标签
var styleTag = document.createElement('style');
document.head.appendChild(styleTag);
// 动态生成的内联样式规则
styleTag.innerHTML = `
.el-radio__input.is-disabled.is-checked .el-radio__inner::before {
content: "×";
position: absolute;
top: -8px;
left: -5px;
color: #f50808;
font-size: 30px;
text-shadow:
-1px -1px 0 #f50808,
1px -1px 0 #f50808,
-1px 1px 0 #f50808,
1px 1px 0 #f50808;
}`;
// 将样式规则应用到页面上的元素
innerElement.classList.add('styleTag');
}
}*/
},
computed:mapState(["isPractice"])
}
......@@ -1196,10 +1089,10 @@ export default {
}
.el-checkbox__label{
/*color: red;*/
font-size: 25px;
font-size: 25px !important;
font-family: 'SimSun', sans-serif;
white-space:normal;
line-height: 25px;
line-height: 25px !important;
}
.content .el-checkbox-group{
display: flex;
......
......@@ -5,14 +5,44 @@
<el-row class="padding-50">
<el-col :span="24">
<ul class="list">
<!-- <li><a href="javascript:;" @click="exam()">我的试卷</a></li> -->
<!-- <li><a href="javascript:;" @click="practice()">我的练习</a></li> -->
<li><router-link to="/scoreTable">我的分数</router-link></li>
<li><router-link to="/scoreTjTable">我的分数统计</router-link></li>
<li v-if="roleflag"><router-link to="/scoreDwTjTable">单位分数统计</router-link></li>
<li>
<router-link
:to="{
path: '/scoreTable',
query: {
cid: this.$route.query.cid,
cname:this.$route.query.cname,
role:this.$route.query.role
}}"
>我的分数
</router-link>
</li>
<li>
<router-link
:to="{
path: '/scoreTjTable',
query: {
cid: this.$route.query.cid,
cname:this.$route.query.cname,
role:this.$route.query.role
}}"
>我的分数统计
</router-link>
</li>
<li v-if="roleflag">
<router-link
:to="{
path: '/scoreDwTjTable',
query: {
cid: this.$route.query.cid,
cname:this.$route.query.cname,
role:this.$route.query.role
}}"
>单位分数统计
</router-link>
</li>
<li class="right">
{{user.userName}}
<!-- <div class="final" @click="over()">结束考试</div>-->
{{this.$route.query.cname}}
</li>
</ul>
</el-col>
......@@ -37,33 +67,27 @@ export default {
return {
flag: false,
user: {},
roleflag: false
roleflag: false,
}
},
created() {
mounted() {
this.userInfo()
},
methods: {
exit() { //退出登录
this.$router.push({path:"/"}) //跳转到登录页面
this.$cookies.remove("cname") //清除cookie
this.$cookies.remove("cid")
},
manage() { //跳转到修改密码页面
this.$router.push({path: '/manager'})
},
userInfo() {
let role = this.$cookies.get("role")
debugger
if(role == "0"){
if(this.$route.query.role == "0"){
this.roleflag = true;
}
let studentName = this.$cookies.get("cname")
let studentId = this.$cookies.get("cid")
console.log(`studentId${studentId}`)
console.log(`studentName ${studentName}`)
this.user.userName = studentName
this.user.studentId = studentId
let self = this;
self.user.userName = this.$route.query.cname
self.user.studentId = this.$route.query.cid
},
practice() { //跳转练习模式
let isPractice = true
......
......@@ -59,12 +59,13 @@ export default {
}
},
created() {
this.getScore()
this.loading = true //数据加载则遮罩表格
},
methods: {
getScore() {
let studentId = this.$cookies.get("cid")
let studentId = this.$route.query.cid;
this.$axios(`/api/score/${this.pagination.current}/${this.pagination.size}/${studentId}`).then(res => {
if(res.data.code == 200) {
this.loading = false //数据加载完成去掉遮罩
......
......@@ -48,7 +48,7 @@ export default {
},
methods: {
getScoreTj() {
let studentId = this.$cookies.get("cid")
let studentId = this.$route.query.cid
this.$axios(`/api/scoreTj/${studentId}`).then(res => {
debugger
if(res.data.code == 200) {
......
//查询所有题库
<!--查询所有题库-->
<template>
<div class="exam">
<div class="tabs">
<el-form ref="searchForm" :model="searchForm" >
<el-row >
<el-col :span="6">
<el-form-item label="题目信息 :" style="display: flex">
<el-input v-model="searchForm.question" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-button
class="toEmptyButton"
@click="toEmpty">
<span class="skyp icon-sousuo"></span>
清空
</el-button>
<el-button
class="searchListButton"
@click="searchList()"
>
<span class="skyp icon-sousuo"></span>
查询
</el-button>
<el-button
class="addTableButton"
@click="addTable"
>
<span class="skyp icon-tianjia"></span>
新增
</el-button>
</el-col>
</el-row>
</el-form>
</div>
<el-table :data="pagination.records" border :row-class-name="tableRowClassName">
<el-table-column fixed="left" prop="subject" label="试卷名称" width="180"></el-table-column>
<el-table-column prop="question" label="题目信息" width="490"></el-table-column>
<el-table-column prop="section" label="所属章节" width="200"></el-table-column>
<el-table-column prop="type" label="题目类型" width="200"></el-table-column>
<el-table-column prop="type" label="题目类型" width="200">
<template slot-scope="scope">
<template v-if="scope.row.oneOrMore === '1'">
单选题
</template>
<template v-else-if="scope.row.oneOrMore === '2'">
多选题
</template>
<template v-else>
判断题
</template>
</template>
</el-table-column>
<el-table-column prop="score" label="试题分数" width="150"></el-table-column>
<el-table-column prop="level" label="难度等级" width="133"></el-table-column>
<el-table-column fixed="right" label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button type="text" size="small" @click="edit(scope.row)"
>编辑</el-button
>
<el-button type="text" size="small" @click="del(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="handleSizeChange"
......@@ -26,6 +83,9 @@
export default {
data() {
return {
searchForm:{
question:'',
},
pagination: {
//分页后的考试信息
current: 1, //当前页
......@@ -38,11 +98,27 @@ export default {
this.getAnswerInfo();
},
methods: {
getAnswerInfo() {
//查询按钮
searchList(){
this.getAnswerInfo(this.searchForm.question)
},
//清空按钮
toEmpty() {
let self = this;
self.searchForm.question = "";
self.getAnswerInfo();
},
//新增按钮
addTable(){
this.$router.push('/addAnswer')
},
//分页查询所有试卷信息
this.$axios(
`/api/answers/${this.pagination.current}/${this.pagination.size}`
)
getAnswerInfo(likeSelect) {
let url =`/api/answers/${this.pagination.current}/${this.pagination.size}/null`
if (likeSelect){
url = `/api/answers/${this.pagination.current}/${this.pagination.size}/${likeSelect}`
}
this.$axios(url)
.then(res => {
this.pagination = res.data.data;
console.log(res);
......@@ -52,12 +128,12 @@ export default {
//改变当前记录条数
handleSizeChange(val) {
this.pagination.size = val;
this.getAnswerInfo();
this.getAnswerInfo(this.searchForm.question);
},
//改变当前页码,重新发送请求
handleCurrentChange(val) {
this.pagination.current = val;
this.getAnswerInfo();
this.getAnswerInfo(this.searchForm.question);
},
tableRowClassName({ row, rowIndex }) {
if (rowIndex % 2 == 0) {
......@@ -65,11 +141,78 @@ export default {
} else {
return "success-row";
}
},
//编辑 跳转到新增页面
edit(row){
this.$router.push({
path: "/addAnswerChildren",
query:{
paperId:row.paperId,
subject:row.subject,
row:JSON.stringify(row),
}
});
},
//删除
del(row) {
console.log(row)
let self = this;
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
self.removeData(row);
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
},
//点击二次确认删除后执行的操作
removeData(row) {
let self = this;
console.log(row)
//删除的时候传主键和类型
this.$axios(`/api/deleteAnswers/${row.questionid}/${row.tablename}/${row.subject}`).then((res) => {
if (res.status == 200) {
self.$message.success("删除成功");
self.getAnswerInfo();
} else {
this.$message.error("删除失败");
}
});
},
}
};
</script>
<style lang="less" scoped>
/deep/.el-input__suffix{
display: none;
}
/*添加按钮*/
.addTableButton{
margin-top: 0;
background-color: #266fe8;
color: #fff;
/*color: #266fe8;*/
/*border: 1px solid #266fe8;*/
}
/*查询按钮*/
.searchListButton{
margin-top: 0;
background-color: #266fe8;
color: #fff;
}
/*清空按钮*/
.toEmptyButton{
margin-top: 0;
background-color: #266fe8;
color: #fff;
}
.exam {
padding: 0px 40px;
.page {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment