移除多余的前端页面 以及api

This commit is contained in:
jianzhichu
2025-12-08 12:45:30 +08:00
parent 772859eb63
commit 2550a1fde8
10 changed files with 12 additions and 201 deletions
+2 -11
View File
@@ -81,19 +81,10 @@ const user = reactive({
onMounted(() => {
useApiStore()
.apiCheckInitStatus()
.apiUserInfo()
.then((res) => {
if (res.code === 0) {
// useApiStore()
// .apiUserInfo()
// .then((res) => {
// if (res.code === 0 && res.code !== '') {
// if (res.data.avatar && res.data.avatar != null) {
// user.avatar = `/upload/${res.data.avatar}`;
// }
// user.name = res.data.userName;
// }
// });
user.name = res.data?.userName;
}
});
});
-129
View File
@@ -1,129 +0,0 @@
<template>
<a-card :bordered="false" :bodyStyle='{"padding-top":"0px","padding-bottom":"100px"}'>
<a-form :model="formState" :label-col="labelCol" :rules="rules" :wrapper-col="wrapperCol" ref="formRef">
<a-divider orientation="left"></a-divider>
<a-form-item has-feedback label="同步周期(分钟)" ref="Cron" name="Cron">
<a-input v-model:value="formState.Cron" placeholder="1:数字-例如20-表示20分钟执行一次;2:cron表达式,根据表达式周期执行" />
</a-form-item>
<a-form-item label="在线Cron表达式">
<a target="_blank" href="https://www.bejson.com/othertools/cron/">查看示例</a>
</a-form-item>
<a-form-item :wrapper-col="{ span: 10, offset: 3 }">
<a-button type="primary" danger @click="onSubmit">进入系统</a-button>
</a-form-item>
</a-form>
</a-card>
</template>
<script lang="ts" setup>
import { reactive, toRaw, ref, watch, createVNode, h } from 'vue';
import type { UnwrapRef } from 'vue';
import { Form } from 'ant-design-vue';
import type { Rule } from 'ant-design-vue/es/form';
import type { FormInstance } from 'ant-design-vue';
import { useApiStore } from '@/store';
import { Modal } from 'ant-design-vue';
import { checkDomain, checksubDomainPrefix, checkPass, checkUserName } from '@/utils/regexHelper';
const formRef = ref<FormInstance>();
const SK = ref(null);
interface FormState {
cloudName: string;
domainName: string;
recordType: string;
ipv6Prefix: string;
domainRecord: string;
AK: string;
SK: string;
DbType: number;
ConnString: string;
Cron: string;
UserName: string;
UswePwd: string;
}
interface CloudInfo {
key: string;
value: string;
doc: string;
}
interface DbTypeInfo {
key: number;
value: string;
conn: string;
}
interface showDBconn {
value: boolean;
}
const showDBconn: UnwrapRef<showDBconn> = reactive({
value: false,
});
const formState: UnwrapRef<FormState> = reactive({
cloudName: 'aliyun',
domainName: '',
recordType: '',
ipv6Prefix: '',
domainRecord: '',
AK: '',
SK: '',
DbType: 2,
ConnString: '',
Cron: '30',
UserName: '',
UswePwd: '',
});
const rules: Record<string, Rule[]> = {
Cron: [{ required: true, message: '请输入任务调度周期', trigger: 'change' }],
};
watch(
() => formState.DbType,
() => {
formRef.value.validateFields(['ConnString']);
},
{ flush: 'post' }
);
//检查数据库连接
import { message } from 'ant-design-vue';
import router from '@/router';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
const isFirst = ref(false);
//提交初始化
const onSubmit = () => {
// console.log('submit!', toRaw(formState));
formRef.value
.validate()
.then(() => {
console.log('values', formState, toRaw(formState));
useApiStore()
.apiInit(toRaw(formState))
.then((res) => {
if (res.code === 0) {
message.success('初始化成功');
setTimeout(() => {
router.push('/login');
}, 1000);
} else {
message.error(res.erro, 8);
}
});
})
.catch((error) => {
console.log('error', error);
});
};
const labelCol = { style: { width: '150px' } };
const wrapperCol = { span: 4 };
</script>
<style scoped>
.ant-card-body {
padding: 5px !important;
}
</style>
-3
View File
@@ -1,3 +0,0 @@
import Init from './Init.vue';
export default Init;
+1
View File
@@ -158,6 +158,7 @@ async function login(params: LoginFormProps) {
try {
const res = await accountStore.login(params.username, params.password);
emit('success', params);
console.log(res);
message.success('登录成功!');
} catch (e: any) {
// emit('failure', e.message, e.data);
-4
View File
@@ -215,7 +215,6 @@ interface FormState {
Cron: number;
Id: string;
BatchCount: number;
DownImageVideoFromEnv: boolean;
DownImageVideo: boolean;
UperSaveTogether: boolean;
UperUseViedoTitle: boolean;
@@ -240,7 +239,6 @@ const formState: UnwrapRef<FormState> = reactive({
UperUseViedoTitle: false,
UperSaveTogether: false,
DownImageVideo: false,
DownImageVideoFromEnv: false,
DownMp3: false,
DownImage: false,
ImageViedoSaveAlone: true,
@@ -313,7 +311,6 @@ const getConfig = () => {
Cron: res.data.cron,
Id: res.data.id,
BatchCount: res.data.batchCount,
DownImageVideoFromEnv: res.data.downImageVideoFromEnv,
DownImageVideo: res.data.downImageVideo,
UperUseViedoTitle: res.data.uperUseViedoTitle,
UperSaveTogether: res.data.uperSaveTogether,
@@ -329,7 +326,6 @@ const getConfig = () => {
DownDynamicVideo: res.data.downDynamicVideo,
});
// downImgVideo.value = res.data.downImageVideoFromEnv;
tagData.value = JSON.parse(res.data.priorityLevel);
} else {
message.error(res.erro || '获取配置失败', 8);
+4 -13
View File
@@ -42,19 +42,10 @@ const dynamicinitRoute =
const InitGuard: NavigationGuard = function (to, from) {
if (to.fullPath != '/login') {
useApiStore()
.apiCheckInitStatus()
.then((res) => {
// console.log(to.fullPath)
if (res.code === 0) {
} else {
if (!router.hasRoute('login')) {
router.addRoute(dynamicinitRoute)
}
router.push('/login')
// return '/init'
}
});
if (!router.hasRoute('login')) {
router.addRoute(dynamicinitRoute)
}
router.push('/login')
}
};
-36
View File
@@ -28,43 +28,9 @@ import { Response } from '@/types';
// }
export const useApiStore = defineStore('coreapi', () => {
//检查是否已经初始化过了
async function apiCheckInitStatus() {
return { code: 0 }
// const initStatus = localStorage.getItem('ddns-init');
// if (initStatus && initStatus === '1') {
// return { code: 0 }
// } else {
// return http
// .request<any, Response<any>>('/api/init/Check', 'GET')
// .then((res) => {
// // console.log(res)
// if (res.data.code === 0) {
// // localStorage.setItem('ddns-init', '1')
// }
// return res.data;
// })
// .finally(() => {
// });
// }
}
//初始化系统配置
async function apiInit(request: object) {
console.log(request)
return http
.request<any, Response<any>>('/api/init/Init', 'post_json', request)
.then((res) => {
// console.log(res)
return res.data;
})
.finally(() => {
});
}
//获取配置
async function apiGetConfig() {
return http
@@ -261,8 +227,6 @@ export const useApiStore = defineStore('coreapi', () => {
CheckTag,
deleteCookie,
UpdateConfig,
apiCheckInitStatus,
apiInit,
apiGetConfig,
apiUpdateConfig,
apiGetLogs,