Files

47 lines
1.3 KiB
Vue
Raw Normal View History

2023-06-07 10:44:31 +08:00
<template>
<div class="app-container">
<el-card shadow="always" style="width: 55%; margin: 0 auto">
2023-06-13 13:40:54 +08:00
<research-form ref="researchFormRef" v-model="form" is-add />
2023-06-07 10:44:31 +08:00
<div :style="{ marginLeft: labelWidth + 'px' }">
2023-07-11 17:21:34 +08:00
<el-button @click="router.push('/identity/index')">{{ t("admin.common.cancel") }}</el-button>
<el-button type="primary" @click="submitForm">{{ t("admin.common.submit") }}</el-button>
2023-06-07 10:44:31 +08:00
</div>
</el-card>
</div>
</template>
<script setup>
2023-06-13 13:40:54 +08:00
import ResearchForm from "@/views/components/ResearchForm";
import { reactive, ref, toRefs } from "vue";
import { insertResearch } from "@/api/identity";
import { ElMessage } from "element-plus";
import { useRouter } from "vue-router";
2023-06-07 10:44:31 +08:00
2023-06-13 13:40:54 +08:00
const router = useRouter();
2023-06-07 10:44:31 +08:00
const props = defineProps({
labelWidth: {
type: Number,
2023-06-13 13:40:54 +08:00
default: 120,
},
});
2023-06-07 10:44:31 +08:00
const data = reactive({
2023-06-13 13:40:54 +08:00
form: {},
});
const { form } = toRefs(data);
const researchFormRef = ref();
2023-06-07 10:44:31 +08:00
const submitForm = async () => {
2023-06-13 13:40:54 +08:00
if (!researchFormRef.value) return;
const valid = await researchFormRef.value.validateForm();
2023-06-07 10:44:31 +08:00
if (valid) {
2023-06-13 13:40:54 +08:00
insertResearch(form.value).then((resp) => {
ElMessage.success("申请入驻成功");
router.push("/identity/index");
});
} else {
console.log("verify failed");
2023-06-07 10:44:31 +08:00
}
2023-06-13 13:40:54 +08:00
};
2023-06-07 10:44:31 +08:00
</script>
2023-06-13 13:40:54 +08:00
<style lang="scss" scoped></style>