Changpeng Duan 5 vuotta sitten
vanhempi
commit
b8fc1ccde9

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

@@ -93,8 +93,8 @@
                             </em>
                             <el-button type="primary" plain @click="goFinish(c)" v-if="c.FinishClass == 0">上课
                             </el-button>
-                            <el-button type="danger" plain @click="goFinish(c)" v-if="c.FinishClass == 0">关课
-                            </el-button>
+                            <!--<el-button type="danger" plain @click="goFinish(c)" v-if="c.FinishClass == 0">关课-->
+                            <!--</el-button>-->
                             <el-button type="primary" plain @click="checkClassOverPrepare(c)" v-if="c.FinishClass == 2">
                                 管理
                             </el-button>

+ 4 - 4
pc/src/views/courses.vue

@@ -123,10 +123,10 @@
                                    @click="showDialogMemberVisible(scope.row)">
                             上课
                         </el-button>
-                        <el-button type="danger" round size="mini" v-if="scope.row.FinishClass == 0"
-                                   @click="closeLesson(scope.row)">
-                            关课
-                        </el-button>
+                        <!--<el-button type="danger" round size="mini" v-if="scope.row.FinishClass == 0"-->
+                                   <!--@click="closeLesson(scope.row)">-->
+                            <!--关课-->
+                        <!--</el-button>-->
                         <el-button type="primary" round size="mini"
                                    v-if="scope.row.FinishClass == 3 || scope.row.FinishClass == 2"
                                    @click="seeEdit(scope.row)"

+ 15 - 9
tv/README.md

@@ -108,16 +108,10 @@ https://segmentfault.com/a/1190000021281307
 29.PC图片上传进行压缩√
 
 ========================
+12/17
 
