艺易修小程序24.08.21
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

158 lines
2.9 KiB

1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="content">
  3. <view class="topBox">
  4. <h3 class="title">登录</h3>
  5. <h3>欢迎使用xx报修</h3>
  6. </view>
  7. <view class="inputBox">
  8. <view class="ipt">
  9. <h4>手机号</h4>
  10. <input v-model="form.account" type="text" value="" placeholder="请输入手机号" />
  11. </view>
  12. <view class="ipt">
  13. <h4>密码</h4>
  14. <input v-model="form.password" type="password" value="" placeholder="请输入密码" />
  15. </view>
  16. <button @click="login" class="loginBtn">登录</button>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. export default {
  22. data() {
  23. return {
  24. form: {
  25. account: '',
  26. password: ''
  27. }
  28. }
  29. },
  30. methods: {
  31. //登录
  32. login() {
  33. if(this.form.account.trim() == ''){
  34. return uni.showToast({
  35. icon: 'none',
  36. title: '请填写手机号'
  37. })
  38. }
  39. if(this.form.password.trim() == ''){
  40. return uni.showToast({
  41. icon: 'none',
  42. title: '请填写密码'
  43. })
  44. }
  45. this.$api('loginLogin', this.form, res => {
  46. if (res.code == 200) {
  47. uni.setStorageSync('token', res.result.token);
  48. uni.setStorageSync('userInfo', JSON.stringify(res.result.userInfo));
  49. this.$store.commit('setUserInfo',res.result.userInfo)
  50. uni.switchTab({
  51. url: '/pages/repair/repair'
  52. })
  53. }
  54. })
  55. }
  56. }
  57. }
  58. </script>
  59. <style scoped>
  60. .content {
  61. height: 100vh;
  62. /* 微信小程序不允许使用本地图片 */
  63. /* background: url("@/static/login/bj.jpg") no-repeat center; */
  64. /* 所以这里我把背景图片上传在阿里云oss.下面这个地址是阿里云oss图片地址 */
  65. background: url("https://tennis-oss.xzaiyp.top/2024-09-02/0030f0ef-4270-47dc-a870-b24bffb6ce28.jpg") no-repeat center;
  66. background-size: cover;
  67. }
  68. .topBox {
  69. font-size: 34rpx;
  70. color: #fff;
  71. padding: 80rpx 50rpx;
  72. }
  73. .topBox .title {
  74. font-size: 45rpx;
  75. }
  76. h3 {
  77. margin-bottom: 10rpx;
  78. }
  79. .inputBox {
  80. position: fixed;
  81. bottom: 0;
  82. left: 0;
  83. width: 750rpx;
  84. height: 85vh;
  85. background-color: #fff;
  86. border-top-left-radius: 40rpx;
  87. border-top-right-radius: 40rpx;
  88. padding: 60rpx;
  89. box-sizing: border-box;
  90. }
  91. .ipt {
  92. margin-bottom: 50rpx;
  93. }
  94. .ipt h4 {
  95. margin-bottom: 20rpx;
  96. font-size: 36rpx;
  97. color: #333;
  98. }
  99. .ipt input {
  100. border-bottom: 1px solid #dedede;
  101. padding-bottom: 20rpx;
  102. font-size: 28rpx;
  103. }
  104. .loginBtn {
  105. margin-top: 20rpx;
  106. line-height: 85rpx;
  107. text-align: center;
  108. background: #3c9cff;
  109. border-radius: 40rpx;
  110. color: #fff;
  111. margin-top: 50rpx;
  112. }
  113. .registerBtn {
  114. margin-top: 20rpx;
  115. line-height: 85rpx;
  116. text-align: center;
  117. border-radius: 40rpx;
  118. color: #ccc;
  119. margin-top: 50rpx;
  120. border: none;
  121. }
  122. .tipbox {
  123. position: fixed;
  124. bottom: 120rpx;
  125. left: 50%;
  126. transform: translate(-50%, -120px);
  127. }
  128. .otherUser {
  129. margin-top: 30rpx;
  130. display: flex;
  131. justify-content: center;
  132. }
  133. .txt {
  134. font-size: 28rpx;
  135. color: #969696;
  136. }
  137. .otherUser .uni-icons {
  138. margin-left: 20rpx;
  139. }
  140. </style>