123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- const app = getApp()
- const util = require("../../../utils/util");
- const api = require('../../../api/api.js');
- const user = require('../../../utils/user.js');
- import moment from 'moment'
- Page({
- data: {
- evalId:'',
- skillList:[],
- sumStudyTime:'',
- currentTab:'1',
- typeList: [
- {text:'全部',value:''}
- ],
- type: '',
- date: moment(new Date()).format('YYYY-MM'),
- currentDate: new Date().getTime(),
- minDate: new Date('2022-01-01').getTime(),
- pickerShow:false,
- star:0,
- evalShow:false,
- courseList:[],
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.selectComponent('#tabs').resize();
- this.getStudyDuration();
- this.getTypeList();
- // this.getMyCourse();
- },
- onClickShow(){
- this.setData({
- evalShow: false,
- });
- },
- submitEval(){
- if(this.data.star==0){
- wx.showToast({
- title: '请选择评价星级',
- icon:'none'
- })
- }else{
- util.request(api.workerCourseScore, {
- enrolmentId:this.data.evalId,
- workerScore:this.data.star
- }, 'GET').then(res=> {
- if (res.errno === 0) {
- wx.showToast({
- title: '评价成功',
- icon:'none'
- })
- this.setData({
- evalShow:false,
- });
- this.getMyCourse()
- }else{
- wx.showToast({
- title: res.errmsg,
- icon:'none'
- })
- }
- });
-
- }
- },
- stop:function(){
- //阻止弹框冒泡和捕获的空事件,不要删除!!!
- },
- goStar(e){
- let id=e.currentTarget.dataset.id;
- this.setData({
- evalShow: true,
- star:0,
- evalId:id
- });
- },
- onChange(event) {
- this.setData({
- star: event.detail,
- });
- },
- getMyCourse(){
- util.request(api.getMyCourse, {
- categorySubId:this.data.type,
- courseType:this.data.currentTab,
- studyType :'1',
- yearMonth:this.data.date
- }, 'GET').then(res=> {
- if (res.errno === 0) {
- this.setData({
- courseList:res.data
- });
- }
-
- });
- },
- getStudyDuration(){
- util.request(api.getStudyDuration, {
- }, 'GET').then(res=> {
- if (res.errno === 0) {
- this.setData({
- sumStudyTime:res.data.sumStudyTime,
- skillList:res.data.willSkill
- });
- }
-
- });
- },
- getTypeList(){
- util.request(api.getCategoryDict, {
- }, 'GET').then(res=> {
- if (res.errno === 0) {
- let list=res.data;
- let current=[{text:'全部',value:''}];
- list.forEach(item=>{
- let obj={text:item.type,value:item.id};
- current.push(obj);
- });
- this.setData({
-
- typeList:current,
- type:''
- });
- }
-
- });
- },
- dropdownChange(e){
- let type=e.detail;
- this.setData({
- type:type
- });
- this.getMyCourse();
- },
- dateSelect(){
- this.setData({
- pickerShow:true
- })
- },
- onCancel(){
- this.setData({
- pickerShow:false
- })
- },
- onConfirm(e){
- console.log(e);
- let date=moment(e.detail).format('YYYY-MM');
- this.setData({
- date:date,
- pickerShow:false
- });
- this.getMyCourse();
- },
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.getMyCourse();
-
- },
- switchTab(e){
- let tab=e.detail.name;
- this.setData({
- currentTab:tab,
- courseList:[]
- });
- this.getMyCourse();
-
- },
- goCurrent(){
- // wx.pageScrollTo({
- // selector: '.tab-sticky',
- // duration: 300
- // })
- wx.navigateTo({
- url: '/pages/upgrade/currentCourse/currentCourse',
- })
- },
- goLearn(e){
- // let id=e.currentTarget.dataset.id;
- let courseid=e.currentTarget.dataset.courseid;
- let userInfo = wx.getStorageSync('userInfo');
- util.request(api.startStudy, {
- courseId:courseid,
- workerNo: userInfo.workerNo,
- }, 'GET').then(res=> {
- if (res.errno == 0) {
- let id=res.data.enrolmentId;
- wx.navigateTo({
- url: '/pages/upgrade/courseDetail/courseDetail?id='+id+'&courseid='+courseid,
- });
- }
-
- });
-
- },
- continueLearn(e){
- let id=e.currentTarget.dataset.id;
- let courseid=e.currentTarget.dataset.courseid;
- wx.navigateTo({
- url: '/pages/upgrade/courseDetail/courseDetail?id='+id+'&courseid='+courseid,
- });
- },
-
- onHide: function () {
- },
- onUnload: function () {
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
-
- })
|