| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 | 
							- <style lang="scss">
 
- 	/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
 
- 	@import "uview-ui/index.scss";
 
- </style>
 
- <script>
 
- 	import Vue from 'vue'
 
- 	// import app from './utils/api.js'
 
- 	export default {
 
- 		onLaunch() {
 
- 			// 获取未读信息
 
- 			// this.getAllMessage()
 
- 			// 微信登录
 
- 			wx.login({
 
- 				success({
 
- 					code
 
- 				}) {
 
- 					// console.log('code', code);
 
- 					uni.request({
 
- 						url:'https://teacherapi.cocorobo.cn/api/pbl/weChatCode',
 
- 						// url: 'http://localhost:7333/api/pbl/weChatCode', //接口地址:前缀+方法中传入的地址
 
- 						method: 'GET',
 
- 						data: {
 
- 							codes: code
 
- 						}
 
- 					}).then(res => {
 
- 						// console.log('微信登录',res);
 
- 						uni.setStorageSync('oId', res.data)
 
- 						// uni.getStorageSync('oId')
 
- 					})
 
- 				}
 
- 			})
 
- 			// 获取设备信息
 
- 			uni.getSystemInfo({
 
- 				success: function(res) {
 
- 					Vue.prototype.screenHeight = res.screenHeight
 
- 					Vue.prototype.screenWidth = res.screenWidth
 
- 					// console.log(res);
 
- 					const tabBarHeight = res.screenHeight - res.windowHeight;
 
- 					Vue.prototype.tabBarHeight = tabBarHeight
 
- 					if (uni.getMenuButtonBoundingClientRect()) {
 
- 						console.log('小程序');
 
- 						// 小程序状态栏是指显示电量的那一小部分
 
- 						thisWechat(res.statusBarHeight)
 
- 					} else {
 
- 						console.log('app');
 
- 						thisApp(res.statusBarHeight)
 
- 					}
 
- 				}
 
- 			});
 
- 			// 微信
 
- 			function thisWechat(statusBarHeight) {
 
- 				// 获取胶囊位置
 
- 				let meunButtonInfo = uni.getMenuButtonBoundingClientRect()
 
- 				// console.log(meunButtonInfo);
 
- 				Vue.prototype.meunButtonInfo = meunButtonInfo.height
 
- 				// 计算出导航栏高度+动态栏
 
- 				let allHeight = meunButtonInfo.bottom + (meunButtonInfo.top - statusBarHeight) * 2;
 
- 				// console.log(allHeight);
 
- 				let navheight;
 
- 				Vue.prototype.navheight = allHeight
 
- 				// 按钮离顶
 
- 				let alltop = meunButtonInfo.top
 
- 				Vue.prototype.navTop = alltop
 
- 				// 动态栏高度
 
- 				let statusHeight
 
- 				Vue.prototype.statusHeight = statusBarHeight
 
- 			};
 
- 			// 这个app的
 
- 			function thisApp(statusBarHeight) {
 
- 				// console.log(uni.getSystemInfoSync());
 
- 				// 导航栏高度
 
- 				let customBarHeight;
 
- 				if (uni.getSystemInfoSync().platform === 'android') {
 
- 					customBarHeight = statusBarHeight + 50;
 
- 				} else if (uni.getSystemInfoSync().platform === 'ios') {
 
- 					// iOS 平台
 
- 					// 在这里根据 iOS 平台的特性计算自定义状态栏高度
 
- 					// ...
 
- 					customBarHeight = statusBarHeight + 45;
 
- 				} else {
 
- 					// 其他平台
 
- 					// ...
 
- 					customBarHeight = statusBarHeight;
 
- 				}
 
- 				// console.log(customBarHeight);
 
- 				Vue.prototype.customBar = customBarHeight;
 
- 			}
 
- 		},
 
- 		onShow() {
 
- 		},
 
- 		methods: {
 
- 			// 获取未读信息
 
- 			getAllMessage() {
 
- 				this.$request('/selectAllMessage', "POST", {
 
- 					oid: this.$store.state.user.openid
 
- 				}).then(res => {
 
- 					console.log('获取未读信息',res[0][0].msg);
 
- 					let num = res[0][0].msg
 
- 		
 
- 					if (num == 0) {
 
- 						uni.hideTabBarRedDot({
 
- 							index: 3
 
- 						})
 
- 					} else {
 
- 						Vue.prototype.msgnum = num
 
- 						uni.setTabBarBadge({
 
- 							index: 3,
 
- 							text: num.toString()
 
- 						})
 
- 					}
 
- 				})
 
- 			}
 
- 		},
 
- 		onLoad() {
 
- 		}
 
- 	}
 
- </script>
 
- <style lang="scss">
 
- 	/*每个页面公共css */
 
- 	body,
 
- 	html {
 
- 		background-color: #f0f2f5;
 
- 		/* font-family: PingFang SC; */
 
- 		height: 100vh;
 
- 		width: 750rpx;
 
- 	}
 
- 	
 
- 	view {
 
- 		box-sizing: border-box;
 
- 		padding: 0;
 
- 	}
 
- 	
 
- 	
 
- 	/* 确认弹窗 */
 
