1
This commit is contained in:
62
nx/utils/call-check-version.js
Normal file
62
nx/utils/call-check-version.js
Normal file
@@ -0,0 +1,62 @@
|
||||
import { getUpgradeBaseUrl, getTenantId, clientId } from '@/defaultBaseUrl'
|
||||
|
||||
export default function () {
|
||||
// #ifdef APP-PLUS
|
||||
return new Promise((resolve, reject) => {
|
||||
plus.runtime.getProperty(plus.runtime.appid, function (widgetInfo) {
|
||||
const osName = plus.os.name
|
||||
let appId = plus.runtime.appid
|
||||
appId = clientId
|
||||
uni.request({
|
||||
url:
|
||||
getUpgradeBaseUrl() +
|
||||
'/api/sys/app-client-version/latestVersionUniapp?clientId=' +
|
||||
appId +
|
||||
'&platform=' +
|
||||
osName +
|
||||
'&tenantId=' +
|
||||
getTenantId(),
|
||||
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.data)
|
||||
resolve(res.data)
|
||||
},
|
||||
fail: err => {
|
||||
reject(error)
|
||||
}
|
||||
})
|
||||
// uni.request(options).then(res => {
|
||||
// resolve(res)
|
||||
// }).catch(err => {
|
||||
// reject(error)
|
||||
// });
|
||||
// uniCloud.callFunction({
|
||||
// name: 'check-version',
|
||||
// data: {
|
||||
// appid: plus.runtime.appid,
|
||||
// appVersion: plus.runtime.version,
|
||||
// wgtVersion: widgetInfo.version
|
||||
// },
|
||||
// success: (e) => {
|
||||
// resolve(e)
|
||||
// },
|
||||
// fail: (error) => {
|
||||
// reject(error)
|
||||
// }
|
||||
// })
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
// #ifndef APP-PLUS
|
||||
return new Promise((resolve, reject) => {
|
||||
reject({
|
||||
message: '请在App中使用'
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
}
|
||||
Reference in New Issue
Block a user