useLoginSuccess.js 601 B

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