验证码配置重构完成

This commit is contained in:
RockYang
2025-08-29 17:45:31 +08:00
parent 539e91c12e
commit 3a6f8ccc16
32 changed files with 272 additions and 248 deletions

View File

@@ -106,6 +106,7 @@
<div class="py-4">
<button
class="w-full py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-blue-600 hover:to-purple-700 transition-all duration-200 flex items-center justify-center space-x-2 text-base"
type="button"
@click="generate"
>
<i v-if="isGenerating" class="iconfont icon-loading animate-spin"></i>

View File

@@ -616,6 +616,7 @@
<button
class="px-10 py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-blue-600 hover:to-purple-700 transition-all duration-200 flex items-center justify-center space-x-2 text-base"
@click="generate"
type="button"
>
<i v-if="isGenerating" class="iconfont icon-loading animate-spin"></i>
<i v-else class="iconfont icon-chuangzuo"></i>

View File

@@ -304,6 +304,7 @@
<button
class="w-full py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-blue-600 hover:to-purple-700 transition-all duration-200 flex items-center justify-center space-x-2 text-base"
@click="generate"
type="button"
>
<i v-if="isGenerating" class="iconfont icon-loading animate-spin"></i>
<i v-else class="iconfont icon-chuangzuo"></i>

View File

@@ -312,6 +312,7 @@
@click="store.submitTask"
:disabled="store.submitting"
class="w-full py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-blue-600 hover:to-purple-700 transition-all duration-200 flex items-center justify-center space-x-2 text-base"
type="button"
>
<i v-if="store.submitting" class="iconfont icon-loading animate-spin"></i>
<i v-else class="iconfont icon-chuangzuo"></i>

View File

