input-password.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <<<<<<< HEAD
  2. <template>
  3. <view class="page">
  4. <view>
  5. <view class="pay-title">
  6. <text>{{$t('enter.b3')}}</text>
  7. </view>
  8. <view class="pay-password">
  9. <view class="list" v-for="item in 6">
  10. <text v-show="passwordArr.length >= item">●</text>
  11. </view>
  12. </view>
  13. <navigator url="/pages/user/set/transaction">
  14. <view class="hint">
  15. <text>{{$t('login.b8')}}</text>
  16. </view>
  17. </navigator>
  18. </view>
  19. <cc-defineKeyboard ref="CodeKeyboard" passwrdType="pay" @KeyInfo="KeyInfo" :viewShow="true"></cc-defineKeyboard>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. passwordArr: []
  27. };
  28. },
  29. mounted() {
  30. this.$refs.CodeKeyboard.show();
  31. },
  32. // 关闭循环
  33. methods: {
  34. // 点击触发支付事件
  35. KeyInfo(val) {
  36. console.log(val);
  37. let arr = this.passwordArr;
  38. if (val.index >= 6) {
  39. return;
  40. }
  41. // 判断是否输入的是删除键
  42. if (val.keyCode === 8) {
  43. // 删除最后一位
  44. arr.splice(val.index + 1, 1)
  45. }
  46. // 判断是否输入的是取消案件
  47. else if (val.keyCode == 190) {
  48. this.$emit('colse')
  49. } else {
  50. arr.push(val.key);
  51. }
  52. // 开始交易
  53. if (arr.length == 6) {
  54. this.$emit('commit',this.passwordArr.join(''))
  55. //初始化对象
  56. this.passwordArr = [];
  57. }
  58. },
  59. },
  60. };
  61. </script>
  62. <style lang="scss">
  63. $base: orangered; // 基础颜色
  64. .page {
  65. width: 100%;
  66. background-color: #FFFFFF;
  67. .pay-title {
  68. display: flex;
  69. align-items: center;
  70. justify-content: center;
  71. width: 100%;
  72. height: 200rpx;
  73. text {
  74. font-size: 28rpx;
  75. color: #555555;
  76. }
  77. }
  78. .pay-password {
  79. display: flex;
  80. align-items: center;
  81. width: 90%;
  82. height: 80rpx;
  83. margin: 20rpx auto;
  84. border: 2rpx solid $base;
  85. .list {
  86. color: #555555;
  87. display: flex;
  88. align-items: center;
  89. justify-content: center;
  90. width: 16.666%;
  91. height: 100%;
  92. border-right: 2rpx solid #EEEEEE;
  93. text {
  94. font-size: 32rpx;
  95. }
  96. }
  97. .list:nth-child(6) {
  98. border-right: none;
  99. }
  100. }
  101. .hint {
  102. display: flex;
  103. align-items: center;
  104. justify-content: center;
  105. width: 100%;
  106. height: 100rpx;
  107. text {
  108. font-size: 28rpx;
  109. color: $base;
  110. }
  111. }
  112. }
  113. </style>