Browse Source

网课学员

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

+ 1 - 0
online/src/page/mainpage.vue

@@ -347,6 +347,7 @@
                         that.InClass = json.InClass;//0下课,1上课
                         // 记录duid
                         that.duId = parseInt(json.DuInfo.DuId);
+                        that.DpName = json.DuInfo.DpName;
                         console.log('that.duId:' + that.duId);
                     } else {
                         that.$message.error(json.Memo);

+ 9 - 0
pc/src/Global.js

@@ -7,6 +7,7 @@ companyInfo = {
 
 headapi = process.env.NODE_ENV === 'development' ? '/api/' : '../';
 headbpi = process.env.NODE_ENV === 'development' ? '/bpi/' : 'http://cal.beswell.com:85/';
+headcpi = process.env.NODE_ENV === 'development' ? 'http://192.168.0.62:9010/' : 'http://cal.beswell.com:85/DataTransfer/';
 
 
 // 常用选项
@@ -421,3 +422,11 @@ getyearOptions = function (val) {
     }
     return item
 };
+
+// 深拷贝
+deepClone = function (obj) {
+    let _obj = JSON.stringify(obj),
+        objClone = JSON.parse(_obj);
+    return objClone
+};
+

+ 12 - 0
pc/src/api/getApiRes.js

@@ -881,3 +881,15 @@ export function QueryShopListByLoallout(postdata) {
     let url = headbpi + 'v1/Shop/QueryShopListByLoallout ';
     return getApiBasic(url, postdata);
 }
+
+// 演示版上课接口
+export function getHello(postdata) {
+    let url = headcpi + 'UserListInfo';
+    return getApiBasic(url, postdata);
+}
+
+// 卡路里场馆统计(分月度、周统计,TV左上角统计)
+export function CalorieStatsQuery(postdata) {
+    let url = headcpi + 'CalorieStatsQuery';
+    return getApiBasic(url, postdata);
+}

+ 0 - 3
pc/src/main.js

@@ -14,18 +14,15 @@ Vue.use(VCharts);
 Vue.use(ElementUI);
 
 let headBpi = 'http://cal.beswell.com:85/';
-let headCpi = "http://cal.beswell.com:85/DataTransfer/";
 if (process.env.NODE_ENV === 'development') {
     // 显示控制台
     // let vConsole = new VConsole();
     // 演示版本数据
     // require('./Mock/index.js');
     headBpi = '/bpi/';
-    headCpi = '/cpi/';
 } else {
     // let vConsole = new VConsole();
     headBpi = 'http://cal.beswell.com:85/';
-    headCpi = "http://cal.beswell.com:85/DataTransfer/";
 }
 
 // 演示版本数据

+ 10 - 10
pc/src/views/courseEdit.vue

@@ -38,6 +38,7 @@
                 <el-button @click="addFinishMember">添加上课会员</el-button>
                 <el-button @click="addTempMember" type="warning">添加临时会员</el-button>
                 <el-button @click="addCrossMember" type="primary">添加跨店会员</el-button>
+                <el-button @click="" type="warning">全部网课</el-button>
             </div>
         </div>
         <div class="table">
@@ -224,13 +225,14 @@
                         sortable
                 >
                     <template slot-scope="scope">
-                        <div v-if=" scope.row.HrSubmitFlag != 1">
-                            <el-checkbox label="网课" v-model="scope.row.IsOnline" name="type"
-                                         @change="showOrDiss(scope.row)"></el-checkbox>
-                        </div>
-                        <div v-if="scope.row.IsOnline == 1 && scope.row.HrSubmitFlag == 1">
-                            网课学员
-                        </div>
+                            <el-checkbox label="网课"
+                                         v-model="scope.row.IsOnline"
+                                         :disabled="scope.row.BindId > 0"
+                                         :checked="scope.row.IsOnline"
+                                         name="type"
+                                         true-label="1"
+                                         false-label="0"
+                            ></el-checkbox>
                     </template>
                 </el-table-column>
                 <el-table-column
@@ -1279,7 +1281,6 @@
                                     }
                                 });
                             }
-
                             // 分队处理
                             // 未上课的分队,已上课的旧的不处理,新人需要处理
                             if (that.FinishClass == 3) {
@@ -1304,8 +1305,7 @@
                                     }
                                 });
                             }