-1. 月、周卡路里总计火焰字体
-2. 私有心率带角标
-9. 胜率显示从后台取胜率数据
-23.彩蛋和新学生接口可以合并 todo  
-29.首页界面和内页都给课程增加关课按钮
-
-
-
-31.TV本地字典,针对不同的EQSN给出本店的转发服务器ip地址(定一下字段名的接口)
+1. 月、周卡路里总计火焰字体√
+31.TV本地字典,针对不同的EQSN给出本店的转发服务器ip地址(定一下字段名的接口)√
 getServeIpAddress
     parame{
         eqsn:'30:9C:23:0C:8B:1E'//每个电视的eqsn
@@ -129,6 +123,18 @@ getServeIpAddress
 
 
 
+=================================
+
+
+2. 私有心率带角标
+9. 胜率显示从后台取胜率数据
+23.彩蛋和新学生接口可以合并 todo  
+29.首页界面和内页都给课程增加关课按钮
+
+
+
+
+
 // 上课中学生信息
 getUserListInfo
 

+ 4 - 5
tv/src/Global.js

@@ -8,9 +8,8 @@ companyInfo = {
 // headapi = process.env.NODE_ENV === 'development' ? '/api/' : '../';
 // headapi = 'http://192.168.0.110:8080/';//从郑伟那里获得数据源
 headapi = '';//从郑伟那里获得数据源
-// headapi = 'http://192.168.0.71:8080/';//从郑伟那里获得数据源
+headapi = 'http://192.168.0.63:8080/';//从郑伟那里获得数据源
 // headapi = 'http://192.168.0.10:8080/';//实际场馆
-headTest =  'http://192.168.0.10:8080/';
 
 // 七牛云imgsrc
 imgUrl = "http://qjzpcd34v.hb-bkt.clouddn.com";
@@ -63,7 +62,7 @@ getHoursAndMin = function (datetime) {
     h = date.getHours() < 10 ? '0' + date.getHours() + ':' : date.getHours() + ':';
     m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
     return h + m;
-}
+};
 
 getHoursAndMinAndSec = function () {
     let date = new Date();
@@ -71,7 +70,7 @@ getHoursAndMinAndSec = function () {
     m = date.getMinutes() < 10 ? '0' + date.getMinutes() + ':' : date.getMinutes() + ':';
     s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
     return h + m + s;
-}
+};
 
 // 格式化时间去掉T
 nonTfmtDate = function (datetime, length) {
@@ -479,5 +478,5 @@ deepClone = function (obj) {
     let _obj = JSON.stringify(obj),
         objClone = JSON.parse(_obj);
     return objClone
-}
+};
 

+ 78 - 49
tv/src/Mock/index.js

@@ -118,34 +118,63 @@ let getUserList = function () {
 
 let testStudent = function (num, team) {
     let item = [];
-    let teams;
     for (var i = 0; i < num; i++) {
-        teams = team == 2 ? "@integer(1, 3)" : "@integer(1, 2)";
-        teams = 3;
         item.push({
-            "SvId": "@guid",
-            "UserId": "@integer(15253135600, 15253135699)",
-            "name": "测试人",
-            "Name": "测试人",
-            "Cle": "@integer(1, 9999)",
-            "realHr": "@integer(70, 140)",
-            "activePercent": "@integer(10, 100)",
-            "PureCalorieNoVo2": "@integer(10, 100)",
-            "Ck": "@integer(10, 100)",
-            "formatCk": "@integer(10, 100)",
-            "Head": "http://192.168.0.2/gc.png",
-            "GroupNo": teams,
-            "Sex": "@integer(1, 2)",
-            "IsBirthday": "@integer(1, 1)",
+            Age: 13,
+            AvgHr: 0,
+            BeginTime: 1608188579,
+            Ck: 0.0020378087647259235,
+            Cle: 0.10189043977055452,
+            DuId: 119,
+            EndTime: 0,
+            GroupNo: team,
+            Head: "http://192.168.0.2/gc.png",
+            Height: 160,
+            HrId: 41,
+            IsBirthday: 0,
+            IsBreaking: 0,
+            IsNewUser: 0,
+            MaxHr: 80,
+            Name: "测试人",
+            PkSucessnum: 2,
+            PkTotalnum: 6,
+            PlanId: 60,
+            PureCalorieNoVo2: 0.046890439770554515,
+            Sex: 1,
+            Sn: "22735",
+            StaticHr: 60,
+            Steps: 0,
+            SvId: 20,
+            UserId: 104,
+            UserMd5: "55661a861f8fae20dd505b2b4575dc0e",
+            Weight: 50,
+            activePercent: 14,
+            bmrMSjRmrcb: 66.00000000000001,
+            formatCk: 0,
+            isAlive: true,
+            isFinish: false,
+            isOver: false,
+            isPrivate: 0,
+            lastPushDataTime: 1608188947175,
+            lastUpdateTime: 1608188945184,
+            queuePushData: [],
+            realHr: 80,
+            vo2Max: 0
         })
     }
 
     let Dp = {
-        PlanName: '测试课程',
-        BeginTime: '19:30',
-        Teacher: '测试教练',
+        "PlanId": 182,
+        "ShopId": 1,
+        "SvId": 1,
+        "PlanName": "齐源大厦浏览器显示2020-12-02日08:40开始的竞技游戏",
+        "Status": 3,
+        "BeginTime": "17:15:18",
+        "EndTime": 0,
+        "ClassType": 2,
+        "PkNum": 2,
+        "Teacher": '测试教练',
     };
-
     return {
         Rs: item,
         Dp: Dp,
@@ -154,17 +183,6 @@ let testStudent = function (num, team) {
     };
 };
 
-let getClassStat = function (ClassOn) {
-    return {
-        ClassOn: ClassOn, //   // 0: 下课 团课/私教/PK 的排名
-        Code: 0,
-        Memo: "Success",
-        dp: 1,
-        // 1:团课/私教
-        // 2:竞技课2PK
-        // 3:竞技课threepk
-    };
-};
 
 let getNewUser = function (code) {
 
@@ -204,24 +222,24 @@ let getRecordBreak = function (code) {
         Rs: item,
     };
 };
-let CalorieStatsQuery = function(){
-     let Rs = [
-         {
-             Title: '本<s>周</s>场馆卡路里总消耗',
-             Result: [{'Values': "@integer(7654321, 1)", Unite: '千卡'}],
-         },
-         {
-             Title: '本<s>周</s>场馆卡路里总消耗',
-             Result: [{'Values':"@integer(7654321, 1)", Unite: '千卡'}],
-         }
-     ]
+let CalorieStatsQuery = function () {
+    let Rs = [
+        {
+            Title: '本<s>周</s>场馆卡路里总消耗',
+            Result: [{'Values': "@integer(7654321, 1)", Unite: '千卡'}],
+        },
+        {
+            Title: '本<s>周</s>场馆卡路里总消耗',
+            Result: [{'Values': "@integer(7654321, 1)", Unite: '千卡'}],
+        }
+    ];
     return {
         Code: 0,
         Memo: "Success",
         Rs: Rs,
     };
 
-    };
+};
 let testHerosRankingQuery = function (num) {
     let item = [
         {
@@ -285,16 +303,27 @@ let testHerosRankingQuery = function (num) {
     };
 }
 
+let getClassStat = function (ClassOn, dp) {
+    return {
+        ClassOn: ClassOn, //   // 0: 下课 团课/私教/PK 的排名
+        Code: 0,
+        Memo: "Success",
+        dp: dp,
+        // 1:团课/私教
+        // 2:竞技课2PK
+        // 3:竞技课threepk
+    };
+};
 
-let t = 1;
-if (t == 0) {
+let t = 0;//0 is on 1 is off
+if (t == 1) {
     // 列表测试
     Mock.mock('/api/testTable', 'post', testTable());
 
     Mock.mock('/api/getUserList', 'post', getUserList());
-    let curheadapi = 'http://192.168.0.71:8080/';
+    let curheadapi = 'http://192.168.0.63:8080/';
     // 学生列表
-    Mock.mock(curheadapi + 'UserListInfo', 'post', testStudent(5, 1));
+    Mock.mock(curheadapi + 'UserListInfo', 'post', testStudent(6, 1));
     // 下课排名
     Mock.mock(curheadapi + 'ClassUserRank', 'post', testStudent(1, 2));
     // 英雄榜
@@ -304,7 +333,7 @@ if (t == 0) {
     // 用户排行榜
     Mock.mock(curheadapi + 'UserRankingQuery', 'post', testStudent(1, 2));
     // 上课状态
-    Mock.mock(curheadapi + 'ClassStatQuery', 'post', getClassStat(2));
+    Mock.mock(curheadapi + 'ClassStatQuery', 'post', getClassStat(1, 2));
     // 新同学 0 999
     Mock.mock(curheadapi + 'getNewUser', 'post', getNewUser(999));
     // 彩蛋 0 999

+ 7 - 2
tv/src/api/getApiRes.js

@@ -100,8 +100,6 @@ export function ClassUserRank(postdata) {
 }
 
 
-
-
 // 用查询最新wgt 般本
 export function QueryVueFramework(postdata) {
     let url = 'http://cal.beswell.com:85/v1/Sensors/QueryVueFramework';
@@ -118,3 +116,10 @@ export function getNewUser(postdata) {
     let url = headapi + 'getNewUser';
     return getApiBasic(url, postdata);
 }
+
+// 12/17
+// 竞技课程结果上传
+export function AddPkInfo(postdata) {
+    let url = headapi + 'AddPkInfo';
+    return getApiBasic(url, postdata);
+}

+ 0 - 2
tv/src/components/sumNumber.vue

@@ -30,13 +30,11 @@
         },
         watch: {
             'curNumber' (val) {
-                console.log(val);
                 this.numTurnImg(val);
             }
         },
         methods: {
             numTurnImg(num){
-                console.log(num);
                 this.imgNumber = num.toString();
             }
         }

+ 30 - 5
tv/src/views/2pkRank.vue

@@ -98,7 +98,10 @@
     import Headside from '@/components/Headside'
     import '../libs/rem';
     import '../Global';
-    import {ClassUserRank} from '@/api/getApiRes'
+    import {
+        ClassUserRank,
+        AddPkInfo
+    } from '@/api/getApiRes'
 
     let qs = require('qs');
     export default {
@@ -151,7 +154,7 @@
                 this.getClassUserRank();
             },
             // 分队展示
-            UniteBreak(Rs) {
+            UniteBreak(Rs,PlanId) {
                 let that = this;
                 that.students.redUnite = [];
                 that.students.blueUnite = [];
@@ -172,7 +175,7 @@
                     // return b.Cle - a.Cle;
                     return b.Ck - a.Ck;
                 });
-                that.calcSumCK(that.students);
+                that.calcSumCK(that.students,PlanId);
             },
             jumpWait(totalTime) {
                 // 倒计时60秒自动关闭
@@ -190,7 +193,7 @@
                 }, 1000)
             },
             // 计算各队总分
-            calcSumCK(Rs) {
+            calcSumCK(Rs,PlanId) {
                 let that = this;
                 let redSum = 0;
                 let blueSum = 0;
@@ -202,6 +205,10 @@
                 });
                 that.redSum = redSum.toFixed(1);
                 that.blueSum = blueSum.toFixed(1);
+
+                // 上报胜率结果
+                let groupNo = redSum >= blueSum ? 1 : 2;
+                that.PostAddPkInfo(PlanId, groupNo);
             },
             getClassUserRank() {
                 let that = this;
@@ -214,7 +221,7 @@
                     that.students.redUnite = [];
                     that.students.blueUnite = [];
                     if (json.Code == 0) {
-                        that.UniteBreak(json.Rs);
+                        that.UniteBreak(json.Rs,json.Dp.PlanId);
                         let totalTime = 40;
                         let Studenlength = 0;
                         if (json.Rs) {
@@ -240,6 +247,24 @@
                         }
                     }
                 })
+            },
+            // 竞技课程结果上传
+            PostAddPkInfo(dpId, groupNo) {
+                console.log(dpId, groupNo);
+                let that = this;
+                let param = {
+                    dpId: dpId,
+                    groupNo: groupNo,
+                };
+                let postdata = qs.stringify(param);
+                AddPkInfo(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        console.log('竞技课程结果上传成功dpid:' + dpId + ' groupNo:' + groupNo);
+                    } else {
+                        that.$message.error(json.Memo);
+                    }
+                })
             }
         },
         filters: {

+ 34 - 9
tv/src/views/3pkRank.vue

@@ -151,7 +151,10 @@
     import Headside from '@/components/Headside'
     import '../libs/rem';
     import '../Global';
-    import {ClassUserRank} from '@/api/getApiRes'
+    import {
+        ClassUserRank,
+        AddPkInfo
+    } from '@/api/getApiRes'
 
     let qs = require('qs');
     export default {
@@ -232,7 +235,7 @@
                 }, 1000)
             },
             // 分队展示
