wuhongyuq 5 lat temu
rodzic
commit
7c7211f0ab
2 zmienionych plików z 32 dodań i 25 usunięć
  1. 8 7
      src/layout/user/punchBtn.vue
  2. 24 18
      src/views/user/checkWork.vue

+ 8 - 7
src/layout/user/punchBtn.vue

@@ -10,15 +10,16 @@
     <van-dialog v-model="show" title="考勤打卡" :showConfirmButton="false">
       <van-form @submit="onSubmit">
         <van-col :span="24">
-          <span>第一期</span>
-          <span>第一批次</span>
-          <span>一班</span>
+          <span>{{ form.termid }}</span>
+          <span>{{ form.batchid }}</span>
+          <span>{{ form.classid }}</span>
         </van-col>
         <el-col :span="24">
           <h2>当前打卡时间</h2>
           <el-col :span="24" class="round">
             <p>打卡</p>
-            <p>{{ time }}</p>
+            <p>{{ form.attend.date }}</p>
+            <p>{{ form.attend.time }}</p>
             <!-- <ul>
               <li></li>
               <li></li>
@@ -41,8 +42,8 @@ export default {
   name: 'punchBtn',
   props: {
     show: null,
-    stuInfo: null,
-    time: null,
+    form: null,
+    attend: null,
   },
   components: {},
   data: () => ({}),
@@ -74,7 +75,7 @@ p {
   color: #ffffff;
 }
 .round p {
-  margin: 27px 0 0 0;
+  margin: 15px 0 0 0;
   font-size: 22px;
 }
 </style>

+ 24 - 18
src/views/user/checkWork.vue

@@ -9,7 +9,7 @@
         <el-col :span="24" class="main">
           <el-col :span="24" class="leaveBtn">
             <!-- <van-button round type="info" icon="smile" @click="onClickRight()">考勤打卡</van-button> -->
-            <punchBtn :show="show" :time="time" :stuInfo="stuInfo" @openClick="openClick" @onSubmit="onSubmit"></punchBtn>
+            <punchBtn :show="show" :form="form" @openClick="openClick" @onSubmit="onSubmit"></punchBtn>
           </el-col>
           <el-col :span="24" class="leaveList">
             <checkList :checkWorkList="checkWorkList"></checkList>
@@ -35,7 +35,7 @@ export default {
     punchBtn, //考勤打卡
   },
   data: () => ({
-    time: '',
+    info: {},
     checkWorkList: [
       {
         studentid: '流域',
@@ -59,18 +59,18 @@ export default {
       },
     ],
     show: false,
-    stuInfo: {},
+    form: {
+      attend: [],
+    },
     title: '',
     isleftarrow: '',
     transitionName: 'fade',
     navShow: true,
   }),
-
   created() {
     this.searchInfo();
     this.getDate();
   },
-
   computed: {},
   mounted() {
     this.title = this.$route.meta.title;
@@ -83,32 +83,38 @@ export default {
     },
   },
   methods: {
-    ...mapAttendance(['fetch']),
+    ...mapAttendance(['fetch', 'create']),
     searchInfo() {
       let site = JSON.parse(sessionStorage.getItem('site'));
-      this.$set(this, `stuInfo`, site);
+      this.$set(this.form, `batchid`, site.batchid);
+      this.$set(this.form, `classid`, site.classid);
+    },
+    openClick() {
+      this.show = true;
+    },
+    async onSubmit(form) {
+      this.form.termid = '123456';
+      let data = this.form;
+      console.log(this.form.attend);
+      // let res = await this.create(data);
+      this.show = false;
     },
-
     getDate() {
       this.timer = setInterval(() => {
         var adate = new Date();
+        let year = adate.getFullYear();
+        let mouth = adate.getMonth() + 1;
+        let date = adate.getDate();
+        let newsdate = year + '-' + mouth + '-' + date;
         this.value = adate.getHours() + ':' + adate.getMinutes() + adate.getSeconds();
         let str = adate.getHours() > 9 ? adate.getHours() : '0' + adate.getHours();
         let tt = adate.getMinutes() > 9 ? adate.getMinutes() : '0' + adate.getMinutes();
         let ss = adate.getSeconds() > 9 ? adate.getSeconds() : '0' + adate.getSeconds();
         let tim = str + ':' + tt + ':' + ss;
-        console.log(this.time);
-        this.$set(this, `time`, tim);
+        this.$set(this.form.attend, `time`, tim);
+        this.$set(this.form.attend, `date`, newsdate);
       }, 1000);
     },
-
-    openClick() {
-      this.show = true;
-    },
-    onSubmit(form) {
-      console.log(form);
-      this.show = false;
-    },
   },
 };
 </script>