HomeScan.vue 1.71 KB
<template>
  <div v-if="type==2" class="scan2" @click="saoYiSao">
    <van-icon name="scan" />
    <p class="tishi">基地打卡</p>
  </div>
  <div v-else class="scan" @click="saoYiSao">
    <van-icon name="scan" />
    <img class="tishi" src="@/assets/home/tishi.png" alt="扫码打卡">
  </div>
</template>
<script>
export default {
  props:['type'],
  methods: {
    saoYiSao () {
      let isLogin = this.checkLogin()
      if (!isLogin) return;
      if (process.env.NODE_ENV === "production" && this.common.isWeiXin()) {
        // location.href = `http://sao315.com/w/api/saoyisao?redirect_uri=https://zlyx.shunzhi.net/wap/index.html%23/MyClassList`;
        location.href = `http://sao315.com/w/api/saoyisao?redirect_uri=https://zlyx.shunzhi.net/wap/index.html%23/MyClassList`;
      } else {
        this.$router.push({ name: 'MyClassList', query: { qrresult: '188' } })
      }
    },
    // 判断是否已登录
    checkLogin () {
      if (process.env.NODE_ENV != "production") return true;
      const userInfo = JSON.parse(localStorage.getItem('userInfo'))
      if (!userInfo?.phone) {
        localStorage.setItem('prePage', 'Home');
        localStorage.setItem('prePageQuery', JSON.stringify({ showTab: this.$route.query.showTab }));
        this.$router.push({ name: 'LoginPublic' })
        return false;
      }
      return true;
    },
  }
}
</script>
<style lang="scss" scoped>
.scan {
  position: relative;
  // position:absolute;
  // right:20px;
  // top :20px;
  // z-index :100;
  color: white;
  font-size: 50px;
  .tishi {
    position: absolute;
    left: -90px;
    bottom: -30px;
    width: 112px;
  }
}
.scan2{
  font-size: 50px;
  color: #526195;
  text-align: center;
.tishi {
    font-size: 24px;
  }
}
</style>