Commit e91cbf62 authored by 王's avatar

老师绑定用户

parent fcefa862
...@@ -287,7 +287,8 @@ ...@@ -287,7 +287,8 @@
periods_id:data.periods_id, periods_id:data.periods_id,
show:true, show:true,
goods_id:this.goods_id, goods_id:this.goods_id,
title:`${data.teacher_name}班级用户列表` title:`${data.teacher_name}班级用户列表`,
teacherId: data.teacher_id
} }
}, },
getTeacher(){ getTeacher(){
......
...@@ -51,7 +51,8 @@ ...@@ -51,7 +51,8 @@
<el-form-item> <el-form-item>
<el-button type="primary" @click="searchList">搜索</el-button> <el-button type="primary" @click="searchList">搜索</el-button>
<el-button type="success" @click="changeClass" v-if="!$store.state.readonly">切换班级</el-button> <el-button type="success" @click="changeClass" v-if="!$store.state.readonly">切换班级</el-button>
<el-button type="success" @click="onAddUser" v-if="!$store.state.readonly">+添加用户</el-button> <el-button type="success" @click="onAddUser(false)" v-if="!$store.state.readonly">+添加用户</el-button>
<el-button type="success" @click="onAddUser(true)" v-if="!$store.state.readonly">老师绑定用户</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table
...@@ -411,7 +412,7 @@ ...@@ -411,7 +412,7 @@
</template> </template>
<script> <script>
import {addClassUesrApi,getClassUserApi,changeUserApi,delClassUserApi,getUserListApi,addPeriodsClassUserDescApi,getClassStatisticsApi,userLookApi,getPeriodsApi,changeClassApi,getClassListApi,addUserTeacherApi,getUserDescListApi,updateUserPrivilegeApi} from "../../service/api"; import {addClassUesrApi,getClassUserApi,changeUserApi,delClassUserApi,getUserListApi,addPeriodsClassUserDescApi,getClassStatisticsApi,userLookApi,getPeriodsApi,changeClassApi,getClassListApi,addUserTeacherApi,getUserDescListApi,updateUserPrivilegeApi,teacherBindUserApi} from "../../service/api";
import page from '../framework/page' import page from '../framework/page'
import page2 from '../framework/page' import page2 from '../framework/page'
import pageDesc from '../framework/page' import pageDesc from '../framework/page'
...@@ -495,7 +496,8 @@ ...@@ -495,7 +496,8 @@
label: '用户主动添加老师', label: '用户主动添加老师',
value: 2 value: 2
} }
] ],
isBindUser: false
} }
}, },
components:{ components:{
...@@ -728,16 +730,28 @@ ...@@ -728,16 +730,28 @@
if (!this.addId) { if (!this.addId) {
return return
} }
addClassUesrApi(this.userObj.classId,this.addId,json).then(res=>{ if (!this.isBindUser) {
this.$message({ addClassUesrApi(this.userObj.classId,this.addId,json).then(res=>{
type: 'success', this.$message({
message: '添加成功!' type: 'success',
}); message: '添加成功!'
this.addShow = false; });
this.initPage() this.addShow = false;
}) this.initPage()
})
} else {
teacherBindUserApi(this.userObj.teacherId, {user_id: this.addId}).then(res=>{
this.$message({
type: 'success',
message: '绑定成功!'
});
this.addShow = false;
})
}
}, },
onAddUser(){ onAddUser(flag){
this.isBindUser = flag;
this.addShow = true; this.addShow = true;
this.getUser(); this.getUser();
}, },
......
...@@ -267,7 +267,7 @@ ...@@ -267,7 +267,7 @@
filterable filterable
remote remote
clearable clearable
placeholder="请输入名称或者手机号" placeholder="请输入名称"
:remote-method="remoteMethod" :remote-method="remoteMethod"
:loading="loading"> :loading="loading">
<el-option <el-option
......
...@@ -477,6 +477,7 @@ ...@@ -477,6 +477,7 @@
} }
getUserListApi(json).then(res=>{ getUserListApi(json).then(res=>{
this.userList = res.list; this.userList = res.list;
this.userDialog.total = res.total;
}) })
}, },
confirmPutForward(){ confirmPutForward(){
...@@ -511,7 +512,7 @@ ...@@ -511,7 +512,7 @@
}, },
onUserPageChange(val){ onUserPageChange(val){
this.userDialog.nowPage = val this.userDialog.nowPage = val
this.getUser() this.getUserList()
}, },
onUserSizeChange(val){ onUserSizeChange(val){
this.userDialog.limit = val this.userDialog.limit = val
......
...@@ -182,7 +182,9 @@ import chooseGoodDialog from './chooseGoodDialog' ...@@ -182,7 +182,9 @@ import chooseGoodDialog from './chooseGoodDialog'
this.userObj={ this.userObj={
classId:data.id, classId:data.id,
show:true, show:true,
title:`${this.detail.name}班级用户列表` title:`${this.detail.name}班级用户列表`,
teacherId: data.teacher_id,
periods_id: data.periods_id
} }
}, },
onPageChange(val){ onPageChange(val){
......
...@@ -409,7 +409,9 @@ ...@@ -409,7 +409,9 @@
this.userObj={ this.userObj={
classId:data.class_id, classId:data.class_id,
show:true, show:true,
title:`${data.teacher_name}班级用户列表` title:`${data.teacher_name}班级用户列表`,
teacherId: data.teacher_id,
periods_id: data.periods_id
} }
} }
}, },
......
...@@ -739,3 +739,8 @@ const getTeacherDayRankListUrl = 'api/admin/teacher/performance/day'; ...@@ -739,3 +739,8 @@ const getTeacherDayRankListUrl = 'api/admin/teacher/performance/day';
export const getTeacherDayRankListApi = function (json) { export const getTeacherDayRankListApi = function (json) {
return Vue.prototype.$fetch(`${getTeacherDayRankListUrl}`,json) return Vue.prototype.$fetch(`${getTeacherDayRankListUrl}`,json)
}; };
// 老师绑定用户
const teacherBindUserUrl = 'api/admin/teacher/bind';
export const teacherBindUserApi = function (id,json) {
return Vue.prototype.$put(`${teacherBindUserUrl}/${id}`, json)
};
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