Browse Source

彩蛋,新学生 都加上了

Changpeng Duan 5 năm trước cách đây
mục cha
commit
da415903a8

+ 2 - 2
pc/src/views/Member.vue

@@ -276,7 +276,7 @@
                             <el-input v-model="form.weight" placeholder="kg" type="number"></el-input>
                         </el-form-item>
                         <el-form-item label="静态心率" >
-                        <el-input v-model="form.staticHr " placeholder="请输入" type="number"></el-input>
+                        <el-input v-model="form.staticHr" placeholder="请输入" type="number"></el-input>
                         </el-form-item>
                         <el-form-item label="性别" :required="true">
                             <el-select v-model="form.sex " placeholder="">
@@ -1232,7 +1232,7 @@
                 this.form.gifthour = 0;
                 this.form.height = '';
                 this.form.weight = '';
-                this.form.staticHr = 0;
+                this.form.staticHr = '';
                 this.form.sex = 1;
                 this.form.birthday = '';
                 this.form.userCode = '';

+ 2 - 2
pc/src/views/versionControlMefisto.vue

@@ -99,7 +99,7 @@
                 formdata.append('file', req.file);
                 formdata.append('version', that.upload.version);
                 formdata.append('updateContent', that.upload.updateContent);
-                this.axios.post(this.falseApi.UpVueFramework, formdata, config).then(res => {
+                this.axios.post(this.trueApi.UpVueFramework, formdata, config).then(res => {
                   console.log(res.data);
                 })
 
@@ -118,7 +118,7 @@
                     token: localStorage.token,
                 };
                 let postdata = qs.stringify(param);
-                let url = that.falseApi.QueryVueFramework;
+                let url = that.trueApi.QueryVueFramework;
                 axios.post(url, postdata).then(function (data) {
                     let json = data.data;
                     if (json.Code == 0) {

+ 14 - 8
tv/src/Mock/index.js

@@ -136,8 +136,14 @@ let testStudent = function (num) {
         })
     }
 
+    let Dp = {
+        PlanName:'测试课程',
+        BeginTime:'19:30',
+    }
+
     return {
         Rs: item,
+        Dp: Dp,
         Code: 0,
         Memo: ''
     };
@@ -145,15 +151,15 @@ let testStudent = function (num) {
 
 let getClassStat = function(){
     return {
-        // 0: 下课 团课/私教/PK 的排名
-        // 1:团课/私教 todo
+
+        // 1:团课/私教
         // 2:竞技课2PK
         // 3:竞技课threepk
 
-        ClassOn: 1, //
+        ClassOn: 1, //   // 0: 下课 团课/私教/PK 的排名
         Code: 0,
         Memo: "Success",
-        dp: 1,
+        dp: 3,
     };
 };
 
@@ -177,16 +183,16 @@ let getNewUser = function(code){
 };
 
 
-let t = 1;
-if (t == 2) {
+let t = 0;
+if (t == 1) {
     Mock.mock('/api/testTable', 'post', testTable());
     Mock.mock('/api/getUserList', 'post', getUserList());
     // 学生列表
-    Mock.mock('http://192.168.0.74:8080/UserListInfo', 'post', testStudent(2));
+    Mock.mock('http://192.168.0.74:8080/UserListInfo', 'post', testStudent(6));
      // 上课状态
     Mock.mock('http://192.168.0.74:8080/ClassStatQuery', 'post', getClassStat());
     // 新同学
-    Mock.mock('http://192.168.0.74:8080/getNewUser', 'post', getNewUser(999));
+    Mock.mock('http://192.168.0.74:8080/getNewUser', 'post', getNewUser(0));
 
 
 }

+ 5 - 5
tv/src/views/Main.vue

@@ -93,8 +93,8 @@
     import
     {
         getHello,
-        getRecordBreak,
         getClassStat,
+        getRecordBreak,
         getNewUser
     } from '@/api/getApiRes'
 
@@ -109,8 +109,6 @@
                 eqSn: '30:9C:23:0C:8B:1E',
                 pageStyle: RandomBg(),
                 trueDate: true,//真实数据 true false
-                totalTime: 4,
-                studentTime: 15,
                 times: 1,
                 thisClassName: '',
                 studentsClassName: [],
@@ -120,6 +118,8 @@
                 serachBtnStatus: false,
                 dialogMsg: '',
                 imgsrc: '../static/img/people/',
+                totalTime: 4,
+                studentTime: 15,
                 toperInfo: {
                     dialogVisible: false,
                     toper: {},
@@ -202,7 +202,7 @@
 
                 this.timer2 = setInterval(() => {
                     this.createEgg();
-                }, 1000);
+                }, 5000);
 
                 this.timer3 = setInterval(() => {
                     this.createNewStudent();
@@ -455,7 +455,7 @@
             }
         },
         components: {
-            Headside, newRecord, levelIcon, newStudent
+            Headside,  levelIcon, newRecord,newStudent
         }
     }
 </script>

+ 133 - 15
tv/src/views/pk.vue

@@ -1,7 +1,6 @@
 <template>
     <div class="pages">
         <Headside></Headside>
-
         <div class="pk-detail-con">
             <img src="../assets/img/pk/redGood.svg" class="lp_icon"/>
             <div class="progress">
@@ -175,15 +174,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';
 
@@ -211,17 +216,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();
@@ -261,12 +273,7 @@
                 let that = this;
                 if (val.path == '/pk') {
                     if (this.trueDate) {
-                        this.PkTimer = setInterval(() => {
-                            this.GetgetUserList();
-                            this.ClacClassTime();
-                            this.curgetClassStat();
-                        }, 1000);
-                        this.GetgetUserList();
+                        this.init();
                         // this.PkEgg = setInterval(() => {
                         //     this.createEgg();
                         // }, 6000);
@@ -278,16 +285,127 @@
                 } 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.GetgetUserList();
+                this.createEgg();
+                this.createNewStudent();
+
+                this.PkTimer = setInterval(() => {
+                    this.GetgetUserList();
+                    this.ClacClassTime();
+                    this.curgetClassStat();
+                }, 1000);
+
+                this.timer2 = setInterval(() => {
+                    this.createEgg();
+                }, 5000);
+
+                this.timer3 = setInterval(() => {
+                    this.createNewStudent();
+                }, 6000);
+            },
+            // 启动一个成就彩蛋
+            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)
+            },
             // 载入课程信息
             ReadLessonInfo(Dp) {
                 this.PlanName = Dp.PlanName;
@@ -512,7 +630,7 @@
             }
         },
         components: {
-            Headside
+            Headside, newRecord,newStudent
         }
     }
 </script>

+ 131 - 18
tv/src/views/threepk.vue

@@ -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>