Commit ace52c26 authored by 王文琼's avatar 王文琼

搜索栏优化,等

parent 486eec8b
var minepage_style = { var minepage_style = {
top:"0px", top: "0px",
bottom: '0px' bottom: '0px'
}; };
mui.init(); mui.init();
var subpages =[{ var subpages = [{
url:'html/message.html', url: 'html/message.html',
id:'message' id: 'message'
},{ }, {
url:'html/task.html', url: 'html/task.html',
id:'task' id: 'task'
},{ }, {
url:'html/application.html', url: 'html/application.html',
id:'application' id: 'application'
},{ }, {
url:'html/mine.html', url: 'html/mine.html',
id:'mine' id: 'mine'
}]; }];
var subpage_style = { var subpage_style = {
// top:"44px", // top:"44px",
top:'0px', top: '0px',
bottom: '0px', bottom: '0px',
navigationbar:{ navigationbar: {
backgroundColor:'#1b83fe', backgroundColor: '#1b83fe',
titleText:'', titleText: '',
titleColor:'#FFFFFF', titleColor: '#FFFFFF',
splitLine:{ splitLine: {
color:'#cccccc', color: '#cccccc',
height:'1px' height: '1px'
} }
} }
}; };
var aniShow = {}; var aniShow = {};
/** /**
* 根据id查询子页面的信息 * 根据id查询子页面的信息
* @param {Object[]} infoList 子页面信息 * @param {Object[]} infoList 子页面信息
* @param {String} id 对比的id值 * @param {String} id 对比的id值
* */ * */
var getSubInfoById = function(infoList,id){ var getSubInfoById = function(infoList, id) {
var result = null; var result = null;
for(var i=0,length = infoList.length;i<length;i+=1){ for (var i = 0, length = infoList.length; i < length; i += 1) {
var info = infoList[i]; var info = infoList[i];
if(info.id == id){ if (info.id == id) {
result = info; result = info;
break; break;
} }
} }
return result; return result;
}; };
//-------------------------------------- //--------------------------------------
var wgtVer=null;
var checkUrl="http://11wangjp.oss-cn-shanghai.aliyuncs.com/ftt_mes/version.txt"; var wgtVer = null;
// 下载wgt文件 var t = (new Date()).valueOf();
var wgtUrl="http://11wangjp.oss-cn-shanghai.aliyuncs.com/ftt_mes/ftt_mes_hot.wgt"; var checkUrl = "http://11wangjp.oss-cn-shanghai.aliyuncs.com/ftt_mes/version.txt?data=" + t;
console.log("检测更新地址:"+wgtUrl); // 下载wgt文件
function downWgtHot(){ var wgtUrl = "http://11wangjp.oss-cn-shanghai.aliyuncs.com/ftt_mes/ftt_mes_hot.wgt";
console.log("检测更新地址:" + checkUrl);
function downWgtHot() {
plus.nativeUI.showWaiting("下载补丁文件..."); plus.nativeUI.showWaiting("下载补丁文件...");
plus.downloader.createDownload( wgtUrl, {filename:"_doc/update/"}, function(d,status){ plus.downloader.createDownload(wgtUrl, {
if ( status == 200 ) { filename: "_doc/update/"
console.log("下载补丁成功:"+d.filename); }, function(d, status) {
if (status == 200) {
console.log("下载补丁成功:" + d.filename);
installWgtHOt(d.filename); // 安装wgt包 installWgtHOt(d.filename); // 安装wgt包
} else { } else {
console.log("下载补丁失败!"); console.log("下载补丁失败!");
...@@ -66,52 +71,54 @@ var minepage_style = { ...@@ -66,52 +71,54 @@ var minepage_style = {
} }
plus.nativeUI.closeWaiting(); plus.nativeUI.closeWaiting();
}).start(); }).start();
} }
function compareVersion(ov,nv){
if(!ov || !nv || ov == "" || nv == ""){ function compareVersion(ov, nv) {
if (!ov || !nv || ov == "" || nv == "") {
return false; return false;
} }
var b = false, var b = false,
ova = ov.split(".",4), ova = ov.split(".", 4),
nva = nv.split(".",4), nva = nv.split(".", 4),
j = ova.length, j = ova.length,
k = nva.length; k = nva.length;
// console.log("ova:"+ova+"nva:"+nva); // console.log("ova:"+ova+"nva:"+nva);
for(var i =0;i < j && i < k;i += 1){ for (var i = 0; i < j && i < k; i += 1) {
var so = ova[i], var so = ova[i],
no = parseInt(so), no = parseInt(so),
sn = nva[i], sn = nva[i],
nn = parseInt(sn); nn = parseInt(sn);
if(nn > no || sn.length > so.length){ if (nn > no || sn.length > so.length) {
return true; return true;
}else if(nn < no){ } else if (nn < no) {
return false; return false;
} }
} }
if(k > j && 0 == nv.indexOf(ov)){ if (k > j && 0 == nv.indexOf(ov)) {
return true; return true;
} }
} }
function checkUpdateHot(){
function checkUpdateHot() {
// plus.nativeUI.showWaiting("检测更新..."); // plus.nativeUI.showWaiting("检测更新...");
var xhr=new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.onreadystatechange=function(){ xhr.onreadystatechange = function() {
switch(xhr.readyState){ switch (xhr.readyState) {
case 4: case 4:
plus.nativeUI.closeWaiting(); plus.nativeUI.closeWaiting();
if(xhr.status==200){ if (xhr.status == 200) {
console.log("检测更新成功:"+xhr.responseText); console.log("检测更新成功:" + xhr.responseText);
var newVer=xhr.responseText; var newVer = xhr.responseText;
if(compareVersion(wgtVer,newVer)){ if (compareVersion(wgtVer, newVer)) {
downWgtHot(); // 下载升级包 downWgtHot(); // 下载升级包
}else{ } else {
//plus.nativeUI.alert("无新版本可更新!"); //plus.nativeUI.alert("无新版本可更新!");
} }
}else{ } else {
console.log("检测更新失败!"); console.log("检测更新失败!");
plus.nativeUI.alert("检测更新失败!"); plus.nativeUI.alert("检测更新失败!");
} }
...@@ -120,51 +127,51 @@ var minepage_style = { ...@@ -120,51 +127,51 @@ var minepage_style = {
break; break;
} }
} }
xhr.open('GET',checkUrl); xhr.open('GET', checkUrl);
xhr.send(); xhr.send();
} }
// 更新应用资源 // 更新应用资源
function installWgtHOt(path){ function installWgtHOt(path) {
plus.nativeUI.showWaiting("安装wgt文件..."); plus.nativeUI.showWaiting("安装wgt文件...");
plus.runtime.install(path,{},function(){ plus.runtime.install(path, {}, function() {
plus.nativeUI.closeWaiting(); plus.nativeUI.closeWaiting();
console.log("安装wgt文件成功!"); console.log("安装wgt文件成功!");
plus.nativeUI.alert("应用资源更新完成!",function(){ plus.nativeUI.alert("应用资源更新完成!", function() {
plus.runtime.restart(); plus.runtime.restart();
}); });
},function(e){ }, function(e) {
plus.nativeUI.closeWaiting(); plus.nativeUI.closeWaiting();
console.log("安装wgt文件失败["+e.code+"]:"+e.message); console.log("安装wgt文件失败[" + e.code + "]:" + e.message);
plus.nativeUI.alert("安装wgt文件失败["+e.code+"]:"+e.message); plus.nativeUI.alert("安装wgt文件失败[" + e.code + "]:" + e.message);
}); });
} }
mui.plusReady(function(){ mui.plusReady(function() {
// 获取本地应用资源版本号 // 获取本地应用资源版本号
plus.runtime.getProperty(plus.runtime.appid,function(inf){ plus.runtime.getProperty(plus.runtime.appid, function(inf) {
wgtVer=inf.version; wgtVer = inf.version;
console.log("当前应用版本:"+wgtVer); console.log("当前应用版本:" + wgtVer);
checkUpdateHot() checkUpdateHot()
}); });
var mineView = mui.preload({ var mineView = mui.preload({
url:'html/application.html', url: 'html/application.html',
id:'application', id: 'application',
styles:minepage_style styles: minepage_style
}); });
mui.initUpdate(false); mui.initUpdate(false);
var self = plus.webview.getLaunchWebview(); var self = plus.webview.getLaunchWebview();
var second = plus.webview.getSecondWebview(); var second = plus.webview.getSecondWebview();
var isLogin = localStorage.getItem('$state'); var isLogin = localStorage.getItem('$state');
// isLogin = false; // isLogin = false;
if(isLogin){ if (isLogin) {
//关闭splash页面; //关闭splash页面;
var data ={ var data = {
} }
// plus.navigator.closeSplashscreen(); // plus.navigator.closeSplashscreen();
plus.navigator.setFullscreen(false); plus.navigator.setFullscreen(false);
}else{ } else {
//显示启动导航 //显示启动导航
mui.openWindow({ mui.openWindow({
id: 'login', id: 'login',
...@@ -181,30 +188,30 @@ function installWgtHOt(path){ ...@@ -181,30 +188,30 @@ function installWgtHOt(path){
}); });
} }
var activeTab = subpages[0].id; var activeTab = subpages[0].id;
mui(".mui-bar-tab").on('tap','a.mui-tab-item',function(){ mui(".mui-bar-tab").on('tap', 'a.mui-tab-item', function() {
var _self = this, var _self = this,
targetTab = _self.getAttribute('data-id').trim(), targetTab = _self.getAttribute('data-id').trim(),
tabText = _self.getAttribute('data-text').trim(), tabText = _self.getAttribute('data-text').trim(),
webview_style ={ webview_style = {
}; };
if(targetTab == activeTab){ if (targetTab == activeTab) {
return; return;
} }
if(~targetTab.indexOf('task')||~targetTab.indexOf('mine')){ if (~targetTab.indexOf('task') || ~targetTab.indexOf('mine')) {
//启用硬件加速,测试用 //启用硬件加速,测试用
webview_style.hardwareAccelerated = true; webview_style.hardwareAccelerated = true;
} }
var _subView = plus.webview.getWebviewById(targetTab); var _subView = plus.webview.getWebviewById(targetTab);
//若不存在则创建 //若不存在则创建
if(!_subView){ if (!_subView) {
var _subInfo = getSubInfoById(subpages,targetTab); var _subInfo = getSubInfoById(subpages, targetTab);
if(targetTab == "mine"){ if (targetTab == "mine") {
_subView = plus.webview.create(_subInfo.url,_subInfo.id,minepage_style); _subView = plus.webview.create(_subInfo.url, _subInfo.id, minepage_style);
}else{ } else {
subpage_style.navigationbar.titleText = tabText; subpage_style.navigationbar.titleText = tabText;
_subView = plus.webview.create(_subInfo.url,_subInfo.id,subpage_style); _subView = plus.webview.create(_subInfo.url, _subInfo.id, subpage_style);
} }
self.append(_subView); self.append(_subView);
...@@ -217,4 +224,4 @@ function installWgtHOt(path){ ...@@ -217,4 +224,4 @@ function installWgtHOt(path){
//更改当前活跃的选项卡 //更改当前活跃的选项卡
activeTab = targetTab; activeTab = targetTab;
}); });
}); });
\ No newline at end of file
...@@ -376,9 +376,10 @@ var app = new Vue({ ...@@ -376,9 +376,10 @@ var app = new Vue({
that.rightInfor = []; that.rightInfor = [];
that.itemsDetail = []; that.itemsDetail = [];
that.cur = 0; that.cur = 0;
mui.toast("没有对应的数据哦!")
} }
}, function(xhr, type, res) { }, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message)) mui.toast(JSON.stringify(res.message));
}); });
} else { } else {
Api.post('/api/vMES/ProductionReportV2/SearchDone', para, function(e) { Api.post('/api/vMES/ProductionReportV2/SearchDone', para, function(e) {
...@@ -394,6 +395,7 @@ var app = new Vue({ ...@@ -394,6 +395,7 @@ var app = new Vue({
that.rightInfor = []; that.rightInfor = [];
that.itemsDetail = []; that.itemsDetail = [];
that.cur = 0; that.cur = 0;
mui.toast("没有对应的数据哦!");
} }
}, function(xhr, type, res) { }, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message)) mui.toast(JSON.stringify(res.message))
......
...@@ -374,6 +374,7 @@ var app = new Vue({ ...@@ -374,6 +374,7 @@ var app = new Vue({
that.itemsLeft = []; that.itemsLeft = [];
that.itemsDetail = []; that.itemsDetail = [];
that.cur = 0; that.cur = 0;
mui.toast("没有对应的数据哦!");
} }
} }
}, function(xhr, type, res) { }, function(xhr, type, res) {
...@@ -393,6 +394,7 @@ var app = new Vue({ ...@@ -393,6 +394,7 @@ var app = new Vue({
that.itemsLeft2 = []; that.itemsLeft2 = [];
that.itemsDetail = []; that.itemsDetail = [];
that.cur = 0; that.cur = 0;
mui.toast("没有对应的数据哦!");
} }
} }
}, function(xhr, type, res) { }, function(xhr, type, res) {
......
...@@ -376,6 +376,7 @@ var app = new Vue({ ...@@ -376,6 +376,7 @@ var app = new Vue({
that.itemsLeft = []; that.itemsLeft = [];
that.itemsDetail = []; that.itemsDetail = [];
that.cur = 0; that.cur = 0;
mui.toast("没有对应的数据哦!");
} }
} }
}, function(xhr, type, res) { }, function(xhr, type, res) {
...@@ -395,6 +396,7 @@ var app = new Vue({ ...@@ -395,6 +396,7 @@ var app = new Vue({
that.itemsLeft2 = []; that.itemsLeft2 = [];
that.itemsDetail = []; that.itemsDetail = [];
that.cur = 0; that.cur = 0;
mui.toast("没有对应的数据哦!");
} }
} }
}, function(xhr, type, res) { }, function(xhr, type, res) {
......
...@@ -375,6 +375,7 @@ var app = new Vue({ ...@@ -375,6 +375,7 @@ var app = new Vue({
that.rightInfor = []; that.rightInfor = [];
that.itemsDetail = []; that.itemsDetail = [];
that.cur = 0; that.cur = 0;
mui.toast("没有对应的数据哦!");
} }
}, function(xhr, type, res) { }, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message)) mui.toast(JSON.stringify(res.message))
...@@ -393,6 +394,7 @@ var app = new Vue({ ...@@ -393,6 +394,7 @@ var app = new Vue({
that.rightInfor = []; that.rightInfor = [];
that.itemsDetail = []; that.itemsDetail = [];
that.cur = 0; that.cur = 0;
mui.toast("没有对应的数据哦!");
} }
}, function(xhr, type, res) { }, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message)) mui.toast(JSON.stringify(res.message))
......
...@@ -374,6 +374,7 @@ var app = new Vue({ ...@@ -374,6 +374,7 @@ var app = new Vue({
that.rightInfor = []; that.rightInfor = [];
that.itemsDetail = []; that.itemsDetail = [];
that.cur = 0; that.cur = 0;
mui.toast("没有对应的数据哦!")
} }
}, function(xhr, type, res) { }, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message)) mui.toast(JSON.stringify(res.message))
......
(function($){ (function($){
var t = (new Date()).valueOf();
var wgtVer = null, var wgtVer = null,
checkUrl = "http://11wangjp.oss-cn-shanghai.aliyuncs.com/ftt_mes", checkUrl = "http://11wangjp.oss-cn-shanghai.aliyuncs.com/ftt_mes",
localDir="update", localDir="update",
...@@ -13,7 +14,6 @@ ...@@ -13,7 +14,6 @@
// 从设置那边调用 ,不检查"跳过此版本",如果没有新版本,也要跳出来提示框 // 从设置那边调用 ,不检查"跳过此版本",如果没有新版本,也要跳出来提示框
var is_invoke_from_setting = false; var is_invoke_from_setting = false;
/** /**
* 创建升级目录 * 创建升级目录
*/ */
...@@ -127,6 +127,7 @@ function getUpdateData(){ ...@@ -127,6 +127,7 @@ function getUpdateData(){
}else{ }else{
mui.toast("xhr请求失败:"+xhr.status)
console.log("xhr请求失败:"+xhr.status); console.log("xhr请求失败:"+xhr.status);
} }
break; break;
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
border-radius: 8px; border-radius: 8px;
} }
.application-box { .application-box {
display: block; display: none;
} }
</style> </style>
</head> </head>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"id" : "H544710A8", /*应用的标识,创建应用时自动生成,勿手动修改*/ "id" : "H544710A8", /*应用的标识,创建应用时自动生成,勿手动修改*/
"name" : "飞天兔MES", /*应用名称,程序桌面图标名称*/ "name" : "飞天兔MES", /*应用名称,程序桌面图标名称*/
"version" : { "version" : {
"name" : "1.0.0.97", /*应用版本名称*/ "name" : "1.0.1.2", /*应用版本名称*/
"code" : 338 "code" : 338
}, },
"description" : "飞天兔MES平板版", /*应用描述信息*/ "description" : "飞天兔MES平板版", /*应用描述信息*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment