Commit 55e28f98 authored by 王's avatar

优化

parent cf78cd85
......@@ -12,8 +12,8 @@ module.exports = {
//本地代理设置
proxyTable: {
'/api': {
// target: 'http://local.base-api.sing.com', // 接口的域名
target: 'http://wechat.test.singsingenglish.com/',
target: 'http://local.base-api.sing.com', // 接口的域名
// target: 'http://wechat.test.singsingenglish.com/',
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
}
},
......
......@@ -77,6 +77,12 @@
prop="teacher_name"
label="班主任">
</el-table-column>
<el-table-column
label="班级类型">
<template slot-scope="scope">
{{scope.row.type|classTypeFilter}}
</template>
</el-table-column>
<el-table-column
prop="max_join_num"
label="最大人数">
......@@ -143,9 +149,20 @@
classDialog,
page
},
filters: {
classTypeFilter(val){
let _val = parseInt(val);
if (_val === 1) {
return '带班班级'
} else if (_val === 2) {
return '观摩班级'
} else {
return ''
}
}
},
mounted(){
this.initPage();
},
methods:{
initQuery(){
......
......@@ -3,34 +3,36 @@
<div>
<el-form label-width="90px" inline>
<el-form-item style="float: right">
<el-button type="success" @click="addShow = true" v-if="!$store.state.readonly">+添加用户</el-button>
<el-button type="success" @click="onAddUser" v-if="!$store.state.readonly">+添加用户</el-button>
</el-form-item>
</el-form>
<el-table
:data="userTable"
style="width: 100%">
<el-table-column label="头像">
<el-table-column label="用户" className="f-c">
<template slot-scope="scope">
<img :src="scope.row.avatar" style="width: 50px;height: 50px;border-radius: 50px">
<img :src="scope.row.avatar" style="margin-right:5px;width: 50px;height: 50px;border-radius: 50px"> {{scope.row.nickname}}(ID:{{scope.row.user_id}})
</template>
</el-table-column>
<el-table-column
prop="user_id"
label="用户ID">
</el-table-column>
<el-table-column
prop="nickname"
label="用户名">
label="是否购买">
<template slot-scope="scope">
{{ scope.row.is_buy === 0 ? '否' : '是'}}
</template>
</el-table-column>
<el-table-column
label="看课权限">
<template slot-scope="scope">
{{ scope.row.is_view_course | isOrNot}}
</template>
</el-table-column>
<el-table-column label="操作" v-if="!$store.state.readonly">
<el-table-column
prop="desc"
label="备注">
</el-table-column>
<el-table-column label="操作" v-if="!$store.state.readonly" width="300">
<template slot-scope="scope">
<el-button type="warning" size="mini" @click="editComment(scope.row.user_id, scope.row.desc)">编辑备注</el-button>
<el-button type="warning" size="mini" @click="changeUser(scope.row)">更改看课权限</el-button>
<el-button type="danger" size="mini" @click="onDel(scope.row)">删除</el-button>
</template>
......@@ -40,10 +42,56 @@
</div>
<el-dialog :modal="false" :visible.sync="addShow">
<el-form label-width="90px">
<el-form-item label="用户id">
<el-input v-model="addId"></el-input>
</el-form-item>
<!--<el-form-item label="用户id">-->
<!--<el-input v-model="addId"></el-input>-->
<!--</el-form-item>-->
<el-row>
<el-col :span="8">
<el-form-item label="ID">
<el-input v-model="searchFrom.userId"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="昵称">
<el-input v-model="searchFrom.nickName"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="电话">
<el-input v-model="searchFrom.mobile"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8" :offset="16">
<el-form-item>
<el-button style="float: right" type="primary" plain @click="getUser">搜索</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table
:data="userList"
ref="multipleTable"
@selection-change="handleSelectionChange"
style="width: 100%">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
className="f-c"
label="用户">
<template slot-scope="scope">
<img style="margin-right:5px;width: 50px;height: 50px;border-radius: 50px" :src="scope.row.avatar">{{scope.row.nickname}}(ID:{{scope.row.user_id}})
</template>
</el-table-column>
<el-table-column
prop="mobile"
label="手机号">
</el-table-column>
</el-table>
<page :total="total" :limit="limit" @pageChange="onPageChange"/>
<span slot="footer" class="dialog-footer">
<el-button @click="addShow = false">取 消</el-button>
<el-button type="primary" @click="onAdd">确 定</el-button>
......@@ -53,7 +101,8 @@
</template>
<script>
import {addClassUesrApi,getClassUserApi,changeUserApi,delClassUserApi} from "../../service/api";
import {addClassUesrApi,getClassUserApi,changeUserApi,delClassUserApi,getUserListApi,addPeriodsClassUserDescApi} from "../../service/api";
import page from '../framework/page'
import {ISORNOT} from "../../util/wordbook";
export default {
......@@ -65,9 +114,23 @@
return {
userTable:[],
addId:'',
addShow:false
addShow:false,
searchFrom: {},
userList: [],
nowPage: 1,
limit: 1,
total:0,
searchFrom: {
userId:'',
nickName: '',
mobile: ''
},
multipleSelection: []
}
},
components:{
page
},
filters:{
isOrNot(value){
return ISORNOT[value]
......@@ -105,19 +168,85 @@
type: 'success',
message: '删除成功!'
});
this.initPage()
});
this.initPage()
});
},
onAdd(){
addClassUesrApi(this.userObj.classId,this.addId).then(res=>{
let json = {
is_buy: 0
}
if(this.multipleSelection.length === 0) {
this.$message({
type: 'error',
message: '请选择用户!'
});
return
} else if (this.multipleSelection.length !== 1){
this.$message({
type: 'error',
message: '只能选择一个用户!'
});
return
}
this.addId = this.multipleSelection[0].user_id;
if (!this.addId) {
return
}
addClassUesrApi(this.userObj.classId,this.addId,json).then(res=>{
this.$message({
type: 'success',
message: '添加成功!'
});
this.addShow = false;
this.initPage()
})
}
},
onAddUser(){
this.addShow = true;
this.getUser();
},
getUser(){
let json = {
page: this.nowPage,
limit: this.limit
}
if (this.searchFrom.userId) {
json.user_id = this.searchFrom.userId
}
if (this.searchFrom.nickName) {
json.nickname = this.searchFrom.nickName
}
if (this.searchFrom.mobile) {
json.mobile = this.searchFrom.mobile
}
getUserListApi(json).then(res=>{
this.userList = res.list;
this.total = res.total;
})
},
onPageChange(val){
this.nowPage = val
this.getUser()
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
editComment(id, desc) {
this.$prompt('', '编辑备注', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputValue: desc
}).then(({ value }) => {
addPeriodsClassUserDescApi(id,{desc: value}).then(res=>{
this.$message({
type: 'success',
message: '编辑备注成功'
})
this.initPage();
});
})
},
},
watch:{
......@@ -128,6 +257,11 @@
}
</script>
<style scoped lang="less">
<style>
.f-c > div{
display: flex;
flex-flow: row nowrap;
justify-content: flex-start;
align-items: center;
}
</style>
......@@ -264,7 +264,7 @@
}
},
editComment(id, desc) {
this.$prompt('编辑备注', '提示', {
this.$prompt('', '编辑备注', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputValue: desc
......
......@@ -45,8 +45,18 @@
placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item label="相关老师">
<el-select v-model="teacherList" multiple placeholder="请选择">
<el-form-item label="带班老师" prop="teacherList">
<el-select v-model="form.teacherList" multiple placeholder="请选择">
<el-option
v-for="item in teacherOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="观摩老师" prop="viewTeacher">
<el-select v-model="form.viewTeacher" placeholder="请选择">
<el-option
v-for="item in teacherOptions"
:key="item.id"
......@@ -88,6 +98,7 @@
loading: false,
form: {},
teacherList: [],
viewTeacher: '',
pickerOptions1: {
disabledDate(time) {
return !(time.getTime() > Date.now());
......@@ -144,6 +155,12 @@
],
goods_id: [
{ required: true, message: '商品ID不能为空', trigger: 'change' }
],
teacherList: [
{ required: true, message: '带班老师不能为空', trigger: 'change' }
],
viewTeacher: [
{ required: true, message: '观摩老师不能为空', trigger: 'change' }
]
}
}
......@@ -170,10 +187,14 @@
},
methods:{
sub(){
if (!this.teacherList) {
this.$message.error('请选择老师ID');
return;
}
// if (!this.teacherList) {
// this.$message.error('请选择老师ID');
// return;
// }
// if (!this.viewTeacher) {
// this.$message.error('请选择观摩老师');
// return;
// }
this.$refs['form'].validate((valid) => {
if(valid){
let _id = this.form.goods_id;
......@@ -182,7 +203,8 @@
start_num: this.form.start_num,
start_at: this.form.start_at,
rest_week_day: this.form.rest_week_day ? this.form.rest_week_day.join(',') : '',
teacher_ids: this.teacherList.join(',')
teacher_ids: this.form.teacherList.join(','),
view_teacher_id: parseInt(this.form.viewTeacher)
}
if (this.form.id) {
getEditPeriodsApi(this.form.id,json).then(res=>{
......
......@@ -151,7 +151,7 @@
limit: this.limit,
page: this.nowPage
}
if (this.searchFrom.type) {
if (this.searchFrom.type || this.searchFrom.type === 0) {
json.type = this.searchFrom.type
}
if (this.searchFrom.name) {
......
......@@ -2,6 +2,11 @@
<div class="user">
<el-form ref="searchFrom" :model="searchFrom" label-width="80px">
<el-row>
<el-col :span="4">
<el-form-item label="ID">
<el-input v-model="searchFrom.userId"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="昵称">
<el-input v-model="searchFrom.nickName"></el-input>
......@@ -77,7 +82,8 @@
searchFrom:{
nickName:'',
mobile:'',
level:''
level:'',
userId: ''
},
userList:[],
total:0,
......@@ -115,6 +121,9 @@
page: this.nowPage,
limit: this.limit
}
if (this.searchFrom.userId) {
json.user_id = this.searchFrom.userId
}
if (this.searchFrom.nickName) {
json.nickname = this.searchFrom.nickName
}
......
......@@ -25,15 +25,15 @@
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<label>老师ID:</label>{{detail.teacher_id ? detail.teacher_id : ''}}
</el-col>
<el-col :span="6">
<label>邀请类型:</label>{{detail.invite_type | inviteType}}
</el-col>
<el-col :span="6">
<label>邀请人ID:</label>{{detail.invite_user_id ? detail.invite_user_id : ''}}
</el-col>
<el-col :span="6">
<label>已绑定老师:</label>{{detail.teacher_name}}
</el-col>
<el-col :span="6">
<label>注册时间:</label>{{detail.created_at}}
</el-col>
......
......@@ -415,8 +415,8 @@ export const getClassUserApi = function (id) {
};
// 添加班级用户
const addClassUserUrl = `${_baseUrl}api/admin/class/user/add/`;
export const addClassUesrApi = function (classId, userId) {
return Vue.prototype.$post(`${addClassUserUrl}${classId}/${userId}`)
export const addClassUesrApi = function (classId, userId, json) {
return Vue.prototype.$post(`${addClassUserUrl}${classId}/${userId}`,json)
};
// 更改看课权限
const changeUserUrl = `${_baseUrl}api/admin/class/user/`;
......@@ -498,3 +498,9 @@ const conflictUrl = `${_baseUrl}api/admin/goods/conflict/`;
export const conflictApi = function (id,json) {
return Vue.prototype.$patch(`${conflictUrl}${id}`,json)
};
// 班级用户添加备注
const addPeriodsClassUserDescUrl = `/api/admin/class/user/desc`;
export const addPeriodsClassUserDescApi = function (id,json) {
return Vue.prototype.$put(`${addPeriodsClassUserDescUrl}/${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