App.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <script>
  2. import {
  3. login
  4. } from '@/api/user.js'
  5. import md5 from 'js-md5'
  6. export default {
  7. onLaunch: function(options) {
  8. if(options && options.query && options.query.user){
  9. this.getUserInfo({
  10. smsCode: "",
  11. captchaKey: "",
  12. captchaValue: "",
  13. username: options.query.user,
  14. password: "",
  15. mark: ""
  16. }).then(res => {
  17. if(this.loginCallBack){
  18. this.loginCallBack()
  19. }
  20. })
  21. }
  22. },
  23. onShow: function() {
  24. },
  25. onHide: function() {
  26. },
  27. methods: {
  28. getUserInfo(params) {
  29. return new Promise((resolve, reject) => {
  30. login({
  31. ...params,
  32. mark: md5(params.username + 'gdnxfdexam321')
  33. }).then(res => {
  34. // 保存本地token
  35. uni.setStorageSync('token', res.token);
  36. resolve(res)
  37. }).catch(err => {
  38. reject(err)
  39. })
  40. })
  41. }
  42. }
  43. }
  44. </script>
  45. <style lang="scss">
  46. /* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */
  47. @import './style/uni.css';
  48. /* 考试相关样式 */
  49. @import './style/style.css';
  50. /* 重写样式 */
  51. .uni-load-more__text {
  52. font-size: 14px !important;
  53. }
  54. .page-box {
  55. padding: 20px;
  56. font-size: 14px;
  57. display: flex;
  58. flex-direction: column;
  59. height: 100vh;
  60. }
  61. </style>