login.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view>
  3. <view class="head">
  4. </view>
  5. <view class="content">
  6. <view class="logo">
  7. 账号登入
  8. </view>
  9. <view class="headline-2">
  10. <text class="uni-list-cell-left-2" >账号:</text>
  11. <view class="uni-list-cell-db-2">
  12. <input class="uni-input-2"placeholder="请输入手机号" v-model="phone" required />
  13. </view>
  14. </view>
  15. <view class="headline-2">
  16. <text class="uni-list-cell-left-2">密码:</text>
  17. <view class="uni-list-cell-db-2">
  18. <input class="uni-input-2" placeholder="请输入密码" v-model="password" required/>
  19. </view>
  20. </view>
  21. <button type="default" @click="bindLogin()" style="width: 273px; height: 33px; background-color:rgba(42, 130, 228, 1); color: white;font-size: 15px; border-radius: 14px;">登录</button>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. var self;
  27. export default {
  28. data() {
  29. return {
  30. phone:"",
  31. password:""
  32. };
  33. },
  34. methods: {
  35. bindLogin(){
  36. const data = {
  37. phone: this.phone,
  38. password: this.password
  39. };
  40. console.log(data);
  41. uni.request({
  42. url:'/api/login/loginWork',
  43. method:'POST',
  44. data:{
  45. phone: this.phone,
  46. password: this.password
  47. },
  48. success: (res) => {
  49. if(res.statusCode ==404){
  50. uni.showToast({
  51. title:'错'
  52. });
  53. return;
  54. }
  55. uni.showToast({
  56. title:'成'
  57. });
  58. uni.reLaunch({
  59. url:'../index/index',
  60. })
  61. },
  62. fail: () => {
  63. },
  64. complete: () => {
  65. }
  66. });
  67. }
  68. },
  69. }
  70. </script>
  71. <style>
  72. .head{
  73. position: relative;
  74. height: 149px;
  75. border-radius: 0px 0px 10px 10px;
  76. background-color: rgba(42, 130, 228, 1);
  77. }
  78. .content{
  79. position: absolute;
  80. top:59px;
  81. left: 7px;
  82. width:359px;
  83. height: 284px;
  84. background-color: white;
  85. border: 1px solid rgba(128, 128, 128, 0.45);
  86. }
  87. .logo{
  88. font-size: 18px;
  89. font-weight: 700;
  90. margin-top: 9px;
  91. text-align: center;
  92. }
  93. .uni-list-cell-left-2{
  94. float: left;
  95. margin-top: 40px;
  96. margin-left: 13px;
  97. }
  98. .uni-list-cell-db-2{
  99. float: right;
  100. margin-right: 17px;
  101. margin-top: 35px;
  102. width: 270px;
  103. height: 35px;
  104. border-radius: 14px;
  105. background-color: rgba(166, 166, 166, 0.18);
  106. }
  107. .uni-input-2{
  108. margin-left: 10px;
  109. margin-top: 5px;
  110. font-size: 12px;
  111. cursor: not-allowed;
  112. }
  113. .uni-input-placeholder{
  114. margin-top: 6px;
  115. text-align: center;
  116. }
  117. button{
  118. position: absolute;
  119. bottom: 36px;
  120. left: 69px;
  121. line-height: 33px;
  122. }
  123. </style>