input-password.vue 2.6 KB

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