登录功能
This commit is contained in:
		
							parent
							
								
									61b20268dc
								
							
						
					
					
						commit
						1a5234a9f8
					
				| 
						 | 
				
			
			@ -43,7 +43,7 @@
 | 
			
		|||
					作业完成情况
 | 
			
		||||
				</view>
 | 
			
		||||
				<view class="work_msa_top_right">
 | 
			
		||||
					本周 <view class="iconfont icon-arrow-down"></view>
 | 
			
		||||
					本周<!-- <view class="iconfont icon-arrow-down"></view> -->
 | 
			
		||||
				</view>
 | 
			
		||||
			</view>
 | 
			
		||||
			<view class="echarts">
 | 
			
		||||
| 
						 | 
				
			
			@ -56,7 +56,7 @@
 | 
			
		|||
		</div>
 | 
			
		||||
		<view class="class_infobox">
 | 
			
		||||
			<view class="class_info" style="width:80rpx ;">
 | 
			
		||||
				
 | 
			
		||||
 | 
			
		||||
				<view class="class_info_bot">
 | 
			
		||||
					21
 | 
			
		||||
				</view>
 | 
			
		||||
| 
						 | 
				
			
			@ -71,13 +71,13 @@
 | 
			
		|||
				<view class="class_info_top">
 | 
			
		||||
					平均成绩/分
 | 
			
		||||
				</view>
 | 
			
		||||
				
 | 
			
		||||
 | 
			
		||||
			</view>
 | 
			
		||||
			<view class="class_info">
 | 
			
		||||
				
 | 
			
		||||
 | 
			
		||||
				<view class="class_info_bot">
 | 
			
		||||
					80%
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
				</view>
 | 
			
		||||
				<view class="class_info_top">
 | 
			
		||||
					作业正确率
 | 
			
		||||
| 
						 | 
				
			
			@ -107,6 +107,7 @@
 | 
			
		|||
				</view>
 | 
			
		||||
			</view>
 | 
			
		||||
		</div>
 | 
			
		||||
		<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">xxxxxxxxxxxxxxxx</button>
 | 
			
		||||
	</view>
 | 
			
		||||
 | 
			
		||||
</template>
 | 
			
		||||
