瀏覽代碼

618regularFixUp

zhengwei 4 年之前
父節點
當前提交
77ab855894
共有 6 個文件被更改,包括 118 次插入157 次删除
  1. 13 17
      tv/src/Global.js
  2. 3 20
      tv/src/api/getApiRes.js
  3. 8 8
      tv/src/components/Headside.vue
  4. 8 14
      tv/src/main.js
  5. 82 94
      tv/src/views/Index.vue
  6. 4 4
      tv/vue.config.js

+ 13 - 17
tv/src/Global.js

@@ -1,28 +1,24 @@
 // 网站基本信息
 companyInfo = {
-    url: 'http://det.shandongewall.com/',
+    url: 'http://beswell.com/',
     main: 'alloutlong',
     year: new Date().getFullYear(),
 };
 
-// 当前版本   演示版
-runVersion = 'test';
-// 户外版本
-// runVersion = 'outDoor';
-// normal
-// runVersion = 'normal';
-
-// headapi = process.env.NODE_ENV === 'development' ? '/api/' : '../';
-// headapi = 'http://192.168.0.110:8080/';//从郑伟那里获得数据源
-// headapi = '';//从郑伟那里获得数据源
-// headapi = 'http://192.168.0.63:8080/';//从郑伟那里获得数据源
-headapi = 'http://192.168.0.10:8080/';//实际场馆默认数据源
-
-// 七牛云imgsrc
+//正式版
+versionNormal = 'normal';
+//户外版本
+versionOutDoor = 'outDoor';
+//演示版
+versionDemo = 'test';
+
+//当前运行模式
+runVersion = versionNormal;
+//实际场馆默认数据源
+headapi = 'http://192.168.0.10:8080/';
+// 七牛云imgSrc
 imgUrl = "http://qjzpcd34v.hb-bkt.clouddn.com";
 
