12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- /**
- * 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'
- },
- {
- permission: 6,
- name: '职能科室负责人',
- pagePath: 'pages/situationsCenter/situationsCenter'
- },
- {
- permission: 7,
- name: '职能科室人员',
- pagePath: 'pages/situationsCenter/situationsCenter'
- },
- {
- permission: 8,
- name: '自查人',
- pagePath: 'pages/situationsCenter/situationsCenter'
- }
- ]
- /**
- * 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)
- }
- }
|