Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MES_PAD
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
MES_PAD
Commits
ebcadfea
Commit
ebcadfea
authored
Nov 15, 2018
by
上官
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app 内更新同步
parent
b8fa5a5a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
153 additions
and
6 deletions
+153
-6
updateHot.js
dest/js/updateHot.js
+70
-0
index.html
index.html
+81
-1
update.js
js/update.js
+1
-1
manifest.json
manifest.json
+1
-4
No files found.
dest/js/updateHot.js
0 → 100644
View file @
ebcadfea
(
function
(
$
){
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"
;
function
downWgtHot
(){
plus
.
nativeUI
.
showWaiting
(
"下载wgt文件..."
);
plus
.
downloader
.
createDownload
(
wgtUrl
,
{
filename
:
"_doc/update/"
},
function
(
d
,
status
){
if
(
status
==
200
)
{
console
.
log
(
"下载wgt成功:"
+
d
.
filename
);
installWgtHOt
(
d
.
filename
);
// 安装wgt包
}
else
{
console
.
log
(
"下载wgt失败!"
);
plus
.
nativeUI
.
alert
(
"下载wgt失败!"
);
}
plus
.
nativeUI
.
closeWaiting
();
}).
start
();
}
$
.
initUpdateHot
=
function
checkUpdateHot
(){
plus
.
nativeUI
.
showWaiting
(
"检测更新..."
);
var
xhr
=
new
XMLHttpRequest
();
xhr
.
onreadystatechange
=
function
(){
switch
(
xhr
.
readyState
){
case
4
:
plus
.
nativeUI
.
closeWaiting
();
if
(
xhr
.
status
==
200
){
console
.
log
(
"检测更新成功:"
+
xhr
.
responseText
);
var
newVer
=
xhr
.
responseText
;
if
(
wgtVer
&&
newVer
&&
(
wgtVer
!=
newVer
)){
downWgtHot
();
// 下载升级包
}
else
{
//plus.nativeUI.alert("无新版本可更新!");
}
}
else
{
console
.
log
(
"检测更新失败!"
);
plus
.
nativeUI
.
alert
(
"检测更新失败!"
);
}
break
;
default
:
break
;
}
}
xhr
.
open
(
'GET'
,
checkUrl
);
xhr
.
send
();
}
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
);
index.html
View file @
ebcadfea
...
@@ -88,8 +88,88 @@
...
@@ -88,8 +88,88 @@
}
}
return
result
;
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"
;
function
downWgtHot
(){
plus
.
nativeUI
.
showWaiting
(
"下载wgt文件..."
);
plus
.
downloader
.
createDownload
(
wgtUrl
,
{
filename
:
"_doc/update/"
},
function
(
d
,
status
){
if
(
status
==
200
)
{
console
.
log
(
"下载wgt成功:"
+
d
.
filename
);
installWgtHOt
(
d
.
filename
);
// 安装wgt包
}
else
{
console
.
log
(
"下载wgt失败!"
);
plus
.
nativeUI
.
alert
(
"下载wgt失败!"
);
}
plus
.
nativeUI
.
closeWaiting
();
}).
start
();
}
function
checkUpdateHot
(){
plus
.
nativeUI
.
showWaiting
(
"检测更新..."
);
var
xhr
=
new
XMLHttpRequest
();
xhr
.
onreadystatechange
=
function
(){
switch
(
xhr
.
readyState
){
case
4
:
plus
.
nativeUI
.
closeWaiting
();
if
(
xhr
.
status
==
200
){
console
.
log
(
"检测更新成功:"
+
xhr
.
responseText
);
var
newVer
=
xhr
.
responseText
;
if
(
wgtVer
&&
newVer
&&
(
wgtVer
!=
newVer
)){
downWgtHot
();
// 下载升级包
}
else
{
//plus.nativeUI.alert("无新版本可更新!");
}
}
else
{
console
.
log
(
"检测更新失败!"
);
plus
.
nativeUI
.
alert
(
"检测更新失败!"
);
}
break
;
default
:
break
;
}
}
xhr
.
open
(
'GET'
,
checkUrl
);
xhr
.
send
();
}
// 更新应用资源
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
(){
mui
.
plusReady
(
function
(){
//------------------------------------------
// 获取本地应用资源版本号
plus
.
runtime
.
getProperty
(
plus
.
runtime
.
appid
,
function
(
inf
){
wgtVer
=
inf
.
version
;
console
.
log
(
"当前应用版本:"
+
wgtVer
);
checkUpdateHot
()
});
// if(window.plus){
// plusReady();
// }else{
// document.addEventListener('plusready',plusReady,false);
// }
// console.log("end end end end ")
// return
//-----------------------------------------------------
var
mineView
=
mui
.
preload
({
var
mineView
=
mui
.
preload
({
url
:
'html/application.html'
,
url
:
'html/application.html'
,
id
:
'application'
,
id
:
'application'
,
...
...
js/update.js
View file @
ebcadfea
...
@@ -213,7 +213,7 @@ function checkUpdate(){
...
@@ -213,7 +213,7 @@ function checkUpdate(){
if
(
wgtVer
&&
newVer
&&
(
wgtVer
!=
newVer
)){
if
(
wgtVer
&&
newVer
&&
(
wgtVer
!=
newVer
)){
downWgt
();
//下载升级包
downWgt
();
//下载升级包
}
else
{
}
else
{
plus
.
nativeUI
.
console
.
log
(
"无版本可更新!"
);
//
plus.nativeUI.console.log("无版本可更新!");
}
}
}
else
{
}
else
{
console
.
log
(
"检测更新失败!"
);
console
.
log
(
"检测更新失败!"
);
...
...
manifest.json
View file @
ebcadfea
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
"id"
:
"H544710A8"
,
/*应用的标识,创建应用时自动生成,勿手动修改*/
"id"
:
"H544710A8"
,
/*应用的标识,创建应用时自动生成,勿手动修改*/
"name"
:
"飞天兔MES"
,
/*应用名称,程序桌面图标名称*/
"name"
:
"飞天兔MES"
,
/*应用名称,程序桌面图标名称*/
"version"
:
{
"version"
:
{
"name"
:
"1.0.0.5"
,
/*应用版本名称*/
"name"
:
"1.0.0.
2
5"
,
/*应用版本名称*/
"code"
:
"338"
"code"
:
"338"
},
},
"description"
:
"飞天兔MES平板版"
,
/*应用描述信息*/
"description"
:
"飞天兔MES平板版"
,
/*应用描述信息*/
...
@@ -77,9 +77,6 @@
...
@@ -77,9 +77,6 @@
"Barcode"
:
{
"Barcode"
:
{
"description"
:
"管理二维码扫描插件"
"description"
:
"管理二维码扫描插件"
},
},
"Maps"
:
{
"description"
:
"管理地图插件"
},
"Speech"
:
{},
"Speech"
:
{},
"Webview"
:
{
"Webview"
:
{
"description"
:
"窗口管理"
"description"
:
"窗口管理"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment