<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() { ZWJSBridge.scan({ type: 'qrCode', }) .then((res) => { if(res.qrcode&&!isNaN(Number(res.qrcode))){ this.$router.push({ name: 'MyClassList', query: { qrresult: res.qrcode } }) }else{ this.$toast.fail('扫码失败') } }) .catch((err) => { console.log(err) }) }, }, } </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>