This commit is contained in:
六如
2024-11-19 22:27:51 +08:00
parent eefddbe5c0
commit 16a2ca7723
24 changed files with 762 additions and 54 deletions

View File

@@ -0,0 +1,27 @@
import { createUrl, http } from "@/utils/http";
import type { PageResult, Result } from "@/model";
// 后端请求接口
const apiUrl: any = createUrl({
get: "/doc/setting/get",
save: "/doc/setting/save"
});
/**
* 接口管理
*/
export const api: any = {
/**
* 分页查询
*/
get(): Promise<PageResult> {
return http.get<PageResult, any>(apiUrl.get, {});
},
/**
* 新增
* @param data 表单内容
*/
save(data: object) {
return http.post<Result<any>, any>(apiUrl.save, { data });
}
};

View File

@@ -1,11 +1,6 @@
<script setup lang="ts">
const a = 1;
</script>
<template>
<el-card>1</el-card>
</template>
<style scoped lang="scss">
</style>

View File

@@ -1,31 +1,15 @@
import { ref } from "vue";
import type { PlusColumn, FieldValues } from "plus-pro-components";
import { api } from "@/api/docSetting";
import { ElMessage } from "element-plus";
export const state = ref<FieldValues>({
status: "0",
name: "",
rate: 4,
progress: 100,
switch: true,
time: new Date().toString(),
endTime: [],
img: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
tornaServerAddr: "",
openProdUrl: "",
openSandboxUrl: ""
});
export const rules = {
tornaServerAddr: [
{
required: true,
message: "请输入名称"
}
],
openProdUrl: [
{
required: true,
message: "请输入标签"
}
]
};
export const rules = {};
export const columns: PlusColumn[] = [
{
@@ -55,5 +39,15 @@ export const columns: PlusColumn[] = [
];
export const handleSubmit = (values: FieldValues) => {
console.log(values, "Submit");
api.save(values).then(() => {
ElMessage.success("保存成功");
});
};
const loadSetting = () => {
api.get().then(resp => {
state.value = resp.data;
});
};
loadSetting();