Commit d7b11f2f authored by 王's avatar

班级列表权限添加老师

parent fbe211cd
......@@ -12,8 +12,8 @@ module.exports = {
//本地代理设置
proxyTable: {
'/api': {
target: 'http://local.base-api.sing.com', // 接口的域名
// target: 'https://wechat-test.changchangenglish.com/',
// target: 'http://local.base-api.sing.com', // 接口的域名
target: 'https://wechat-test.changchangenglish.com/',
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
}
},
......
......@@ -84,12 +84,13 @@
{{ scope.row.is_continue_buy | isOrNot}}
</template>
</el-table-column>
<el-table-column label="操作" v-if="!$store.state.readonly" width="360">
<el-table-column label="操作" v-if="!$store.state.readonly" width="410">
<template slot-scope="scope">
<el-button type="warning" size="mini" @click="editComment(scope.row.id, scope.row.desc)" v-if="!$store.state.readonly">编辑备注</el-button>
<el-button type="warning" size="mini" @click="changeUser(scope.row)" v-if="!$store.state.readonly">看课权限</el-button>
<el-button type="primary" size="mini" @click="userLook(scope.row)" v-if="!$store.state.readonly">看课情况</el-button>
<el-button type="danger" size="mini" @click="onDel(scope.row)" v-if="$store.state.deletePermission && !$store.state.readonly">删除</el-button>
<el-button type="warning" size="mini" @click="addTeacher(scope.row)" v-if="!$store.state.readonly">{{scope.row.is_add_teacher === 0 ? '添加老师' : '取消添加老师'}}</el-button>
</template>
</el-table-column>
</el-table>
......@@ -165,7 +166,7 @@
label="爸妈看一看">
<template slot-scope="scope">
<span v-if="scope.row.watch_list && scope.row.watch_list.length > 0 && scope.row.watch_list.find(i=>{return i.page_id === 1})">
学习时长:{{scope.row.watch_list.find(i=>{return i.page_id === 1}).stay_time}}
{{scope.row.watch_list.find(i=>{return i.page_id === 1}).stay_time}}
</span>
<span v-if="!scope.row.watch_list.find(i=>{return i.page_id === 1})">
暂未上课
......@@ -175,10 +176,10 @@
<el-table-column
label="宝贝玩一玩">
<template slot-scope="scope">
<span v-if="scope.row.watch_list && scope.row.watch_list.length > 0 && scope.row.watch_list.find(i=>{return i.page_id === 1})">
学习时长:{{scope.row.watch_list.find(i=>{return i.page_id === 2}).stay_time}}
<span v-if="scope.row.watch_list && scope.row.watch_list.length > 0 && scope.row.watch_list.find(i=>{return i.page_id === 2})">
{{scope.row.watch_list.find(i=>{return i.page_id === 2}).stay_time}}
</span>
<span v-if="!scope.row.watch_list.find(i=>{return i.page_id === 1})">
<span v-if="!scope.row.watch_list.find(i=>{return i.page_id === 2})">
暂未上课
</span>
</template>
......@@ -186,15 +187,38 @@
<el-table-column
label="爸妈秀宝贝">
<template slot-scope="scope">
<span v-if="scope.row.watch_list && scope.row.watch_list.length > 0 && scope.row.watch_list.find(i=>{return i.page_id === 1})">
学习记录:<div v-html="scope.row.watch_list.find(i=>{return i.page_id === 0}).learn_report"></div>{{scope.row.watch_list.find(i=>{return i.page_id === 3}).stay_time}}
<span v-if="scope.row.watch_list && scope.row.watch_list.length > 0 && scope.row.watch_list.find(i=>{return i.page_id === 3})">
<div v-html="scope.row.watch_list.find(i=>{return i.page_id === 0}).learn_report"></div>{{scope.row.watch_list.find(i=>{return i.page_id === 3}).stay_time}}
</span>
<span v-if="!scope.row.watch_list.find(i=>{return i.page_id === 1})">
<span v-if="!scope.row.watch_list.find(i=>{return i.page_id === 3})">
暂未上课
</span>
</template>
</el-table-column>
<el-table-column
label="多元趣味课">
<template slot-scope="scope">
<span v-if="scope.row.watch_list && scope.row.watch_list.length > 0 && scope.row.watch_list.find(i=>{return i.page_id === 5})">
<div v-html="scope.row.watch_list.find(i=>{return i.page_id === 0}).learn_report"></div>{{scope.row.watch_list.find(i=>{return i.page_id === 5}).stay_time}}
</span>
<span v-if="!scope.row.watch_list.find(i=>{return i.page_id === 5})">
暂未上课
</span>
</template>
</el-table-column>
<el-table-column
label="分享">
<template slot-scope="scope">
<span v-if="scope.row.watch_list && scope.row.watch_list.length > 0 && scope.row.watch_list.find(i=>{return i.page_id === 4})">
<div v-html="scope.row.watch_list.find(i=>{return i.page_id === 0}).learn_report"></div>{{scope.row.watch_list.find(i=>{return i.page_id === 4}).stay_time}}
</span>
<span v-if="!scope.row.watch_list.find(i=>{return i.page_id === 4})">
暂未分享
</span>
</template>
</el-table-column>
</el-table>
<page2 :nowPage="lookDetail.nowPage" :total="lookDetail.total" :limit="lookDetail.limit" @pageChange="onLookDetailPageChange" @sizeChange="onLookDetailSizeChange"/>
</el-dialog>
<el-dialog :modal="false" :visible.sync="changeClassObj.show" title="切换班级">
<el-form>
......@@ -219,8 +243,9 @@
</template>
<script>
import {addClassUesrApi,getClassUserApi,changeUserApi,delClassUserApi,getUserListApi,addPeriodsClassUserDescApi,userLookApi,getPeriodsApi,changeClassApi,getClassListApi} from "../../service/api";
import {addClassUesrApi,getClassUserApi,changeUserApi,delClassUserApi,getUserListApi,addPeriodsClassUserDescApi,userLookApi,getPeriodsApi,changeClassApi,getClassListApi,addUserTeacherApi} from "../../service/api";
import page from '../framework/page'
import page2 from '../framework/page'
import {ISORNOT} from "../../util/wordbook";
export default {
......@@ -235,7 +260,10 @@
lookDetail:{
show:false,
loading:false,
list:[]
list:[],
nowPage: 1,
limit: 5,
total:0
},
changeClassObj:{
show:false,
......@@ -260,7 +288,8 @@
}
},
components:{
page
page,
page2
},
filters:{
isOrNot(value){
......@@ -326,11 +355,44 @@
userLook(data){
this.lookDetail.show = true;
this.lookDetail.loading = true;
userLookApi(data.periods_id,data.user_id).then(res=>{
let json = {
limit: this.lookDetail.limit,
page: this.lookDetail.nowPage
}
this.lookDetail.data = {
periods_id:data.periods_id,
user_id: data.user_id
}
userLookApi(data.periods_id,data.user_id, json).then(res=>{
this.lookDetail.list = res.list;
this.lookDetail.loading = false;
this.lookDetail.total = res.total;
})
},
getUserLook(){
if(!this.lookDetail.data) return;
this.lookDetail.show = true;
this.lookDetail.loading = true;
let json = {
limit: this.lookDetail.limit,
page: this.lookDetail.nowPage
}
let data = this.lookDetail.data;
userLookApi(data.periods_id,data.user_id, json).then(res=>{
this.lookDetail.list = res.list;
this.lookDetail.loading = false;
this.lookDetail.total = res.total;
})
},
onLookDetailPageChange(val){
this.lookDetail.nowPage = val
this.getUserLook();
},
onLookDetailSizeChange(val){
this.lookDetail.limit = val
this.lookDetail.nowPage = 1;
this.getUserLook();
},
initPage(){
getClassUserApi(this.userObj.classId,{limit:500}).then(res=>{
this.userTable = res.list
......@@ -359,6 +421,21 @@
});
});
},
addTeacher(data){
this.$confirm('此操作将修改是否添加老师权限?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
addUserTeacherApi(data.id,{is_add_teacher:data.is_add_teacher === 0 ? 1 : 0}).then(res=>{
this.$message({
type: 'success',
message: '修改成功!'
});
this.initPage()
});
});
},
onDel(data){
this.$confirm('此操作将删除该成员?', '提示', {
confirmButtonText: '确定',
......
......@@ -92,6 +92,10 @@
prop="periods_title"
label="期数名称">
</el-table-column>
<el-table-column
prop="total_join_num"
label="带班总人数">
</el-table-column>
<el-table-column
prop="join_num"
label="参加人数">
......
......@@ -423,6 +423,11 @@ const changeUserUrl = `${_baseUrl}api/admin/class/user/`;
export const changeUserApi = function (id,json) {
return Vue.prototype.$put(`${changeUserUrl}${id}`,json)
};
// 添加是否添加老师权限
const addUserTeacherUrl = `${_baseUrl}api/admin/class/user/teacher/`;
export const addUserTeacherApi = function (id,json) {
return Vue.prototype.$put(`${addUserTeacherUrl}${id}`,json)
};
// 移除班级用户
const delClassUserUrl = `${_baseUrl}api/admin/class/user/`;
export const delClassUserApi = function (id) {
......@@ -526,8 +531,8 @@ export const getClassStatisticsApi = function (periods_id, class_id) {
};
// 用户看课情况
const userLookUrl = `/api/admin/user/static/list/`;
export const userLookApi = function (periods_id,user_id) {
return Vue.prototype.$fetch(`${userLookUrl}${periods_id}/${user_id}`)
export const userLookApi = function (periods_id,user_id, json) {
return Vue.prototype.$fetch(`${userLookUrl}${periods_id}/${user_id}`, json)
};
//订单统计
const orderCountUrl = `/api/admin/order/statistics`;
......
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