优化登录

This commit is contained in:
闵宪瑞 2025-02-07 16:09:08 +08:00
parent 170690b9ef
commit 5d762b82a5
2 changed files with 7 additions and 9 deletions

View File

@ -42,9 +42,7 @@ const handleSelect = (key: string, keyPath: string[]) => {
onMounted(()=>{
// activeIndexpath便<EFBFBD><EFBFBD>
state.activeIndex = route.path
})
</script>
<style scoped>

View File

@ -23,9 +23,9 @@
<!-- </div>-->
<div class="module_m">
<div class="module_code">
<el-radio-group v-model="state.role" class="ml-4">
<el-radio :label=false size="large">普通用户</el-radio>
<el-radio :label=true size="large">管理员</el-radio>
<el-radio-group v-model="login.role" class="ml-4">
<el-radio :label=0 size="large">普通用户</el-radio>
<el-radio :label=1 size="large">管理员</el-radio>
</el-radio-group>
</div>
</div>
@ -44,15 +44,14 @@ import { getUuid } from '~/utils/utils'
import { loginFront } from '~/api/user/frontUserApi'
const router = useRouter()
const state = reactive({
role: false,
captchaUrl: '',
loginFrom: {},
loading: false
})
const login = reactive({ username: 'admin', password: 'admin', captcha: '', uuid: '' })
const login = reactive({ username: 'admin', password: 'admin', captcha: '', uuid: '',role: 0,})
const onLogin = () => {
state.loading = true
if (state.role) {
if (login.role) {
console.log("管理员")
loginAdmin(login).then(response => {
state.loading = false
@ -66,10 +65,11 @@ const onLogin = () => {
})
} else {
loginFront(login)
toast.success("登录成功~")
ElMessage.success("登录成功~")
router.push('/front')
}
}
/**
* 获取验证码
*/