| | |
| | | size="large"
|
| | | auto-complete="off"
|
| | | placeholder="账号"
|
| | | @input="deptListSearch"
|
| | | @input="getUserLoginFacotryList"
|
| | | >
|
| | | <template #prefix><el-icon><User /></el-icon></template>
|
| | | </el-input>
|
| | |
| | | import Cookies from "js-cookie"
|
| | | import { encrypt, decrypt } from "@/utils/jsencrypt"
|
| | | import useUserStore from '@/store/modules/user'
|
| | | import {userDeptList} from "@/api/system/user.js"
|
| | | import {userLoginFacotryList} from "@/api/system/user.js"
|
| | |
|
| | | const title = import.meta.env.VITE_APP_TITLE
|
| | | const userStore = useUserStore()
|
| | |
| | | if (valid) {
|
| | | loading.value = true
|
| | | // 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
| | | if (loginForm.value.rememberMe) {
|
| | | Cookies.set("username", loginForm.value.username, { expires: 30 })
|
| | | Cookies.set("password", encrypt(loginForm.value.password), { expires: 30 })
|
| | | Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 })
|
| | | } else {
|
| | | // 否则移除
|
| | | Cookies.remove("username")
|
| | | Cookies.remove("password")
|
| | | Cookies.remove("rememberMe")
|
| | | }
|
| | | Cookies.set("username", loginForm.value.username, { expires: 30 })
|
| | | Cookies.set("password", encrypt(loginForm.value.password), { expires: 30 })
|
| | | Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 })
|
| | | userStore.loginCheckFactory(loginForm.value).then(res => {
|
| | | const query = route.query
|
| | | const otherQueryParams = Object.keys(query).reduce((acc, cur) => {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | function deptListSearch() {
|
| | | function getUserLoginFacotryList() {
|
| | | if(loginForm.value.username){
|
| | | userDeptList({userName:loginForm.value.username}).then(res => {
|
| | | userLoginFacotryList({userName:loginForm.value.username}).then(res => {
|
| | | console.log('res', res)
|
| | | factoryList.value = res.data
|
| | | })
|
| | | }else {
|
| | | factoryList.value = []
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | getCode()
|
| | | getCookie()
|
| | | deptListSearch()
|
| | | getUserLoginFacotryList()
|
| | | </script>
|
| | |
|
| | | <style lang='scss' scoped>
|