创建班级
- 保 存
-
-
- 开 班结 班
-
+ 保 存
+
+
+ 开 班结 班
+
@@ -144,7 +147,7 @@
@@ -165,12 +168,12 @@
-
+
-
+
@@ -268,26 +271,28 @@ export default {
miniClassRules: {
modelId: [{ required: true, message: "必填项", trigger: "blur" }],
title: [{ required: true, message: "必填项", trigger: "blur" }],
- number: [{ required: true, message: "请填入招收的学员人数", trigger: "blur" }],
+ number: [
+ { required: true, message: "请填入招收的学员人数", trigger: "blur" }
+ ]
},
- memberRules:{
+ memberRules: {
monitor: [{ required: true, message: "必填项", trigger: "blur" }],
dmonitor: [{ required: true, message: "必填项", trigger: "blur" }],
learner: [{ required: true, message: "必填项", trigger: "blur" }],
scorer: [{ required: true, message: "必填项", trigger: "blur" }],
- counter: [{ required: true, message: "必填项", trigger: "blur" }]
+ counter: [{ required: true, message: "必填项", trigger: "blur" }]
},
remoteMethodLoading: false,
imageUrl: "",
- qrcodeUrl:"",
+ qrcodeUrl: "",
miniClassForm: {
title: "",
id: undefined,
- number:30,
+ number: 30,
content: "",
icon: "",
state: "0",
- qrcode:'',
+ qrcode: "",
modelId: undefined
},
member: {
@@ -324,15 +329,13 @@ export default {
},
placeholder: "请输入正文"
},
- showOverbtn: false, // 是否显示结班按钮
-
-
+ showOverbtn: false // 是否显示结班按钮
};
},
mounted() {
- if (this.miniClass) {
+ if (this.miniClass) {
console.log("编辑小班", this.miniClass);
- this.getClassInfo()
+ this.getClassInfo();
if (this.miniClass.classModel.id) {
this.modelList.push(this.miniClass.classModel);
}
@@ -343,36 +346,40 @@ export default {
this.qrcodeUrl = this.miniClass.qrcode;
}
this.miniClassForm = this.miniClass;
- if(this.miniClass.classUsers.length > 0){
- var list = [...this.miniClass.classUsers]
+ if (this.miniClass.classUsers.length > 0) {
+ var list = [...this.miniClass.classUsers];
// this.userList = [...this.miniClass.classUsers]
- list.forEach( item => {
- let name = '';
- if(item.name){
- name = item.name
- }else if(item.nickname){
- name = item.nickname
+ list.forEach(item => {
+ let name = "";
+ if (item.name) {
+ name = item.name;
+ } else if (item.nickname) {
+ name = item.nickname;
}
- if(item.role == '1'){
- this.member.monitor = item.tel + '(' +name+')'
+ if (item.role == "1") {
+ this.member.monitor = item.userId;
}
- if(item.role == '2'){
- this.member.dmonitor = item.tel + '(' +name+')'
+ if (item.role == "2") {
+ this.member.dmonitor = item.userId ;
}
- if(item.role == '3'){
- this.member.learner = item.tel + '(' +name+')'
+ if (item.role == "3") {
+ this.member.learner = item.userId;
}
- if(item.role == '4'){
- this.member.scorer.push(item.tel + '(' +name+')')
+ if (item.role == "4") {
+ this.member.scorer.push(item.userId );
}
- if(item.role == '5'){
- this.member.counter.push(item.tel + '(' +name+')')
- }
- item.id = item.userId
- this.userList.push(item)
- })
-
- console.log("处理后的开班日期",this.miniClassForm.mstartseconds, this.miniClassForm.nowseconds);
+ if (item.role == "5") {
+ this.member.counter.push(item.userId);
+ }
+ item.id = item.userId;
+ this.userList.push(item);
+ });
+
+ console.log(
+ "处理后的开班日期",
+ this.miniClassForm.mstartseconds,
+ this.miniClassForm.nowseconds
+ );
}
} else {
console.log("添加小班");
@@ -381,101 +388,116 @@ export default {
methods: {
// 获取小班详情
async getClassInfo() {
- console.log('班级详情')
+ console.log("班级详情");
this.$http({
url: this.$http.adornUrl("/common/class/getClassInfo"),
method: "post",
data: this.$http.adornData({
classId: this.miniClass.id
})
- })
- .then(async ({ data }) => {
-
- if (data && data.code === 0) {
- this.miniClassForm.startTime = data.result.class.startTime;
- var strStartTime = new Date(this.miniClassForm.startTime)
- var StartTime = strStartTime.getTime()
- console.log(';shijia',StartTime, data.result.class.startTime)
- var nowTime = await this.getServerTime() // 服务器当前时间
- console.log('服务器时间',nowTime)
- this.miniClassForm.mstartseconds = StartTime
- this.miniClassForm.nowseconds = nowTime
- // if(this.miniClass.classModel.isExam == 0){ // 没有考试模块
- // var off70 = undefined // 时长过70%显示结班按钮天数
- // off70 = Math.ceil(parseInt(this.miniClass.classModel.days) * 0.7)
- var endminiSecond = this.miniClass.classModel.days * 1000 * 60 * 60 * 24
- console.log('时间比较', (endminiSecond + StartTime), nowTime)
- if (StartTime > 0 && (endminiSecond + StartTime) <= nowTime) {
- console.log('显示结班按钮');
- this.showOverbtn = true
- } else {
- this.showOverbtn = false
- console.log('不显示');
- }
- }else{
- this.showOverbtn = false
- }
- // }else{
- // this.miniClassForm.startTime = undefined
- // }
- })
+ }).then(async ({ data }) => {
+ if (data && data.code === 0) {
+ this.miniClassForm.startTime = data.result.class.startTime;
+ var strStartTime = new Date(this.miniClassForm.startTime);
+ var StartTime = strStartTime.getTime();
+ console.log(";shijia", StartTime, data.result.class.startTime);
+ var nowTime = await this.getServerTime(); // 服务器当前时间
+ console.log("服务器时间", nowTime);
+ this.miniClassForm.mstartseconds = StartTime;
+ this.miniClassForm.nowseconds = nowTime;
+ // if(this.miniClass.classModel.isExam == 0){ // 没有考试模块
+ // var off70 = undefined // 时长过70%显示结班按钮天数
+ // off70 = Math.ceil(parseInt(this.miniClass.classModel.days) * 0.7)
+ var endminiSecond =
+ this.miniClass.classModel.days * 1000 * 60 * 60 * 24;
+ console.log("时间比较", endminiSecond + StartTime, nowTime);
+ if (StartTime > 0 && endminiSecond + StartTime <= nowTime) {
+ console.log("显示结班按钮");
+ this.showOverbtn = true;
+ } else {
+ this.showOverbtn = false;
+ console.log("不显示");
+ }
+ } else {
+ this.showOverbtn = false;
+ }
+ // }else{
+ // this.miniClassForm.startTime = undefined
+ // }
+ });
},
// 获取服务器时间
- async getServerTime() {
- var time = undefined
- await this.$http({
+ async getServerTime() {
+ var time = undefined;
+ await this.$http({
url: this.$http.adornUrl("/common/classExam/getServerTime"),
method: "post",
data: this.$http.adornData({})
- })
- .then( async ({ data }) => {
- if (data && data.code === 0) {
- time = data.serverTime;
- }}
- )
- return time
- },
+ }).then(async ({ data }) => {
+ if (data && data.code === 0) {
+ time = data.serverTime;
+ }
+ });
+ return time;
+ },
// 开班
- kaiban(){
- if(this.miniClass.classUsers.length == 0 || !this.miniClass.classUsers){
- this.$message.error('请先设置管理成员后再进行开班操作')
- return
+ kaiban() {
+ if (this.miniClass.classUsers.length == 0 || !this.miniClass.classUsers) {
+ this.$message.error("请先设置管理成员后再进行开班操作");
+ return;
}
this.$http({
- url: this.$http.adornUrl('/common/class/updateClassState'),
- method: "post",
- data: this.$http.adornData({
- classId:this.miniClassForm.id,
- state: '1'
- })
- })
- .then(({ data }) => {
- if (data && data.code === 0) {
- this.$message.success("操作成功");
- this.handleClose();
- }else{
- this.$message.error(data.msg);
- }
- })
+ url: this.$http.adornUrl("/common/class/updateClassState"),
+ method: "post",
+ data: this.$http.adornData({
+ classId: this.miniClassForm.id,
+ state: "1"
+ })
+ }).then(({ data }) => {
+ if (data && data.code === 0) {
+ this.$message.success("操作成功");
+ this.handleClose();
+ } else {
+ this.$message.error(data.msg);
+ }
+ });
},
// 结班
- jieban(){
+ jieban() {
this.$http({
- url: this.$http.adornUrl('/common/class/updateClassState'),
- method: "post",
- data: this.$http.adornData({
- classId:this.miniClassForm.id,
- state: '2'
- })
- })
- .then(({ data }) => {
- if (data && data.code === 0) {
- this.$message.success("操作成功");
- this.handleClose();
- }else{
- this.$message.error(data.msg);
- }
- })
+ url: this.$http.adornUrl("/common/class/updateClassState"),
+ method: "post",
+ data: this.$http.adornData({
+ classId: this.miniClassForm.id,
+ state: "2"
+ })
+ }).then(({ data }) => {
+ if (data && data.code === 0) {
+ this.$message.success("操作成功");
+ this.handleClose();
+ } else {
+ this.$message.error(data.msg);
+ }
+ });
+ },
+ safeProcessData(obj) {
+ const processed = {};
+ const pattern = /\([^)]*\)/g; // 匹配括号及内容的正则
+
+ for (const key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ const value = obj[key];
+ // 只对字符串类型进行处理,其他类型保持原样
+ if (typeof value === "string") {
+ processed[key] = value.replace(pattern, "");
+ } else {
+ // 非字符串类型(数字、null、undefined等)直接保留
+ processed[key] = value;
+ }
+ }
+ }
+
+ return processed;
},
// 保存成员信息
saveMember() {
@@ -486,29 +508,31 @@ export default {
// _myist = _Str.split(',')
// _myist.push(...this.member.scorer)
// _myist.push(...this.member.counter)
- // console.log('_Str',_myist,this.member.scorer,this.member.counter)
- var url = ''
- this.$http({
- url: this.$http.adornUrl("/common/class/setUserRole"),
- method: "post",
- data: this.$http.adornData({
- classId: this.miniClassForm.id,
- monitor: this.member.monitor+'', //班长
- dmonitor: this.member.dmonitor+'', //2班长
- learner: this.member.learner+'', //学习委员
- scorer: this.member.scorer.join(','), //评分员
- counter: this.member.counter.join(',') //记分员
- })
- })
- .then(({ data }) => {
- if (data && data.code === 0) {
- this.$message.success("设置成功");
- this.handleClose();
- }else{
- this.$message.error(data.msg);
- }
- })
- }})
+ // console.log('_Str',_myist,this.member.scorer,this.member.counter)
+ var url = "";
+ this.$http({
+ url: this.$http.adornUrl("/common/class/setUserRole"),
+ method: "post",
+ data: this.$http.adornData(
+ {
+ classId: this.miniClassForm.id,
+ monitor: this.member.monitor + "", //班长
+ dmonitor: this.member.dmonitor + "", //2班长
+ learner: this.member.learner + "", //学习委员
+ scorer: this.member.scorer.join(","), //评分员
+ counter: this.member.counter.join(",") //记分员
+ }
+ )
+ }).then(({ data }) => {
+ if (data && data.code === 0) {
+ this.$message.success("设置成功");
+ this.handleClose();
+ } else {
+ this.$message.error(data.msg);
+ }
+ });
+ }
+ });
},
// 创建/编辑班级
saveAdd() {
@@ -530,18 +554,17 @@ export default {
state: this.miniClassForm.state,
content: this.miniClassForm.content,
qrcode: this.miniClassForm.qrcode,
- number:Number(this.miniClassForm.number)
+ number: Number(this.miniClassForm.number)
// createUserid: "10185"
})
- })
- .then(({ data }) => {
- if (data && data.code === 0) {
- this.$message.success("操作成功");
- this.handleClose();
- }else{
- this.$message.error("提交失败");
- }
- })
+ }).then(({ data }) => {
+ if (data && data.code === 0) {
+ this.$message.success("操作成功");
+ this.handleClose();
+ } else {
+ this.$message.error("提交失败");
+ }
+ });
} else {
this.$message.error("请完成表单的填写");
}
@@ -558,7 +581,7 @@ export default {
page: 1,
limit: 10,
title: query,
- type:''
+ type: ""
})
})
.then(({ data }) => {
@@ -611,7 +634,7 @@ export default {
this.qrcodeUrl = URL.createObjectURL(file.raw);
// console.log("this.imageUrl", this.imageUrl, file, res);
this.$message.success("上传成功");
- },
+ },
iconbeforeAvatarUpload(file) {
this.$message.success("正在上传");
},
@@ -652,9 +675,9 @@ export default {
},
handleClose() {
// this.$nextTick(() => {555
- this.userList = []
- this.imageUrl = ''
- this.qrcodeUrl = ''
+ this.userList = [];
+ this.imageUrl = "";
+ this.qrcodeUrl = "";
this.$refs["miniClassForm"].resetFields();
// });
this.$emit("handleClose");