mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 22:18:07 +08:00
feat: mysql root 密码增加随机和复制按钮 (#556)
This commit is contained in:
parent
188a3e0ac5
commit
8603d4347b
@ -7,7 +7,12 @@
|
|||||||
<el-row type="flex" justify="center">
|
<el-row type="flex" justify="center">
|
||||||
<el-col :span="22">
|
<el-col :span="22">
|
||||||
<el-form-item :label="$t('database.rootPassword')" :rules="Rules.requiredInput" prop="password">
|
<el-form-item :label="$t('database.rootPassword')" :rules="Rules.requiredInput" prop="password">
|
||||||
<el-input type="password" show-password clearable v-model="form.password" />
|
<el-input type="password" show-password clearable v-model="form.password">
|
||||||
|
<template #append>
|
||||||
|
<el-button @click="copy" icon="DocumentCopy"></el-button>
|
||||||
|
<el-button style="margin-left: 1px" @click="random" icon="RefreshRight"></el-button>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -38,6 +43,7 @@ import ConfirmDialog from '@/components/confirm-dialog/index.vue';
|
|||||||
import { GetAppPassword } from '@/api/modules/app';
|
import { GetAppPassword } from '@/api/modules/app';
|
||||||
import DrawerHeader from '@/components/drawer-header/index.vue';
|
import DrawerHeader from '@/components/drawer-header/index.vue';
|
||||||
import { MsgSuccess } from '@/utils/message';
|
import { MsgSuccess } from '@/utils/message';
|
||||||
|
import { getRandomStr } from '@/utils/util';
|
||||||
|
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
|
||||||
@ -57,6 +63,20 @@ const acceptParams = (): void => {
|
|||||||
dialogVisiable.value = true;
|
dialogVisiable.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const random = async () => {
|
||||||
|
form.password = getRandomStr(16);
|
||||||
|
};
|
||||||
|
|
||||||
|
const copy = async () => {
|
||||||
|
let input = document.createElement('input');
|
||||||
|
input.value = form.password;
|
||||||
|
document.body.appendChild(input);
|
||||||
|
input.select();
|
||||||
|
document.execCommand('Copy');
|
||||||
|
document.body.removeChild(input);
|
||||||
|
MsgSuccess(i18n.global.t('commons.msg.copySuccess'));
|
||||||
|
};
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
dialogVisiable.value = false;
|
dialogVisiable.value = false;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user