优化登录
This commit is contained in:
parent
170690b9ef
commit
5d762b82a5
@ -42,9 +42,7 @@ const handleSelect = (key: string, keyPath: string[]) => {
|
||||
onMounted(()=>{
|
||||
// 初始化activeIndex为当前路由的path路径,方便在菜单栏高<EFBFBD><EFBFBD>显示选中项
|
||||
state.activeIndex = route.path
|
||||
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
@ -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')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取验证码
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user