Merge branch 'YOUFANGAPP1.1.1' of 192.168.0.27:dev0/youfang-app into YOUFANGAPP1.1.1
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
var versionUpdate = function(){
|
||||
var isAndroid = isAndroidUser();
|
||||
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
|
||||
var localVersion =inf.version;
|
||||
var curVersion = versionInfo();
|
||||
if(parseFloat(localVersion)<curVersion.version){
|
||||
plus.nativeUI.alert( curVersion.updateDesc,
|
||||
var isAndroid = isAndroidUser();
|
||||
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
|
||||
var localVersion = inf.version;
|
||||
var curVersion = versionInfo();
|
||||
if(compareVersion(localVersion, curVersion.version)){
|
||||
//判断升级方式(0:提示 1:静默)
|
||||
if(curVersion.upgradeType == 0){
|
||||
plus.nativeUI.alert(curVersion.updateDesc,
|
||||
function(){
|
||||
if(isAndroid){
|
||||
downApp()
|
||||
downApp();
|
||||
}else{
|
||||
plus.nativeUI.showWaiting("版本更新中...");
|
||||
var url='https://itunes.apple.com/cn/app/id1341557643?mt=8';
|
||||
@@ -15,12 +17,13 @@ var versionUpdate = function(){
|
||||
}
|
||||
}, "发现新版本", "立即升级"
|
||||
);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
};
|
||||
}else if(curVersion.upgradeType == 1){
|
||||
//不区分Android 和 ios直接增量包更新(Android已测试,ios待测试)
|
||||
downAppWgt(curVersion.fileUrl);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//判断是不是安卓系统
|
||||
var isAndroidUser = function(){
|
||||
@@ -33,8 +36,9 @@ var isAndroidUser = function(){
|
||||
}
|
||||
return isAndroid;
|
||||
}
|
||||
|
||||
//判断是否需要安装
|
||||
var versionInfo = function(){
|
||||
var versionInfo = function(){
|
||||
var flag = null;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -46,28 +50,29 @@ var versionInfo = function(){
|
||||
flag = data.data;
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
return flag;
|
||||
}
|
||||
|
||||
//下载后安装
|
||||
var downApp =function(){
|
||||
var url="http://app.fangjia.com/download/youfang.apk"; // 下载文件地址
|
||||
plus.nativeUI.showWaiting("下载wgt文件...");
|
||||
var downApp = function(){
|
||||
var url="http://app.fangjia.com/download/youfang.apk"; //下载文件地址
|
||||
plus.nativeUI.showWaiting("下载apk文件...");
|
||||
var dtask = plus.downloader.createDownload( url, {}, function ( d, status ) {
|
||||
if ( status == 200 ) { // 下载成功
|
||||
installWgt(d.filename)
|
||||
if (status == 200) {
|
||||
//下载成功
|
||||
install(d.filename);
|
||||
} else {//下载失败
|
||||
alert( "Download failed: " + status );
|
||||
plus.nativeUI.alert("Download failed: " + status);
|
||||
}
|
||||
plus.nativeUI.closeWaiting()
|
||||
plus.nativeUI.closeWaiting();
|
||||
});
|
||||
dtask.start();
|
||||
}
|
||||
|
||||
//安装
|
||||
function installWgt(path){
|
||||
plus.nativeUI.showWaiting("安装wgt文件...");
|
||||
function install(path){
|
||||
plus.nativeUI.showWaiting("安装apk文件...");
|
||||
plus.runtime.install(path,{},function(){
|
||||
plus.nativeUI.closeWaiting();
|
||||
plus.nativeUI.alert("应用资源更新完成!",function(){
|
||||
@@ -75,6 +80,82 @@ function installWgt(path){
|
||||
});
|
||||
},function(e){
|
||||
plus.nativeUI.closeWaiting();
|
||||
plus.nativeUI.alert("安装wgt文件失败["+e.code+"]:"+e.message);
|
||||
plus.nativeUI.alert("安装apk文件失败["+e.code+"]:"+e.message);
|
||||
});
|
||||
}
|
||||
|
||||
//静默安装下载
|
||||
var downAppWgt = function(url){
|
||||
var dtask = plus.downloader.createDownload( url, {}, function ( d, status ) {
|
||||
if (status == 200) {
|
||||
//下载成功
|
||||
installWgt(d.filename)
|
||||
} else {
|
||||
//下载失败
|
||||
}
|
||||
});
|
||||
dtask.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 静默安装
|
||||
* force: (Boolean 类型 )是否强制安装
|
||||
* true表示强制安装,不进行版本号的校验;false则需要版本号校验
|
||||
* @param {Object} path
|
||||
*/
|
||||
function installWgt(path){
|
||||
plus.runtime.install(path, {force:true}, function(){
|
||||
plus.runtime.restart();
|
||||
},function(e){
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 版本比较(添加时候已经控制版本格式xx.xx ~ xx.xx.xx)
|
||||
* @param {Object} _currentVersion 当前版本
|
||||
* @param {Object} _onLineVersion 系统最新上架版本
|
||||
*/
|
||||
function compareVersion(_currentVersion, _onLineVersion){
|
||||
try{
|
||||
var onLineVersion = _onLineVersion.split('.');
|
||||
var currentVersion = _currentVersion.split('.');
|
||||
//先比较第一位
|
||||
if(parseFloat(onLineVersion[0]) > parseFloat(currentVersion[0])){
|
||||
return true;
|
||||
}else if(parseFloat(onLineVersion[0]) == parseFloat(currentVersion[0])){
|
||||
//在比较第二位
|
||||
if(parseFloat(onLineVersion[1]) > parseFloat(currentVersion[1])){
|
||||
return true;
|
||||
}else if(parseFloat(onLineVersion[1]) == parseFloat(currentVersion[1])){
|
||||
//判断第三位是否存在,存在才可以进行比较
|
||||
if(onLineVersion.length > currentVersion.length){
|
||||
//如果当前输入的version大于maxVersion的length
|
||||
return true;
|
||||
}else if(onLineVersion.length == currentVersion.length){
|
||||
if(onLineVersion.length == 2){
|
||||
return false;
|
||||
}else{
|
||||
//当length相等,且存在第三位
|
||||
if(parseFloat(onLineVersion[2]) > parseFloat(currentVersion[2])){
|
||||
return true;
|
||||
}else if(parseFloat(onLineVersion[2]) == parseFloat(currentVersion[2])){
|
||||
return false;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//如果当前输入的version小于maxVersion的length
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}catch(e){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+12
-1
@@ -6,9 +6,10 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="css/sm.css">
|
||||
<link rel="stylesheet" href="css/mui.min.css">
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
|
||||
<style>
|
||||
.mui-bar-tab{background:#fff;box-shadow:none;}
|
||||
.mui-bar-tab .mui-tab-item{border-top:solid 1px #e7e7e7;}
|
||||
@@ -16,10 +17,18 @@
|
||||
.mui-bar-tab .mui-tab-item.mui-active .mui-icon{color:#F18D00;}
|
||||
.mui-bar-tab .mui-tab-item .mui-icon~.mui-tab-label{color:#C3C0BC;}
|
||||
.mui-bar-tab .mui-tab-item.mui-active .mui-icon~.mui-tab-label{color:#F18D00;}
|
||||
|
||||
.loadingBg{width:100%;height:100%;background:#fff;overflow:hidden;position:absolute;top:11px;left:0;z-index:100;}
|
||||
.loadingBg .infinite-scroll-preloader{margin-top:30%;}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="loadingBg">
|
||||
<div class="infinite-scroll-preloader">
|
||||
<div class="preloader"></div>
|
||||
</div>
|
||||
</div>
|
||||
<nav class="mui-bar mui-bar-tab">
|
||||
<a class="mui-tab-item mui-active" id="defaultTab" href="yfindex.html">
|
||||
<span class="mui-icon iconfont icon-tab01"></span>
|
||||
@@ -89,6 +98,7 @@
|
||||
|
||||
} else {
|
||||
loadStartPage();
|
||||
|
||||
//显示启动导航
|
||||
mui.openWindow({
|
||||
id: 'guide',
|
||||
@@ -103,6 +113,7 @@
|
||||
autoShow: false
|
||||
}
|
||||
});
|
||||
setTimeout(function(){$(".loadingBg").hide();},1000)
|
||||
}
|
||||
var self = plus.webview.currentWebview();
|
||||
for (var i = 0; i < 4; i++) {
|
||||
|
||||
@@ -2035,7 +2035,6 @@ function addItems(number, lastIndex) {
|
||||
function loadImg(url, obj){
|
||||
if($(obj).attr("src") == 'cardInfoPlaceholderImg.png'){
|
||||
$(obj).attr("src", url)
|
||||
console.log("+=============="+url);
|
||||
}
|
||||
}
|
||||
//数量进行转换
|
||||
|
||||
Reference in New Issue
Block a user