优化登录

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(()=>{ onMounted(()=>{
// activeIndexpath便<EFBFBD><EFBFBD> // activeIndexpath便<EFBFBD><EFBFBD>
state.activeIndex = route.path state.activeIndex = route.path
}) })
</script> </script>
<style scoped> <style scoped>

View File

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