feat:系统更新
This commit is contained in:
@@ -10,21 +10,27 @@ export default function () {
|
||||
uni.request({
|
||||
url:
|
||||
getUpgradeBaseUrl() +
|
||||
'/api/sys/app-client-version/latestVersionUniapp?clientId=' +
|
||||
appId +
|
||||
'&platform=' +
|
||||
osName +
|
||||
'&tenantId=' +
|
||||
getTenantId(),
|
||||
'/qms/version-management/checkUpdate?' +
|
||||
'applicationCode=ytgg_lims' +
|
||||
'&updatePlatform=android',
|
||||
method: 'GET',
|
||||
success: res => {
|
||||
if (res.data && res.data.result) {
|
||||
res.data.result.localVersion = plus.runtime.version
|
||||
res.data.result.localWgtVersion = widgetInfo.version
|
||||
res.data.result.url = getUpgradeBaseUrl() + res.data.result.url
|
||||
console.log(res)
|
||||
|
||||
const data = res.data.data
|
||||
if (data) {
|
||||
data.localVersion = plus.runtime.version
|
||||
data.localWgtVersion = widgetInfo.version
|
||||
data.version = data.currentVersion
|
||||
data.url = data.downloadUrl
|
||||
data.type = data.updateType
|
||||
data.platform = data.updatePlatform
|
||||
data.is_silently = data.silenceFlag == '1'
|
||||
data.is_mandatory = data.mustFlag == '1'
|
||||
data.contents = data.updateContent
|
||||
}
|
||||
console.log('更新信息:', res.data)
|
||||
resolve(res.data)
|
||||
console.log('更新信息:', data)
|
||||
resolve(data)
|
||||
},
|
||||
fail: err => {
|
||||
reject(error)
|
||||
|
||||
@@ -7,7 +7,7 @@ export default function(isShowNoUpdateToast = false) {
|
||||
// #ifdef APP-PLUS
|
||||
return new Promise((resolve, reject) => {
|
||||
callCheckVersion().then(async (e) => {
|
||||
if (!e.result) return;
|
||||
if (!e) return;
|
||||
const {
|
||||
code,
|
||||
message,
|
||||
@@ -15,10 +15,10 @@ export default function(isShowNoUpdateToast = false) {
|
||||
url, // 安装包下载地址
|
||||
platform, // 安装包平台
|
||||
type // 安装包类型
|
||||
} = e.result;
|
||||
} = e;
|
||||
|
||||
// 此处逻辑仅为实例,可自行编写
|
||||
if (code > 0 && isUpdate(e.result)) {
|
||||
if ( isUpdate(e)) {
|
||||
console.log("更新逻辑。。。")
|
||||
// 腾讯云和阿里云下载链接不同,需要处理一下,阿里云会原样返回
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ export default function(isShowNoUpdateToast = false) {
|
||||
* 提示升级二
|
||||
* 官方适配的升级弹窗,可自行替换资源适配UI风格
|
||||
*/
|
||||
uni.setStorageSync(PACKAGE_INFO_KEY, e.result)
|
||||
uni.setStorageSync(PACKAGE_INFO_KEY, e)
|
||||
uni.navigateTo({
|
||||
url: `/pages/setting/upgrade-popup?local_storage_key=${PACKAGE_INFO_KEY}`,
|
||||
fail: (err) => {
|
||||
|
||||
Reference in New Issue
Block a user