提交 ffb2021b 编写于 作者: 麦嘉得's avatar 麦嘉得

①新增蹭课app轻应用页面(添加、删除、搜索)

上级 05299021
...@@ -190,4 +190,37 @@ export function MsgSend(data) { ...@@ -190,4 +190,37 @@ export function MsgSend(data) {
method: 'post', method: 'post',
data: data data: data
}); });
} }
\ No newline at end of file ///////////////////////////蹭课app////////////////////////
export function CourseList(data) {
return request({
url: '/QtInspect/api/SubClass/Course/List',
method: 'get',
params: data
});
}
export function MyList(data) {
return request({
url: '/QtInspect/api/SubClass/MyList',
method: 'get',
params: data
});
}
export function CourseAdd(data) {
return request({
url: '/QtInspect/api/SubClass/Add',
method: 'post',
data: data
});
}
export function CourseDelete(data) {
return request({
url: '/QtInspect/api/SubClass/Delete/'+data.id,
method: 'post',
data: data
});
}
<template>
<Row>
<Col span="24">
<Card style="width: 100%">
<div style="text-align: center">
<h3>
{{ name
}}<Dropdown trigger="click" @on-click="change_term">
<a style="color: black" href="javascript:void(0)">
({{ month_name }})
<Icon type="arrow-down-b"></Icon>
</a>
<!-- <Dropdown-menu slot="list">
<Dropdown-item name="01">一月</Dropdown-item>
<Dropdown-item name="02">二月</Dropdown-item>
<Dropdown-item name="03">三月</Dropdown-item>
<Dropdown-item name="04">四月</Dropdown-item>
<Dropdown-item name="05">五月</Dropdown-item>
<Dropdown-item name="06">六月</Dropdown-item>
<Dropdown-item name="07">七月</Dropdown-item>
<Dropdown-item name="08">八月</Dropdown-item>
<Dropdown-item name="09">九月</Dropdown-item>
<Dropdown-item name="10">十月</Dropdown-item>
<Dropdown-item name="11">十一月</Dropdown-item>
<Dropdown-item name="12"> 十二月</Dropdown-item>
</Dropdown-menu> -->
</Dropdown>
</h3>
</div>
</Card>
</Col>
<Col span="24" style="margin-top: 5px">
<Card>
<Tabs value="name1">
<Tab-pane label="所有课程" name="name1">
<Input v-model="searchVal" placeholder="按课程、按教师" style="width: 100%;margin-bottom: 15px;" :search="true" enter-button @on-search="searchValStr()"/>
<Table border :columns="columns1" :data="data1">
<template slot-scope="{ row }" slot="course_add">
<Button
type="primary"
ghost
size="small"
style="border: none"
@click="Add_method(row)"
>添加</Button
>
</template>
</Table>
</Tab-pane>
<Tab-pane label="我的课程" name="name2">
<Table border :columns="columns2" :data="data2">
<template slot-scope="{ row }" slot="course_delete">
<Button
type="primary"
ghost
size="small"
style="border: none"
@click="del_method(row)"
>移除</Button
>
</template>
</Table>
</Tab-pane>
</Tabs>
</Card>
</Col>
</Row>
</template>
<script>
import * as api from "@/api/common";
export default {
data() {
return {
month_name: "2020-2021-1",
month: "09",
columns1: [
{
title: "学年学期",
key: "term",
},
{
title: "课程名称",
key: "course_name",
},
{
title: "授课教师",
key: "teacher_name",
},
{
title: "操作",
key: "",
slot:"course_add"
},
],
data1: [
{
name: "理学院",
age: 98,
address: 2,
},
{
name: "软件学院",
age: 87,
address: 3,
},
{
name: "文学院",
age: 100,
address: 1,
},
{
name: "哲学院",
age: 180,
address: 10,
},
{
name: "材料学院",
age: 459,
address: 20,
},
],
columns2: [
{
title: "学年学期",
key: "term",
},
{
title: "课程名称",
key: "course_name",
},
{
title: "授课教师",
key: "teacher_name",
},
{
title: "操作",
key: "",
slot:"course_delete"
},
],
data2: [
{
name: "呈现",
age: "12333",
address: "1",
},
{
name: "呈现",
age: "12333",
address: "2",
},
{
name: "呈现",
age: "12333",
address: "3",
},
{
name: "呈现",
age: "12333",
address: "4",
},
{
name: "呈现",
age: "12333",
address: "5",
},
],
searchVal:"",
pageIndex:1,
pageSize:100
};
},
methods: {
changeLimit() {
api.CourseList({
key: this.searchVal,
term: "2020-2021-1",
pageIndex: this.pageIndex,
pageSize: this.pageSize,
}).then((resp) => {
if (resp.code == 1) {
this.data1 = [];
this.data1 = resp.response.data;
} else {
throw resp;
}
})
.finally((resp) => {});
api.MyList({
pageIndex: this.pageIndex,
pageSize: this.pageSize,
}).then((resp) => {
if (resp.code == 1) {
this.data2 = [];
this.data2 = resp.response.data;
} else {
throw resp;
}
})
.finally((resp) => {});
},
change_term(name) {
console.log(name);
this.month = name;
if (name == "01") {
this.month_name = "一月";
}
if (name == "02") {
this.month_name = "二月";
}
if (name == "03") {
this.month_name = "三月";
}
if (name == "04") {
this.month_name = "四月";
}
if (name == "05") {
this.month_name = "五月";
}
if (name == "06") {
this.month_name = "六月";
}
if (name == "07") {
this.month_name = "七月";
}
if (name == "08") {
this.month_name = "八月";
}
if (name == "09") {
this.month_name = "九月";
}
if (name == "10") {
this.month_name = "十月";
}
if (name == "11") {
this.month_name = "十一月";
}
if (name == "12") {
this.month_name = "十二月";
}
this.changeLimit();
},
Add_method(row){
console.log(row);
this.course_add(row);
},
del_method(row){
this.course_del(row);
},
course_add(val){
var json={
"course_name": val.course_name,
"teacher_name": val.teacher_name,
"term": val.term
}
api.CourseAdd(json).then((resp) => {
if (resp.code == 1) {
this.$Message.success('添加成功');
this.changeLimit();
} else {
throw resp;
}
})
.finally((resp) => {});
},
course_del(val){
api.CourseDelete({id:val._index}).then((resp) => {
if (resp.code == 1) {
this.$Message.success('移除成功');
this.changeLimit();
} else {
throw resp;
}
})
.finally((resp) => {});
},
searchValStr(){
this.changeLimit();
}
},
mounted() {
this.changeLimit();
},
created() {
this.name = "蹭课";
},
};
</script>
<style>
.ivu-table th {
height: 40px;
white-space: nowrap;
overflow: hidden;
background-color: #ffffff;
}
</style>
\ No newline at end of file
...@@ -214,6 +214,15 @@ const frameOut = [ ...@@ -214,6 +214,15 @@ const frameOut = [
}, },
component: () => import('@/pages/maintenance_unit') component: () => import('@/pages/maintenance_unit')
}, },
{
path: '/stu_rubclass',
name: 'stu_rubclass-edit',
meta: {
auth: false,
title: '学生阅读报告'
},
component: () => import('@/pages/my_exam/edit/stu_rubclass.vue')
},
{ {
path: '/sso', path: '/sso',
name: 'sso', name: 'sso',
......
Markdown 格式
0% or
您添加了 0 人 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册 或