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 = {};
/**
* 根据id查询子页面的信息
* @param {Object[]} infoList 子页面信息
* @param {String} id 对比的id值
* */
var getSubInfoById = function(infoList,id){
var result = null;
for(var i=0,length = infoList.length;i<length;i+=1){
var info = infoList[i];
if(info.id == id){
result = info;
break;
}
}
return result;
};
//--------------------------------------
var wgtVer=null;
var checkUrl="http://11wangjp.oss-cn-shanghai.aliyuncs.com/ftt_mes/version.txt";
// 下载wgt文件
var wgtUrl="http://11wangjp.oss-cn-shanghai.aliyuncs.com/ftt_mes/ftt_mes_hot.wgt";
console.log("检测更新地址:"+wgtUrl);
function downWgtHot(){
plus.nativeUI.showWaiting("下载补丁文件...");
plus.downloader.createDownload( wgtUrl, {filename:"_doc/update/"}, function(d,status){
if ( status == 200 ) {
console.log("下载补丁成功:"+d.filename);
installWgtHOt(d.filename); // 安装wgt包
} else {
console.log("下载补丁失败!");
plus.nativeUI.alert("下载补丁失败!");
}
plus.nativeUI.closeWaiting();
}).start();
} }
function compareVersion(ov,nv){ }
};
if(!ov || !nv || ov == "" || nv == ""){ var aniShow = {};
return false; /**
} * 根据id查询子页面的信息
var b = false, * @param {Object[]} infoList 子页面信息
ova = ov.split(".",4), * @param {String} id 对比的id值
nva = nv.split(".",4), * */
j = ova.length, var getSubInfoById = function(infoList, id) {
k = nva.length; var result = null;
// console.log("ova:"+ova+"nva:"+nva); for (var i = 0, length = infoList.length; i < length; i += 1) {
for(var i =0;i < j && i < k;i += 1){ var info = infoList[i];
var so = ova[i], if (info.id == id) {
no = parseInt(so), result = info;
sn = nva[i], break;
nn = parseInt(sn);
if(nn > no || sn.length > so.length){
return true;
}else if(nn < no){
return false;
}
}
if(k > j && 0 == nv.indexOf(ov)){
return true;
}
} }
function checkUpdateHot(){ }
// plus.nativeUI.showWaiting("检测更新..."); return result;
var xhr=new XMLHttpRequest(); };
xhr.onreadystatechange=function(){ //--------------------------------------
switch(xhr.readyState){
case 4: var wgtVer = null;
plus.nativeUI.closeWaiting(); var t = (new Date()).valueOf();
if(xhr.status==200){ var checkUrl = "http://11wangjp.oss-cn-shanghai.aliyuncs.com/ftt_mes/version.txt?data=" + t;
console.log("检测更新成功:"+xhr.responseText); // 下载wgt文件
var wgtUrl = "http://11wangjp.oss-cn-shanghai.aliyuncs.com/ftt_mes/ftt_mes_hot.wgt";
console.log("检测更新地址:" + checkUrl);
var newVer=xhr.responseText;
if(compareVersion(wgtVer,newVer)){ function downWgtHot() {
plus.nativeUI.showWaiting("下载补丁文件...");
downWgtHot(); // 下载升级包 plus.downloader.createDownload(wgtUrl, {
}else{ filename: "_doc/update/"
//plus.nativeUI.alert("无新版本可更新!"); }, function(d, status) {
} if (status == 200) {
}else{ console.log("下载补丁成功:" + d.filename);
console.log("检测更新失败!"); installWgtHOt(d.filename); // 安装wgt包
plus.nativeUI.alert("检测更新失败!"); } else {
} console.log("下载补丁失败!");
break; plus.nativeUI.alert("下载补丁失败!");
default: }
break; plus.nativeUI.closeWaiting();
} }).start();
}
xhr.open('GET',checkUrl);
xhr.send();
} }
// 更新应用资源
function installWgtHOt(path){ function compareVersion(ov, nv) {
plus.nativeUI.showWaiting("安装wgt文件...");
plus.runtime.install(path,{},function(){ if (!ov || !nv || ov == "" || nv == "") {
plus.nativeUI.closeWaiting(); return false;
console.log("安装wgt文件成功!"); }
plus.nativeUI.alert("应用资源更新完成!",function(){ var b = false,
plus.runtime.restart(); ova = ov.split(".", 4),
}); nva = nv.split(".", 4),
},function(e){ j = ova.length,
plus.nativeUI.closeWaiting(); k = nva.length;
console.log("安装wgt文件失败["+e.code+"]:"+e.message); // console.log("ova:"+ova+"nva:"+nva);
plus.nativeUI.alert("安装wgt文件失败["+e.code+"]:"+e.message); for (var i = 0; i < j && i < k; i += 1) {
}); var so = ova[i],
no = parseInt(so),
sn = nva[i],
nn = parseInt(sn);
if (nn > no || sn.length > so.length) {
return true;
} else if (nn < no) {
return false;
}
}
if (k > j && 0 == nv.indexOf(ov)) {
return true;
}
} }
mui.plusReady(function(){
function checkUpdateHot() {
// 获取本地应用资源版本号 // plus.nativeUI.showWaiting("检测更新...");
plus.runtime.getProperty(plus.runtime.appid,function(inf){ var xhr = new XMLHttpRequest();
wgtVer=inf.version; xhr.onreadystatechange = function() {
console.log("当前应用版本:"+wgtVer); switch (xhr.readyState) {
checkUpdateHot() case 4:
}); plus.nativeUI.closeWaiting();
if (xhr.status == 200) {
var mineView = mui.preload({ console.log("检测更新成功:" + xhr.responseText);
url:'html/application.html',
id:'application',
styles:minepage_style var newVer = xhr.responseText;
}); if (compareVersion(wgtVer, newVer)) {
mui.initUpdate(false);
var self = plus.webview.getLaunchWebview(); downWgtHot(); // 下载升级包
var second = plus.webview.getSecondWebview(); } else {
var isLogin = localStorage.getItem('$state'); //plus.nativeUI.alert("无新版本可更新!");
// isLogin = false;
if(isLogin){
//关闭splash页面;
var data ={
}
// plus.navigator.closeSplashscreen();
plus.navigator.setFullscreen(false);
}else{
//显示启动导航
mui.openWindow({
id: 'login',
url: 'html/login.html',
styles: {
popGesture: "none"
},
show: {
aniShow: 'none'
},
waiting: {
autoShow: false
} }
}); } else {
} console.log("检测更新失败!");
var activeTab = subpages[0].id; plus.nativeUI.alert("检测更新失败!");
mui(".mui-bar-tab").on('tap','a.mui-tab-item',function(){
var _self = this,
targetTab = _self.getAttribute('data-id').trim(),
tabText = _self.getAttribute('data-text').trim(),
webview_style ={
};
if(targetTab == activeTab){
return;
}
if(~targetTab.indexOf('task')||~targetTab.indexOf('mine')){
//启用硬件加速,测试用
webview_style.hardwareAccelerated = true;
}
var _subView = plus.webview.getWebviewById(targetTab);
//若不存在则创建
if(!_subView){
var _subInfo = getSubInfoById(subpages,targetTab);
if(targetTab == "mine"){
_subView = plus.webview.create(_subInfo.url,_subInfo.id,minepage_style);
}else{
subpage_style.navigationbar.titleText = tabText;
_subView = plus.webview.create(_subInfo.url,_subInfo.id,subpage_style);
}
self.append(_subView);
} }
//显示目标选项卡 break;
_subView.show(); default:
break;
//隐藏当前; }
plus.webview.hide(activeTab); }
//更改当前活跃的选项卡 xhr.open('GET', checkUrl);
activeTab = targetTab; xhr.send();
}); }
}); // 更新应用资源
\ No newline at end of file function installWgtHOt(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);
});
}
mui.plusReady(function() {
// 获取本地应用资源版本号
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
wgtVer = inf.version;
console.log("当前应用版本:" + wgtVer);
checkUpdateHot()
});
var mineView = mui.preload({
url: 'html/application.html',
id: 'application',
styles: minepage_style
});
mui.initUpdate(false);
var self = plus.webview.getLaunchWebview();
var second = plus.webview.getSecondWebview();
var isLogin = localStorage.getItem('$state');
// isLogin = false;
if (isLogin) {
//关闭splash页面;
var data = {
}
// plus.navigator.closeSplashscreen();
plus.navigator.setFullscreen(false);
} else {
//显示启动导航
mui.openWindow({
id: 'login',
url: 'html/login.html',
styles: {
popGesture: "none"
},
show: {
aniShow: 'none'
},
waiting: {
autoShow: false
}
});
}
var activeTab = subpages[0].id;
mui(".mui-bar-tab").on('tap', 'a.mui-tab-item', function() {
var _self = this,
targetTab = _self.getAttribute('data-id').trim(),
tabText = _self.getAttribute('data-text').trim(),
webview_style = {
};
if (targetTab == activeTab) {
return;
}
if (~targetTab.indexOf('task') || ~targetTab.indexOf('mine')) {
//启用硬件加速,测试用
webview_style.hardwareAccelerated = true;
}
var _subView = plus.webview.getWebviewById(targetTab);
//若不存在则创建
if (!_subView) {
var _subInfo = getSubInfoById(subpages, targetTab);
if (targetTab == "mine") {
_subView = plus.webview.create(_subInfo.url, _subInfo.id, minepage_style);
} else {
subpage_style.navigationbar.titleText = tabText;
_subView = plus.webview.create(_subInfo.url, _subInfo.id, subpage_style);
}
self.append(_subView);
}
//显示目标选项卡
_subView.show();
//隐藏当前;
plus.webview.hide(activeTab);
//更改当前活跃的选项卡
activeTab = targetTab;
});
});
...@@ -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