|
|
@@ -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);
|
|
|
//正式
|