dedsudiyu vor 10 Monaten
Ursprung
Commit
05939bf6f5
1 geänderte Dateien mit 41 neuen und 33 gelöschten Zeilen
  1. 41 33
      pages/views/login/login.vue

+ 41 - 33
pages/views/login/login.vue

@@ -94,45 +94,53 @@
 					data
 				} = await login(obj)
 				if (data.code == 200) {
-					uni.setStorageSync('token', data.data.token);
-					uni.setStorageSync('userId', data.data.userId);
-					// userType 0-系统 1-教职工 2-学生 3-大屏
-					uni.setStorageSync('userType', data.data.userType == 0 || data.data.userType == 1 ? '1' :
-						(data.data.userType == 2 ? '2' : (data.data.userType == 3 ? '3' : 'none')));
-					if (this.checkedType) {
-						uni.setStorageSync('userName', this.username)
-						uni.setStorageSync('password', this.password)
-					} else {
-						uni.removeStorageSync('userName')
-						uni.removeStorageSync('password')
-					}
-					//等待配置与字段获取到后跳转
-					Promise.all([
-						//获取开发配置
-						this.getConfigByType(),
-						//获取权限字段
-						this.systemAppletRolePermission()
-					]).then((result) => {
-						if (uni.getStorageSync('codeData')) {
-							uni.redirectTo({
-								url: '/pages/views/saoCode/saoCode',
-							});
-						} else if (uni.getStorageSync('warningId')) {
-							uni.redirectTo({
-								url: '/pages_basics/views/earlyWarningManage/earlyWarningDetail',
-							});
+					if(data.data.userType == 1 || data.data.userType == 2){
+						uni.setStorageSync('token', data.data.token);
+						uni.setStorageSync('userId', data.data.userId);
+						// userType 0-系统 1-教职工 2-学生 3-大屏
+						uni.setStorageSync('userType', data.data.userType == 0 || data.data.userType == 1 ? '1' :
+							(data.data.userType == 2 ? '2' : (data.data.userType == 3 ? '3' : 'none')));
+						if (this.checkedType) {
+							uni.setStorageSync('userName', this.username)
+							uni.setStorageSync('password', this.password)
 						} else {
-							uni.redirectTo({
-								url: '/pages/views/home/home',
-							});
+							uni.removeStorageSync('userName')
+							uni.removeStorageSync('password')
 						}
-					}).catch((error) => {
+						//等待配置与字段获取到后跳转
+						Promise.all([
+							//获取开发配置
+							this.getConfigByType(),
+							//获取权限字段
+							this.systemAppletRolePermission()
+						]).then((result) => {
+							if (uni.getStorageSync('codeData')) {
+								uni.redirectTo({
+									url: '/pages/views/saoCode/saoCode',
+								});
+							} else if (uni.getStorageSync('warningId')) {
+								uni.redirectTo({
+									url: '/pages_basics/views/earlyWarningManage/earlyWarningDetail',
+								});
+							} else {
+								uni.redirectTo({
+									url: '/pages/views/home/home',
+								});
+							}
+						}).catch((error) => {
+							wx.showToast({
+								title: '数据异常,请稍候再试!',
+								icon: "none",
+								duration: 3000
+							});
+						})
+					}else{
 						wx.showToast({
-							title: '数据异常,请稍候再试!',
+							title: '非教职工/学生账号,无法登录本系统.',
 							icon: "none",
 							duration: 3000
 						});
-					})
+					}
 				}
 			},
 			//获取权限字段