login.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <view class="login">
  3. <view class="logo">
  4. <image src="../../static/images/login/logo.png" style="width: 160upx;height: 160upx;" mode="scaleToFill"></image>
  5. </view>
  6. <view class="login-from">
  7. <view class="input-item">
  8. <label for="">
  9. <image src="../../static/images/login/phone.png" style="width: 30upx;height: 40upx;" mode=""></image>
  10. </label>
  11. <input type="text" placeholder="请输入账号" v-model="account">
  12. </view>
  13. <view class="input-item" style="margin-bottom: 20upx;">
  14. <label for="">
  15. <image src="../../static/images/login/lock.png" style="width: 30upx;height: 40upx;" mode=""></image>
  16. </label>
  17. <input type="password" placeholder="请输入密码" v-model="password">
  18. </view>
  19. <view class="forget">
  20. <navigator url="/pages/user/find-pass" open-type="navigate" style="display: inline;">
  21. <text>忘记密码</text>
  22. </navigator>
  23. </view>
  24. <view class="button-item">
  25. <button class="login-btn" @tap="login()">登录</button>
  26. </view>
  27. <view class="button-item">
  28. <navigator url="/pages/register/step1" open-type="navigate">
  29. <button class="reg-btn">注册</button>
  30. </navigator>
  31. </view>
  32. <view class="use-phone">
  33. <navigator url="/pages/user/vcode-login" open-type="navigate" style="display: inline;">
  34. <text>使用手机验证码登入</text>
  35. </navigator>
  36. </view>
  37. </view>
  38. <view class="third-party">
  39. <view class="title"><text>第三方登录</text></view>
  40. <view class="content">
  41. <image src="../../static/images/login/wx.png" style="width: 90upx;height: 90upx;" mode="scaleToFill"></image>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. data() {
  49. return {
  50. account: '',
  51. password: ''
  52. }
  53. },
  54. methods: {
  55. login() {
  56. if (this.$verified.account(this.account) &&
  57. this.$verified.required(this.password, "请输入密码")) {
  58. this.$http.post({
  59. url: "/user/login",
  60. data: {
  61. account: this.account,
  62. password: this.password
  63. },
  64. success: (res) => {
  65. console.log(this.$store)
  66. this.$store.dispatch("user/save", res.data.data.userinfo)
  67. uni.$emit("login_succeeded");
  68. uni.navigateBack();
  69. }
  70. })
  71. }
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. .login {
  78. background: $primary-color;
  79. height: 100vh;
  80. width: 750rpx;
  81. /* #ifdef APP-PLUS */
  82. padding-bottom: 60upx;
  83. /* #endif */
  84. }
  85. .logo {
  86. width: 160upx;
  87. height: 160upx;
  88. background: white;
  89. border-radius: 160upx;
  90. border: 10upx solid $primary-color;
  91. margin: auto;
  92. margin-top: -60upx;
  93. position: relative;
  94. top: 80upx;
  95. z-index: 999;
  96. }
  97. .login-from {
  98. margin: auto;
  99. width: 600upx;
  100. height: 740upx;
  101. background-color: white;
  102. border-radius: 20rpx;
  103. padding: 72upx;
  104. padding-top: 180upx;
  105. box-sizing: border-box;
  106. position: relative;
  107. z-index: 2;
  108. &::after {
  109. content: "";
  110. background: url(../../static/images/login/box-bottom.png) no-repeat;
  111. background-size: contain;
  112. width: 564upx;
  113. height: 30upx;
  114. display: block;
  115. position: absolute;
  116. bottom: -30upx;
  117. left: 18upx;
  118. z-index: -1;
  119. }
  120. }
  121. .input-item {
  122. display: flex;
  123. margin-bottom: 48upx;
  124. label {
  125. width: 50upx;
  126. }
  127. input {
  128. border-bottom: 2upx solid $primary-color;
  129. flex-grow: 1;
  130. padding: 5upx;
  131. font-size: 30upx;
  132. }
  133. }
  134. .forget {
  135. text-align: right;
  136. color: $primary-color;
  137. font-size: 28upx;
  138. }
  139. .login-btn,
  140. .reg-btn {
  141. height: 80upx;
  142. border: 2upx solid $primary-color;
  143. line-height: 80upx;
  144. margin: 30upx 0;
  145. font-size: 32upx;
  146. &::after {
  147. border: none;
  148. }
  149. }
  150. .login-btn {
  151. background: $primary-color;
  152. color: white;
  153. }
  154. .reg-btn {
  155. background-color: white;
  156. color: $primary-color;
  157. }
  158. .use-phone {
  159. font-size: 28upx;
  160. text-align: center;
  161. color: $primary-color;
  162. }
  163. .third-party {
  164. margin: auto;
  165. text-align: center;
  166. margin-top: 100upx;
  167. .title {
  168. font-size: 28upx;
  169. color: white;
  170. &::before,
  171. &::after {
  172. display: inline-block;
  173. width: 100upx;
  174. height: 0upx;
  175. border: 1upx solid #ff8ca8;
  176. transform: scaleY(0.5);
  177. content: "";
  178. margin: 8upx 20upx;
  179. }
  180. }
  181. .content {
  182. margin-top: 50upx;
  183. }
  184. }
  185. </style>