mirror of
https://github.com/yangjian102621/geekai.git
synced 2026-04-23 03:24:34 +08:00
验证码配置重构完成
This commit is contained in:
@@ -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 === '') {
|
||||
|
||||
@@ -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('操作成功!')
|
||||
})
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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('操作成功!')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user