conversion.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view class="form-box">
  3. <en-nav title="兑换码" :title-color="'#333'" >
  4. </en-nav>
  5. <view class="from-input" :class="{'apply-shake':codeShake}">
  6. <input type="text" class="input-item sys-height-44" v-model="code" placeholder="请输入兑换码"></input>
  7. </view>
  8. <view class="from-text sys-color-gray-9">
  9. 在输入框内正确输入兑换码
  10. </view>
  11. <view class="chang-phone-but sys-color-white sys-background-black sys-selected-but" @click="setPhone" :class="{'sys-unselected-but':!isLogin}">确认</view>
  12. </view>
  13. </template>
  14. <script>
  15. import EnNav from "@/components/en-utils/en-nav/en-nav";
  16. import tools from "@/service/tools";
  17. export default {
  18. components: {EnNav},
  19. data() {
  20. return {
  21. code:'',
  22. codeShake:false,
  23. isLogin:false,
  24. }
  25. },
  26. watch:{
  27. 'code':function (){
  28. this.verifyIsLogin()
  29. },
  30. },
  31. methods: {
  32. verifyIsLogin(){
  33. this.isLogin = this.code !== '';
  34. },
  35. setShake(){
  36. this.codeShake=true
  37. setTimeout(()=>{
  38. this.codeShake=false
  39. },500)
  40. },
  41. setPhone(){
  42. if(this.code ===''){
  43. tools.error('请输入兑换码')
  44. this.setShake()
  45. tools.vibrate()
  46. return false
  47. }
  48. uni.redirectTo({
  49. 'url':'/pages/my/set'
  50. })
  51. },
  52. }
  53. }
  54. </script>
  55. <style scoped lang="scss">
  56. .form-box{
  57. padding: 0 32rpx;
  58. position: relative;
  59. min-height: 100vh;
  60. .from-input{
  61. margin-top: 56rpx;
  62. background-color: #F2F2F2;
  63. border-radius: 16rpx;
  64. padding: 32rpx;
  65. .input-item{
  66. font-size: 28rpx;
  67. color: #333;
  68. }
  69. .input-item::placeholder{
  70. color: #999;
  71. }
  72. }
  73. .from-text{
  74. margin-top: 24rpx;
  75. font-size: 24rpx;
  76. }
  77. .chang-phone-but{
  78. position: absolute;
  79. bottom:calc(50rpx + env(safe-area-inset-bottom));
  80. left: 32rpx;
  81. width:calc(100vw - 64rpx);
  82. }
  83. }
  84. </style>