|
|
@@ -241,15 +241,21 @@
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <newRecord :toper-info="toperInfo"></newRecord>
|
|
|
+ <newStudent :student-info="studentInfo"></newStudent>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import '../libs/rem';
|
|
|
import Headside from '@/components/Headside'
|
|
|
+ import newRecord from '@/components/newRecord'
|
|
|
+ import newStudent from '@/components/newStudent'
|
|
|
import {
|
|
|
getHello,
|
|
|
- getClassStat
|
|
|
+ getClassStat,
|
|
|
+ getRecordBreak,
|
|
|
+ getNewUser
|
|
|
} from '@/api/getApiRes'
|
|
|
import '../libs/rem';
|
|
|
|
|
|
@@ -282,17 +288,24 @@
|
|
|
endTime: '00:00:00',
|
|
|
redSum: 0,
|
|
|
blueSum: 0,
|
|
|
- }
|
|
|
+ },
|
|
|
+ totalTime: 4,
|
|
|
+ studentTime: 15,
|
|
|
+ toperInfo: {
|
|
|
+ dialogVisible: false,
|
|
|
+ toper: {},
|
|
|
+ },
|
|
|
+ studentInfo: {
|
|
|
+ dialogVisible: false,
|
|
|
+ Rs: [],
|
|
|
+ percent: 0
|
|
|
+ },
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
let that = this;
|
|
|
if (this.trueDate) {
|
|
|
- this.PkTimer = setInterval(() => {
|
|
|
- this.GetgetUserList();
|
|
|
- this.curgetClassStat();
|
|
|
- }, 1000);
|
|
|
- this.GetgetUserList();
|
|
|
+ this.init();
|
|
|
|
|
|
// this.PkEgg = setInterval(() => {
|
|
|
// this.createEgg();
|
|
|
@@ -331,12 +344,7 @@
|
|
|
'$route': function (val) {
|
|
|
if (val.path == '/threepk') {
|
|
|
if (this.trueDate) {
|
|
|
- this.PkTimer = setInterval(() => {
|
|
|
- this.GetgetUserList();
|
|
|
- this.ClacClassTime();
|
|
|
- this.curgetClassStat();
|
|
|
- }, 1000);
|
|
|
- this.GetgetUserList();
|
|
|
+ this.init();
|
|
|
|
|
|
// this.PkEgg = setInterval(() => {
|
|
|
// this.createEgg();
|
|
|
@@ -350,16 +358,41 @@
|
|
|
} else {
|
|
|
clearInterval(this.PkTimer);
|
|
|
clearInterval(this.PkEgg);
|
|
|
+ clearInterval(this.timer2);
|
|
|
+ clearInterval(this.timer3);
|
|
|
+ this.PkTimer = null;
|
|
|
+ this.PkEgg = null;
|
|
|
+ this.timer2 = null;
|
|
|
+ this.timer3 = null;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
clearInterval(this.PkTimer);
|
|
|
clearInterval(this.PkEgg);
|
|
|
+ clearInterval(this.timer2);
|
|
|
+ clearInterval(this.timer3);
|
|
|
this.PkTimer = null;
|
|
|
this.PkEgg = null;
|
|
|
+ this.timer2 = null;
|
|
|
+ this.timer3 = null;
|
|
|
},
|
|
|
methods: {
|
|
|
+ init(){
|
|
|
+ this.PkTimer = setInterval(() => {
|
|
|
+ this.GetgetUserList();
|
|
|
+ this.curgetClassStat();
|
|
|
+ }, 1000);
|
|
|
+ this.GetgetUserList();
|
|
|
+
|
|
|
+ this.timer2 = setInterval(() => {
|
|
|
+ this.createEgg();
|
|
|
+ }, 5000);
|
|
|
+
|
|
|
+ this.timer3 = setInterval(() => {
|
|
|
+ this.createNewStudent();
|
|
|
+ }, 6000);
|
|
|
+ },
|
|
|
// 载入课程信息
|
|
|
ReadLessonInfo(Dp) {
|
|
|
this.PlanName = Dp.PlanName;
|
|
|
@@ -485,12 +518,9 @@
|
|
|
let that = this;
|
|
|
let numberClass = '';
|
|
|
switch (true) {
|
|
|
- case parseInt(res.length) <= 2 && parseInt(res.length) > 0:
|
|
|
+ case parseInt(res.length) <= 2 && parseInt(res.length) >= 0:
|
|
|
numberClass = 'two';
|
|
|
break;
|
|
|
- // case parseInt(res.length) == 3:
|
|
|
- // numberClass = 'three';
|
|
|
- // break;
|
|
|
case parseInt(res.length) <= 4 && parseInt(res.length) >= 3:
|
|
|
numberClass = 'four';
|
|
|
break;
|
|
|
@@ -544,6 +574,89 @@
|
|
|
// sumMax = parseFloat(Redsum) + parseFloat(Bluesum);
|
|
|
// that.classInfo.pkVal = (that.classInfo.redSum / sumMax) * 100 + '%';
|
|
|
// },
|
|
|
+
|
|
|
+ // 启动一个成就彩蛋
|
|
|
+ createEgg() {
|
|
|
+ let that = this;
|
|
|
+ let param = {
|
|
|
+ token: localStorage.token,
|
|
|
+ eqSn: localStorage.eqSn
|
|
|
+ };
|
|
|
+ let postdata = qs.stringify(param);
|
|
|
+ getRecordBreak(postdata).then(res => {
|
|
|
+ let json = res;
|
|
|
+ if (json.Code == 0) {
|
|
|
+ // 欢迎新学生时不显示彩蛋
|
|
|
+ if (that.studentInfo.dialogVisible == true) {
|
|
|
+ console.log('正在显示新学生');
|
|
|
+ return false
|
|
|
+ }else{
|
|
|
+ this.OpenEgg(json);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 并没有人破记录
|
|
|
+ if (json.Code == 999) return false;
|
|
|
+ if (json.Code != 999) that.$message.error(json.Memo + '[egg]');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 欢迎新同学
|
|
|
+ createNewStudent() {
|
|
|
+ console.log(223);
|
|
|
+ let that = this;
|
|
|
+ let param = {
|
|
|
+ token: localStorage.token,
|
|
|
+ eqSn: localStorage.eqSn
|
|
|
+ };
|
|
|
+ let postdata = qs.stringify(param);
|
|
|
+ getNewUser(postdata).then(res => {
|
|
|
+ let json = res;
|
|
|
+ if (json.Code == 0) {
|
|
|
+ console.log('来新生了');
|
|
|
+ // 显示彩蛋时不欢迎新学生
|
|
|
+ if (that.toperInfo.dialogVisible == true) {
|
|
|
+ console.log('正在显示彩蛋');
|
|
|
+ return false
|
|
|
+ }else{
|
|
|
+ that.OpenStudent(json.Rs);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 并没有人破记录
|
|
|
+ if (json.Code == 999) return false;
|
|
|
+ if (json.Code != 999) that.$message.error(json.Memo + '[egg]');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ OpenEgg(msg) {
|
|
|
+ this.toperInfo.toper = msg.Rs;
|
|
|
+ this.toperInfo.dialogVisible = true;
|
|
|
+ // 倒计时5秒自动关闭
|
|
|
+ let that = this;
|
|
|
+ this.totalTime = 4;
|
|
|
+ let clock = window.setInterval(() => {
|
|
|
+ this.totalTime--;
|
|
|
+ if (parseInt(this.totalTime) < 0) {
|
|
|
+ that.toperInfo.dialogVisible = false;
|
|
|
+ clearInterval(clock);
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+ },
|
|
|
+ OpenStudent(msg) {
|
|
|
+ let that = this;
|
|
|
+ that.studentInfo.Rs = msg;
|
|
|
+ that.studentInfo.dialogVisible = true;
|
|
|
+ // 倒计时5秒自动关闭
|
|
|
+ this.studentTime = 6;
|
|
|
+ let clock = window.setInterval(() => {
|
|
|
+ this.studentTime--;
|
|
|
+ let num = parseInt((6 - this.studentTime) / 6) * 100;
|
|
|
+ this.studentInfo.percent = num > 100 ? 100 : num;
|
|
|
+ if (parseInt(this.studentTime) < 0) {
|
|
|
+ that.studentInfo.dialogVisible = false;
|
|
|
+ clearInterval(clock);
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+ },
|
|
|
// 当前课程状态
|
|
|
curgetClassStat() {
|
|
|
let that = this;
|
|
|
@@ -612,7 +725,7 @@
|
|
|
},
|
|
|
|
|
|
components: {
|
|
|
- Headside
|
|
|
+ Headside, newRecord,newStudent
|
|
|
}
|
|
|
}
|
|
|
</script>
|