Commit 7fdf4bae authored by 王's avatar

班级用户列表修改

parent e684792c
......@@ -132,10 +132,6 @@
{{ scope.row.is_view_course | isOrNot}}
</template>
</el-table-column>
<el-table-column
prop="desc"
label="备注">
</el-table-column>
<el-table-column
label="最后登录时间">
<template slot-scope="scope">
......@@ -192,11 +188,11 @@
</el-table-column>
<el-table-column label="操作" v-if="!$store.state.readonly" width="480">
<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="warning" size="mini" @click="editComment(scope.row.id)" v-if="!$store.state.readonly">备注</el-button>
<el-button type="warning" size="mini" @click="editPrivilege(scope.row)" v-if="!$store.state.readonly">编辑</el-button>
<el-button type="primary" size="mini" @click="onGetUserDescList(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>
......@@ -344,14 +340,71 @@
<el-button type="primary" @click="changeClassSub()"> </el-button>
</span>
</el-dialog>
<el-dialog ></el-dialog>
<el-dialog :modal="false" :visible.sync="privilegeDialog.show" title="编辑权限">
<el-form label-width="120px">
<el-form-item label="是否添加老师">
<el-select v-model="privilegeDialog.is_add_teacher" placeholder="请选择">
<el-option
v-for="(data,index) in isAddTeacherList"
:key="index"
:label="data.label"
:value="data.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="看课权限">
<el-switch
v-model="privilegeDialog.isAllowView"
active-color="#13ce66"
inactive-color="#ff4949">
</el-switch>
</el-form-item>
<el-form-item label="意向等级">
<el-input-number v-model="privilegeDialog.weight" :min="0" :step="1"></el-input-number>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="privilegeDialog.show = false"> </el-button>
<el-button type="primary" @click="changePrivilegeSub()"> </el-button>
</span>
</el-dialog>
<el-dialog :modal="false" :visible.sync="descDialog.show" title="备注列表">
<el-table
:data="descDialog.descList"
style="width: 100%">
<el-table-column
label="用户" className="f-c" min-width="150">
<template slot-scope="scope" v-if="descDialog.userInfo">
<img :src="descDialog.userInfo.avatar" style="width: 40px;height: 40px;border-radius: 50px"> {{descDialog.userInfo.nickname}}(ID:{{descDialog.userInfo.user_id}})
</template>
</el-table-column>
<el-table-column
prop="desc"
label="备注">
</el-table-column>
<el-table-column
prop="operator"
label="备注人">
</el-table-column>
<el-table-column
prop="created_at"
label="创建时间">
</el-table-column>
<el-table-column
prop="updated_at"
label="更新时间">
</el-table-column>
</el-table>
<page-desc :nowPage="descDialog.nowPage" :total="descDialog.total" :limit="descDialog.limit" @pageChange="onDescDialogPageChange" @sizeChange="onDescDialogSizeChange"/>
</el-dialog>
</el-dialog>
</template>
<script>
import {addClassUesrApi,getClassUserApi,changeUserApi,delClassUserApi,getUserListApi,addPeriodsClassUserDescApi,getClassStatisticsApi,userLookApi,getPeriodsApi,changeClassApi,getClassListApi,addUserTeacherApi} from "../../service/api";
import {addClassUesrApi,getClassUserApi,changeUserApi,delClassUserApi,getUserListApi,addPeriodsClassUserDescApi,getClassStatisticsApi,userLookApi,getPeriodsApi,changeClassApi,getClassListApi,addUserTeacherApi,getUserDescListApi,updateUserPrivilegeApi} from "../../service/api";
import page from '../framework/page'
import page2 from '../framework/page'
import pageDesc from '../framework/page'
import {ISORNOT} from "../../util/wordbook";
export default {
......@@ -403,12 +456,42 @@
start_at:'',
end_at:''
},
multipleSelection: []
multipleSelection: [],
descDialog: {
show: false,
descList: [],
nowPage: 1,
limit: 10,
total:0,
userInfo: null
},
privilegeDialog: {
show: false,
isAllowView: false,
is_add_teacher: 0,
weight: 0,
id: ''
},
isAddTeacherList: [
{
label: '未加好友',
value: 0
},
{
label: '老师主动添加用户',
value: 1
},
{
label: '用户主动添加老师',
value: 2
}
]
}
},
components:{
page,
page2
page2,
pageDesc
},
filters:{
isOrNot(value){
......@@ -679,11 +762,11 @@
handleSelectionChange(val) {
this.multipleSelection = val;
},
editComment(id, desc) {
this.$prompt('', '编辑备注', {
editComment(id) {
this.$prompt('', '添加备注', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputValue: desc
inputValue: ''
}).then(({ value }) => {
addPeriodsClassUserDescApi(id,{desc: value}).then(res=>{
this.$message({
......@@ -694,6 +777,65 @@
});
})
},
onGetUserDescList(val){
this.descDialog.show = true;
this.descDialog.userInfo = {
user_id: val.user_id,
avatar: val.avatar,
nickname: val.nickname
};
this.descDialog.id = val.id;
this.getUserDescList();
},
getUserDescList(){
let json = {
page: this.descDialog.nowPage,
limit: this.descDialog.limit
};
getUserDescListApi(this.descDialog.id,json).then(res=>{
this.descDialog.descList = res.list;
this.descDialog.total = res.total;
})
},
onDescDialogPageChange(val){
this.descDialog.nowPage = val
this.getUserDescList()
},
onDescDialogSizeChange(val){
this.descDialog.limit = val
this.descDialog.nowPage = 1;
this.getUserDescList()
},
editPrivilege(val){
this.privilegeDialog = {
id: val.id,
isAllowView: val.is_view_course === 1,
is_add_teacher: val.is_add_teacher ? val.is_add_teacher : 0,
weight: val.weight ? val.weight : 0,
show: true
}
},
changePrivilegeSub(){
this.$confirm('此操作将修改用户权限?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let _json = {
is_view_course: this.privilegeDialog.isAllowView ? 1 : 0,
is_add_teacher: this.privilegeDialog.is_add_teacher,
weight: this.privilegeDialog.weight
}
updateUserPrivilegeApi(this.privilegeDialog.id,_json).then(res=>{
this.$message({
type: 'success',
message: '修改成功!'
});
this.privilegeDialog.show = false;
this.initPage()
});
});
}
},
watch:{
......
......@@ -508,7 +508,7 @@ export const conflictApi = function (id,json) {
// 班级用户添加备注
const addPeriodsClassUserDescUrl = `/api/admin/class/user/desc`;
export const addPeriodsClassUserDescApi = function (id,json) {
return Vue.prototype.$put(`${addPeriodsClassUserDescUrl}/${id}`,json)
return Vue.prototype.$post(`${addPeriodsClassUserDescUrl}/${id}`,json)
};
// 复制商品
const copyShopUrl = `/api/admin/goods/copy/`;
......@@ -709,3 +709,13 @@ const updateGoodsNumberUrl = 'api/admin/goods/buy/nums';
export const updateGoodsNumbeApi = function (id,json) {
return Vue.prototype.$put(`${updateGoodsNumberUrl}/${id}`,json)
};
// 获取班级用户备注列表
const getUserDescListUrl = 'api/admin/class/user/desc/';
export const getUserDescListApi = function (id,json) {
return Vue.prototype.$fetch(`${getUserDescListUrl}${id}`,json)
};
// 更改用户看课权限,添加老师,意向等级
const updateUserPrivilegeUrl = 'api/admin/class/user';
export const updateUserPrivilegeApi = function (id,json) {
return Vue.prototype.$put(`${updateUserPrivilegeUrl}/${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