App.vue 1.1 KB

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