From c694cffc8541d921e5256d33e14e3237454de950 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: Fri, 26 Jan 2024 09:43:31 +0800
Subject: [PATCH] 新提交
---
src/layout/navBars/breadcrumb/user.vue | 284 ++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 222 insertions(+), 62 deletions(-)
diff --git a/src/layout/navBars/breadcrumb/user.vue b/src/layout/navBars/breadcrumb/user.vue
index 5a26dde..70ef2c0 100644
--- a/src/layout/navBars/breadcrumb/user.vue
+++ b/src/layout/navBars/breadcrumb/user.vue
@@ -2,7 +2,7 @@
<div class="layout-navbars-breadcrumb-user pr15" :style="{ flex: layoutUserFlexNum }">
<div class="logo">
<img src="../../../assets/menu/companyLogo.png" />
- <span style="font-size: 32px; color: #409eff; font-weight: bolder; border-left: 2px solid #409eff; padding-left: 10px">{{ systemName }}</span>
+ <span>{{ systemName }}</span>
</div>
<div style="display: flex; align-items: center; padding-right: 5px">
<div @click="backToMenu()" class="backBtn">返回首页</div>
@@ -66,6 +66,7 @@
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="/newMenu">{{ $t('message.user.dropdown1') }}</el-dropdown-item>
+ <el-dropdown-item @click="showPwdDialog = true">修改密码</el-dropdown-item>
<!-- <el-dropdown-item command="wareHouse">{{ $t('message.user.dropdown6') }}</el-dropdown-item>-->
<!-- <el-dropdown-item command="/personal">{{ $t('message.user.dropdown2') }}</el-dropdown-item>-->
<!-- <el-dropdown-item command="/404">{{ $t('message.user.dropdown3') }}</el-dropdown-item>-->
@@ -74,6 +75,26 @@
</el-dropdown-menu>
</template>
</el-dropdown>
+ <el-dialog title="修改密码" v-model="showPwdDialog" width="500px">
+ <el-form :model="pwdForm" size="default" ref="pwdRef" :rules="pwdFormRules" label-width="110px">
+ <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
+ <el-form-item label="新密码" prop="newPassword">
+ <el-input v-model.trim="pwdForm.newPassword" placeholder="请输入" type="password" show-password>
+ </el-input>
+ </el-form-item>
+ <el-form-item label="确认新密码" prop="rePassword">
+ <el-input v-model.trim="pwdForm.rePassword" placeholder="请输入" type="password" show-password>
+ </el-input>
+ </el-form-item>
+ </el-col>
+ </el-form>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button @click="showPwdDialog = !showPwdDialog" size="default">取 消</el-button>
+ <el-button type="primary" v-throttle @click="onPwdSubmit" size="default">确 定</el-button>
+ </span>
+ </template>
+ </el-dialog>
<Search ref="searchRef" />
</div>
</div>
@@ -101,6 +122,9 @@
import { useRequestOldRoutes } from '/@/stores/requestOldRoutes';
import { dynamicRoutes } from '/@/router/route';
import Cookies from 'js-cookie';
+import {useRoutesList} from "/@/stores/routesList";
+import {verifyPwd} from "/@/utils/toolsValidate";
+import {userApi} from "/@/api/systemManage/user";
export default defineComponent({
name: 'layoutBreadcrumbUser',
@@ -110,15 +134,47 @@
const { proxy } = <any>getCurrentInstance();
const router = useRouter();
const stores = useUserInfo();
+ const routeList = storeToRefs(useRoutesList())
const storesThemeConfig = useThemeConfig();
const { userInfos } = storeToRefs(stores);
const { themeConfig } = storeToRefs(storesThemeConfig);
const searchRef = ref();
+ const pwdRef = ref();
+ const validatePwd = (rule: any, value: any, callback: any)=>{
+ if(value === ''){
+ callback(new Error('请输入密码'))
+ }else{
+ if(!verifyPwd(value)){
+ callback(new Error('密码须包含字母、数字、特殊字符,长度在6-16之间'))
+ }else{
+ callback()
+ }
+ }
+ }
+ const equalToPassword = (rule: any, value: any, callback: any) => {
+ if(value == ''){
+ callback(new Error("请再次确认密码"))
+ }else if (state.pwdForm.newPassword !== value) {
+ callback(new Error("两次输入的密码不一致"))
+ } else {
+ callback();
+ }
+ };
const state = reactive({
isScreenfull: false,
disabledI18n: 'zh-cn',
disabledSize: 'large',
- systemName: ''
+ systemName: '',
+ showPwdDialog: false,
+ pwdForm: {
+ uid: Cookies.get('uid'),
+ newPassword: '',
+ rePassword: ''
+ },
+ pwdFormRules: {
+ newPassword: [{ required: true, validator: validatePwd, trigger: 'blur' }],
+ rePassword: [{ required: true, validator: equalToPassword, trigger: "blur" }]
+ }
});
// 设置分割样式
const layoutUserFlexNum = computed(() => {
@@ -129,6 +185,42 @@
else num = '';
return num;
});
+
+ const onPwdSubmit = async () => {
+ pwdRef.value.validate(async (valid:Boolean) => {
+ if(valid){
+ const {rePassword,...data} = state.pwdForm
+ let res = await userApi().pwdModSelf(data);
+ if (res.data.code === '200') {
+ state.showPwdDialog = false
+ ElMessage({
+ type: 'success',
+ message: '密码修改成功,请重新登录',
+ duration: 2000
+ })
+ setTimeout(()=>{
+ useLoginApi()
+ .signOut()
+ .then(() => {
+ Session.clear()
+ window.location.href = '/'
+ })
+ },2000)
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
+ }else{
+ ElMessage({
+ type:'warning',
+ message:'请完善信息'
+ })
+ }
+ })
+ }
+
// 全屏点击时
const onScreenfullClick = () => {
if (!screenfull.isEnabled) {
@@ -261,8 +353,14 @@
}
};
const backToMenu = () => {
- router.push({ path: 'newMenu' });
+ router.push({ path: 'newMenu' }).then(()=>{
+ routeList.routesList.value = []
+ console.log(routeList);
+ });
};
+ // const toHome = () => {
+ // router.push({ path: 'newMenu' });
+ // };
// 页面加载时
onMounted(() => {
if (Local.get('themeConfig')) {
@@ -273,6 +371,8 @@
});
return {
userInfos,
+ pwdRef,
+ onPwdSubmit,
backToMenu,
onLayoutSetingClick,
onHandleCommandClick,
@@ -289,70 +389,130 @@
</script>
<style scoped lang="scss">
-.layout-navbars-breadcrumb-user {
- display: flex;
- align-items: center;
- justify-content: space-between;
+ @media screen and (min-width: 1400px) {
+ .logo{
+ img {
+ height: 100%;
+ }
+ span{
+ font-size: 32px;
+ color: #409eff;
+ font-weight: bolder;
+ border-left: 2px solid #409eff;
+ padding-left: 10px
+ }
+ }
+ .backBtn {
+ font-size: 16px;
+ cursor: pointer;
+ margin-right: 20px;
- .logo {
- height: 75%;
- padding: 5px 10px;
- display: flex;
- align-items: center;
- overflow: hidden;
- box-sizing: border-box;
- img {
- height: 100%;
- }
- }
- &-link {
- height: 100%;
- display: flex;
- align-items: center;
- white-space: nowrap;
- &-photo {
- width: 25px;
- height: 25px;
- border-radius: 100%;
- }
- }
- &-icon {
- padding: 0 10px;
- cursor: pointer;
- color: var(--next-bg-topBarColor);
- height: 80px;
- line-height: 80px;
- display: flex;
- align-items: center;
- &:hover {
- background: var(--next-color-user-hover);
- i {
- display: inline-block;
- animation: logoAnimation 0.3s ease-in-out;
+ &:hover {
+ color: #409eff;
+ font-weight: bolder;
}
}
}
- ::v-deep(.el-dropdown) {
- color: var(--next-bg-topBarColor);
- }
- ::v-deep(.el-badge) {
- height: 40px;
- line-height: 40px;
- display: flex;
- align-items: center;
- }
- ::v-deep(.el-badge__content.is-fixed) {
- top: 12px;
- }
- .backBtn {
- font-size: 16px;
- cursor: pointer;
- margin-right: 20px;
+ @media screen and (min-width: 1200px) and (max-width: 1400px) {
+ .logo{
+ img {
+ height: 90%;
+ }
+ span{
+ font-size: 28px;
+ color: #409eff;
+ font-weight: bolder;
+ border-left: 2px solid #409eff;
+ padding-left: 10px
+ }
+ }
+ .backBtn {
+ font-size: 14px;
+ cursor: pointer;
+ margin-right: 20px;
- &:hover {
- color: #409eff;
- font-weight: bolder;
+ &:hover {
+ color: #409eff;
+ font-weight: bolder;
+ }
}
}
-}
+ @media screen and (max-width: 1024px) {
+ .logo{
+ img {
+ width: 60%;
+ height: auto;
+ }
+ span{
+ font-size: 22px;
+ color: #409eff;
+ font-weight: bolder;
+ border-left: 2px solid #409eff;
+ padding-left: 10px
+ }
+ }
+ .backBtn {
+ font-size: 12px;
+ cursor: pointer;
+ margin-right: 20px;
+
+ &:hover {
+ color: #409eff;
+ font-weight: bolder;
+ }
+ }
+ }
+ .layout-navbars-breadcrumb-user {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+
+ .logo {
+ height: 75%;
+ padding: 5px 10px;
+ display: flex;
+ align-items: center;
+ overflow: hidden;
+ box-sizing: border-box;
+ }
+ &-link {
+ height: 100%;
+ display: flex;
+ align-items: center;
+ white-space: nowrap;
+ &-photo {
+ width: 25px;
+ height: 25px;
+ border-radius: 100%;
+ }
+ }
+ &-icon {
+ padding: 0 10px;
+ cursor: pointer;
+ color: var(--next-bg-topBarColor);
+ height: 80px;
+ line-height: 80px;
+ display: flex;
+ align-items: center;
+ &:hover {
+ background: var(--next-color-user-hover);
+ i {
+ display: inline-block;
+ animation: logoAnimation 0.3s ease-in-out;
+ }
+ }
+ }
+ ::v-deep(.el-dropdown) {
+ color: var(--next-bg-topBarColor);
+ }
+ ::v-deep(.el-badge) {
+ height: 40px;
+ line-height: 40px;
+ display: flex;
+ align-items: center;
+ }
+ ::v-deep(.el-badge__content.is-fixed) {
+ top: 12px;
+ }
+ }
</style>
--
Gitblit v1.9.2