|
@@ -0,0 +1,333 @@
|
|
|
+import Vue from 'vue';
|
|
|
+import Vuex from 'vuex';
|
|
|
+import _ from 'lodash';
|
|
|
+
|
|
|
+Vue.use(Vuex);
|
|
|
+const api = {
|
|
|
+ corpInfo: '/api/corp/corps/{corpid}/info',
|
|
|
+ corpBase: '/api/corp/corps/{corpid}',
|
|
|
+ hr: '/api/corp/corps/{corpid}/users', //list,add
|
|
|
+ hrImp: '/api/corp/users/{id}', //查询:id:手机号,用户肯定不知道id啊!那就手机号呗;修改:用id
|
|
|
+ corpIdentity: '/api/corp/corps/{corpid}/identity',
|
|
|
+ corpSchInfo: '/api/corp/corps/{corpid}/schs',
|
|
|
+ schs: '/api/corp/schs', //get:按学校查询入驻企业列表;post:申请入驻学校
|
|
|
+ profiles: '/api/jobs/profiles', //get查询招生简章列表;post创建招生简章
|
|
|
+ posts: '/api/jobs/posts',
|
|
|
+ postsinfo: '/api/jobs/posts/{id}',
|
|
|
+ profilesinfo: '/api/jobs/profiles/{id}',
|
|
|
+ infos: '/api/jobs/infos',
|
|
|
+ fairs: '/api/jobs/fairs',
|
|
|
+ fairsinfo: '/api/jobs/fairs/{id}',
|
|
|
+ faircorps: '/api/jobs/faircorps',
|
|
|
+ faircorpsInfo: '/api/jobs/faircorps/{id}',
|
|
|
+ infoss: '/api/jobs/infos/{id}',
|
|
|
+ talks: '/api/jobs/talks',
|
|
|
+ talksinfo: '/api/jobs/talks/{id}',
|
|
|
+ resumes: '/api/jobs/resumes',
|
|
|
+ letters: '/api/jobs/letters',
|
|
|
+ lettersinfo: '/api/jobs/letters/{id}',
|
|
|
+ userReg: '/api/stud/registers/{id}',
|
|
|
+ connection: '/weixin/qrcode/create',
|
|
|
+ wxtoken: '/weixin/qrcode/{qrcode}/token',
|
|
|
+ corpBind: '/api/corp/bind', //post=>query;corpid;body:mobile,wxtoken
|
|
|
+ corpLogin: '/api/corp/login',
|
|
|
+};
|
|
|
+
|
|
|
+export default new Vuex.Store({
|
|
|
+ state: {
|
|
|
+ user: {},
|
|
|
+ },
|
|
|
+ mutations: {
|
|
|
+ setUser(state, payload) {
|
|
|
+ if (payload) {
|
|
|
+ state.user = payload;
|
|
|
+ sessionStorage.setItem('user', JSON.stringify(payload));
|
|
|
+ } else {
|
|
|
+ let user = sessionStorage.getItem('user');
|
|
|
+ if (user) state.user = JSON.parse(user);
|
|
|
+ else return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ actions: {
|
|
|
+ //用户信息
|
|
|
+ async userOperation({ state }, { type, data }) {
|
|
|
+ let result;
|
|
|
+ if (type === 'search') {
|
|
|
+ let { id } = data;
|
|
|
+ result = await this.$axios.$get(api.userReg, { id: id });
|
|
|
+ }
|
|
|
+ if (type === 'passwd') {
|
|
|
+ let { id, info } = data;
|
|
|
+ result = await this.$axios.$post(api.userReg, info, { id: id });
|
|
|
+ }
|
|
|
+ if (type === 'login') {
|
|
|
+ let { loginType, info } = data;
|
|
|
+ result = this.$axios.$post(api.corpLogin, info, {}, { type: loginType });
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ 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;
|
|
|
+ },
|
|
|
+ //宣讲会
|
|
|
+ async postTalksInfo({ state }, { type, data }) {
|
|
|
+ let { skip, limit } = data;
|
|
|
+ let result;
|
|
|
+ if (type === 'add') {
|
|
|
+ let { info, corpid, corpname, schid, schname } = data;
|
|
|
+ result = await this.$axios.$post(api.talks, info, {}, { schid: schid, corpid: corpid, corpname: corpname, schname: schname });
|
|
|
+ }
|
|
|
+ if (type === 'list') {
|
|
|
+ let { corpid, status } = data;
|
|
|
+ result = await this.$axios.$get(api.talks, {}, { corpid: corpid, status: status, skip: skip, limit: limit });
|
|
|
+ }
|
|
|
+ if (type === 'search') {
|
|
|
+ let { id } = data;
|
|
|
+ result = await this.$axios.$get(api.talksinfo, { id: id });
|
|
|
+ }
|
|
|
+ if (type === 'update') {
|
|
|
+ let { info, id } = data;
|
|
|
+ result = await this.$axios.$post(api.talksinfo, info, { id: id });
|
|
|
+ }
|
|
|
+ if (type === 'delete') {
|
|
|
+ let { id } = data;
|
|
|
+ result = await this.$axios.$delete(api.talksinfo, {}, { id: id });
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ //在线招聘
|
|
|
+ async jobinfoOperation({ state }, { type, data }) {
|
|
|
+ let { skip, limit } = data;
|
|
|
+ let result;
|
|
|
+ if (type === 'add') {
|
|
|
+ let { info, corpid, corpname, schid, schname } = data;
|
|
|
+ result = await this.$axios.$post(api.infos, info, {}, { schid: schid, corpid: corpid, corpname: corpname, schname: schname });
|
|
|
+ }
|
|
|
+ if (type === 'list') {
|
|
|
+ let { corpid, is_practice, status } = data;
|
|
|
+ result = await this.$axios.$get(api.infos, {}, { corpid: corpid, skip: skip, limit: limit, is_practice: is_practice, status: status });
|
|
|
+ }
|
|
|
+ if (type === 'search') {
|
|
|
+ let { id } = data;
|
|
|
+ result = await this.$axios.$get(api.infoss, { id: id });
|
|
|
+ }
|
|
|
+ if (type === 'update') {
|
|
|
+ let { info, id } = data;
|
|
|
+ result = await this.$axios.$post(api.infoss, info, { id: id });
|
|
|
+ }
|
|
|
+ if (type === 'delete') {
|
|
|
+ let { id } = data;
|
|
|
+ result = await this.$axios.$delete(api.infoss, {}, { id: id });
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ //职位管理
|
|
|
+ async postOperation({ state }, { type, data }) {
|
|
|
+ let { skip, limit } = data;
|
|
|
+ let result;
|
|
|
+ if (type === 'add') {
|
|
|
+ let { info, corpid, corpname } = data;
|
|
|
+ result = await this.$axios.$post(api.posts, info, {}, { corpid: corpid, corpname: corpname });
|
|
|
+ }
|
|
|
+ if (type === 'list') {
|
|
|
+ let { corpid, is_practice } = data;
|
|
|
+ result = await this.$axios.$get(`${api.posts}`, {}, { corpid: corpid, skip: skip, limit: limit, is_practice: is_practice });
|
|
|
+ }
|
|
|
+ if (type === 'search') {
|
|
|
+ let { id } = data;
|
|
|
+ result = await this.$axios.$get(api.postsinfo, { id: id });
|
|
|
+ }
|
|
|
+ if (type === 'update') {
|
|
|
+ let { info, id } = data;
|
|
|
+ result = await this.$axios.$post(api.postsinfo, info, { id: id });
|
|
|
+ }
|
|
|
+ if (type === 'delete') {
|
|
|
+ let { id } = data;
|
|
|
+ result = await this.$axios.$delete(api.postsinfo, {}, { id: id });
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ //hr一系列操作
|
|
|
+ async hrOperation({ state }, { type, data }) {
|
|
|
+ let result;
|
|
|
+ if (type === `delete`) {
|
|
|
+ let { id } = data;
|
|
|
+ result = await this.$axios.$delete(api.hrImp, {}, { id: id });
|
|
|
+ } else if (type === `add`) {
|
|
|
+ let { corpid, info } = data;
|
|
|
+ result = await this.$axios.$post(api.hr, info, { corpid: corpid });
|
|
|
+ } else if (type === 'search') {
|
|
|
+ let { tel } = data;
|
|
|
+ result = await this.$axios.$get(api.hrImp, { id: tel });
|
|
|
+ } else if (type === 'update') {
|
|
|
+ let { info } = data;
|
|
|
+ let { passwd, id } = info;
|
|
|
+ result = await this.$axios.$post(api.hrImp, { passwd: passwd }, { id: id });
|
|
|
+ } else {
|
|
|
+ result = await this.$axios.$get(api.hr, { corpid: data });
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ //招聘简章
|
|
|
+ async profilesOperation({ state }, { type, data }) {
|
|
|
+ let { skip, limit } = data;
|
|
|
+ let result;
|
|
|
+ if (type === 'add') {
|
|
|
+ let { info, corpid, corpname } = data;
|
|
|
+ result = await this.$axios.$post(api.profiles, info, {}, { corpid: corpid, corpname: corpname });
|
|
|
+ }
|
|
|
+ if (type === 'list') {
|
|
|
+ let { corpid } = data;
|
|
|
+ result = await this.$axios.$get(api.profiles, {}, { corpid: corpid, skip: skip, limit: limit });
|
|
|
+ }
|
|
|
+ if (type === 'search') {
|
|
|
+ let { id } = data;
|
|
|
+ result = await this.$axios.$get(api.profilesinfo, { id: id });
|
|
|
+ }
|
|
|
+ if (type === 'update') {
|
|
|
+ let { info, id } = data;
|
|
|
+ result = await this.$axios.$post(api.profilesinfo, info, { id: id });
|
|
|
+ }
|
|
|
+ if (type === 'delete') {
|
|
|
+ let { id } = data;
|
|
|
+ result = await this.$axios.$delete(api.profilesinfo, {}, { id: id });
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ //企业基本信息
|
|
|
+ async corpOperation({ state }, { type, data }) {
|
|
|
+ let result;
|
|
|
+ if (type === 'search') {
|
|
|
+ let { corpid } = data;
|
|
|
+ let info = await this.$axios.$get(`${api.corpInfo}`, { corpid: corpid });
|
|
|
+ let base = await this.$axios.$get(api.corpBase, { corpid: corpid });
|
|
|
+ let identity = await this.$axios.$get(api.corpIdentity, { corpid: corpid });
|
|
|
+ return { info: info.data, base: base.data, identity: identity.data };
|
|
|
+ }
|
|
|
+ if (type === 'info') {
|
|
|
+ let { corpid, info } = data;
|
|
|
+ result = await this.$axios.$post(api.corpInfo, info, { corpid: corpid });
|
|
|
+ }
|
|
|
+ if (type === 'identity') {
|
|
|
+ let { corpid, info } = data;
|
|
|
+ result = await this.$axios.$post(api.corpIdentity, info, { corpid: corpid });
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ //入驻学校
|
|
|
+ async joinSch({ state }, { schid, corpid }) {
|
|
|
+ let result = await this.$axios.$post(api.schs, { schid: schid, corpid: corpid });
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ // 简历管理
|
|
|
+ async resumesOperation({ state }, { type, data }) {
|
|
|
+ let result;
|
|
|
+ if (type === 'list') {
|
|
|
+ let { schid, year } = data;
|
|
|
+ result = await this.$axios.$get(api.resumes, {}, { schid: schid, year: year });
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ //求职信
|
|
|
+ async lettersOperation({ state }, { type, data }) {
|
|
|
+ let result;
|
|
|
+ let { skip, limit } = data;
|
|
|
+ if (type === 'list') {
|
|
|
+ let { resume_id, status, corpname, studname, post_id } = data;
|
|
|
+ result = await this.$axios.$get(
|
|
|
+ api.letters,
|
|
|
+ {},
|
|
|
+ { post_id: post_id, resume_id: resume_id, status: status, corpname: corpname, studname: studname, skip: skip, limit: limit }
|
|
|
+ );
|
|
|
+ }
|
|
|
+ if (type === 'search') {
|
|
|
+ let { id } = data;
|
|
|
+ result = await this.$axios.$get(api.lettersinfo, { id: id });
|
|
|
+ }
|
|
|
+ if (type === 'update') {
|
|
|
+ let { id, status } = data;
|
|
|
+ result = await this.$axios.$post(api.lettersinfo, { status: status }, { id: id });
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ // 招聘会
|
|
|
+ async jobfairOperation({ state }, { type, data }) {
|
|
|
+ let result;
|
|
|
+ if (type === 'add') {
|
|
|
+ let { info, corpid, corpname } = data;
|
|
|
+ result = await this.$axios.$post(api.fairs, info, {}, { corpid: corpid, corpname: corpname });
|
|
|
+ }
|
|
|
+ if (type === 'list') {
|
|
|
+ let { schid } = data;
|
|
|
+ result = await this.$axios.$get(api.fairs, {}, { schid: schid });
|
|
|
+ }
|
|
|
+ if (type === 'myList') {
|
|
|
+ let { schid, fairid, corpid, status } = data;
|
|
|
+ result = await this.$axios.$get(api.faircorps, {}, { schid: schid, fairid: fairid, corpid: corpid, status: status });
|
|
|
+ }
|
|
|
+ if (type === 'search') {
|
|
|
+ let { id } = data;
|
|
|
+ result = await this.$axios.$get(api.fairsinfo, { id: id });
|
|
|
+ }
|
|
|
+ if (type === 'update') {
|
|
|
+ let { info, id } = data;
|
|
|
+ result = await this.$axios.$post(api.faircorps, info, { id: id });
|
|
|
+ }
|
|
|
+ if (type === 'delete') {
|
|
|
+ let { id } = data;
|
|
|
+ result = await this.$axios.$delete(api.fairsinfo, {}, { id: id });
|
|
|
+ }
|
|
|
+ if (type === 'apply') {
|
|
|
+ let { schname, fairid, corpid, corpname, info } = data;
|
|
|
+ result = await this.$axios.$post(api.faircorps, info, {}, { schname: schname, fairid: fairid, corpid: corpid, corpname: corpname, schid: 999991 });
|
|
|
+ }
|
|
|
+ if (type === 'searchApply') {
|
|
|
+ let { id } = data;
|
|
|
+ result = await this.$axios.$get(api.faircorpsInfo, { id: id });
|
|
|
+ }
|
|
|
+ if (type === 'applyUpdate') {
|
|
|
+ let { id, info } = data;
|
|
|
+ result = await this.$axios.$post(api.faircorpsInfo, info, { id: id });
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ //微信部分
|
|
|
+ async createConnection() {
|
|
|
+ let result = await this.$axios.$post(api.connection);
|
|
|
+ if (result.errcode != undefined && result.errcode === 0) {
|
|
|
+ console.log('create qrcode success', result.data);
|
|
|
+ return result.data;
|
|
|
+ }
|
|
|
+ console.error('create qrcode fail', result);
|
|
|
+ },
|
|
|
+ async getWxtoken({ state }, qrcode) {
|
|
|
+ let result = await this.$axios.$post(api.wxtoken, {}, { qrcode: qrcode });
|
|
|
+ if (result.errcode != undefined && result.errcode === 0) {
|
|
|
+ console.log('qrcode login success', result);
|
|
|
+ return result.token;
|
|
|
+ }
|
|
|
+ console.error('create qrcode fail', result);
|
|
|
+ },
|
|
|
+ async bindOperation({ state }, { type, data }) {
|
|
|
+ let { corpid, ...info } = data;
|
|
|
+ let result = await this.$axios.$post(api.corpBind, info, {}, { corpid: corpid });
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ },
|
|
|
+});
|
|
|
+
|
|
|
+const data = {
|
|
|
+ testItem: {
|
|
|
+ id: Math.random(),
|
|
|
+ name: 'name',
|
|
|
+ age: 'age',
|
|
|
+ tel: '13099876544',
|
|
|
+ },
|
|
|
+};
|