소스 검색

修改一些问题

lrf402788946 5 년 전
부모
커밋
a7caf88603

+ 3 - 2
src/layout/login.vue

@@ -28,9 +28,9 @@ export default {
       }
       let wxtoken = sessionStorage.getItem('wxtoken');
       if (!wxtoken) {
-        window.location.href = `/wxtoken/auth?test=lrf402788946&redirect_uri=${window.location.href}`; //学生:省外=>teststud1;省内=>lrf402788946  企业:13089419810,testcorp1
+        window.location.href = `/wxtoken/auth?test=ocPqjswkUejZHq2ANriNrFFC7A3I&redirect_uri=${window.location.href}`; //学生:省外=>teststud1;省内=>lrf402788946:openid:ocPqjswkUejZHq2ANriNrFFC7A3I  企业:13089419810,testcorp1
       } else {
-        let result = await this.studLogin({ type: `1`, data: { wxtoken: wxtoken } });
+        let result = await this.corpLogin({ type: `1`, data: { wxtoken: wxtoken } }); //studLogin
         if (`${result.errcode}` !== '0') {
           result = await this.corpLogin({ type: `1`, data: { wxtoken: wxtoken } });
           if (`${result.errcode}` !== '0') {
@@ -38,6 +38,7 @@ export default {
             return;
           }
         }
+        sessionStorage.setItem('token', result.data);
         let info = jwt.decode(result.data);
         this.setUser(info);
       }

+ 2 - 0
src/pages/corp/store/index.js

@@ -8,6 +8,7 @@ import * as talks from '@/store/talks';
 import * as resumes from '@/store/resumes';
 import * as letters from '@/store/letters';
 import * as jobfair from '@/store/jobfair';
+import * as school from '@/store/schoolList';
 import * as user from '@/store/user';
 
 Vue.use(Vuex);
@@ -22,6 +23,7 @@ export default new Vuex.Store({
     resumes: resumes,
     letters: letters,
     jobfair: jobfair,
+    school: school,
     user: user,
   },
 });

+ 27 - 2
src/pages/corp/views/jobfair/detailAdd.vue

@@ -18,7 +18,7 @@
         </el-form>
         <el-row type="flex" justify="center" :gutter="20" style="padding:1rem 0;">
           <el-col :span="10" style="text-align:center;">
-            <el-button type="success" @click="toSubmit()">申&nbsp;&nbsp;&nbsp;&nbsp;请</el-button>
+            <el-button type="success" @click="submit()">申&nbsp;&nbsp;&nbsp;&nbsp;请</el-button>
           </el-col>
         </el-row>
       </el-col>
@@ -190,6 +190,7 @@ export default {
     jobList: [],
     OrJobList: [],
     perForm: {},
+    query: {},
     genderList: [{ label: '男' }, { label: '女' }],
     dialogTableVisible: false,
     dialogTableVisibles: false,
@@ -287,7 +288,28 @@ export default {
         this.$set(this, `attendList`, result.data.attendee);
         this.$set(this, `gridData`, result.data.jobs);
         this.$set(this, `loading`, true);
-        this.resetJobList();
+      }
+    },
+    async submit() {
+      let jobs = this.gridData.map(item => item.id);
+      let attendee = this.attendList.map(item => item);
+      let info = JSON.parse(JSON.stringify(this.info));
+      info.jobs = jobs;
+      info.attendee = attendee;
+      let result;
+      if (info.id) {
+        result = await this.fairsOperation({ type: 'applyUpdate', data: { id: this.$route.query.id, info: info } });
+      } else {
+        result = await this.fairsOperation({
+          type: 'apply',
+          data: { ...this.query, info: info },
+        });
+      }
+      if (`${result.errcode}` === '0') {
+        this.$message.success('操作成功');
+        this.$router.push({ path: '/jobfair/index' });
+      } else {
+        this.$message.error(result.errmsg || 'error');
       }
     },
     addjobs(item) {
@@ -366,6 +388,9 @@ export default {
       let result = await this.fairsOperation({ type: 'search', data: { id: this.$route.query.fairId } });
       if (`${result.errcode}` === '0') {
         this.$set(this, `jobfairInfo`, result.data);
+        let { schid, schname, corpid, corpname } = result.data;
+        let query = { schid: schid, schname: schname, fairid: this.$route.query.fairId, corpid: this.user.corpid, corpname: this.user.corpname };
+        this.$set(this, `query`, query);
       }
     },
     // 增加参会人员

+ 1 - 2
src/pages/corp/views/jobfair/index.vue

@@ -84,8 +84,7 @@ export default {
               let object = await this.searchJobfair(item);
               arr.push(object);
             }
-            console.log(arr);
-            this.$set(this, `list`, this.list.concat(arr));
+            this.$set(this, `list`, skip === 0 ? arr : this.list.concat(arr));
           }
           this.$set(this, `totalRow`, result.total);
           this.$set(this, `hasMore`, this.list.length < this.totalRow); //此处是根据数据库总数的结果和当前列表的总条数比较,看看是否可以继续请求数据

