login.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view style="height: 100vh;">
  3. <view class="logo">
  4. <image src="../../static/image/login/8eef2e54055a5b072a5dc000919a7ae.png" mode=""></image>
  5. </view>
  6. <form @submit="formSubmit">
  7. <view class="uni-form-item uni-column">
  8. <view class="username">
  9. <u-icon name="account" size="36" style="margin-right:30rpx;color: #72CD9C;"></u-icon>
  10. <!-- <input class="uni-input" name="username" placeholder-class="icon iconfont icon-bianji1" placeholder="请输入用户名" /> -->
  11. <u-input class="uni-input" name="username" v-model="formdata.username" placeholder-class="icon iconfont icon-bianji1" placeholder="请输入用户名"/>
  12. </view>
  13. <view class="passwold">
  14. <u-icon name="lock" size="36" style="margin-right:30rpx;color: #72CD9C;"></u-icon>
  15. <!-- <input class="uni-input" name="pass" password placeholder-class="icon iconfont icon-bianji1" placeholder="请输入密码" /> -->
  16. <u-input class="uni-input" name="pass" v-model="formdata.passwold" type="password" placeholder-class="icon iconfont icon-bianji1" placeholder="请输入密码"/>
  17. </view>
  18. <view class="aboutpass">
  19. <p>忘记密码?</p>
  20. <u-checkbox-group>
  21. <u-checkbox v-model="checked" :label-disabled="false" size="22">记住密码</u-checkbox>
  22. </u-checkbox-group>
  23. </view>
  24. <view class="uni-btn-v">
  25. <button form-type="submit">登 录</button>
  26. </view>
  27. </view>
  28. </form>
  29. <view class="bg">
  30. <image src="../../static/image/login/850c9307f4ef2d7dc6db1049711ab55.jpg" mode=""></image>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. export default {
  36. data() {
  37. return {
  38. checked:false,
  39. formdata:{
  40. username:'',
  41. passwold:''
  42. }
  43. }
  44. },
  45. onLoad() {
  46. },
  47. methods: {
  48. async formSubmit() {
  49. const res = await this.$myRequest({
  50. url: '/api/api_gateway?method=user.login.login_user',
  51. data: {
  52. username: this.formdata.username,
  53. password: this.formdata.passwold
  54. }
  55. })
  56. let session_key = res.session_key
  57. uni.setStorage({
  58. key: 'session_key',
  59. data: session_key,
  60. success: ()=> {
  61. uni.switchTab({
  62. url:"../index/index"
  63. })
  64. }
  65. })
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss">
  71. .logo {
  72. width: 100%;
  73. height: 340rpx;
  74. text-align: center;
  75. padding-top: 120rpx;
  76. image {
  77. width: 280rpx;
  78. margin: 0 auto;
  79. height: 120rpx;
  80. }
  81. }
  82. .bg {
  83. width: 100%;
  84. position: absolute;
  85. bottom: 0;
  86. z-index: -1;
  87. image {
  88. width: 100%;
  89. }
  90. }
  91. .uni-form-item {
  92. // margin-top: 50rpx;
  93. width: 100%;
  94. .username {
  95. width: 80%;
  96. margin: 0 auto;
  97. display: flex;
  98. margin-bottom: 40rpx;
  99. padding-bottom: 10rpx;
  100. border-bottom: 2rpx solid #C3C3C3;
  101. }
  102. .passwold {
  103. width: 80%;
  104. margin: 0 auto;
  105. display: flex;
  106. margin-bottom: 40rpx;
  107. }
  108. .aboutpass{
  109. width: 80%;
  110. margin: 0 auto;
  111. display: flex;
  112. justify-content: space-between;
  113. p{
  114. color: #C0C0C0;
  115. }
  116. /deep/.u-checkbox__label{
  117. font-size: 28rpx;
  118. color: #C0C0C0;
  119. margin-right: 0;
  120. }
  121. }
  122. .uni-btn-v{
  123. width: 80%;
  124. margin: 112rpx auto 0;
  125. position: relative;
  126. z-index: 100;
  127. button{
  128. width: 100%;
  129. height: 72rpx;
  130. line-height: 75rpx;
  131. background-color: #5DC18B;
  132. color: #FFFFFF;
  133. border-radius: 36rpx;
  134. font-size: 28rpx;
  135. }
  136. }
  137. }
  138. </style>