| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376 |
- <template>
- <div :class="[{'IndexContainer':true}]" :style="{height:clientHeight}">
- <keep-alive>
- <router-view></router-view>
- </keep-alive>
- </div>
- </template>
- <script>
- import {
- QueryVueFramework
- } from '@/api/getApiRes'
- import "../../public/mui.js"
- import '../Global'
- let qs = require('qs');
- export default {
- name: 'Home',
- data() {
- return {
- handleTabsList: [{
- title: '系统首页',
- name: '1',
- clmurl: '/',
- }],
- autoUpdate: false,
- curVersion: '1.0.1',
- isPad: true,//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();
- },
- methods: {
- //获取当前版本号
- getCurVersion() {
- let that = this;
- //浏览器默认配置信息
- localStorage.eqSn = '30:9C:23:0C:8B:1E';
- localStorage.version = '1.1.0';
- if (window.plus) {
- plusReady();
- } else {
- console.log('mui is not ready');
- // 调试时候关闭
- this.getServeIpAddress(localStorage.eqSn);
- document.addEventListener('plusready', plusReady, false);
- }
- function plusReady() {
- if (typeof plus == 'undefined') return false;
- //获取本地应用资源版本号
- plus.runtime.getProperty(plus.runtime.appid, function (inf) {
- localStorage.version = inf.version;
- that.curVersion = inf.version;
- });
- //获取手机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 == "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);
- })
- } else {
- console.log(223);
- // 正式版
- //开启自动升级
- // 教室版本自动升级,户外版禁用自动升级
- if (runVersion == 'outDoor') {
- console.log('户外版禁用自动升级');
- return false
- } else {
- that.checkUpdate();
- }
- }
- },
- fail: function (e) {
- console.log('getDeviceInfo failed: ' + JSON.stringify(e));
- }
- });
- }
- },
- // 是否有新版本
- checkUpdate() {
- let that = this;
- let param = {};
- let postdata = qs.stringify(param);
- const h = that.$createElement;
- QueryVueFramework(postdata).then(res => {
- let json = res;
- 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'}, '检测到新的版本,正在下载最新版本')
- // });
- }
- }
- })
- },
- 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包
- } else {
- console.log("下载wgt失败!");
- // plus.nativeUI.alert("下载wgt失败!");
- }
- plus.nativeUI.closeWaiting();
- }).start();
- },
- 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: {}
- }
- </script>
- <!-- Add "scoped" attribute to limit CSS to this component only -->
- <style>
- ul, li {
- list-style: none;
- margin: 0;
- padding: 0;
- }
- .el-header {
- padding: 0 !important;
- height: 72px !important;
- }
- .shortElaside {
- width: 140px !important;
- overflow: hidden;
- height: 100%;
- float: left;
- }
- .lognElaside {
- width: 256px !important;
- overflow: hidden;
- height: 100%;
- float: left;
- }
- /deep/ .nav {
- width: 60px;
- }
- .IndexContainer {
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- background: #F0F2F5;
- height: 100%;
- overflow-y: scroll;
- }
- /*演示版专供*/
- .isPad {
- height: 11.2rem;
- }
- .IndexContainer > .el-container {
- width: 100%;
- height: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .footer {
- position: absolute;
- bottom: 0px;
- width: 100%;
- padding: 10px;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- text-align: center;
- text-indent: -30%;
- font-size: 12px;
- color: #BDBDBD;
- background: #F0F2F5;
- z-index: 222;
- }
- .el-main {
- width: 100%;
- height: 100%;
- /*min-height: 800px;*/
- overflow: hidden;
- display: block;
- margin: 0 auto;
- overflow-y: hidden;
- padding: 10px 20px;
- }
- /*ipad only*/
- @media only screen and (max-width: 1366px) {
- .lognElaside {
- width: 70px !important;
- }
- .logoContainer img {
- display: none !important;
- }
- .el-main {
- padding: 3px !important;
- overflow-y: scroll;
- }
- .el-main > .context {
- /*height: 640px;*/
- /*overflow-y: scroll;*/
- padding: 6px !important;
- }
- .table {
- /*width: 950px;*/
- /*overflow-x: scroll;*/
- }
- .el-dialog {
- max-width: 960px;
- }
- .el-dialog__body {
- padding: 3px;
- }
- .el-transfer__buttons {
- width: 60px;
- padding: 3px;
- }
- .el-transfer .el-button + .el-button {
- float: right;
- }
- .el-container.is-vertical {
- position: absolute;
- left: 140px;
- top: 0;
- right: 0;
- bottom: 0;
- height: 100%;
- }
- .context {
- border-radius: 12px;
- height: 823px !important;
- overflow-y: scroll;
- }
- .el-dialog {
- padding: 5px;
- padding-bottom: 15px;
- }
- }
- #__vconsole {
- display: none;
- }
- #__vconsole.show {
- display: block;
- }
- </style>
|