js 代码

	// #ifdef APP-PLUS
			let version = ''
			let versionCode = ''
			plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
				version = wgtinfo.version
				versionCode = wgtinfo.versionCode
				console.log(version, versionCode)
			})
			setTimeout(() => {
				appVersion({
						appName: uni.getSystemInfoSync().platform
					})
					.then(res => {
						const data = res.data
						if(data.version> versionCode){
							// 	//有新版本
								uni.showModal({
									title: '发现新版本 ' + data.versionName,
									content:data.versionInfo,
									cancelText: '稍后更新',
									cancelColor: '#999999',
									confirmText: '立即下载',
									confirmColor: '#18B097',
									success: (ress) => {
										if (ress.confirm) {
											plus.runtime.openURL(data.downloadUrl)
										}
									}
								})
						}
						
					})
			
			}, 3000)
			// #endif
	
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36