Преглед на файлове

更新个人信息(个人信息,详情+请假)完成

guhongwei преди 5 години
родител
ревизия
73d7b3d2e3
променени са 7 файла, в които са добавени 88 реда и са изтрити 9 реда
  1. 10 1
      src/layout/user/leaveList.vue
  2. 2 2
      src/layout/user/messageInfo.vue
  3. 3 0
      src/store/index.js
  4. 38 0
      src/store/student.js
  5. 15 2
      src/views/user/index.vue
  6. 1 1
      src/views/user/leaveDetail.vue
  7. 19 3
      src/views/user/personalDetail.vue

+ 10 - 1
src/layout/user/leaveList.vue

@@ -13,12 +13,15 @@
           <p>结束时间:{{ item.endtime }}</p>
         </el-col>
         <el-col :span="10" class="ispass"> 请假结果:{{ item.ispass === '0' ? '未通过' : item.ispass === '1' ? '通过' : '审核中' }} </el-col>
+        <!-- <el-col :span="10" @click="deleteBtn(item.id)">删除</el-col> -->
       </el-col>
     </el-row>
   </div>
 </template>
 
 <script>
+import { createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapLeave } = createNamespacedHelpers('leave');
 export default {
   name: 'leaveList',
   props: {
@@ -28,7 +31,13 @@ export default {
   data: () => ({}),
   created() {},
   computed: {},
-  methods: {},
+  methods: {
+    // ...mapLeave(['delete']),
+    // async deleteBtn(id) {
+    //   const res = await this.delete(id);
+    //   this.$checkRes(res, '删除成功', '删除失败');
+    // },
+  },
 };
 </script>
 

+ 2 - 2
src/layout/user/messageInfo.vue

@@ -2,10 +2,10 @@
   <div id="messageInfo">
     <el-row>
       <el-col :span="24" class="message" @click.native="$router.push({ path: '/user/personalDetail', query: { id: info.id } })">
-        <el-col :span="6" class="name">
+        <el-col :span="7" class="name">
           {{ info.name }}
         </el-col>
-        <el-col :span="18" class="mess">
+        <el-col :span="17" class="mess">
           <p>{{ info.school_name }}</p>
           <p>{{ info.faculty }}&nbsp;&nbsp;{{ info.major }}</p>
           <p>民族:{{ info.nation }}&nbsp;性别:{{ info.gender }}</p>

+ 3 - 0
src/store/index.js

@@ -5,6 +5,8 @@ import attendance from './attendance';
 import group from './group';
 import question from './question';
 import questionnaire from './questionnaire';
+import student from './student';
+
 Vue.use(Vuex);
 
 export default new Vuex.Store({
@@ -14,6 +16,7 @@ export default new Vuex.Store({
     group,
     question,
     questionnaire,
+    student,
   },
   state: {}, //变量
   mutations: {}, //同步方法

+ 38 - 0
src/store/student.js

@@ -0,0 +1,38 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  studentInfo: `/api/train/student`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.studentInfo}`, { skip, limit, ...info });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.studentInfo}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.studentInfo}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.studentInfo}/update/${id}`, data);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.studentInfo}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 15 - 2
src/views/user/index.vue

@@ -26,6 +26,8 @@ import topInfo from '@/layout/common/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
 import messageInfo from '@/layout/user/messageInfo.vue';
 import clickBtn from '@/layout/user/clickBtn.vue';
+import { createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapStudent } = createNamespacedHelpers('student');
 export default {
   name: 'index',
   props: {},
@@ -56,9 +58,20 @@ export default {
       job: '班长',
     },
   }),
-  created() {},
+  created() {
+    this.searchInfo();
+  },
   computed: {},
-  methods: {},
+  methods: {
+    ...mapStudent(['fetch']),
+    async searchInfo() {
+      const res = await this.fetch('5e4f3d096a90e861b0f30871');
+      if (res.errcode === 0) {
+        sessionStorage.setItem('site', JSON.stringify(res.data));
+        this.$set(this, `info`, res.data);
+      }
+    },
+  },
 };
 </script>
 

+ 1 - 1
src/views/user/leaveDetail.vue

@@ -39,7 +39,7 @@ export default {
   methods: {
     ...mapLeave(['create']),
     async submitForm(form) {
-      this.form.studentid = '99991';
+      this.form.studentid = '5e4f3d096a90e861b0f30871';
       let data = this.form;
       let res = await this.create(data);
       let msg = `${this.keyWord}添加成功`;

+ 19 - 3
src/views/user/personalDetail.vue

@@ -16,6 +16,8 @@
 <script>
 import topInfo from '@/layout/common/topInfo.vue';
 import studentInfo from '@/layout/user/studentInfo.vue';
+import { createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapStudent } = createNamespacedHelpers('student');
 export default {
   name: 'personalDetail',
   props: {},
@@ -44,9 +46,23 @@ export default {
       job: '班长',
     },
   }),
-  created() {},
-  computed: {},
-  methods: {},
+  created() {
+    this.searchInfo();
+  },
+  computed: {
+    id() {
+      return this.$route.query.id;
+    },
+  },
+  methods: {
+    ...mapStudent(['fetch']),
+    async searchInfo() {
+      const res = await this.fetch(this.id);
+      if (res.errcode === 0) {
+        this.$set(this, `messInfo`, res.data);
+      }
+    },
+  },
 };
 </script>