-            UniteBreak(Rs) {
+            UniteBreak(Rs,PlanId) {
                 let that = this;
                 that.students.redUnite = [];
                 that.students.blueUnite = [];
@@ -266,11 +269,11 @@
                     return b.Ck - a.Ck;
                 });
 
-                that.calcSumCK(that.students);
+                that.calcSumCK(that.students,PlanId);
 
             },
             // 计算各队总分
-            calcSumCK(Rs) {
+            calcSumCK(Rs,PlanId) {
                 let that = this;
                 let redSum = 0;
                 let blueSum = 0;
@@ -292,18 +295,22 @@
                     {name: "blue", val: that.blueSum},
                     {name: "yellow", val: that.yellowSum},
                 ];
-                that.getUnitRank(res);
-
+                that.getUnitRank(res,PlanId);
             },
             // 结果排序
-            getUnitRank(res) {
-                let that = this;
+            getUnitRank(res,PlanId) {
+                let that = this;//这个that不要删
                 let sum = res.sort(function (a, b) {
                     return b.val - a.val;
                 });
                 sum.map(function (item, i) {
                     eval("that." + item['name'] + ".rank = i+1");
                 });
+
+                // 上报胜率结果
+                console.log(sum);
+                let groupNo = 1;
+                that.PostAddPkInfo(PlanId, groupNo);
             },
             getClassUserRank() {
                 let that = this;
@@ -317,7 +324,7 @@
                     that.students.blueUnite = [];
                     that.students.yellowUnite = [];
                     if (json.Code == 0) {
-                        that.UniteBreak(json.Rs);
+                        that.UniteBreak(json.Rs,json.Dp.PlanId);
 
                         let totalTime = 40;
                         let Studenlength = 0;
@@ -343,6 +350,24 @@
                         }
                     }
                 })
