yearning
16 小时以前 63fea2990e587837ed3dde2b9ac8f2b4ef729672
src/views/h5/map/index.vue
File was renamed from src/views/h5/signup/index.vue
@@ -11,7 +11,8 @@
          <div class="mapBox">
            <BaiduMap
              :center="centerPoint"
              @getUserPositionStatus="(evt) => userPositionStatus = evt"
              :limitDistanceFlag="limitDistanceFlag"
              @getUserPositionStatus="getUserPositionStatus"
              @getMapStatus="(evt) => mapStatus = evt"
              @getDistance="getDistance"
            />
@@ -20,19 +21,21 @@
            <el-image 
              style="width: 50px;height: 50px;" 
              fit="contain" 
              :src="$getImageUrl(`/map/position-marker-${positionError?'red':'green'}.png`)"
              :src="$getImageUrl(`/map/position-marker-${limitDistanceFlag&&positionError?'red':'green'}.png`)"
            ></el-image>
          </div>
          <div class="text-sign">
            <el-text style="color: #8c8c8c;" v-if="userPositionStatus=='loading'">定位中...</el-text>
            <el-text style="color: #e73f3f;" v-else-if="userPositionStatus=='fail'">获取定位失败,当前设备的定位服务</el-text>
            <el-text style="color: #e73f3f;" v-else-if="userPositionStatus=='fail'">获取定位失败,请检查当前设备的定位服务</el-text>
            <template v-else-if="userPositionStatus=='success'">
              <el-text v-if="distance>0&&distance<500" style="color: #56c16d;">
                位置正常 距离签到地点{{ distance }}米
              </el-text>
              <el-text v-else style="color: #e73f3f;">
                超出签到范围,不可签到
              </el-text>
              <template v-if="limitDistanceFlag">
                <el-text v-if="distance>0&&distance<500" style="color: #56c16d;">
                  位置正常 距离签到地点{{ distance }}米
                </el-text>
                <el-text v-else style="color: #e73f3f;">
                  超出签到范围,不可签到
                </el-text>
              </template>
            </template>
          </div>
        </div>
@@ -40,8 +43,8 @@
      <!-- <el-row justify="center">
        <el-text class="text-lg font-bold">{{ positionName }}</el-text>
      </el-row> -->
      <el-row justify="center" class="mt-1">
        <el-text class="text-lg text-info">{{ positionAddress }}</el-text>
      <el-row justify="center" class="mt-7">
        <el-text class="text-lg text-info" style="text-align: center;">{{ positionAddress }}</el-text>
      </el-row>
    </div>
    <el-row justify="center" class="mt-7">
@@ -59,7 +62,7 @@
</template>
<script>
import BaiduMap from '@/views/h5/signup/BaiduMap.vue'
import BaiduMap from '@/views/h5/map/BaiduMap.vue'
import { useSessionStore } from '@/stores/session.js'
import { storeToRefs } from 'pinia';
export default {
@@ -83,7 +86,9 @@
        lat: 23.135618,
        lng: 113.27077
      },
      clickCount: 0
      clickCount: 0,
      personType: 0,
      limitDistanceFlag: false
    }
  },
  computed: {
@@ -111,13 +116,20 @@
    }
  },
  created() {
    this.getSignupAddress()
    const type = localStorage.getItem('_personType')
    this.personType = Number(type)
    if (this.personType == 2) {
      this.limitDistanceFlag = true
      this.getVerifyAddress()
    } else {
      this.limitDistanceFlag = false
    }
  },
  async mounted() {
    this.currentTimeText = this.$dayjs().format('HH:mm')
  },
  methods: {
    getSignupAddress() {
    getVerifyAddress() {
      const params = { applicationId: this.appId }
      this.$axios.get('/exam/verify-record/get-by-application-id', { params }).then(res => {
        if (res.data.code == 0) {
@@ -135,7 +147,8 @@
      })
    },
    getUserPositionStatus(evt) {
      this.userPositionStatus = evt
      this.userPositionStatus = evt.status
      this.positionAddress = evt.userPositionText
    },
    getDistance(evt) {
      this.distance = evt
@@ -152,19 +165,27 @@
          return
        }
      }
      const data = {
      let data = {
        targetId: this.appId,
        targetType: 2,
        targetType: this.personType,
        url: this.url,
        type: 0
        type: this.url ? 0 : 2
      }
      this.confirmLoading = true
      this.$axios.post('/exam/staff/checkin', data).then(res => {
        if (res.data.code == 0) {
          this.$message.success('签到成功')
          setTimeout(() => {
            this.$router.replace({ path: '/h5/verForm', query: { appId: this.appId }})
            if (data.targetType == 2) {
              this.$message.success('签到成功')
              this.$router.replace({ path: '/h5/verForm', query: { appId: this.appId }})
            } else {
              this.$router.replace({ path: '/h5/signInSuccess', query: {
                timeText: this.$dayjs().format('HH:mm:ss'),
                address: this.positionAddress
              }})
            }
          }, 500)
        } else {
          this.$message.error(res.data.msg)
        }