- 	.mask { //弹窗背景色
 
- 		position: fixed;
 
- 		top: 0;
 
- 		left: 0;
 
- 		width: 100%;
 
- 		height: 100%;
 
- 		background-color: rgba(0, 0, 0, 0.3);
 
- 		z-index: 999;
 
- 		overflow: hidden;
 
- 		// display: none;
 
- 	}
 
- 	.popup-container {
 
- 		position: fixed;
 
- 		top: 50%;
 
- 		left: 50%;
 
- 		transform: translate(-50%, -50%);
 
- 		width: 520rpx;
 
- 		height: 260rpx;
 
- 		z-index: 1000;
 
- 		border-radius: 16rpx;
 
- 		overflow: hidden;
 
- 		.popup {
 
- 			width: 100%;
 
- 			height: 100%;
 
- 			display: flex;
 
- 			flex-direction: column;
 
- 			background-color: #fff;
 
- 			border-radius: 16rpx;
 
- 			overflow: hidden;
 
- 	
 
- 			.header {
 
- 				flex: 1;
 
- 				display: flex;
 
- 				justify-content: center;
 
- 				align-items: center;
 
- 				flex-direction: column;
 
- 				margin-top: 24px;
 
- 				font-size: 34rpx;
 
- 				font-weight: 600;
 
- 	
 
- 				image {
 
- 					width: 150rpx;
 
- 					height: 150rpx;
 
- 					margin-top: 15px;
 
- 					margin-bottom: 15px;
 
- 				}
 
- 			}
 
- 	
 
- 			.footer {
 
- 				width: 100%;
 
- 				display: flex;
 
- 				overflow: hidden;
 
- 	
 
- 				.cancel-btn {
 
- 					width: 50%;
 
- 					height: 100rpx;
 
- 					background-color: #F7F7F7;
 
- 					color: #000;
 
- 					font-size: 34rpx;
 
- 					text-align: center;
 
- 					border-bottom-left-radius: 16rpx;
 
- 					line-height: 50px;
 
- 				}
 
- 	
 
- 				.confirm-btn {
 
- 					width: 50%;
 
- 					height: 100rpx;
 
- 					background-color: #0081FE;
 
- 					color: #fff;
 
- 					font-size: 34rpx;
 
- 					text-align: center;
 
- 					line-height: 50px;
 
- 				}
 
- 			}
 
- 		}
 
- 	}
 
- 	/* 触底加载更多 */
 
- 	.loading {
 
- 		height: 30rpx;
 
- 		text-align: center;
 
- 		padding-top: 20rpx;
 
- 		padding-bottom: 100rpx;
 
- 		font-size: 26rpx;
 
- 		color: #888;
 
- 		line-height: 2em;
 
- 	}
 
- 	/* 公共字体大小类 */
 
- 	.one-font {
 
- 		font-size: 48rpx;
 
- 		line-height: 72rpx;
 
- 		font-weight: 600;
 
- 	}
 
- 	.two-font {
 
- 		font-size: 40rpx;
 
- 		line-height: 56rpx;
 
- 	}
 
- 	.twoZ-font {
 
- 		font-size: 40rpx;
 
- 		line-height: 56rpx;
 
- 		font-weight: 500;
 
- 	}
 
- 	.three-font {
 
- 		font-size: 34rpx;
 
- 		line-height: 48rpx;
 
- 		font-weight: 500;
 
- 	}
 
- 	.num-font {
 
- 		font-size: 36rpx;
 
- 		line-height: 56rpx;
 
- 		font-weight: 700;
 
- 	}
 
- 	.bmTit-font {
 
- 		font-size: 36rpx;
 
- 		line-height: 44rpx;
 
- 		font-weight: 500;
 
- 	}
 
- 	.fNum-font {
 
- 		font-size: 44rpx;
 
- 		line-height: 56rpx;
 
- 		font-weight: 700;
 
- 	}
 
- 	.zw-font {
 
- 		font-size: 34rpx;
 
- 		line-height: 48rpx;
 
- 	}
 
- 	.btn-font {
 
- 		font-size: 28rpx;
 
- 		line-height: 40rpx;
 
- 		font-weight: 600;
 
- 	}
 
- 	.fwb-font {
 
- 		font-size: 28rpx;
 
- 		line-height: 40rpx;
 
- 		font-size: 400;
 
- 	}
 
- 	.sZw-font {
 
- 		font-size: 26rpx;
 
- 		line-height: 42rpx;
 
- 		font-size: 400;
 
- 	}
 
- 	.sBtn-font {
 
- 		font-size: 24rpx;
 
- 		line-height: 32rpx;
 
- 		font-weight: 600;
 
- 	}
 
- 	.fz-font {
 
- 		font-size: 24rpx;
 
- 		line-height: 32rpx;
 
- 		font-weight: 400;
 
- 	}
 
- 	.bq-font {
 
- 		font-size: 20rpx;
 
- 		line-height: 24rpx;
 
- 	}
 
- 	.bqZ-font {
 
- 		font-size: 20rpx;
 
- 		line-height: 24rpx;
 
- 		font-weight: 600;
 
- 	}
 
- </style>
 
 
  |