Forráskód Böngészése

云塑关于我们——职位管理

ZhouRuiTing 5 éve
szülő
commit
e4ca7beebc

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 0
official_frontend/src/icons/svg/home.svg


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 0
official_frontend/src/icons/svg/position.svg


+ 33 - 19
official_frontend/src/router/index.js

@@ -52,35 +52,22 @@ export const constantRoutes = [
   {
     path: '/banner',
     component: Layout,
+    meta: { title: '首页', icon: 'home' },
     children: [
       {
-        path: '',
+        path: '/Banner',
         name: 'Banner',
         component: () => import('@/views/index/banner'),
         meta: { title: 'Banner图片', icon: 'banner' }
-      }
-    ]
-  },
-
-  {
-    path: '/label',
-    component: Layout,
-    children: [
+      },
       {
-        path: '',
+        path: '/label',
         name: 'label',
         component: () => import('@/views/index/label'),
         meta: { title: '首页标签', icon: 'label' }
-      }
-    ]
-  },
-
-  {
-    path: '/customer',
-    component: Layout,
-    children: [
+      },
       {
-        path: '',
+        path: '/customer',
         name: 'customer',
         component: () => import('@/views/index/customer'),
         meta: { title: '客户说', icon: 'customer' }
@@ -182,6 +169,33 @@ export const constantRoutes = [
     ]
   },
 
+  {
+    path: '/position',
+    component: Layout,
+    children: [
+      {
+        path: '',
+        name: 'position',
+        component: () => import('@/views/about/position'),
+        meta: { title: '职位管理', icon: 'position' }
+      }
+    ]
+  },
+
+  {
+    path: '/position/:id',
+    component: Layout,
+    children: [
+      {
+        path: '',
+        name: 'positionEdit',
+        hidden: true,
+        component: () => import('@/views/about/positionEdit'),
+        meta: { title: '职位管理编辑', icon: 'position' }
+      }
+    ]
+  },
+
   {
     path: '/comment',
     component: Layout,

+ 140 - 0
official_frontend/src/views/about/position.vue

@@ -0,0 +1,140 @@
+<template>
+    <div class="app-container">
+        <el-button size="small" type="primary" @click="openDialog(false, null)" :loading="loading">添加</el-button>
+        <el-table :data="cooperations" style="width: 100%">
+            <el-table-column type="index" width="50"></el-table-column>
+            <el-table-column label="职位图片" width="200">
+                <template slot-scope="scope">
+                    <el-image :src="scope.row.picUrl"></el-image>
+                    <!--  style="width: 200px; height: 200px" -->
+                </template>
+            </el-table-column>
+            <el-table-column prop="title" label="职位名称" width="150"></el-table-column>
+            <el-table-column label="职位信息">
+                <template slot-scope="scope">
+                    <el-link type="primary" :underline="false" @click="showAll(scope.$index)">查看全文</el-link>
+                </template>
+            </el-table-column>
+            <el-table-column prop="publishTime" label="创建时间" width="150"></el-table-column>
+            <el-table-column label="操作" width="180">
+                <template slot-scope="scope">
+                    <el-button size="small" @click="openDialog(true, scope.$index)" :loading="loading">编辑</el-button>
+                    <el-button size="small" type="danger" @click="deleteCooperation(scope.row.id)" :loading="loading">删除</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+
+        <!-- 添加和编辑的dialog -->
+        <el-dialog title="首页标签" :visible.sync="addDialogVisible" width="600px">
+            {{detail}}
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="addDialogVisible = false">取消</el-button>
+            </span>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+    import request from "@/utils/request";
+    import Tinymce from "@/components/Tinymce";
+    export default {
+        name: "TinymceDemo",
+        components: { Tinymce },
+        data() {
+            return {
+                editing: false,
+                loading: false,
+
+                cooperations: [],
+                addDialogVisible: false,
+                detail: "",
+            };
+        },
+        methods: {
+            //打开对话框
+            openDialog(isEdit, index) {
+                this.$router.push("/position/" + (index==null?0:1));
+            },
+
+            //获取合作信息
+            getCooperations() {
+                this.loading = true;
+                request({
+                    url: "/feedback/listFeedback",
+                    method: "post",
+                    params: {pageIndex:1,pageSize: 9999999}
+                })
+                .then(response => {
+                    this.cooperations = response.data;
+                    this.loading = false;
+                })
+                .catch(error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                    this.loading = false;
+                });
+            },
+
+            //删除合作信息
+            deleteCooperation(id) {
+                request({
+                    url: "/feedback/deleteFeedback",
+                    method: "post",
+                    params: { id: id }
+                })
+                .then(response => {
+                    this.$message({
+                        message: "删除成功",
+                        type: "success"
+                    });
+                    this.getCooperations();
+                    this.addDialogVisible = false;
+                    this.loading = false;
+                })
+                .catch(error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                    this.loading = false;
+                });
+            },
+
+            //切换置顶
+            switchSticky(id) {
+                request({
+                    url: "/cooperations/switchCooperationSticky",
+                    method: "post",
+                    params: { id: id }
+                })
+                .then(response => {
+                    this.$message({
+                        message: "操作成功",
+                        type: "success"
+                    });
+                    this.getCooperations();
+                })
+                .catch(error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+
+            showAll(i) {
+                this.detail = this.cooperations[i].content;
+                this.addDialogVisible = true;
+            }
+        },
+        mounted() {
+            this.getCooperations();
+        }
+    };
+</script>
+
+<style scoped>
+</style>
+

+ 154 - 0
official_frontend/src/views/about/positionEdit.vue

@@ -0,0 +1,154 @@
+<template>
+    <div class="app-container">
+        <el-form ref="form" :model="cooperationsForm" :rules="rules" label-width="100px">
+            <el-form-item label="职位名称" prop="title">
+                <el-input v-model="cooperationsForm.title" placeholder="请输入客户名称" clearable></el-input>
+            </el-form-item>
+            <el-form-item label="职位图片" prop="image">
+                <el-upload ref="upload" action="customize" :http-request="uploadDiscardFile" :limit="1" :before-remove="beforeRemove">
+                    <el-button size="small" type="primary" :loading="loading">上传一张图片</el-button>
+                </el-upload>
+            </el-form-item>
+            <el-form-item label="职位信息" prop="introduction">
+                <tinymce v-model="cooperationsForm.introduction" :height="300" />
+            </el-form-item>
+        </el-form>
+        <span slot="footer" class="dialog-footer" style="float:right;">
+            <el-button @click="$router.go(-1);">取消</el-button>
+            <el-button type="primary" @click="addCooperation()" :loading="loading">提交</el-button>
+        </span>
+    </div>
+</template>
+
+<script>
+    import request from "@/utils/request";
+    import Tinymce from "@/components/Tinymce";
+    export default {
+        name: "TinymceDemo",
+        components: { Tinymce },
+        data() {
+            return {
+                id: this.$route.params.id,
+
+                loading: false,
+                cooperations: [],
+                cooperationsForm: {
+                    id: null,
+                    title: null,
+                    introduction: null,
+                    image: null,
+                },
+                rules: {
+                    title: [{ required: true, message: "请输入职位名称", trigger: "blur" }],
+                    introduction: [{ required: true, message: "请输入职位信息", trigger: "blur"}],
+                },
+            };
+        },
+        methods: {
+            //打开对话框
+            openDialog(isEdit, index) {
+                this.editing = isEdit;
+                if (this.editing) {
+                    this.cooperationsForm.id = this.cooperations[index].id;
+                    this.cooperationsForm.title = this.cooperations[index].companyName;
+                    this.cooperationsForm.title1 = this.cooperations[index].companyName;
+                    this.cooperationsForm.introduction = this.cooperations[index].description;
+                    this.cooperationsForm.image = null;
+                } else {
+                    this.cooperationsForm.id = null;
+                    this.cooperationsForm.title = "";
+                    this.cooperationsForm.title1 = "";
+                    this.cooperationsForm.introduction = "";
+                    this.cooperationsForm.image = null;
+                }
+            },
+
+            //获取合作信息
+            getCooperations() {
+                this.loading = true;
+                request({
+                    url: "/feedback/listFeedback",
+                    method: "post",
+                    params: {pageIndex:1,pageSize: 9999999}
+                })
+                .then(response => {
+                    this.cooperations = response.data;
+                    this.loading = false;
+                })
+                .catch(error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                    this.loading = false;
+                });
+            },
+
+            //添加/编辑合作信息
+            addCooperation() {
+                this.$refs.form.validate(valid => {
+                    if (valid) {
+                        this.loading = true;
+                        var form = new FormData();
+                        form.append("title", this.cooperationsForm.title);
+                        form.append("content", this.cooperationsForm.introduction);
+                        if (this.cooperationsForm.image == null && this.editing == false) {
+                            this.loading =false;
+                            this.$message({
+                                message: "尚未上传图片",
+                                type: "error"
+                            });
+                            return;
+                        } else if (this.cooperationsForm.image != null) {
+                            form.append("file", this.cooperationsForm.image);
+                        }
+                        if (this.cooperationsForm.id != null) {
+                            form.append("id", this.cooperationsForm.id);
+                        }
+                        request({
+                            url: "/feedback/insertOrUpdateFeedback",
+                            method: "post",
+                            data: form
+                        })
+                        .then(response => {
+                            this.$refs.upload.clearFiles();
+                            this.loading = false;
+                            this.$message({
+                                message: this.cooperationsForm.id != null?"修改成功":"添加成功",
+                                type: "success"
+                            });
+                            this.$router.go(-1);
+                        })
+                        .catch(error => {
+                            this.$message({
+                                message: error,
+                                type: "error"
+                            });
+                            this.loading = false;
+                        });
+                    }
+                });
+            },
+
+            //文件上传的部分操作
+            uploadDiscardFile(params) {
+                this.cooperationsForm.image = params.file;
+                return false;
+            },
+
+            //文件上传的移除操作
+            beforeRemove(params) {
+                this.cooperationsForm.image = null;
+            }
+        },
+        mounted() {
+            if(this.id != 0) {
+                this.getCooperations();
+            }
+        }
+    };
+</script>
+
+<style scoped>
+</style>
+