loginByPWD.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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. console.log("登陆成功data=",data);
  98. mydata_userInfo.Name = data.Name;
  99. mydata_userInfo.UserID = data.UserID;
  100. mydata_userInfo.Position = data.Position;
  101. mydata_userInfo.role = data.Type;
  102. // let url = this.$Api + "/user/setusertype";
  103. // console.log('url=',url)
  104. // let aData = {
  105. // "UserID" : data.UserID, //虚拟仿真用户ID
  106. // "Type":"老师"
  107. // }
  108. // console.log('data=',aData)
  109. // uni.request({
  110. // header: {
  111. // 'Content-Type': 'application/json;charset=UTF-8'
  112. // },
  113. // url: url,
  114. // method: 'POST',
  115. // data: {
  116. // "UserID" : data.UserID, //虚拟仿真用户ID
  117. // "Type":"老师"
  118. // },
  119. // dataType: 'json',
  120. // success: (res) => {
  121. // console.log("success+++**+*", res)
  122. // },
  123. // fail: (res) => {
  124. // console.log("fail+**+*", res)
  125. // }
  126. // });
  127. // console.log("登陆成功,个人信息", mydata_userInfo);
  128. if (mydata_userInfo.role == '老师') {
  129. userController.updateStudentList(null,null);
  130. }
  131. userController.updateScore();
  132. userController.updateUserInfo();
  133. MyRequest.SetUserType(mydata_userInfo.role,null,null);
  134. this.$emit("onLogin");
  135. }
  136. //密码错误
  137. else {
  138. this.isShowTip = 1;
  139. }
  140. // console.log("success+++**+*", res.data.Code)
  141. },
  142. fail: (res) => {
  143. console.log("fail+**+*", res)
  144. }
  145. });
  146. },
  147. // onLogin: function(type) {
  148. // this.$emit("onLogin", "onLogin")
  149. // },
  150. onForget() {
  151. // this.$emit("onForget", "onForget")
  152. }
  153. // test() {
  154. // this.$emit("pChangeType","哈哈哈")
  155. // let url = "http://121.4.59.141:1986/hello";
  156. // uni.request({
  157. // header: {
  158. // // 'Content-Type': 'application/x-www-form-urlencoded'
  159. // // 'Content-Type': 'application/json',
  160. // 'Content-Type': 'application/json'
  161. // },
  162. // url: url,
  163. // method: 'POST',
  164. // data: {
  165. // // "IlabAccount": "teststudent01",
  166. // // "Password": "qgsTest002"
  167. // "name": "13790516503",
  168. // "message": "qwerty123..."
  169. // // "IlabAccount": this.account,
  170. // // "Password": this.password
  171. // },
  172. // dataType: 'json',
  173. // success: (res) => {
  174. // // var result = JSON.parse(res);
  175. // console.log("success+**+*", res)
  176. // },
  177. // fail: (res) => {
  178. // console.log("fail+**+*", res)
  179. // }
  180. // });
  181. // }
  182. }
  183. }
  184. </script>
  185. <style>
  186. .loginByPWD-listbox {
  187. margin-top: 2.vw;
  188. }
  189. .loginByPWD-inputbox {
  190. margin-top: 2.5vw;
  191. }
  192. .loginByPWD-inputbox-icon {
  193. margin-left: 0.46875vw;
  194. }
  195. .loginByPWD-inputbox-input {
  196. font-size: 1.04vw;
  197. border: none;
  198. margin-left: 1.25vw;
  199. flex-grow: 1;
  200. }
  201. .loginByPWD-line {
  202. margin-top: 0.729vw;
  203. width: 23.54vw;
  204. height: 0.104vw;
  205. background-color: #E6E6E6;
  206. }
  207. .loginByPWD-tip1box {
  208. margin-top: 1.354vw;
  209. }
  210. .loginByPWD-tip1box-checkbox {
  211. margin-left: 0.46875vw;
  212. }
  213. .loginByPWD-tip1box-tip {
  214. font-size: 0.781vw;
  215. margin-left: 1.146vw;
  216. color: #333333;
  217. }
  218. .loginByPWD-tip2box {
  219. font-size: 0.781vw;
  220. font-family: MicrosoftYaHei;
  221. color: #333333;
  222. line-height: 1.041vw;
  223. margin-top: 2.656vw;
  224. }
  225. .loginByPWD-tip2box-account {
  226. margin-left: 0.104vw;
  227. }
  228. .loginByPWD-tip2box-pwd {
  229. margin-left: 2.031vw;
  230. }
  231. .loginByPWD-loginbtn {
  232. height: 3.125vw;
  233. font-size: 0.989vw;
  234. font-family: MicrosoftYaHei;
  235. line-height: 1.302vw;
  236. margin-top: 2.083vw;
  237. border-radius: 8px;
  238. }
  239. .loginByPWD-registerOrForgetBox {
  240. margin-top: 1.562vw;
  241. font-size: 0.781vw;
  242. font-family: MicrosoftYaHei;
  243. color: #EA252C;
  244. line-height: 1.041vw;
  245. }
  246. .loginByPWD-register {
  247. margin-left: 0.104vw;
  248. }
  249. .loginByPWD-forget {
  250. margin-left: 13.906vw;
  251. color: #EA252C;
  252. }
  253. .loginByPWD-failTip {
  254. color: #EA252C;
  255. font-size: 0.989vw;
  256. margin-top: 1vw;
  257. }
  258. </style>