Skip to content

Commit

Permalink
feat:新生注册功能上线 (#43)
Browse files Browse the repository at this point in the history
* Initial commit

* feat:新生注册提醒功能

* fix:删除了上传的多余文件

* feat:新生注册提醒功能

* 无效提交

* feat:新生提醒功能上线

* fix:更改了错误上传的文件

* fix:修复代理跨域的错误提交

* docs:修改了部分提示文字
  • Loading branch information
luolananDR authored Aug 13, 2024
1 parent e2c7a12 commit 3d2c364
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 18 deletions.
12 changes: 12 additions & 0 deletions src/apis/SystemInfoAPI/typing.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,17 @@ declare namespace SystemInfoAPI {
time: string;
/** 距离开学周的周数 */
week: number;
/** 获取分数的学期 */
scoreTerm: string;
/** 获取分数的学年 */
scoreYear: string;
/** 校车链接 */
schoolBusUrl: string;
/** 图片链接 */
jpgUrl: string;
/** 文件链接 */
fileUrl: string;
/** 注册提醒 */
register: string;
}
}
8 changes: 7 additions & 1 deletion src/apis/TermTimeAPI/setTermInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ type GetTermInfoData = {
termStartDateValue: string;
termValue: string;
yearValue: string;
scoreYearValue: string;
scoreTermValue: string;
schoolBusUrlValue: string;
jpgUrlValue: string;
fileUrlValue: string;
registerTips: string;
}

type GetTermInfoResult = Common.IResponse<string>

