yearning
18 小时以前 63fea2990e587837ed3dde2b9ac8f2b4ef729672
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<template>
  <div></div>
</template>
<script>
export default {
  components: {},
  data() {
    return {
      noTaskTip: ''
    }
  },
  computed: {
    appId() {
      return this.$route.query.appId
    }
  },
  async created() {
    const canSignIn = await this.getCanSignIn()
    if (!canSignIn) {
      this.$router.replace({ path: '/h5/noTask', query: { tip: this.noTaskTip }})
      return
    }
    const setting = await this.getSignInSetting()
    
    if (setting === 0) {
      this.$router.replace({ path: '/h5/face', query: { appId: this.appId } })
    } else if (setting === 2) {
      this.$router.replace({ path: '/h5/map', query: { appId: this.appId } })
    } else {
      this.$router.replace({ path: '/h5/noTask', query: { tip: this.noTaskTip }})
    }
  },
  mounted() {
    document.title = '工作人员签到'
  },
  methods: {
    getCanSignIn() {
      return new Promise((resolve) => {
        const params = {
          targetId: '',
          appraisalPlanId: this.appId
        }
        this.$axios.get('/exam/staff/checkin/open', { params }).then(res => {
          if (res.data.code == 0) {
            if (!res.data.data) {
              this.noTaskTip = '当前评价计划未开启签到'
            }
            resolve(res.data.data)
          } else {
            resolve(false)
            this.$message.error(res.data.msg)
          }
        }, () => {
          resolve(false)
        })
      })
    },
    getSignInSetting() {
      return new Promise((resolve) => {
        const params = { appraisalPlanId: this.appId }
        this.$axios.get('/exam/staff/checkin/config', { params }).then(res => {
          if (res.data.code == 0) {
            resolve(res.data.data)
          } else {
            this.noTaskTip = res.data.msg
            resolve(null)
          }
        }, () => {
          resolve(null)
        })
      })
    },
  }
}
</script>