App.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 isSingle = instType === 1
  15. this.$store.commit('setUser', {isSingle})
  16. const Yxtoken = Cookies.get('congress')
  17. const redirect = window.location.href;
  18. if (Yxtoken) {
  19. uni.redirectTo({url: isSingle ? '/pages/home/me' : '/pages/home/home'});
  20. } else {
  21. // 跳转到iam 用户端登陆
  22. window.location.href = `${window._CONFIG.VUE_APP_BASE_URLS}/account/#/login?redirect=${redirect}`;
  23. }
  24. })
  25. })
  26. },
  27. onShow: function () {
  28. },
  29. onHide: function () {
  30. }
  31. }
  32. </script>
  33. <style lang="scss">
  34. /*每个页面公共css */
  35. @import "@/uni_modules/uview-ui/index.scss";
  36. @import "common/demo.scss";
  37. @import "common/tool.css";
  38. page {
  39. background-color: #f6f6f6;
  40. }
  41. .iframe {
  42. width: 100%;
  43. height: calc(100% - 176rpx);
  44. }
  45. .u-picker {
  46. .u-picker__view__column__item {
  47. font-weight: 500 !important;
  48. }
  49. }
  50. </style>