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