loginByPWD.vue 6.3 KB

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