Kaynağa Gözat

fix(merchant): 优化Tabbar组件并添加用户类型判断

EvilDragon 5 ay önce
ebeveyn
işleme
394e46fb40

+ 1 - 1
packages/app/src/components/data-form.vue

@@ -2,7 +2,7 @@
 import WdButton from 'wot-design-uni/components/wd-button/wd-button.vue'
 import WdInput from 'wot-design-uni/components/wd-input/wd-input.vue'
 import WdPicker from 'wot-design-uni/components/wd-picker/wd-picker.vue'
-import {} from 'vue'
+import {ref} from 'vue'
 
 const modelValue = defineModel({
   type: Object,

+ 2 - 0
packages/assets/src/assets/svgs/addBlue.ts

@@ -0,0 +1,2 @@
+import addBlue from "./add_blue.svg";
+export default addBlue;

+ 4 - 0
packages/assets/src/assets/svgs/add_blue.svg

@@ -0,0 +1,4 @@
+<svg width="42" height="42" viewBox="0 0 42 42" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="21" cy="21" r="21" fill="#2357E9"/>
+<path d="M19.6667 19.6667H14.3367C14.1613 19.6664 13.9877 19.7007 13.8256 19.7676C13.6635 19.8344 13.5162 19.9326 13.3921 20.0564C13.268 20.1802 13.1694 20.3273 13.1022 20.4892C13.0349 20.6511 13.0002 20.8247 13 21C13 21.7413 13.5987 22.3333 14.3367 22.3333H19.6667V27.6633C19.6667 28.402 20.2633 29 21 29C21.7413 29 22.3333 28.4013 22.3333 27.6633V22.3333H27.6633C27.8387 22.3336 28.0123 22.2993 28.1744 22.2324C28.3365 22.1656 28.4838 22.0674 28.6079 21.9436C28.732 21.8198 28.8306 21.6727 28.8978 21.5108C28.9651 21.3489 28.9998 21.1753 29 21C29 20.2587 28.4013 19.6667 27.6633 19.6667H22.3333V14.3367C22.3336 14.1613 22.2993 13.9877 22.2324 13.8256C22.1656 13.6635 22.0674 13.5162 21.9436 13.3921C21.8198 13.268 21.6727 13.1694 21.5108 13.1022C21.3489 13.0349 21.1753 13.0002 21 13C20.2587 13 19.6667 13.5987 19.6667 14.3367V19.6667Z" fill="white"/>
+</svg>

+ 2 - 0
packages/assets/src/assets/svgs/channelTabbarHome.ts

@@ -0,0 +1,2 @@
+import channelTabbarHome from "./channel_tabbar_home.svg";
+export default channelTabbarHome;

+ 2 - 0
packages/assets/src/assets/svgs/channelTabbarHomeActive.ts

@@ -0,0 +1,2 @@
+import channelTabbarHomeActive from "./channel_tabbar_home_active.svg";
+export default channelTabbarHomeActive;

+ 2 - 0
packages/assets/src/assets/svgs/channelTabbarMine.ts

@@ -0,0 +1,2 @@
+import channelTabbarMine from "./channel_tabbar_mine.svg";
+export default channelTabbarMine;

+ 2 - 0
packages/assets/src/assets/svgs/channelTabbarMineActive.ts

@@ -0,0 +1,2 @@
+import channelTabbarMineActive from "./channel_tabbar_mine_active.svg";
+export default channelTabbarMineActive;

+ 5 - 0
packages/assets/src/assets/svgs/channel_tabbar_home.svg

@@ -0,0 +1,5 @@
+<svg width="19" height="19" viewBox="0 0 19 19" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M0.75 3C0.75 2.0335 1.5335 1.25 2.5 1.25H16.5C17.4665 1.25 18.25 2.0335 18.25 3V12.4329C18.25 13.3994 17.4665 14.1829 16.5 14.1829H2.5C1.5335 14.1829 0.75 13.3994 0.75 12.4329V3Z" stroke="#C1C4D9" stroke-width="1.5"/>
+<path d="M3 17.875H16" stroke="#C1C4D9" stroke-width="1.5" stroke-linecap="round"/>
+<path d="M3.125 9.125L7.5 6L11.25 9.125L15.625 5.375" stroke="#C1C4D9" stroke-opacity="0.5" stroke-width="1.25" stroke-linecap="round"/>
+</svg>

+ 6 - 0
packages/assets/src/assets/svgs/channel_tabbar_home_active.svg

@@ -0,0 +1,6 @@
+<svg width="19" height="19" viewBox="0 0 19 19" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M0.75 3C0.75 2.0335 1.5335 1.25 2.5 1.25H16.5C17.4665 1.25 18.25 2.0335 18.25 3V12.4329C18.25 13.3994 17.4665 14.1829 16.5 14.1829H2.5C1.5335 14.1829 0.75 13.3994 0.75 12.4329V3Z" stroke="#2357E9" stroke-width="1.5"/>
+<rect x="1" y="4" width="14" height="10" rx="1.5" fill="#2357E9" fill-opacity="0.1"/>
+<path d="M3 17.875H16" stroke="#2357E9" stroke-width="1.5" stroke-linecap="round"/>
+<path d="M3.125 9.125L7.5 6L11.25 9.125L15.625 5.375" stroke="#2357E9" stroke-opacity="0.5" stroke-width="1.25" stroke-linecap="round"/>
+</svg>

+ 5 - 0
packages/assets/src/assets/svgs/channel_tabbar_mine.svg

@@ -0,0 +1,5 @@
+<svg width="22" height="21" viewBox="0 0 22 21" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M11 12.5V16.9541" stroke="#C1C4D9" stroke-opacity="0.5" stroke-width="1.25" stroke-linecap="round"/>
+<path d="M14.75 4.50022C14.75 6.57129 13.0711 8.25022 11 8.25022C8.92893 8.25022 7.25 6.57129 7.25 4.50022C7.25 2.42915 8.92893 0.750222 11 0.750222C13.0711 0.750222 14.75 2.42915 14.75 4.50022Z" stroke="#C1C4D9" stroke-width="1.5"/>
+<path d="M8.99992 10.6501C8.41168 10.6505 7.07386 10.3348 6.33325 10.6501C3.28308 11.9488 1.47337 14.3339 1.08095 17.8193C0.988259 18.6426 1.67162 19.3168 2.50005 19.3168C7.17868 19.3168 10.9999 19.3168 10.9999 19.3168C10.9999 19.3168 15.2621 19.3168 19.4999 19.3168C20.3284 19.3168 21.0116 18.6426 20.9189 17.8193C20.5265 14.3338 18.7168 11.9481 15.6666 10.6494C14.926 10.3341 13.4632 10.6505 12.875 10.6501" stroke="#C1C4D9" stroke-width="1.5" stroke-linecap="round"/>
+</svg>

+ 6 - 0
packages/assets/src/assets/svgs/channel_tabbar_mine_active.svg

@@ -0,0 +1,6 @@
+<svg width="22" height="21" viewBox="0 0 22 21" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M11 12.5V16.9541" stroke="#2357E9" stroke-opacity="0.5" stroke-width="1.25" stroke-linecap="round"/>
+<path d="M14.75 4.50022C14.75 6.57129 13.0711 8.25022 11 8.25022C8.92893 8.25022 7.25 6.57129 7.25 4.50022C7.25 2.42915 8.92893 0.750222 11 0.750222C13.0711 0.750222 14.75 2.42915 14.75 4.50022Z" stroke="#2357E9" stroke-width="1.5"/>
+<path d="M12 19H19.5C20.3284 19 21.0205 18.3229 20.9046 17.5026C20.5089 14.7038 18.8911 13.7591 16.2 12.578C15.3432 12.2019 12.7718 12 12 12C11.0575 12 8.48605 12.2773 7.8 12.5786C5.10935 13.7605 3.49122 14.7042 3.09547 17.5026C2.97947 18.3229 3.67226 19 4.50069 19H12Z" fill="#2357E9" fill-opacity="0.1"/>
+<path d="M8.99992 10.6501C8.41168 10.6505 7.07386 10.3348 6.33325 10.6501C3.28308 11.9488 1.47337 14.3339 1.08095 17.8193C0.988259 18.6426 1.67162 19.3168 2.50005 19.3168C7.17868 19.3168 10.9999 19.3168 10.9999 19.3168C10.9999 19.3168 15.2621 19.3168 19.4999 19.3168C20.3284 19.3168 21.0116 18.6426 20.9189 17.8193C20.5265 14.3338 18.7168 11.9481 15.6666 10.6494C14.926 10.3341 13.4632 10.6505 12.875 10.6501" stroke="#2357E9" stroke-width="1.5" stroke-linecap="round"/>
+</svg>

+ 13 - 0
packages/assets/src/assets/svgs/index.ts

@@ -0,0 +1,13 @@
+import channelTabbarHome from "./channelTabbarHome";
+import channelTabbarMine from "./channelTabbarMine";
+import channelTabbarHomeActive from "./channelTabbarHomeActive";
+import channelTabbarMineActive from "./channelTabbarMineActive";
+import addBlue from "./addBlue";
+
+export {
+  addBlue,
+  channelTabbarMine,
+  channelTabbarMineActive,
+  channelTabbarHome,
+  channelTabbarHomeActive,
+};

+ 1 - 0
packages/assets/src/index.ts

@@ -1,4 +1,5 @@
 export * from "./svgs";
+export * from "./assets/svgs";
 
 export const getAssets = (path: string) => {
   const fullPath = `/src/assets/${path}`;

+ 52 - 64
packages/merchant/src/layouts/tabbar.vue

@@ -1,32 +1,61 @@
 <script setup lang="ts">
 import TabbarEvo from '@/components/tabbar-evo.vue'
-import { home, homeActive, mine, mineActive, publish } from '../core/libs/svgs'
 import { currRoute } from '../utils'
 import { defaultThemeVars } from '../core/themes/default'
 import DataForm from '@designer-hub/app/src/components/data-form.vue'
+import { useUserStore } from '../store'
+import { storeToRefs } from 'pinia'
+import {
+  addBlue,
+  channelTabbarHome,
+  channelTabbarHomeActive,
+  channelTabbarMine,
+  channelTabbarMineActive,
+} from '@designer-hub/assets/src'
 
+const userStore = useUserStore()
+const { userInfo, isChannel, isMerchant } = storeToRefs(userStore)
 const publishState = ref(false)
-const items = [
-  {
-    title: '首页',
-    iconPath: home,
-    selectedIconPath: homeActive,
-    path: '/pages/home/index',
-  },
-  {
-    title: '发布',
-    iconPath: publish,
-    selectedIconPath: publish,
-    path: '/pages/publish/index',
-    hiddenTitle: true,
-  },
-  {
-    title: '我的',
-    iconPath: mine,
-    selectedIconPath: mineActive,
-    path: '/pages/mine/index',
-  },
-]
+const items = computed(() => {
+  if (isChannel.value) {
+    return [
+      {
+        title: '首页',
+        iconPath: channelTabbarHome,
+        selectedIconPath: channelTabbarHomeActive,
+        path: '/pages/home/index',
+      },
+      {
+        title: '发布',
+        iconPath: addBlue,
+        selectedIconPath: addBlue,
+        path: '/pages/publish/index',
+        hiddenTitle: true,
+      },
+      {
+        title: '我的',
+        iconPath: channelTabbarMine,
+
+        selectedIconPath: channelTabbarMineActive,
+        path: '/pages/mine/index',
+      },
+    ]
+  }
+  return [
+    {
+      title: '首页',
+      iconPath: channelTabbarHome,
+      selectedIconPath: channelTabbarHomeActive,
+      path: '/pages/home/index',
+    },
+    {
+      title: '我的',
+      iconPath: channelTabbarMine,
+      selectedIconPath: channelTabbarMineActive,
+      path: '/pages/mine/index',
+    },
+  ]
+})
 const schema = ref({
   user: {
     type: 'TextField',
@@ -61,14 +90,7 @@ const handleTabbarItemClick = (path: string) => {
   }
   uni.switchTab({ url: path })
 }
-const toPublishMoment = () => {
-  uni.navigateTo({ url: '/pages/publish/moment/index' })
-  publishState.value = false
-}
-const toPublishCase = () => {
-  uni.navigateTo({ url: '/pages/publish/cases/index' })
-  publishState.value = false
-}
+onMounted(async () => {})
 </script>
 
 <template>
@@ -90,40 +112,6 @@ const toPublishCase = () => {
         <div><wd-button block :round="false">提交</wd-button></div>
       </view>
     </wd-action-sheet>
-    <!-- <div
-      v-if="publishState"
-      class="bg-white/80 backdrop-blur-[100px] fixed top-0 left-0 right-0 bottom-0 z-1"
-    >
-      <div class="w-full h-full flex flex-col justify-around px-7 box-border">
-        <div class="text-black/40 text-3xl font-normal font-['PingFang SC'] leading-[45px]">
-          发布记录,
-          <br />
-          成为更好的自己!
-        </div>
-        <div class="flex flex-col">
-          <div class="flex justify-around">
-            <div class="flex flex-col items-center" @click="toPublishMoment">
-              <wd-img :src="iconCamera" width="66" mode="widthFix"></wd-img>
-              <div class="text-black text-sm font-normal font-['PingFang SC'] leading-[21px]">
-                个人动态
-              </div>
-            </div>
-            <div class="flex flex-col items-center" @click="toPublishCase">
-              <wd-img :src="iconWallet" width="66" mode="widthFix"></wd-img>
-              <div class="text-black text-sm font-normal font-['PingFang SC'] leading-[21px]">
-                设计案例
-              </div>
-            </div>
-          </div>
-          <wd-button
-            custom-class="mt-15"
-            type="icon"
-            icon="close"
-            @click="publishState = false"
-          ></wd-button>
-        </div>
-      </div>
-    </div> -->
     <wd-toast />
     <wd-message-box />
   </wd-config-provider>

+ 4 - 1
packages/merchant/src/store/user.ts

@@ -20,12 +20,15 @@ export const useUserStore = defineStore(
       userInfo.value = { ...initState }
     }
     const isLogined = computed(() => !!userInfo.value.accessToken)
-
+    const isChannel = computed(() => userInfo.value.appLoginType === 1)
+    const isMerchant = computed(() => userInfo.value.appLoginType === 2)
     return {
       userInfo,
       setUserInfo,
       clearUserInfo,
       isLogined,
+      isChannel,
+      isMerchant,
       reset,
     }
   },