App.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <script>
  2. import Cookies from 'js-cookie'
  3. import {setToken} from '@/util'
  4. import {useSensors} from "@/util/sensors";
  5. export default {
  6. onLaunch: function () {
  7. useSensors({
  8. commonProps: {platform_type: 'H5'},
  9. settings: {},
  10. });
  11. setToken().then(() => {
  12. uni.$u.http.get('/api/blade-token/currentUser').then(res => {
  13. let {instType} = res.detail
  14. let userInfo = res
  15. userInfo = {...userInfo, ...res.detail}
  16. let isSingle = instType === 1
  17. userInfo.isSingle = isSingle
  18. this.$store.commit('setUser', userInfo)
  19. const Yxtoken = Cookies.get('congress')
  20. const redirect = window.location.href;
  21. if (Yxtoken) {
  22. uni.redirectTo({url: isSingle ? '/pages/home/me' : '/pages/home/home'});
  23. } else {
  24. // 跳转到iam 用户端登陆
  25. window.location.href = `${window._CONFIG.VUE_APP_BASE_URLS}/account/#/login?redirect=${redirect}`;
  26. }
  27. })
  28. })
  29. },
  30. onShow: function () {
  31. },
  32. onHide: function () {
  33. }
  34. }
  35. </script>
  36. <style lang="scss">
  37. /*每个页面公共css */
  38. @import "@/uni_modules/uview-ui/index.scss";
  39. @import "common/demo.scss";
  40. @import "common/tool.css";
  41. @import "common/home.scss";
  42. page {
  43. background-color: #f6f6f6;
  44. }
  45. .iframe {
  46. width: 100%;
  47. height: calc(100% - 176rpx);
  48. }
  49. .u-picker {
  50. .u-picker__view__column__item {
  51. font-weight: 500 !important;
  52. }
  53. }
  54. </style>