+ 34 - 4
src/pages/corp/views/talk/detail.vue

@@ -1,6 +1,11 @@
 <template>
   <div id="detail">
     <el-form ref="form" :model="info" label-width="0" label-position="left" style="padding:0 0.5rem;" :rules="rules">
+      <form-item label="发布学校" prop="schid">
+        <el-col :span="24">
+          <drawer :data="schList" type="schid" need="value" :selected="query.schid" placeholder="请选择发布学校" @select="selectSch"></drawer>
+        </el-col>
+      </form-item>
       <form-item label="招聘简章" prop="profile_id">
         <el-col :span="24">
           <drawer :data="profileList" type="profile_id" need="value" :selected="info.profile_id" placeholder="请选择招聘简章" @select="getProfile"></drawer>
@@ -166,6 +171,8 @@ export default {
     profileList: [],
     jobList: [],
     OrJobList: [],
+    schList: [],
+    query: {},
     datePick: false,
     endDate: `${new Date().getFullYear() + 1}-${new Date().getMonth() + 1}-${new Date().getDate()}`,
     rules: {
@@ -190,9 +197,10 @@ export default {
     loading: true,
   }),
   created() {
+    this.$set(this.info, `title`, JSON.parse(JSON.stringify(this.user.corpname)));
     this.getProfileList();
     this.getJobsList();
-    this.$set(this.info, `title`, this.user.corpname);
+    this.getSchList();
     this.search();
   },
   computed: {
@@ -201,7 +209,7 @@ export default {
     }),
   },
   methods: {
-    ...mapActions(['profilesOperation', 'talksOperation', 'postsOperation']),
+    ...mapActions(['profilesOperation', 'talksOperation', 'postsOperation', 'corpSchInfo']),
     async search() {
       if (this.$route.query.id) {
         this.$set(this, `loading`, false);
@@ -225,7 +233,7 @@ export default {
       } else {
         result = await this.talksOperation({
           type: 'add',
-          data: { info: data, schid: 999991, corpid: this.user.coprid, corpname: this.user.corpname, schname: '测试学校1' },
+          data: { info: data, corpid: this.user.corpid, corpname: this.user.corpname, ...this.query },
         });
       }
       if (`${result.errcode}` === '0') {
@@ -303,12 +311,34 @@ export default {
         let result = await this.profilesOperation({ type: 'search', data: { id: this.info.profile_id } });
         if (`${result.errcode}` === `0`) {
           this.$set(this.info, `content`, result.data.content);
-          this.$set(this.info, `title`, result.data.title);
         }
       } else {
         this.$set(_.get(this, checkType[0]), `${checkType[1]}`, value);
       }
     },
+    async getSchList() {
+      let result = await await this.corpSchInfo({ type: 'list', data: { corpid: this.user.corpid } });
+      if (`${result.errcode}` === '0') {
+        let arr = result.data.map(item => {
+          let object = {};
+          object.label = item.schname;
+          object.value = item.schid;
+          return object;
+        });
+        this.$set(this, `schList`, arr);
+      } else {
+        this.$message.error(result.errmsg ? result.errmsg : 'error');
+      }
+    },
+    selectSch({ type, value }) {
+      let res = this.schList.filter(item => {
+        return `${item.value}` === `${value}`;
+      });
+      if (res.length > 0) {
+        this.$set(this.query, `schid`, value);
+        this.$set(this.query, `schname`, res[0].label);
+      }
+    },
     dateChoose(date) {
       this.$set(this.info, `date`, `${date[0]}-${date[1]}-${date[2]}`);
       this.$set(this.info, `time`, date[5]);

+ 1 - 4
src/pages/index/views/home.vue

@@ -5,10 +5,7 @@
       <template v-slot:left>
         关闭
       </template>
-      <template v-slot:right>
-        <el-link @click="test()">test</el-link>
-        <el-avatar style="position: relative;top: 0.1rem;" size="medium" :src="url"></el-avatar>
-      </template>
+      <template v-slot:right> </template>
       <template v-slot:more-icon>
         &nbsp;
       </template>

+ 1 - 1
src/pages/jobsList/views/jobs/job-list.vue

@@ -12,7 +12,7 @@
                 <el-tag type="warning" v-if="item.is_intern === '1'" style="border-radius: 4px;">实习</el-tag>
                 {{ item.job_name }}
               </el-col>
-              <el-col :span="8" class="list_info_top-sWord">{{ item.create_time || 1 }}</el-col>
+              <el-col :span="8" class="list_info_top-sWord">{{ item.create_time || '' }}</el-col>
             </el-row>
             <el-row type="flex" :gutter="10">
               <el-col :span="16" class="word_etc word_grey">专业:{{ item.zy_req }}</el-col>

+ 2 - 2
src/store/jobfair.js

@@ -36,7 +36,7 @@ export const actions = {
       let { id } = data;
       result = await this.$axios.$delete(api.profilesinfo, {}, { id: id });
     }
-    if (type === 'addCorps') {
+    if (type === 'apply') {
       let { info, corpid, corpname, schid, schname, fairid } = data;
       result = await this.$axios.$post(api.faircorps, info, {}, { corpid: corpid, corpname: corpname, schid: schid, schname: schname, fairid: fairid });
     }
@@ -48,7 +48,7 @@ export const actions = {
       let { id } = data;
       result = await this.$axios.$get(api.faircorpsInfo, { id: id });
     }
-    if (type === 'updateCorps') {
+    if (type === 'applyUpdate') {
       let { info, id } = data;
       result = await this.$axios.$post(api.faircorpsInfo, info, { id: id });
     }

+ 21 - 0
src/store/schoolList.js

@@ -0,0 +1,21 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+
+Vue.use(Vuex);
+const api = {
+  corpSchInfo: '/corp/corps/{corpid}/schs',
+};
+export const state = () => ({});
+export const mutations = {};
+export const actions = {
+  async corpSchInfo({ state, commit }, { type, data }) {
+    let result;
+    if (type === 'list') {
+      let { corpid, skip, limit } = data;
+      result = await this.$axios.$get(`${api.corpSchInfo}`, { corpid: corpid }, { skip: skip, limit: limit });
+    }
+
+    return result;
+  },
+};

+ 1 - 0
src/store/talks.js

@@ -15,6 +15,7 @@ export const actions = {
     let result;
     if (type === 'add') {
       let { info, corpid, corpname, schid, schname } = data;
+      console.log(data);
       result = await this.$axios.$post(api.talks, info, {}, { corpid: corpid, corpname: corpname, schid: schid, schname: schname });
     }
     if (type === 'list') {

+ 3 - 2
src/util/axios-wrapper.js

@@ -75,7 +75,6 @@ export default class AxiosWrapper {
     if (_.isObject(router)) {
       url = AxiosWrapper.routerChange(url, router);
     }
-    console.log(url);
     currentRequests += 1;
     // Indicator.open({
     //   spinnerType: 'fading-circle',
@@ -85,7 +84,9 @@ export default class AxiosWrapper {
       const axios = Axios.create({
         baseURL: this.baseUrl,
       });
-      axios.defaults.headers.common.Authorization = util.token;
+      if (sessionStorage.getItem('token')) {
+        axios.defaults.headers.common.Authorization = util.token;
+      }
       let res = await axios.request({
         method: isNullOrUndefined(data) ? 'get' : 'post',
         url,