wuhongyuq 5 лет назад
Родитель
Сommit
ceabfaccc4
2 измененных файлов с 17 добавлено и 29 удалено
  1. 3 9
      src/layout/user/punchBtn.vue
  2. 14 20
      src/views/user/checkWork.vue

+ 3 - 9
src/layout/user/punchBtn.vue

@@ -10,23 +10,17 @@
     <van-dialog v-model="show" title="考勤打卡" :showConfirmButton="false">
     <van-dialog v-model="show" title="考勤打卡" :showConfirmButton="false">
       <van-form @submit="onSubmit">
       <van-form @submit="onSubmit">
         <van-col :span="24">
         <van-col :span="24">
-          <!-- <span>{{ form.termid }}</span>
-          <span>{{ form.batchid }}</span>
-          <span>{{ form.classid }}</span> -->
+          <span>{{ form.topTitle }}</span>
         </van-col>
         </van-col>
         <el-col :span="24">
         <el-col :span="24">
           <h2>当前打卡时间</h2>
           <h2>当前打卡时间</h2>
-          <el-col :span="24" class="round">
+          <el-col :span="24" class="round" @click.native="onSubmit">
             <p>打卡</p>
             <p>打卡</p>
             <p>{{ dates.date }}</p>
             <p>{{ dates.date }}</p>
             <p>{{ dates.time }}</p>
             <p>{{ dates.time }}</p>
           </el-col>
           </el-col>
         </el-col>
         </el-col>
-        <div style="margin: 16px;">
-          <van-button round block type="info" native-type="submit">
-            提交
-          </van-button>
-        </div>
+        <div style="margin: 16px;"></div>
       </van-form>
       </van-form>
     </van-dialog>
     </van-dialog>
   </div>
   </div>

+ 14 - 20
src/views/user/checkWork.vue

@@ -3,12 +3,10 @@
     <el-row>
     <el-row>
       <el-col :span="24" class="style">
       <el-col :span="24" class="style">
         <el-col :span="24" class="top">
         <el-col :span="24" class="top">
-          <!-- <topInfo></topInfo> -->
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         </el-col>
         <el-col :span="24" class="main">
         <el-col :span="24" class="main">
           <el-col :span="24" class="leaveBtn">
           <el-col :span="24" class="leaveBtn">
-            <!-- <van-button round type="info" icon="smile" @click="onClickRight()">考勤打卡</van-button> -->
             <punchBtn :show="show" :form="form" :dates="dates" @openClick="openClick" @onSubmit="onSubmit"></punchBtn>
             <punchBtn :show="show" :form="form" :dates="dates" @openClick="openClick" @onSubmit="onSubmit"></punchBtn>
           </el-col>
           </el-col>
           <el-col :span="24" class="leaveList">
           <el-col :span="24" class="leaveList">
@@ -26,6 +24,7 @@ import checkList from '@/layout/user/checkList.vue';
 import punchBtn from '@/layout/user/punchBtn.vue';
 import punchBtn from '@/layout/user/punchBtn.vue';
 import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
 import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: mapAttendance } = createNamespacedHelpers('attendance');
 const { mapActions: mapAttendance } = createNamespacedHelpers('attendance');
+const { mapActions: mapClass } = createNamespacedHelpers('classes');
 export default {
 export default {
   name: 'checkWork',
   name: 'checkWork',
   props: {},
   props: {},
@@ -35,26 +34,23 @@ export default {
     punchBtn, //考勤打卡
     punchBtn, //考勤打卡
   },
   },
   data: () => ({
   data: () => ({
-    info: {},
-    anames: '',
-    checkWorkList: {
-      attend: [],
-    },
-
     show: false,
     show: false,
     form: {
     form: {
       attend: [],
       attend: [],
     },
     },
     dates: {},
     dates: {},
+    anames: '',
+    checkWorkList: {
+      attend: [],
+    },
     title: '',
     title: '',
     isleftarrow: '',
     isleftarrow: '',
     transitionName: 'fade',
     transitionName: 'fade',
     navShow: true,
     navShow: true,
   }),
   }),
   created() {
   created() {
-    this.searchInfo();
-    this.getDate();
     this.search();
     this.search();
+    this.getDate();
   },
   },
   computed: {
   computed: {
     ...mapState(['user']),
     ...mapState(['user']),
@@ -71,25 +67,22 @@ export default {
   },
   },
   methods: {
   methods: {
     ...mapAttendance(['fetch', 'create', 'query']),
     ...mapAttendance(['fetch', 'create', 'query']),
+    ...mapClass({ classinfo: 'fetch', classlist: 'query' }),
+    // 查询考勤列表
     async search() {
     async search() {
       let studentid = this.user.userid;
       let studentid = this.user.userid;
-      console.log(studentid);
       const res = await this.query();
       const res = await this.query();
-      console.log(res.data);
-      console.log(res.data[0]);
-
       this.$set(this, `checkWorkList`, res.data);
       this.$set(this, `checkWorkList`, res.data);
-    },
-    searchInfo() {
-      this.$set(this.form, `batchid`, this.user.batchid);
-      this.$set(this.form, `classid`, this.user.classid);
       this.$set(this, `anames`, this.user.name);
       this.$set(this, `anames`, this.user.name);
     },
     },
-    openClick() {
+    // 考勤详情显示
+    async openClick() {
       this.show = true;
       this.show = true;
+      const classInfo = await this.classinfo(this.user.classid);
+      this.$set(this.form, `topTitle`, classInfo.data.name);
     },
     },
+    // 考勤提交
     async onSubmit(form) {
     async onSubmit(form) {
-      console.log(this.user);
       this.form.termid = this.user.termid;
       this.form.termid = this.user.termid;
       this.form.batchid = this.user.batchid;
       this.form.batchid = this.user.batchid;
       this.form.classid = this.user.classid;
       this.form.classid = this.user.classid;
@@ -98,6 +91,7 @@ export default {
       let res = await this.create(data);
       let res = await this.create(data);
       this.show = false;
       this.show = false;
     },
     },
+    // 获得时间
     getDate() {
     getDate() {
       this.timer = setInterval(() => {
       this.timer = setInterval(() => {
         var adate = new Date();
         var adate = new Date();