login.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view class="container">
  3. <navback />
  4. <view class="kuang">
  5. <view class="loginText">欢迎登录</view>
  6. <input class="phone_input"
  7. type="text" v-model="phone_value" placeholder="手机号">
  8. <view class="passwordcontent">
  9. <input v-if="hidden_password" class="password_input phone_input"
  10. type="password" v-model="password_value" placeholder="密码">
  11. <input v-else="hidden_password" class="password_input phone_input"
  12. type="text" v-model="password_value" placeholder="密码">
  13. <view :class="hidden_password ?'passwordcontent_hidden':'passwordcontent_show passwordcontent_hidden'" @click="clickToPasswordIsHidden">
  14. <image src="../../static/password_hidden.png" mode="aspectFit"></image>
  15. </view>
  16. </view>
  17. <view class="loginButton" @click="clickToLogin">登录</view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import navback from '../../components/navigator-back/navigator-back.vue'
  23. export default {
  24. data() {
  25. return {
  26. hidden_password: true,
  27. phone_value: '',
  28. password_value: '',
  29. }
  30. },
  31. methods: {
  32. clickToPasswordIsHidden() {
  33. this.hidden_password = !this.hidden_password
  34. },
  35. clickToLogin() {
  36. console.log('phone_value', this.phone_value)
  37. console.log('password_value', this.password_value)
  38. if(this.tools.isNull(this.phone_value)) {
  39. uni.showModal({
  40. title:'请输入手机号',
  41. showCancel:false
  42. })
  43. return
  44. }
  45. // if(tools.isNull(this.password_value)) {
  46. // uni.showModal({
  47. // title:'请输入密码',
  48. // showCancel:false
  49. // })
  50. // return
  51. // }
  52. let self = this
  53. this.tools.request_login(self, this.phone_value, this.password_value, (success)=>{
  54. if(success === true) {
  55. uni.showToast({
  56. title:'登录成功',
  57. duration:2000
  58. })
  59. uni.navigateBack()
  60. }
  61. })
  62. }
  63. },
  64. components: {
  65. navback
  66. }
  67. }
  68. </script>
  69. <style>
  70. page{
  71. background-color: #2A2832;
  72. }
  73. </style>
  74. <style lang="scss">
  75. .container{
  76. display: flex;
  77. box-sizing: border-box;
  78. flex-direction: column;
  79. width: 100%;
  80. height: 100%;
  81. align-items: center;
  82. .kuang{
  83. display: flex;
  84. box-sizing: border-box;
  85. flex-direction: column;
  86. width: 497px;
  87. border-radius: 10px;
  88. border: 1px solid #32B3AA;
  89. box-shadow: 0 0 15px #000000;
  90. padding: 50px 37px;
  91. align-items: center;
  92. .loginText{
  93. display: flex;
  94. font-size: 24px;
  95. font-weight: 500;
  96. color: #C2C2C2;
  97. justify-content: center;
  98. }
  99. .phone_input{
  100. margin-top: 30px;
  101. width: 100%;
  102. height: 70px;
  103. font-size: 22px;
  104. color: #ffffff;
  105. border-bottom: 1px solid #32B3AA;
  106. }
  107. .passwordcontent{
  108. position: relative;
  109. display: flex;
  110. width: 100%;
  111. .password_input{
  112. margin-top: 40px;
  113. background-color: transparent;
  114. }
  115. .passwordcontent_hidden{
  116. position: absolute;
  117. display: flex;
  118. bottom: 10px;
  119. right: 10px;
  120. width: 30px;
  121. height: 30px;
  122. transition: all 0.5s;
  123. image{
  124. width: 100%;
  125. height: 100%;
  126. }
  127. }
  128. .passwordcontent_show {
  129. transform: rotate(-180deg);
  130. transition: all 0.5s;
  131. }
  132. }
  133. .loginButton{
  134. display: flex;
  135. margin-top: 80px;
  136. width: 260px;
  137. height: 40px;
  138. border-radius: 10px;
  139. color: #ffffff;
  140. background-color: #32B3AA;
  141. justify-content: center;
  142. align-items: center;
  143. }
  144. }
  145. }
  146. </style>