-// pad测试版本
-
 // 常用选项
 globalQuipState = function () {
     let option = [

+ 3 - 20
tv/src/api/getApiRes.js

@@ -1,5 +1,4 @@
 import axios from 'axios';
-import global from '../Global.js'
 
 // 基础方法进行封装
 function getApiBasic(url, postdata) {
@@ -17,8 +16,6 @@ export function getCheckUpdate(postdata) {
     return getApiBasic(url, postdata);
 }
 
-
-
 // 调用的api改写成方法
 export function getUserList(postdata) {
     let url = headapi + 'UserList';
@@ -32,12 +29,6 @@ export function getHello(postdata) {
     return getApiBasic(url, postdata);
 }
 
-// 上课中学生信息
-// export function getHello(postdata) {
-//     let url =  'http://192.168.74.1:9000/getUserListInfo';
-//     return getApiBasic(url, postdata);
-// }
-
 // 是否开始上课的状态
 // ClassType为课程类型
 // 1:团课
@@ -54,26 +45,18 @@ export function getRecordBreak(postdata) {
     return getApiBasic(url, postdata);
 }
 
-// // 英雄榜和个人破纪录查询
-// export function HerosRankingQuery(postdata) {
-//     // let url = 'http://192.168.0.236:19096/v1/Sensors/HerosRankingQuery';
-//     let url = '/bpi/v1/Sensors/HerosRankingQuery';
-//     return getApiBasic(url, postdata);
-// }
-//
-// // 卡路里场馆统计(分月度、周统计,TV左上角统计)
+//卡路里场馆统计(分月度、周统计,TV左上角统计)
 // export function CalorieStatsQuery(postdata) {
 //     let url = '/bpi/v1/Sensors/CalorieStatsQuery';
 //     return getApiBasic(url, postdata);
 // }
-//
-// // 用户排名查询(Tv待机页面右侧排名)
+
+//用户排名查询(Tv待机页面右侧排名)
 // export function UserRankingQuery(postdata) {
 //     let url = '/bpi/v1/Sensors/UserRankingQuery';
 //     return getApiBasic(url, postdata);
 // }
 
-
 // 英雄榜和个人破纪录查询
 export function HerosRankingQuery(postdata) {
     let url = headapi + 'HerosRankingQuery';

+ 8 - 8
tv/src/components/Headside.vue

@@ -22,13 +22,13 @@
       <div id='qrcode' class="qrcode" ref="qrCodeUrl">
       </div>
       <table>
-        <th>
+        <tr>
             <td>版本</td>
             <td>热点IP</td>
-        </th>
+        </tr>
         <tr>
-          <td>{{currunVersion}}</td>
-          <td>{{curheadapi}}</td>
+          <td>{{currRunVersion}}</td>
+          <td>{{currHeadapi}}</td>
         </tr>
       </table>
       <span slot="footer" class="dialog-footer">
@@ -54,8 +54,8 @@ export default {
       nowDay: '',
       nowTime: '',
       version: '',
-      currunVersion:runVersion,
-      curheadapi:headapi,
+      currRunVersion:runVersion,
+      currHeadapi:headapi,
     }
   },
   mounted() {
@@ -68,8 +68,8 @@ export default {
       this.nowDayFunc();
       // 获取版本号
       this.version = localStorage.version;
-      this.currunVersion = runVersion
-      this.curheadapi = headapi
+      this.currRunVersion = runVersion
+      this.currHeadapi = headapi
     }, 1000);
     this.getCurVersion();
   },

+ 8 - 14
tv/src/main.js

@@ -1,30 +1,24 @@
 import Vue from 'vue'
-import './plugins/axios'
 import App from './App.vue'
 import router from './router'
-import 'default-passive-events'
-// import store from './store'
 import ElementUI from 'element-ui';
-import 'element-ui/lib/theme-chalk/index.css';
-import axios from 'axios'
+import VConsole from 'vconsole/dist/vconsole.min.js'
+import './plugins/axios'
+import 'default-passive-events'
 
-import VConsole from 'vconsole/dist/vconsole.min.js' //import vconsole
+import 'element-ui/lib/theme-chalk/index.css';
 
+//显示控制台
+let vConsole = new VConsole();
+Vue.use(vConsole)
 if (process.env.NODE_ENV === 'development') {
-    // 显示控制台
-    let vConsole = new VConsole();
-    // 演示版本数据
+    //演示版本数据
     require('./Mock/index.js');
-} else {
-    let vConsole = new VConsole();
-    // 演示版本数据
-    // require('./Mock/index.js');
 }
 
 Vue.config.productionTip = false;
 Vue.use(ElementUI);
 
-// store,
 new Vue({
     router,
     render: h => h(App)

+ 82 - 94
tv/src/views/Index.vue

@@ -63,6 +63,7 @@ export default {
         plus.runtime.getProperty(plus.runtime.appid, function (inf) {
           localStorage.version = inf.version;
           that.curVersion = inf.version;
+          console.log("inf:",inf);
         });
 
         //获取手机UUID
@@ -72,45 +73,22 @@ export default {
             uuid = uuid.substring(0, uuid.length - 1);
             localStorage.eqSn = uuid;
             console.log('===== uuid =====:' + uuid + '\ngetDeviceInfo success: ' + JSON.stringify(e.uuid));
-            // 正式版打开
+            
             // 获取转发端口地址
             that.getServeIpAddress(e.uuid);
 
-            // 公司测试机用公司版本升级
-            // if (uuid == "a1f2d679c1624d3a" || uuid == "8e501b0bde9ce600") {
-            if (uuid == "1277fcb4c81e29d2" || uuid == "8e501b0bde9ce600") {
-              //首发版本 '1.1.0' 在线版不需要自动升级
-              // 内测版自动升级
-              let url = 'http://192.168.0.3:19096/v1/Sensors/QueryVueFramework';
-              let param = {};
-              let postdata = qs.stringify(param);
-              axios.post(url, postdata).then(function (data) {
-                let json = data.data;
-                if (json.Code == 0) {
-                  if (localStorage.version != json.VueFramework.Version) {
-                    // 测试版本下载
-                    console.log(332);
-                    let downUrl = "http://192.168.0.3:19096/v1/Sensors/DownloadVueFramework";
-                    that.downWgt(downUrl);
-                  }
-                } else {
-                  console.log(json.Memo);
-                }
-              }, function (response) {
-                console.info(response);
-              })
+            //公司测试机升级
+            if (uuid == "14cc77e7c2281e20") {
+              that.checkTestUpdate();
             } else {
-              console.log(223);
-              // 正式版
-              //开启自动升级
-              // 教室版本自动升级,户外版禁用自动升级
+              //户外版禁用升级
               if (runVersion == 'outDoor') {
                 console.log('户外版禁用自动升级');
                 return false
               } else {
-                that.checkUpdate();
+                //正式版
+                that.checkReleaseUpdate();
               }
-
             }
           },
           fail: function (e) {
@@ -119,25 +97,84 @@ export default {
         });
       }
     },
-    // 是否有新版本
-    checkUpdate() {
+    //获取转发端地址
+    getServeIpAddress(eqSn) {
+      const that = this;
+
+      //演示版固定转发端地址
+      if (runVersion == 'test') {
+        headapi = "http://cal.beswell.com:85/DataTransfer/";
+        return false
+      }
+
+      //正式版请求转发段地址的url
+      let url = 'http://cal.beswell.com:85/v1/Sensors/GetShopConfigParam'
+      //测试版
+      if (eqSn == '14cc77e7c2281e20') {
+        url = "http://192.168.0.3:19096/v1/Sensors/GetShopConfigParam";
+      }
+      console.log("url:"+url+"\neqSn:"+eqSn);
+      let param = {
+        eqSn: eqSn
+      };
+      let postData = qs.stringify(param);
+      axios.post(url, postData).then(function (data) {
+        let json = data.data;
+        if (json.Code == 0) {
+          //户外版
+          if (runVersion == 'outDoor') {
+            headapi = json.Rs.HotsPotDataServiceIP;
+            if (!json.Rs.HotsPotDataServiceIP) {
+              that.$message.error("未获取到HotsPotDataServiceIP");
+              return false
+            }
+          } else if (runVersion == 'normal'){
+            headapi = json.Rs.DataServiceIP;
+          }
+        } else {
+          headapi = 'http://221.214.111.254:9000/';
+          console.log(json.memo);
+          that.$message.error(json.memo);
+        }
+      }, function (response) {
+        console.info(response);
+      })
+    },
+    //检查测试版本升级
+    checkTestUpdate(){
       let that = this;
+      let url = 'http://192.168.0.3:19096/v1/Sensors/QueryVueFramework';
+      let param = {};
+      let postData = qs.stringify(param);
+      axios.post(url, postData).then(function (data) {
+        let json = data.data;
+        console.log("checkTestUpdate",json);
+        if (json.Code == 0) {
+          if (localStorage.version != json.VueFramework.Version) {
+            // 测试版本下载
+            let testVersion = "http://192.168.0.3:19096/v1/Sensors/DownloadVueFramework";
+            that.downWgt(testVersion);
+          }
+        } else {
+          console.log(json.Memo);
+        }
+      }, function (response) {
+        console.info(response);
+      })
+    },
+    //检查正式版本升级
+    checkReleaseUpdate() {
       let param = {};
-      let postdata = qs.stringify(param);
-      const h = that.$createElement;
-      QueryVueFramework(postdata).then(res => {
+      let postData = qs.stringify(param);
+      QueryVueFramework(postData).then(res => {
         let json = res;
+        console.log("checkReleaseUpdate",json);
         if (json.Code == 0) {
           console.log('localStorage.version' + localStorage.version);
+          //正式
           if (localStorage.version != json.VueFramework.Version) {
-            // 正式
-            let url = "http://cal.beswell.com:85/v1/Sensors/DownloadVueFramework";
-            this.downWgt(url);
-            // that.downWgt(url, json.Version);
-            // that.$notify({
-            //     title: '升级提醒',
-            //     message: h('i', {style: 'color: teal'}, '检测到新的版本,正在下载最新版本')
-            // });
+            let releaseVersion = "http://cal.beswell.com:85/v1/Sensors/DownloadVueFramework";
+            this.downWgt(releaseVersion);
           }
         }
       })
@@ -145,75 +182,26 @@ export default {
     downWgt(url) {
       let that = this;
       plus.downloader.createDownload(url, {filename: "_doc/update/"}, function (d, status) {
-        // plus.downloader.createDownload(url, {}, function (d, status) {
         if (status == 200) {
           console.log(d);
           console.log("下载wgt成功:" + d.filename);
-          that.installWgt(d.filename); // 安装wgt包
+          that.installWgt(d.filename);
         } else {
           console.log("下载wgt失败!");
-          // plus.nativeUI.alert("下载wgt失败!");
         }
         plus.nativeUI.closeWaiting();
       }).start();
     },
+    //安装wgt包
     installWgt(path) {
-      // plus.nativeUI.showWaiting("安装wgt文件...");
       plus.runtime.install(path, {}, function () {
         plus.nativeUI.closeWaiting();
         console.log("安装wgt文件成功!");
-        // plus.nativeUI.alert("应用资源更新完成!", function () {
         plus.runtime.restart();
-        // });
       }, function (e) {
         plus.nativeUI.closeWaiting();
         console.log("安装wgt文件失败[" + e.code + "]:" + e.message);
-        // plus.nativeUI.alert("安装wgt文件失败[" + e.code + "]:" + e.message);
       });
-    },
-    // 获取转发端口地址
-    getServeIpAddress(eqsn) {
-      const that = this;
-      let url = '';
-      if (runVersion == 'test') {
-        headapi = "http://cal.beswell.com:85/DataTransfer/";
-        return false
-      }
-      // 测试使用0.3心率系统
-      // if (eqsn == 'a1f2d679c1624d3a' || eqsn == '30:9C:23:0C:8B:1E') {
-      if (eqsn == '1277fcb4c81e29d2' || eqsn == '30:9C:23:0C:8B:1E') {
-        url = "http://192.168.0.3:19096/v1/Sensors/GetShopConfigParam";
-      } else {
-        url = 'http://cal.beswell.com:85/v1/Sensors/GetShopConfigParam'
-      }
-      let param = {
-        eqSn: eqsn
-      };
-      let postdata = qs.stringify(param);
-      axios.post(url, postdata).then(function (data) {
-        let json = data.data;
-        if (json.Code == 0) {
-          // 户外版使用HotsPotDataServiceIP
-          if (runVersion == 'outDoor') {
-            headapi = json.Rs.HotsPotDataServiceIP;
-            // 内网测试版
-            // headapi = 'http://192.168.0.3:19096/v1/Sensors/';
-            if (!json.Rs.HotsPotDataServiceIP) {
-              that.$message.error("未获取到HotsPotDataServiceIP");
-              return false
-            }
-          } else {
-            headapi = json.Rs.DataServiceIP;
-          }
-
-        } else {
-          headapi = 'http://192.168.0.10:8080/';
-          console.log(json.memo);
-          that.$message.error(json.memo);
-        }
-      }, function (response) {
-        console.info(response);
-      })
     }
   },
   components: {}

+ 4 - 4
tv/vue.config.js

@@ -18,17 +18,17 @@ module.exports = {
     devServer: {
         port: 8083, // 端口
         proxy: {
+            //心率及上下课获取接口
             '/api': {
-                // target: 'http://192.168.0.105:8080/',
                 target: 'http://192.168.0.61:9000',
                 changeOrigin: true,
                 pathRewrite: {
                     '^/api': '',
                 }
             },
-            // 用查询最新wgt 般本
+            //查询最新wgt接口
             '/bpi': {
-                target: 'http://192.168.0.3:19096',//公司用
+                target: 'http://192.168.0.3:19096',
                 changeOrigin: true,
                 pathRewrite: {
                     '^/bpi': '',
@@ -36,7 +36,7 @@ module.exports = {
             }
         }
     },
-    // 输出文件目录
+    //打包输出文件目录
     outputDir: '/Users/macbook/Working/vueBuild/flyLong/GoAllOutTv',
     publicPath:'./',
 };