call-check-version.js 725 字节
Newer Older
DCloud_JSON's avatar
DCloud_JSON 已提交
1 2 3 4
export default function() {
	// #ifdef APP-PLUS
	return new Promise((resolve, reject) => {
		plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
5 6 7 8 9 10 11
			const data = {
				action: 'checkVersion',
				appid: plus.runtime.appid,
				appVersion: plus.runtime.version,
				wgtVersion: widgetInfo.version
			}
			console.log("data: ",data);
DCloud_JSON's avatar
DCloud_JSON 已提交
12
			uniCloud.callFunction({
13 14
				name: 'uni-upgrade-center',
				data,
DCloud_JSON's avatar
DCloud_JSON 已提交
15
				success: (e) => {
16
					console.log("e: ", e);
DCloud_JSON's avatar
DCloud_JSON 已提交
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
					resolve(e)
				},
				fail: (error) => {
					reject(error)
				}
			})
		})
	})
	// #endif
	// #ifndef APP-PLUS
	return new Promise((resolve, reject) => {
		reject({
			message: '请在App中使用'
		})
	})
	// #endif
33
}