浏览代码

代码优化

Changpeng Duan 5 年之前
父节点
当前提交
30b81269a6

+ 40 - 3
app/src/page/404.vue

@@ -1,14 +1,17 @@
 <template>
     <div class="container">
-        <h5 class="title">404</h5>
-        <p class="content">网络状况不佳,请改善网络状况后重启本应用</p>
+        <p class="content">系统升级中
+            <br>
+            敬请期待</p>
     </div>
 </template>
 
 <script>
     import axios from 'axios';
+
     let qs = require('qs');
     import Global from '../Global.js'
+
     export default {
         data() {
             return {
@@ -38,7 +41,41 @@
         color: #fff;
     }
 
-   /deep/ .mu-appbar-title {
+    /deep/ .mu-appbar-title {
         text-align: center;
     }
+
+   #app {
+        background: cornflowerblue;
+    }
+
+    .container {
+        width: 100%;
+        height: 100%;
+        overflow: hidden;
+        display: block;
+        margin: 0 auto;
+        background: cornflowerblue;
+        background-image: url("../static/images/404/man.png");
+        background-position: top center;
+        background-repeat: no-repeat;
+        background-size: 100%;
+    }
+
+    .container {
+        width: 100%;
+        overflow: hidden;
+        margin: 0 auto;
+        text-align: center;
+        color: #fff;
+        font-size: 36px;
+    }
+
+    .content {
+        width: 100%;
+        overflow: hidden;
+        display: block;
+        margin: 0 auto;
+        margin-top: 27%;
+    }
 </style>

+ 2 - 1
app/src/router/index.js

@@ -72,7 +72,8 @@ const routes = [
             title: '登陆',
             index: 1
         },
-        component: () => import( '../page/login.vue')
+        // component: () => import( '../page/login.vue')
+        component: () => import( '../page/404.vue')
     }, {
         path: '/test',
         name: 'test',

二进制
app/src/static/images/404/man.png


+ 0 - 2
tv/src/Mock/index.js

@@ -200,6 +200,4 @@ if (t == 1) {
 
 }
 
-// Mock.mock('/api/Hello', 'post', getUserList());
-
 export default Mock;

+ 8 - 7
tv/src/views/2pkRank.vue

@@ -57,8 +57,7 @@
                 <!--CK-->
                 <el-col :span="12">
                     <li v-for="(s,i) in students.blueUnite"
-                        :class="[{'blueUnite':true},{'mvpli':i == 0}]"
-                    >
+                        :class="[{'blueUnite':true},{'mvpli':i == 0}]">
                         <div>
                             <div class="head">
                                 <img :src="s.Head" class="headImg" v-if="s.Head">
@@ -115,7 +114,7 @@
         mounted() {
             let that = this;
             if (this.trueDate) {
-                this.getClassUserRank();
+                that.init();
                 // this.rankTimer = setInterval(() => {
                 //     this.getClassUserRank();
                 // }, 5000);
@@ -128,7 +127,7 @@
             '$route': function (val) {
                 if (val.path == '/2pkRank') {
                     if (this.trueDate) {
-                        this.getClassUserRank();
+                        that.init();
                         // this.rankTimer = setInterval(() => {
                         //     this.getClassUserRank();
                         // }, 5000);
@@ -148,6 +147,9 @@
             this.rankTimer = null;
         },
         methods: {
+            init(){
+                this.getClassUserRank();
+            },
             // 分队展示
             UniteBreak(Rs) {
                 let that = this;
@@ -192,10 +194,10 @@
                 let redSum = 0;
                 let blueSum = 0;
                 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);
@@ -280,7 +282,6 @@
         font-family: vista;
     }
 
-
     .pages {
         position: absolute;
         top: 0;

+ 18 - 40
tv/src/views/3pkRank.vue

@@ -177,25 +177,7 @@
         mounted() {
             let that = this;
             if (this.trueDate) {
-                this.getClassUserRank();
-                // this.rankTimer = setInterval(() => {
-                //     this.getClassUserRank();
-                // }, 5000);
-                if (this.autoJump) {
-                    // 倒计时60秒自动关闭
-                    let that = this;
-                    this.totalTime = 60;
-                    let clock = window.setInterval(() => {
-                        this.totalTime--;
-                        console.log(this.totalTime);
-                        if (parseInt(this.totalTime) < 0) {
-                            // 前往等待页面
-                            that.$router.push({path: '/'});
-                            // 计时器回收
-                            clearInterval(clock);
-                        }
-                    }, 1000)
-                }
+                that.init();
             } else {
                 let Rs = fakeNews(27, 3);
                 that.UniteBreak(Rs);
@@ -207,27 +189,7 @@
                 let that = this;
                 if (val.path == '/3pkRank') {
                     if (this.trueDate) {
-                        this.getClassUserRank();
-                        // this.rankTimer = setInterval(() => {
-                        //     this.getClassUserRank();
-                        // }, 5000);
-
-                        if (this.autoJump) {
-                            // 倒计时60秒自动关闭
-                            let that = this;
-                            this.totalTime = 60;
-                            let clock = window.setInterval(() => {
-                                this.totalTime--;
-                                console.log(this.totalTime);
-                                if (parseInt(this.totalTime) < 0) {
-                                    // 前往等待页面
-                                    that.$router.push({path: '/'});
-                                    // 计时器回收
-                                    clearInterval(clock);
-                                }
-                            }, 1000)
-                        }
-
+                        that.init();
                     } else {
                         let Rs = fakeNews(18, 3);
                         that.UniteBreak(Rs);
@@ -244,6 +206,22 @@
             this.rankTimer = null;
         },
         methods: {
+            init() {
+                this.getClassUserRank();
+                // 倒计时60秒自动关闭
+                let that = this;
+                this.totalTime = 60;
+                let clock = window.setInterval(() => {
+                    this.totalTime--;
+                    console.log(this.totalTime);
+                    if (parseInt(this.totalTime) < 0) {
+                        // 前往等待页面
+                        that.$router.push({path: '/'});
+                        // 计时器回收
+                        clearInterval(clock);
+                    }
+                }, 1000)
+            },
             jumpWait(totalTime) {
                 // 倒计时60秒自动关闭
                 let that = this;

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

@@ -232,7 +232,7 @@
                     } else {
                         // 并没有人破记录
                         if (json.Code == 999) return false;
-                        if (json.Code != 999) that.$message.error(json.Memo + '[egg]');
+                        if (json.Code != 999) that.$message.error(json.Memo + '[错误码]' + json.Code);
                     }
                 })
             },
@@ -259,7 +259,7 @@
                     } else {
                         // 并没有人破记录
                         if (json.Code == 999) return false;
-                        if (json.Code != 999) that.$message.error(json.Memo + '[egg]');
+                        if (json.Code != 999) that.$message.error(json.Memo + '[错误码]' + json.Code);
                     }
                 })
             },

+ 18 - 20
tv/src/views/Wait.vue

@@ -91,7 +91,7 @@
                 title="提示"
                 :visible.sync="dialogVisible"
                 width="30%"
-               >
+        >
             <span>{{dialogText}}</span>
             <span slot="footer" class="dialog-footer">
     <el-button type="primary" @click="dialogVisible = false">知道了</el-button>
@@ -144,17 +144,8 @@
             }
         },
         mounted() {
-            // for test
-            // this.$router.push({path: '/3pkRank'});
-
             if (this.trueDate) {
-                this.waitTimer = setInterval(() => {
-                    // this.GetgetUserList();
-                    this.curgetClassStat();
-                    this.GetHerosRankingQuery();
-                    this.GetCalorieStatsQuery();
-                    this.GetUserRankingQuery();
-                }, 1000);
+                this.init();
             } else {
                 this.students = this.fakeNews();
                 this.studentsLimit = this.fakeNewsLimit();
@@ -237,15 +228,11 @@
         },
         watch: {
             '$route': function (val) {
+                let that = this;
                 if (val.path == '/') {
                     this.autoplayStatus = false;
                     if (this.trueDate) {
-                        this.waitTimer = setInterval(() => {
-                            this.curgetClassStat();
-                            this.GetHerosRankingQuery();
-                            this.GetCalorieStatsQuery();
-                            this.GetUserRankingQuery();
-                        }, 1000);
+                        that.init();
                     } else {
                         this.students = this.fakeNews();
                         this.topMsg = this.students[0];
@@ -260,6 +247,15 @@
             this.waitTimer = null;
         },
         methods: {
+            init() {
+                this.waitTimer = setInterval(() => {
+                    this.curgetClassStat();
+                    this.GetHerosRankingQuery();
+                    this.GetCalorieStatsQuery();
+                    this.GetUserRankingQuery();
+                }, 1000);
+
+            },
             fakeNews() {
                 let item = [];
                 for (var i = 0; i < 7; i++) {
@@ -337,7 +333,8 @@
                     if (json.Code == 0) {
                         that.bottom = json.Rs;
                     } else {
-                        if (json.Code == 4002) {}else{
+                        if (json.Code == 4002) {
+                        } else {
                             that.$message.error(json.Memo);
                         }
                     }
@@ -355,7 +352,8 @@
                     if (json.Code == 0) {
                         that.rt = json.Rs;
                     } else {
-                        if (json.Code == 4002) {}else{
+                        if (json.Code == 4002) {
+                        } else {
                             that.$message.error(json.Memo);
                         }
                     }
@@ -385,7 +383,7 @@
                         if (json.Code == 4002) {
                             that.dialogVisible = true;
                             that.dialogText = json.Memo;
-                        }else{
+                        } else {
                             that.$message.error(json.Memo);
                         }
 

+ 2 - 3
tv/src/views/pk.vue

@@ -345,13 +345,12 @@
                     } else {
                         // 并没有人破记录
                         if (json.Code == 999) return false;
-                        if (json.Code != 999) that.$message.error(json.Memo + '[egg]');
+                        if (json.Code != 999) that.$message.error(json.Memo + '[错误码]' + json.Code);
                     }
                 })
             },
             // 欢迎新同学
             createNewStudent() {
-                console.log(223);
                 let that = this;
                 let param = {
                     token: localStorage.token,
@@ -372,7 +371,7 @@
                     } else {
                         // 并没有人破记录
                         if (json.Code == 999) return false;
-                        if (json.Code != 999) that.$message.error(json.Memo + '[egg]');
+                        if (json.Code != 999) that.$message.error(json.Memo + '[错误码]' + json.Code);
                     }
                 })
             },

+ 2 - 3
tv/src/views/threepk.vue

@@ -596,13 +596,12 @@
                     } else {
                         // 并没有人破记录
                         if (json.Code == 999) return false;
-                        if (json.Code != 999) that.$message.error(json.Memo + '[egg]');
+                        if (json.Code != 999) that.$message.error(json.Memo + '[错误码]' + json.Code);
                     }
                 })
             },
             // 欢迎新同学
             createNewStudent() {
-                console.log(223);
                 let that = this;
                 let param = {
                     token: localStorage.token,
@@ -623,7 +622,7 @@
                     } else {
                         // 并没有人破记录
                         if (json.Code == 999) return false;
-                        if (json.Code != 999) that.$message.error(json.Memo + '[egg]');
+                        if (json.Code != 999) that.$message.error(json.Memo + '[错误码]' + json.Code);
                     }
                 })
             },