Prechádzať zdrojové kódy

排序问题解决,深浅拷贝再次击中我的膝盖,嘤嘤嘤

Changpeng Duan 5 rokov pred
rodič
commit
6f3ac8ed40

+ 18 - 4
pc/src/views/versionControlMefisto.vue

@@ -3,7 +3,7 @@
         <br>
         <br>
         <br>
-        <el-row :gutter="20">
+        <el-row :gutter="20" v-loading="loading">
             <el-col :span="10">
                 <el-card class="box-card">
                     <div slot="header" class="clearfix">
@@ -14,7 +14,7 @@
                     </div>
                     <br>
                     <div class="text item">
-                        时间 {{ CreatedAt }}
+                        时间 {{ CreatedAt | filterFmtDate}}
                     </div>
                     <br>
                     <div class="text item">
@@ -74,6 +74,7 @@
                     UpVueFramework: 'http://192.168.0.3:19096/v1/Sensors/UpVueFramework',
                     QueryVueFramework: 'http://192.168.0.3:19096/v1/Sensors/QueryVueFramework',
                 },
+                loading: false,
                 Version: '',
                 CreatedAt: '',
                 FileName: '',
@@ -92,6 +93,7 @@
         methods: {
             upqiniu(req) {
                 let that = this;
+                that.loading = true;
                 const config = {
                     headers: {'Content-Type': 'multipart/form-data'}
                 };
@@ -100,9 +102,11 @@
                 formdata.append('version', that.upload.version);
                 formdata.append('updateContent', that.upload.updateContent);
                 this.axios.post(this.trueApi.UpVueFramework, formdata, config).then(res => {
-                  console.log(res.data);
+                    console.log(res.data);
+                //     // 重载
+                    that.QueryVueFramework();
+                    that.loading = false;
                 })
-
             },
             // 验证文件合法性
             beforeUpload(file) {
@@ -131,6 +135,16 @@
                     }
                 })
             }
+        },
+        filters: {
+            filterFmtDate(val) {
+                if (!val) {
+                    return '--'
+                } else {
+                    return nonTfmtDate(val, 16);
+                }
+            },
+
         }
     }
 </script>

+ 26 - 0
tv/src/Global.js

@@ -451,3 +451,29 @@ fakeNews = function (num, team) {
     }
     return item;
 };
+
+// 欢迎新同学
+OpenStudent = function (msg, that) {
+    that.studentInfo.Rs = msg;
+    that.studentInfo.dialogVisible = true;
+    // 倒计时5秒自动关闭
+    let studentTime = 6;
+    let clock = window.setInterval(() => {
+        studentTime--;
+        let num = (6 - studentTime) / 6 * 100;
+        this.studentInfo.percent = num > 100 ? 100 : num;
+        console.log('num' + num);
+        console.log('studentTime' + this.studentTime);
+        if (parseInt(studentTime) < 0) {
+            that.studentInfo.dialogVisible = false;
+            clearInterval(clock);
+        }
+    }, 1000)
+};
+
+// 深拷贝
+deepClone = function (obj) {
+    let _obj = JSON.stringify(obj),
+        objClone = JSON.parse(_obj);
+    return objClone
+}

+ 21 - 18
tv/src/Mock/index.js

@@ -130,16 +130,17 @@ let testStudent = function (num) {
             "Ck": "@integer(10, 100)",
             "formatCk": "@integer(10, 100)",
             "Head": "http://192.168.0.2/gc.png",
-            "GroupNo": "@integer(1, 3)",
+            // "GroupNo": "@integer(1, 3)",
+            "GroupNo": "@integer(1,3)",
             "Sex": "@integer(1, 2)",
-            "IsBirthday": "@integer(0, 1)",
+            "IsBirthday": "@integer(1, 1)",
         })
     }
 
     let Dp = {
-        PlanName:'测试课程',
-        BeginTime:'19:30',
-    }
+        PlanName: '测试课程',
+        BeginTime: '19:30',
+    };
 
     return {
         Rs: item,
@@ -149,24 +150,22 @@ let testStudent = function (num) {
     };
 };
 
