|
@@ -12,6 +12,9 @@ Page({
|
|
|
sfmArr: [],
|
|
|
studentName: "",
|
|
|
status: '', //状态
|
|
|
+ myCanvasId: 0,
|
|
|
+ byzsbj: "../../images/zsbj.jpg",
|
|
|
+ IngCourseArr: [] //如果有正在进行的课就存一下
|
|
|
},
|
|
|
// 更多
|
|
|
listToggle: function () {
|
|
@@ -82,70 +85,102 @@ Page({
|
|
|
// })
|
|
|
// },
|
|
|
gokhAnswer(e) {
|
|
|
- console.log(e.currentTarget.dataset.courseid, "00");
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/wx/exam/examList',
|
|
|
- method: "post",
|
|
|
- data: {
|
|
|
- sessionKey: this.data.sessionKey,
|
|
|
- courseId: e.currentTarget.dataset.courseid,
|
|
|
- clasId: this.data.classInfo.id
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- if (res.data.code == 0) {
|
|
|
- console.log(res.data);
|
|
|
- //let answersId = res.data.list[0].answersId ;
|
|
|
- if (res.data.list[0]) {
|
|
|
- if (res.data.list[0].answersId) {
|
|
|
- this.toPath(res.data.list[0].id, res.data.list[0].paperId, res.data.list[0].answersId, 'answerAfterclass');
|
|
|
- } else {
|
|
|
- console.log('777777');
|
|
|
- this.beginKao(res.data.list[0].id, res.data.list[0].paperId, this.data.sessionKey, 'answerAfterclass');
|
|
|
+ let isStudyDone = e.currentTarget.dataset.item.isStudyDone
|
|
|
+ let isExam = e.currentTarget.dataset.item.isExam
|
|
|
+ if (isStudyDone != 1) {
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: "您的学习课程还未完成哦,请先完成学习任务后再来考试吧!"
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ } else {
|
|
|
+ if (isExam == 0) {
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.publicUrl + '/wx/exam/examList',
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ sessionKey: this.data.sessionKey,
|
|
|
+ courseId: e.currentTarget.dataset.item.courseid,
|
|
|
+ clasId: this.data.classInfo.id
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ console.log(res.data);
|
|
|
+ //let answersId = res.data.list[0].answersId ;
|
|
|
+ if (res.data.list[0]) {
|
|
|
+ if (res.data.list[0].answersId) {
|
|
|
+ this.toPath(res.data.list[0].id, res.data.list[0].paperId, res.data.list[0].answersId, 'answerAfterclass');
|
|
|
+ } else {
|
|
|
+ console.log('777777');
|
|
|
+ this.beginKao(res.data.list[0].id, res.data.list[0].paperId, this.data.sessionKey, 'answerAfterclass');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: "您已经考完试了!"
|
|
|
+ })
|
|
|
}
|
|
|
- })
|
|
|
- // wx.navigateTo({
|
|
|
- // url: '../evaluationCourse/evaluationCourse'
|
|
|
- // })
|
|
|
+ }
|
|
|
+ // console.log(e.currentTarget.dataset.courseid, "00");
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
- //w我的班级去评价
|
|
|
+ //我的班级去评价
|
|
|
gopjClass(e) {
|
|
|
- console.log(e.currentTarget.dataset.courseid, "00");
|
|
|
- wx.request({
|
|
|
- url: app.globalData.publicUrl + '/wx/exam/quesExamList',
|
|
|
- method: "post",
|
|
|
- data: {
|
|
|
- sessionKey: this.data.sessionKey,
|
|
|
- questSub: '3',
|
|
|
- courseId: e.currentTarget.dataset.courseid,
|
|
|
- clasId: this.data.classInfo.id
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- if (res.data.code == 0) {
|
|
|
- console.log(res.data);
|
|
|
- //let answersId = res.data.list[0].answersId ;
|
|
|
- if (res.data.list[0]) {
|
|
|
- if (res.data.list[0].answersId) {
|
|
|
- if (res.data.list[0].status == '1') {
|
|
|
- wx.navigateTo({
|
|
|
- url: '/pages/evaluationCourseDetail/evaluationCourseDetail?answersId=' + res.data.list[0].answersId,
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.toPath(res.data.list[0].id, res.data.list[0].paperId, res.data.list[0].answersId, 'evaluationCourse');
|
|
|
+ console.log(e.currentTarget.dataset.item, "8888")
|
|
|
+ let isStudyDone = e.currentTarget.dataset.item.isStudyDone
|
|
|
+ let isFeedback = e.currentTarget.dataset.item.isFeedback
|
|
|
+ if (isStudyDone != 1) {
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: "您的学习课程还未完成哦,请先完成学习任务后再来评价吧!"
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ } else {
|
|
|
+ if (isFeedback == 0) {
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.publicUrl + '/wx/exam/quesExamList',
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ sessionKey: this.data.sessionKey,
|
|
|
+ questSub: '3',
|
|
|
+ courseId: e.currentTarget.dataset.courseid,
|
|
|
+ clasId: this.data.classInfo.id
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ console.log(res.data);
|
|
|
+ //let answersId = res.data.list[0].answersId ;
|
|
|
+ if (res.data.list[0]) {
|
|
|
+ if (res.data.list[0].answersId) {
|
|
|
+ if (res.data.list[0].status == '1') {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/evaluationCourseDetail/evaluationCourseDetail?answersId=' + res.data.list[0].answersId,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.toPath(res.data.list[0].id, res.data.list[0].paperId, res.data.list[0].answersId, 'evaluationCourse');
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log('777777');
|
|
|
+ this.beginKao(res.data.list[0].id, res.data.list[0].paperId, this.data.sessionKey, 'evaluationCourse');
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
- console.log('777777');
|
|
|
- this.beginKao(res.data.list[0].id, res.data.list[0].paperId, this.data.sessionKey, 'evaluationCourse');
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: "您已经评价过了!"
|
|
|
+ })
|
|
|
}
|
|
|
- })
|
|
|
- // wx.navigateTo({
|
|
|
- // url: '../evaluationCourse/evaluationCourse'
|
|
|
- // })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
goMyPoints() {
|
|
|
// wx.showModal({
|
|
@@ -163,14 +198,74 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
lq() {
|
|
|
- // wx.showModal({
|
|
|
- // showCancel: false,
|
|
|
- // content: "此功能暂时还未开放哦",
|
|
|
- // success(res) {}
|
|
|
- // })
|
|
|
+ wx.showLoading({
|
|
|
+ mask: true,
|
|
|
+ title: '加载中',
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ myCanvasId: this.data.myCanvasId + 1
|
|
|
+ })
|
|
|
+ console.log(this.data.myCanvasId)
|
|
|
+ let str = this.data.studentName + "同志于" + this.data.classInfo.beginDate + " 至 " + this.data.classInfo.endDate + "参加学习完成规定培训内容,准予结业,特发此证。"
|
|
|
+ let strArr = [];
|
|
|
+ //每15个字截取一下
|
|
|
+ // let n = 15;
|
|
|
+ // for (let i = 0, l = str.length; i < l / n; i++) {
|
|
|
+ // let a = str.slice(n * i, n * (i + 1));
|
|
|
+ // strArr.push(a);
|
|
|
+ // }
|
|
|
+ let a = str.slice(0, 18);
|
|
|
+ let b = str.slice(16, 36);
|
|
|
+ let c = str.slice(36, 56);
|
|
|
+ strArr.push(a, b, c);
|
|
|
+ console.log(strArr, "我是截取之后的")
|
|
|
+ const ctx = wx.createCanvasContext(this.data.myCanvasId);
|
|
|
+ ctx.drawImage(this.data.byzsbj, 0, 0, 300, 415); //里面的参数无非就是图片放置的位置即图片的横纵坐标,图片的宽高
|
|
|
+ ctx.setFillStyle("#000");
|
|
|
+ ctx.setFontSize(16); //字大小
|
|
|
+ ctx.setTextAlign('left'); //是否居中显示,参考点画布中线
|
|
|
+ let leftPositionAarr = [60, 30, 30, 30]
|
|
|
+ for (let i = 0; i < strArr.length; i++) {
|
|
|
+ console.log(i);
|
|
|
+ ctx.fillText(strArr[i], leftPositionAarr[i], 160 + i * 30);
|
|
|
+ }
|
|
|
+ // ctx.fillText(str, 150, 160); //150:canvas画布宽300,取1/2,中间,280:纵向位置
|
|
|
+ ctx.draw();
|
|
|
+ wx.hideLoading();
|
|
|
this.setData({
|
|
|
showzs: true
|
|
|
});
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.publicUrl + '/wx/student/wxGraduation',
|
|
|
+ method: "post",
|
|
|
+ data: {
|
|
|
+ sessionKey: this.data.sessionKey
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ console.log(res.data, "领取结业证提交")
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ saveZs() {
|
|
|
+ wx.canvasToTempFilePath({ //把当前画布指定区域的内容导出生成指定大小的图片
|
|
|
+ canvasId: this.data.myCanvasId,
|
|
|
+ success(res) {
|
|
|
+ console.log(res)
|
|
|
+ wx.authorize({ //向用户发起授权请求
|
|
|
+ scope: 'scope.writePhotosAlbum', //保存相册授权
|
|
|
+ success: () => {
|
|
|
+ wx.saveImageToPhotosAlbum({ //保存图片到系统相册
|
|
|
+ filePath: res.tempFilePath,
|
|
|
+ success: () => {
|
|
|
+ wx.showToast({
|
|
|
+ title: '图片保存成功'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
onClose1() {
|
|
|
this.setData({
|
|
@@ -261,7 +356,7 @@ Page({
|
|
|
},
|
|
|
// 综合反馈表 、、、、、、
|
|
|
getBanner1() {
|
|
|
- console.log(this.data.sessionKey,"dayin");
|
|
|
+ console.log(this.data.sessionKey, "dayin");
|
|
|
console.log(this.data.classInfo.id);
|
|
|
wx.request({
|
|
|
url: app.globalData.publicUrl + '/wx/exam/quesExamList',
|
|
@@ -273,7 +368,7 @@ Page({
|
|
|
},
|
|
|
success: (res) => {
|
|
|
if (res.data.code == 0) {
|
|
|
- console.log(res.data,"zonghe");
|
|
|
+ console.log(res.data, "zonghe");
|
|
|
//let answersId = res.data.list[0].answersId ;
|
|
|
console.log(res.data.list.length);
|
|
|
if (res.data.list[0]) {
|
|
@@ -333,29 +428,53 @@ Page({
|
|
|
},
|
|
|
// 跳转直播点播页面
|
|
|
goStudy(e) {
|
|
|
- wx.showModal({
|
|
|
- showCancel: false,
|
|
|
- content: "您有未完成的学习课程,请先完成学习任务后再进行其他课程学习!",
|
|
|
- success(res) {}
|
|
|
- })
|
|
|
- // let id = e.currentTarget.dataset.item.id
|
|
|
- // if (e.currentTarget.dataset.item.isLive == 1) {
|
|
|
- // if (e.currentTarget.dataset.item.isActive == 1) {
|
|
|
- // wx.navigateTo({
|
|
|
- // url: '../zbDetails/zbDetails?id=' + id
|
|
|
- // })
|
|
|
- // } else {
|
|
|
- // wx.showModal({
|
|
|
- // showCancel: false,
|
|
|
- // content: "直播还未开始哦",
|
|
|
- // success(res) {}
|
|
|
- // })
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // wx.navigateTo({
|
|
|
- // url: '../dbDetails/dbDetails?id=' + id
|
|
|
- // })
|
|
|
- // }
|
|
|
+ let id = e.currentTarget.dataset.item.id //此课程的id
|
|
|
+ console.log(id)
|
|
|
+ console.log(this.data.IngCourseArr, "我是筛选的列表")
|
|
|
+ if (this.data.IngCourseArr.length == 0) {
|
|
|
+ if (e.currentTarget.dataset.item.isLive == 1) {
|
|
|
+ if (e.currentTarget.dataset.item.isActive == 1) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '../zbDetails/zbDetails?id=' + id
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: "直播还未开始哦"
|
|
|
+ })
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '../dbDetails/dbDetails?id=' + id
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (id == this.data.IngCourseArr.id) {
|
|
|
+ if (e.currentTarget.dataset.item.isLive == 1) {
|
|
|
+ if (e.currentTarget.dataset.item.isActive == 1) {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '../zbDetails/zbDetails?id=' + id
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: "直播还未开始哦"
|
|
|
+ })
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '../dbDetails/dbDetails?id=' + id
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ wx.showModal({
|
|
|
+ showCancel: false,
|
|
|
+ content: "您有未完成的学习课程,请先完成学习任务后再进行其他课程学习!"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
// 查询我是否有班&&班级名字
|
|
|
isClass(sessionKey) {
|
|
@@ -402,15 +521,15 @@ Page({
|
|
|
success: (res) => {
|
|
|
console.log(res, "查询学员信息")
|
|
|
if (res.data.code == 0 && res.data.data) {
|
|
|
- if (res.data.data.isAgree == 0) {
|
|
|
+ if (res.data.data.agreement == 0) {
|
|
|
this.setData({
|
|
|
studentName: res.data.data.studentName,
|
|
|
- show: true
|
|
|
+ show: false
|
|
|
});
|
|
|
} else {
|
|
|
this.setData({
|
|
|
studentName: res.data.data.studentName,
|
|
|
- show: false
|
|
|
+ show: true
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -461,6 +580,13 @@ Page({
|
|
|
this.setData({
|
|
|
kcArr: res.data.list
|
|
|
});
|
|
|
+ for (let i = 0; i < res.data.list.length; i++) {
|
|
|
+ if (res.data.list[i].isStudyDone == 0) {
|
|
|
+ this.setData({
|
|
|
+ IngCourseArr: res.data.list[i]
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
let result = [];
|
|
|
if (res.data.list)
|
|
|
for (let i = 0; i < res.data.list.length; i++) {
|