소스 검색

添加外部登录识别,适配横店项目

xieyunhui 3 년 전
부모
커밋
2567d1a7a3
12개의 변경된 파일148개의 추가작업 그리고 55개의 파일을 삭제
  1. BIN
      .DS_Store
  2. 47 10
      App.vue
  3. BIN
      components/.DS_Store
  4. BIN
      pages/.DS_Store
  5. 3 34
      pages/login/login.vue
  6. 18 4
      pages/mission-action/components/assign-mission.vue
  7. BIN
      static/.DS_Store
  8. BIN
      uni_modules/.DS_Store
  9. 70 0
      utils/loginHandle.js
  10. 7 5
      utils/request.js
  11. 3 2
      utils/requestUrl.js
  12. BIN
      uview-ui/.DS_Store

BIN
.DS_Store


+ 47 - 10
App.vue

@@ -1,11 +1,38 @@
-<script>
+<script>
+	import {loginAfterHandle} from './utils/loginHandle.js'
 	export default {
-		onLaunch: function() {
-		
+		onLaunch: function(e) {
+			//当url存在loginData时直接种上数据
+			// const data = {
+			// 	  code: "admin",
+			// 	  headUrl: null,
+			// 	  hiId: 9,
+			// 	  hospName: "东阳市横店医院",
+			// 	  id: 1,
+			// 	  name: "超级管理员",
+			// 	  nowPermission: 1,
+			// 	  permissions: [1, 2, 3, 4, 5],
+			// 	  token: "mMC/agxymKc6Zrxbe2Rye0avfX9GMRFfHV7/YqifA90="
+			// }
+			// console.log({e});
+			// console.log(JSON.stringify(data));
+			
+			
+			
+			
+			
 			/* 条件编译,仅在H5平台生效 */
-			// #ifdef H5
-		
-		
+			// #ifdef H5
+			
+			if(e.query.loginData&&e.query.hospSign){
+				try{
+					loginAfterHandle(JSON.parse(decodeURI(e.query.loginData)),e.query.hospSign);
+				}catch(e){
+					console.log({e})
+				}
+			}
+			
+			
 			uni.getSystemInfo({
 				success(e) {
 					/* 窗口宽度大于420px且不在PC页面且不在移动设备时跳转至 PC.html 页面 */
@@ -22,14 +49,12 @@
 				}
 			})
 			// #endif		
-
 		},
 		onShow: function() {
-			// console.log("App Show");
 
 		},
 		onHide: function() {
-			// console.log("App Hide");
+
 		},
 		methods: {
 			// 监测是否传参数
@@ -51,7 +76,19 @@
 						// #endif
 					}
 				} catch (e) {}
-			},
+			},
+			//角色和对应的跳转页面
+			rolToTarget(nowPermission) {
+				if(nowPermission != 0){
+					let current = this.rolList.find(item => item.permission == nowPermission);
+					if(current){
+						// 页面跳转
+						uni.redirectTo({
+							 url: `/${current.pagePath}`
+						});
+					}
+				}
+			}
 		}
 	};
 </script>

BIN
components/.DS_Store


BIN
pages/.DS_Store


+ 3 - 34
pages/login/login.vue

@@ -29,23 +29,17 @@
 
 <script>
 	import encryption from "../../utils/crypto.js";
+	import {loginAfterHandle} from '../../utils/loginHandle.js';
 	export default {
 		data() {
 			return {
 				index:0,
-				appHospSign:'tYAoFaa20yCAgaiy',//app端更新hospSign
+				appHospSign:'IGlcn5nc4xBWc08C',//app端更新hospSign
 				showInputModal:false,
 				hospSign: '', // 医院标识
 				username: '', // 用户名
 				password: '', // 密码
 				version:'',
-				rolList: [
-					{permission: 1, name: '管理员', pagePath: 'pages/situationsCenter/situationsCenter'}, // targetIndexs:targetList种对应的下标
-					{permission: 2, name: '查核组长',pagePath: 'pages/situationsCenter/situationsCenter'},
-					{permission: 3, name: '查核组员', pagePath: 'pages/situationsCenter/situationsCenter'},
-					{permission: 4, name: '单位负责人', pagePath: 'pages/mission/mission'},
-					{permission: 5, name: '改善者', pagePath: 'pages/mission/mission'}
-				],
 				deviceInfo:{}
 			}
 		},
@@ -120,39 +114,14 @@
 							password: encryption(this.password),
 							hospSign:hospSign,
 							nowPermission:nowPermission
-							// hospSign:'tYAoFaa20yCAgaiy'
 						}
 					}
 				}).then((data) => {
-					console.log('loginResData',data);
 					if (data) {
-						uni.setStorageSync('hiId', data.hiId);
-						uni.setStorageSync('permissions', data.permissions);
-			            uni.setStorageSync('token', data.token);
-						uni.setStorageSync('code', data.code);
-					    uni.setStorageSync('nowPermission', data.nowPermission);
-						uni.setStorageSync('id', data.id);
-						uni.setStorageSync('name', data.name);
-						uni.setStorageSync('hospSign',hospSign);
-						this.rolToTarget(data.nowPermission)
+						 loginAfterHandle(data,hospSign);
 					}
 				});
 			},
-			clickModalhandle(){
-				
-			},
-			//角色和对应的跳转页面
-			rolToTarget(nowPermission) {
-				if(nowPermission != 0){
-					let current = this.rolList.find(item => item.permission == nowPermission);
-					if(current){
-						// 页面跳转
-						uni.redirectTo({
-							 url: `/${current.pagePath}`
-						});
-					}
-				}
-			}
 		}
 	}
 </script>

+ 18 - 4
pages/mission-action/components/assign-mission.vue

