Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cxerpapp
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
李苏
cxerpapp
Commits
35443e55
Commit
35443e55
authored
May 30, 2022
by
李苏
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app更新
parent
ed2cb9bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
72 deletions
+66
-72
appUpdate.js
common/util/appUpdate.js
+64
-70
manifest.json
manifest.json
+2
-2
No files found.
common/util/appUpdate.js
View file @
35443e55
//APP更新
//APP更新
import
api
from
'api/api.js'
export
default
function
appUpdate
()
{
export
default
function
appUpdate
()
{
uni
.
request
({
api
.
postData
(
'/getAppVersion'
,{
url
:
'http://app.jeecg.com/update.json'
,
//检查更新的服务器地址
/* version: plus.runtime.version,
data
:
{
imei: plus.device.imei, */
appid
:
plus
.
runtime
.
appid
,
apptype
:
"0"
,
version
:
plus
.
runtime
.
version
,
appid
:
plus
.
runtime
.
appid
,
imei
:
plus
.
device
.
imei
}).
then
((
res
)
=>
{
},
if
(
res
){
success
:
(
res
)
=>
{
plus
.
runtime
.
getProperty
(
plus
.
runtime
.
appid
,
function
(
wgtinfo
)
{
plus
.
runtime
.
getProperty
(
plus
.
runtime
.
appid
,
function
(
wgtinfo
)
{
let
client_version
=
wgtinfo
.
version
;
let
client_version
=
wgtinfo
.
version
var
flag_update_v
=
Number
(
client_version
.
split
(
"."
)[
0
]);
var
flag_update
=
client_version
.
split
(
"."
).
splice
(
0
,
2
).
join
(
"."
)
!=
res
.
data
.
version
.
split
(
"."
).
splice
(
0
,
2
)
var
flag_update_v2
=
Number
(
res
.
data
.
version
);
.
join
(
"."
)
var
flag_hot
=
false
;
var
flag_hot
=
(
Number
(
client_version
.
split
(
"."
)[
2
])
<
Number
(
res
.
data
.
version
.
split
(
"."
)[
2
]))
&
!
flag_update
if
(
flag_update_v
<
flag_update_v2
)
{
console
.
log
(
client_version
)
// 提醒用户更新
console
.
log
(
flag_update
)
uni
.
showModal
({
console
.
log
(
flag_hot
)
title
:
'更新提示'
,
content
:
"请进行版本更新"
,
if
(
flag_update
)
{
success
:
(
showResult
)
=>
{
// 提醒用户更新
if
(
showResult
.
confirm
)
{
uni
.
showModal
({
plus
.
nativeUI
.
toast
(
"正在准备环境,请稍后! "
);
title
:
'更新提示'
,
var
dtask
=
plus
.
downloader
.
createDownload
(
res
.
data
.
url
,
{
content
:
res
.
data
.
note
,
method
:
'GET'
,
success
:
(
showResult
)
=>
{
filename
:
'_doc/update/'
if
(
showResult
.
confirm
)
{
},
function
(
d
,
status
)
{
plus
.
nativeUI
.
toast
(
"正在准备环境,请稍后!"
);
if
(
status
==
200
)
{
console
.
log
(
res
.
data
.
url
,
)
var
path
=
d
.
filename
;
//下载apk
var
dtask
=
plus
.
downloader
.
createDownload
(
res
.
data
.
url
,
{
plus
.
runtime
.
install
(
path
);
// 自动安装apk文件
method
:
'GET'
,
}
else
{
filename
:
'_doc/update/'
plus
.
nativeUI
.
alert
(
'版本更新失败:'
+
status
);
},
function
(
d
,
status
)
{
}
if
(
status
==
200
)
{
});
var
path
=
d
.
filename
;
//下载apk
dtask
.
start
();
plus
.
runtime
.
install
(
path
);
// 自动安装apk文件
}
}
else
{
}
plus
.
nativeUI
.
alert
(
'版本更新失败:'
+
status
);
})
}
}
else
if
(
flag_hot
)
{
});
uni
.
downloadFile
({
dtask
.
start
();
url
:
res
.
data
.
url
,
}
success
:
(
downloadResult
)
=>
{
}
console
.
log
(
downloadResult
.
tempFilePath
)
})
if
(
downloadResult
.
statusCode
===
200
)
{
}
else
if
(
flag_hot
)
{
plus
.
nativeUI
.
toast
(
`正在热更新!
${
res
.
data
.
versionCode
}
`
);
uni
.
downloadFile
({
plus
.
runtime
.
install
(
downloadResult
.
tempFilePath
,
{
url
:
res
.
data
.
wgtUrl
,
force
:
false
success
:
(
downloadResult
)
=>
{
},
function
()
{
console
.
log
(
downloadResult
.
tempFilePath
)
plus
.
nativeUI
.
toast
(
"热更新成功"
);
if
(
downloadResult
.
statusCode
===
200
)
{
plus
.
runtime
.
restart
();
plus
.
nativeUI
.
toast
(
`正在热更新!
${
res
.
data
.
versionCode
}
`
);
},
function
(
e
)
{
plus
.
runtime
.
install
(
downloadResult
.
tempFilePath
,
{
console
.
log
(
e
)
force
:
false
plus
.
nativeUI
.
toast
(
`热更新失败:
${
e
.
message
}
`
);
},
function
()
{
});
plus
.
nativeUI
.
toast
(
"热更新成功"
);
}
plus
.
runtime
.
restart
();
}
},
function
(
e
)
{
});
console
.
log
(
e
)
}
plus
.
nativeUI
.
toast
(
`热更新失败:
${
e
.
message
}
`
);
});
});
}
}
}
}).
catch
((
err
)
=>
{
});
}
}).
finally
(()
=>
{
});
})
}
})
}
}
manifest.json
View file @
35443e55
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
"name"
:
"格物ERP"
,
"name"
:
"格物ERP"
,
"appid"
:
"__UNI__C98E701"
,
"appid"
:
"__UNI__C98E701"
,
"description"
:
""
,
"description"
:
""
,
"versionName"
:
"1.0.
0
"
,
"versionName"
:
"1.0.
1
"
,
"versionCode"
:
1
,
"versionCode"
:
2
,
"transformPx"
:
false
,
"transformPx"
:
false
,
"app-plus"
:
{
"app-plus"
:
{
/*
5
+App特有相关
*/
/*
5
+App特有相关
*/
...
...
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