newPass.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view class="assembly">
  3. <!-- 支付层 -->
  4. <view class="pay_node fx-h">
  5. <view class="pay_title"></view>
  6. <view class="pay_body fx-h">
  7. <view class="pay-pwd-input fx-r fx-bc fx-ac">
  8. <view class="pay-pwd-grid" v-for="(value, index) in payPwdGrid" :key="index">
  9. {{value.text}}
  10. </view>
  11. </view>
  12. <view class="keyboard-node">
  13. <view class="keyboard-12 fx-h">
  14. <view class="fx-r keyboard-row">
  15. <view @tap="inputPwd($event)" class="keyboard" data-char="1" >1</view>
  16. <view @tap="inputPwd($event)" class="keyboard" data-char="2" >2</view>
  17. <view @tap="inputPwd($event)" class="keyboard" data-char="3" >3</view>
  18. </view>
  19. <view class="fx-r keyboard-row">
  20. <view @tap="inputPwd($event)" class="keyboard" data-char="4" >4</view>
  21. <view @tap="inputPwd($event)" class="keyboard" data-char="5" >5</view>
  22. <view @tap="inputPwd($event)" class="keyboard" data-char="6" >6</view>
  23. </view>
  24. <view class="fx-r keyboard-row">
  25. <view @tap="inputPwd($event)" class="keyboard" data-char="7" >7</view>
  26. <view @tap="inputPwd($event)" class="keyboard" data-char="8" >8</view>
  27. <view @tap="inputPwd($event)" class="keyboard" data-char="9" >9</view>
  28. </view>
  29. <view class="fx-r keyboard-row">
  30. <view class="keyboard"></view>
  31. <view @tap="inputPwd($event)" class="keyboard" data-char="0" >0</view>
  32. <view @tap="backspace()" class="keyboard" data-char="×" >×</view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. export default {
  42. data() {
  43. return {
  44. shader: false,
  45. password: [],
  46. payPwdGrid: [
  47. {
  48. text: ''
  49. },
  50. {
  51. text: ''
  52. },
  53. {
  54. text: ''
  55. },
  56. {
  57. text: ''
  58. },
  59. {
  60. text: ''
  61. },
  62. {
  63. text: ''
  64. }
  65. ],
  66. token:""
  67. };
  68. },
  69. onLoad(options) {
  70. console.log(options.token);
  71. this.token = options.token || "";
  72. },
  73. methods: {
  74. /* 小键盘输入 */
  75. inputPwd(e) {
  76. let char = e.currentTarget.dataset.char;
  77. let args = {
  78. target: this,
  79. data: char
  80. };
  81. let passIndex = this.password.length;
  82. if (passIndex < 6) {
  83. this.password.push(char);
  84. this.payPwdGrid[passIndex].text = "●";
  85. // 改变密码框
  86. if (this.password.length === this.payPwdGrid.length) {
  87. let newPaswd = this.password.join('');
  88. uni.navigateTo({ url:"ckPass?val=" + newPaswd + "&token=" + this.token});
  89. }
  90. }
  91. },
  92. /* 回退 */
  93. backspace() {
  94. let passIndex = this.password.length;
  95. if (this.password.length > 0) {
  96. // 改变密码框
  97. this.password = this.password.slice(0, this.password.length - 1);
  98. this.payPwdGrid[passIndex - 1].text = "";
  99. return;
  100. }
  101. }
  102. }
  103. };
  104. </script>
  105. <style>
  106. page{background: #fff;}
  107. .pay_title{font-size: 16px;text-align: center;height: 40px;border-bottom: 1px solid #f1fff1;line-height: 40px;}
  108. .pay-pwd-grid{width: 14%;height: 15vw;margin-right: 2%;border: 1px solid #f1f1ff;line-height: 15vw;text-align: center;}
  109. .pay-pwd-grid:last-child{margin-right: 0;}
  110. /* 自定义键盘 */
  111. .keyboard-node {
  112. width: 750upx;
  113. margin-top: 120upx;
  114. height: 320px;
  115. line-height: 320px;
  116. position: fixed;
  117. bottom: 0;
  118. box-sizing: border-box;
  119. }
  120. .keyboard-12 {
  121. width: 750upx;
  122. height: 100%;
  123. line-height: 100%;
  124. box-sizing: border-box;
  125. }
  126. .keyboard-row {
  127. width: 750upx;
  128. height: 25%;
  129. line-height: 25%;
  130. box-sizing: border-box;
  131. }
  132. .keyboard {
  133. box-sizing: border-box;
  134. width: 250upx;
  135. height: 100%;
  136. line-height: 100%;
  137. background-color: #ffffff;
  138. border-top: #f7f4f4 solid 0.1upx;
  139. border-left: #f7f4f4 solid 0.1upx;
  140. font-size: 40upx;
  141. font-weight: 600;
  142. display: flex;
  143. justify-content: center;
  144. align-items: Center;
  145. }
  146. .keyboard:active {
  147. background: #f1f1f1;
  148. }
  149. .keyboard-row .keyboard:nth-child(1) {
  150. border-left: none;
  151. }
  152. .keyboard-row:nth-child(4) .keyboard:nth-child(1),
  153. .keyboard-row:nth-child(4) .keyboard:nth-child(3) {
  154. background-color: #e3e8ec;
  155. }
  156. .hovers{
  157. }
  158. @keyframes showPopup{
  159. 0%{
  160. opacity: 0;
  161. background-color: #d8d8d8;
  162. }
  163. 100%{
  164. opacity: 1;
  165. }
  166. }
  167. .container {
  168. width: 100%;
  169. height: 100%;
  170. z-index: 999;
  171. overflow: hidden;
  172. position: absolute;
  173. top: 0;
  174. left: 0;
  175. background: rgba(0,0,0,.7);
  176. box-sizing: border-box;
  177. }
  178. </style>