@@ -46,10 +46,13 @@
<div class="p-4">
<button
class="w-full py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-blue-600 hover:to-purple-700 transition-all duration-200 flex items-center justify-center space-x-2 text-base"
type="button"
@click="generateAI"
:loading="loading"
:disabled="loading"
>
生成思维导图
<i v-if="loading" class="iconfont icon-loading animate-spin"></i>
<i v-else class="iconfont icon-chuangzuo"></i>
<span>生成思维导图</span>
</button>
</div>
@@ -67,6 +70,7 @@
<button
class="w-full py-3 bg-gradient-to-r from-green-400 to-blue-500 text-white rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-green-500 hover:to-blue-600 transition-all duration-200 flex items-center justify-center space-x-2 text-base"
@click="generate"
type="button"
>
直接生成免费
</button>
@@ -140,10 +144,8 @@ onMounted(async () => {
if (cache) {
text.value = cache
} else {
const res = await getSystemInfo().catch((e) => {
ElMessage.error('获取系统配置失败:' + e.message)
})
text.value = res.data['mark_map_text']
const res = await httpGet('/api/config/get?key=mark_map')
text.value = res.data?.content || ''
content.value = text.value
}

View File

@@ -205,6 +205,7 @@
@click="store.create"
:disabled="store.loading"
class="w-full py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-blue-600 hover:to-purple-700 transition-all duration-200 flex items-center justify-center space-x-2"
type="button"
>
<i v-if="store.loading" class="iconfont icon-loading animate-spin"></i>
<i v-else class="iconfont icon-chuangzuo"></i>
@@ -245,6 +246,7 @@
<div class="w-full py-2">
<button
class="w-full py-3 bg-gradient-to-r from-orange-300 to-purple-500 text-white rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-orange-300 hover:to-red-500 transition-all duration-200 flex items-center justify-center space-x-2"
type="button"
>
<i class="iconfont icon-upload mr-2"></i>
<span>上传音乐</span>

View File

@@ -139,6 +139,7 @@
@click="store.createLumaVideo"
:disabled="store.generating"
class="w-full py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-blue-600 hover:to-purple-700 transition-all duration-200 flex items-center justify-center space-x-2 text-base"
type="button"
>
<i v-if="store.generating" class="iconfont icon-loading animate-spin"></i>
<i v-else class="iconfont icon-chuangzuo"></i>
@@ -457,6 +458,7 @@
@click="store.createKelingVideo"
:disabled="store.generating"
class="w-full py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-blue-600 hover:to-purple-700 transition-all duration-200 flex items-center justify-center space-x-2 text-base"
type="button"
>
<i v-if="store.generating" class="iconfont icon-loading animate-spin"></i>
<i v-else class="iconfont icon-chuangzuo"></i>

View File

@@ -80,22 +80,24 @@ const enableVerify = ref(false)
const captchaRef = ref(null)
const loading = ref(false)
checkAdminSession()
.then(() => {
router.push('/admin')
})
.catch(() => {})
onMounted(() => {
// 判断是否登录
checkAdminSession()
.then(() => {
router.push('/admin')
})
.catch(() => {})
// 加载系统配置
getSystemInfo()
.then((res) => {
title.value = res.data.admin_title
logo.value = res.data.logo
enableVerify.value = res.data['enabled_verify']
})
.catch((e) => {
ElMessage.error('加载系统配置失败: ' + e.message)
})
// 加载系统配置
getSystemInfo()
.then((res) => {
title.value = res.data.admin_title
logo.value = res.data.logo
})
.catch((e) => {
ElMessage.error('加载系统配置失败: ' + e.message)
})
})
const login = function () {
if (username.value === '') {

View File

@@ -1,18 +1,13 @@
<template>
<div class="agreement-config form" v-loading="loading">
<div class="container">
<h3>用户协议</h3>
<md-editor
class="mgb20"
v-model="agreement"
:theme="store.theme"
@on-upload-img="onUploadImg"
/>
<el-form-item>
<div style="padding-top: 10px; margin-left: 150px">
<el-button type="primary" @click="save">保存</el-button>
</div>
</el-form-item>
<div class="agreement-config container" v-loading="loading">
<md-editor
class="mgb20"
v-model="agreement"
:theme="store.theme"
@on-upload-img="onUploadImg"
/>
<div class="flex justify-center p-5">
<el-button type="primary" @click="save">保存</el-button>
</div>
</div>
</template>
@@ -43,7 +38,7 @@ onMounted(() => {
})
const save = () => {
httpPost('/api/admin/config/update/base', { mark_map_text: agreement.value })
httpPost('/api/admin/config/update/agreement', { content: agreement.value })
.then(() => {
ElMessage.success('操作成功!')
})

View File

@@ -1,56 +0,0 @@
<template>
<div class="form" v-loading="loading">
<el-form :model="api" label-width="140px">
<el-form-item label="API 网关"><el-input v-model="api.api_url" /></el-form-item>
<el-form-item label="AppId"><el-input v-model="api.app_id" /></el-form-item>
<el-form-item label="Token"><el-input v-model="api.token" type="password" /></el-form-item>
<el-divider>即梦 AI</el-divider>
<el-form-item label="AccessKey"
><el-input v-model="api.jimeng_config.access_key"
/></el-form-item>
<el-form-item label="SecretKey"
><el-input v-model="api.jimeng_config.secret_key"
/></el-form-item>
<el-form-item>
<el-button type="primary" @click="save">保存</el-button>
<el-button @click="test">测试</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script setup>
import { httpGet } from '@/utils/http'
import { ElMessage } from 'element-plus'
import { onMounted, ref } from 'vue'
const loading = ref(true)
const api = ref({
api_url: '',
app_id: '',
token: '',
jimeng_config: { access_key: '', secret_key: '' },
})
onMounted(() => {
httpGet('/api/admin/config/get?key=api')
.then((res) => (api.value = res.data || api.value))
.catch(() => {})
.finally(() => (loading.value = false))
})
const save = () => {
ElMessage.info('当前后端未提供 /api 配置的更新接口,已保留只读展示')
}
const test = () => {
ElMessage.info('请在对应服务端手动测试 API 可用性')
}
</script>
<style scoped>
.form {
padding: 10px 20px 40px 20px;
}
</style>

View File

@@ -90,18 +90,6 @@
<el-switch v-model="system['enabled_register']" />
</el-form-item>
<el-form-item>
<template #label>
<div class="label-title">
启用验证码
<span class="text-xs text-gray-500"
>启用验证码之后注册登录都会加载行为验证码增加安全性</span
>
</div>
</template>
<el-switch v-model="system['enabled_verify']" />
</el-form-item>
<el-form-item label="注册方式" prop="register_ways">
<el-checkbox-group v-model="system['register_ways']">
<el-checkbox value="mobile">手机注册</el-checkbox>

View File

@@ -1,45 +1,14 @@
<template>
<div class="markmap-config form" v-loading="loading">
<div class="container">
<h3>思维导图配置</h3>
<el-form
:model="system"
label-width="150px"
label-position="right"
ref="systemFormRef"
:rules="rules"
>
<el-form-item>
<template #label>
<div class="label-title">
思维导图默认文本
<el-tooltip
effect="dark"
content="用户访问思维导图页面时显示的默认文本内容,支持 Markdown 格式"
raw-content
placement="right"
>
<el-icon>
<InfoFilled />
</el-icon>
</el-tooltip>
</div>
</template>
<md-editor
class="mgb20"
:theme="store.theme"
v-model="system['mark_map_text']"
@on-upload-img="onUploadImg"
placeholder="请输入思维导图页面的默认文本内容,支持 Markdown 格式"
/>
</el-form-item>
<div class="container" v-loading="loading">
<md-editor
:theme="store.theme"
v-model="content"
@on-upload-img="onUploadImg"
placeholder="请输入思维导图页面的默认文本内容,支持 Markdown 格式"
/>
<div style="padding: 10px">
<el-form-item>
<el-button type="primary" @click="save">保存</el-button>
</el-form-item>
</div>
</el-form>
<div class="flex justify-center p-5">
<el-button type="primary" @click="save">保存</el-button>
</div>
</div>
</template>
@@ -47,26 +16,25 @@
<script setup>
import { useSharedStore } from '@/store/sharedata'
import { httpGet, httpPost } from '@/utils/http'
import { InfoFilled } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import MdEditor from 'md-editor-v3'
import 'md-editor-v3/lib/style.css'
import { onMounted, reactive, ref } from 'vue'
const system = ref({})
const content = ref('')
const loading = ref(true)
const systemFormRef = ref(null)
const store = useSharedStore()
onMounted(() => {
// 加载系统配置
httpGet('/api/admin/config/get?key=system')
httpGet('/api/admin/config/get?key=mark_map')
.then((res) => {
system.value = res.data
loading.value = false
content.value = res.data?.content || ''
})
.catch((e) => {
ElMessage.error('加载系统配置失败: ' + e.message)
})
.finally(() => {
loading.value = false
})
})
@@ -74,9 +42,8 @@ onMounted(() => {
const rules = reactive({})
const save = function () {
httpPost('/api/admin/config/update', {
key: 'system',
config: { mark_map_text: system.value.mark_map_text },
httpPost('/api/admin/config/update/mark_map', {
content: content.value,
})
.then(() => {
ElMessage.success('操作成功!')
@@ -111,8 +78,8 @@ const onUploadImg = (files, callback) => {
</script>
<style lang="scss" scoped>
@use '../../../assets/css/admin/form.scss' as *;
@use '../../../assets/css/main.scss' as *;
@use '@/assets/css/admin/form.scss' as *;
@use '@/assets/css/main.scss' as *;
.markmap-config {
display: flex;

View File

@@ -1,13 +1,8 @@
<template>
<div class="notice-config form" v-loading="loading">
<div class="container">
<h3>公告配置</h3>
<md-editor class="mgb20" v-model="notice" :theme="store.theme" @on-upload-img="onUploadImg" />
<el-form-item>
<div style="padding-top: 10px; margin-left: 150px">
<el-button type="primary" @click="save">保存</el-button>
</div>
</el-form-item>
<div class="notice-config container" v-loading="loading">
<md-editor class="mgb20" v-model="notice" :theme="store.theme" @on-upload-img="onUploadImg" />
<div class="flex justify-center p-5">
<el-button type="primary" @click="save">保存</el-button>
</div>
</div>
</template>

View File

@@ -1,18 +1,15 @@
<template>
<div class="privacy-config form" v-loading="loading">
<div class="privacy-config container" v-loading="loading">
<div class="container">
<h3>隐私声明</h3>
<md-editor
class="mgb20"
v-model="privacy"
:theme="store.theme"
@on-upload-img="onUploadImg"
/>
<el-form-item>
<div style="padding-top: 10px; margin-left: 150px">
<el-button type="primary" @click="save">保存</el-button>
</div>
</el-form-item>
<div class="flex justify-center p-5">
<el-button type="primary" @click="save">保存</el-button>
</div>
</div>
</div>
</template>
@@ -43,7 +40,7 @@ onMounted(() => {
})
const save = () => {
httpPost('/api/admin/config/update/notice', { content: privacy.value })
httpPost('/api/admin/config/update/privacy', { content: privacy.value })
.then(() => {
ElMessage.success('操作成功!')
})

View File

@@ -250,6 +250,7 @@
<div class="bg-white rounded-xl p-4 shadow-sm mb-3">
<button
class="w-full py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-blue-600 hover:to-purple-700 transition-all duration-200 flex items-center justify-center space-x-2 text-base"
type="button"
@click="jimengStore.submitTask"
:disabled="jimengStore.submitting"
>

View File

@@ -191,6 +191,7 @@
<button
@click="suno.create"
:disabled="suno.loading"
type="button"
class="w-full py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-blue-600 hover:to-purple-700 transition-all duration-200 flex items-center justify-center space-x-2"
>
<i v-if="suno.loading" class="iconfont icon-loading animate-spin"></i>

View File

@@ -186,6 +186,7 @@
<button
@click="video.createLumaVideo"
:disabled="video.generating"
type="button"
class="w-full py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-blue-600 hover:to-purple-700 transition-all duration-200 flex items-center justify-center space-x-2"
>
<i v-if="video.generating" class="iconfont icon-loading animate-spin"></i>
@@ -423,6 +424,7 @@
<button
@click="video.createKelingVideo"
:disabled="video.generating"
type="button"
class="w-full py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-blue-600 hover:to-purple-700 transition-all duration-200 flex items-center justify-center space-x-2"
>
<i v-if="video.generating" class="iconfont icon-loading animate-spin"></i>

View File

@@ -78,6 +78,7 @@
<button
@click="generate"
:disabled="loading"
type="button"
class="w-full py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white font-semibold rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-blue-600 hover:to-purple-700 transition-all duration-200 flex items-center justify-center space-x-2"
>
<i v-if="loading" class="iconfont icon-loading animate-spin"></i>

View File

@@ -195,6 +195,7 @@
<button
@click="generate"
:disabled="loading"
type="button"
class="w-full py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white font-semibold rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-blue-600 hover:to-purple-700 transition-all duration-200 flex items-center justify-center space-x-2"
>
<i v-if="loading" class="iconfont icon-loading animate-spin"></i>

View File

@@ -134,6 +134,7 @@
<button
@click="generate"
:disabled="loading"
type="button"
class="w-full py-3 bg-gradient-to-r from-blue-500 to-purple-600 text-white font-semibold rounded-xl disabled:from-gray-400 disabled:to-gray-400 disabled:cursor-not-allowed hover:from-blue-600 hover:to-purple-700 transition-all duration-200 flex items-center justify-center space-x-2"
>
<i v-if="loading" class="iconfont icon-loading animate-spin"></i>