| | |
| | | auto-complete="off" |
| | | placeholder="密码" |
| | | @keyup.enter="handleLogin" |
| | | show-password |
| | | > |
| | | <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template> |
| | | </el-input> |
| | |
| | | :loading="loading" |
| | | size="large" |
| | | type="primary" |
| | | style="width:50%;" |
| | | style="width:63%;" |
| | | @click.prevent="handleLogin" |
| | | > |
| | | <span v-if="!loading">登 录</span> |
| | |
| | | import { encrypt, decrypt } from "@/utils/jsencrypt"; |
| | | import useUserStore from '@/store/modules/user' |
| | | import { Register } from "@/layout/components"; |
| | | import { Base64 } from 'js-base64' |
| | | import menu from "@/layout/components/Sidebar/menu"; |
| | | |
| | | const userStore = useUserStore() |
| | | const route = useRoute(); |
| | |
| | | }) |
| | | |
| | | const openRegist = ()=>{ |
| | | regRef.value.dialogVisible = true |
| | | regRef.value.openDialog('add', {}); |
| | | } |
| | | |
| | | watch(route, (newRoute) => { |
| | | redirect.value = newRoute.query && newRoute.query.redirect; |
| | | }, { immediate: true }); |
| | | |
| | | |
| | | const sidebarRouters = ref([]) |
| | | function handleLogin() { |
| | | proxy.$refs.loginRef.validate(valid => { |
| | | if (valid) { |
| | |
| | | // Cookies.remove("rememberMe"); |
| | | // } |
| | | // 调用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 routers = JSON.parse(Cookies.get('routers')) |
| | | router.push({ |
| | | path: routers[0].path |
| | | }) |
| | | router.push({ |
| | | path: sidebarRouters.value[0].path |
| | | }) |
| | | // router.push({ path: redirect.value || "/", query: otherQueryParams }); |
| | | }).catch(() => { |
| | | loading.value = false; |