| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 | 
							- <script>
 
- 	import $api from 'static/js/api.js';
 
- 	import $app from 'static/js/app.js';
 
- 	export default {
 
- 		onLaunch: function(options) {
 
- 			console.log('App Launch')
 
- 			// 判断用户是否通过分销码进入------------------------------------------------------
 
- 			if (options.scene === 1011|| options.scene === 1012||options.scene === 1013) {
 
- 				const decodedUrl = decodeURIComponent(options.query.q);
 
- 				const urlParts = decodedUrl.split('?');
 
- 				if (urlParts.length > 1) {
 
- 					const queryParams = urlParts[1];
 
- 					const paramPairs = queryParams.split('&');
 
- 					const resultObj = {};
 
- 					paramPairs.forEach(pair => {
 
- 						const [key, value] = pair.split('=');
 
- 						resultObj[key] = value;
 
- 					});
 
- 					const adminUserId = resultObj['adminUserId'];
 
- 					uni.setStorageSync('ADMIN_USERID', adminUserId);
 
- 					console.info(uni.getStorageSync('ADMIN_USERID'),'---用户通过扫码进入')
 
- 				}
 
- 			}
 
- 		},
 
- 		onShow: function(options) {
 
- 			// 判断用户是否通过分销码进入------------------------------------------------------
 
- 			if (options.scene === 1011||options.scene === 1012||options.scene === 1013) {
 
- 				const decodedUrl = decodeURIComponent(options.query.q);
 
- 				const urlParts = decodedUrl.split('?');
 
- 				if (urlParts.length > 1) {
 
- 					const queryParams = urlParts[1];
 
- 					const paramPairs = queryParams.split('&');
 
- 					const resultObj = {};
 
- 					paramPairs.forEach(pair => {
 
- 						const [key, value] = pair.split('=');
 
- 						resultObj[key] = value;
 
- 					});
 
- 					const adminUserId = resultObj['adminUserId'];
 
- 					uni.setStorageSync('ADMIN_USERID', adminUserId);
 
- 					console.info(uni.getStorageSync('ADMIN_USERID'),'---用户通过扫码进入')
 
- 				}
 
- 			}
 
- 			
 
- 			// 自动更新管理-------------------------------------------------------------------
 
- 			const updateManager = uni.getUpdateManager();
 
- 			updateManager.onUpdateReady(function(res) {
 
- 				uni.showModal({
 
- 					title: '更新提示',
 
- 					content: '新版本已经准备好,是否重启应用?',
 
- 					success(res) {
 
- 						if (res.confirm) updateManager.applyUpdate();
 
- 					}
 
- 				});
 
- 			});
 
- 			updateManager.onUpdateFailed(function(res) {
 
- 				uni.showModal({
 
- 					title: '更新失败',
 
- 					content: '小程序已有新版本,请稍后重试更新!',
 
- 					showCancel: false
 
- 				});
 
- 			});
 
- 			// 自动登录用户-------------------------------------------------------------------
 
- 			const userInfo = $app.storage.get("USER_INFO");
 
- 			if (!userInfo) $api.login();
 
- 		},
 
- 		onHide: function() {
 
- 			console.log('App Hide')
 
- 		}
 
- 	}
 
- </script>
 
- <style>
 
- 	/*每个页面公共css */
 
- 	@import "components/ax/ax.css";
 
- 	@import "static/css/app.css";
 
- </style>
 
 
  |