@@ -4,7 +4,7 @@
 			<tm-radio-group :list="desicionList" label="改善工具" :defaultValue='desicion' @change="changeDesicion" />
 			<view class="switch-box">
 				<text class="label">需要审核改善方案</text>
-				<switch :checked="needApproveFlag" style="transform:scale(1.5)" @change="switchChange" />
+				<switch :checked="needApproveFlag" style="transform:scale(0.8)" @change="switchChange" />
 			</view>
 			<tm-radio-group :list="empDeptList" :setting="{value: 'empId',name: 'empName'}"
 				:defaultValue='desPersopn.empId' @change="changeDesPersopn" />
@@ -97,7 +97,20 @@
 			},
 			// 确定
 			sure() {
-				let requestParams = {};
+				let requestParams = {};
+				if(JSON.stringify(this.desPersopn) == '{}'){
+					   uni.showModal({
+					   	title: '提示',
+					   	content: '请先选择改善人',
+					   	showCancel: false,
+					   	success: function(res) {
+					   		if (res.confirm) {
+					   			this.needApproveFlag = false;
+					   		}
+					   	}
+					   });
+					   return;
+				}
 				this.btnInfo.params && this.btnInfo.params.map(item => {
 					if (item.valueKey) {
 						requestParams[item.paramsKey] = (
@@ -175,12 +188,13 @@
 
 			.switch-box {
 				display: flex;
-				justify-content: space-between;
+				justify-content:space-between;
 				align-items: center;
 				margin: 15rpx 0;
 				height: 87.5rpx;
 				background-color: #fff;
-				padding: 0 25rpx;
+				padding: 0 25rpx;
+				padding-right: 0;
 
 				.label {
 					font-size: 22.5rpx;

BIN
static/.DS_Store


BIN
uni_modules/.DS_Store


+ 70 - 0
utils/loginHandle.js

@@ -0,0 +1,70 @@
+/**
+ *  data {
+	 * code:string;
+	 * headUrl:string;
+	 * hiId:number;
+	 * hospName:string;
+	 * id:number;
+	 * name:string
+	 * nowPermission:number;
+	 * permissions:number[];
+	 * token:string;
+ }
+ */
+export const loginAfterHandle = (data,hospSign) => {
+	const rolList = [{
+			permission: 1,
+			name: '管理员',
+			pagePath: 'pages/situationsCenter/situationsCenter'
+		}, // targetIndexs:targetList种对应的下标
+		{
+			permission: 2,
+			name: '查核组长',
+			pagePath: 'pages/situationsCenter/situationsCenter'
+		},
+		{
+			permission: 3,
+			name: '查核组员',
+			pagePath: 'pages/situationsCenter/situationsCenter'
+		},
+		{
+			permission: 4,
+			name: '单位负责人',
+			pagePath: 'pages/mission/mission'
+		},
+		{
+			permission: 5,
+			name: '改善者',
+			pagePath: 'pages/mission/mission'
+		}
+	]
+
+	/**
+	 * nowPermission:number
+	 */
+	//角色和对应的跳转页面
+	const rolToTarget = (nowPermission) => {
+		if (nowPermission != 0) {
+			let current = rolList.find(item => item.permission == nowPermission);
+			if (current) {
+				// 页面跳转
+				uni.redirectTo({
+					url: `/${current.pagePath}`
+				});
+			}
+		}
+	}
+
+	if (data) {
+		uni.setStorageSync('hiId', data.hiId);
+		uni.setStorageSync('permissions', data.permissions);
+		uni.setStorageSync('token', data.token);
+		uni.setStorageSync('code', data.code);
+		uni.setStorageSync('nowPermission', data.nowPermission);
+		uni.setStorageSync('id', data.id);
+		uni.setStorageSync('name', data.name);
+		uni.setStorageSync('hospSign',hospSign);
+
+		rolToTarget(data.nowPermission)
+	}
+}

+ 7 - 5
utils/request.js

@@ -114,7 +114,6 @@ function dispatchEventGloal(type){
 }
 
 function notifyException(resArr, additional) {
-  console.log({resArr});
   openCloseLoading(additional, false);
   const [error, res] = resArr;
   if (error) {
@@ -133,12 +132,15 @@ function notifyException(resArr, additional) {
   } else if (res.data.code !== 'SUCCESS') {
     const { code, msg } = res.data;
     if (code === '410' || code === '401'||code === '403') {
+		
+	  // 当页面被嵌套告诉主页面,token过期
+	  if(window.parent){
+		   console.log('window.parent',window.parent);
+		   window.parent.postMessage('tokenExpired','*');
+	  }
+	  
       LoginExpired(msg);
     } else {
-		// uni.showToast({
-		//     title: '标题',
-		//     duration: 2000
-		// });
       uni.showModal({
         title: '错误提示',
         content: msg,

+ 3 - 2
utils/requestUrl.js

@@ -9,8 +9,9 @@
 // const base = '192.168.51.80:8801/imed/pfm/';
 
 // export const URL = '192.168.51.80:8801/imed/pfm/'; // 本地
-// export const URL = '112.124.59.133:8802/imed/pfm/'; //线上测试
-export const URL = '118.31.245.65:8802/imed/pfm/';
+//export const URL = '112.124.59.133:8802/imed/pfm/'; //线上测试
+//export const URL = '118.31.245.65:8802/imed/pfm/';
+export const URL = '118.31.245.65:8111/imed/pfm/'; //横店
 // export const URL = '192.168.38.174:8088/imed/pfm/';
 // export const URL = '192.168.1.45:8088/imed/pfm/'; //内网
 // export const URL = 's1.nsloop.com:5137/imed/pfm/';  // 外网

BIN
uview-ui/.DS_Store