zhouwenxuan
2023-12-08 b7143b51f3a50b6fac9c139d291c1fad017daee6
src/views/components/loginForm.vue
@@ -107,7 +107,7 @@
})
const openRegist = ()=>{
  regRef.value.dialogVisible = true
  regRef.value.openDialog('add', {});
}
watch(route, (newRoute) => {
@@ -134,22 +134,21 @@
      // 调用action的登录方法
      loginForm.value.password = Base64.encode(loginForm.value.password)
      userStore.login(loginForm.value).then(() => {
        const query = route.query;
        const otherQueryParams = Object.keys(query).reduce((acc, cur) => {
          if (cur !== "redirect") {
            acc[cur] = query[cur];
        // const query = route.query;
        // const otherQueryParams = Object.keys(query).reduce((acc, cur) => {
        //   if (cur !== "redirect") {
        //     acc[cur] = query[cur];
        //   }
        //   return acc;
        // }, {});
        const userInfo = JSON.parse(Cookies.get('userInfo'))
          if(userInfo.identity === 0 || userInfo.identity === 1 ) {
              sidebarRouters.value =  menu.adminMenu
              Cookies.set('routers',JSON.stringify(sidebarRouters.value))
          }
          return acc;
        }, {});
          const userInfo = JSON.parse(Cookies.get('userInfo'))
            if(userInfo.identity === 0) {
                sidebarRouters.value =  menu.adminMenu
                Cookies.set('routers',JSON.stringify(sidebarRouters.value))
            }
          console.log("sidebarRouters.value",sidebarRouters.value)
          router.push({
              path: sidebarRouters.value[0].path
          })
        router.push({
            path: sidebarRouters.value[0].path
        })
        // router.push({ path: redirect.value || "/", query: otherQueryParams });
      }).catch(() => {
        loading.value = false;