lrf402788946 5 年之前
父節點
當前提交
0f3669051a
共有 3 個文件被更改,包括 102 次插入4 次删除
  1. 40 0
      src/store.js
  2. 60 3
      src/views/corp/index.vue
  3. 2 1
      vue.config.js

+ 40 - 0
src/store.js

@@ -48,6 +48,16 @@ const api = {
   //栏目管理
   //栏目管理
   columnQuery: '/api/cms/column/list',
   columnQuery: '/api/cms/column/list',
   columnFetch: '/api/cms/column/fetch/{id}',
   columnFetch: '/api/cms/column/fetch/{id}',
+  // 学生关注企业
+  // 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}`,
+  stucorp: `/api/stud/studentcorp`,
+  stucorpsearch: '/api/stud/studentcorp',
+  stucorplist: '/api/stud/studentcorp',
+  stucorpdelete: '/api/stud/studentcorp/{id}',
 };
 };
 
 
 export default new Vuex.Store({
 export default new Vuex.Store({
@@ -324,6 +334,36 @@ export default new Vuex.Store({
       }
       }
       return result;
       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;
+    },
   },
   },
 });
 });
 
 

+ 60 - 3
src/views/corp/index.vue

@@ -44,7 +44,7 @@
               </el-col>
               </el-col>
             </el-row>
             </el-row>
             <el-row id="content1">
             <el-row id="content1">
-              <el-col :span="24">
+              <el-col :span="8">
                 联系电话:<span>{{ corpInfo.job_tel }}</span>
                 联系电话:<span>{{ corpInfo.job_tel }}</span>
               </el-col>
               </el-col>
             </el-row>
             </el-row>
@@ -70,16 +70,23 @@
               </el-col>
               </el-col>
             </el-row>
             </el-row>
           </el-col>
           </el-col>
+          <el-col :span="3">
+            <el-col :span="24">
+              <el-button type="primary" @click="guanzhuAdd()">{{ guanzhu ? '关注企业' : '取消关注' }}</el-button>
+            </el-col>
+          </el-col>
         </el-row>
         </el-row>
         <web-intro title="单位简介" :info="corpInfo"></web-intro>
         <web-intro title="单位简介" :info="corpInfo"></web-intro>
         <web-jobs title="招聘职位" :info="jobList" @search="searchJobs"> </web-jobs>
         <web-jobs title="招聘职位" :info="jobList" @search="searchJobs"> </web-jobs>
       </template>
       </template>
     </recruitdetail-layout>
     </recruitdetail-layout>
+    <toLogin :display="loginDialog" @close="loginDialog = false" title="请登录"></toLogin>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
 import recruitdetailLayout from '@/layout/recruitdetail-layout.vue';
 import recruitdetailLayout from '@/layout/recruitdetail-layout.vue';
+import toLogin from '@/components/to-login.vue';
 import share from '@/layout/share.vue';
 import share from '@/layout/share.vue';
 import webIntro from '@/layout/detail/web-intro.vue';
 import webIntro from '@/layout/detail/web-intro.vue';
 import webJobs from '@/layout/detail/web-jobs.vue';
 import webJobs from '@/layout/detail/web-jobs.vue';
@@ -92,17 +99,24 @@ export default {
     share,
     share,
     webIntro,
     webIntro,
     webJobs,
     webJobs,
+    toLogin,
   },
   },
   data: () => ({
   data: () => ({
     corpInfo: {},
     corpInfo: {},
     jobList: [],
     jobList: [],
+    loginDialog: false,
+    guanzhuData: [],
+    guanzhu: true,
   }),
   }),
   created() {
   created() {
     this.search();
     this.search();
+    if (this.user.id) this.ticketSearch();
+  },
+  computed: {
+    ...mapState(['user']),
   },
   },
-  computed: {},
   methods: {
   methods: {
-    ...mapActions(['corpOperation', 'postOperation']),
+    ...mapActions(['corpOperation', 'postOperation', 'userOperation', 'stucorpOperation']),
     async search() {
     async search() {
       if (!this.$route.query.id) return;
       if (!this.$route.query.id) return;
       let result = await this.corpOperation({ type: 'component', data: { corpid: this.$route.query.id } });
       let result = await this.corpOperation({ type: 'component', data: { corpid: this.$route.query.id } });
@@ -120,6 +134,49 @@ export default {
         this.$set(this, `jobList`, result);
         this.$set(this, `jobList`, result);
       }
       }
     },
     },
+    async ticketSearch() {
+      let result = await this.stucorpOperation({ type: 'search', data: { studid: this.user.id, corpid: this.$route.query.id } });
+      this.$set(this, `guanzhuData`, result.data[0]);
+      if (result.data && result.data.length > 0) {
+        this.guanzhu = false;
+      } else {
+        this.guanzhu = true;
+      }
+    },
+    async getTicket() {
+      if (!this.user.id) {
+        this.loginDialog = true;
+        return false;
+      } else {
+        this.ticketSearch();
+      }
+    },
+    async guanzhuAdd() {
+      if (this.guanzhu) {
+        let query = {};
+        let result = await this.userOperation({ type: 'search', data: { studid: this.user.id } });
+        let info = result.data.info;
+        let body = {};
+        body.studid = this.user.id;
+        body.corpid = this.corpInfo.id;
+        body.corpname = this.corpInfo.corpname;
+        body.studname = info.xm;
+        body.studschool = info.yx;
+        result = await this.stucorpOperation({ type: 'add', data: { query: query, body: body } });
+        this.$set(this, `guanzhuData`, result.data);
+        this.$message.success('关注成功');
+        this.guanzhu = false;
+      } else {
+        let result = await this.stucorpOperation({ type: 'delete', data: { id: this.guanzhuData.id } }); //this.guanzhuData.id
+        if (`${result.errcode}` === '0') {
+          this.$message.success('取消关注成功');
+          this.ticketSearch();
+        } else {
+          this.$message.error(result.errmsg ? result.errmsg : '取消关注失败');
+        }
+        this.guanzhu = true;
+      }
+    },
   },
   },
 };
 };
 </script>
 </script>

+ 2 - 1
vue.config.js

@@ -46,8 +46,9 @@ module.exports = {
         ws: true,
         ws: true,
       },
       },
       '/adminapi': {
       '/adminapi': {
-        target: 'http://10.16.5.15:8105',
+        target: 'http://10.16.5.15:8101',
         ws: true,
         ws: true,
+        pathRewrite: { '^/adminapi': '/api' },
       },
       },
     },
     },
   },
   },