<template>
  <div class="download-button-wrapper" @click="download">
    <img src="../../images/course/pica-icon.png" alt />
    <span :class="{'short': needShort}">{{downloadTips}}</span>
  </div>
</template>
<script>
export default {
  data() {
    return {
      downloadTips: "打开云鹊医APP",
      needShort: false,
    }
  },
  props: {
    tag: {
      type: String,
      default: '88212'
    }
  },
  methods: {
    download() {
      this.$sendBuriedData({
        component_tag: `882#${this.tag}`
      });
      window.location.href =
        "https://a.app.qq.com/o/simple.jsp?pkgname=com.picahealth.yunque";
    },
  },
  created() {
    setTimeout(() => {
      this.downloadTips = '';
      this.needShort = true;
    }, 5000);    
  },
};
</script>
<style lang="less" scoped>
.download-button-wrapper {
  display: flex;
  // width: 100%;
  // position: fixed;
  position: absolute;
  z-index: 1000;
  top: 10px;
  right: 0;
  height: 30px;
  align-items: center;
  img {
    position: relative;
    left: 15px;
    width: 30px;
    height: 30px;
  }
  span {
    display: inline-block;
    height: 30px;
    line-height: 30px;
    padding: 0 8px 0 23px;
    font-size: 12px;
    font-weight: 700;
    color: #5ba99b;
    background: #fff;
    box-shadow:0px 2px 10px 0px rgba(0,0,0,0.1);    
    width: 120px;
    &.short {
      width: 10px;
      transition: width 1s;
      -moz-transition: width 1s; /* Firefox 4 */
      -webkit-transition: width 1s; /* Safari 和 Chrome */
      -o-transition: width 1s; /* Opera */
      padding: 0 12px;
    }
  }
}
</style>