index.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <Page :title="'首页'">
  3. <template v-slot:headerRight>
  4. <div @click="showModule = true">新建</div>
  5. </template>
  6. <template v-slot:body>
  7. <van-tabs v-model:active="homepageType" class="w-full h-full flex flex-col">
  8. <van-tab title="工作台" name="workbench" class="w-full h-full">
  9. <Workbench />
  10. </van-tab>
  11. <van-tab title="数据分析" name="dataAnalysis" class="w-full h-full">
  12. <DataAnalysis />
  13. </van-tab>
  14. </van-tabs>
  15. <!-- 显示对应的模块 -->
  16. <van-overlay :show="showModule" class="flex items-center" z-index="100" @click="showModule = false">
  17. <div class="w-3/4 h-3/4 m-auto flex flex-wrap items-center" @click.stop>
  18. <div class="text-white w-1/2 text-center" v-for="(item) in moduleList" :key="item.id" @click.stop="toAddEditor(item)">
  19. {{ item.name }}
  20. </div>
  21. </div>
  22. </van-overlay>
  23. </template>
  24. <template v-slot:footer>
  25. <Footer />
  26. </template>
  27. </Page>
  28. </template>
  29. <script setup>
  30. import { ref } from "vue";
  31. import { useLifecycle } from "@hooks/useCommon.js";
  32. import useInfoStore from "@store/useInfoStore"
  33. import useRouterStore from "@store/useRouterStore.js";
  34. import { routingInfos } from "@utility/generalVariables.js";
  35. import Footer from "@components/page/footer.vue";
  36. import Workbench from "./component/workbench.vue";
  37. import DataAnalysis from "./component/dataAnalysis.vue";
  38. const userInfo = useInfoStore()
  39. const router = useRouterStore()
  40. const homepageType = ref('workbench')
  41. const showModule = ref(false)
  42. const moduleList = ref(userInfo.modularList)
  43. function toAddEditor(rows) {
  44. const jumpTo = routingInfos[rows.path.replace('/', '')]
  45. router.navigateTo({
  46. pathName: 'addEditor',
  47. success: () => {
  48. router.emit('addEditorParameter', {
  49. routerInfo: JSON.stringify(jumpTo)
  50. })
  51. }
  52. })
  53. }
  54. useLifecycle({
  55. load: () => {
  56. }
  57. });
  58. </script>
  59. <style lang="scss" scoped>
  60. ::v-deep .van-tabs__content {
  61. flex: 1;
  62. overflow-y: auto;
  63. }
  64. </style>