Selaa lähdekoodia

关闭vConsole
删除'演示版'和'户外版'模式
目前改为正式版和线下版本
并新增观看模式

zhengwei 4 vuotta sitten
vanhempi
commit
b4f1fe7b35
6 muutettua tiedostoa jossa 91 lisäystä ja 92 poistoa
  1. 5 5
      tv/src/Global.js
  2. 0 3
      tv/src/Mock/index.js
  3. 2 2
      tv/src/main.js
  4. 1 1
      tv/src/views/2pkRank.vue
  5. 1 1
      tv/src/views/3pkRank.vue
  6. 82 80
      tv/src/views/Index.vue

+ 5 - 5
tv/src/Global.js

@@ -7,15 +7,15 @@ companyInfo = {
 
 //正式版
 versionNormal = 'normal';
-//户外版本
-versionOutDoor = 'outDoor';
-//演示版
-versionDemo = 'test';
+//线下版
+versionOffLine = 'offline';
+//是否是观看模式
+isViewMode = false;
 
 //当前运行模式
 runVersion = versionNormal;
 //实际场馆默认数据源
-headapi = 'http://192.168.0.10:8080/';
+headapi = 'http://221.214.111.254:9000/';
 // 七牛云imgSrc
 imgUrl = "http://qjzpcd34v.hb-bkt.clouddn.com";
 

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

@@ -381,9 +381,6 @@ if (t == 1) {
     if (runVersion == 'test') {
         curheadapi = 'http://cal.beswell.com:85/DataTransfer/';
     }
-    if(runVersion == 'outDoor'){
-         curheadapi = 'http://192.168.0.105:9000/';
-    }
 
     // 0: 下课 团课/私教/PK 的排名
     let LessonClass = 1;

+ 2 - 2
tv/src/main.js

@@ -9,8 +9,8 @@ import 'default-passive-events'
 import 'element-ui/lib/theme-chalk/index.css';
 
 //显示控制台
-let vConsole = new VConsole();
-Vue.use(vConsole)
+// let vConsole = new VConsole();
+// Vue.use(vConsole)
 if (process.env.NODE_ENV === 'development') {
     //演示版本数据
     require('./Mock/index.js');

+ 1 - 1
tv/src/views/2pkRank.vue

@@ -304,7 +304,7 @@ export default {
     PostAddPkInfo(dpId, groupNo) {
 
       // 如果是演示版不上报比赛结果
-      if (runVersion == 'test') {
+      if (isViewMode) {
         return false
       }
       let that = this;

+ 1 - 1
tv/src/views/3pkRank.vue

@@ -453,7 +453,7 @@ export default {
     PostAddPkInfo(dpId, groupNo) {
       console.log(dpId, groupNo);
       // 如果是演示版不上报比赛结果
-      if (runVersion == 'test') {
+      if (isViewMode) {
         return false
       }
       let that = this;

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

@@ -3,6 +3,17 @@
     <keep-alive>
       <router-view></router-view>
     </keep-alive>
+    <el-dialog
+        title="请输入设备信息"
+        :visible.sync="viewMode"
+        width="30%">
+      <el-input v-model="viewEqSn" placeholder="请输入设备编码"/>
+      <el-input v-model="viewVersion" placeholder="请输入设备版本号"/>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="viewMode = false">取 消</el-button>
+        <el-button type="primary" @click="changeEqSn()">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -27,110 +38,99 @@ export default {
       }],
       autoUpdate: false,
       curVersion: '1.0.1',
+      viewEqSn: localStorage.eqSn,
+      viewVersion: localStorage.version,
       isPad: true,//pad 展示版本
+      viewMode: false,//pad 展示版本
       clientHeight: document.documentElement.clientHeight + 'px'
     }
   },
   mounted() {
     // alert('clientWidth:' + document.documentElement.clientWidth);
     // alert('devicePixelRatio:' + window.devicePixelRatio);
-    //浏览器默认的
-    localStorage.eqSn = '30:9C:23:0C:8B:1E';
-    localStorage.version = '1.1.0';
-    this.getCurVersion();
+
+    //浏览器运行时打开注释
+    // localStorage.eqSn = '30:9C:23:0C:8B:1E';
+    // localStorage.version = '1.1.0';
+
+    this.viewMode = isViewMode;
+    this.isMui();
   },
   methods: {
-    //获取当前版本号
-    getCurVersion() {
+    changeEqSn() {
       let that = this;
-      //浏览器默认配置信息
-      localStorage.eqSn = '30:9C:23:0C:8B:1E';
-      localStorage.version = '1.1.0';
-
+      localStorage.eqSn = that.viewEqSn;
+      localStorage.version = that.viewVersion;
+      this.plusReady();
+      that.viewMode = false;
+    },
+    isMui() {
+      let that = this;
+      //mui is ready
       if (window.plus) {
-        plusReady();
-      } else {
-        console.log('mui is not ready');
-        // 调试时候关闭
-        this.getServeIpAddress(localStorage.eqSn);
-        document.addEventListener('plusready', plusReady, false);
-      }
+        //先检查升级
+        if (runVersion != versionOffLine) {
+          that.checkReleaseUpdate();//正式版
+        } else {
+          that.checkTestUpdate();//线下版
+        }
 
-      function plusReady() {
         if (typeof plus == 'undefined') return false;
 
-        //获取本地应用资源版本号
-        plus.runtime.getProperty(plus.runtime.appid, function (inf) {
-          localStorage.version = inf.version;
-          that.curVersion = inf.version;
-          console.log("inf:",inf);
-        });
-
-        //获取手机UUID
-        plus.device.getInfo({
-          success: function (e) {
-            let uuid = JSON.stringify(e.uuid).toString().substr(1);
-            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 == "14cc77e7c2281e20") {
-              that.checkTestUpdate();
-            } else {
-              //户外版禁用升级
-              if (runVersion == 'outDoor') {
-                console.log('户外版禁用自动升级');
-                return false
-              } else {
-                //正式版
-                that.checkReleaseUpdate();
-              }
+        if (!that.viewMode) {
+          //获取本地应用资源版本号
+          plus.runtime.getProperty(plus.runtime.appid, function (inf) {
+            localStorage.version = inf.version;
+            that.curVersion = inf.version;
+            console.log("inf:", inf);
+          });
+
+          //获取手机UUID
+          plus.device.getInfo({
+            success: function (e) {
+              let uuid = JSON.stringify(e.uuid).toString().substr(1);
+              uuid = uuid.substring(0, uuid.length - 1);
+              localStorage.eqSn = uuid;
+
+              console.log('===== uuid =====:' + uuid + '\ngetDeviceInfo success: ' + JSON.stringify(e.uuid));
+            },
+            fail: function (e) {
+              console.log('getDeviceInfo failed: ' + JSON.stringify(e));
             }
-          },
-          fail: function (e) {
-            console.log('getDeviceInfo failed: ' + JSON.stringify(e));
-          }
-        });
+          });
+          this.plusReady();
+        }
+      } else {
+        console.log('mui is not ready');
+        this.getServeIpAddress(localStorage.eqSn);
+        document.addEventListener('plusready', plusReady, false);
       }
     },
+    //获取当前版本号
+    plusReady() {
+      let that = this;
+      // 获取转发端口地址
+      that.getServeIpAddress(localStorage.eqSn);
+    },
     //获取转发端地址
     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
+      if (runVersion == versionOffLine) {
         url = "http://192.168.0.3:19096/v1/Sensors/GetShopConfigParam";
       }
-      console.log("url:"+url+"\neqSn:"+eqSn);
-      let param = {
-        eqSn: eqSn
-      };
+      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;
-          }
+          headapi = json.Rs.DataServiceIP;
         } else {
           headapi = 'http://221.214.111.254:9000/';
           console.log(json.memo);
@@ -139,16 +139,17 @@ export default {
       }, function (response) {
         console.info(response);
       })
-    },
+    }
+    ,
     //检查测试版本升级
-    checkTestUpdate(){
+    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);
+        console.log("checkTestUpdate", json);
         if (json.Code == 0) {
           if (localStorage.version != json.VueFramework.Version) {
             // 测试版本下载
@@ -161,14 +162,15 @@ export default {
       }, function (response) {
         console.info(response);
       })
-    },
+    }
+    ,
     //检查正式版本升级
     checkReleaseUpdate() {
       let param = {};
       let postData = qs.stringify(param);
       QueryVueFramework(postData).then(res => {
         let json = res;
-        console.log("checkReleaseUpdate",json);
+        console.log("checkReleaseUpdate", json);
         if (json.Code == 0) {
           console.log('localStorage.version' + localStorage.version);
           //正式