nickname.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. import {filUserInfo, register} from "@/api/login";
  36. export default {
  37. components: {EnNav},
  38. data() {
  39. return {
  40. navHeight:40,
  41. isOK:false,
  42. isShakeBut:false,
  43. nickname:'',
  44. password:'',
  45. }
  46. },
  47. watch:{
  48. 'nickname':function (){
  49. uni.setStorageSync('nickname', this.nickname)
  50. this.verifyIsOK()
  51. },
  52. 'password':function (){
  53. uni.setStorageSync('password', this.password)
  54. this.verifyIsOK()
  55. },
  56. },
  57. methods: {
  58. setNextStep(){
  59. if(this.isOK){
  60. let mobile=uni.getStorageSync('mobile')
  61. let dateOfBirth=uni.getStorageSync('dateOfBirth')
  62. let gender=uni.getStorageSync('gender')
  63. filUserInfo({'mobile':mobile,'dateOfBirth':dateOfBirth,'gender':gender,'nickname':this.nickname,'password':this.password}).then((res)=>{
  64. if(res.code===0){
  65. uni.navigateTo({
  66. 'url':'/pages/perfect/cards'
  67. })
  68. }else {
  69. tools.error(res.msg)
  70. }
  71. })
  72. }else {
  73. tools.error('请完善信息')
  74. this.isShakeBut=true
  75. setTimeout(()=>{
  76. this.isShakeBut=false
  77. },500)
  78. }
  79. },
  80. verifyIsOK(){
  81. this.isOK = this.nickname!=='' && this.password.length>=6;
  82. },
  83. setNavHeight(navHeight){
  84. this.navHeight=navHeight+41
  85. },
  86. }
  87. }
  88. </script>
  89. <style scoped lang="scss">
  90. @import "/static/css/shake.css";
  91. .pass-box{
  92. .login-box{
  93. padding: 160rpx 80rpx 0 80rpx;
  94. box-sizing: border-box;
  95. position: relative;
  96. .login-top{
  97. .login-title{
  98. padding-bottom: 60rpx;
  99. .title-item{
  100. font-size: 48rpx;
  101. }
  102. }
  103. .login-from{
  104. .from-title{
  105. display: flex;
  106. justify-content: flex-start;
  107. height: 44rpx;
  108. .title-circle{
  109. width: 16rpx;
  110. height: 16rpx;
  111. border-radius: 50%;
  112. margin-top: 14rpx;
  113. margin-right: 8rpx;
  114. }
  115. }
  116. .from-text{
  117. width: 100%;
  118. padding-bottom: 40rpx;
  119. border-bottom: 1rpx solid #E0E0E0;
  120. .from-input{
  121. font-size: 32rpx;
  122. height: 44rpx;
  123. line-height: 44rpx;
  124. }
  125. .from-input::placeholder{
  126. color: #999999;
  127. }
  128. }
  129. .from-item{
  130. margin-top: 60rpx;
  131. }
  132. }
  133. .login-but{
  134. margin-top: 120rpx;
  135. }
  136. .local-txt{
  137. padding-top: 32rpx;
  138. font-size: 24rpx;
  139. text-align: center;
  140. }
  141. }
  142. .login-bottom{
  143. padding-bottom: calc(58rpx + env(safe-area-inset-bottom));
  144. position: absolute;
  145. bottom: 0;
  146. left: 68rpx;
  147. width:calc(100vw - 136rpx);
  148. .login-but{
  149. margin-top: 120rpx;
  150. }
  151. }
  152. }
  153. }
  154. </style>