login-password.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view style="height: 100% !important;">
  3. <view class="context">
  4. <view class="input-wrap">
  5. <input style="text-align: start;" placeholder="请输入用户名" v-model="username" auto-complete="new-password"
  6. autocomplete="off" />
  7. </view>
  8. <view class="input-wrap" style="margin-top: 50rpx;">
  9. <input class="uni-input" placeholder="请输入密码" password type="text" v-model="password" />
  10. </view>
  11. <view style="text-align: center;margin-top: 100rpx;" @tap="loginFun">
  12. <view class="login" style="background-color: #49A992">登录</view>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import md5 from "md5";
  19. import sha1 from "js-sha1";
  20. export default {
  21. components: {},
  22. props: {
  23. themeColor: {
  24. type: String,
  25. default: '#33CCCC',
  26. },
  27. logoUrl: {
  28. type: String,
  29. default: '',
  30. },
  31. },
  32. computed: {
  33. style_xuan() {
  34. let that = this;
  35. var themeColor = that.themeColor;
  36. var isRemeber = that.isRemeber;
  37. var style = '';
  38. if (isRemeber) {
  39. style += `color:${themeColor};`;
  40. }
  41. return style;
  42. },
  43. },
  44. data() {
  45. return {
  46. isRemeber: false,
  47. isShow: false, //是否显示输的密码
  48. username: '',
  49. password: '',
  50. }
  51. },
  52. methods: {
  53. isShowPassword() {
  54. let that = this;
  55. that.isShow = !that.isShow;
  56. },
  57. loginFun() {
  58. let that = this;
  59. if (that.username == "" || that.password == "") {
  60. uni.showToast({
  61. title: '请输入账号或密码',
  62. icon: 'none'
  63. });
  64. return;
  65. }
  66. let pad = md5(
  67. sha1(that.password).toUpperCase()
  68. ).toUpperCase();
  69. let data = {
  70. loginId: that.username,
  71. pwd: pad,
  72. };
  73. this.$emit('loginFun', data);
  74. },
  75. }
  76. }
  77. </script>
  78. <style lang="scss">
  79. .context {
  80. position: relative;
  81. width: 100%;
  82. height: 100%;
  83. padding: 190rpx 50rpx 0rpx 50rpx;
  84. z-index: 100;
  85. }
  86. .input-wrap {
  87. height: 100rpx;
  88. text-align: center;
  89. padding: 30rpx;
  90. border: 2rpx solid #d5d4d4;
  91. border-radius: 100rpx;
  92. background-color: #fff;
  93. }
  94. view {
  95. box-sizing: border-box;
  96. }
  97. .cf-hengStart {
  98. display: flex;
  99. flex-direction: row;
  100. justify-content: flex-start;
  101. align-items: center;
  102. width: 100%;
  103. }
  104. .xuanShowBox {
  105. padding-left: 40rpx;
  106. .icon-weixuan {
  107. color: #eaeeed;
  108. }
  109. .xuanShowTip {
  110. padding-left: 10rpx;
  111. }
  112. }
  113. .uni-input {
  114. text-align: start;
  115. }
  116. .login {
  117. color: #FFFFFF;
  118. width: 100%;
  119. border-radius: 68rpx;
  120. margin: 20rpx auto;
  121. padding: 35rpx;
  122. font-size: 28rpx;
  123. }
  124. .changeShow {
  125. font-size: 36rpx;
  126. position: relative;
  127. top: -12rpx;
  128. left: 84rpx;
  129. }
  130. .input-placeholder {
  131. font-size: 28rpx;
  132. }
  133. uni-page-wrapper {
  134. height: 100%;
  135. }
  136. uni-page-body {
  137. height: 100%;
  138. }
  139. </style>