This commit is contained in:
孟帅
2023-12-29 20:08:00 +08:00
parent c68004b6da
commit b54055810b
52 changed files with 1468 additions and 1325 deletions

View File

@@ -12,15 +12,23 @@
</n-form-item>
<n-form-item label="提现最低手续费(元)" path="cashMinFee">
<n-input placeholder="" v-model:value="formValue.cashMinFee" />
<n-input-number placeholder="" v-model:value="formValue.cashMinFee" style="width: 100%" />
</n-form-item>
<n-form-item label="提现最低手续费比率" path="cashMinFeeRatio">
<n-input placeholder="" v-model:value="formValue.cashMinFeeRatio" />
<n-input-number
placeholder=""
v-model:value="formValue.cashMinFeeRatio"
style="width: 100%"
/>
</n-form-item>
<n-form-item label="提现最低金额" path="cashMinMoney">
<n-input placeholder="" v-model:value="formValue.cashMinMoney" />
<n-input-number
placeholder=""
v-model:value="formValue.cashMinMoney"
style="width: 100%"
/>
</n-form-item>
<n-form-item label="提现提示信息" path="cashTips">
@@ -50,8 +58,8 @@
const message = useMessage();
const formValue = ref({
cashSwitch: '',
cashMinFee: '',
cashMinFeeRatio: '',
cashMinFee: 0,
cashMinFeeRatio: 0,
cashMinMoney: 0,
cashTips: '',
});

View File

