fix: 系统配置中新增短信配置窗口
This commit is contained in:
parent
54f8671899
commit
572f494a88
@ -1,7 +1,7 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
export const getSystemSettingsTabsApi = (params: any): Promise<IResponse> => {
|
||||
return request.get({ url: '/vadmin/system/settings/tabs', params })
|
||||
export const getSystemSettingsTabsApi = (data: any): Promise<IResponse> => {
|
||||
return request.post({ url: '/vadmin/system/settings/tabs', data })
|
||||
}
|
||||
|
||||
export const getSystemSettingsApi = (params: any): Promise<IResponse> => {
|
||||
|
@ -239,7 +239,7 @@ const save = async () => {
|
||||
const emit = defineEmits(['updateDictTypeId'])
|
||||
|
||||
const handleCurrentChange = async (val: any | undefined) => {
|
||||
emit('updateDictTypeId', val.id)
|
||||
emit('updateDictTypeId', val ? val.id : val)
|
||||
}
|
||||
|
||||
const clearCurrentRow = async () => {
|
||||
|
@ -6,6 +6,7 @@ import Privacy from './components/Privacy.vue'
|
||||
import Agreement from './components/Agreement.vue'
|
||||
import WXClient from './components/WechatServer.vue'
|
||||
import Email from './components/Email.vue'
|
||||
import SMS from './components/SMS.vue'
|
||||
import { ContentWrap } from '@/components/ContentWrap'
|
||||
import { getSystemSettingsTabsApi } from '@/api/vadmin/system/settings'
|
||||
|
||||
@ -18,7 +19,7 @@ const activeName = ref('web_basic')
|
||||
const tabs = ref([] as Recordable[])
|
||||
|
||||
const getList = async () => {
|
||||
const res = await getSystemSettingsTabsApi({ classify: 'web' })
|
||||
const res = await getSystemSettingsTabsApi(['web', 'aliyun'])
|
||||
if (res) {
|
||||
tabs.value = res.data
|
||||
}
|
||||
@ -37,6 +38,7 @@ getList()
|
||||
<Agreement v-else-if="item.tab_name === 'web_agreement'" :tab-id="item.id" />
|
||||
<WXClient v-else-if="item.tab_name === 'wx_server'" :tab-id="item.id" />
|
||||
<Email v-else-if="item.tab_name === 'web_email'" :tab-id="item.id" />
|
||||
<SMS v-else-if="item.tab_name === 'aliyun_sms'" :tab-id="item.id" />
|
||||
</ElTabPane>
|
||||
</template>
|
||||
</ElTabs>
|
||||
|
197
kinit-admin/src/views/Vadmin/System/Settings/components/SMS.vue
Normal file
197
kinit-admin/src/views/Vadmin/System/Settings/components/SMS.vue
Normal file
@ -0,0 +1,197 @@
|
||||
<script setup lang="tsx">
|
||||
import { Form, FormSchema } from '@/components/Form'
|
||||
import { useForm } from '@/hooks/web/useForm'
|
||||
import { ElButton } from 'element-plus'
|
||||
import { getSystemSettingsApi, putSystemSettingsApi } from '@/api/vadmin/system/settings'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
import { useValidator } from '@/hooks/web/useValidator'
|
||||
|
||||
const { required } = useValidator()
|
||||
|
||||
const props = defineProps({
|
||||
tabId: propTypes.number
|
||||
})
|
||||
|
||||
const formSchema = reactive<FormSchema[]>([
|
||||
{
|
||||
field: 'sms_access_key',
|
||||
label: 'AccessKey',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
style: {
|
||||
width: '500px'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'sms_access_key_secret',
|
||||
label: 'AccessKeySecret',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
style: {
|
||||
width: '500px'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'sms_sign_name_1',
|
||||
label: '短信验证码签名',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
style: {
|
||||
width: '500px'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'sms_template_code_1',
|
||||
label: '短信验证码模板',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
style: {
|
||||
width: '500px'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'sms_sign_name_2',
|
||||
label: '重置密码签名',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
style: {
|
||||
width: '500px'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'sms_template_code_2',
|
||||
label: '重置密码模板',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
style: {
|
||||
width: '500px'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'sms_send_interval',
|
||||
label: '发送频率',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
style: {
|
||||
width: '500px'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'sms_valid_time',
|
||||
label: '有效时间',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
style: {
|
||||
width: '500px'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'active',
|
||||
label: '',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
formItemProps: {
|
||||
slots: {
|
||||
default: () => {
|
||||
return (
|
||||
<>
|
||||
<ElButton loading={loading.value} type="primary" onClick={save}>
|
||||
立即提交
|
||||
</ElButton>
|
||||
</>
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
const rules = reactive({
|
||||
sms_access_key: [required()],
|
||||
sms_access_key_secret: [required()],
|
||||
sms_send_interval: [required()],
|
||||
sms_valid_time: [required()]
|
||||
})
|
||||
|
||||
const { formRegister, formMethods } = useForm()
|
||||
const { setValues, getFormData, getElFormExpose } = formMethods
|
||||
|
||||
let formData = ref({} as Recordable)
|
||||
|
||||
const getData = async () => {
|
||||
const res = await getSystemSettingsApi({ tab_id: props.tabId })
|
||||
if (res) {
|
||||
await setValues(res.data)
|
||||
formData.value = res.data
|
||||
const elForm = await getElFormExpose()
|
||||
elForm?.clearValidate()
|
||||
}
|
||||
}
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const save = async () => {
|
||||
const elForm = await getElFormExpose()
|
||||
const valid = await elForm?.validate()
|
||||
if (valid) {
|
||||
const formData = await getFormData()
|
||||
loading.value = true
|
||||
if (!formData) {
|
||||
loading.value = false
|
||||
return ElMessage.error('未获取到数据')
|
||||
}
|
||||
try {
|
||||
const res = await putSystemSettingsApi(formData)
|
||||
if (res) {
|
||||
getData()
|
||||
return ElMessage.success('更新成功')
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getData()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||
</template>
|
||||
|
||||
<style lang="less"></style>
|
@ -11,7 +11,7 @@ from fastapi.security import OAuth2PasswordBearer
|
||||
"""
|
||||
系统版本
|
||||
"""
|
||||
VERSION = "3.1.0"
|
||||
VERSION = "3.2.0"
|
||||
|
||||
"""安全警告: 不要在生产中打开调试运行!"""
|
||||
DEBUG = False
|
||||
@ -24,6 +24,7 @@ DEMO_WHITE_LIST_PATH = [
|
||||
"/auth/token/refresh",
|
||||
"/auth/wx/login",
|
||||
"/vadmin/system/dict/types/details",
|
||||
"/vadmin/system/settings/tabs",
|
||||
"/vadmin/resource/images",
|
||||
"/vadmin/auth/user/export/query/list/to/excel"
|
||||
]
|
||||
|
@ -145,9 +145,9 @@ async def sms_send(telephone: str, rd: Redis = Depends(redis_getter), auth: Auth
|
||||
###########################################################
|
||||
# 系统配置管理
|
||||
###########################################################
|
||||
@app.get("/settings/tabs", summary="获取系统配置标签列表")
|
||||
async def get_settings_tabs(classify: str, auth: Auth = Depends(FullAdminAuth())):
|
||||
return SuccessResponse(await crud.SettingsTabDal(auth.db).get_datas(limit=0, classify=classify))
|
||||
@app.post("/settings/tabs", summary="获取系统配置标签列表")
|
||||
async def get_settings_tabs(classifys: list[str] = Body(...), auth: Auth = Depends(FullAdminAuth())):
|
||||
return SuccessResponse(await crud.SettingsTabDal(auth.db).get_datas(limit=0, classify=("in", classifys)))
|
||||
|
||||
|
||||
@app.get("/settings/tabs/values", summary="获取系统配置标签下的信息")
|
||||
|
@ -87,6 +87,8 @@ def register_exception(app: FastAPI):
|
||||
msg = f"类型错误,提交参数应该为整数!"
|
||||
elif msg == "value could not be parsed to a boolean":
|
||||
msg = f"类型错误,提交参数应该为布尔值!"
|
||||
elif msg == "Input should be a valid list":
|
||||
msg = f"类型错误,输入应该是一个有效的列表!"
|
||||
return JSONResponse(
|
||||
status_code=200,
|
||||
content=jsonable_encoder(
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user