launch.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <view class="launch-container"></view>
  3. </template>
  4. <script>
  5. export default {
  6. data(){
  7. return {
  8. }
  9. },
  10. onLoad() {
  11. if(uni.getStorageSync('token')){
  12. let url = '';
  13. let roleCodes = JSON.parse(uni.getStorageSync('userInfo'))?.roleCodes;
  14. if(roleCodes.length==0&&JSON.parse(uni.getStorageSync('userInfo'))?.status==2) return this.$showToast('当前员工已离职');
  15. if(roleCodes.length==0||!roleCodes) url = '/pagesClockin/index';
  16. else if(roleCodes.includes('Maintenance')||roleCodes.includes('Inspection')) url = '/pages/operation/index';
  17. else if(roleCodes.includes('inventory')||roleCodes.includes('Admin')||roleCodes.includes('Warehouse Manager')) url = '/pagesStorage/home';
  18. if(!url) return this.$showToast('无菜单角色,请后台查看!')
  19. uni.reLaunch({ url })
  20. return
  21. }else{
  22. uni.reLaunch({ url:'/pages/login/wxLogin' })
  23. }
  24. },
  25. methods:{
  26. }
  27. }
  28. </script>
  29. <style scoped lang="less">
  30. .launch-container {
  31. display: flex;
  32. align-items: center;
  33. justify-content: center;
  34. height: 100vh;
  35. width: 100vw;
  36. background-color: #FFFFFF;
  37. }
  38. </style>