|
@ -86,67 +86,67 @@ |
|
|
if (userName.value !== '' && password.value !== '') { |
|
|
if (userName.value !== '' && password.value !== '') { |
|
|
errorShow.value = false; |
|
|
errorShow.value = false; |
|
|
let data = JSON.stringify({ userName: userName.value, password: password.value }); |
|
|
let data = JSON.stringify({ userName: userName.value, password: password.value }); |
|
|
Cookies.set('nervsid', 'mockdata'); |
|
|
// Cookies.set('nervsid', 'mockdata'); |
|
|
router.replace({ name: 'root' }); |
|
|
// router.replace({ name: 'root' }); |
|
|
|
|
|
|
|
|
// loading.value = true; |
|
|
loading.value = true; |
|
|
// async function logins() { |
|
|
async function logins() { |
|
|
// try { |
|
|
try { |
|
|
// const res = await configStore.userLogin(JSON.parse(data)); |
|
|
const res = await configStore.userLogin(JSON.parse(data)); |
|
|
// if (res.success) { |
|
|
if (res.success) { |
|
|
// if (res.data?.userToken) { |
|
|
if (res.data?.userToken) { |
|
|
// Cookies.set('nervsid', res.data?.userToken); |
|
|
Cookies.set('nervsid', res.data?.userToken); |
|
|
// } |
|
|
} |
|
|
// const info = await configStore.userInfo(); |
|
|
const info = await configStore.userInfo(); |
|
|
// info.success |
|
|
info.success |
|
|
// ? window.sessionStorage.setItem('userInfo', JSON.stringify(info.data)) |
|
|
? window.sessionStorage.setItem('userInfo', JSON.stringify(info.data)) |
|
|
// : ''; |
|
|
: ''; |
|
|
// loading.value = false; |
|
|
loading.value = false; |
|
|
// if (configStore.enablePermissions) { |
|
|
if (configStore.enablePermissions) { |
|
|
// const res = await configStore.userResource(); |
|
|
const res = await configStore.userResource(); |
|
|
// if (configStore.customApplication) { |
|
|
if (configStore.customApplication) { |
|
|
// await useAuthorization.initMenuResource(); |
|
|
await useAuthorization.initMenuResource(); |
|
|
// } |
|
|
} |
|
|
|
|
|
|
|
|
// initUrl.value = ''; |
|
|
initUrl.value = ''; |
|
|
// const dealInitUrl = (item) => { |
|
|
const dealInitUrl = (item) => { |
|
|
// if (item.type === 'menus' && item.menus && item.menus?.length !== 0) { |
|
|
if (item.type === 'menus' && item.menus && item.menus?.length !== 0) { |
|
|
// dealInitUrl(item.menus[0]); |
|
|
dealInitUrl(item.menus[0]); |
|
|
// } else { |
|
|
} else { |
|
|
// // if (item.type === 'noChildrenMenu') { |
|
|
// if (item.type === 'noChildrenMenu') { |
|
|
// initUrl.value = configStore.resourceName |
|
|
initUrl.value = configStore.resourceName |
|
|
// ? item.code.replace(configStore.resourceName, '') |
|
|
? item.code.replace(configStore.resourceName, '') |
|
|
// : item.code; |
|
|
: item.code; |
|
|
// // } |
|
|
|
|
|
// } |
|
|
// } |
|
|
// }; |
|
|
} |
|
|
// if (configStore.resourceName) { |
|
|
}; |
|
|
// const initResource = []; |
|
|
if (configStore.resourceName) { |
|
|
// res.data.forEach((item) => { |
|
|
const initResource = []; |
|
|
// if (item.code.includes(configStore.resourceName)) { |
|
|
res.data.forEach((item) => { |
|
|
// initResource.push(item); |
|
|
if (item.code.includes(configStore.resourceName)) { |
|
|
// } |
|
|
initResource.push(item); |
|
|
// }); |
|
|
} |
|
|
// dealInitUrl(initResource[0]); |
|
|
}); |
|
|
// } else { |
|
|
dealInitUrl(initResource[0]); |
|
|
|
|
|
} else { |
|
|
|
|
|
dealInitUrl(res.data[0]); |
|
|
|
|
|
} |
|
|
// dealInitUrl(res.data[0]); |
|
|
// dealInitUrl(res.data[0]); |
|
|
// } |
|
|
useAuthorization.updateUserResource(res.data); |
|
|
// // dealInitUrl(res.data[0]); |
|
|
const initRouterList = useAuthorization.getInitRouterList; |
|
|
// useAuthorization.updateUserResource(res.data); |
|
|
|
|
|
// const initRouterList = useAuthorization.getInitRouterList; |
|
|
|
|
|
|
|
|
|
|
|
// router.push({ |
|
|
router.push({ |
|
|
// name: initRouterList.length === 0 ? 'error403' : initUrl.value, |
|
|
name: initRouterList.length === 0 ? 'error403' : initUrl.value, |
|
|
// }); |
|
|
}); |
|
|
// } else { |
|
|
} else { |
|
|
// router.replace({ name: 'root' }); |
|
|
router.replace({ name: 'root' }); |
|
|
// } |
|
|
} |
|
|
// } |
|
|
} |
|
|
// } catch (err) { |
|
|
} catch (err) { |
|
|
// loading.value = false; |
|
|
loading.value = false; |
|
|
// } |
|
|
} |
|
|
// } |
|
|
} |
|
|
// logins(); |
|
|
logins(); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
const checkoutLogo = (): void => { |
|
|
const checkoutLogo = (): void => { |
|
|