Prechádzať zdrojové kódy

dictionary字典表

guhongwei 5 rokov pred
rodič
commit
cffdfc43c1

+ 1 - 1
src/layout/login.vue

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

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

@@ -8,6 +8,7 @@ import * as resumes from '@/store/resumes';
 import * as letters from '@/store/letters';
 import * as jobs from '@/store/jobs';
 import * as corp from '@/store/corp';
+import * as dictionary from '@/store/dictionary';
 
 Vue.use(Vuex);
 
@@ -21,5 +22,6 @@ export default new Vuex.Store({
     letters: letters,
     jobs: jobs,
     corp: corp,
+    dictionary: dictionary,
   },
 });

+ 25 - 0
src/store/dictionary.js

@@ -0,0 +1,25 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+
+Vue.use(Vuex);
+const api = {
+  dictionary: '/api/code/{type}/items', //type === xzqh:query:level(1/2);parent(无/code)
+};
+
+export const state = () => ({});
+export const mutations = {};
+export const actions = {
+  // 字典表
+  async dicOperation({ state }, type) {
+    let result;
+    if (!_.isObject(type)) {
+      result = await this.$axios.$get(api.dictionary, { type: type });
+    } else {
+      let { level, parent } = type;
+      result = await this.$axios.$get(api.dictionary, { type: 'xzqh' }, { level: level, parent: parent });
+    }
+
+    return result;
+  },
+};