tabbar.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <script setup lang="ts">
  2. import TabbarEvo from '@/components/tabbar-evo.vue'
  3. import { currRoute } from '../utils'
  4. import { defaultThemeVars } from '../core/themes/default'
  5. import DataForm from '@designer-hub/app/src/components/data-form.vue'
  6. import { useUserStore } from '../store'
  7. import { storeToRefs } from 'pinia'
  8. import {
  9. addBlue,
  10. channelTabbarHome,
  11. channelTabbarHomeActive,
  12. channelTabbarMine,
  13. channelTabbarMineActive,
  14. } from '@designer-hub/assets/src/assets/svgs'
  15. const userStore = useUserStore()
  16. const { userInfo, isChannel, isMerchant } = storeToRefs(userStore)
  17. const publishState = ref(false)
  18. const items = computed(() => {
  19. if (isChannel?.value) {
  20. return [
  21. {
  22. title: '首页',
  23. iconPath: channelTabbarHome,
  24. selectedIconPath: channelTabbarHomeActive,
  25. path: '/pages/home/index',
  26. },
  27. {
  28. title: '发布',
  29. iconPath: addBlue,
  30. selectedIconPath: addBlue,
  31. path: '/pages/publish/index',
  32. // hiddenTitle: true,
  33. main: true,
  34. },
  35. {
  36. title: '我的',
  37. iconPath: channelTabbarMine,
  38. selectedIconPath: channelTabbarMineActive,
  39. path: '/pages/mine/index',
  40. },
  41. ]
  42. }
  43. return [
  44. {
  45. title: '首页',
  46. iconPath: channelTabbarHome,
  47. selectedIconPath: channelTabbarHomeActive,
  48. path: '/pages/home/index',
  49. },
  50. {
  51. title: '我的',
  52. iconPath: channelTabbarMine,
  53. selectedIconPath: channelTabbarMineActive,
  54. path: '/pages/mine/index',
  55. },
  56. ]
  57. })
  58. const schema = ref({
  59. user: {
  60. type: 'TextField',
  61. label: '设计师',
  62. },
  63. dateTime: {
  64. type: 'TextField',
  65. label: '时间',
  66. },
  67. type: {
  68. type: 'TextField',
  69. label: '类型',
  70. },
  71. remark: {
  72. type: 'TextField',
  73. label: '备注',
  74. },
  75. location: {
  76. type: 'TextField',
  77. label: '地址',
  78. },
  79. images: {
  80. type: 'ImageUploader',
  81. label: '图片',
  82. max: 9,
  83. },
  84. })
  85. const handleTabbarItemClick = (path: string) => {
  86. if (path === '/pages/publish/index') {
  87. publishState.value = true
  88. return
  89. }
  90. uni.switchTab({ url: path })
  91. }
  92. onMounted(async () => {})
  93. </script>
  94. <template>
  95. <wd-config-provider :themeVars="defaultThemeVars" custom-class="flex-grow flex flex-col">
  96. <view class="bg-[#f6f6f6] pb-20 flex-grow">
  97. <slot />
  98. </view>
  99. <TabbarEvo
  100. :items="items"
  101. fixed
  102. safeAreaInsetBottom
  103. :current-path="currRoute().path"
  104. @click="handleTabbarItemClick"
  105. />
  106. <wd-action-sheet v-model="publishState" title="创建跟进" @close="publishState = false">
  107. <view class="flex flex-col p-4">
  108. <div><DataForm :schema="schema" direction="horizontal"></DataForm></div>
  109. <div><wd-button block :round="false">提交</wd-button></div>
  110. </view>
  111. </wd-action-sheet>
  112. <wd-toast />
  113. <wd-message-box />
  114. </wd-config-provider>
  115. </template>
  116. <style lang="scss">
  117. /* stylelint-disable-next-line selector-type-no-unknown */
  118. layout-tabbar-uni {
  119. display: flex;
  120. flex-direction: column;
  121. flex-grow: 1;
  122. }
  123. </style>