+            },
+            // 竞技课程结果上传
+            PostAddPkInfo(dpId, groupNo) {
+                console.log(dpId, groupNo);
+                let that = this;
+                let param = {
+                    dpId: dpId,
+                    groupNo: groupNo,
+                };
+                let postdata = qs.stringify(param);
+                AddPkInfo(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        console.log('竞技课程结果上传成功dpid:' + dpId + ' groupNo:' + groupNo);
+                    } else {
+                        that.$message.error(json.Memo);
+                    }
+                })
             }
         },
         filters: {

+ 1 - 0
tv/src/views/Index.vue

@@ -99,6 +99,7 @@
                     plusReady();
                 } else {
                     console.log('mui is not ready');
+                    // 调试时候关闭
                     this.getServeIpAddress(localStorage.eqSn);
                     // plusReady();
                     document.addEventListener('plusready', plusReady, false);

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

@@ -66,7 +66,9 @@
     import Headside from '@/components/Headside'
     import '../libs/rem';
     import '../Global';
-    import {ClassUserRank} from '@/api/getApiRes'
+    import {
+        ClassUserRank
+    } from '@/api/getApiRes'
 
     let qs = require('qs');
     export default {
@@ -148,8 +150,8 @@
                     if (json.Code == 0) {
                         let totalTime = 40;
                         let Studenlength = 0;
-                        if(json.Rs){
-                             Studenlength = json.Rs.length;
+                        if (json.Rs) {
+                            Studenlength = json.Rs.length;
                         }
                         // 根据人数多少显示停留时间
                         if (Studenlength > 3) {
@@ -183,7 +185,6 @@
                     }
                 })
             },
-
         },
         filters: {
             fmtNum(val) {

+ 0 - 1
tv/src/views/pk.vue

@@ -496,7 +496,6 @@
                             that.ReadLessonInfo(json.Dp);
                         }
                         that.UniteBreak(json.Rs);
-
                         // 人口总数
                         that.num = json.Rs.length ? json.Rs.length : 0;
                         this.ClacClassTime();