login.vue 3.4 KB

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