const setTermInfoAPI = (data?: GetTermInfoData) => {
return request<GetTermInfoResult>({
method: "post",
url: "/api/admin/set/terminfo",
url: "/api/admin/set/systeminfo",
data: data,
withCredentials: true
})
Expand Down
2 changes: 1 addition & 1 deletion src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const menuOptions = computed<Array<MenuOption & { access?: boolean }>>(() =>
label: () => h(
RouterLink,
{ to: { name: "TermTime", } },
{ default: () => "学期时间修改" }
{ default: () => "系统信息修改" }
),
key: "school-term-time",
icon: renderIcon(AlarmIcon),
Expand Down
162 changes: 146 additions & 16 deletions src/pages/TermTime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,77 @@ import PageTitle from "../components/PageTitle.vue";
const initialValue = ref({
termYear: new Date().getFullYear().toString(),
term: "",
termStartDate: "1970-01-01"
termStartDate: "1970-01-01",
scoreTerm: "",
scoreYear: new Date().getFullYear().toString(),
schoolBusUrl: "暂无",
jpgUrl: "暂无",
fileUrl: "暂无",
registerTips: "暂无",
});
const termYearValue = ref(initialValue.value.termYear);
const termValue = ref(initialValue.value.term);
const termStartDateValue = ref(initialValue.value.termStartDate);
const scoreTermValue = ref(initialValue.value.scoreTerm);
const scoreYearValue = ref(initialValue.value.scoreYear);
const schoolBusUrlValue = ref(initialValue.value.schoolBusUrl);
const jpgUrlValue = ref(initialValue.value.jpgUrl);
const fileUrlValue = ref(initialValue.value.fileUrl);
const registerTips = ref(initialValue.value.registerTips);
const dialog = useDialog();
const handleReset = async () => {
termYearValue.value = initialValue.value.termYear,
termValue.value = initialValue.value.term,
termStartDateValue.value = initialValue.value.termStartDate,
scoreTermValue.value = initialValue.value.scoreTerm,
scoreYearValue.value = initialValue.value.scoreYear;
};
const noticeReset = async () => {
registerTips.value=initialValue.value.registerTips;
};
const urlReset = async () => {
schoolBusUrlValue.value = initialValue.value.schoolBusUrl,
jpgUrlValue.value = initialValue.value.jpgUrl,
fileUrlValue.value = initialValue.value.fileUrl;
};
onMounted(async () => {
try {
const { code, data, msg } = await getSystemInfo();
if (code !== 1) throw new Error(msg);
const { term, termStartDate, termYear } = data;
termYearValue.value = termYear;
termValue.value = term;
termStartDateValue.value = termStartDate;
initialValue.value = data;
const { term, termStartDate, termYear,scoreTerm,scoreYear,schoolBusUrl,jpgUrl,fileUrl,registerTips } = data;

Check failure on line 64 in src/pages/TermTime.vue

View workflow job for this annotation

GitHub Actions / deploy

Property 'registerTips' does not exist on type 'SystemInfo'.
initialValue.value.termYear = termYear;
initialValue.value.term = term;
initialValue.value.termStartDate = termStartDate;
initialValue.value.scoreTerm = scoreTerm;
initialValue.value.scoreYear = scoreYear;
initialValue.value.schoolBusUrl = schoolBusUrl;
initialValue.value.jpgUrl = jpgUrl;
initialValue.value.fileUrl = fileUrl;
initialValue.value.registerTips = registerTips;
} catch (e) {
console.log(e);
}
urlReset();
noticeReset();
//handleReset();
});
//this.$forceUpdate()
const optionsTerm = [
{ label: "", value: "" },
{ label: "", value: "" },
{ label: "", value: "" },
];
const handleReset = () => {
termYearValue.value = initialValue.value.termYear,
termValue.value = initialValue.value.term,
termStartDateValue.value = initialValue.value.termStartDate;
};
const handleSubmit = async () => {
dialog.warning({
Expand All @@ -62,7 +100,13 @@ const handleSubmit = async () => {
const res = await setTermInfoAPI({
yearValue: termYearValue.value,
termValue: termValue.value,
termStartDateValue: termStartDateValue.value
termStartDateValue: termStartDateValue.value,
scoreTermValue:scoreTermValue.value,
scoreYearValue:scoreYearValue.value,
jpgUrlValue: jpgUrlValue.value,
fileUrlValue: fileUrlValue.value,
schoolBusUrlValue:schoolBusUrlValue.value,
registerTips:registerTips.value,
});
const { code, msg } = res;
if (code !== 1) throw new Error(msg);
Expand All @@ -72,6 +116,7 @@ const handleSubmit = async () => {
}
});
};
</script>

<template>
Expand All @@ -81,7 +126,7 @@ const handleSubmit = async () => {
<n-form style="max-width: 400px">
<n-form-item>
<n-alert type="info" style="width: 400px">
表单的初始值为当前系统的数据
表单的初始值为当前系统的数据,刷新以查看
</n-alert>
</n-form-item>
<n-form-item label="学年选择">
Expand All @@ -94,17 +139,102 @@ const handleSubmit = async () => {
<n-date-picker v-model:formatted-value="termStartDateValue" value-format="yyyy-MM-dd" type="date"
style="width: 400px" />
</n-form-item>

<n-form-item label="成绩查询学年选择">
<n-date-picker v-model:formatted-value="scoreYearValue" value-format="yyyy" type="year" style="width: 400px" />
</n-form-item>
<n-form-item label="成绩查询学期选择">
<n-select v-model:value="scoreTermValue" :options="optionsTerm" clearable />
</n-form-item>
<n-form-item>
<n-space>
<n-button id="update" type="success" @click="handleSubmit">
提交修改
</n-button>
<n-button secondary type="error" id="clear" @click="handleReset">
重置表单
<n-button secondary type="info" id="clear" @click="handleReset">
刷新表单
</n-button>
</n-space>
</n-form-item>
</n-form>
</n-space>

<page-title>新生注册提醒</page-title>
<n-space style="padding: 0 24px">

<n-form style="max-width: 400px">
<n-form-item>
<n-alert type="info" style="width: 400px">
表单的初始值为当前系统的数据,刷新以查看
</n-alert>
</n-form-item>
<n-form-item>
<n-input
v-model:value="registerTips"
type="textarea"
placeholder="请输入新生注册提醒"
/>
</n-form-item>

<n-form-item>
<n-space>
<n-button id="update" type="success" @click="handleSubmit">
发布提醒
</n-button>
<n-button secondary type="info" id="clear" @click="noticeReset">
刷新表单
</n-button>
</n-space>
</n-form-item>
</n-form >
</n-space>
<page-title>链接编辑</page-title>
<n-space style="padding: 0 24px">

<n-form style="max-width: 400px">
<n-form-item>
<n-alert type="info" style="width: 400px">
表单的初始值为当前系统的数据,刷新以查看
</n-alert>
</n-form-item>
<n-form-item >
<n-card title="图片链接" size="small" :bordered="false">
<n-input
v-model:value="jpgUrlValue"
type="input"
placeholder="请输入图片URL"
/>
</n-card>

</n-form-item>
<n-form-item >
<n-card title="文件链接" size="small" :bordered="false">
<n-input
v-model:value="fileUrlValue"
type="input"
placeholder="请输入文件URL"
/>
</n-card>
</n-form-item>
<n-form-item >
<n-card title="校车链接" size="small" :bordered="false">
<n-input
v-model:value="schoolBusUrlValue"
type="input"
placeholder="请输入校车URL"
/>
</n-card>
</n-form-item>

<n-form-item>
<n-space>
<n-button id="update" type="success" @click="handleSubmit">
修改前缀
</n-button>
<n-button secondary type="info" id="clear" @click="urlReset">
刷新表单
</n-button>
</n-space>
</n-form-item>
</n-form>
</n-space>
</template>

0 comments on commit 3d2c364

Please sign in to comment.