uni-keyword.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <view class="keyborad" :style="{transform:show_key?'translateY(0)':'translateY(100%)'}">
  3. <view class="key_main">
  4. <view class="main_title">
  5. <view class="close-but" v-if="showCose">
  6. <image src="../../static/theme/default/my/del_1.png" mode="aspectFill" @tap="hideFun"></image>
  7. </view>
  8. <text class="set" :set_msg="set_msg">{{set_msg}}</text>
  9. <text class="msg">{{set_info}}</text>
  10. </view>
  11. <view class="main_content">
  12. <view class="content_num">
  13. <view v-for="item in 6" :key="item" class="content_item">{{password[item-1] ? '●' :''}}</view>
  14. </view>
  15. </view>
  16. <view class="main_keyboard">
  17. <view class="key_num" v-for="item in 9" :key="item" @tap="inputNumFun({num:item})">
  18. {{item}}
  19. </view>
  20. <view class="key_null"></view>
  21. <view class="key_0" @tap="inputNumFun({num:0})">0</view>
  22. <view class="key_del" @tap="delNumFun">
  23. <image src="../../static/theme/default/my/del_2.png" mode="aspectFill"></image>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default{
  31. props:{
  32. show_key:Boolean,
  33. set_msg:String,
  34. set_info:String,
  35. showCose:{
  36. type: Boolean,
  37. default: false
  38. }
  39. },
  40. computed:{},
  41. data(){
  42. return{
  43. password:''
  44. }
  45. },
  46. methods:{
  47. inputNumFun(op){
  48. let _this = this
  49. if(_this.password.length <=6){
  50. _this.password += op.num
  51. if(_this.password.length == 6){
  52. _this.$emit('getPassword',{password:_this.password})
  53. }
  54. }
  55. },
  56. delNumFun(){
  57. if(this.password.length == 0) return
  58. this.password = this.password.substring(0,this.password.length - 1)
  59. console.log("删除后的结果",this.password)
  60. },
  61. forgetFun(){
  62. },
  63. hideFun(){
  64. this.$emit('hideFun')
  65. },
  66. cleanNum(){
  67. this.password = '';
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss">
  73. .keyborad{width:100vw;height: 100vh;position: fixed;bottom: 0px;top:0px;left:0px;right:0px;z-index:100;display: flex;flex-direction: column;justify-content: flex-end;transform: translateY(100%);transition:all 0.4s;background-color: white;
  74. .key_main{ width:100vw;height: 1000rpx;background: rgba(245,245,245,0.9);box-sizing: border-box;display: flex;flex-direction: column;justify-content: space-between;background-color: white;
  75. .main_title{ font-size:34rpx;color: #000000;display: flex;align-items: center;letter-spacing: 2rpx;width:100%;;padding:0px 20rpx;
  76. image{ width:48rpx;height: 48rpx;}
  77. text{ flex:1;margin-left:-48rpx;display: flex;justify-content: center;padding: 10upx 0;}
  78. }
  79. .main_content{ width:100%;box-sizing: border-box;padding:0px 30rpx;
  80. .content_num{ width:100%;height: 100rpx;border:2rpx solid #DBDBDB;border-radius: 10rpx;display: flex;align-items: center;
  81. .content_item{ flex: 1;height: 100%;border-right: 2rpx solid #DBDBDB;display: flex;justify-content: center;align-items: center;}
  82. .content_item:last-child{ border-right:none}
  83. }
  84. .main_forget{ display: flex;justify-content: center;align-items: center;width:100%;font-size:28rpx;color: #007AFF;margin-top:40rpx}
  85. }
  86. .main_keyboard{ width:100%;height: 500rpx;background: #FFFFFF;display: flex;flex-flow: wrap;
  87. .key_null,.key_del{ background: #e2e7eb;}
  88. image{ width:48rpx;height: 48rpx;}
  89. .key_num,.key_null,.key_del,.key_0{ width:250rpx;height: 125rpx;display: flex;align-items: center;justify-content: center;}
  90. .key_num{ border-right:2rpx solid #f1f4f4;border-bottom:2rpx solid #f1f4f4;box-sizing: border-box;border-top: 2rpx solid #f1f4f4;}
  91. .key_num:nth-child(8){border-bottom: none;}
  92. .key_0{ border-top:2rpx solid #f1f4f4}
  93. }
  94. }
  95. }
  96. .main_title{display: flex;flex-direction: column;}
  97. .set{font-size: 22px;font-weight: 400}
  98. .msg{font-weight: 400}
  99. .close-but image{
  100. display: flex;
  101. justify-content: space-around;
  102. }
  103. .close-but{
  104. width: 100%;
  105. }
  106. </style>