mirror of
https://github.com/dataease/dataease.git
synced 2026-06-16 20:42:07 +08:00
feat(移动端): 移动端支持改密 #18143
This commit is contained in:
@@ -744,6 +744,9 @@ export default {
|
||||
to_delete_variable: 'Are you sure you want to delete {0}?'
|
||||
},
|
||||
user: {
|
||||
my: 'My',
|
||||
switch_organization: 'Switch Organization',
|
||||
logout: 'Logout',
|
||||
change_password: 'Change Password',
|
||||
select_users: 'Please select a user',
|
||||
account: 'Account',
|
||||
|
||||
@@ -719,6 +719,9 @@ export default {
|
||||
to_delete_variable: '確定刪除 {0} 嗎?'
|
||||
},
|
||||
user: {
|
||||
my: '我的',
|
||||
switch_organization: '切換組織',
|
||||
logout: '登出',
|
||||
change_password: '修改密碼',
|
||||
select_users: '請選擇使用者',
|
||||
account: '帳號',
|
||||
|
||||
@@ -722,6 +722,9 @@ export default {
|
||||
to_delete_variable: '确定删除 {0} 吗?'
|
||||
},
|
||||
user: {
|
||||
my: '我的',
|
||||
switch_organization: '切换组织',
|
||||
logout: '注销',
|
||||
change_password: '修改密码',
|
||||
select_users: '请选择用户',
|
||||
account: '账号',
|
||||
|
||||
@@ -8,10 +8,13 @@ import OrgCell from '@/views/mobile/components/OrgCell.vue'
|
||||
import { useRouter } from 'vue-router_2'
|
||||
import { logoutApi } from '@/api/login'
|
||||
import { logoutHandler } from '@/utils/logout'
|
||||
import UpdatePwd from '@/views/system/modify-pwd/UpdatePwd.vue'
|
||||
import VanPopup from 'vant/es/popup'
|
||||
import VanNavBar from 'vant/es/nav-bar'
|
||||
import VanImage from 'vant/es/image'
|
||||
import 'vant/es/image/style'
|
||||
import 'vant/es/nav-bar/style'
|
||||
import 'vant/es/popup/style'
|
||||
|
||||
interface OrgTreeNode {
|
||||
id: string | number
|
||||
@@ -157,12 +160,18 @@ const dfsTree = (ids, arr) => {
|
||||
const activeTableData = computed(() => {
|
||||
return directId.value.length ? dfsTree([...directId.value], tableData.value) : tableData.value
|
||||
})
|
||||
|
||||
const showPwd = ref(false)
|
||||
const success = () => {
|
||||
showPwd.value = false
|
||||
logout()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="de-mobile-user">
|
||||
<template v-if="showNavBar">
|
||||
<div class="logout flex-center" style="padding-top: 8px; margin: 0">我的</div>
|
||||
<div class="logout flex-center" style="padding-top: 8px; margin: 0">{{ $t('user.my') }}</div>
|
||||
<div class="mobile-user-top">
|
||||
<van-image round width="48" height="48" :src="userImg" />
|
||||
<div class="user-name">
|
||||
@@ -171,12 +180,18 @@ const activeTableData = computed(() => {
|
||||
</div>
|
||||
<OrgCell
|
||||
@click="orgClick"
|
||||
label="切换组织"
|
||||
:label="$t('user.switch_organization')"
|
||||
prefix-icon="icon_switch_outlined"
|
||||
:tips="name"
|
||||
nextlevel
|
||||
></OrgCell>
|
||||
<div class="logout flex-center danger" @click="logout">注销</div>
|
||||
<div class="logout flex-center" @click="showPwd = true">{{ $t('user.change_password') }}</div>
|
||||
<div class="logout flex-center danger" @click="logout">{{ $t('user.logout') }}</div>
|
||||
<van-popup teleport="body" position="bottom" v-model:show="showPwd">
|
||||
<div style="padding: 0 24px 24px">
|
||||
<update-pwd @success="success" />
|
||||
</div>
|
||||
</van-popup>
|
||||
</template>
|
||||
<template v-else>
|
||||
<van-nav-bar
|
||||
|
||||
@@ -7,6 +7,7 @@ import { rsaEncryp } from '@/utils/encryption'
|
||||
import { ElMessage } from 'element-plus-secondary'
|
||||
import { logoutHandler } from '@/utils/logout'
|
||||
import { CustomPassword } from '@/components/custom-password'
|
||||
import { isMobile } from '@/utils/utils'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -79,12 +80,19 @@ const rule = {
|
||||
}
|
||||
const updatePwdForm = ref()
|
||||
|
||||
const emits = defineEmits(['success'])
|
||||
|
||||
const save = () => {
|
||||
updatePwdForm.value.validate(val => {
|
||||
if (val) {
|
||||
const pwd = rsaEncryp(pwdForm.pwd)
|
||||
const newPwd = rsaEncryp(pwdForm.newPwd)
|
||||
request.post({ url: '/user/modifyPwd', data: { pwd, newPwd } }).then(() => {
|
||||
if (isMobile()) {
|
||||
emits('success')
|
||||
return
|
||||
}
|
||||
|
||||
ElMessage.success(t('system.log_in_again'))
|
||||
logoutHandler()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user