123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- // pages/classroom_assessment/classroom_assessment.js
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- baseImgUrl: app.globalData.baseImgUrl,
- isClass:true,
- starList: [
- {
- url: '../../assets/star-2@2x.png',
- activeUrl: '',
- },
- {
- url: '../../assets/star-2@2x.png',
- activeUrl: '',
- },
- {
- url: '../../assets/star-2@2x.png',
- activeUrl: '',
- },
- {
- url: '../../assets/star-2@2x.png',
- activeUrl: '',
- },
- {
- url: '../../assets/star-2@2x.png',
- activeUrl: '',
- }
- ],
- tagList:[
-
- ],
- wordList:[],
- normalSrc: '../../image/min_star_gay.png',
- selectedSrc: '../../image/min_star_red.png',
- halfSrc: '../../image/min_star_red.png',
- key: 0,//评分
- num: '',
- content: ''
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.setData( options )
- console.log(options);
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.seeEvaluate()
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
-
- // 批改老师提交
- checkTeacher: function () {
- const postData = { fn: this.submitAssessment, param: { ...arguments } }
- const { lever, lableList, isJudge ,teacherId, homeworkId } = this.data;
- console.log(lever, lableList, isJudge, teacherId, homeworkId)
- if (isJudge == 1) {
- wx.showToast({
- title: '已评价,请勿重复评价',
- icon: 'none'
- });
- return
- }
- if (!lever) {
- wx.showToast({
- title: '请选择星级',
- icon: 'none'
- })
- return
- }
- if (!lableList) {
- wx.showToast({
- title: '请选择评语',
- icon: 'none'
- })
- return
- }
- app.post('/api/parents/parents/V2/assessCorrectTeacher', {
- teacherId,
- homeworkId,
- level:lever,
- lableList
- }, 0, postData).then(res => {
- wx.showToast({
- title: '评价成功',
- icon: 'none',
- duration: 1000
- });
- setTimeout((function callback() {
- wx.navigateBack({});
- }).bind(this), 2000);
- })
- },
- /**
- * 查看评价
- */
- seeEvaluate:function(){
- const postData = { fn: this.seeEvaluate, param: { ...arguments } }
- const { teacherId, homeworkId } = this.data;
- app.post('/api/parents/parents/V2/getCorrectTeacherAssessment', {
- teacherId,
- homeworkId
- }, 0, postData).then(res => {
- const { labelList, isJudge, judgeLever } = res.data;
- var tagList=[];
- for (var i in labelList){
- if (judgeLever == labelList[i].lever){
- tagList.push(labelList[i])
- }
- }
- this.setData({ labelList, isJudge, lever:judgeLever, tagList})
- })
- },
- //点击整颗星
- selectRight: function (e) {
- const postData = { fn: this.selectRight, param: { ...arguments } }
- const { key} = e.currentTarget.dataset;
- const { courseId, isClass, teacherId, homeworkId} = this.data;
- console.log(isClass)
- this.setData({ lever: key});
- var url = !isClass ? '/api/parents/parents/getCourseAssessment' : '/api/parents/parents/V1/getCorrectTeacherAssessment';
- var str = !isClass ? { courseId } : { teacherId, homeworkId };
- app.post(url, str, 0, postData).then(res => {
- const { labelList, isJudge} = res.data;
-
- var tagList=[];
- for (var i in labelList){
- if (key == labelList[i].lever){
- tagList.push(labelList[i].label)
- }
- }
-
- this.setData({ tagList, isJudge });
- })
- },
- // 选择标签
- clickTag:function(e){
- const { tagList}=this.data;
- const {index}=e.target.dataset;
- var temp={};
- temp[`tagList[0][${index}].status`] = tagList[0][index].status == 'active' ? "" : 'active';
- this.setData(temp);
- this.tagList();
- },
- // 标签内容
- tagList:function(){
- const { tagList } = this.data;
- const lableList = [];
- for (var i in tagList[0]) {
- if (tagList[0][i].status == "active") {
- lableList.push(tagList[0][i].labelName);
- }
- }
- this.setData({ lableList});
- },
- // 提交
- submitAssessment:function(){
- const postData = { fn: this.submitAssessment, param: { ...arguments } }
- const { lever, lableList, courseId, isJudge}=this.data;
- if (isJudge == 1) {
- wx.showToast({
- title: '已评价,请勿重复评价',
- icon: 'none'
- });
- return
- }
- if (!lever) {
- wx.showToast({
- title: '请选择星级',
- icon: 'none'
- })
- return
- }
- if (!lableList) {
- wx.showToast({
- title: '请选择评语',
- icon: 'none'
- })
- return
- }
- app.post('/api/parents/parents/upCourseAssessment', {
- courseId,
- lever,
- lableList
- }, 0, postData).then(res => {
- wx.showToast({
- title: '评价成功',
- icon:'none',
- duration:1000
- });
- setTimeout((function callback() {
- wx.navigateBack({});
- }).bind(this), 2000);
-
- })
- }
- })
|