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