| 
						 | 
				
			
			@ -123,18 +124,123 @@
 | 
			
		|||
				flag: true
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		onLoad() {
 | 
			
		||||
			this.getUserInfo()
 | 
			
		||||
		},
 | 
			
		||||
		methods: {
 | 
			
		||||
			getPhoneNumber(e) {
 | 
			
		||||
				console.log("eeeeeeee", e)
 | 
			
		||||
				wx.login({
 | 
			
		||||
					success(res) {
 | 
			
		||||
						if (res.code) {
 | 
			
		||||
							console.log('登录!', res)
 | 
			
		||||
 | 
			
		||||
							//发起网络请求
 | 
			
		||||
							wx.request({
 | 
			
		||||
								url: 'https://api.admin-v2.langsi.online/admin-api/system/auth/mini-login',
 | 
			
		||||
								header: {
 | 
			
		||||
									"Tenant-Id": 1
 | 
			
		||||
								},
 | 
			
		||||
								method: "POST",
 | 
			
		||||
								data: {
 | 
			
		||||
									loginCode: res.code,
 | 
			
		||||
									phoneCode: e.detail.code,
 | 
			
		||||
									encryptedData: e.detail.encryptedData,
 | 
			
		||||
									iv: e.detail.iv
 | 
			
		||||
								}
 | 
			
		||||
							})
 | 
			
		||||
 | 
			
		||||
						} else {
 | 
			
		||||
							console.log('登录失败!', res.errMsg)
 | 
			
		||||
						}
 | 
			
		||||
					},
 | 
			
		||||
					fail(err) {
 | 
			
		||||
						console.log(err)
 | 
			
		||||
					}
 | 
			
		||||
				})
 | 
			
		||||
			},
 | 
			
		||||
			getUserInfo(e) {
 | 
			
		||||
				wx.login({
 | 
			
		||||
					success(res) {
 | 
			
		||||
						if (res.code) {
 | 
			
		||||
							console.log('登录!', res)
 | 
			
		||||
 | 
			
		||||
							wx.getUserInfo({
 | 
			
		||||
								success(rrr) {
 | 
			
		||||
									console.log("xxxxx", rrr)
 | 
			
		||||
 | 
			
		||||
									//发起网络请求
 | 
			
		||||
									wx.request({
 | 
			
		||||
										url: 'https://api.admin-v2.langsi.online/admin-api/system/auth/mini-login',
 | 
			
		||||
										header: {
 | 
			
		||||
											"Tenant-Id": 1
 | 
			
		||||
										},
 | 
			
		||||
										method: "POST",
 | 
			
		||||
										data: {
 | 
			
		||||
											loginCode: res.code,
 | 
			
		||||
											encryptedData: rrr.encryptedData,
 | 
			
		||||
											iv: rrr.iv
 | 
			
		||||
										}
 | 
			
		||||
									})
 | 
			
		||||
 | 
			
		||||
								}
 | 
			
		||||
							})
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
						} else {
 | 
			
		||||
							console.log('登录失败!', res.errMsg)
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				})
 | 
			
		||||
			},
 | 
			
		||||
			// async userlogin() {
 | 
			
		||||
			// 	let code = await this.wxLogin();
 | 
			
		||||
			// 	console.log(code);
 | 
			
		||||
			// 	let data={
 | 
			
		||||
			// 		loginCode:code
 | 
			
		||||
			// 	}
 | 
			
		||||
			// 	this.$u.post('https://api.admin-v2.langsi.online/admin-api/system/auth/mini-login',data).then(res => {
 | 
			
		||||
			// 		if (res.code == 10003) {
 | 
			
		||||
			// 			// console.log("新用户登录")
 | 
			
		||||
			// 			uni.setStorageSync('token','Bearer '+ res.data);
 | 
			
		||||
			// 			this.getuser()
 | 
			
		||||
			// 		} else if (res.code == 200) {
 | 
			
		||||
			// 			console.log("老用户登录", res.data)
 | 
			
		||||
			// 			uni.setStorageSync('token','Bearer '+ res.data);
 | 
			
		||||
			// 			this.isLogin = true
 | 
			
		||||
			// 			this.getuser()
 | 
			
		||||
			// 		} else if (res.code == 30003) {
 | 
			
		||||
			// 			this.userlogin()
 | 
			
		||||
			// 		}
 | 
			
		||||
			// 	})
 | 
			
		||||
			// 	uni.hideLoading();
 | 
			
		||||
			// },
 | 
			
		||||
			// 获取个人信息
 | 
			
		||||
			async getuser() {
 | 
			
		||||
				await this.$u.get('/app-api/user/info').then(res => {
 | 
			
		||||
					if (res.code == 200) {
 | 
			
		||||
						if (res.data.headImgUrl == "") {
 | 
			
		||||
							this.userlogin()
 | 
			
		||||
						}
 | 
			
		||||
						this.userInfo = res.data
 | 
			
		||||
						// this.getstatistics()
 | 
			
		||||
					} else {
 | 
			
		||||
						this.userlogin()
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
				})
 | 
			
		||||
			},
 | 
			
		||||
			async initChart() {
 | 
			
		||||
				let _this = this
 | 
			
		||||
 | 
			
		||||
				const option = {
 | 
			
		||||
					 grid: {
 | 
			
		||||
					          left: 0,
 | 
			
		||||
					          right: 0,
 | 
			
		||||
					          top: 10,
 | 
			
		||||
					          bottom: 0,
 | 
			
		||||
					          containLabel: true,
 | 
			
		||||
					        },
 | 
			
		||||
					grid: {
 | 
			
		||||
						left: 0,
 | 
			
		||||
						right: 0,
 | 
			
		||||
						top: 10,
 | 
			
		||||
						bottom: 0,
 | 
			
		||||
						containLabel: true,
 | 
			
		||||
					},
 | 
			
		||||
					xAxis: {
 | 
			
		||||
						type: 'category',
 | 
			
		||||
						data: ['Mon', '', 'Wed', '', 'Fri', '', 'Sun']
 | 
			
		||||
| 
						 | 
				
			
			@ -177,18 +283,21 @@
 | 
			
		|||
 | 
			
		||||
	.view_by {
 | 
			
		||||
		padding: 0 32rpx;
 | 
			
		||||
		.noinfo{
 | 
			
		||||
 | 
			
		||||
		.noinfo {
 | 
			
		||||
			margin-top: 62rpx;
 | 
			
		||||
			margin-left: 186rpx;
 | 
			
		||||
			display: flex;
 | 
			
		||||
			flex-wrap: wrap;
 | 
			
		||||
			.noinfo_tit{
 | 
			
		||||
 | 
			
		||||
			.noinfo_tit {
 | 
			
		||||
				font-size: 28rpx;
 | 
			
		||||
				font-family: 'PingFang', 'PingFang';
 | 
			
		||||
				font-weight: 500;
 | 
			
		||||
				color: #627698;
 | 
			
		||||
			}
 | 
			
		||||
			.noinfo_btn{
 | 
			
		||||
 | 
			
		||||
			.noinfo_btn {
 | 
			
		||||
				margin-top: 18rpx;
 | 
			
		||||
				display: flex;
 | 
			
		||||
				flex-wrap: nowrap;
 | 
			
		||||
| 
						 | 
				
			
			@ -202,13 +311,15 @@
 | 
			
		|||
				font-family: 'PingFang', 'PingFang';
 | 
			
		||||
				font-weight: 500;
 | 
			
		||||
				color: #FFFFFF;
 | 
			
		||||
				image{
 | 
			
		||||
 | 
			
		||||
				image {
 | 
			
		||||
					margin-left: 8rpx;
 | 
			
		||||
					width: 16rpx;
 | 
			
		||||
					height: 16rpx;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		.top_message {
 | 
			
		||||
 | 
			
		||||
			display: flex;
 | 
			
		||||
| 
						 | 
				
			
			@ -280,13 +391,15 @@
 | 
			
		|||
			height: 459rpx;
 | 
			
		||||
			background: #FFFFFF;
 | 
			
		||||
			border-radius: 20rpx 20rpx 20rpx 20rpx;
 | 
			
		||||
			.work_img{
 | 
			
		||||
 | 
			
		||||
			.work_img {
 | 
			
		||||
				position: absolute;
 | 
			
		||||
				left: 22rpx;
 | 
			
		||||
				top: -190rpx;
 | 
			
		||||
				height:190rpx ;
 | 
			
		||||
				height: 190rpx;
 | 
			
		||||
				width: 145.28rpx;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			.work_msa_top {
 | 
			
		||||
				display: flex;
 | 
			
		||||
				flex-wrap: nowrap;
 | 
			
		||||
| 
						 | 
				
			
			@ -323,7 +436,8 @@
 | 
			
		|||
			width: 622rpx;
 | 
			
		||||
			height: 350rpx;
 | 
			
		||||
		}
 | 
			
		||||
		.data{
 | 
			
		||||
 | 
			
		||||
		.data {
 | 
			
		||||
			display: flex;
 | 
			
		||||
			flex-wrap: nowrap;
 | 
			
		||||
			align-items: center;
 | 
			
		||||
| 
						 | 
				
			
			@ -332,13 +446,14 @@
 | 
			
		|||
			font-family: 'PingFang', 'PingFang';
 | 
			
		||||
			font-weight: 800;
 | 
			
		||||
			color: #2E4975;
 | 
			
		||||
			
 | 
			
		||||
 | 
			
		||||
			.icon-arrow-down {
 | 
			
		||||
				color: #2E4975 ;
 | 
			
		||||
				color: #2E4975;
 | 
			
		||||
				margin-left: 8rpx;
 | 
			
		||||
				font-size: 24rpx;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		.class_infobox {
 | 
			
		||||
			margin-top: 20rpx;
 | 
			
		||||
			display: flex;
 | 
			
		||||
| 
						 | 
				
			
			@ -347,15 +462,15 @@
 | 
			
		|||
			justify-content: space-around;
 | 
			
		||||
			width: 686rpx;
 | 
			
		||||
			height: 128rpx;
 | 
			
		||||
			background: linear-gradient(179deg, rgba(255,237,223,0.65) 0%, #FFFFFF 100%);
 | 
			
		||||
			background: linear-gradient(179deg, rgba(255, 237, 223, 0.65) 0%, #FFFFFF 100%);
 | 
			
		||||
			border-radius: 20rpx 20rpx 20rpx 20rpx;
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
			.class_info {
 | 
			
		||||
				width: 110rpx;
 | 
			
		||||
				display: flex;
 | 
			
		||||
				flex-wrap: wrap;
 | 
			
		||||
				justify-content: center;
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
				.class_info_top {
 | 
			
		||||
					margin-top: 12rpx;
 | 
			
		||||
					font-size: 20rpx;
 | 
			
		||||
| 
						 | 
				
			
			@ -363,9 +478,9 @@
 | 
			
		|||
					font-weight: 500;
 | 
			
		||||
					color: rgba(7, 47, 90, 0.5);
 | 
			
		||||
				}
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
				.class_info_bot {
 | 
			
		||||
					
 | 
			
		||||
 | 
			
		||||
					font-size: 28rpx;
 | 
			
		||||
					font-family: 'PingFang', 'PingFang';
 | 
			
		||||
					font-weight: 800;
 | 
			
		||||
| 
						 | 
				
			
			@ -373,7 +488,8 @@
 | 
			
		|||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		.card{
 | 
			
		||||
 | 
			
		||||
		.card {
 | 
			
		||||
			display: flex;
 | 
			
		||||
			justify-content: space-between;
 | 
			
		||||
			align-items: center;
 | 
			
		||||
| 
						 | 
				
			
			@ -383,47 +499,54 @@
 | 
			
		|||
			height: 124rpx;
 | 
			
		||||
			background: #FFFFFF;
 | 
			
		||||
			border-radius: 20rpx 20rpx 20rpx 20rpx;
 | 
			
		||||
			.card_left{
 | 
			
		||||
 | 
			
		||||
			.card_left {
 | 
			
		||||
				display: flex;
 | 
			
		||||
				flex-wrap: nowrap;
 | 
			
		||||
				.stu_img{
 | 
			
		||||
 | 
			
		||||
				.stu_img {
 | 
			
		||||
					width: 76rpx;
 | 
			
		||||
					height: 76rpx;
 | 
			
		||||
					border-radius: 50%;
 | 
			
		||||
				}
 | 
			
		||||
				.stu_info{
 | 
			
		||||
 | 
			
		||||
				.stu_info {
 | 
			
		||||
					margin-left: 16rpx;
 | 
			
		||||
					.stu_info_top{
 | 
			
		||||
 | 
			
		||||
					.stu_info_top {
 | 
			
		||||
						font-size: 28rpx;
 | 
			
		||||
						font-family: 'PingFang', 'PingFang';
 | 
			
		||||
						font-weight: bold;
 | 
			
		||||
						color: #072F5A;
 | 
			
		||||
					}
 | 
			
		||||
					.stu_info_bot{
 | 
			
		||||
 | 
			
		||||
					.stu_info_bot {
 | 
			
		||||
						margin-top: 4rpx;
 | 
			
		||||
						font-size: 20rpx;
 | 
			
		||||
						font-family: 'PingFang', 'PingFang';
 | 
			
		||||
						font-weight: 500;
 | 
			
		||||
						color: rgba(46,73,117,0.5);
 | 
			
		||||
						color: rgba(46, 73, 117, 0.5);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			.card_right{
 | 
			
		||||
				
 | 
			
		||||
				.card_right_top{
 | 
			
		||||
 | 
			
		||||
			.card_right {
 | 
			
		||||
 | 
			
		||||
				.card_right_top {
 | 
			
		||||
					text-align: right;
 | 
			
		||||
					font-size: 20rpx;
 | 
			
		||||
					font-family: 'PingFang', 'PingFang';
 | 
			
		||||
					font-weight: 500;
 | 
			
		||||
					color: #F18F21;
 | 
			
		||||
				}
 | 
			
		||||
				.card_right_bot{
 | 
			
		||||
 | 
			
		||||
				.card_right_bot {
 | 
			
		||||
					margin-top: 4rpx;
 | 
			
		||||
					text-align: right;
 | 
			
		||||
					font-size: 20rpx;
 | 
			
		||||
					font-family: 'PingFang', 'PingFang';
 | 
			
		||||
					font-weight: 500;
 | 
			
		||||
					color: rgba(7,47,90,0.4);
 | 
			
		||||
					color: rgba(7, 47, 90, 0.4);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user