Commit fe94bebb authored by wangwei's avatar wangwei

编写

parent 03b9ce17
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
<el-option <el-option
v-for="(data,index) in teacherList" v-for="(data,index) in teacherList"
:key="index" :key="index"
:label="data.teacher_name" :label="data.name"
:value="data.teacher_id"> :value="data.id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</template> </template>
<script> <script>
import {getPeriodsTeacherApi,getClassDetailApi,editClassApi,addClassApi} from "../../service/api"; import {getTeacherListApi,getClassDetailApi,editClassApi,addClassApi} from "../../service/api";
export default { export default {
props:[ props:[
'dialogObj' 'dialogObj'
...@@ -42,8 +42,8 @@ ...@@ -42,8 +42,8 @@
}, },
methods:{ methods:{
initPage(){ initPage(){
getPeriodsTeacherApi(this.dialogObj.periodsId).then(res=>{ getTeacherListApi().then(res=>{
this.teacherList = res this.teacherList = res.list
}); });
switch (this.dialogObj.type) { switch (this.dialogObj.type) {
case 0: case 0:
......
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label=""> <el-form-item label="">
<el-button size="" @click="getClassList"> <el-button type="primary" @click="getClassList">
搜索 搜索
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-form-item style="float: right"> <el-form-item style="float: right">
<el-button @click="onAdd">+添加班级</el-button> <el-button @click="onAdd" type="success">+添加班级</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -40,6 +40,11 @@ ...@@ -40,6 +40,11 @@
<el-form-item label="已看课包数">{{title.has_watch_num }}</el-form-item> <el-form-item label="已看课包数">{{title.has_watch_num }}</el-form-item>
</el-form> </el-form>
</div> </div>
<div v-if="!classList || classList.length === 0">
<el-form label-width="300px" inline>
<el-form-item label="暂无期数信息,请先选择期数"></el-form-item>
</el-form>
</div>
<div> <div>
<el-table <el-table
:data="classList" :data="classList"
...@@ -61,24 +66,24 @@ ...@@ -61,24 +66,24 @@
label="现有人数"> label="现有人数">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="200" width="250"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button @click="editClass(scope.row)">编辑</el-button> <el-button @click="showUser(scope.row)" size="mini" type="primary">班级成员</el-button>
<el-button @click="delClass(scope.row)">删除</el-button> <el-button @click="editClass(scope.row)" size="mini" type="warning">编辑</el-button>
<el-button @click="delClass(scope.row)" size="mini" type="danger">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<class-dialog :dialogObj="dialogObj" @reflash="getClassList"></class-dialog> <class-dialog :dialogObj="dialogObj" @reflash="getClassList"></class-dialog>
<user-list :userObj="userObj" @reflash="getClassList"/>
<!--<page :total="total" v-model="nowPage"/>-->
</div> </div>
</template> </template>
<script> <script>
import {getGoodsListApi,getPeriodsApi,getClassListApi,getPeriodsTeacherApi,delClassApi} from "../../service/api"; import {getGoodsListApi,getPeriodsApi,getClassListApi,getPeriodsTeacherApi,delClassApi} from "../../service/api";
import classDialog from './dialog' import classDialog from './dialog'
import UserList from './userList'
export default { export default {
data(){ data(){
return { return {
...@@ -88,6 +93,11 @@ ...@@ -88,6 +93,11 @@
classList:[], classList:[],
title:'', title:'',
teacherList:[], teacherList:[],
userObj:{
classId:'',
title:'',
show:false,
},
dialogObj:{ dialogObj:{
show:false, show:false,
title:'添加班级', title:'添加班级',
...@@ -98,6 +108,7 @@ ...@@ -98,6 +108,7 @@
} }
}, },
components:{ components:{
UserList,
classDialog classDialog
}, },
mounted(){ mounted(){
...@@ -122,16 +133,27 @@ ...@@ -122,16 +133,27 @@
} }
}); });
}, },
showUser(data){
this.userObj={
classId:data.id,
show:true,
title:`${data.teacher_name}班级用户列表`
}
},
getTeacher(){
getPeriodsTeacherApi(this.periods.id).then(res=>{
this.teacherList = res
})
},
changePeriods(data){ changePeriods(data){
if(data.length>1){ if(data.length>1){
let nowGoods = this.goodsList.find(i=>{return i.id === data[0]}); let nowGoods = this.goodsList.find(i=>{return i.id === data[0]});
this.periods = nowGoods.children.find(i=>{return i.id === data[1]}); this.periods = nowGoods.children.find(i=>{return i.id === data[1]});
getPeriodsTeacherApi(this.periods.id).then(res=>{ this.getTeacher()
this.teacherList = res
})
} }
}, },
getClassList(){ getClassList(){
this.getTeacher();
getClassListApi(this.periods.id,{teacher_id:this.teacher_id}).then(res=>{ getClassListApi(this.periods.id,{teacher_id:this.teacher_id}).then(res=>{
this.title = res.periods; this.title = res.periods;
this.classList = res.list; this.classList = res.list;
......
<template>
<el-dialog :title="userObj.title" :visible.sync="userObj.show">
</el-dialog>
</template>
<script>
export default {
name: "userList",
props:[
'userObj'
],
}
</script>
<style scoped lang="less">
</style>
<template>
</template>
<script>
export default {
name: "noLesson"
}
</script>
<style scoped>
</style>
...@@ -27,6 +27,7 @@ import sysConfig from '@/components/system/sysConfig' ...@@ -27,6 +27,7 @@ import sysConfig from '@/components/system/sysConfig'
import autoReply from '@/components/weChat/autoReply' import autoReply from '@/components/weChat/autoReply'
import weChatResource from '@/components/weChat/weChatResource' import weChatResource from '@/components/weChat/weChatResource'
import banner from '@/components/system/banner' import banner from '@/components/system/banner'
import noLesson from '@/components/noLesson'
Vue.use(Router); Vue.use(Router);
...@@ -54,6 +55,10 @@ const router =new Router({ ...@@ -54,6 +55,10 @@ const router =new Router({
path: '/help', path: '/help',
name:'help', name:'help',
component: help component: help
},{
path: '/noLesson',
name:'noLesson',
component: noLesson
},{ },{
path: '/banner', path: '/banner',
name:'banner', name:'banner',
......
...@@ -392,6 +392,13 @@ const getClassDetailUrl = `${_baseUrl}api/admin/periods/class/info/`; ...@@ -392,6 +392,13 @@ const getClassDetailUrl = `${_baseUrl}api/admin/periods/class/info/`;
export const getClassDetailApi = function (id, json) { export const getClassDetailApi = function (id, json) {
return Vue.prototype.$fetch(`${getClassDetailUrl}${id}`,json) return Vue.prototype.$fetch(`${getClassDetailUrl}${id}`,json)
}; };
// 获取班级用户列表
const getClassUserUrl = `${_baseUrl}api/admin/class/user/list/`;
export const getClassUserApi = function (id) {
return Vue.prototype.$fetch(`${getClassUserUrl}${id}`)
};
// 添加班级用户
const addClassUserUrl = `${_baseUrl}`
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