zuojincheng
2024-10-22 d3e02569fdef4d270e896bea2f9894f83c4503f9
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<template>
  <div class="scan" v-if="$route.name == 'start'" ref="scan">
    <transition name="maskAnimate">
      <div v-show="modelFlag == true" class="scan-box">
        <transition name="zoomAnimate">
          <div v-show="modelFlag == true" class="scan-dialog">
            <div class="line"></div>
            <div class="content">
              <i class="iconfont icon-saoma" />
              <span>{{ modelContent }}</span>
            </div>
          </div>
        </transition>
      </div>
    </transition>
  </div>
</template>
 
<script>
export default {
  name: "Scan",
  data() {
    return {
      modelFlag: false, //false为消失,true为显示
      modelContent: '',//弹窗内容
      scanType: ''
    }
  },
  watch: {
    // 通过事件总线发送弹窗状态
    modelFlag: function (newVal) {
      this.$bus.$emit('isScaning', newVal)
    },
  },
  methods: {
    //显示弹窗,记性复制
    show(options) {
      this.close();
      if (this.modelFlag == true) { return };
      this.modelContent = options.modelContent;
      this.scanType = options.scanType;
      this.modelFlag = true;
    },
    //关闭弹窗,数据重置
    close() {
      this.modelFlag = false;
      this.modelContent = '';
    },
  },
  mounted() {
  },
  destroyed() {
  }
}
</script>
 
<style lang="less" scoped>
.scan-box {
  position: fixed;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  background-color: rgba(0, 0, 0, .5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  
  .scan-dialog {
    width: 500px;
    height: 400px;
    background-color: #002244;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
  }
  .line {
        height: calc(100% - 2px);
        width: 100%;
        background: linear-gradient(180deg, rgba(0, 255, 51, 0) 43%, #0089ff 211%);
        border-bottom: 1px solid #0089ff;
        transform: translateY(-100%);
        animation: radar-beam 2s infinite;
        animation-timing-function: cubic-bezier(0.53, 0, 0.43, 0.99);
        opacity: .5;
      }
 
      @keyframes radar-beam {
        0% {
          transform: translateY(-100%);
        }
 
        100% {
          transform: translateY(0);
        }
      }
 
      .content {
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
 
        i {
          font-size: 180px;
          margin-bottom: 50px;
          color: #0089ff;
        }
 
        span {
          font-size: 30px;
          color: #fff;
          font-weight: 500;
        }
      }
}
 
.zoomAnimate-enter-active {
  animation: bounceIn 0.5s;
}
 
.zoomAnimate-leave-active {
  animation: bounceOut 0.2s;
}
 
.maskAnimate-enter-active {
  animation: fadeIn 0.5s;
}
 
.maskAnimate-leave-active {
  animation: fadeOut 0.2s;
}
</style>