zhibin 6 年之前
父节点
当前提交
a8d2d32690

+ 111 - 0
src/pages/home/edit.vue

@@ -0,0 +1,111 @@
+<template>
+  <div>
+    <el-form ref="form" label-width="80px">
+      <el-form-item label="新闻标题">
+        <el-input v-model="news.title"></el-input>
+      </el-form-item>
+      <el-form-item label="排序">
+        <el-input v-model="news.sort"></el-input>
+      </el-form-item>
+      <el-form-item label="封面图片">
+        <el-upload
+          class="cover-uploader"
+          :action="root + '/system/upload'"
+          :show-file-list="false"
+          :on-success="handleCoverSuccess"
+          :style="{width: '200px', paddingTop: '20%'}">
+          <div class="cover-content">
+            <img v-if="news.cover" :src="news.cover" class="cover">
+            <template v-else class="cover-content">
+              <i class="el-icon-plus cover-uploader-icon"></i>
+              <p>点击上传案例封面图片(限5M)<br> 支持格式为jpg/png</p>
+            </template>
+          </div>
+        </el-upload>
+      </el-form-item>
+
+      <el-form-item label="语言" style="text-align: left">
+        <el-select v-model="news.language" placeholder="语言">
+          <el-option label="中文" :value="1"></el-option>
+          <el-option label="英文" :value="2"></el-option>
+          <el-option label="德文" :value="3"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="关联文章" style="text-align: left">
+        <el-select v-model="news.nid" filterable :filter-method="filter" placeholder="关联文章" >
+          <el-option
+            v-for="item in options"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value">
+          </el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="简介">
+        <div style="padding-right: 10%; position: relative">
+          <el-button type="primary" @click="news.text.push('')" circle class="addText" icon="el-icon-plus"></el-button>
+          <el-input type="text" v-model="news.text[k]" v-for="(t, k) in news.text" :key="k" style="margin-bottom: 10px"></el-input>
+        </div>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="$emit('submit', news)">{{news.id ? '修改' : '创建'}}</el-button>
+        <el-button @click="$emit('quit')">取消</el-button>
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script>
+import {root} from '@/util/http'
+
+export default {
+  props: ['datap'],
+  data () {
+    return {
+      root,
+      options: [],
+      news: {
+        ...this.datap
+      }
+    }
+  },
+  methods: {
+    handleCoverSuccess (data) {
+      this.news.cover = data.content
+    },
+    async filter (keyword) {
+      this.options = (await this.$http.get('/news', {params: {limit: 10, keyword}})).content.data
+      this.options = this.options.map(item => {
+        return {
+          label: item.title,
+          value: item.id
+        }
+      })
+    }
+  },
+  async mounted () {
+    if (!this.news.nid) {
+      this.filter('')
+    } else {
+      let {content} = (await this.$http.get('/news/' + this.news.nid))
+      this.options = [{
+        label: content.title,
+        value: content.id
+      }]
+    }
+
+    if (this.news.text) {
+      this.news.text = JSON.parse(this.news.text)
+    }
+  }
+}
+</script>
+
+<style scoped>
+  .addText {
+    position: absolute;
+    right: 0;
+    top: 0;
+  }
+</style>

+ 158 - 0
src/pages/home/index.vue

@@ -5,10 +5,119 @@
       <p>四维时代致力于让数字化飞入寻常百姓家</p>
       <p>让人工智能真正服务于生活</p>
     </div>
+
+    <div class="model m1">
+      <h2 class="title">
+        <span>首页新闻栏</span>
+        <el-button type="primary" class="insert" icon="el-icon-plus" circle @click="previewData=getNew()"></el-button>
+      </h2>
+      <el-row>
+        <el-col :span="7"  v-for="(_new, index) in news" :key="_new.id" :offset="index%3 === 0 ? 0 : 1">
+          <el-card :body-style="{ padding: '0px' }">
+            <img :src="_new.cover" class="cad-cover">
+            <div style="padding: 14px;" class="card-body">
+              <h3>{{_new.title}}</h3>
+              <div v-html="getTextShow(_new.text)"></div>
+              <div class="opers">
+                <a @click="previewData = _new">编辑</a>
+                <a @click="delNew(_new)">删除</a>
+              </div>
+            </div>
+          </el-card>
+        </el-col>
+      </el-row>
+    </div>
+
+    <div class="preview" v-if="previewData">
+      <div class="preview-layer">
+        <Edit :datap="previewData" class="layer" @quit="previewData = null" @submit="insert"/>
+      </div>
+    </div>
   </div>
 </template>
 
