index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <view>
  3. <view class="head"></view>
  4. <view class="content flex column items-center">
  5. <view class="title">账号登录</view>
  6. <!-- <view class="headline-2"> -->
  7. <view class="flex items-center justify-between uni-list-cell-db-2">
  8. <!-- <text class="uni-list-cell-left-2">账号:</text> -->
  9. <span>账号:</span>
  10. <!-- <view class="uni-list-cell-db-2"> -->
  11. <u--input class="flex items-center" placeholder="请输入手机号" v-model="phone" required />
  12. <!-- </view> -->
  13. </view>
  14. <view class="flex items-center justify-between uni-list-cell-db-2">
  15. <span>密码:</span>
  16. <u--input class="flex items-center" placeholder="请输入密码" v-model="password" required />
  17. </view>
  18. <button
  19. type="default"
  20. @click="bindLogin"
  21. style="
  22. width: 273px;
  23. height: 33px;
  24. background-color: rgba(42, 130, 228, 1);
  25. color: white;
  26. font-size: 15px;
  27. border-radius: 14px;
  28. "
  29. >
  30. 登录
  31. </button>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. phone: '',
  40. password: '',
  41. }
  42. },
  43. methods: {
  44. async bindLogin() {
  45. if (this.phone && this.password) {
  46. uni.showLoading({
  47. title: '登录中',
  48. })
  49. let res = await this.$myRequest({
  50. method: 'post',
  51. url: `/login/loginWork?phone=${this.phone}&password=${this.password}`,
  52. })
  53. // console.log(res)
  54. if (res.status == 200) {
  55. uni.setStorageSync('token', res.data)
  56. uni.setStorageSync('identity', JSON.stringify(1)) //身份标识
  57. uni.reLaunch({
  58. url: '../repair-center/index',
  59. })
  60. } else {
  61. uni.showToast({
  62. icon: 'error',
  63. title: '登录失败',
  64. })
  65. }
  66. } else {
  67. uni.showToast({
  68. title: '请输入账号密码',
  69. icon: 'none',
  70. })
  71. }
  72. },
  73. },
  74. }
  75. </script>
  76. <style lang="scss">
  77. .head {
  78. height: 300rpx;
  79. border-radius: 0px 0px 10px 10px;
  80. background-color: rgba(42, 130, 228, 1);
  81. }
  82. .content {
  83. position: fixed;
  84. top: 120rpx;
  85. left: 50%;
  86. width: 720rpx;
  87. height: 568rpx;
  88. background-color: white;
  89. border: 1px solid rgba(128, 128, 128, 0.45);
  90. transform: translateX(-360rpx);
  91. }
  92. .title {
  93. font-size: 36rpx;
  94. font-weight: 700;
  95. margin-top: 18rpx;
  96. text-align: center;
  97. }
  98. .uni-list-cell-left-2 {
  99. float: left;
  100. margin-top: 80rpx;
  101. margin-left: 26rpx;
  102. }
  103. .uni-list-cell-db-2 {
  104. // float: right;
  105. // margin-right: 34rpx;
  106. // margin-top: 70rpx;
  107. width: 540rpx;
  108. height: 70rpx;
  109. padding: 0rpx 20rpx;
  110. margin: 20rpx 0px;
  111. border-radius: 28rpx;
  112. background-color: rgba(166, 166, 166, 0.18);
  113. }
  114. .uni-input-2 {
  115. // margin-left: 20rpx;
  116. // margin-top: 20rpx;
  117. font-size: 28rpx;
  118. cursor: not-allowed;
  119. }
  120. .uni-input-placeholder {
  121. text-align: center;
  122. }
  123. .u-input {
  124. border: none;
  125. }
  126. button {
  127. // position: absolute;
  128. // bottom: 72rpx;
  129. // left: 140rpx;
  130. margin-top: 60rpx;
  131. line-height: 66rpx;
  132. }
  133. </style>