-let getClassStat = function(){
+let getClassStat = function () {
     return {
-
+        ClassOn: 0, //   // 0: 下课 团课/私教/PK 的排名
+        Code: 0,
+        Memo: "Success",
+        dp: 2,
         // 1:团课/私教
         // 2:竞技课2PK
         // 3:竞技课threepk
-
-        ClassOn: 1, //   // 0: 下课 团课/私教/PK 的排名
-        Code: 0,
-        Memo: "Success",
-        dp: 3,
     };
 };
 
-let getNewUser = function(code){
+let getNewUser = function (code) {
 
     let item = [];
-    for (var i = 0; i < 3; i++) {
+    for (var i = 0; i < 12; i++) {
         item.push({
             "SvId": "@guid",
             "UserId": "@integer(15253135600, 15253135699)",
@@ -185,14 +184,18 @@ let getNewUser = function(code){
 
 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(6));
-     // 上课状态
+    Mock.mock('http://192.168.0.74:8080/UserListInfo', 'post', testStudent(12));
+    // 下课排名
+    Mock.mock('http://192.168.0.74:8080/ClassUserRank', 'post', testStudent(20));
+    // 上课状态
     Mock.mock('http://192.168.0.74:8080/ClassStatQuery', 'post', getClassStat());
-    // 新同学
-    Mock.mock('http://192.168.0.74:8080/getNewUser', 'post', getNewUser(0));
+    // 新同学 0 999
+    Mock.mock('http://192.168.0.74:8080/getNewUser', 'post', getNewUser(999));
 
 
 }

+ 18 - 12
tv/src/components/newStudent.vue

@@ -2,7 +2,7 @@
     <el-dialog title="" :visible.sync="studentInfo.dialogVisible" :close-on-click-modal="false">
         <div class="newStudentContainer">
             <div class="info">
-                <span v-for="s in studentInfo.Rs">{{s.Name}}</span>
+                <span v-for="(s,i) in studentInfo.Rs" v-if="i < 8">{{s.Name}}</span>
             </div>
             <div class="studentTips">
                 <span>
@@ -98,7 +98,7 @@
 
     .detail span {
         color: #fff;
-        font-size: 0.3rem;
+        font-size: 0.6rem;
         font-family: vista;
     }
 
@@ -113,7 +113,7 @@
 
     .newStudentContainer {
         width: 100%;
-        overflow: hidden;
+        overflow: visible;
         display: block;
         margin: 0 auto;
         margin-top: 2rem;
@@ -121,10 +121,14 @@
 
     .info {
         width: 50%;
-        height: 2.5rem;
+        height: 2rem;
         overflow: hidden;
-        display: block;
+        display: flex;
         margin: 0 auto;
+        padding-top: 0.5rem;
+        flex: 1;
+        flex-wrap: wrap;
+        /*justify-content: space-between;*/
     }
 
     .info span {
@@ -134,10 +138,9 @@
         color: #a00;
         text-shadow: 0px 0px 1px #ffa200;
         /*margin-right: 1rem;*/
-        flex: 1;
-        padding-left: 0.2rem;
-        padding-right: 0.2rem;
-        padding-bottom: 0.2rem;
+        padding-left: 0.1rem;
+        padding-right: 0.1rem;
+        padding-bottom: 0rem;
     }
 
     .studentTips {
@@ -149,25 +152,28 @@
 
     .studentTips span {
         width: 100%;
+        height: 0.3rem;
         overflow: hidden;
         display: flex;
         margin: 0 auto;
+        padding-top: 0.1rem;
         text-align: center;
         font-weight: 500;
-        font-size: 0.2rem;
+        font-size: 0.3rem;
         color: #000;
         align-items: center;
         justify-content: center;
     }
     .progress {
         position: relative;
-        width: 77%;
+        top:0.1rem;
+        width: 94%;
         overflow: hidden;
         display: block;
         margin: 0 auto;
     }
     /deep/ .el-progress-bar .el-progress-bar__outer {
-        height: 0.2rem;
+        height: 0.4rem;
 
     }
     /deep/ .el-progress-bar__inner {

+ 2 - 2
tv/src/views/Index.vue

@@ -110,9 +110,9 @@
                     if (json.Code == 0) {
                         if (version != json.Version) {
                             // 正式
-                            // let url = "http://cal.beswell.com:85/v1/Sensors/DownloadVueFramework";
+                            let url = "http://cal.beswell.com:85/v1/Sensors/DownloadVueFramework";
                             // 测试
-                            let url = "http://192.168.0.162/wgt/H5BB8BEB3.wgt";
+                            // let url = "http://192.168.0.162/wgt/H5BB8BEB3.wgt";
                             console.log('Version'+ json.Version);
                             console.log(json);
                             that.downWgt(url,json.Version);

+ 10 - 7
tv/src/views/Main.vue

@@ -189,7 +189,7 @@
             this.timer3 = null;
         },
         methods: {
-            init(){
+            init() {
                 this.GetgetUserList();
                 this.createEgg();
                 this.createNewStudent();
@@ -226,7 +226,7 @@
                         if (that.studentInfo.dialogVisible == true) {
                             console.log('正在显示新学生');
                             return false
-                        }else{
+                        } else {
                             this.OpenEgg(json);
                         }
                     } else {
@@ -252,8 +252,9 @@
                         if (that.toperInfo.dialogVisible == true) {
                             console.log('正在显示彩蛋');
                             return false
-                        }else{
+                        } else {
                             that.OpenStudent(json.Rs);
+                            // OpenStudent(json.Rs,that);
                         }
                     } else {
                         // 并没有人破记录
@@ -280,13 +281,15 @@
                 let that = this;
                 that.studentInfo.Rs = msg;
                 that.studentInfo.dialogVisible = true;
+                this.studentInfo.percent = 0;
                 // 倒计时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) {
+                    let num = (6 - this.studentTime) / 6 * 100;
+                    this.studentInfo.percent = parseInt(num) > 100 ? 100 : num;
+                    console.log('num' + num);
+                    if (parseInt(this.studentTime) <= 0) {
                         that.studentInfo.dialogVisible = false;
                         clearInterval(clock);
                     }
@@ -455,7 +458,7 @@
             }
         },
         components: {
-            Headside,  levelIcon, newRecord,newStudent
+            Headside, levelIcon, newRecord, newStudent
         }
     }
 </script>

+ 6 - 4
tv/src/views/Rank.vue

@@ -155,15 +155,16 @@
                             totalTime = 40
                         }
                         this.jumpWait(totalTime);
-                        this.students.CkSort = json.Rs;
-                        this.students.CalSort = json.Rs;
+                        let CkSort = json.Rs;
+                        let CalSort = deepClone(json.Rs);
                         let Rs = json.Rs;
                         if (Rs != '') {
                             // 排序
-                            that.students.CkSort = that.students.CkSort.sort(function (a, b) {
+                            that.students.CkSort = json.Rs.sort(function (a, b) {
                                 return b.Ck - a.Ck;
                             });
-                            that.students.CalSort = that.students.CalSort.sort(function (a, b) {
+
+                            that.students.CalSort = CalSort.sort(function (a, b) {
                                 return b.Cle - a.Cle;
                             });
                         }
@@ -179,6 +180,7 @@
                     }
                 })
             },
+
         },
         filters: {
             fmtNum(val) {

+ 17 - 7
tv/src/views/pk.vue

@@ -394,13 +394,15 @@
                 let that = this;
                 that.studentInfo.Rs = msg;
                 that.studentInfo.dialogVisible = true;
+                this.studentInfo.percent = 0;
                 // 倒计时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) {
+                    let num = (6 - this.studentTime) / 6 * 100;
+                    this.studentInfo.percent = parseInt(num) > 100 ? 100 : num;
+                    console.log('num' + num);
+                    if (parseInt(this.studentTime) <= 0) {
                         that.studentInfo.dialogVisible = false;
                         clearInterval(clock);
                     }
@@ -429,7 +431,6 @@
                             that.students.blueUnite.push(item);
                         }
                     })
-
                 }
                 that.giveClassName(that.students.redUnite, 1);
                 that.giveClassName(that.students.blueUnite, 2);
@@ -442,14 +443,17 @@
                 let blueSum = 0;
                 // that.redSum
                 Rs.redUnite.map(function (item, t) {
-                    redSum += parseFloat(item.Ck);
+                    redSum += parseFloat(item.Ck.toFixed(1));
                 });
                 Rs.blueUnite.map(function (item, t) {
-                    blueSum += parseFloat(item.Ck);
+                    blueSum += parseFloat(item.Ck.toFixed(1));
                 });
                 that.redSum = redSum.toFixed(1);
                 that.blueSum = blueSum.toFixed(1);
 
+                // that.redSum = redSum;
+                // that.blueSum = blueSum;
+
                 // 进度条 formatCk
                 let redFmtSum = 0;
                 let blueFmtSum = 0;
@@ -1294,10 +1298,16 @@
         line-height: 1.2rem;
     }
 
+    .three .user .ult em {
+        height: 1rem;
+    }
+
     .three .urt em {
         line-height: 1.2rem;
     }
-
+    .three .user .urt {
+        height: 1rem;
+    }
     .three .bottomLi img {
         width: 0.4rem;
         height: 0.4rem;

+ 8 - 6
tv/src/views/threepk.vue

@@ -436,13 +436,13 @@
                 let yellowSum = 0;
                 // that.redSum
                 Rs.redUnite.map(function (item, t) {
-                    redSum += parseFloat(item.Ck)
+                    redSum += parseFloat(item.Ck.toFixed(1))
                 });
                 Rs.blueUnite.map(function (item, t) {
-                    blueSum += parseFloat(item.Ck)
+                    blueSum += parseFloat(item.Ck.toFixed(1))
                 });
                 Rs.yellowUnite.map(function (item, t) {
-                    yellowSum += parseFloat(item.Ck)
+                    yellowSum += parseFloat(item.Ck.toFixed(1))
                 });
                 that.redSum = redSum.toFixed(1);
                 that.blueSum = blueSum.toFixed(1);
@@ -645,13 +645,15 @@
                 let that = this;
                 that.studentInfo.Rs = msg;
                 that.studentInfo.dialogVisible = true;
+                this.studentInfo.percent = 0;
                 // 倒计时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) {
+                    let num = (6 - this.studentTime) / 6 * 100;
+                    this.studentInfo.percent = parseInt(num) > 100 ? 100 : num;
+                    console.log('num' + num);
+                    if (parseInt(this.studentTime) <= 0) {
                         that.studentInfo.dialogVisible = false;
                         clearInterval(clock);
                     }