login.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <!-- 开启顶部安全区适配 -->
  3. <van-nav-bar
  4. :border="false"
  5. safe-area-inset-top
  6. style="background-color: #5c8fff"
  7. />
  8. <div class="page_login">
  9. <div class="login_bg">
  10. <div class="bg_title">
  11. <van-image
  12. :src="require('@/assets/logo.svg')"
  13. width="32"
  14. height="32"
  15. fit="contain"
  16. />
  17. <span>双碳感知资产运营管理平台</span>
  18. </div>
  19. </div>
  20. <div class="login_info">
  21. <div class="info_content">
  22. <div class="title">
  23. <span>登录</span>
  24. </div>
  25. <van-form @submit="onSubmit">
  26. <van-cell-group>
  27. <van-field
  28. v-model="tel"
  29. name="手机号"
  30. :left-icon="require('@/assets/phone.svg')"
  31. placeholder="请输入手机号码"
  32. :clearable="true"
  33. :rules="[{ required: true, message: '请输入手机号码' }]"
  34. style="margin-bottom: 20px"
  35. />
  36. <van-field
  37. v-model="password"
  38. type="password"
  39. name="密码"
  40. :left-icon="require('@/assets/password.svg')"
  41. placeholder="请输入密码"
  42. :clearable="true"
  43. :rules="[{ required: true, message: '请输入密码' }]"
  44. />
  45. </van-cell-group>
  46. <div style="margin-top: 50px">
  47. <van-button
  48. round
  49. block
  50. type="primary"
  51. color="#2E69EB"
  52. :loading="loading"
  53. loading-text="登陆中。。。"
  54. native-type="submit"
  55. >
  56. 登录
  57. </van-button>
  58. </div>
  59. </van-form>
  60. </div>
  61. </div>
  62. </div>
  63. </template>
  64. <script>
  65. import Api from "../utils/api";
  66. export default {
  67. data() {
  68. return {
  69. loading: false,
  70. tel: "",
  71. password: "",
  72. };
  73. },
  74. mounted() {
  75. window.localStorage.setItem("token", "");
  76. window.localStorage.setItem("role", "");
  77. },
  78. methods: {
  79. onSubmit() {
  80. window.location.href = "/?username=" + this.tel + "&&pwd=" + this.password;
  81. },
  82. },
  83. };
  84. </script>
  85. <style lang="scss" scoped>
  86. .page_login {
  87. position: relative;
  88. .login_bg {
  89. width: 100%;
  90. height: 245px;
  91. background: #5c8fff;
  92. border-radius: 0px 0px 16px 16px;
  93. padding-top: 16px;
  94. .bg_title {
  95. display: flex;
  96. align-items: center;
  97. justify-content: center;
  98. span {
  99. height: 24px;
  100. font-size: 18px;
  101. font-weight: 600;
  102. color: #ffffff;
  103. line-height: 24px;
  104. text-align: center;
  105. }
  106. }
  107. }
  108. .login_info {
  109. position: absolute;
  110. top: 142px;
  111. width: calc(100% - 32px);
  112. padding: 0 16px;
  113. .info_content {
  114. background: #ffffff;
  115. box-shadow: 0px 0px 8px 0px rgba(51, 51, 51, 0.08);
  116. border-radius: 16px;
  117. padding: 30px 20px 50px 20px;
  118. .title {
  119. display: flex;
  120. align-items: center;
  121. justify-content: center;
  122. margin-bottom: 30px;
  123. span {
  124. height: 24px;
  125. font-size: 20px;
  126. font-weight: 600;
  127. color: #0c1935;
  128. line-height: 24px;
  129. }
  130. }
  131. }
  132. }
  133. /deep/ {
  134. --van-cell-vertical-padding: 8px;
  135. .van-icon__image {
  136. margin-top: 4px;
  137. }
  138. .van-field {
  139. background: #f4f7ff;
  140. border-radius: 18px;
  141. border: 1px solid #5c8fff;
  142. }
  143. }
  144. }
  145. </style>