-
-
+                            console.log(json.Rs);
                             that.allTableData = json.Rs;
                             that.recordsTotal = json.Rs.length;
                         } else {

+ 172 - 15
pc/src/views/online.vue

@@ -2,12 +2,13 @@
     <div class="context bgStyle1" id="online">
         <div class="change">
             <div class="basicInfo">
-                <em>课程名:{{classInfo.name}} </em>
-                <em>学员数:{{classInfo.len}} </em>
-                <em>(在线:{{classInfo.online}}人 离线:{{classInfo.offline}}人) </em>
-                <em>当前时间:{{classInfo.time}}   </em>
-                    <!--拿到eqsn才能获取数据-->
-                <em>区域列表 </em>
+                <em>课程名:{{PlanName}} </em>
+                <em>学员数:{{Num}} </em>
+                <em>教练:{{Teacher}} </em>
+                <!--<em>(在线:{{classInfo.online}}人 离线:{{classInfo.offline}}人) </em>-->
+                <em>当前时间:{{classInfo.endTime}} </em>
+                <!--拿到eqsn才能获取数据-->
+                <em class="room">区域列表 </em>
                 <el-select v-model="VenueId" placeholder="请选择区域" @change="queryEqsnByVenueId">
                     <el-option
                             v-for="item in VenueOption"
@@ -27,6 +28,9 @@
         </div>
         <div :class="[{'userList':true},{'bigUserList':bigUserList}]">
             <ul :class="[{'bigUserList':bigUserList}]">
+                <li v-if="students.length == 0">
+                    <h5 style="color: #fff;font-size: 3rem">暂无学生加入当前课程</h5>
+                </li>
                 <li v-for="(s,i) in students" :class="studentsClassName[i].name" v-show="students"
                     v-if="students.length > 0">
                     <div class="centerLi">
@@ -129,7 +133,11 @@
     import {
         QueryShopVenue,
         QueryVenueEquip,
+        getHello,
+        CalorieStatsQuery,
+        ClassUserRank,
     } from "../api/getApiRes";
+
     let qs = require('qs');
     export default {
         data() {
@@ -140,6 +148,7 @@
                     online: 0,
                     offline: 0,
                     time: '00:00:00',
+                    endTime: '00:00:00',
                 },
                 VenueId: '',//所选区域
                 classState: 0,//0 下课 1上课
@@ -151,24 +160,100 @@
                 bigUserList: false,
                 dialogMemberVisible: false,//false
                 dialogTitle: '排行榜',
+                EqSn: '',
+                PlanName: '',
+                BeginTime: '',
+                Num: '',
+                Teacher: '',
+
             };
         },
         mounted() {
-            // this.getList(26);
-            this.getVenueQuery();
+            this.init();
         },
         watch: {
             $route(to) {
                 console.log(to);
                 if (to.name != 'online') {
-                    this.clearRem()
+                    this.clearRem();
+                    clearInterval(this.mainTimer);//页面销毁时清除定时器
                 } else {
                     this.setRem();
                     this.getVenueQuery();
                 }
             },
+            // EqSn(to){
+            //     console.log(to);
+            //     clearInterval(this.mainTimer);//页面销毁时清除定时器
+            //     if(to){
+            //         this.mainTimer = setInterval(() => {
+            //             this.GetgetUserList();
+            //         }, 1000);
+            //     }
+            // }
+        },
+        destroyed() {
+            clearInterval(this.mainTimer);//页面销毁时清除定时器
         },
         methods: {
+            init() {
+                // this.getList(26);
+                this.getVenueQuery();
+            },
+            getClassUserRank() {
+                let that = this;
+                let param = {
+                    eqSn: localStorage.eqSn
+                };
+                let postdata = qs.stringify(param);
+                ClassUserRank(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        let totalTime = 40;
+                        let Studenlength = 0;
+                        let CkSort = json.Rs;
+                        let CalSort = deepClone(json.Rs);
+                        let Rs = json.Rs;
+                        if (Rs != '') {
+                            // 排序
+                            that.students.CkSort = json.Rs.sort(function (a, b) {
+                                return b.Ck - a.Ck;
+                            });
+
+                            that.students.CalSort = CalSort.sort(function (a, b) {
+                                return b.Cle - a.Cle;
+                            });
+                        }
+                    } else {
+                        this.students.CkSort = [];
+                        this.students.CalSort = [];
+                        if (json.Code == '999') {
+                            // that.$router.push({path: '/'});
+                        } else {
+                            // 已出错
+                            that.$message.error(json.Memo);
+                        }
+                    }
+                })
+            },
+            // 载入课程信息
+            ReadLessonInfo(Dp) {
+                this.PlanName = Dp.PlanName;
+                this.BeginTime = Dp.BeginTime;
+                this.Teacher = Dp.Teacher;
+                this.Num = this.students.length;
+            },
+            // 计算团队竞技课持续时间
+            ClacClassTime() {
+                let BeginTime = new Date(globalcurrent() + ' ' + this.BeginTime);//结束时间
+                let nowDate = new Date();
+                let date = new Date(nowDate - BeginTime - 8 * 60 * 60 * 1000);//减掉东八区时区问题
+
+                let h = date.getHours() < 10 ? '0' + date.getHours() + ':' : date.getHours() + ':';
+                let m = date.getMinutes() < 10 ? '0' + date.getMinutes() + ':' : date.getMinutes() + ':';
+                let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
+                this.classInfo.endTime = h + m + s;
+            },
             clearRem() {
                 // 320 默认大小16px; 320px = 20rem ;每个元素px基础上/16
                 let htmlWidth = document.documentElement.clientWidth || document.body.clientWidth;
@@ -182,7 +267,7 @@
                 //得到html的Dom元素
                 let htmlDom = document.getElementsByTagName('html')[0];
                 //设置根元素字体大小
-                htmlDom.style.fontSize = htmlWidth / 120 + 'px';
+                htmlDom.style.fontSize = htmlWidth / 140 + 'px';
             },
             // 全屏显示
             full_screen() {
@@ -229,7 +314,12 @@
             },
             // 打开排行榜
             showRank() {
-                this.dialogMemberVisible = true;
+                if (this.rankInfo.length == 0) {
+                    this.$message.error('暂无排名数据');
+                    return false
+                } else {
+                    this.dialogMemberVisible = true;
+                }
             },
             // 获取演示区域
             getVenueQuery() {
@@ -249,7 +339,6 @@
                         } else {
                             that.VenueOption = [];
                         }
