mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-05 05:18:12 +08:00
显示长期 token
This commit is contained in:
parent
ec7e76c130
commit
a621d3dd7c
@ -62,6 +62,7 @@ public class UserBasicInfoController extends BaseServerController {
|
|||||||
map.put("email", userModel.getEmail());
|
map.put("email", userModel.getEmail());
|
||||||
map.put("dingDing", userModel.getDingDing());
|
map.put("dingDing", userModel.getDingDing());
|
||||||
map.put("workWx", userModel.getWorkWx());
|
map.put("workWx", userModel.getWorkWx());
|
||||||
|
map.put("md5Token", userModel.getUserMd5Key());
|
||||||
return JsonMessage.getString(200, "success", map);
|
return JsonMessage.getString(200, "success", map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="user-header">
|
<div class="user-header">
|
||||||
<a-tooltip placement="left" >
|
<a-tooltip placement="left">
|
||||||
<a-button title="只保留当前的 Tab" :disabled="getTabList.length <= 1" class="close-all jpom-close-tabs" @click="closeTabs">关闭 Tab</a-button>
|
<a-button title="只保留当前的 Tab" :disabled="getTabList.length <= 1" class="close-all jpom-close-tabs" @click="closeTabs">关闭 Tab</a-button>
|
||||||
<!-- <a-button title="回到旧版 UI" class="close-all jpom-old-version" @click="toOldIndex">旧版</a-button>-->
|
<!-- <a-button title="回到旧版 UI" class="close-all jpom-old-version" @click="toOldIndex">旧版</a-button>-->
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
<a-dropdown>
|
<a-dropdown>
|
||||||
<!-- <a-avatar-->
|
<!-- <a-avatar-->
|
||||||
<!-- shape="square"-->
|
<!-- shape="square"-->
|
||||||
<!-- size="large"-->
|
<!-- size="large"-->
|
||||||
<!-- :style="{ backgroundColor: '#f56a00', verticalAlign: 'middle' ,fontSize:'40px'}">-->
|
<!-- :style="{ backgroundColor: '#f56a00', verticalAlign: 'middle' ,fontSize:'40px'}">-->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- </a-avatar>-->
|
<!-- </a-avatar>-->
|
||||||
<a-button class="ant-dropdown-link jpom-user-operation" :style="{ backgroundColor: '#f56a00', color: '#fff', verticalAlign: 'middle'}" @click="e => e.preventDefault()" :title="getUserInfo.name">
|
<a-button
|
||||||
|
class="ant-dropdown-link jpom-user-operation"
|
||||||
|
:style="{ backgroundColor: '#f56a00', color: '#fff', verticalAlign: 'middle' }"
|
||||||
|
@click="(e) => e.preventDefault()"
|
||||||
|
:title="getUserInfo.name"
|
||||||
|
>
|
||||||
{{ avatarName }} <a-icon type="down" />
|
{{ avatarName }} <a-icon type="down" />
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-menu slot="overlay">
|
<a-menu slot="overlay">
|
||||||
@ -33,29 +38,32 @@
|
|||||||
<a-modal v-model="updateNameVisible" title="修改密码" @ok="handleUpdatePwdOk" :maskClosable="false">
|
<a-modal v-model="updateNameVisible" title="修改密码" @ok="handleUpdatePwdOk" :maskClosable="false">
|
||||||
<a-form-model ref="pwdForm" :rules="rules" :model="temp" :label-col="{ span: 6 }" :wrapper-col="{ span: 14 }">
|
<a-form-model ref="pwdForm" :rules="rules" :model="temp" :label-col="{ span: 6 }" :wrapper-col="{ span: 14 }">
|
||||||
<a-form-model-item label="原密码" prop="oldPwd">
|
<a-form-model-item label="原密码" prop="oldPwd">
|
||||||
<a-input-password v-model="temp.oldPwd" placeholder="Old password"/>
|
<a-input-password v-model="temp.oldPwd" placeholder="Old password" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-form-model-item label="新密码" prop="newPwd">
|
<a-form-model-item label="新密码" prop="newPwd">
|
||||||
<a-input-password v-model="temp.newPwd" placeholder="New password"/>
|
<a-input-password v-model="temp.newPwd" placeholder="New password" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-form-model-item label="确认密码" prop="confirmPwd">
|
<a-form-model-item label="确认密码" prop="confirmPwd">
|
||||||
<a-input-password v-model="temp.confirmPwd" placeholder="Confirm password"/>
|
<a-input-password v-model="temp.confirmPwd" placeholder="Confirm password" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
</a-form-model>
|
</a-form-model>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
<!-- 修改用户资料区 -->
|
<!-- 修改用户资料区 -->
|
||||||
<a-modal v-model="updateUserVisible" title="修改用户资料" @ok="handleUpdateUserOk" :maskClosable="false">
|
<a-modal v-model="updateUserVisible" title="修改用户资料" @ok="handleUpdateUserOk" :maskClosable="false">
|
||||||
<a-form-model ref="userForm" :rules="rules" :model="temp" :label-col="{ span: 6 }" :wrapper-col="{ span: 14 }">
|
<a-form-model ref="userForm" :rules="rules" :model="temp" :label-col="{ span: 6 }" :wrapper-col="{ span: 14 }">
|
||||||
<a-form-model-item label="Token" prop="token">
|
<a-form-model-item label="临时token" prop="token">
|
||||||
<a-input v-model="temp.token" placeholder="Token"/>
|
<a-input v-model="temp.token" placeholder="Token" />
|
||||||
|
</a-form-model-item>
|
||||||
|
<a-form-model-item label="长期token" prop="md5Token">
|
||||||
|
<a-input v-model="temp.md5Token" placeholder="Token" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-form-model-item label="邮箱地址" prop="email">
|
<a-form-model-item label="邮箱地址" prop="email">
|
||||||
<a-input v-model="temp.email" placeholder="邮箱地址"/>
|
<a-input v-model="temp.email" placeholder="邮箱地址" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-form-model-item v-show="showCode" label="邮箱验证码" prop="code">
|
<a-form-model-item v-show="showCode" label="邮箱验证码" prop="code">
|
||||||
<a-row :gutter="8">
|
<a-row :gutter="8">
|
||||||
<a-col :span="15">
|
<a-col :span="15">
|
||||||
<a-input v-model="temp.code" placeholder="邮箱验证码"/>
|
<a-input v-model="temp.code" placeholder="邮箱验证码" />
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="4">
|
<a-col :span="4">
|
||||||
<a-button type="primary" :disabled="!temp.email" @click="sendEmailCode">发送验证码</a-button>
|
<a-button type="primary" :disabled="!temp.email" @click="sendEmailCode">发送验证码</a-button>
|
||||||
@ -63,19 +71,19 @@
|
|||||||
</a-row>
|
</a-row>
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-form-model-item label="钉钉通知地址" prop="dingDing">
|
<a-form-model-item label="钉钉通知地址" prop="dingDing">
|
||||||
<a-input v-model="temp.dingDing" placeholder="钉钉通知地址"/>
|
<a-input v-model="temp.dingDing" placeholder="钉钉通知地址" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-form-model-item label="企业微信通知地址" prop="workWx">
|
<a-form-model-item label="企业微信通知地址" prop="workWx">
|
||||||
<a-input v-model="temp.workWx" placeholder="企业微信通知地址"/>
|
<a-input v-model="temp.workWx" placeholder="企业微信通知地址" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
</a-form-model>
|
</a-form-model>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from "vuex";
|
||||||
import { updatePwd, sendEmailCode, editUserInfo } from '../../api/user';
|
import { updatePwd, sendEmailCode, editUserInfo, getUserInfo } from "../../api/user";
|
||||||
import sha1 from 'sha1';
|
import sha1 from "sha1";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -86,27 +94,15 @@ export default {
|
|||||||
temp: {},
|
temp: {},
|
||||||
// 表单校验规则
|
// 表单校验规则
|
||||||
rules: {
|
rules: {
|
||||||
oldPwd: [
|
oldPwd: [{ required: true, message: "Please input old password", trigger: "blur" }],
|
||||||
{ required: true, message: 'Please input old password', trigger: 'blur' }
|
newPwd: [{ required: true, message: "Please input new password", trigger: "blur" }],
|
||||||
],
|
confirmPwd: [{ required: true, message: "Please input confirmPwd password", trigger: "blur" }],
|
||||||
newPwd: [
|
email: [{ required: true, message: "Please input email", trigger: "blur" }],
|
||||||
{ required: true, message: 'Please input new password', trigger: 'blur' }
|
},
|
||||||
],
|
};
|
||||||
confirmPwd: [
|
|
||||||
{ required: true, message: 'Please input confirmPwd password', trigger: 'blur' }
|
|
||||||
],
|
|
||||||
email: [
|
|
||||||
{ required: true, message: 'Please input email', trigger: 'blur' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters([
|
...mapGetters(["getToken", "getUserInfo", "getTabList"]),
|
||||||
'getToken',
|
|
||||||
'getUserInfo',
|
|
||||||
'getTabList'
|
|
||||||
]),
|
|
||||||
// 处理展示的名称 中文 3 个字 其他 4 个字符
|
// 处理展示的名称 中文 3 个字 其他 4 个字符
|
||||||
avatarName() {
|
avatarName() {
|
||||||
const reg = new RegExp("[\u4E00-\u9FA5]+");
|
const reg = new RegExp("[\u4E00-\u9FA5]+");
|
||||||
@ -118,29 +114,29 @@ export default {
|
|||||||
},
|
},
|
||||||
showCode() {
|
showCode() {
|
||||||
return this.getUserInfo.email !== this.temp.email;
|
return this.getUserInfo.email !== this.temp.email;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 退出登录
|
// 退出登录
|
||||||
logOut() {
|
logOut() {
|
||||||
this.$confirm({
|
this.$confirm({
|
||||||
title: '系统提示',
|
title: "系统提示",
|
||||||
content: '真的要退出系统么?',
|
content: "真的要退出系统么?",
|
||||||
okText: '确认',
|
okText: "确认",
|
||||||
cancelText: '取消',
|
cancelText: "取消",
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
// 退出登录
|
// 退出登录
|
||||||
this.$store.dispatch('logOut').then(() => {
|
this.$store.dispatch("logOut").then(() => {
|
||||||
this.$notification.success({
|
this.$notification.success({
|
||||||
message: '退出登录成功',
|
message: "退出登录成功",
|
||||||
duration: 2
|
duration: 2,
|
||||||
});
|
});
|
||||||
this.$router.push('/login');
|
this.$router.push("/login");
|
||||||
resolve();
|
resolve();
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 加载修改密码对话框
|
// 加载修改密码对话框
|
||||||
@ -151,99 +147,104 @@ export default {
|
|||||||
// 修改密码
|
// 修改密码
|
||||||
handleUpdatePwdOk() {
|
handleUpdatePwdOk() {
|
||||||
// 检验表单
|
// 检验表单
|
||||||
this.$refs['pwdForm'].validate(valid => {
|
this.$refs["pwdForm"].validate((valid) => {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 判断两次新密码是否一致
|
// 判断两次新密码是否一致
|
||||||
if (this.temp.newPwd !== this.temp.confirmPwd) {
|
if (this.temp.newPwd !== this.temp.confirmPwd) {
|
||||||
this.$notification.error({
|
this.$notification.error({
|
||||||
message: '两次密码不一致...',
|
message: "两次密码不一致...",
|
||||||
duration: 2
|
duration: 2,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 提交修改
|
// 提交修改
|
||||||
const params = {
|
const params = {
|
||||||
oldPwd: sha1(this.temp.oldPwd),
|
oldPwd: sha1(this.temp.oldPwd),
|
||||||
newPwd: sha1(this.temp.newPwd)
|
newPwd: sha1(this.temp.newPwd),
|
||||||
}
|
};
|
||||||
updatePwd(params).then(res => {
|
updatePwd(params).then((res) => {
|
||||||
// 修改成功
|
// 修改成功
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
// 退出登录
|
// 退出登录
|
||||||
this.$store.dispatch('logOut').then(() => {
|
this.$store.dispatch("logOut").then(() => {
|
||||||
this.$notification.success({
|
this.$notification.success({
|
||||||
message: res.msg,
|
message: res.msg,
|
||||||
duration: 2
|
duration: 2,
|
||||||
});
|
});
|
||||||
this.$refs['pwdForm'].resetFields();
|
this.$refs["pwdForm"].resetFields();
|
||||||
this.updateNameVisible = false;
|
this.updateNameVisible = false;
|
||||||
this.$router.push('/login');
|
this.$router.push("/login");
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
// 加载修改用户资料对话框
|
// 加载修改用户资料对话框
|
||||||
handleUpdateUser() {
|
handleUpdateUser() {
|
||||||
this.temp = {...this.getUserInfo};
|
this.temp = { ...this.getUserInfo };
|
||||||
this.temp.token = this.getToken;
|
this.temp.token = this.getToken;
|
||||||
this.updateUserVisible = true;
|
getUserInfo().then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.temp.md5Token = res.data.md5Token;
|
||||||
|
this.updateUserVisible = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// 发送邮箱验证码
|
// 发送邮箱验证码
|
||||||
sendEmailCode() {
|
sendEmailCode() {
|
||||||
if (!this.temp.email) {
|
if (!this.temp.email) {
|
||||||
this.$notification.error({
|
this.$notification.error({
|
||||||
message: '请输入邮箱地址',
|
message: "请输入邮箱地址",
|
||||||
duration: 2
|
duration: 2,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sendEmailCode(this.temp.email).then(res => {
|
sendEmailCode(this.temp.email).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.$notification.success({
|
this.$notification.success({
|
||||||
message: res.msg,
|
message: res.msg,
|
||||||
duration: 2
|
duration: 2,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
// 修改用户资料
|
// 修改用户资料
|
||||||
handleUpdateUserOk() {
|
handleUpdateUserOk() {
|
||||||
// 检验表单
|
// 检验表单
|
||||||
this.$refs['userForm'].validate(valid => {
|
this.$refs["userForm"].validate((valid) => {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
editUserInfo(this.temp).then(res => {
|
editUserInfo(this.temp).then((res) => {
|
||||||
// 修改成功
|
// 修改成功
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.$notification.success({
|
this.$notification.success({
|
||||||
message: res.msg,
|
message: res.msg,
|
||||||
duration: 2
|
duration: 2,
|
||||||
});
|
});
|
||||||
// 清空表单校验
|
// 清空表单校验
|
||||||
this.$refs['userForm'].resetFields();
|
this.$refs["userForm"].resetFields();
|
||||||
this.updateUserVisible = false;
|
this.updateUserVisible = false;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
// 关闭 tabs
|
// 关闭 tabs
|
||||||
closeTabs() {
|
closeTabs() {
|
||||||
this.$notification.success({
|
this.$notification.success({
|
||||||
message: '操作成功',
|
message: "操作成功",
|
||||||
top: '100px',
|
top: "100px",
|
||||||
duration: 1
|
duration: 1,
|
||||||
});
|
});
|
||||||
this.$store.dispatch('clearTabs');
|
this.$store.dispatch("clearTabs");
|
||||||
},
|
},
|
||||||
// toOldIndex() {
|
// toOldIndex() {
|
||||||
// window.location.href = '/old.html'
|
// window.location.href = '/old.html'
|
||||||
// }
|
// }
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.user-header {
|
.user-header {
|
||||||
@ -256,4 +257,4 @@ export default {
|
|||||||
.close-all {
|
.close-all {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user