【Angualr4】跨方法计算
来源:互联网 发布:国外域名 批量 编辑:程序博客网 时间:2024/06/15 23:41
前台TS辛辛苦苦写的TS代码,但是不能够跨方法计算,即使声明的是全局变量也不行,暂时放这里,作为个资料库 ,方便以后自己调用;(注:这里是半成品,不可全部copy)
this.examStudyTimeCount=0; this.examPointCount=0; this.examPntCntThsYr=0; this.examHourStudy=0; for(var i=0;i<this.messagenotices.length;i++){ /!*考试*!/ if(1==this.messagenotices[i].status) { var examId=this.messagenotices[i].examId; this.trainService.findExamUser(examId).subscribe(result2=>{ this.examUserList=result2; console.log(result2); var examUser=this.examUserList[0]; var exam=this.examUserList[0].exam; if (2==examUser.status) { this.examStudyTimeCount += exam.duration; this.examHourStudy = this.examStudyTimeCount / (60); this.examPointCount += examUser.integral; console.log("考试积分:"); console.log(examUser.integral); var timeStudy = new Date(examUser.handInTime); var time00001 = new Date(examUser.handInTime); time00001.setMonth(0); time00001.setDate(0); time00001.setHours(0); time00001.setMinutes(0); time00001.setMilliseconds(1); var now1 = new Date(); if (timeStudy < now1 && timeStudy > time00001) { this.examPntCntThsYr += examUser.integral; } } }); } /!*warn 培训*!/ if(2==this.messagenotices[i].status){ this.studyTimeCount=0; this.pointCount=0; this.studyTimeOnce=0; this.pntCntThsYr=0; this.hourStudy=0; this.train=this.messagenotices[i].train; this.pointCount += this.train.point; console.log("培训积分:"); console.log(this.pointCount); this.trainService.findTrainMarksAndTime(this.train.id).subscribe(result3=>{ this.trainList=result3; var trainInfo = this.trainList[0]; var st: any = new Date(trainInfo.startDate); var et: any = new Date(trainInfo.endDatess); this.studyTimeOnce = parseInt((et - st).toString()); this.studyTimeCount += this.studyTimeOnce; this.hourStudy = Math.round(this.studyTimeCount / (1000 * 60 * 60)); var timeStudy = new Date(trainInfo.endDatess); var time00001 = new Date(trainInfo.endDatess); time00001.setMonth(0); time00001.setDate(0); time00001.setHours(0); time00001.setMinutes(0); time00001.setMilliseconds(1); var now1 = new Date();//获取现在时间; if (timeStudy < now1 && timeStudy > time00001) { this.pntCntThsYr += this.train.point; } }); } } /*this.hourFinal=this.hourStudy+this.examHourStudy; this.pointFinal=this.pointCount+this.examPointCount;//6分 console.log("最终积分"); console.log(this.pointFinal); this.pntCnYrFinal=this.pntCntThsYr+this.examPntCntThsYr;*/
阅读全文
0 0
- 【Angualr4】跨方法计算
- angualr4 环境搭建
- angualr4基础之组件生命周期
- angualr4中使用event.clientX
- angualr4 动态设置页面标题
- 使用Angular CLI创建一个Angualr4项目
- 组件间通信 angualr4中间人模式
- angualr4模板目录及angular模块解析
- 在angualr4中年引入ng-bootstrap
- 在angualr4中年引入ng-bootstrap
- angualr4+ionic3开发app中popover的用法
- 计算几何方法概览
- 计算页数方法
- GPS计算距离方法
- 固定资产折旧计算的方法
- 计算剩余时间的方法
- 计算CPU的方法
- 计算MD5值方法
- Spring入门(基于Java的容器注解之@Scope和基于泛型的自动装配)
- 【Leetcode】【python】Pow(x, n)
- 【20170929】C语言每日一练
- jdk9新特性
- 国庆阅兵 我们阅代码!全球知名区块链底层技术对比
- 【Angualr4】跨方法计算
- iOS下JS与OC互相调用(二)--WKWebView 拦截URL
- [简单题]Consecutive strings
- HTML网页链接
- iOS下JS与OC互相调用(三)--MessageHandler
- 解决 Android N 上报错:android.os.FileUriExposedException: file:///storage/emulated/0/
- 用户体验的时间尺度
- Java Web学习总结(38)——JavaWeb网站架构设计总结
- redis的回收策略