verify.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view :class="mode=='pop'?'masks':''" v-if="clickShow">
  3. <view :class="mode=='pop'?'verifybox':''">
  4. <view class="verifybox-top" v-if="mode=='pop'">
  5. 请完成安全验证
  6. <text class="verifybox-close" @click="clickShow = false">
  7. <text class="iconfont icon-close"></text>
  8. </text>
  9. </view>
  10. <view class="verifybox-bottom" :style="{padding:mode=='pop'?'15px':'0'}">
  11. <!-- 验证码容器 -->
  12. <move-verify :style="{ marginTop: '40rpx'} " @vertify='vertifyResult'></move-verify>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import moveVerify from './move-verify.vue';
  19. export default {
  20. name: 'MoveVerify',
  21. components: {
  22. moveVerify,
  23. },
  24. props: {
  25. mode: {
  26. type: String,
  27. default: 'pop'
  28. },
  29. },
  30. data() {
  31. return {
  32. vertify: false, //验证是否成功
  33. // showBox:true,
  34. clickShow: false,
  35. // 内部类型
  36. verifyType: undefined,
  37. tipWords: '', // 提示语
  38. startMoveTime: "", //移动开始的时间
  39. endMovetime: '', //移动结束的时间
  40. }
  41. },
  42. methods: {
  43. /**
  44. * 滑动验证
  45. */
  46. vertifyResult(vertify) {
  47. this.vertify = vertify
  48. if(this.vertify) this.$emit('success', this.vertify)
  49. },
  50. show() {
  51. if (this.mode == "pop") {
  52. this.clickShow = true;
  53. }
  54. },
  55. hide() {
  56. if (this.mode == "pop") {
  57. this.clickShow = false;
  58. }
  59. }
  60. },
  61. computed: {
  62. instance() {
  63. return this.$refs.instance || {}
  64. },
  65. showBox() {
  66. if (this.mode == 'pop') {
  67. return this.clickShow
  68. } else {
  69. return true;
  70. }
  71. }
  72. },
  73. }
  74. </script>
  75. <style scoped>
  76. .verifybox {
  77. width: 90%;
  78. position: relative;
  79. box-sizing: border-box;
  80. border-radius: 2px;
  81. border: 1px solid #e4e7eb;
  82. background-color: #fff;
  83. box-shadow: 0 0 10px rgba(0, 0, 0, .3);
  84. left: 50%;
  85. top: 50%;
  86. transform: translate(-50%, -50%);
  87. }
  88. .verifybox-top {
  89. padding: 0 15px;
  90. height: 50px;
  91. line-height: 50px;
  92. text-align: left;
  93. font-size: 16px;
  94. color: #45494c;
  95. border-bottom: 1px solid #e4e7eb;
  96. box-sizing: border-box;
  97. }
  98. .verifybox-bottom {
  99. /* padding: 15px; */
  100. box-sizing: border-box;
  101. }
  102. .verifybox-close {
  103. position: absolute;
  104. top: 13px;
  105. right: 9px;
  106. width: 24px;
  107. height: 24px;
  108. text-align: center;
  109. cursor: pointer;
  110. }
  111. .masks {
  112. position: fixed;
  113. top: 0;
  114. left: 0;
  115. z-index: 1001;
  116. width: 100%;
  117. height: 100vh;
  118. background: rgba(0, 0, 0, .3);
  119. /* display: none; */
  120. transition: all .5s;
  121. }
  122. .verify-tips {
  123. position: absolute;
  124. left: 0px;
  125. bottom: 0px;
  126. width: 100%;
  127. height: 30px;
  128. background-color: rgb(231, 27, 27, .5);
  129. line-height: 30px;
  130. color: #fff;
  131. }
  132. .tips-enter,
  133. .tips-leave-to {
  134. bottom: -30px;
  135. }
  136. .tips-enter-active,
  137. .tips-leave-active {
  138. transition: bottom .5s;
  139. }
  140. </style>