App.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <script>
  2. import Vue from 'vue'
  3. export default {
  4. onLaunch: function(options) {
  5. uni.getSystemInfo({
  6. success: function(e) {
  7. // #ifndef MP
  8. Vue.prototype.StatusBar = e.statusBarHeight;
  9. if (e.platform == 'android') {
  10. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  11. } else {
  12. Vue.prototype.CustomBar = e.statusBarHeight + 45;
  13. };
  14. // #endif
  15. // #ifdef MP-WEIXIN
  16. Vue.prototype.StatusBar = e.statusBarHeight;
  17. let custom = wx.getMenuButtonBoundingClientRect();
  18. Vue.prototype.Custom = custom;
  19. Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
  20. // #endif
  21. // #ifdef MP-ALIPAY
  22. Vue.prototype.StatusBar = e.statusBarHeight;
  23. Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
  24. // #endif
  25. }
  26. });
  27. var param = {
  28. 'phone':options.query.phone,
  29. 'token':options.query.tonken
  30. }
  31. this.tokenLogin(param)
  32. },
  33. onShow: function() {
  34. console.log('App Show')
  35. },
  36. onHide: function() {
  37. console.log('App Hide')
  38. },
  39. methods: {
  40. tokenLogin(param){
  41. console.log(param)
  42. this.$u.api.tokenLogin(param).then(res => {
  43. if (res.code === 200) {
  44. //登录成功,跳转首页
  45. console.log(res)
  46. uni.setStorageSync("userInfo", res.data)
  47. } else {
  48. this.$api.msg(res.msg);
  49. }
  50. })
  51. }
  52. }
  53. }
  54. </script>
  55. <style>
  56. @import "colorui/main.css";
  57. @import "colorui/icon.css";
  58. @import "common/common.scss";
  59. @import "uview-ui/index.scss";
  60. /* @import "uview-ui/index.scss"; */
  61. /*每个页面公共css */
  62. </style>