useLoginSuccess.js 667 B

1234567891011121314151617181920212223242526
  1. import { useLoginUserStore } from '@/stores/loginUser'
  2. const loginUserStore = useLoginUserStore()
  3. export function useLoginSuccess() {
  4. /**
  5. * 登录成功后的操作
  6. */
  7. const loginSuccess = (user) => {
  8. loginUserStore.setLoginHospital(user.infoPermission.hospitals);
  9. loginUserStore.setLoginUser(user.user);
  10. loginUserStore.setLoginUserMenu(user.menu);
  11. // 判断用户标识是否为处理人
  12. if (user.user.engineer === 1) {
  13. uni.reLaunch({
  14. url: '/pages/incidentList/incidentList'
  15. })
  16. } else {
  17. uni.reLaunch({
  18. url: '/pages/repairEntrance/repairEntrance'
  19. })
  20. }
  21. }
  22. return {
  23. loginSuccess
  24. };
  25. }