| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 | 
							- <script>
 
- 	import Vue from 'vue'
 
- 	// import TIM from 'tim-wx-sdk';
 
- 	// import COS from 'cos-wx-sdk-v5';
 
- 	export default {
 
- 		globalData: {
 
- 			wsUrl: 'wss://websocket.cdwjyyh.com',
 
- 			appId: 'wx503cf8ab31f83dd4'
 
- 		},
 
- 		onLaunch: function(options) {
 
- 			console.log("onLaunch在这里", options)
 
- 			this.checkUpdate()
 
- 			if (options.query.companyId) {
 
- 				uni.setStorageSync('share', options.query)
 
- 			}
 
- 			if (options.query.scene) {
 
- 				uni.setStorageSync('scene', options.query.scene)
 
- 			}
 
- 			// uni.$TUIKit = TIM.create({
 
- 			// 	SDKAppID: 1400693126
 
- 			// });
 
- 			// uni.$TUIKit.registerPlugin({
 
- 			// 	'cos-wx-sdk': COS
 
- 			// });
 
- 			// uni.$TUIKitTIM = TIM;
 
- 			// uni.$TUIKitEvent = TIM.EVENT;
 
- 			// uni.$TUIKitVersion = TIM.VERSION;
 
- 			// uni.$TUIKitTypes = TIM.TYPES; // 监听系统级事件
 
- 			// uni.$resetLoginData = this.resetLoginData();
 
- 			// uni.$TUIKit.on(uni.$TUIKitEvent.SDK_READY, this.onSDKReady);
 
- 			// uni.$TUIKit.on(uni.$TUIKitEvent.SDK_NOT_READY, this.onSdkNotReady);
 
- 			// uni.$TUIKit.on(uni.$TUIKitEvent.KICKED_OUT, this.onKickedOut);
 
- 			// uni.$TUIKit.on(uni.$TUIKitEvent.ERROR, this.onTIMError);
 
- 			// uni.$TUIKit.on(uni.$TUIKitEvent.NET_STATE_CHANGE, this.onNetStateChange);
 
- 			// uni.$TUIKit.on(uni.$TUIKitEvent.SDK_RELOAD, this.onSDKReload);
 
- 			console.log('IM')
 
- 		},
 
- 		onShow: function() {
 
- 			console.log('App Show')
 
- 			uni.getSystemInfo({
 
- 				success: (result) => {
 
- 					// 获取手机系统的状态栏高度(不同手机的状态栏高度不同)
 
- 					// console.log('当前手机的状态栏高度',result.statusBarHeight)
 
- 					let statusBarHeight = result.statusBarHeight + 'px'
 
- 					// 获取右侧胶囊的信息 单位px
 
- 					//#ifndef H5 || APP-PLUS
 
- 					const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
 
- 					//bottom: 胶囊底部距离屏幕顶部的距离
 
- 					//height: 胶囊高度
 
- 					//left:   胶囊左侧距离屏幕左侧的距离
 
- 					//right:  胶囊右侧距离屏幕左侧的距离
 
- 					//top:    胶囊顶部距离屏幕顶部的距离
 
- 					//width:  胶囊宽度
 
- 					// console.log(menuButtonInfo.width, menuButtonInfo.height, menuButtonInfo.top)
 
- 					// console.log('计算胶囊右侧距离屏幕右边距离', result.screenWidth - menuButtonInfo.right)
 
- 					let menuWidth = menuButtonInfo.width + 'px'
 
- 					let menuHeight = menuButtonInfo.height + 'px'
 
- 					let menuBorderRadius = menuButtonInfo.height / 2 + 'px'
 
- 					let menuRight = result.screenWidth - menuButtonInfo.right + 'px'
 
- 					let menuTop = menuButtonInfo.top + 'px'
 
- 					let contentTop = result.statusBarHeight + 44 + 'px'
 
- 					let menuInfo = {
 
- 						statusBarHeight: statusBarHeight, //状态栏高度----用来给自定义导航条页面的顶部导航条设计padding-top使用:目的留出系统的状态栏区域
 
- 						menuWidth: menuWidth, //右侧的胶囊宽度--用来给自定义导航条页面的左侧胶囊设置使用
 
- 						menuHeight: menuHeight, //右侧的胶囊高度--用来给自定义导航条页面的左侧胶囊设置使用
 
- 						menuBorderRadius: menuBorderRadius, //一半的圆角--用来给自定义导航条页面的左侧胶囊设置使用
 
- 						menuRight: menuRight, //右侧的胶囊距离右侧屏幕距离--用来给自定义导航条页面的左侧胶囊设置使用
 
- 						menuTop: menuTop, //右侧的胶囊顶部距离屏幕顶部的距离--用来给自定义导航条页面的左侧胶囊设置使用
 
- 						contentTop: contentTop, //内容区距离页面最上方的高度--用来给自定义导航条页面的内容区定位距离使用
 
- 					}
 
- 					uni.setStorageSync('menuInfo', menuInfo)
 
- 					//#endif
 
- 				},
 
- 				fail: (error) => {
 
- 					console.log(error)
 
- 				}
 
- 			})
 
- 		},
 
- 		onHide: function() {
 
- 			console.log('App Hide')
 
- 		},
 
- 		methods: {
 
- 			// TODO:
 
- 			resetLoginData() {
 
- 				// this.globalData.expiresIn = '';
 
- 				// this.globalData.sessionID = '';
 
- 				// this.globalData.userInfo = {
 
- 				// 	userID: '',
 
- 				// 	userSig: '',
 
- 				// 	token: '',
 
- 				// 	phone: ''
 
- 				// };
 
- 				// this.globalData.userProfile = null;
 
- 				// logger.log(`| app |  resetLoginData | globalData: ${this.globalData}`);
 
- 			},
 
- 			onTIMError() {},
 
- 			onSDKReady({
 
- 				name
 
- 			}) {
 
- 				console.log("im注册:" + name)
 
- 				const isSDKReady = name === uni.$TUIKitEvent.SDK_READY ? true : false
 
- 				console.log("im注册:" + isSDKReady)
 
- 				uni.$emit('isSDKReady', {
 
- 					isSDKReady: true
 
- 				});
 
- 			},
 
- 			onNetStateChange() {},
 
- 			onSDKReload() {},
 
- 			onSdkNotReady() {},
 
- 			onKickedOut() {
 
- 				uni.showToast({
 
- 					title: '您被踢下线',
 
- 					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>
 
- <style lang="scss">
 
- 	/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
 
- 	@import "@/uni_modules/uview-ui/index.scss";
 
- 	@import '@/assets/css/commonTheme.css';
 
- 	@import '@/assets/css/common.scss';
 
- </style>
 
- <style lang="less">
 
- 	/*每个页面公共css */
 
- 	// @import 'animate.css';
 
- 	@import './assets/iconfont/iconfont.css';
 
- 	@import './assets/css/common.less';
 
- 	page {
 
- 		background-color: #f6f6f6;
 
- 	}
 
- 	::-webkit-scrollbar {
 
- 		width: 0 !important;
 
- 		height: 0 !important;
 
- 	}
 
- </style>
 
- <style>
 
- 	/*每个页面公共css */
 
- 	/* 解决小程序和app滚动条的问题 */
 
- 	/* #ifdef MP-WEIXIN || APP-PLUS */
 
- 	::v-deep ::-webkit-scrollbar {
 
- 		display: none !important;
 
- 		width: 0 !important;
 
- 		height: 0 !important;
 
- 		-webkit-appearance: none;
 
- 		background: transparent;
 
- 		color: transparent;
 
- 	}
 
- 	/* #endif */
 
- 	/* 解决H5 的问题 */
 
- 	/* #ifdef H5 */
 
- 	uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
 
- 		/* 隐藏滚动条,但依旧具备可以滚动的功能 */
 
- 		display: none;
 
- 		width: 0 !important;
 
- 		height: 0 !important;
 
- 		-webkit-appearance: none;
 
- 		background: transparent;
 
- 		color: transparent;
 
- 	}
 
- 	/* #endif */
 
- </style>
 
 
  |