guhongwei преди 5 години
родител
ревизия
83b21ab3dc
променени са 2 файла, в които са добавени 48 реда и са изтрити 3 реда
  1. 36 0
      src/store.js
  2. 12 3
      src/views/home/index.vue

+ 36 - 0
src/store.js

@@ -42,6 +42,12 @@ const api = {
   //短信验证码
   message: '/adminapi/verify/sendmessage',
   checkMessage: '/adminapi/verify/check_message',
+  // 关注数
+  stucorp: `/adminapi${process.env.NODE_ENV === 'development' ? '' : ' / jobs'}/studentcorp`,
+  stucorpsearch: `/adminapi${process.env.NODE_ENV === 'development' ? '' : ' / jobs'}/studentcorp`,
+  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}`,
 };
 
 export default new Vuex.Store({
@@ -371,6 +377,36 @@ export default new Vuex.Store({
       }
       return result;
     },
+    // 学生关注企业
+    async stucorpOperation({ state }, { type, data }) {
+      let result;
+      let { skip, limit } = data;
+      if (type === 'add') {
+        let { query, body } = data;
+        result = await this.$axios.$post(api.stucorp, body, {}, query);
+      }
+      if (type === 'list') {
+        let { corpid, corpname, studid, studname, studschool } = data;
+        result = await this.$axios.$get(
+          api.stucorplist,
+          {},
+          { corpid: corpid, corpname: corpname, studid: studid, studname: studname, studschool: studschool, skip: skip, limit: limit }
+        );
+      }
+      if (type === 'search') {
+        let { id, studid, corpid } = data;
+        result = await this.$axios.$get(api.stucorpsearch, {}, { studid: studid, corpid: corpid });
+      }
+      if (type === 'update') {
+        let { info, id } = data;
+        result = await this.$axios.$post(api.stucorpupdate, info, { id: id });
+      }
+      if (type === 'delete') {
+        let { id } = data;
+        result = await this.$axios.$delete(api.stucorpdelete, {}, { id: id });
+      }
+      return result;
+    },
   },
 });
 

+ 12 - 3
src/views/home/index.vue

@@ -59,8 +59,8 @@
           <li>
             <a href="">
               <span>
-                <em class="number number_s">0</em>
-                <strong class="title">微信关注数</strong>
+                <em class="number number_s">{{ totalGuanzhu }}</em>
+                <strong class="title">关注数</strong>
               </span>
             </a>
           </li>
@@ -135,6 +135,7 @@ export default {
     totalRow: 0,
     totalRowPost: 0,
     totalRowResume: 0,
+    totalGuanzhu: 0,
     resumeListSys: [
       { message: '【在线招聘】您申请的在线招聘:"fffffff,已通过审批', day: '2019-07-02 16:05' },
       { message: '【在线招聘】您申请的在线招聘:"fffffff,已通过审批', day: '2019-07-02 16:05' },
@@ -153,7 +154,7 @@ export default {
     ...mapState(['user']),
   },
   methods: {
-    ...mapActions(['resumesOperation', 'lettersOperation', 'corpSchInfo', 'postOperation']),
+    ...mapActions(['resumesOperation', 'lettersOperation', 'corpSchInfo', 'postOperation', 'stucorpOperation']),
     async search(searchInfo) {
       //1直接拿着参数发送请求
       let result = await this.lettersOperation({ type: 'list', data: { corpname: this.user.corpname } });
@@ -163,6 +164,14 @@ export default {
       } else {
         this.$message.error(result.errmsg ? result.errmsg : 'error');
       }
+      result = await this.stucorpOperation({ type: 'list', data: { corpid: this.user.id, corpname: this.user.corpname, schid: 999991 } });
+      if (`${result.errcode}` === '0') {
+        //给this=>vue的实例下在中的list属性,赋予result.data的值
+        console.log(result);
+        this.$set(this, `totalGuanzhu`, result.total);
+      } else {
+        this.$message.error(result.errmsg ? result.errmsg : 'error');
+      }
       result = await this.resumesOperation({ type: 'list', data: { schid: 999991, year: 2018, ...searchInfo } });
       if (`${result.errcode}` === '0') {
         let arr = [];