|
@@ -0,0 +1,75 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-card class="box-card">
|
|
|
+ <template #header>
|
|
|
+ <div class="card-header">
|
|
|
+ <span>详情</span>
|
|
|
+ <el-button size="mini" style="float:right" type="primary" @click="addContent">提交</el-button>
|
|
|
+ <el-button size="mini" style="float:right" type="info" @click="router.go(-1)">返回</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <el-form>
|
|
|
+ <el-form-item label="标题:">
|
|
|
+ <el-input v-model="contentsDetail.title" placeholder="请输入标题"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-switch v-model="contentsDetail.types" active-value="1" inactive-value="0" active-text="招聘"
|
|
|
+ inactive-text="公告"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="简介:">
|
|
|
+ <el-input v-model="contentsDetail.synopsis" placeholder="请输入简介"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="详情:">
|
|
|
+ {{ contentsDetail.synopsis }}
|
|
|
+ <editor v-model="contentsDetail.synopsis"></editor>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+ </el-card>
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script setup>
|
|
|
+import {onBeforeMount, reactive} from 'vue';
|
|
|
+import {useRoute, useRouter} from 'vue-router'
|
|
|
+import contents from "../../api/contents.js";
|
|
|
+import Editor from "../editor.vue";
|
|
|
+import {ElMessage} from "element-plus";
|
|
|
+
|
|
|
+const route = useRoute();
|
|
|
+const router = useRouter();
|
|
|
+const contentsDetail = reactive({
|
|
|
+ title: '',
|
|
|
+ detail: '',
|
|
|
+ synopsis: '',
|
|
|
+ types: '',
|
|
|
+})
|
|
|
+const addContent = async () => {
|
|
|
+ const res = await contents.addRecruit({
|
|
|
+ id: parseInt(route.query.id),
|
|
|
+ title: contentsDetail.title,
|
|
|
+ synopsis: contentsDetail.synopsis,
|
|
|
+ detail: contentsDetail.detail,
|
|
|
+ types: contentsDetail.types,
|
|
|
+ });
|
|
|
+ if (res.data.Code === 200) {
|
|
|
+ ElMessage.success("添加成功")
|
|
|
+ await getRecruitDetail()
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.data.Msg)
|
|
|
+ }
|
|
|
+}
|
|
|
+const getRecruitDetail = async () => {
|
|
|
+ const res = await contents.getRecruitDetail({id: route.query.id})
|
|
|
+ Object.assign(contentsDetail, res.data.Data);
|
|
|
+}
|
|
|
+onBeforeMount(async () => {
|
|
|
+ if (route.query.id) {
|
|
|
+ const res = await contents.getRecruitDetail({id: route.query.id})
|
|
|
+ Object.assign(contentsDetail, res.data.Data);
|
|
|
+ }
|
|
|
+})
|
|
|
+</script>
|
|
|
+
|
|
|
+
|
|
|
+<style lang="scss" scoped></style>
|