lrf402788946 5 năm trước cách đây
mục cha
commit
8714f8cb7e
4 tập tin đã thay đổi với 52 bổ sung33 xóa
  1. 28 6
      src/layout/layout-part/heads.vue
  2. 17 0
      src/store.js
  3. 2 2
      src/views/login/login.vue
  4. 5 25
      vue.config.js

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

@@ -8,10 +8,7 @@
         <h3 class="headCompany">学生管理</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 class="mr14" style="color:red"> <span class="el-icon-question info_icon"></span> 帮助 </a> -->
         <span class="mr14">|</span>
@@ -49,12 +46,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: () => ({
     visible: false,
     html: '<ul class="popoverCon"><li>没有消息</li></ul><a class="popoverBtn">点击进入信息中心<span class="el-icon-d-arrow-right info_icon"></span></a>',
@@ -63,17 +63,26 @@ export default {
     rules: {
       passwd: [{ required: true, message: '请输入新密码', trigger: 'blur' }],
     },
+    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.id) this.$router.push({ path: '/login' });
     },
@@ -106,6 +115,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: 3 } });
+      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>

+ 17 - 0
src/store.js

@@ -29,6 +29,9 @@ const api = {
   //验证码
   verify: '/adminapi/verify/verify',
   checkVerify: '/adminapi/verify/check_verify',
+  //待办事项
+  notice: `${process.env.NODE_ENV === 'development' ? '/napi' : '/api'}/message`,
+  noticeDelete: `${process.env.NODE_ENV === 'development' ? '/napi' : '/api'}/message/{id}`,
 };
 export default new Vuex.Store({
   state: {
@@ -227,6 +230,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: userid, type: type, skip: skip, limit: limit });
+      }
+      if (type === 'delete') {
+        let { id } = data;
+        result = await this.$axios.$delete(api.noticeDelete, {}, { id: id });
+      }
+      return result;
+    },
   },
 });
 

+ 2 - 2
src/views/login/login.vue

@@ -119,8 +119,8 @@ export default {
     toSubmit() {
       this.$refs.form.validate(valid => {
         if (valid) {
-          // this.submit();
-          this.checkVerify();
+          this.submit();
+          // this.checkVerify();
         }
         return false;
       });

+ 5 - 25
vue.config.js

@@ -38,35 +38,15 @@ module.exports = {
         changeOrigin: true,
         ws: true,
       },
-      '/loginProject': {
-        target: 'http://localhost:8001',
-        changeOrigin: true,
-        ws: true,
-      },
-      '/studentProject': {
-        target: 'http://localhost:8002',
-        changeOrigin: true,
-        ws: true,
-      },
-      '/corpProject': {
-        target: 'http://localhost:8003',
-        changeOrigin: true,
-        ws: true,
-      },
-      '/protalProject': {
-        target: 'http://localhost:8004',
-        changeOrigin: true,
-        ws: true,
-      },
-      '/mobileProject': {
-        target: 'http://localhost:8005',
-        changeOrigin: true,
-        ws: true,
-      },
       '/adminapi': {
         target: 'http://10.16.5.15:8105',
         ws: true,
       },
+      '/napi': {
+        target: 'http://10.16.11.186:8103',
+        ws: true,
+        pathRewrite: { '^/napi': '/api' },
+      },
     },
   },
 };