launch.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <view class="content">
  3. </view>
  4. </template>
  5. <script>
  6. import { getDicts } from '@/api/common'
  7. export default {
  8. data() {
  9. return {
  10. };
  11. },
  12. onLoad() {
  13. this.getDicts()
  14. },
  15. onShow() {
  16. this.navigatHandler();
  17. },
  18. methods: {
  19. navigatHandler: function() {
  20. if (!this.$isLogin()) {
  21. setTimeout(()=>{
  22. uni.reLaunch({
  23. url: '/pages/auth/loginIndex',
  24. animationType: 'none',
  25. animationDuration: 2000
  26. })
  27. },200);
  28. // #ifdef APP-PLUS
  29. plus.navigator.closeSplashscreen();
  30. // #endif
  31. } else {
  32. if(uni.getStorageSync("openUrl")) {
  33. return
  34. }
  35. uni.reLaunch({
  36. url: '/pages/index/index',
  37. //url: '/pages_im/pages/conversation/conversationList/index',
  38. animationType: 'none',
  39. animationDuration: 2000
  40. })
  41. }
  42. },
  43. getDicts:function(){
  44. getDicts().then(
  45. res => {
  46. if(res.code==200){
  47. uni.setStorageSync('dicts',JSON.stringify(res));
  48. console.log('res',res)
  49. }
  50. },
  51. rej => {}
  52. );
  53. },
  54. },
  55. };
  56. </script>
  57. <style>
  58. page{
  59. background-color: #fff;
  60. }
  61. .content {
  62. background-color: #fff;
  63. height: 100%;
  64. width: 100%;
  65. position: relative;
  66. padding-top: 0;
  67. }
  68. </style>