+<script>
+import edit from './edit'
+
+export default {
+  data () {
+    return {
+      previewData: null,
+      news: []
+    }
+  },
+  methods: {
+    getNew () {
+      return {
+        title: '',
+        text: [''],
+        cover: ''
+      }
+    },
+    getTextShow (texts) {
+      return JSON.parse(texts).map(text => '<p>' + text + '</p>').join('')
+    },
+    async insert (data) {
+      let pdata = {...data}
+      pdata.text = JSON.stringify(data.text)
+
+      try {
+        if (data.id) {
+          await this.$http.put('/home_news', pdata)
+        } else {
+          await this.$http.post('/home_news', pdata)
+        }
+        this.previewData = null
+        this.referNews()
+      } catch (e) {
+        this.$error('服务端发生错误!')
+      }
+    },
+    async delNew (data) {
+      if (!confirm('删除后无法恢复,你确定要删除这个新闻栏吗?')) return
+
+      try {
+        await this.$http.delete('/home_news/' + data.id)
+        this.referNews()
+      } catch (e) {
+        this.$error('服务端发生错误!')
+      }
+    },
+    async referNews () {
+      try {
+        let {content} = await this.$http.get('/home_news')
+        this.news = content
+      } catch (e) {
+        this.$error('服务端发生错误!')
+      }
+    }
+  },
+  async mounted () {
+    this.referNews()
+  },
+  components: {Edit: edit}
+}
+</script>
+
 <style scoped>
+.cad-cover {
+  display: block;
+  width: 100%;
+  margin-bottom: 10px;
+}
+
+.card-body div {
+  margin: 10px 0;
+}
+
+.card-body h3 {
+  text-align: center;
+}
+
+.opers a{
+  color: #3a8ee6;
+  font-size: 14px;
+}
 .model {
   background-color: #fff;
   margin-bottom: 30px;
@@ -60,4 +169,53 @@
   word-wrap: break-word;
   word-break: break-all;
 }
+
+.title {
+  padding: 10px 0;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.insert {
+  float: right;
+}
+
+.preview {
+  position: absolute;
+  left: 0;
+  top: 0;
+  bottom: 0;
+  right: 0;
+  background-color: rgba(255, 255, 255, 0.9);
+  z-index: 9999;
+}
+
+.preview-layer {
+  overflow-y: scroll;
+  height: 100%;
+}
+
+.preview .layer {
+  margin: 50px auto;
+  max-width: 780px;
+  text-align: center;
+}
+
+.el-icon-close {
+  position: absolute;
+  right: 20px;
+  top: 10px;
+  font-size: 26px;
+  color: #000;
+  cursor: pointer;
+}
+</style>
+
+<style>
+.card-body div p {
+  margin-bottom: 10px;
+  font-size: 14px;
+  text-indent: 2em;
+}
 </style>

+ 34 - 0
src/pages/layout/index.vue

@@ -2,6 +2,11 @@
   <el-container class="container">
     <el-header class="header">
       <img src="@/assets/images/logo.png" alt="">
+
+      <el-select v-model="lg" placeholder="请选择">
+        <el-option v-for="item in lgs" :key="item.value" :label="item.label" :value="item.value">
+        </el-option>
+      </el-select>
       <a @click="quit" class="span">
         <icon name="cancel" class="icon" />注销
       </a>
@@ -63,6 +68,8 @@ function queryPath (router, name) {
   return paths.concat(result || [])
 }
 
+global.lg = Number(sessionStorage.getItem('lg')) || 1
+
 export default {
   data () {
     return {
@@ -87,7 +94,25 @@ export default {
           name: 'newsList',
           icon: 'news',
           active: false
+        },
+        {
+          text: '媒体资料',
+          name: 'mediaInfo',
+          icon: 'news',
+          active: false
+        },
+        {
+          text: '人才招聘',
+          name: 'personnel',
+          icon: 'news',
+          active: false
         }
+      ],
+      lg: global.lg,
+      lgs: [
+        {label: '中文', value: 1},
+        {label: '英文', value: 2},
+        {label: '德文', value: 3}
       ]
     }
   },
@@ -117,6 +142,15 @@ export default {
           }
         })
       }
