index.js 4.4 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/studentcenter/index"],{6214:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=s(n("da92")),a=n("cabd"),o=n("eaf8");function s(t){return t&&t.__esModule?t:{default:t}}var r=function(){Promise.all([n.e("common/vendor"),n.e("node-modules/@dcloudio/uni-ui/lib/uni-calendar/uni-calendar")]).then(function(){return resolve(n("25d4"))}.bind(null,n)).catch(n.oe)},u=function(){n.e("components/swiper-tab").then(function(){return resolve(n("d0ba"))}.bind(null,n)).catch(n.oe)},c={components:{uniCalendar:r,swiperTab:u},data:function(){return{topHeader:this.globalCustomBarHeight,type:"schedule",menuList:["我的","历史"],currentIndex:0,page_num:1,noMore:!1,list:[],classList:[],info:{year:"",month:"",day:"",selected:[]},present:{absenteeism_num:0,actual_section_num:5,be_section_num:5,late_num:0,leave_num:0,normal_num:0},attendance:{leave_num:{title:"请假",times:2,color:"#9bde78"},late_num:{title:"正常",times:3,color:"#e0be60"},normal_num:{title:"迟到",times:1,color:"#61d4e2"},absenteeism_num:{title:"旷课",times:0,color:"#d697eb"}}}},onShow:function(){var t=(0,o.getDate)(new Date,0);this.info.year=t.year,this.info.month=t.month,this.info.day=t.date,this.init()},methods:{init:function(){var t=this;"mine"===this.type?this.get_list():this.get_attend().then((function(e){t.present=e.data,t.fix_attend(e.data),t.drawChart(),t.get_dateCourse()}))},classOperation:function(t){this.globalNavigateTo("studentOperation",{id:t})},askLeave:function(t){this.globalNavigateTo("studentAbsent",{id:t})},loadMore:function(){if(this.noMore)return t.showToast({title:"没有更多了",icon:"none"}),!1;this.page_num++,this.get_list()},get_list:function(){0===this.currentIndex?this.get_course():this.get_history()},get_course:function(){var t=this;(0,a._nowCourse)({page_num:this.page_num}).then((function(e){t.page_num>1?(e.data.length<t.page_size&&(t.noMore=!0),t.list=t.list.concat(e.data)):(t.noMore=!1,t.list=e.data)}))},get_history:function(){var t=this;(0,a._courseHistory)({page_num:this.page_num}).then((function(e){t.page_num>1?(e.data.length<t.page_size&&(t.noMore=!0),t.list=Object.assign({},t.list,e.data)):(t.noMore=!1,t.list=e.data)}))},drawChart:function(){for(var t in this.attendance)this.draw(this.attendance[t],t)},changeTab:function(t){var e=this;this.type=t,this.$nextTick((function(){e.init()}))},swipe:function(t){this.currentIndex=t,this.page_num=1,this.get_list()},changeDay:function(t){},monthSwitch:function(t){console.log(t)},get_attend:function(){var t=this.info.year+"-"+this.info.month;return new Promise((function(e,n){var i=(0,a._attendance)({date:t});e(i)}))},fix_attend:function(t){var e=this;Object.keys(this.attendance).forEach((function(n){e.attendance[n].times=t[n]}))},get_dateCourse:function(){var t=this;(0,a._dateCourse)({year:this.info.year,month:this.info.month}).then((function(e){t.classList=e.data}))},draw:function(e,n){var a=t.createCanvasContext(n),o=100*i.default.divide(e.times,this.present.be_section_num),s=1.5,r=1.5+2*o/100;a.beginPath(),a.arc(34,40,28,0,2*Math.PI),a.setStrokeStyle("#EDEDED"),a.setLineWidth("8"),a.setLineCap("round"),a.stroke(),a.beginPath(),a.arc(34,40,28,s*Math.PI,r*Math.PI),a.setStrokeStyle(e.color),a.setLineWidth("8"),a.setLineCap("round"),a.stroke(),a.setFontSize(14),a.setFillStyle("#000"),a.fillText(e.times+"次",20,44),a.draw()}}};e.default=c}).call(this,n("543d")["default"])},"710e":function(t,e,n){"use strict";var i=n("c268"),a=n.n(i);a.a},7375:function(t,e,n){"use strict";var i,a=function(){var t=this,e=t.$createElement;t._self._c},o=[];n.d(e,"b",(function(){return a})),n.d(e,"c",(function(){return o})),n.d(e,"a",(function(){return i}))},b4d3:function(t,e,n){"use strict";(function(t){n("6cdc");i(n("66fd"));var e=i(n("d980"));function i(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,n("543d")["createPage"])},c268:function(t,e,n){},d980:function(t,e,n){"use strict";n.r(e);var i=n("7375"),a=n("f3f1");for(var o in a)"default"!==o&&function(t){n.d(e,t,(function(){return a[t]}))}(o);n("710e");var s,r=n("f0c5"),u=Object(r["a"])(a["default"],i["b"],i["c"],!1,null,null,null,!1,i["a"],s);e["default"]=u.exports},f3f1:function(t,e,n){"use strict";n.r(e);var i=n("6214"),a=n.n(i);for(var o in i)"default"!==o&&function(t){n.d(e,t,(function(){return i[t]}))}(o);e["default"]=a.a}},[["b4d3","common/runtime","common/vendor"]]]);