lrf402788946 il y a 5 ans
Parent
commit
3c873ca209
4 fichiers modifiés avec 56 ajouts et 6 suppressions
  1. 1 0
      .gitignore
  2. 33 6
      src/layout/layout-part/heads.vue
  3. 17 0
      src/store.js
  4. 5 0
      vue.config.js

+ 1 - 0
.gitignore

@@ -2,6 +2,7 @@
 node_modules
 /dist
 package-lock.json
+.eslintignore
 
 # local env files
 .env.local

+ 33 - 6
src/layout/layout-part/heads.vue

@@ -9,10 +9,7 @@
         <h3 class="headCompany">{{ user.corpname }}</h3>
       </div>
       <div class="headBtn">
-        <el-popover placement="left-start" title="" width="400" trigger="hover">
-          <div class="popover-content" v-html="html"></div>
-          <el-button slot="reference"><span class="el-icon-message info_icon"></span></el-button>
-        </el-popover>
+        <notice :list="noticeList" :total="total" @delete="noticeDelete"></notice>
         <!-- <span class="mr14">|</span> -->
         <!-- <a href="" class="mr14" style="color:red" title="云校招企业服务平台简明使用手册"> <span class="el-icon-question info_icon"></span> 帮助 </a> -->
         <span class="mr14">|</span>
@@ -48,12 +45,15 @@
 </template>
 
 <script>
+import notice from '@publics/src/components/notice.vue';
 import { mapActions, mapState, mapMutations } from 'vuex';
 const jwt = require('jsonwebtoken');
 export default {
   name: 'heads',
   props: {},
-  components: {},
+  components: {
+    notice,
+  },
   data: () => ({
     dialog: false,
     form: {},
@@ -62,17 +62,26 @@ export default {
     },
     formLabelWidth: '120px',
     html: '<ul class="popoverCon"><li>没有消息</li></ul><a class="popoverBtn">点击进入信息中心<span class="el-icon-d-arrow-right info_icon"></span></a>',
+    noticeList: [],
+    total: 0,
   }),
   created() {
     this.setUser();
     this.check();
   },
+  watch: {
+    $route: {
+      handler(val) {
+        this.getNoticeList();
+      },
+    },
+  },
   computed: {
     ...mapState(['user']),
   },
   methods: {
     ...mapMutations(['setUser']),
-    ...mapActions(['userOperation']),
+    ...mapActions(['userOperation', 'noticeOperation']),
     check() {
       if (!this.user.corpid) this.$router.push({ path: '/login' });
     },
@@ -105,6 +114,19 @@ export default {
       this.setUser(undefined);
       this.$router.push('/login');
     },
+    async getNoticeList() {
+      let result = await this.noticeOperation({ type: 'list', data: { userid: this.user.corpid, type: 1 } });
+      if (`${result.errcode}` === '0') {
+        this.$set(this, `total`, result.total);
+        this.$set(this, `noticeList`, result.data ? result.data : []);
+      }
+    },
+    async noticeDelete(id) {
+      let result = await this.noticeOperation({ type: 'delete', data: { id: id } });
+      if (`${result.errcode}` === '0') {
+        this.getNoticeList();
+      }
+    },
   },
 };
 </script>
@@ -168,6 +190,11 @@ a {
 .popover-content {
   margin: 0;
   padding: 0;
+  .el-col {
+    border-bottom: 1px dashed #cccccc;
+    font-size: 0.8rem;
+    height: 1.25rem;
+  }
 }
 /deep/.el-popper {
   border: 1px solid #ccc;

+ 17 - 0
src/store.js

@@ -48,6 +48,9 @@ const api = {
   stucorplist: `/adminapi${process.env.NODE_ENV === 'development' ? '' : ' / jobs'}/studentcorp`,
   stucorpupdate: `/adminapi${process.env.NODE_ENV === 'development' ? '' : ' / jobs'}/studentcorp`,
   stucorpdelete: `/adminapi${process.env.NODE_ENV === 'development' ? '' : ' / jobs'}/studentcorp/{id}`,
+  //待办事项
+  notice: `${process.env.NODE_ENV === 'development' ? '/napi' : '/api'}/message`,
+  noticeDelete: `${process.env.NODE_ENV === 'development' ? '/napi' : '/api'}/message/{id}`,
 };
 
 export default new Vuex.Store({
@@ -403,6 +406,20 @@ export default new Vuex.Store({
       }
       return result;
     },
+    //待办事项
+    async noticeOperation({ state }, { type, data }) {
+      let result;
+      let { skip, limit } = data;
+      if (type === 'list') {
+        let { userid, type } = data;
+        result = await this.$axios.$get(api.notice, {}, { userid: `2`, type: type, skip: skip, limit: limit });
+      }
+      if (type === 'delete') {
+        let { id } = data;
+        result = await this.$axios.$delete(api.noticeDelete, {}, { id: id });
+      }
+      return result;
+    },
   },
 });
 

+ 5 - 0
vue.config.js

@@ -40,6 +40,11 @@ module.exports = {
         ws: true,
         pathRewrite: { '^/adminapi': '/api' },
       },
+      '/napi': {
+        target: 'http://10.16.11.186:8103',
+        ws: true,
+        pathRewrite: { '^/napi': '/api' },
+      },
     },
   },
 };