-
                     } else {
                         if (!localStorage.ServiceKey) {
                             that.$message.error('还未与心率系统对接,请联系管理员');
@@ -267,7 +356,7 @@
                     key: localStorage.ServiceKey,
                     shopId: localStorage.ServiceId,
                     svId: svId,
-                    eqType:3//设备类型 1 电视盒子 2 演示对应中间件 3 演示客户端
+                    eqType: 3//设备类型 1 电视盒子 2 演示对应中间件 3 演示客户端
                 };
                 let postdata = qs.stringify(param);
                 QueryVenueEquip(postdata).then(res => {
@@ -276,15 +365,61 @@
                         that.loading = false;
                         if (json.Rs) {
                             that.EqSn = json.Rs[0].EqSn;
+                            clearInterval(this.mainTimer);//页面销毁时清除定时器
+                            that.GetgetUserList();
+                            if (that.EqSn) {
+                                this.mainTimer = setInterval(() => {
+                                    this.GetgetUserList();
+                                }, 1000);
+                            }
+
                         } else {
                             that.$message.error('当前区域没有设置显示设备');
-                            that.EqSn = '';
+                            that.students = [];
+                            that.rankInfo = [];
+                            clearInterval(this.mainTimer);//页面销毁时清除定时器
+                            return false
                         }
                     } else {
                         that.$message.error(json.Memo + ' 错误码:' + json.Code);
                     }
                 })
             },
+            GetgetUserList() {
+                let that = this;
+                let param = {
+                    token: localStorage.token,
+                    eqSn: that.EqSn
+                };
+                let postdata = qs.stringify(param);
+                // CalorieStatsQuery(postdata).then(res => {
+                getHello(postdata).then(res => {
+                    let json = res;
+                    if (json.Code == 0) {
+                        if (!json.Dp) {
+                            // that.$message.error('没有获取到课程信息');
+                            this.PlanName = '';
+                            this.BeginTime = '';
+                            this.Teacher = '';
+                        } else {
+                            that.ReadLessonInfo(json.Dp);
+                        }
+                        that.students = json.Rs;
+                        that.rankInfo = json.Rs;
+                        that.giveClassName(json.Rs);
+                    } else {
+                        // 已下课
+                        if (json.Code == '999') {
+                            that.students = "";
+                            that.rankInfo = "";
+                            that.getClassUserRank();
+                        } else {
+                            // 已出错
+                            that.$message.error(json.Memo);
+                        }
+                    }
+                })
+            },
             getList(len) {
                 let rs = {};
                 for (var i = 0; i < len; i++) {
@@ -1131,6 +1266,7 @@
     .three .bottomLi .btck span {
         text-indent: 1.6rem;
     }
+
     .three /deep/ .powerContainer img {
         width: 2rem;
     }
@@ -1253,7 +1389,7 @@
 
     .six .lhj span.plus {
         position: relative;
-        left: 1.3rem
+        left: 11.3rem
     }
 
     .six .bottomLi .btck img {
@@ -2283,8 +2419,29 @@
         background-repeat: no-repeat;
         color: #fff;
     }
+
     /deep/ .el-dialog__title {
         color: #fff;
         font-size: 2rem;
     }
+
+    /deep/ .el-input__inner {
+        background-color: inherit;
+        color: #fff;
+    }
+
+    .el-select-dropdown__item {
+        padding-left: 10px !important;
+    }
+
+    .el-scrollbar {
+        padding-left: 10px !important;
+    }
+
+    .selected {
+        padding-left: 10px !important;
+    }
+    .room {
+        margin-left: 10px;
+    }
 </style>

+ 2 - 2
pc/vue.config.js

@@ -17,11 +17,11 @@ module.exports = {
                     '^/bpi': '',
                 }
             },
-            '/cbi':{
+            '/cpi':{
                 target: 'http://192.168.0.62:9010/',
                 changeOrigin: true,
                 pathRewrite: {
-                    '^/cbi': '',
+                    '^/cpi': '',
                 }
             }
         }