nickname.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view class="pass-box">
  3. <en-nav ></en-nav>
  4. <view class="login-box" :style="{'height':'calc(100vh - '+navHeight+'px)'}" >
  5. <view class="login-top">
  6. <view class="login-title">
  7. <text class="title-item sys-color-black sys-weight-600">昵称&密码</text>
  8. </view>
  9. <view class="login-from">
  10. <view class="from-title">
  11. <view class="title-circle sys-background-black" :class="{'sys-background-green':nickname!==''}"></view>
  12. <view class="title-text sys-color-black">设置昵称</view>
  13. </view>
  14. <view class="from-text from-item">
  15. <input type="text" class="from-input sys-color-gray-3" max="11" v-model="nickname" placeholder="请输入昵称"></input>
  16. </view>
  17. <view class="from-title from-item">
  18. <view class="title-circle sys-background-black" :class="{'sys-background-green':password.length>=6}"></view>
  19. <view class="title-text sys-color-black">设置密码</view>
  20. </view>
  21. <view class="from-text from-item">
  22. <input type="password" class="from-input sys-color-gray-3" v-model="password" placeholder="请设置密码(6位以上)"></input>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="login-bottom">
  27. <view class="login-but sys-color-white sys-background-black sys-selected-but" @click="setNextStep" :class="{'sys-unselected-but':!isOK,'apply-shake':isShakeBut}">下一步</view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import EnNav from "@/components/en-utils/en-nav/en-nav";
  34. import tools from "@/service/tools";
  35. export default {
  36. components: {EnNav},
  37. data() {
  38. return {
  39. navHeight:40,
  40. isOK:false,
  41. isShakeBut:false,
  42. nickname:'',
  43. password:'',
  44. }
  45. },
  46. watch:{
  47. 'nickname':function (){
  48. uni.setStorageSync('nickname', this.nickname)
  49. this.verifyIsOK()
  50. },
  51. 'password':function (){
  52. uni.setStorageSync('password', this.password)
  53. this.verifyIsOK()
  54. },
  55. },
  56. methods: {
  57. setNextStep(){
  58. if(this.isOK){
  59. uni.navigateTo({
  60. 'url':'/pages/perfect/cards'
  61. })
  62. }else {
  63. tools.error('请完善信息')
  64. this.isShakeBut=true
  65. setTimeout(()=>{
  66. this.isShakeBut=false
  67. },500)
  68. }
  69. },
  70. verifyIsOK(){
  71. this.isOK = this.nickname!=='' && this.password.length>=6;
  72. },
  73. setNavHeight(navHeight){
  74. this.navHeight=navHeight+41
  75. },
  76. }
  77. }
  78. </script>
  79. <style scoped lang="scss">
  80. @import "/static/css/shake.css";
  81. .login-box{
  82. padding: 82rpx 80rpx 0 80rpx;
  83. box-sizing: border-box;
  84. position: relative;
  85. .login-top{
  86. .login-title{
  87. padding-bottom: 60rpx;
  88. .title-item{
  89. font-size: 48rpx;
  90. }
  91. }
  92. .login-from{
  93. .from-title{
  94. display: flex;
  95. justify-content: flex-start;
  96. height: 44rpx;
  97. .title-circle{
  98. width: 16rpx;
  99. height: 16rpx;
  100. border-radius: 50%;
  101. margin-top: 14rpx;
  102. margin-right: 8rpx;
  103. }
  104. }
  105. .from-text{
  106. width: 100%;
  107. padding-bottom: 40rpx;
  108. border-bottom: 1rpx solid #E0E0E0;
  109. .from-input{
  110. font-size: 32rpx;
  111. height: 44rpx;
  112. line-height: 44rpx;
  113. }
  114. .from-input::placeholder{
  115. color: #999999;
  116. }
  117. }
  118. .from-item{
  119. margin-top: 60rpx;
  120. }
  121. }
  122. .login-but{
  123. margin-top: 120rpx;
  124. }
  125. .local-txt{
  126. padding-top: 32rpx;
  127. font-size: 24rpx;
  128. text-align: center;
  129. }
  130. }
  131. .login-bottom{
  132. padding-bottom: calc(58rpx + env(safe-area-inset-bottom));
  133. position: absolute;
  134. bottom: 0;
  135. left: 68rpx;
  136. width:calc(100vw - 136rpx);
  137. .login-but{
  138. margin-top: 120rpx;
  139. }
  140. }
  141. }
  142. </style>