@@ -2,7 +2,7 @@
<div>
<n-spin :show="show" description="请稍候...">
<n-form
:label-width="110"
:label-width="150"
:model="formValue"
:rules="rules"
ref="formRef"
@@ -41,7 +41,7 @@
</n-input-number>
</n-form-item>
<n-tabs type="segment" v-model:value="tabName">
<n-tabs type="card" size="small" v-model:value="tabName">
<n-tab-pane name="aliyun">
<template #tab> 阿里云 </template>
<n-divider title-placement="left"> 阿里云</n-divider>
@@ -74,7 +74,7 @@
</template>
</n-form-item>
<n-form-item label="短信模板" path="smsAliYunTemplate" label-placement="top">
<n-form-item label="短信模板" path="smsAliYunTemplate">
<n-dynamic-input
v-model:value="formValue.smsAliYunTemplate"
preset="pair"
@@ -87,14 +87,14 @@
<n-tab-pane name="tencent">
<template #tab> 腾讯云 </template>
<n-divider title-placement="left"> 腾讯云</n-divider>
<n-form-item label="SecretId" path="smsTencentSecretId">
<n-form-item label="APPID" path="smsTencentSecretId">
<n-input v-model:value="formValue.smsTencentSecretId" placeholder="" />
<template #feedback>
应用key和密钥你可以通过 https://ram.console.aliyun.com/manage/ak 获取
子账号密钥获取地址https://cloud.tencent.com/document/product/598/37140
</template>
</n-form-item>
<n-form-item label="SecretKey" path="smsTencentSecretKey">
<n-form-item label="密钥" path="smsTencentSecretKey">
<n-input
type="password"
v-model:value="formValue.smsTencentSecretKey"
@@ -140,7 +140,7 @@
</template>
</n-form-item>
<n-form-item label="短信模板" path="smsTencentTemplate" label-placement="top">
<n-form-item label="短信模板" path="smsTencentTemplate">
<n-dynamic-input
v-model:value="formValue.smsTencentTemplate"
preset="pair"
@@ -179,10 +179,7 @@
class="py-4"
>
<n-form-item label="事件模板" path="event">
<n-select
:options="options.config_sms_template"
v-model:value="formParams.event"
/>
<n-select :options="options.config_sms_template" v-model:value="formParams.event" />
</n-form-item>
<n-form-item label="手机号" path="mobile">
@@ -205,9 +202,7 @@
<template #action>
<n-space>
<n-button @click="() => (showModal = false)">关闭</n-button>
<n-button type="info" :loading="formBtnLoading" @click="confirmForm">
发送
</n-button>
<n-button type="info" :loading="formBtnLoading" @click="confirmForm"> 发送 </n-button>
</n-space>
</template>
</n-modal>
@@ -215,125 +210,124 @@
</template>
<script lang="ts" setup>
import { ref, onMounted, watch } from "vue";
import { useMessage } from "naive-ui";
import { getConfig, sendTestSms, updateConfig } from "@/api/sys/config";
import { Dicts } from "@/api/dict/dict";
import { Options } from "@/utils/hotgo";
import { GlassesOutline, Glasses } from "@vicons/ionicons5";
import { ref, onMounted, watch } from 'vue';
import { useMessage } from 'naive-ui';
import { getConfig, sendTestSms, updateConfig } from '@/api/sys/config';
import { Dicts } from '@/api/dict/dict';
import { Options } from '@/utils/hotgo';
import { GlassesOutline, Glasses } from '@vicons/ionicons5';
const group = ref("sms");
const show = ref(false);
const showModal = ref(false);
const formBtnLoading = ref(false);
const formParams = ref({ mobile: "", event: "", code: "1234" });
const group = ref('sms');
const show = ref(false);
const showModal = ref(false);
const formBtnLoading = ref(false);
const formParams = ref({ mobile: '', event: '', code: '1234' });
const rules = {
smsDrive: {
required: true,
message: "请输入默认驱动",
trigger: "blur",
},
};
const rules = {
smsDrive: {
required: true,
message: '请输入默认驱动',
trigger: 'blur',
},
};
const formTestRef = ref<any>();
const formRef: any = ref(null);
const message = useMessage();
const formTestRef = ref<any>();
const formRef: any = ref(null);
const message = useMessage();
const options = ref<Options>({
config_sms_template: [],
config_sms_drive: [],
});
const options = ref<Options>({
config_sms_template: [],
config_sms_drive: [],
});
/** 默认选项卡 */
const defaultTabName = "aliyun";
/** 选项卡名称 */
const tabName = ref<string>(defaultTabName);
/** 默认选项卡 */
const defaultTabName = 'aliyun';
/** 选项卡名称 */
const tabName = ref<string>(defaultTabName);
const formValue = ref({
smsDrive: defaultTabName,
smsMinInterval: 60,
smsMaxIpLimit: 10,
smsCodeExpire: 600,
smsAliYunAccessKeyID: "",
smsAliYunAccessKeySecret: "",
smsAliYunSign: "",
smsAliYunTemplate: null,
smsTencentSecretId: "",
smsTencentSecretKey: "",
smsTencentEndpoint: "sms.tencentcloudapi.com",
smsTencentRegion: "ap-guangzhou",
smsTencentAppId: "",
smsTencentSign: "",
smsTencentTemplate: null,
});
const formValue = ref({
smsDrive: defaultTabName,
smsMinInterval: 60,
smsMaxIpLimit: 10,
smsCodeExpire: 600,
smsAliYunAccessKeyID: '',
smsAliYunAccessKeySecret: '',
smsAliYunSign: '',
smsAliYunTemplate: null,
smsTencentSecretId: '',
smsTencentSecretKey: '',
smsTencentEndpoint: 'sms.tencentcloudapi.com',
smsTencentRegion: 'ap-guangzhou',
smsTencentAppId: '',
smsTencentSign: '',
smsTencentTemplate: null,
});
/** 监听类型变化,同步到选项卡中 */
watch(
() => formValue.value.smsDrive,
(smsDrive: string) => {
console.error(smsDrive);
tabName.value = smsDrive;
}
);
function sendTest() {
showModal.value = true;
formBtnLoading.value = false;
}
function formSubmit() {
formRef.value.validate((errors) => {
if (!errors) {
updateConfig({ group: group.value, list: formValue.value }).then((_res) => {
message.success("更新成功");
load();
});
} else {
message.error("验证失败,请填写完整信息");
/** 监听类型变化,同步到选项卡中 */
watch(
() => formValue.value.smsDrive,
(smsDrive: string) => {
tabName.value = smsDrive;
}
});
}
);
onMounted(() => {
load();
});
async function load() {
show.value = true;
await loadOptions();
new Promise((_resolve, _reject) => {
getConfig({ group: group.value })
.then((res) => {
res.list.smsAliYunTemplate = JSON.parse(res.list.smsAliYunTemplate);
res.list.smsTencentTemplate = JSON.parse(res.list.smsTencentTemplate);
formValue.value = res.list;
})
.finally(() => {
show.value = false;
});
});
}
async function loadOptions() {
options.value = await Dicts({
types: ["config_sms_template", "config_sms_drive"],
});
}
function confirmForm(e) {
e.preventDefault();
formBtnLoading.value = true;
formTestRef.value.validate((errors) => {
if (!errors) {
sendTestSms(formParams.value).then((_res) => {
message.success("发送成功");
showModal.value = false;
});
} else {
message.error("请填写完整信息");
}
function sendTest() {
showModal.value = true;
formBtnLoading.value = false;
}
function formSubmit() {
formRef.value.validate((errors) => {
if (!errors) {
updateConfig({ group: group.value, list: formValue.value }).then((_res) => {
message.success('更新成功');
load();
});
} else {
message.error('验证失败,请填写完整信息');
}
});
}
onMounted(() => {
load();
});
}
</script>
async function load() {
show.value = true;
await loadOptions();
new Promise((_resolve, _reject) => {
getConfig({ group: group.value })
.then((res) => {
res.list.smsAliYunTemplate = JSON.parse(res.list.smsAliYunTemplate);
res.list.smsTencentTemplate = JSON.parse(res.list.smsTencentTemplate);
formValue.value = res.list;
})
.finally(() => {
show.value = false;
});
});
}
async function loadOptions() {
options.value = await Dicts({
types: ['config_sms_template', 'config_sms_drive'],
});
}
function confirmForm(e) {
e.preventDefault();
formBtnLoading.value = true;
formTestRef.value.validate((errors) => {
if (!errors) {
sendTestSms(formParams.value).then((_res) => {
message.success('发送成功');
showModal.value = false;
});
} else {
message.error('请填写完整信息');
}
formBtnLoading.value = false;
});
}
</script>

View File

@@ -2,7 +2,7 @@
<div>
<n-spin :show="show" description="请稍候...">
<n-form
:label-width="100"
:label-width="150"
:model="formValue"
:rules="rules"
ref="formRef"
@@ -42,11 +42,7 @@
<n-form-item label="文件类型限制" path="uploadFileType">
<n-input v-model:value="formValue.uploadFileType" placeholder="" />
</n-form-item>
<n-tabs
type="card"
tab-style="min-width: 120px; text-aling:center;"
v-model:value="tabName"
>
<n-tabs type="card" size="small" v-model:value="tabName">
<n-tab-pane name="local">
<template #tab> 本地存储</template>
<n-divider title-placement="left">本地存储</n-divider>
@@ -56,111 +52,6 @@
</n-form-item>
</n-tab-pane>
<n-tab-pane name="ucloud">
<template #tab> ucloud对象存储</template>
<n-divider title-placement="left">ucloud对象存储</n-divider>
<n-form-item label="公钥" path="uploadUCloudPublicKey">
<n-input
type="password"
v-model:value="formValue.uploadUCloudPublicKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
<template #feedback>
获取地址https://console.ucloud.cn/ufile/token
</template>
</n-form-item>
<n-form-item label="私钥" path="uploadUCloudPrivateKey">
<n-input
type="password"
v-model:value="formValue.uploadUCloudPrivateKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
</n-form-item>
<n-form-item label="存储路径" path="uploadUCloudPath">
<n-input v-model:value="formValue.uploadUCloudPath" placeholder="" />
<template #feedback>填对对象存储中的相对路径</template>
</n-form-item>
<n-form-item label="地域API" path="uploadUCloudBucketHost">
<n-input v-model:value="formValue.uploadUCloudBucketHost" placeholder="" />
</n-form-item>
<n-form-item label="存储桶名称" path="uploadUCloudBucketName">
<n-input v-model:value="formValue.uploadUCloudBucketName" placeholder="" />
<template #feedback>存储空间名称</template>
</n-form-item>
<n-form-item label="存储桶地域host" path="uploadUCloudFileHost">
<n-input v-model:value="formValue.uploadUCloudFileHost" placeholder="" />
<template #feedback>不需要包含桶名称</template>
</n-form-item>
<n-form-item label="访问域名" path="uploadUCloudEndpoint">
<n-input v-model:value="formValue.uploadUCloudEndpoint" placeholder="" />
<template #feedback>
格式http://abc.com 或 https://abc.com不可为空
</template>
</n-form-item>
</n-tab-pane>
<n-tab-pane name="cos">
<template #tab> 腾讯云COS存储</template>
<n-divider title-placement="left">腾讯云COS存储</n-divider>
<n-form-item label="secretId" path="uploadCosSecretId">
<n-input
type="password"
v-model:value="formValue.uploadCosSecretId"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
<template #feedback>
子账号密钥获取地址https://cloud.tencent.com/document/product/598/37140
</template>
</n-form-item>
<n-form-item label="secretKey" path="uploadCosSecretKey">
<n-input
type="password"
v-model:value="formValue.uploadCosSecretKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
</n-form-item>
<n-form-item label="存储路径" path="uploadCosBucketURL">
<n-input v-model:value="formValue.uploadCosBucketURL" placeholder="" />
<template #feedback>填对对象存储中的相对路径</template>
</n-form-item>
<n-form-item label="地域API" path="uploadCosPath">
<n-input v-model:value="formValue.uploadCosPath" placeholder="" />
<template #feedback>
控制台查看地址https://console.cloud.tencent.com/cos5/bucket
</template>
</n-form-item>
</n-tab-pane>
<n-tab-pane name="oss">
<template #tab> 阿里云OSS存储</template>
<n-divider title-placement="left">阿里云OSS存储</n-divider>
@@ -177,9 +68,7 @@
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
<template #feedback>
创建地址https://ram.console.aliyun.com/manage/ak
</template>
<template #feedback> 创建地址https://ram.console.aliyun.com/manage/ak </template>
</n-form-item>
<n-form-item label="AccessKey Secret" path="uploadOssSecretKey">
@@ -212,6 +101,42 @@
</n-form-item>
</n-tab-pane>
<n-tab-pane name="cos">
<template #tab> 腾讯云COS存储</template>
<n-divider title-placement="left">腾讯云COS存储</n-divider>
<n-form-item label="APPID" path="uploadCosSecretId">
<n-input v-model:value="formValue.uploadCosSecretId" />
<template #feedback>
子账号密钥获取地址https://cloud.tencent.com/document/product/598/37140
</template>
</n-form-item>
<n-form-item label="密钥" path="uploadCosSecretKey">
<n-input
type="password"
v-model:value="formValue.uploadCosSecretKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
</n-form-item>
<n-form-item label="存储路径" path="uploadCosPath">
<n-input v-model:value="formValue.uploadCosPath" placeholder="" />
<template #feedback>填对对象存储中的相对路径</template>
</n-form-item>
<n-form-item label="访问域名" path="uploadCosBucketURL">
<n-input v-model:value="formValue.uploadCosBucketURL" placeholder="" />
<template #feedback
>控制台查看地址https://console.cloud.tencent.com/cos5/bucket</template
>
</n-form-item>
</n-tab-pane>
<n-tab-pane name="qiniu">
<template #tab> 七牛云对象存储</template>
<n-divider title-placement="left">七牛云对象存储</n-divider>
@@ -256,9 +181,64 @@
<n-input v-model:value="formValue.uploadQiNiuDomain" placeholder="" />
</n-form-item>
</n-tab-pane>
<n-tab-pane name="ucloud">
<template #tab> ucloud对象存储</template>
<n-divider title-placement="left">ucloud对象存储</n-divider>
<n-form-item label="公钥" path="uploadUCloudPublicKey">
<n-input
type="password"
v-model:value="formValue.uploadUCloudPublicKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
<template #feedback> 获取地址https://console.ucloud.cn/ufile/token </template>
</n-form-item>
<n-form-item label="私钥" path="uploadUCloudPrivateKey">
<n-input
type="password"
v-model:value="formValue.uploadUCloudPrivateKey"
show-password-on="click"
>
<template #password-visible-icon>
<n-icon :size="16" :component="GlassesOutline" />
</template>
<template #password-invisible-icon>
<n-icon :size="16" :component="Glasses" />
</template>
</n-input>
</n-form-item>
<n-form-item label="存储路径" path="uploadUCloudPath">
<n-input v-model:value="formValue.uploadUCloudPath" placeholder="" />
<template #feedback>填对对象存储中的相对路径</template>
</n-form-item>
<n-form-item label="地域API" path="uploadUCloudBucketHost">
<n-input v-model:value="formValue.uploadUCloudBucketHost" placeholder="" />
</n-form-item>
<n-form-item label="存储桶名称" path="uploadUCloudBucketName">
<n-input v-model:value="formValue.uploadUCloudBucketName" placeholder="" />
<template #feedback>存储空间名称</template>
</n-form-item>
<n-form-item label="存储桶地域host" path="uploadUCloudFileHost">
<n-input v-model:value="formValue.uploadUCloudFileHost" placeholder="" />
<template #feedback>不需要包含桶名称</template>
</n-form-item>
<n-form-item label="访问域名" path="uploadUCloudEndpoint">
<n-input v-model:value="formValue.uploadUCloudEndpoint" placeholder="" />
<template #feedback> 格式http://abc.com 或 https://abc.com不可为空 </template>
</n-form-item>
</n-tab-pane>
<n-tab-pane name="minio">
<template #tab> minio配置</template>
<n-divider title-placement="left">minio配置</n-divider>
<template #tab> minio对象存储</template>
<n-divider title-placement="left">minio对象存储</n-divider>
<n-form-item label="AccessKey ID" path="uploadMinioAccessKey">
<n-input
type="password"
@@ -293,14 +273,14 @@
<n-input v-model:value="formValue.uploadMinioEndpoint" placeholder="" />
<template #feedback> Endpoint不带http://和路径)</template>
</n-form-item>
<n-form-item path="uploadMinioUseSSL">
<n-form-item path="uploadMinioUseSSL" label="SSL">
<n-switch
v-model:value="formValue.uploadMinioUseSSL"
:checked-value="1"
:unchecked-value="2"
>
<template #checked> 启用SSL</template>
<template #unchecked> 禁用SSL</template>
<template #checked> 启用</template>
<template #unchecked> 禁用</template>
</n-switch>
</n-form-item>
<n-form-item label="储存路径" path="uploadMinioPath">
@@ -309,7 +289,7 @@
<n-form-item label="存储桶名称" path="uploadMinioBucket">
<n-input v-model:value="formValue.uploadMinioBucket" placeholder="" />
</n-form-item>
<n-form-item label="对外访问域名" path="uploadMinioDomain">
<n-form-item label="访问域名" path="uploadMinioDomain">
<n-input v-model:value="formValue.uploadMinioDomain" placeholder="" />
</n-form-item>
</n-tab-pane>
@@ -325,115 +305,115 @@
</template>
<script lang="ts" setup>
import { onMounted, ref, watch } from "vue";
import { useMessage } from "naive-ui";
import { getConfig, updateConfig } from "@/api/sys/config";
import { Glasses, GlassesOutline } from "@vicons/ionicons5";
import { Dicts } from "@/api/dict/dict";
import { Options } from "@/utils/hotgo";
import { onMounted, ref, watch } from 'vue';
import { useMessage } from 'naive-ui';
import { getConfig, updateConfig } from '@/api/sys/config';
import { Glasses, GlassesOutline } from '@vicons/ionicons5';
import { Dicts } from '@/api/dict/dict';
import { Options } from '@/utils/hotgo';
const group = ref("upload");
const show = ref(false);
const formRef: any = ref(null);
const message = useMessage();
const group = ref('upload');
const show = ref(false);
const formRef: any = ref(null);
const message = useMessage();
const rules = {
uploadDrive: {
required: true,
message: "请输入默认驱动",
trigger: "blur",
},
};
const rules = {
uploadDrive: {
required: true,
message: '请输入默认驱动',
trigger: 'blur',
},
};
const options = ref<Options>({
config_upload_drive: [],
});
const options = ref<Options>({
config_upload_drive: [],
});
/** 默认选项卡 */
const defaultTabName = "local";
/** 选项卡名称 */
const tabName = ref<string>(defaultTabName);
/** 默认选项卡 */
const defaultTabName = 'local';
/** 选项卡名称 */
const tabName = ref<string>(defaultTabName);
const formValue = ref({
uploadDrive: defaultTabName,
uploadImageSize: 2,
uploadImageType: "",
uploadFileSize: 10,
uploadFileType: "",
uploadLocalPath: "",
uploadUCloudPath: "",
uploadUCloudPublicKey: "",
uploadUCloudPrivateKey: "",
uploadUCloudBucketHost: "api.ucloud.cn",
uploadUCloudBucketName: "",
uploadUCloudFileHost: "cn-bj.ufileos.com",
uploadUCloudEndpoint: "",
uploadCosSecretId: "",
uploadCosSecretKey: "",
uploadCosBucketURL: "",
uploadCosPath: "",
uploadOssSecretId: "",
uploadOssSecretKey: "",
uploadOssEndpoint: "",
uploadOssBucketURL: "",
uploadOssPath: "",
uploadOssBucket: "",
uploadQiNiuAccessKey: "",
uploadQiNiuSecretKey: "",
uploadQiNiuDomain: "",
uploadQiNiuPath: "",
uploadQiNiuBucket: "",
uploadMinioAccessKey: "",
uploadMinioSecretKey: "",
uploadMinioEndpoint: "",
uploadMinioUseSSL: 2,
uploadMinioPath: "",
uploadMinioBucket: "",
uploadMinioDomain: "",
});
const formValue = ref({
uploadDrive: defaultTabName,
uploadImageSize: 2,
uploadImageType: '',
uploadFileSize: 10,
uploadFileType: '',
uploadLocalPath: '',
uploadUCloudPath: '',
uploadUCloudPublicKey: '',
uploadUCloudPrivateKey: '',
uploadUCloudBucketHost: 'api.ucloud.cn',
uploadUCloudBucketName: '',
uploadUCloudFileHost: 'cn-bj.ufileos.com',
uploadUCloudEndpoint: '',
uploadCosSecretId: '',
uploadCosSecretKey: '',
uploadCosBucketURL: '',
uploadCosPath: '',
uploadOssSecretId: '',
uploadOssSecretKey: '',
uploadOssEndpoint: '',
uploadOssBucketURL: '',
uploadOssPath: '',
uploadOssBucket: '',
uploadQiNiuAccessKey: '',
uploadQiNiuSecretKey: '',
uploadQiNiuDomain: '',
uploadQiNiuPath: '',
uploadQiNiuBucket: '',
uploadMinioAccessKey: '',
uploadMinioSecretKey: '',
uploadMinioEndpoint: '',
uploadMinioUseSSL: 2,
uploadMinioPath: '',
uploadMinioBucket: '',
uploadMinioDomain: '',
});
/** 监听类型变化,同步到选项卡中 */
watch(
() => formValue.value.uploadDrive,
(uploadDrive: string) => {
tabName.value = uploadDrive;
}
);
function formSubmit() {
formRef.value.validate((errors) => {
if (!errors) {
updateConfig({ group: group.value, list: formValue.value }).then((_res) => {
message.success("更新成功");
load();
});
} else {
message.error("验证失败,请填写完整信息");
/** 监听类型变化,同步到选项卡中 */
watch(
() => formValue.value.uploadDrive,
(uploadDrive: string) => {
tabName.value = uploadDrive;
}
});
}
);
onMounted(async () => {
load();
await loadOptions();
});
function formSubmit() {
formRef.value.validate((errors) => {
if (!errors) {
updateConfig({ group: group.value, list: formValue.value }).then((_res) => {
message.success('更新成功');
load();
});
} else {
message.error('验证失败,请填写完整信息');
}
});
}
function load() {
show.value = true;
new Promise((_resolve, _reject) => {
getConfig({ group: group.value })
.then((res) => {
formValue.value = res.list;
})
.finally(() => {
show.value = false;
});
onMounted(async () => {
load();
await loadOptions();
});
}
async function loadOptions() {
options.value = await Dicts({
types: ["config_upload_drive"],
});
}
function load() {
show.value = true;
new Promise((_resolve, _reject) => {
getConfig({ group: group.value })
.then((res) => {
formValue.value = res.list;
})
.finally(() => {
show.value = false;
});
});
}
async function loadOptions() {
options.value = await Dicts({
types: ['config_upload_drive'],
});
}
</script>

View File

@@ -34,41 +34,41 @@
</div>
</template>
<script lang="ts">
import { defineAsyncComponent, defineComponent, reactive, toRefs } from "vue";
/** 异步加载的组件,用到的时候再加载组件 */
const BasicSetting = defineAsyncComponent(() => {
return import("./BasicSetting.vue");
}),
RevealSetting = defineAsyncComponent(() => {
return import("./RevealSetting.vue");
}),
EmailSetting = defineAsyncComponent(() => {
return import("./EmailSetting.vue");
}),
ThemeSetting = defineAsyncComponent(() => {
return import("./ThemeSetting.vue");
}),
CashSetting = defineAsyncComponent(() => {
return import("./CashSetting.vue");
}),
UploadSetting = defineAsyncComponent(() => {
return import("./UploadSetting.vue");
}),
GeoSetting = defineAsyncComponent(() => {
return import("./GeoSetting.vue");
}),
SmsSetting = defineAsyncComponent(() => {
return import("./SmsSetting.vue");
}),
PaySetting = defineAsyncComponent(() => {
return import("./PaySetting.vue");
}),
WechatSetting = defineAsyncComponent(() => {
return import("./WechatSetting.vue");
}),
LoginSetting = defineAsyncComponent(() => {
return import("./LoginSetting.vue");
});
import { defineAsyncComponent, defineComponent, reactive, toRefs } from 'vue';
/** 异步加载的组件,用到的时候再加载组件 */
const BasicSetting = defineAsyncComponent(() => {
return import('./BasicSetting.vue');
}),
RevealSetting = defineAsyncComponent(() => {
return import('./RevealSetting.vue');
}),
EmailSetting = defineAsyncComponent(() => {
return import('./EmailSetting.vue');
}),
ThemeSetting = defineAsyncComponent(() => {
return import('./ThemeSetting.vue');
}),
CashSetting = defineAsyncComponent(() => {
return import('./CashSetting.vue');
}),
UploadSetting = defineAsyncComponent(() => {
return import('./UploadSetting.vue');
}),
GeoSetting = defineAsyncComponent(() => {
return import('./GeoSetting.vue');
}),
SmsSetting = defineAsyncComponent(() => {
return import('./SmsSetting.vue');
}),
PaySetting = defineAsyncComponent(() => {
return import('./PaySetting.vue');
}),
WechatSetting = defineAsyncComponent(() => {
return import('./WechatSetting.vue');
}),
LoginSetting = defineAsyncComponent(() => {
return import('./LoginSetting.vue');
});
const typeTabList = [
{
name: '基本设置',

View File

@@ -106,7 +106,8 @@
import { statusOptions } from '@/enums/optionsiEnum';
import { TypeSelect } from '@/api/sys/config';
import { Option } from '@/utils/hotgo';
import {cloneDeep} from "lodash-es";
import { findTreeDataById } from '@/utils';
import { cloneDeep } from 'lodash-es';
const options = ref<Option>();
interface Props {
checkedId?: number;
@@ -320,11 +321,14 @@
}
}
function handleUpdateTypeIdValue(
value: string | number | Array<string | number> | null,
_option: TreeSelectOption | null | Array<TreeSelectOption | null>
) {
function handleUpdateTypeIdValue(value) {
const row = findTreeDataById(typeList.value, value);
if (!row) {
message.error('未找到该节点数据');
return;
}
formParams.value.typeId = value;
formParams.value.type = row.type;
}
async function loadOptions() {