提交 fb13141a 编写于 作者: Joey0610's avatar Joey0610

Day8 搜索接口等

上级 058dd9d2
......@@ -125,11 +125,6 @@ export default {
login(userForm) {
this.$refs["userForm"].validate((valid) => {
if (valid) {
this.$notify({
title: "登录成功",
message: "欢迎进入福州大学信息通后台",
type: "success",
});
console.log("userform");
console.log(this.userForm.teacherNo + this.userForm.password);
// 表单校验合法
......@@ -156,28 +151,36 @@ export default {
// console.log(username + password);
console.log("5");
console.log(res);
if (res.code === "200") {
localStorage.setItem("userId", JSON.stringify(res.data)); // 存储用户信息到浏览器
if (res.data.code == "200") {
// window.sessionStorage.setItem('id', res.data.id)
localStorage.setItem("userId", JSON.stringify(this.userForm.teacherNo)); // 存储用户信息到浏览器
localStorage.setItem("menus", JSON.stringify(res.data.menus)); // 存储用户信息到浏览器
// 动态设置当前用户的路由
// setRoutes();
this.$notify({
title: "登录成功",
message: "欢迎进入福州大学信息通后台",
type: "success",
});
console.log("登录成功");
// this.$message.success("登录成功");
// localStorage.setItem("user_id", id);
// if (res.data.role === "ROLE_STUDENT") {
// this.$router.push("/PageTable");
this.$router.push("/PageTable");
// } else {
// this.$router.push("/");
// }
} else if (res.code === "1005") {
console.log("6");
this.$message.error(res.msg);
}else if(res.data.code == "204"){
console.log("用户名不存在");
}else if(res.data.code == "210"){
console.log("用户名或者密码错误");
}
})
.catch((err) => {
console.log(err);
console.log("登陆失败");
if (err.code === "1005") {
if (err.data.code == "210") {
console.log("用户名或者密码错误");
console.log("6");
}
});
......
<template>
<div>
<el-card shadow="hover" style="width: 100%">
<h2>删除竞赛信息</h2>
<h2>删除竞赛信息</h2>
</el-card>
<el-card>
<div style="text-align: left; margin-left: 20px">
<h4>发布者:{{ publisher }}</h4>
<h4>发布时间:{{ date }}</h4>
<h4>发布者:{{ teacherName }}</h4>
<h4>发布时间:{{ createrTime }}</h4>
<h4>竞赛名称:{{ title }}</h4>
<h4>介绍:{{ desc }}</h4>
<h4>要求:{{ demand }}</h4>
<h4>备注:{{ comment }}</h4>
<h4>介绍:{{ content }}</h4>
<h4>报名时间:{{ registerTime }}</h4>
<h4>比赛时间:{{ competitionTime }}</h4>
<h4>报名名单:</h4>
</div>
<el-table :data="tableData" border style="width: 100%; margin: 20px">
......@@ -37,9 +37,11 @@
:total="pageTotal"
>
</el-pagination>
<br/><br/>
<el-button type="danger" round>确认删除</el-button>
<el-button type="primary" round style="margin-left: 10em">取消</el-button>
<br /><br />
<el-button @click="deleteForm" type="danger" round>确认删除</el-button>
<el-button @click="cancel" type="primary" round style="margin-left: 10em"
>取消</el-button
>
</el-card>
</div>
</template>
......@@ -48,6 +50,9 @@
export default {
data() {
return {
queryInfo: {
competeId: this.$route.query.id, //获取竞赛id
},
tableData: [
{
id: "1",
......@@ -57,14 +62,6 @@ export default {
phone: "13822223333",
remarks: "...",
},
{
id: "1",
no: "221900190",
name: "佩奇",
email: "1234567890@qq.com",
phone: "13822223333",
remarks: "...",
},
],
publisher: "FBB",
date: "2022年4月3日",
......@@ -77,14 +74,65 @@ export default {
pageTotal: 2,
};
},
//初始化数据
mounted() {
// window.addEventListener('message', this.handleMessage)
this.getInformation();
},
methods: {
//获取详情竞赛信息
getInformation() {
this.$axios({
method: "get",
url: "http://47.113.195.148:8085/backend/teacher/showComp",
params: {
// competitionId: this.queryInfo.competeId
"competitionId":"11"
}
})
.then((res) => {
// console.log(username + password);
console.log("5");
console.log(res);
if (res.code === "200") {
// this.competeList = res.data.records;
// console.log(this.competeList);
console.log("获取成功")
}
})
.catch((err) => {
return this.$message.error("获取信息失败!");
});
},
handleSizeChange(size) {
this.pagesize = size;
this.$router.replace('/PageTable');
this.$router.replace("/PageTable");
},
handleCurrentChange(currentPage) {
this.currentPage = currentPage;
this.$router.replace('/PageTable');
},
//确定删除
deleteForm() {
this.$axios
.post("http://47.113.195.148:8085/backend/teacher/deleteCompetition", {
competitionId: this.queryInfo.competeId,
// competitionId: "11"
})
.then((res) => {
console.log("5");
console.log(res);
if (res.data.code == "200") {
console.log("删除成功");
}
})
.catch((err) => {
console.log(err);
});
},
//取消,返回大厅
cancel() {
this.$router.replace("/PageTable");
},
},
};
......
......@@ -48,6 +48,9 @@
export default {
data() {
return {
queryInfo: {
competeId: this.$route.query.id, //获取竞赛id
},
tableData: [
{
id: "1",
......@@ -80,11 +83,11 @@ export default {
methods: {
handleSizeChange(size) {
this.pagesize = size;
this.$router.replace('/PageTable');
this.$router.replace("/PageTable");
},
handleCurrentChange(currentPage) {
this.currentPage = currentPage;
this.$router.replace('/PageTable');
this.$router.replace("/PageTable");
},
},
};
......
......@@ -121,6 +121,9 @@ export default {
return data;
};
return {
queryInfo: {
competeId: this.$route.query.id, //获取竞赛id
},
ruleForm: {
title: "",
desc: "",
......
......@@ -37,33 +37,36 @@
<div v-for="item in competeList" :key="item.id">
<el-table-column label="竞赛id" width="80">
<!-- <template slot-scope="scope"> -->
<span style="margin-left: 10px">{{ item.competitionId }}</span>
<span style="margin-left: 10px">{{ item.competitionId }}</span>
<!-- </template> -->
</el-table-column>
<el-table-column prop="title" label="竞赛名称" width="380">{{ item.title }}
<el-table-column prop="title" label="竞赛名称" width="380"
>{{ item.title }}
</el-table-column>
<el-table-column prop="teacher" label="老师名字" width="120">{{ item.teacherName }}
<el-table-column prop="teacher" label="老师名字" width="120"
>{{ item.teacherName }}
</el-table-column>
<el-table-column prop="count" label="已报名人数" width="200">{{ item.count }}
<el-table-column prop="count" label="已报名人数" width="200"
>{{ item.count }}
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<template>
<el-button
size="mini"
@click="handleDetail(scope.$index, scope.row)"
@click="handleDetail(item.competitionId)"
round
>详细信息
</el-button>
<el-button
size="mini"
@click="handleEdit(scope.$index, scope.row)"
@click="handleEdit(item.competitionId)"
round
>编辑信息
</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)"
@click="handleDelete(item.competitionId)"
round
>删除信息
</el-button>
......@@ -131,52 +134,69 @@ export default {
},
};
},
mounted() {
this.getCompeteList();
},
methods: {
//点击跳转
//发布竞赛功能
release() {
this.$router.replace("/PageFormsModify");
},
//查询竞赛功能
onSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
requestUserQuery(this.formInline).then((res) => {
this.$message({
message: "查询成功!",
type: "success",
});
this.pageTotal = res.data.length;
this.tableData = res.data;
});
this.$axios({
method: "get",
url: "http://47.113.195.148:8085/backend/teacher/searchCompetition",
data: {
title: this.formInline.param1, //获取查询内容
teacherNo: localStorage.getItem("userId"),
},
})
.then((res) => {
// console.log(username + password);
console.log("获取查询内容");
console.log(res);
if (res.code === "200") {
}
})
.catch((err) => {});
} else {
console.log("error submit!!");
return false;
}
});
},
//查看竞赛详情
handleDetail(index, row) {
this.$router.push({ path: "/PageFormsDetail", query: { id: id } });
// this.form.index = index + (this.currentPage - 1) * this.pageSize;
// this.form.no = row.no;
// this.form.title = row.title;
// this.form.num = row.num;
// this.dialogFormVisible = true;
this.$router.replace("/PageFormsDetail");
},
//修改竞赛信息
handleEdit(index, row) {
this.$router.push({ path: "/PageFormsModify", query: { id: id } });
// this.form.index = index + (this.currentPage - 1) * this.pageSize;
// this.form.no = row.no;
// this.form.title = row.title;
// this.form.num = row.num;
// this.dialogFormVisible = true;
this.$router.replace("/PageFormsModify");
},
handleDelete(index, row) {
//删除竞赛信息
handleDelete(id) {
this.$router.push({ path: "/PageFormsDelete", query: { id: id } }); // 通过this.$route.query.id获得id
// this.tableData.splice(index + (this.currentPage - 1) * this.pageSize, 1);
// this.pageTotal = this.tableData.length;
// this.$message({
// message: "删除" + row.name + "成功!",
// type: "success",
// });
this.$router.replace("/PageFormsDelete");
},
handleSizeChange(size) {
this.pagesize = size;
......@@ -187,13 +207,22 @@ export default {
//获取竞赛信息
getCompeteList() {
axios({
method: "get",
url: "http://47.113.195.148:8085/backend/teacher/showAllCompetitions",
data: {
console.log(localStorage.getItem("userId"));
this.$axios({
method: 'get',
url: 'http://47.113.195.148:8085/backend/teacher/showAllCompetitions',
Headers:{'token':window.localStorage.getItem("accessToken")} ,
params: {
teacherNo: localStorage.getItem("userId"),
},
})
// this.$axios
// .get("http://47.113.195.148:8085/backend/teacher/showAllCompetitions", {
// //params参数必写 , 如果没有可传参数,传{}以
// params: {
// teacherNo: localStorage.getItem("userId"),
// },
// })
.then((res) => {
// console.log(username + password);
console.log("5");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册