register.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view>
  3. <u-navbar title="" autoBack placeholder></u-navbar>
  4. <view class="card_login">
  5. <view class="card_head_logo">
  6. <image class="mine_image" src="../static/logo.png" mode=""></image>
  7. <view class="welcome_title">欢迎注册宝智达气瓶</view>
  8. </view>
  9. <view class="login_input_box">
  10. <u--input v-model="formList.account" fontSize="18px" placeholder="请输入账号" border="bottom"
  11. clearable></u--input>
  12. </view>
  13. <view class="login_input_box">
  14. <u--input v-model="formList.password" fontSize="18px" placeholder="请输入密码" password border="bottom"
  15. clearable></u--input>
  16. </view>
  17. <view class="title_register" @click="goLogin">去登录</view>
  18. <view class="card_btn">
  19. <u-button type="primary" :disabled="disabled" text="登录" @click="getRegister"></u-button>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. formList: {
  29. account: '',
  30. password: '',
  31. },
  32. }
  33. },
  34. computed: {
  35. disabled() {
  36. if (this.formList.account == '' || this.formList.password == '') {
  37. return true;
  38. } else {
  39. return false;
  40. }
  41. }
  42. },
  43. methods: {
  44. // 注册
  45. getRegister() {
  46. uni.showLoading();
  47. this.$api.post('/api/login', {
  48. type: 1,
  49. mobile: true,
  50. username: this.formList.account,
  51. password: this.formList.password
  52. }).then((res) => {
  53. if (res.code == 200) {
  54. console.log(res, 132)
  55. } else {
  56. uni.showToast({
  57. title: res.data.msg,
  58. icon: 'none'
  59. });
  60. }
  61. uni.hideLoading();
  62. })
  63. },
  64. // 登录
  65. goLogin() {
  66. // uni.redirectTo({
  67. // url: '/pages/login'
  68. // })
  69. uni.navigateBack({
  70. delta: 1
  71. });
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss">
  77. .welcome_title {
  78. font-size: 46rpx;
  79. font-weight: 600;
  80. margin-bottom: 60rpx;
  81. margin-top: 10rpx;
  82. }
  83. .card_head_logo {
  84. margin-top: 50rpx;
  85. display: flex;
  86. flex-direction: column;
  87. justify-content: center;
  88. align-items: center;
  89. }
  90. .card_login {
  91. padding: 20rpx 40rpx;
  92. }
  93. .mine_image {
  94. width: 100rpx;
  95. height: 100rpx;
  96. }
  97. .login_input_box {
  98. margin-bottom: 30rpx;
  99. }
  100. .title_register {
  101. display: flex;
  102. justify-content: flex-end;
  103. font-size: 30rpx;
  104. color: #494949;
  105. }
  106. .card_hint {
  107. margin-top: 60rpx;
  108. display: flex;
  109. align-items: flex-start;
  110. }
  111. .agreement_title {
  112. font-size: 30rpx;
  113. color: #333;
  114. }
  115. .protocol_title {
  116. color: #1177ff;
  117. }
  118. .card_btn {
  119. margin-top: 50rpx;
  120. }
  121. .card_checkbox {
  122. margin-top: 5rpx;
  123. position: relative;
  124. cursor: pointer;
  125. }
  126. .message {
  127. display: none;
  128. position: absolute;
  129. padding: 5px 8px;
  130. border: 1px solid #494949;
  131. border-radius: 9px;
  132. top: -36px;
  133. font-size: 12px;
  134. width: 110px;
  135. background: #494949;
  136. color: #fff;
  137. left: -6px;
  138. }
  139. .message::after {
  140. content: '';
  141. position: absolute;
  142. left: 8px;
  143. top: 100%;
  144. border: 8px solid transparent;
  145. border-top: 6px solid #494949;
  146. margin-left: -2px;
  147. }
  148. </style>