perf: 对话日志修改内容改为markdown编辑器
This commit is contained in:
parent
d6c369553f
commit
ba1f0b557e
@ -6,7 +6,7 @@
|
|||||||
:model="resetPasswordForm"
|
:model="resetPasswordForm"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
>
|
>
|
||||||
<p class="mb-8 lighter">{{ $t("layout.topbar.avatar.dialog.newPassword") }}</p>
|
<p class="mb-8 lighter">{{ $t('layout.topbar.avatar.dialog.newPassword') }}</p>
|
||||||
<el-form-item prop="password" style="margin-bottom: 8px">
|
<el-form-item prop="password" style="margin-bottom: 8px">
|
||||||
<el-input
|
<el-input
|
||||||
type="password"
|
type="password"
|
||||||
@ -27,7 +27,7 @@
|
|||||||
>
|
>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<p class="mb-8 lighter">{{ $t("layout.topbar.avatar.dialog.useEmail") }}</p>
|
<p class="mb-8 lighter">{{ $t('layout.topbar.avatar.dialog.useEmail') }}</p>
|
||||||
<el-form-item style="margin-bottom: 8px">
|
<el-form-item style="margin-bottom: 8px">
|
||||||
<el-input
|
<el-input
|
||||||
class="input-item"
|
class="input-item"
|
||||||
@ -39,7 +39,11 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="code">
|
<el-form-item prop="code">
|
||||||
<div class="flex-between w-full">
|
<div class="flex-between w-full">
|
||||||
<el-input class="code-input" v-model="resetPasswordForm.code" :placeholder="$t('layout.topbar.avatar.dialog.enterVerificationCode')">
|
<el-input
|
||||||
|
class="code-input"
|
||||||
|
v-model="resetPasswordForm.code"
|
||||||
|
:placeholder="$t('layout.topbar.avatar.dialog.enterVerificationCode')"
|
||||||
|
>
|
||||||
</el-input>
|
</el-input>
|
||||||
<el-button
|
<el-button
|
||||||
:disabled="isDisabled"
|
:disabled="isDisabled"
|
||||||
@ -47,15 +51,23 @@
|
|||||||
@click="sendEmail"
|
@click="sendEmail"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
>
|
>
|
||||||
{{ isDisabled ? $t('layout.topbar.avatar.dialog.resend', { time }) : $t('layout.topbar.avatar.dialog.getVerificationCode') }}
|
{{
|
||||||
|
isDisabled
|
||||||
|
? $t('layout.topbar.avatar.dialog.resend', { time })
|
||||||
|
: $t('layout.topbar.avatar.dialog.getVerificationCode')
|
||||||
|
}}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button @click="resetPasswordDialog = false">{{ $t('layout.topbar.avatar.dialog.cancel') }}</el-button>
|
<el-button @click="resetPasswordDialog = false">{{
|
||||||
<el-button type="primary" @click="resetPassword"> {{ $t('layout.topbar.avatar.dialog.save') }} </el-button>
|
$t('layout.topbar.avatar.dialog.cancel')
|
||||||
|
}}</el-button>
|
||||||
|
<el-button type="primary" @click="resetPassword">
|
||||||
|
{{ $t('layout.topbar.avatar.dialog.save') }}
|
||||||
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -88,7 +100,13 @@ const time = ref<number>(60)
|
|||||||
|
|
||||||
const rules = ref<FormRules<ResetCurrentUserPasswordRequest>>({
|
const rules = ref<FormRules<ResetCurrentUserPasswordRequest>>({
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
code: [{ required: true, message: t('layout.topbar.avatar.dialog.enterVerificationCode'), trigger: 'blur' }],
|
code: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t('layout.topbar.avatar.dialog.enterVerificationCode'),
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
password: [
|
password: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
@ -131,7 +149,7 @@ const rules = ref<FormRules<ResetCurrentUserPasswordRequest>>({
|
|||||||
*/
|
*/
|
||||||
const sendEmail = () => {
|
const sendEmail = () => {
|
||||||
UserApi.sendEmailToCurrent(loading).then(() => {
|
UserApi.sendEmailToCurrent(loading).then(() => {
|
||||||
MsgSuccess(t('verificationCodeSentSuccess'))
|
MsgSuccess(t('layout.topbar.avatar.dialog.verificationCodeSentSuccess'))
|
||||||
isDisabled.value = true
|
isDisabled.value = true
|
||||||
handleTimeChange()
|
handleTimeChange()
|
||||||
})
|
})
|
||||||
@ -176,7 +194,5 @@ const close = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ open, close })
|
defineExpose({ open, close })
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scope></style>
|
<style lang="scss" scope></style>
|
||||||
|
|||||||
@ -18,15 +18,20 @@
|
|||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="内容" prop="content">
|
<el-form-item label="内容" prop="content">
|
||||||
<el-input
|
<MdEditor
|
||||||
v-model="form.content"
|
v-model="form.content"
|
||||||
placeholder="请输入内容"
|
placeholder="请输入内容"
|
||||||
maxlength="100000"
|
:maxLength="100000"
|
||||||
show-word-limit
|
:preview="false"
|
||||||
:rows="8"
|
:toolbars="toolbars"
|
||||||
type="textarea"
|
style="height: 300px"
|
||||||
|
@onUploadImg="onUploadImg"
|
||||||
|
:footers="footers"
|
||||||
>
|
>
|
||||||
</el-input>
|
<template #defFooters>
|
||||||
|
<span style="margin-left: -6px">/ 100000</span>
|
||||||
|
</template>
|
||||||
|
</MdEditor>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="标题">
|
<el-form-item label="标题">
|
||||||
<el-input
|
<el-input
|
||||||
@ -99,6 +104,7 @@ import { ref, watch, reactive } from 'vue'
|
|||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import type { FormInstance, FormRules } from 'element-plus'
|
import type { FormInstance, FormRules } from 'element-plus'
|
||||||
import logApi from '@/api/log'
|
import logApi from '@/api/log'
|
||||||
|
import imageApi from '@/api/image'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
|
|
||||||
const { application, document } = useStore()
|
const { application, document } = useStore()
|
||||||
@ -111,6 +117,38 @@ const {
|
|||||||
const emit = defineEmits(['refresh'])
|
const emit = defineEmits(['refresh'])
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
|
|
||||||
|
const toolbars = [
|
||||||
|
'bold',
|
||||||
|
'underline',
|
||||||
|
'italic',
|
||||||
|
'-',
|
||||||
|
'title',
|
||||||
|
'strikeThrough',
|
||||||
|
'sub',
|
||||||
|
'sup',
|
||||||
|
'quote',
|
||||||
|
'unorderedList',
|
||||||
|
'orderedList',
|
||||||
|
'task',
|
||||||
|
'-',
|
||||||
|
'codeRow',
|
||||||
|
'code',
|
||||||
|
'link',
|
||||||
|
'image',
|
||||||
|
'table',
|
||||||
|
'mermaid',
|
||||||
|
'katex',
|
||||||
|
'-',
|
||||||
|
'revoke',
|
||||||
|
'next',
|
||||||
|
'=',
|
||||||
|
'pageFullscreen',
|
||||||
|
'preview',
|
||||||
|
'htmlPreview'
|
||||||
|
] as any[]
|
||||||
|
|
||||||
|
const footers = ['markdownTotal', 0, '=', 1, 'scrollSwitch']
|
||||||
|
|
||||||
const dialogVisible = ref<boolean>(false)
|
const dialogVisible = ref<boolean>(false)
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
@ -151,6 +189,26 @@ watch(dialogVisible, (bool) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const onUploadImg = async (files: any, callback: any) => {
|
||||||
|
const res = await Promise.all(
|
||||||
|
files.map((file: any) => {
|
||||||
|
return new Promise((rev, rej) => {
|
||||||
|
const fd = new FormData()
|
||||||
|
fd.append('file', file)
|
||||||
|
|
||||||
|
imageApi
|
||||||
|
.postImage(fd)
|
||||||
|
.then((res: any) => {
|
||||||
|
rev(res)
|
||||||
|
})
|
||||||
|
.catch((error) => rej(error))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
callback(res.map((item) => item.data))
|
||||||
|
}
|
||||||
|
|
||||||
function changeDataset(id: string) {
|
function changeDataset(id: string) {
|
||||||
form.value.document_id = ''
|
form.value.document_id = ''
|
||||||
getDocument(id)
|
getDocument(id)
|
||||||
|
|||||||
@ -170,7 +170,7 @@ const model_form_field = ref<Array<FormField>>([])
|
|||||||
const dialogVisible = ref<boolean>(false)
|
const dialogVisible = ref<boolean>(false)
|
||||||
|
|
||||||
const base_form_data_rule = ref<FormRules>({
|
const base_form_data_rule = ref<FormRules>({
|
||||||
name: { required: true, trigger: 'blur', message: '模型名不能为空' },
|
name: { required: true, trigger: 'blur', message: '模型名称不能为空' },
|
||||||
permission_type: { required: true, trigger: 'change', message: '权限不能为空' },
|
permission_type: { required: true, trigger: 'change', message: '权限不能为空' },
|
||||||
model_type: { required: true, trigger: 'change', message: '模型类型不能为空' },
|
model_type: { required: true, trigger: 'change', message: '模型类型不能为空' },
|
||||||
model_name: { required: true, trigger: 'change', message: '基础模型不能为空' }
|
model_name: { required: true, trigger: 'change', message: '基础模型不能为空' }
|
||||||
|
|||||||
@ -164,7 +164,7 @@ const model_form_field = ref<Array<FormField>>([])
|
|||||||
const dialogVisible = ref<boolean>(false)
|
const dialogVisible = ref<boolean>(false)
|
||||||
|
|
||||||
const base_form_data_rule = ref<FormRules>({
|
const base_form_data_rule = ref<FormRules>({
|
||||||
name: { required: true, trigger: 'blur', message: '模型名不能为空' },
|
name: { required: true, trigger: 'blur', message: '模型名称不能为空' },
|
||||||
model_type: { required: true, trigger: 'change', message: '模型类型不能为空' },
|
model_type: { required: true, trigger: 'change', message: '模型类型不能为空' },
|
||||||
model_name: { required: true, trigger: 'change', message: '基础模型不能为空' }
|
model_name: { required: true, trigger: 'change', message: '基础模型不能为空' }
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user