loginByPWD.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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="df aic loginByPWD-tip1box">
  25. <view class="loginByPWD-tip1box-checkbox df aic">
  26. <img src="../../assets/login/loginIcon5.png" />
  27. </view>
  28. <view class="loginByPWD-tip1box-tip">支持使用实验空间账号登录</view>
  29. </view>
  30. <!-- 评审账号和密码 -->
  31. <view class="df loginByPWD-tip2box">
  32. <view class="loginByPWD-tip2box-account">评审账号:teststudent01</view>
  33. <view class="loginByPWD-tip2box-pwd">密码:qgsTest002</view>
  34. </view>
  35. <!-- 登录按钮 -->
  36. <view class="loginByPWD-loginbtn df jcc aic btn-hover" @click="onLogin">登录</view>
  37. <!-- 注册账号忘记密码 -->
  38. <view class="df fdr loginByPWD-registerOrForgetBox">
  39. <a :href="regURL" class="loginByPWD-register">注册实验空间账号</a>
  40. <view class="loginByPWD-forget" @click="onForget">忘记密码</view>
  41. </view>
  42. <view :style="{'opacity': isShowTip}" class="loginByPWD-failTip df jcc">登录失败!请查看账号及密码是否正确!</view>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. export default {
  48. data() {
  49. return {
  50. account: '',
  51. password: '',
  52. regURL: 'http://www.ilab-x.com/register',
  53. //是否显示登录失败的提示 1显示0隐藏(即:透明度归零)
  54. isShowTip: 0,
  55. }
  56. },
  57. methods: {
  58. onAccountInput: function(event) {
  59. this.account = event.target.value
  60. },
  61. onPWDInput: function(event) {
  62. this.password = event.target.value
  63. },
  64. inputFocus() {
  65. this.isShowTip = 0;
  66. },
  67. onLogin() {
  68. console.log("账号密码", this.account, this.password);
  69. let url = "http://39.105.166.141:8085/user/loginin";
  70. // let url = "http://39.105.166.141:8085/user/getallstudent";
  71. uni.request({
  72. header: {
  73. // 'Content-Type': 'application/x-www-form-urlencoded'
  74. 'Content-Type': 'application/json;charset=UTF-8'
  75. },
  76. url: url,
  77. method: 'POST',
  78. data: {
  79. // "IlabAccount": "teststudent01",
  80. // "Password": "qgsTest002"
  81. // "IlabAccount": "13790516503",
  82. // "Password": "qwerty123..."
  83. "IlabAccount": this.account,
  84. "Password": this.password
  85. },
  86. dataType: 'json',
  87. success: (res) => {
  88. let data = res.data;
  89. //登录成功
  90. if (data.Code == 100) {
  91. console.log("登陆成功");
  92. this.$emit("onLogin")
  93. }
  94. //密码错误
  95. else {
  96. this.isShowTip=1;
  97. }
  98. console.log("success+++**+*", res.data.Code)
  99. },
  100. fail: (res) => {
  101. console.log("fail+**+*", res)
  102. }
  103. });
  104. },
  105. // onLogin: function(type) {
  106. // this.$emit("onLogin", "onLogin")
  107. // },
  108. onForget() {
  109. this.$emit("onForget", "onForget")
  110. }
  111. // test() {
  112. // this.$emit("pChangeType","哈哈哈")
  113. // let url = "http://121.4.59.141:1986/hello";
  114. // uni.request({
  115. // header: {
  116. // // 'Content-Type': 'application/x-www-form-urlencoded'
  117. // // 'Content-Type': 'application/json',
  118. // 'Content-Type': 'application/json'
  119. // },
  120. // url: url,
  121. // method: 'POST',
  122. // data: {
  123. // // "IlabAccount": "teststudent01",
  124. // // "Password": "qgsTest002"
  125. // "name": "13790516503",
  126. // "message": "qwerty123..."
  127. // // "IlabAccount": this.account,
  128. // // "Password": this.password
  129. // },
  130. // dataType: 'json',
  131. // success: (res) => {
  132. // // var result = JSON.parse(res);
  133. // console.log("success+**+*", res)
  134. // },
  135. // fail: (res) => {
  136. // console.log("fail+**+*", res)
  137. // }
  138. // });
  139. // }
  140. }
  141. }
  142. </script>
  143. <style>
  144. .loginByPWD-listbox {
  145. margin-top: 2.vw;
  146. }
  147. .loginByPWD-inputbox {
  148. margin-top: 2.5vw;
  149. }
  150. .loginByPWD-inputbox-icon {
  151. margin-left: 0.46875vw;
  152. }
  153. .loginByPWD-inputbox-input {
  154. font-size: 1.04vw;
  155. border: none;
  156. margin-left: 1.25vw;
  157. flex-grow: 1;
  158. }
  159. .loginByPWD-line {
  160. margin-top: 0.729vw;
  161. width: 23.54vw;
  162. height: 0.104vw;
  163. background-color: #E6E6E6;
  164. }
  165. .loginByPWD-tip1box {
  166. margin-top: 1.354vw;
  167. }
  168. .loginByPWD-tip1box-checkbox {
  169. margin-left: 0.46875vw;
  170. }
  171. .loginByPWD-tip1box-tip {
  172. font-size: 0.781vw;
  173. margin-left: 1.146vw;
  174. color: #333333;
  175. }
  176. .loginByPWD-tip2box {
  177. font-size: 0.781vw;
  178. font-family: MicrosoftYaHei;
  179. color: #333333;
  180. line-height: 1.041vw;
  181. margin-top: 2.656vw;
  182. }
  183. .loginByPWD-tip2box-account {
  184. margin-left: 0.104vw;
  185. }
  186. .loginByPWD-tip2box-pwd {
  187. margin-left: 2.031vw;
  188. }
  189. .loginByPWD-loginbtn {
  190. height: 3.125vw;
  191. font-size: 0.989vw;
  192. font-family: MicrosoftYaHei;
  193. line-height: 1.302vw;
  194. margin-top: 2.083vw;
  195. border-radius: 8px;
  196. }
  197. .loginByPWD-registerOrForgetBox {
  198. margin-top: 1.562vw;
  199. font-size: 0.781vw;
  200. font-family: MicrosoftYaHei;
  201. color: #EA252C;
  202. line-height: 1.041vw;
  203. }
  204. .loginByPWD-register {
  205. margin-left: 0.104vw;
  206. }
  207. .loginByPWD-forget {
  208. margin-left: 13.906vw;
  209. }
  210. .loginByPWD-failTip {
  211. color: #EA252C;
  212. font-size: 0.989vw;
  213. margin-top: 1vw;
  214. }
  215. </style>