+    },
+    lg: {
+      immediate: true,
+      handler (newVal, oldVal) {
+        sessionStorage.setItem('lg', newVal)
+        if (oldVal) {
+          location.reload()
+        }
+      }
     }
   },
   methods: {

+ 7 - 9
src/pages/layout/style.css

@@ -8,25 +8,23 @@
   font-size: 18px;
   overflow: hidden;
   height: 68px !important;
-  position: relative;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
 }
 
 .header img {
   height: 28px;
-  top: 50%;
-  left: 25px;
-  position: absolute;
-  transform: translateY(-50%);
 }
 
 .header .span {
   float: right;
   color: #fff;
   font-size: 14px;
-  top: 50%;
-  right: 25px;
-  position: absolute;
-  transform: translateY(-50%);
+  /* top: 50%;
+  right: 25px; */
+  /* position: absolute; */
+  /* transform: translateY(-50%); */
   vertical-align: middle
 }
 

+ 108 - 0
src/pages/media/edit.vue

@@ -0,0 +1,108 @@
+<template>
+  <div>
+    <el-form ref="form" label-width="80px">
+      <el-form-item label="封面图片">
+        <el-upload
+          class="cover-uploader"
+          :action="root + '/system/upload'"
+          :show-file-list="false"
+          :on-success="handleCoverSuccess"
+          :style="{width: '200px', paddingTop: '20%'}">
+          <div class="cover-content">
+            <img v-if="media.cover" :src="media.cover" class="cover">
+            <template v-else class="cover-content">
+              <i class="el-icon-plus cover-uploader-icon"></i>
+              <p>点击上传案例封面图片(限5M)<br> 支持格式为jpg/png</p>
+            </template>
+          </div>
+        </el-upload>
+      </el-form-item>
+      <el-form-item label="下载包" style="text-align: left">
+        <el-upload
+          class="upload-demo"
+          :action="root + '/system/upload'"
+          :on-success="handleZipSuccess"
+          :on-remove="handleRemove"
+          :file-list="fileList">
+          <el-button size="small" type="primary">点击上传</el-button>
+          <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
+        </el-upload>
+      </el-form-item>
+
+      <el-form-item label="语言" style="text-align: left">
+        <el-select v-model="media.language" placeholder="语言">
+          <el-option label="中文" :value="1"></el-option>
+          <el-option label="英文" :value="2"></el-option>
+          <el-option label="德文" :value="3"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="栏目" style="text-align: left">
+        <el-select v-model="media.type" placeholder="栏目">
+          <el-option label="图标" :value="1"></el-option>
+          <el-option label="活动图集" :value="2"></el-option>
+          <el-option label="办公环境" :value="3"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="排序">
+        <el-input v-model="media.sort"></el-input>
+      </el-form-item>
+      <el-form-item label="介绍">
+        <el-input v-model="media.text"></el-input>
+      </el-form-item>
+
+      <el-form-item>
+        <el-button type="primary" @click="$emit('submit', media)">{{media.id ? '修改' : '创建'}}</el-button>
+        <el-button @click="$emit('quit')">取消</el-button>
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script>
+import {root} from '@/util/http'
+
+export default {
+  props: ['datap'],
+  data () {
+    let fileList = []
+    if (this.datap.zip) {
+      fileList.push({name: '已有文件', url: this.datap.zip})
+    }
+
+    return {
+      root,
+      fileList,
+      media: {
+        ...this.datap
+      }
+    }
+  },
+  methods: {
+    handleCoverSuccess (data) {
+      this.media.cover = data.content
+    },
+    handleRemove () {
+      this.fileList = []
+    },
+    handleZipSuccess (data) {
+      this.fileList = [{
+        name: '成功上传文件',
+        url: data.content
+      }]
+    }
+  },
+  watch: {
+    fileList () {
+      if (this.fileList.length > 0) {
+        this.media.zip = this.fileList[0].url
+      } else {
+        this.media.zip = null
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 115 - 0
src/pages/media/index.vue

@@ -0,0 +1,115 @@
+<template>
+  <div class="layer">
+    <el-button type="primary" plain @click="previewData = getNew()">添加图标</el-button>
+
+    <div class="card">
+      <h2>商标</h2>
+      <div class="icons">
+        <div v-for="icon in icons" :key="icon.id" class="ms-item">
+          <img :src="icon.cover" alt="">
+          <p>{{icon.text}}</p>
+          <a @click="previewData = icon">修改</a>
+          <a @click="del(icon)">删除</a>
+        </div>
+      </div>
+    </div>
+
+    <div class="card">
+      <h2>活动图集</h2>
+      <div class="icons">
+        <div v-for="icon in huods" :key="icon.id" class="ms-item">
+          <img :src="icon.cover" alt="">
+          <p>{{icon.text}}</p>
+          <a @click="previewData = icon">修改</a>
+          <a @click="del(icon)">删除</a>
+        </div>
+      </div>
+    </div>
+
+    <div class="card">
+      <h2>办公环境</h2>
+      <div class="icons">
+        <div v-for="icon in hjins" :key="icon.id" class="ms-item">
+          <img :src="icon.cover" alt="">
+          <p>{{icon.text}}</p>
+          <a @click="previewData = icon">修改</a>
+          <a @click="del(icon)">删除</a>
+        </div>
+      </div>
+    </div>
+
+    <div class="preview" v-if="previewData">
+      <div class="preview-layer">
+        <Edit :datap="previewData" class="layer" @quit="previewData = null" @submit="insert"/>
+      </div>
+    </div>
+
+  </div>
+</template>
+
+<script>
+import edit from './edit'
+
+export default {
+  data () {
+    return {
+      icons: [],
+      huods: [],
+      hjins: [],
+      previewData: null
+    }
+  },
+  methods: {
+    getNew () {
+      return {
+        cover: null,
+        zip: null,
+        language: '',
+        text: '',
+        type: ''
+      }
+    },
+    async referData () {
+      try {
+        let {content} = await this.$http.get('/media')
+        this.icons = content.filter(item => item.type === 1)
+        this.huods = content.filter(item => item.type === 2)
+        this.hjins = content.filter(item => item.type === 3)
+      } catch (e) {
+        this.$error('服务端发生错误!')
+      }
+    },
+    async insert (data) {
+      try {
+        if (data.id) {
+          await this.$http.put('/media', data)
+        } else {
+          await this.$http.post('/media', data)
+        }
+        this.previewData = null
+        this.referData()
+      } catch (e) {
+        this.$error('服务端发生错误!')
+      }
+    },
+    async del (data) {
+      if (!confirm('删除后无法恢复,你确定要删除这个图标集吗?')) return
+
+      try {
+        await this.$http.delete('/media/' + data.id)
+        this.referData()
+      } catch (e) {
+        this.$error('服务端发生错误!')
+      }
+    }
+  },
+  mounted () {
+    this.referData()
+  },
+  components: { Edit: edit }
+}
+</script>
+
+<style scoped>
+@import url('./style.css');
+</style>

+ 69 - 0
src/pages/media/style.css

@@ -0,0 +1,69 @@
+.layer {
+  background-color: #fff;
+  padding: 10px;
+}
+
+.card {
+  border: 1px solid #ccc;
+  margin-top: 20px;
+  padding: 10px;
+}
+
+.card h2 {
+  text-align: center;
+  font-size: 16px;
+}
+
+.preview {
+  position: absolute;
+  left: 0;
+  top: 0;
+  bottom: 0;
+  right: 0;
+  background-color: rgba(255, 255, 255, 0.9);
+  z-index: 9999;
+}
+
+.preview-layer {
+  overflow-y: scroll;
+  height: 100%;
+}
+
+.preview .layer {
+  margin: 50px auto;
+  max-width: 780px;
+  text-align: center;
+}
+
+.ms-item {
+  text-align: center;
+  width: 25%;
+  display: inline-block;
+  padding: 0 10px;
+  margin-bottom: 30px;
+  vertical-align: text-top;
+  box-sizing: border-box;
+}
+
+.ms-item img {
+  display: block;
+  max-width: 100%;
+  margin: 0 auto;
+}
+
+.ms-item p {
+  line-height: 20px;
+  width: 80%;
+  margin: 30px auto;
+  font-size: 14px;
+  color: #5d5d5d;
+}
+
+.ms-item a {
+  font-size: 12px;
+  color: #00b4ed;
+}
+
+.icons {
+  margin-top: 20px;
+}

+ 22 - 0
src/pages/news/details/index.vue

@@ -191,6 +191,28 @@ export default {
   },
   async mounted () {
     let editor = new this.Editor(this.$refs.editContent)
+    editor.customConfig.menus = [
+      'head',
+      'bold',
+      'fontSize',
+      'fontName',
+      'italic',
+      'underline',
+      'strikeThrough',
+      'foreColor',
+      'backColor',
+      'link',
+      'list',
+      'justify',
+      'quote',
+      'emoticon',
+      'image',
+      'table',
+      'video',
+      'code',
+      'undo',
+      'redo'
+    ]
     editor.customConfig.onchange = html => {
       this.content = html
     }

+ 36 - 0
src/pages/news/preview/style.css

@@ -0,0 +1,36 @@
+.del-info {
+  text-align: center;
+  padding-bottom: 10px;
+  border-bottom: 1px solid #e6e6e6;
+  margin-bottom: 20px;
+}
+
+.del-info h2 {
+  font-size: 20px;
+}
+
+.del-info span {
+  display: inline-block;
+  margin: 30px 10px;
+  font-size: 14px;
+}
+
+.del-info img {
+  display: block;
+  margin: 0 auto;
+  max-width: 100%;
+}
+
+.del-info a {
+  color: #09aafe;
+}
+
+@media screen and (min-width: 1040px) { 
+  .del-info h2 {
+    font-size: 30px;
+  }
+
+  .del-info span {
+    font-size: 16px
+  }
+}

+ 79 - 0
src/pages/personnel/edit.vue

@@ -0,0 +1,79 @@
+<template>
+  <div>
+    <el-form ref="form" label-width="80px">
+      <el-form-item label="工作地点" style="text-align: left">
+        <el-select v-model="media.address" placeholder="工作地点">
+          <el-option label="珠海" value="珠海"></el-option>
+          <el-option label="芜湖" value="芜湖"></el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="岗位类别" style="text-align: left">
+        <el-select v-model="media.type" placeholder="岗位类别">
+          <el-option label="开发类" value="开发类"></el-option>
+          <el-option label="设计类" value="设计类"></el-option>
+          <el-option label="硬件类" value="硬件类"></el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="语言" style="text-align: left">
+        <el-select v-model="media.language" placeholder="语言">
+          <el-option label="中文" :value="1"></el-option>
+          <el-option label="英文" :value="2"></el-option>
+          <el-option label="德文" :value="3"></el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="人数">
+        <el-input v-model="media.count"></el-input>
+      </el-form-item>
+      <el-form-item label="岗位">
+        <el-input v-model="media.title"></el-input>
+      </el-form-item>
+      <el-form-item label="职位描述">
+        <div style="padding-right: 10%; position: relative">
+          <el-button type="primary" @click="media.describe.push('')" circle class="addText" icon="el-icon-plus"></el-button>
+          <el-input type="text" v-model="media.describe[k]" v-for="(t, k) in media.describe" :key="k" style="margin-bottom: 10px"></el-input>
+        </div>
+      </el-form-item>
+      <el-form-item label="任职要求">
+        <div style="padding-right: 10%; position: relative">
+          <el-button type="primary" @click="media.requirement.push('')" circle class="addText" icon="el-icon-plus"></el-button>
+          <el-input type="text" v-model="media.requirement[k]" v-for="(t, k) in media.requirement" :key="k" style="margin-bottom: 10px"></el-input>
+        </div>
+      </el-form-item>
+      <el-form-item label="加分项">
+        <div style="padding-right: 10%; position: relative">
+          <el-button type="primary" @click="media.bonus.push('')" circle class="addText" icon="el-icon-plus"></el-button>
+          <el-input type="text" v-model="media.bonus[k]" v-for="(t, k) in media.bonus" :key="k" style="margin-bottom: 10px"></el-input>
+        </div>
+      </el-form-item>
+
+      <el-form-item>
+        <el-button type="primary" @click="$emit('submit', media)">{{media.id ? '修改' : '创建'}}</el-button>
+        <el-button @click="$emit('quit')">取消</el-button>
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script>
+export default {
+  props: ['datap'],
+  data () {
+    return {
+      media: {
+        ...this.datap
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+  .addText {
+    position: absolute;
+    right: 0;
+    top: 0;
+  }
+</style>

+ 116 - 0
src/pages/personnel/index.vue

@@ -0,0 +1,116 @@
+<template>
+  <div class="layer">
+    <el-button type="primary" plain @click="previewData = getNew()">添加职位</el-button>
+
+    <el-table :data="personnels" style="width: 100%">
+      <el-table-column prop="address" label="工作地点" width="100px">
+      </el-table-column>
+      <el-table-column prop="type" label="岗位类别"  width="100px">
+      </el-table-column>
+      <el-table-column prop="title" label="岗位" width="100px">
+      </el-table-column>
+      <el-table-column prop="count" label="招聘人数" width="100px">
+      </el-table-column>
+      <el-table-column prop="describe" label="职位描述">
+        <div slot-scope="{row}" style="text-align:left">
+          <p v-for="(t, i) in row.describe" :key="i">{{i+1}}.{{t}}</p>
+        </div>
+      </el-table-column>
+      <el-table-column prop="requirement" label="任职要求">
+        <div slot-scope="{row}" style="text-align:left">
+          <p v-for="(t, i) in row.requirement" :key="i">{{i+1}}.{{t}}</p>
+        </div>
+      </el-table-column>
+      <el-table-column prop="bonus" label="加分项">
+        <div slot-scope="{row}" style="text-align:left">
+          <p v-for="(t, i) in row.bonus" :key="i">{{i+1}}.{{t}}</p>
+        </div>
+      </el-table-column>
+    <el-table-column label="操作" width="160px">
+      <template slot-scope="scope">
+        <el-button size="mini" @click="previewData=scope.row">编辑</el-button>
+        <el-button size="mini" type="danger" @click="del(scope.row)">删除</el-button>
+      </template>
+    </el-table-column>
+    </el-table>
+
+    <div class="preview" v-if="previewData">
+      <div class="preview-layer">
+        <Edit :datap="previewData" class="layer" @quit="previewData = null" @submit="insert"/>
+      </div>
+    </div>
+
+  </div>
+</template>
+
+<script>
+import edit from './edit'
+
+export default {
+  data () {
+    return {
+      personnels: [],
+      previewData: null
+    }
+  },
+  methods: {
+    getNew () {
+      return {
+        language: '',
+        text: '',
+        type: '',
+        describe: [''],
+        requirement: [''],
+        bonus: ['']
+      }
+    },
+    async referData () {
+      try {
+        let {content} = await this.$http.get('/personnel')
+        content.forEach(item => {
+          item.describe = JSON.parse(item.describe)
+          item.requirement = JSON.parse(item.requirement)
+          item.bonus = item.bonus ? JSON.parse(item.bonus) : []
+        })
+        this.personnels = content
+      } catch (e) {
+        this.$error('服务端发生错误!')
+      }
+    },
+    async insert (data) {
+      data.describe = JSON.stringify(data.describe)
+      data.requirement = JSON.stringify(data.requirement)
+      data.bonus = JSON.stringify(data.bonus)
+      try {
+        if (data.id) {
+          await this.$http.put('/personnel', data)
+        } else {
+          await this.$http.post('/personnel', data)
+        }
+        this.previewData = null
+        this.referData()
+      } catch (e) {
+        this.$error('服务端发生错误!')
+      }
+    },
+    async del (data) {
+      if (!confirm('删除后无法恢复,你确定要删除这个职位吗?')) return
+
+      try {
+        await this.$http.delete('/personnel/' + data.id)
+        this.referData()
+      } catch (e) {
+        this.$error('服务端发生错误!')
+      }
+    }
+  },
+  mounted () {
+    this.referData()
+  },
+  components: { Edit: edit }
+}
+</script>
+
+<style scoped>
+@import url('./style.css');
+</style>

+ 69 - 0
src/pages/personnel/style.css

@@ -0,0 +1,69 @@
+.layer {
+  background-color: #fff;
+  padding: 10px;
+}
+
+.card {
+  border: 1px solid #ccc;
+  margin-top: 20px;
+  padding: 10px;
+}
+
+.card h2 {
+  text-align: center;
+  font-size: 16px;
+}
+
+.preview {
+  position: absolute;
+  left: 0;
+  top: 0;
+  bottom: 0;
+  right: 0;
+  background-color: rgba(255, 255, 255, 0.9);
+  z-index: 9999;
+}
+
+.preview-layer {
+  overflow-y: scroll;
+  height: 100%;
+}
+
+.preview .layer {
+  margin: 50px auto;
+  max-width: 780px;
+  text-align: center;
+}
+
+.ms-item {
+  text-align: center;
+  width: 25%;
+  display: inline-block;
+  padding: 0 10px;
+  margin-bottom: 30px;
+  vertical-align: text-top;
+  box-sizing: border-box;
+}
+
+.ms-item img {
+  display: block;
+  max-width: 100%;
+  margin: 0 auto;
+}
+
+.ms-item p {
+  line-height: 20px;
+  width: 80%;
+  margin: 30px auto;
+  font-size: 14px;
+  color: #5d5d5d;
+}
+
+.ms-item a {
+  font-size: 12px;
+  color: #00b4ed;
+}
+
+.icons {
+  margin-top: 20px;
+}

+ 16 - 0
src/router/index.js

@@ -6,6 +6,8 @@ import Case from '@/pages/case/list'
 import CaseDetails from '@/pages/case/details'
 import News from '@/pages/news/list'
 import NewsDetails from '@/pages/news/details'
+import Media from '@/pages/media'
+import Personnel from '@/pages/personnel'
 import Home from '@/pages/home'
 
 Vue.use(Router)
@@ -56,6 +58,20 @@ let router = new Router({
           name: 'newsDetails',
           component: NewsDetails,
           remarks: '新闻编辑'
+        },
+        {
+          path: 'media',
+          name: 'mediaInfo',
+          remarks: '媒体资料',
+          component: Media,
+          meta: { cache: true }
+        },
+        {
+          path: 'personnel',
+          name: 'personnel',
+          remarks: '人才招聘',
+          component: Personnel,
+          meta: { cache: true }
         }
       ]
     }

+ 7 - 3
src/util/http.js

@@ -1,10 +1,10 @@
 import axios from 'axios'
 import qs from 'qs'
 
-// const root = 'http://www.4dage.com/newOfficialapi/'
-const root = '/newOfficialapi/'
+const root = 'http://www.4dage.com/newOfficialapi/'
+// const root = '/newOfficialapi/'
 
-// const root = 'http://localhost:7000/'
+// const root = 'http://localhost:7000'
 // const root = 'http://www.4dage.com:7000'
 // 配置请求域名
 axios.defaults.baseURL = root
@@ -12,6 +12,10 @@ axios.defaults.baseURL = root
 
 const configure = (Vue, router, { Message }) => {
   axios.interceptors.request.use(function (config) {
+    if (!config.params) {
+      config.params = {}
+    }
+    config.params.language = global.lg
     config.data = qs.stringify(config.data)
     return config
   }, function (error) {