index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-01-12 11:57:48
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-01-20 10:12:06
  6. * @Description: file content
  7. * @FilePath: \crm\pages\login\index.vue
  8. -->
  9. <template>
  10. <view class="login">
  11. <view class="nav">
  12. <view :style="{ paddingTop }">
  13. <view class="title" :style="[{ height }, { lineHeight: height }]">
  14. <text>OMS</text>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="main">
  19. <view class="bg flex1">
  20. <view class="tips">欢迎使用OMS</view>
  21. <image class="login-img" src="../../static/images/login.png" mode="scaleToFill" />
  22. </view>
  23. <u-form :model="loginForm" :rules="rules" ref="loginForm" label-width="0">
  24. <u-form-item prop="username" customStyle="padding-top:38rpx;border-bottom:1px solid #CDCDCD">
  25. <u-input placeholder="请输⼊账号" v-model="loginForm.username" border="none" clearable></u-input>
  26. </u-form-item>
  27. <u-form-item prop="password" customStyle="padding-top:38rpx;border-bottom:1px solid #CDCDCD">
  28. <u-input
  29. placeholder="请输⼊密码"
  30. :password="true"
  31. v-model="loginForm.password"
  32. border="none"
  33. clearable></u-input>
  34. </u-form-item>
  35. </u-form>
  36. <u-text
  37. color="#CDCDCD"
  38. size="20rpx"
  39. customStyle="padding-top:32rpx"
  40. text="登录代表您已同意用户协议及隐私条款"></u-text>
  41. <view class="login-btn" @click="handleLogin()">登录</view>
  42. <view class="footer">
  43. <u-text color="#646464" size="24rpx" align="center" text="由-青岛大数华创科技有限公司 提供技术支持"></u-text>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import { mapActions } from 'vuex'
  50. import to from 'await-to-js'
  51. export default {
  52. name: 'omsIndex',
  53. data() {
  54. return {
  55. height: '',
  56. paddingTop: '',
  57. loginForm: {
  58. username: '',
  59. password: '',
  60. },
  61. rules: {
  62. username: {
  63. type: 'string',
  64. required: true,
  65. message: '请填写账号',
  66. trigger: ['blur'],
  67. },
  68. password: {
  69. type: 'string',
  70. required: true,
  71. message: '请填写密码',
  72. trigger: ['blur'],
  73. },
  74. },
  75. }
  76. },
  77. created() {
  78. const navData = uni.getMenuButtonBoundingClientRect()
  79. this.height = navData.height + 'px'
  80. this.paddingTop = navData.top + 'px'
  81. },
  82. mounted() {},
  83. methods: {
  84. ...mapActions(['login']),
  85. async handleLogin() {
  86. const [valid] = await to(this.$refs.loginForm.validate())
  87. if (valid !== null) return
  88. await this.login(this.loginForm)
  89. },
  90. },
  91. }
  92. </script>
  93. <style>
  94. page {
  95. background: #fff;
  96. }
  97. </style>
  98. <style lang="scss" scoped>
  99. .login {
  100. padding-top: 188rpx;
  101. .nav {
  102. position: absolute;
  103. left: 0;
  104. top: 0;
  105. width: 100%;
  106. background: #ffffff;
  107. .title {
  108. position: relative;
  109. text-align: center;
  110. font-size: 32rpx;
  111. font-weight: bold;
  112. color: #000;
  113. .back {
  114. position: absolute;
  115. top: 0;
  116. bottom: 0;
  117. margin: auto;
  118. left: 70rpx;
  119. display: flex;
  120. }
  121. }
  122. }
  123. .main {
  124. position: absolute;
  125. width: 100%;
  126. height: calc(100vh - 188rpx);
  127. background: #ffffff;
  128. padding: 0 88rpx 0 90rpx;
  129. .bg {
  130. padding-top: 40rpx;
  131. .tips {
  132. font-size: 46rpx;
  133. font-weight: bold;
  134. color: #060606;
  135. }
  136. .login-img {
  137. width: 292rpx;
  138. height: 292rpx;
  139. }
  140. }
  141. .login-btn {
  142. margin-top: 42rpx;
  143. width: 100%;
  144. height: 92rpx;
  145. background: #3e7ef8;
  146. border-radius: 32rpx;
  147. font-size: 32rpx;
  148. color: #ffffff;
  149. text-align: center;
  150. line-height: 92rpx;
  151. }
  152. .footer {
  153. position: absolute;
  154. bottom: 100rpx;
  155. left: 0;
  156. right: 0;
  157. margin: auto;
  158. }
  159. }
  160. }
  161. </style>