浏览代码

客户端已ready

Changpeng Duan 4 年之前
父节点
当前提交
5dc6b9e822
共有 4 个文件被更改,包括 21 次插入17 次删除
  1. 2 2
      online/src/components/LineExample.js
  2. 12 10
      online/src/page/mainpage.vue
  3. 2 1
      pc/src/views/courseEdit.vue
  4. 5 4
      pc/src/views/online.vue

+ 2 - 2
online/src/components/LineExample.js

@@ -32,16 +32,16 @@ export default {
                             display: false,
                             text: 'Custom Chart Title'
                         },
-
                         label: '',
                         barShowStroke : true, // 是否显示线
                         color: '#E75296',
                         borderColor: '#E75296',
-                        backgroundColor: 'rgba(255,255,255,0)',
+                        backgroundColor: 'rgba(231,82,150,0.3)',
                         data: this.datadatasets
                     }
                 ]
             }, {
+                area: true,
                 animation:{
                     duration:0,
                     // easing:'easeInQuad'

+ 12 - 10
online/src/page/mainpage.vue

@@ -58,7 +58,7 @@
                 <button>点击连接</button>
             </div>
             <div class="classInfo" v-if="InClass == 1 && watchState">
-                <em><span>课程名称</span>{{DpName}}</em>
+                <em><span>课程名称</span>{{DpName}}</em>
             </div>
         </div>
         <div class="middle">
@@ -137,7 +137,7 @@
     export default {
         data() {
             return {
-                runMode: '',//'' 为正常模式 mock 为模拟操作模式
+                runMode: 'mock',//'' 为正常模式 mock 为模拟操作模式
                 isClassTime: 5000,//上课状态检测频率
                 isAddHeartTime: 1000,//心率上报检测频率
                 dataLabels: [],
@@ -175,7 +175,7 @@
                 InClass: 0,//是否上课
                 DpName: '1234',//课程名称
                 HrId: '',//心率带
-                duId: '',
+                duId: 0,
                 sn: '',
             }
         },
@@ -273,14 +273,13 @@
                                 // 卡路里计算
                                 that.calcCalorie(that.heartRate);
                                 if (that.heartLine.length > 30) {
-                                    that.heartLine.unshift();
-                                    that.dataLabels.unshift();
+                                    that.heartLine = that.heartLine.concat();
+                                    that.dataLabels = that.dataLabels.concat();
                                 } else {
                                     that.heartLine.push(that.heartRate);
                                     that.dataLabels.push('');
                                 }
                                 that.DrawHeartLine(that.heartLine, that.dataLabels);
-                                // that.AutoAddAppHeartRate();
                             }
                         });
                     });
@@ -324,7 +323,8 @@
                     if (json.Code == 0) {
                         that.InClass = json.InClass;//0下课,1上课
                         // 记录duid
-                        that.duid = json.DuInfo.DuId;
+                        that.duId = parseInt(json.DuInfo.DuId);
+                        console.log('that.duId:' +  that.duId);
                     } else {
                         that.$message.error(json.Memo);
                     }
@@ -658,6 +658,7 @@
             // 上报信息
             AutoAddAppHeartRate() {
                 let that = this;
+                console.log('duId:' + that.duId);
                 let param = {
                     token: localStorage.token,
                     duId: that.duId,
@@ -665,8 +666,8 @@
                     hrId: that.HrId,
                     heartRate: that.heartRate,
                     rcvTime: new Date().getTime(),
-                    calories: parseInt(that.addCalories * 1000), //卡
-                    pureCalories: parseInt(that.addPureCalories * 1000), //卡
+                    calories: parseInt(that.addCalories * 1000000), //卡
+                    pureCalories: parseInt(that.addPureCalories * 1000000), //卡
                 };
                 let postdata = qs.stringify(param);
                 AddAppHeartRate(postdata).then(res => {
@@ -675,7 +676,8 @@
                         that.InClass = json.InClass;
                         console.log('心率数据上传成功!');
                     } else {
-                        that.Toast( '心率数据上传失败' + json.Memo);
+                        // that.Toast( '心率数据上传失败' + json.Memo);
+                        console.log( '心率数据上传失败' + json.Memo);
                     }
                 })
             },

+ 2 - 1
pc/src/views/courseEdit.vue

@@ -1404,7 +1404,7 @@
             getClassDetailAndSnAdd(row) {
                 let begin_time = parseInt(new Date().valueOf() / 1000);
                 let duRs = [];
-                if (!row.Sn) {
+                if (!row.Sn && row.isOnline == 0) {
                     this.$message.error(row.Name + '没有绑定心率带');
                     return false
                 }
@@ -1425,6 +1425,7 @@
                     birthday: row.Birthday,
                     is_tmp_user: row.IsTmpUser,
                     is_private: row.IsPrivate,
+                    isOnline: row.isOnline,
                 };
                 duRs = '{"Rs":' + JSON.stringify(duRs).toString() + '}';
                 let that = this;

+ 5 - 4
pc/src/views/online.vue

@@ -5,12 +5,13 @@
                 <em>课程名:{{classInfo.name}} </em>
                 <em>学员数:{{classInfo.len}} </em>
                 <em>(在线:{{classInfo.online}}人 离线:{{classInfo.offline}}人) </em>
-                <em>当前时间:{{classInfo.time}} </em>
-            </div>
-            <div class="region">
-                <!--拿到eqsn才能获取数据-->
+                <em>当前时间:{{classInfo.time}}   </em>
+                    <!--拿到eqsn才能获取数据-->
+                <em>区域列表</em>
+
 
             </div>
+
             <el-button @click="full_screen" v-if="!screen_full" icon="el-icon-full-screen" type="primary">全屏</el-button>
             <el-button @click="cancle_screen" v-else icon="el-icon-full-screen" type="primary">缩小</el-button>
             <!--<el-button v-if="classState == 0" @click="" type="success">上课</el-button>-->