优化登录
This commit is contained in:
parent
cae25ad4ce
commit
f1cd72e2ec
@ -41,3 +41,10 @@ export function logoutAdmin() {
|
||||
export function userInfoAdmin() {
|
||||
return adminRequest.get("/sys/user/info")
|
||||
}
|
||||
/**
|
||||
* 修改密码
|
||||
* @param userId
|
||||
*/
|
||||
export function updatePasswordAdmin(data:any) {
|
||||
return adminRequest.put("/sys/user/password",data)
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
<div class="head">
|
||||
<div class="head_l">
|
||||
<!-- <img src="/icoimg.png" alt="收缩" />-->
|
||||
|
||||
</div>
|
||||
<el-dropdown>
|
||||
<div class="head_r">
|
||||
@ -14,19 +13,67 @@
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item >个人中心</el-dropdown-item>
|
||||
<el-dropdown-item @click="drawer = true" >个人中心</el-dropdown-item>
|
||||
<el-dropdown-item @click="logout">退出登录</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
|
||||
<el-drawer
|
||||
v-model="drawer"
|
||||
title="个人中心"
|
||||
>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="state.dynamicValidateForm"
|
||||
label-position="top"
|
||||
>
|
||||
<el-form-item
|
||||
prop="password"
|
||||
label="原始密码"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '原始密码不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
|
||||
]"
|
||||
>
|
||||
<el-input v-model="state.dynamicValidateForm.password" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item
|
||||
prop="newPassword"
|
||||
label="新密码"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '新密码不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<el-input v-model="state.dynamicValidateForm.newPassword" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
|
||||
<el-button type="primary" @click="submitForm(formRef)">确定修改</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useRouter } from "vue-router";
|
||||
import type { FormInstance } from 'element-plus'
|
||||
const formRef = ref<FormInstance>()
|
||||
import { updatePasswordAdmin } from '~/api/user/adminUserApi'
|
||||
const router = useRouter();
|
||||
|
||||
|
||||
|
||||
const drawer = ref(false)
|
||||
const state = reactive({
|
||||
dynamicValidateForm:{}
|
||||
})
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
@ -37,6 +84,21 @@ const logout = () => {
|
||||
router.push('/login');
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
* @param formEl
|
||||
*/
|
||||
const submitForm = (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return
|
||||
formEl.validate((valid) => {
|
||||
if (valid) {
|
||||
updatePasswordAdmin(state.dynamicValidateForm).then(result => {
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.head{
|
||||
|
@ -21,7 +21,6 @@
|
||||
<!-- <img class="module_code_img" :src="state.captchaUrl" @click="getCaptcha">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="module_m">
|
||||
<div class="module_code">
|
||||
<el-radio-group v-model="state.role" class="ml-4">
|
||||
|
@ -13,31 +13,30 @@ export const getUuid = (): string => {
|
||||
export const getFrontList = () => {
|
||||
const routes = [
|
||||
{
|
||||
"path": "/",
|
||||
"path": "/admin/",
|
||||
"name": "产品维度",
|
||||
"icon": "House",
|
||||
},
|
||||
{
|
||||
"path": "/view1",
|
||||
"path": "/admin/view1",
|
||||
"name": "时间维度",
|
||||
"icon": "DataAnalysis",
|
||||
},
|
||||
{
|
||||
"path": "view2",
|
||||
"path": "/admin/view2",
|
||||
"name": "地域维度",
|
||||
"icon": "DataAnalysis",
|
||||
},
|
||||
{
|
||||
"path": "view3",
|
||||
"path": "/admin/view3",
|
||||
"name": "客户维度",
|
||||
"icon": "DataAnalysis",
|
||||
},
|
||||
{
|
||||
"path": "view4",
|
||||
"path": "/admin/view4",
|
||||
"name": "销售收入维度",
|
||||
"icon": "DataAnalysis",
|
||||
},
|
||||
]
|
||||
|
||||
return routes;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user