|  | @@ -9,7 +9,7 @@
 | 
											
												
													
														|  |  		},
 |  |  		},
 | 
											
												
													
														|  |  		onLaunch: function(options) {
 |  |  		onLaunch: function(options) {
 | 
											
												
													
														|  |  			console.log("onLaunch在这里", options)
 |  |  			console.log("onLaunch在这里", options)
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +			this.checkUpdate()
 | 
											
												
													
														|  |  			if (options.query.companyId) {
 |  |  			if (options.query.companyId) {
 | 
											
												
													
														|  |  				uni.setStorageSync('share', options.query)
 |  |  				uni.setStorageSync('share', options.query)
 | 
											
												
													
														|  |  			}
 |  |  			}
 | 
											
										
											
												
													
														|  | @@ -120,7 +120,39 @@
 | 
											
												
													
														|  |  					icon: 'error'
 |  |  					icon: 'error'
 | 
											
												
													
														|  |  				});
 |  |  				});
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -			}
 |  | 
 | 
											
												
													
														|  | 
 |  | +			},
 | 
											
												
													
														|  | 
 |  | +			checkUpdate() {
 | 
											
												
													
														|  | 
 |  | +				const updateManager = uni.getUpdateManager();
 | 
											
												
													
														|  | 
 |  | +				updateManager.onCheckForUpdate(function(res) {
 | 
											
												
													
														|  | 
 |  | +					// 请求完新版本信息的回调
 | 
											
												
													
														|  | 
 |  | +					console.log('是否有新版本:', res.hasUpdate);
 | 
											
												
													
														|  | 
 |  | +				});
 | 
											
												
													
														|  | 
 |  | +			
 | 
											
												
													
														|  | 
 |  | +				updateManager.onUpdateReady(function() {
 | 
											
												
													
														|  | 
 |  | +					uni.showModal({
 | 
											
												
													
														|  | 
 |  | +						title: '更新提示',
 | 
											
												
													
														|  | 
 |  | +						content: '新版本已经准备好,是否重启小程序?',
 | 
											
												
													
														|  | 
 |  | +						confirmText: '立即重启',
 | 
											
												
													
														|  | 
 |  | +						confirmColor: '#2179f5',
 | 
											
												
													
														|  | 
 |  | +						showCancel: false,
 | 
											
												
													
														|  | 
 |  | +						success(res) {
 | 
											
												
													
														|  | 
 |  | +							if (res.confirm) {
 | 
											
												
													
														|  | 
 |  | +								// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
 | 
											
												
													
														|  | 
 |  | +								updateManager.applyUpdate();
 | 
											
												
													
														|  | 
 |  | +							}
 | 
											
												
													
														|  | 
 |  | +						}
 | 
											
												
													
														|  | 
 |  | +					});
 | 
											
												
													
														|  | 
 |  | +				});
 | 
											
												
													
														|  | 
 |  | +			
 | 
											
												
													
														|  | 
 |  | +				updateManager.onUpdateFailed(function() {
 | 
											
												
													
														|  | 
 |  | +					// 新的版本下载失败
 | 
											
												
													
														|  | 
 |  | +					uni.showModal({
 | 
											
												
													
														|  | 
 |  | +						title: '更新提示',
 | 
											
												
													
														|  | 
 |  | +						content: '新版本下载失败,请检查网络后重试。',
 | 
											
												
													
														|  | 
 |  | +						showCancel: false
 | 
											
												
													
														|  | 
 |  | +					});
 | 
											
												
													
														|  | 
 |  | +				});
 | 
											
												
													
														|  | 
 |  | +			},
 | 
											
												
													
														|  |  		}
 |  |  		}
 | 
											
												
													
														|  |  	}
 |  |  	}
 | 
											
												
													
														|  |  </script>
 |  |  </script>
 |