loginByPWD.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view class="df jcc fdc">
  3. <view class="login-righttitle">密码登录</view>
  4. <view class="fdc df jcc loginByPWD-listbox">
  5. <!-- 账号 -->
  6. <view class="df loginByPWD-inputbox aic">
  7. <view class="loginByPWD-inputbox-icon">
  8. <img class="df" src="../../assets/login/loginIcon2.png" />
  9. </view>
  10. <input @focus="inputFocus" class="loginByPWD-inputbox-input" type="text" placeholder="账号" @input="onAccountInput" />
  11. </view>
  12. <!-- 横线 -->
  13. <view class="loginByPWD-line"></view>
  14. <!-- 密码 -->
  15. <view class="df loginByPWD-inputbox aic">
  16. <view class="loginByPWD-inputbox-icon">
  17. <img class="df" src="../../assets/login/loginIcon1.png" />
  18. </view>
  19. <input @focus="inputFocus" class="loginByPWD-inputbox-input" type="password" placeholder="密码" @input="onPWDInput" />
  20. </view>
  21. <!-- 横线 -->
  22. <view class="loginByPWD-line"></view>
  23. <!-- 登录按钮 -->
  24. <view class="loginByPWD-loginbtn df jcc aic btn-hover" @click="onLogin">登录</view>
  25. <view :style="{'opacity': isShowTip}" class="loginByPWD-failTip df jcc">登录失败!请查看账号及密码是否正确!</view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. account: '',
  34. password: '',
  35. regURL: 'http://www.ilab-x.com/register',
  36. //是否显示登录失败的提示 1显示0隐藏(即:透明度归零)
  37. isShowTip: 0,
  38. }
  39. },
  40. methods: {
  41. onAccountInput: function(event) {
  42. this.account = event.target.value
  43. },
  44. onPWDInput: function(event) {
  45. this.password = event.target.value
  46. },
  47. inputFocus() {
  48. this.isShowTip = 0;
  49. },
  50. onLogin() {
  51. // console.log("账号密码", this.account, this.password);
  52. uni.request({
  53. header: {
  54. // 'Content-Type': 'application/x-www-form-urlencoded'
  55. 'Content-Type': 'application/json;charset=UTF-8'
  56. },
  57. url: mydata_api+"/user/loginin",
  58. method: 'POST',
  59. data: {
  60. "IlabAccount": this.account,
  61. "Password": this.password
  62. },
  63. dataType: 'json',
  64. success: (res) => {
  65. let data = res.data;
  66. //登录成功
  67. if (data.Code == 100) {
  68. console.log("登陆成功",this.account,data);
  69. mydata_userInfo.account = this.account;
  70. mydata_userInfo.userID=data.UserID;
  71. mydata_userInfo.type=data.Type;
  72. // console.log("登陆以后的用户信息",mydata_userInfo);
  73. this.$emit("onLogin");
  74. }
  75. //密码错误
  76. else {
  77. this.isShowTip = 1;
  78. }
  79. },
  80. fail: (res) => {
  81. console.log("fail+**+*", res)
  82. }
  83. });
  84. },
  85. onForget() {
  86. this.$emit("onForget", "onForget")
  87. }
  88. }
  89. }
  90. </script>
  91. <style>
  92. .loginByPWD-listbox {
  93. margin-top: 2.vw;
  94. }
  95. .loginByPWD-inputbox {
  96. margin-top: 2.5vw;
  97. }
  98. .loginByPWD-inputbox-icon {
  99. margin-left: 0.46875vw;
  100. }
  101. .loginByPWD-inputbox-input {
  102. font-size: 1.04vw;
  103. border: none;
  104. margin-left: 1.25vw;
  105. flex-grow: 1;
  106. }
  107. .loginByPWD-line {
  108. margin-top: 0.729vw;
  109. width: 23.54vw;
  110. height: 0.104vw;
  111. background-color: #E6E6E6;
  112. }
  113. .loginByPWD-tip1box {
  114. margin-top: 1.354vw;
  115. }
  116. .loginByPWD-tip1box-checkbox {
  117. margin-left: 0.46875vw;
  118. }
  119. .loginByPWD-tip1box-tip {
  120. font-size: 0.781vw;
  121. margin-left: 1.146vw;
  122. color: #333333;
  123. }
  124. .loginByPWD-tip2box {
  125. font-size: 0.781vw;
  126. font-family: MicrosoftYaHei;
  127. color: #333333;
  128. line-height: 1.041vw;
  129. margin-top: 2.656vw;
  130. }
  131. .loginByPWD-tip2box-account {
  132. margin-left: 0.104vw;
  133. }
  134. .loginByPWD-tip2box-pwd {
  135. margin-left: 2.031vw;
  136. }
  137. .loginByPWD-loginbtn {
  138. height: 3.125vw;
  139. font-size: 0.989vw;
  140. font-family: MicrosoftYaHei;
  141. line-height: 1.302vw;
  142. margin-top: 2.083vw;
  143. border-radius: 8px;
  144. }
  145. .loginByPWD-registerOrForgetBox {
  146. margin-top: 1.562vw;
  147. font-size: 0.781vw;
  148. font-family: MicrosoftYaHei;
  149. color: #EA252C;
  150. line-height: 1.041vw;
  151. }
  152. .loginByPWD-register {
  153. margin-left: 0.104vw;
  154. }
  155. .loginByPWD-forget {
  156. margin-left: 13.906vw;
  157. }
  158. .loginByPWD-failTip {
  159. color: #EA252C;
  160. font-size: 0.989vw;
  161. margin-top: 1vw;
  162. }
  163. </style>