|
@@ -1,7 +1,10 @@
|
|
// pages/Components/classList/classList.js
|
|
// pages/Components/classList/classList.js
|
|
|
|
+const app = getApp()
|
|
|
|
+const util = require("../../../utils/util")
|
|
|
|
+const urlDef = require("../../../utils/urls")
|
|
Component({
|
|
Component({
|
|
- lifetimes:{
|
|
|
|
- attached:function(){
|
|
|
|
|
|
+ lifetimes: {
|
|
|
|
+ attached: function () {
|
|
wx.getSystemInfo({
|
|
wx.getSystemInfo({
|
|
success: (result) => {
|
|
success: (result) => {
|
|
this.setData({
|
|
this.setData({
|
|
@@ -11,6 +14,19 @@ Component({
|
|
})
|
|
})
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ pageLifetimes: {
|
|
|
|
+ show: function () {
|
|
|
|
+ let action = this.properties.action
|
|
|
|
+ this.setData({ action: action })
|
|
|
|
+ if ('1' == this.data.action) {
|
|
|
|
+ this.setData({ actionName: '补' })
|
|
|
|
+ } else if ('2' == this.data.action) {
|
|
|
|
+ this.setData({ actionName: '加' })
|
|
|
|
+ } else {
|
|
|
|
+ this.setData({ actionName: '调' })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
/**
|
|
/**
|
|
* 组件的属性列表
|
|
* 组件的属性列表
|
|
*/
|
|
*/
|
|
@@ -19,20 +35,24 @@ Component({
|
|
type: Boolean,
|
|
type: Boolean,
|
|
value: false
|
|
value: false
|
|
},
|
|
},
|
|
- showTime:{ //是否显示上课时间
|
|
|
|
|
|
+ showTime: { //是否显示上课时间
|
|
type: Boolean,
|
|
type: Boolean,
|
|
value: true
|
|
value: true
|
|
},
|
|
},
|
|
- showFlag:{ //是否显示上课状态
|
|
|
|
|
|
+ showFlag: { //是否显示上课状态
|
|
type: Boolean,
|
|
type: Boolean,
|
|
value: true
|
|
value: true
|
|
},
|
|
},
|
|
- showBtn:{ //是否显示功能按钮
|
|
|
|
- type:Boolean,
|
|
|
|
|
|
+ showBtn: { //是否显示功能按钮
|
|
|
|
+ type: Boolean,
|
|
|
|
+ value: false,
|
|
|
|
+ },
|
|
|
|
+ showRadio: { //是否显示单选按钮
|
|
|
|
+ type: Boolean,
|
|
value: false,
|
|
value: false,
|
|
},
|
|
},
|
|
- showRadio:{ //是否显示单选按钮
|
|
|
|
- type:Boolean,
|
|
|
|
|
|
+ showLevel: {
|
|
|
|
+ type: Boolean,
|
|
value: false,
|
|
value: false,
|
|
},
|
|
},
|
|
date: {
|
|
date: {
|
|
@@ -41,6 +61,12 @@ Component({
|
|
list: {
|
|
list: {
|
|
type: Array,
|
|
type: Array,
|
|
value: []
|
|
value: []
|
|
|
|
+ },
|
|
|
|
+ action: {
|
|
|
|
+ type: String
|
|
|
|
+ },
|
|
|
|
+ source: {
|
|
|
|
+ type: Object
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
@@ -49,21 +75,89 @@ Component({
|
|
*/
|
|
*/
|
|
data: {
|
|
data: {
|
|
animation: null,
|
|
animation: null,
|
|
- height:0,
|
|
|
|
|
|
+ height: 0,
|
|
overflow: 'auto',
|
|
overflow: 'auto',
|
|
|
|
+ source: null,
|
|
|
|
+ target: null,
|
|
|
|
+ key: null,
|
|
|
|
+ action: null,
|
|
|
|
+ actionName: null
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
* 组件的方法列表
|
|
* 组件的方法列表
|
|
*/
|
|
*/
|
|
methods: {
|
|
methods: {
|
|
- toPages:function(e){
|
|
|
|
- wx.navigateTo({
|
|
|
|
- url: e.currentTarget.dataset.url,
|
|
|
|
|
|
+ toPages: function (e) {
|
|
|
|
+ let urls = urlDef.urls
|
|
|
|
+ let stu = wx.getStorageSync('student')
|
|
|
|
+ let item = null;
|
|
|
|
+ this.properties.list.map(h => {
|
|
|
|
+ if (item == null) {
|
|
|
|
+ if (h.items && h.items.length > 0) {
|
|
|
|
+ item = h.items.filter(o => o.id == e.currentTarget.dataset.id)[0]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
})
|
|
})
|
|
|
|
+ let action = e.currentTarget.dataset.action
|
|
|
|
+ if (action == '1' || action == '3' || action == '4') {
|
|
|
|
+ item.curDate = item.beginTime.substring(0, 10)
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: e.currentTarget.dataset.url + '?data=' + JSON.stringify({ source: item, action: (action ? action : 0), dayScope: 14 }),
|
|
|
|
+ })
|
|
|
|
+ } else if (action == '2') {
|
|
|
|
+ util.apiPost(urls.get_last_classes + '&q.studentId=' + stu.studentId + '&q.classesId=' + item.classesId).then(rs => {
|
|
|
|
+ if (rs == null) {
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: '未查询到排课数据',
|
|
|
|
+ icon: 'none'
|
|
|
|
+ })
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ rs.curDate = rs.beginTime.substring(0, 10)
|
|
|
|
+ rs.classromeId = null; // 加课不用传 教室id
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: e.currentTarget.dataset.url + '?data=' + JSON.stringify({ source: rs, action: (action ? action : 0), dayScope: 14 }),
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ }
|
|
},
|
|
},
|
|
-
|
|
|
|
- showChoose:function(){
|
|
|
|
|
|
+ showChoose: function () {
|
|
|
|
+ // 判断是否选择了
|
|
|
|
+ let key = this.data.key
|
|
|
|
+ if (key == null || key == undefined) {
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: '请选择目标课程',
|
|
|
|
+ icon: 'none'
|
|
|
|
+ })
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let ks = key.split('#')
|
|
|
|
+ let action = this.data.action
|
|
|
|
+ this.properties.list.map(o => {
|
|
|
|
+ if (o.date == ks[0]) {
|
|
|
|
+ o.items.map(i => {
|
|
|
|
+ if (i.attendTeacherId == ks[1] && i.bt == ks[2]) {
|
|
|
|
+ let source = this.properties.source
|
|
|
|
+ if (source.curDate) {
|
|
|
|
+ source.date = source.curDate.substring(0, 10)
|
|
|
|
+ source.week = this.getWeek(source.date)
|
|
|
|
+ }
|
|
|
|
+ if (source.beginTime) {
|
|
|
|
+ source.bt = source.beginTime.substring(11, 16)
|
|
|
|
+ }
|
|
|
|
+ if (source.endTime) {
|
|
|
|
+ source.et = source.endTime.substring(11, 16)
|
|
|
|
+ }
|
|
|
|
+ if (i.newDate) {
|
|
|
|
+ i.date = i.newDate.substring(0, 10)
|
|
|
|
+ i.week = this.getWeek(i.date)
|
|
|
|
+ }
|
|
|
|
+ this.setData({ target: i, source: source, action: action })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
this.animation = wx.createAnimation({
|
|
this.animation = wx.createAnimation({
|
|
timingFunction: 'linear',
|
|
timingFunction: 'linear',
|
|
})
|
|
})
|
|
@@ -71,11 +165,11 @@ Component({
|
|
this.animation.translateY(bottom).step()
|
|
this.animation.translateY(bottom).step()
|
|
this.setData({
|
|
this.setData({
|
|
overflow: 'hidden',
|
|
overflow: 'hidden',
|
|
- animation:this.animation.export(),
|
|
|
|
|
|
+ animation: this.animation.export(),
|
|
bottom
|
|
bottom
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- hideChoose:function(){
|
|
|
|
|
|
+ hideChoose: function () {
|
|
this.animation = wx.createAnimation({
|
|
this.animation = wx.createAnimation({
|
|
timingFunction: 'linear',
|
|
timingFunction: 'linear',
|
|
})
|
|
})
|
|
@@ -83,7 +177,7 @@ Component({
|
|
this.animation.translateY(bottom).step()
|
|
this.animation.translateY(bottom).step()
|
|
this.setData({
|
|
this.setData({
|
|
overflow: 'auto',
|
|
overflow: 'auto',
|
|
- animation:this.animation.export(),
|
|
|
|
|
|
+ animation: this.animation.export(),
|
|
})
|
|
})
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
this.setData({
|
|
this.setData({
|
|
@@ -97,8 +191,114 @@ Component({
|
|
url: '/pages/leaveRecord/leaveRecord',
|
|
url: '/pages/leaveRecord/leaveRecord',
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- radioChange:function(e){
|
|
|
|
- console.log(JSON.stringify(e.detail.value))
|
|
|
|
|
|
+ radioChange: function (e) {
|
|
|
|
+ this.setData({ key: e.detail.value })
|
|
|
|
+ },
|
|
|
|
+ getWeek: function (d) {
|
|
|
|
+ return '星期' + '天一二三四五六'.charAt(new Date(d).getDay());
|
|
|
|
+ },
|
|
|
|
+ doSave: function () {
|
|
|
|
+ let that = this
|
|
|
|
+ wx.showModal({
|
|
|
|
+ title: '确认信息',
|
|
|
|
+ content: '确定要执行' + this.data.actionName + '课申请?',
|
|
|
|
+ showCancel: true,
|
|
|
|
+ cancelText: "否",
|
|
|
|
+ confirmText: "是",
|
|
|
|
+ success: function (res) {
|
|
|
|
+ if (res.cancel) {
|
|
|
|
+ that.hideChoose()
|
|
|
|
+ } else {
|
|
|
|
+ that.doRealSave()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
|
|
+ doRealSave: function () {
|
|
|
|
+ wx.showLoading({
|
|
|
|
+ title: '正在保存数据...',
|
|
|
|
+ mask: true
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ const urls = urlDef.urls;
|
|
|
|
+ let stu = wx.getStorageSync('student')
|
|
|
|
+ let data = {}
|
|
|
|
+ data.orgId = stu.orgId;
|
|
|
|
+ data.operator = stu.studentId
|
|
|
|
+ data.studentId = stu.studentId;
|
|
|
|
+ data.studentName = stu.name
|
|
|
|
+
|
|
|
|
+ if ('1' === this.data.action) {
|
|
|
|
+ data.leaveId = this.data.source.leaveId;
|
|
|
|
+ data.attenceStudentId = this.data.source.attenceStudentId;
|
|
|
|
+ } else {
|
|
|
|
+ data.attenceStudentId = this.data.source.studentId;
|
|
|
|
+ }
|
|
|
|
+ data.oldAttenceTeacherId = this.data.source.attenceTeacherId;
|
|
|
|
+ data.oldKindId = this.data.source.kindId;
|
|
|
|
+ data.attendTeacherId = this.data.target.attendTeacherId;
|
|
|
|
+ data.beginTime = this.data.target.newDate.substring(0, 10) + ' ' + this.data.target.beginTime + ':00';
|
|
|
|
+ data.endTime = this.data.target.newDate.substring(0, 10) + ' ' + this.data.target.endTime + ':00';
|
|
|
|
+ data.classesId = this.data.target.classesId;
|
|
|
|
+ data.courseName = this.data.target.courseName;
|
|
|
|
+ data.classesName = this.data.target.classesName;
|
|
|
|
+ data.name = this.data.target.classesName;
|
|
|
|
+
|
|
|
|
+ data.kindId = this.data.target.kindId;
|
|
|
|
+ data.teacherId = this.data.target.teacherId;
|
|
|
|
+ data.classRoomId = this.data.target.classroomId;
|
|
|
|
+
|
|
|
|
+ let saveURL = urls.classes_switch_save;
|
|
|
|
+ if ('1' === this.data.action) {
|
|
|
|
+ saveURL = urls.student_makeup;
|
|
|
|
+ }
|
|
|
|
+ if ('2' === this.data.action) {
|
|
|
|
+ data.classesId = this.data.source.classesId; // 原课程的classesId, 不然找不到当前学生的最后一节课
|
|
|
|
+ let gridList = [];
|
|
|
|
+ gridList.push(
|
|
|
|
+ {
|
|
|
|
+ personNum: this.data.target.personNum,
|
|
|
|
+ attendTeacherId: this.data.target.attendTeacherId,
|
|
|
|
+ teacherName: this.data.target.teacherName,
|
|
|
|
+ endDate: this.data.target.endDate,
|
|
|
|
+ classroomId: this.data.target.classroomId,
|
|
|
|
+ beginDate: this.data.target.beginDate,
|
|
|
|
+ classesId: this.data.target.classesId,
|
|
|
|
+ courseName: this.data.target.courseName,
|
|
|
|
+ teacherId: this.data.target.teacherId,
|
|
|
|
+ classesName: this.data.target.classesName,
|
|
|
|
+ beginTime: this.data.target.newDate.substring(0, 10) + ' ' + this.data.target.beginTime + ':00',
|
|
|
|
+ courseId: this.data.target.courseId,
|
|
|
|
+ kindId: this.data.target.kindId,
|
|
|
|
+ classRoomId: this.data.target.classroomId,
|
|
|
|
+ endTime: this.data.target.newDate.substring(0, 10) + ' ' + this.data.target.endTime + ':00'
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ data.gridList = gridList;
|
|
|
|
+ saveURL = urls.add_classes;
|
|
|
|
+ }
|
|
|
|
+ util.apiPost(saveURL, data, 'application/json').then((rs) => {
|
|
|
|
+ wx.hideLoading({})
|
|
|
|
+ this.hideChoose()
|
|
|
|
+ if (rs.message) {
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: this.data.actionName + '课失败,' + rs.message,
|
|
|
|
+ icon: 'none'
|
|
|
|
+ })
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: '您已' + this.data.actionName + '课成功!'
|
|
|
|
+ })
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ wx.navigateBack({
|
|
|
|
+ delta: 1, // 返回上一级页面。
|
|
|
|
+ success: function () {
|
|
|
|
+ console.log('成功!')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }, 1000)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
})
|
|
})
|