Merge branch 'main' of github.com:maxkb-dev/maxkb

This commit is contained in:
shaohuzhang1 2024-02-29 15:18:31 +08:00
commit 699cc0b084
6 changed files with 66 additions and 9 deletions

View File

@ -1,7 +1,7 @@
<template>
<el-row class="not-found-container">
<el-col class="img" :span="12"> </el-col>
<el-col class="message-container" :span="12">
<el-col class="img" :xs="0" :sm="0" :md="12" :lg="12" :xl="12"> </el-col>
<el-col class="message-container" :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
<div class="title">404</div>
<div class="message">很抱歉无法访问应用</div>
<!-- <div class="operate"><el-button type="primary" @click="router.push('/')">返回首页</el-button></div> -->
@ -41,4 +41,9 @@ const router = useRouter()
}
}
}
@media only screen and (max-width: 1000px) {
.not-found-container .message-container {
text-align: center;
}
}
</style>

View File

@ -67,6 +67,11 @@
/>
</el-form-item>
<el-form-item label="AI 模型" prop="model_id">
<template #label>
<div class="flex-between">
<span>AI 模型 <span class="danger">*</span></span>
</div>
</template>
<el-select
v-model="applicationForm.model_id"
placeholder="请选择 AI 模型"
@ -367,7 +372,7 @@ const applicationForm = ref<ApplicationFormType>({
max_paragraph_char_number: 5000
},
model_setting: {
prompt: ''
prompt: defaultPrompt
},
problem_optimization: false
})

View File

@ -118,8 +118,8 @@ async function submit() {
detail.value.type === '1'
? {
application_id_list: application_id_list.value,
...BaseFormRef.value.form,
...form.value
meta: form.value,
...BaseFormRef.value.form
}
: {
application_id_list: application_id_list.value,

View File

@ -31,6 +31,7 @@
</template>
<script setup lang="ts">
import { ref, reactive, onMounted, onUnmounted, computed, watch } from 'vue'
import { useRoute } from 'vue-router'
import useStore from '@/stores'
import type { datasetData } from '@/api/type/dataset'
import { isAllPropertiesEmpty } from '@/utils/utils'
@ -41,6 +42,11 @@ const props = defineProps({
default: () => {}
}
})
const route = useRoute()
const {
params: { type }
} = route
const isCreate = type === 'create'
const { dataset } = useStore()
const baseInfo = computed(() => dataset.baseInfo)
const form = ref<datasetData>({
@ -57,6 +63,7 @@ const FormRef = ref()
watch(
() => props.data,
(value) => {
console.log(value)
if (value && JSON.stringify(value) !== '{}') {
form.value.name = value.name
form.value.desc = value.desc
@ -71,7 +78,9 @@ watch(form.value, (value) => {
if (isAllPropertiesEmpty(value)) {
dataset.saveBaseInfo(null)
} else {
dataset.saveBaseInfo(value)
if (isCreate) {
dataset.saveBaseInfo(value)
}
}
})

View File

@ -29,13 +29,15 @@
placeholder="请输入验证码"
>
</el-input>
<el-button
:disabled="CheckEmailForm.email"
:disabled="isDisabled"
size="large"
class="send-email-button ml-12"
@click="sendEmail"
:loading="loading"
>获取验证码</el-button
>
{{ isDisabled ? `重新发送(${time}s` : '获取验证码' }}</el-button
>
</div>
</el-form-item>
@ -90,6 +92,8 @@ const rules = ref<FormRules<CheckCodeRequest>>({
code: [{ required: true, message: '请输入验证码' }]
})
const loading = ref<boolean>(false)
const isDisabled = ref<boolean>(false)
const time = ref<number>(60)
const checkCode = () => {
resetPasswordFormRef.value
@ -109,5 +113,16 @@ const sendEmail = () => {
}
})
}
const handleTimeChange = () => {
if (time.value <= 0) {
isDisabled.value = false
time.value = 60
} else {
setTimeout(() => {
time.value--
handleTimeChange()
}, 1000)
}
}
</script>
<style lang="scss" scope></style>

View File

@ -62,11 +62,13 @@
>
</el-input>
<el-button
:disabled="isDisabled"
size="large"
class="send-email-button ml-12"
@click="sendEmail"
:loading="sendEmailLoading"
>获取验证码</el-button
>
{{ isDisabled ? `重新发送(${time}s` : '获取验证码' }}</el-button
>
</div>
</el-form-item>
@ -110,6 +112,12 @@ const rules = ref<FormRules<RegisterRequest>>({
required: true,
message: '请输入用户名',
trigger: 'blur'
},
{
min: 6,
max: 20,
message: '长度在 6 到 20 个字符',
trigger: 'blur'
}
],
password: [
@ -177,6 +185,8 @@ const register = () => {
})
}
const sendEmailLoading = ref<boolean>(false)
const isDisabled = ref<boolean>(false)
const time = ref<number>(60)
/**
* 发送验证码
*/
@ -185,9 +195,22 @@ const sendEmail = () => {
if (v) {
UserApi.sendEmit(registerForm.value.email, 'register', sendEmailLoading).then(() => {
MsgSuccess('发送验证码成功')
isDisabled.value = true
handleTimeChange()
})
}
})
}
const handleTimeChange = () => {
if (time.value <= 0) {
isDisabled.value = false
time.value = 60
} else {
setTimeout(() => {
time.value--
handleTimeChange()
}, 1000)
}
}
</script>
<style lang="scss" scope></style>