浏览代码

fix(merchant): 调整首页和登录页的导航逻辑

EvilDragon 5 月之前
父节点
当前提交
3b87dd3bc4

+ 7 - 6
packages/merchant/src/pages.json

@@ -51,12 +51,11 @@
   },
   "pages": [
     {
-      "path": "pages/home/index",
+      "path": "pages/login/index",
       "type": "home",
-      "layout": "tabbar",
       "style": {
-        "navigationStyle": "custom",
-        "navigationBarTitleText": "首页"
+        "navigationBarTitleText": "",
+        "navigationBarBackgroundColor": "#ffffff"
       }
     },
     {
@@ -84,10 +83,12 @@
       }
     },
     {
-      "path": "pages/login/index",
+      "path": "pages/home/index",
       "type": "page",
+      "layout": "tabbar",
       "style": {
-        "navigationBarTitleText": "登录"
+        "navigationStyle": "custom",
+        "navigationBarTitleText": "首页"
       }
     },
     {

+ 1 - 4
packages/merchant/src/pages/home/index.vue

@@ -1,4 +1,4 @@
-<route lang="json5" type="home">
+<route lang="json5">
 {
   layout: 'tabbar',
   style: {
@@ -105,9 +105,6 @@ onShow(async () => {
 })
 onLoad(() => {
   console.log(isLogined.value)
-  if (!isLogined.value) {
-    uni.navigateTo({ url: '/pages/login/index' })
-  }
 })
 onShareAppMessage(() => ({}))
 </script>

+ 29 - 22
packages/merchant/src/pages/login/index.vue

@@ -1,13 +1,16 @@
-<route lang="yaml">
+<route lang="yaml" type="home">
 style:
-  navigationBarTitleText: 登录
+  navigationBarTitleText: ''
+  navigationBarBackgroundColor: '#ffffff'
 </route>
 <script lang="ts" setup>
+import { storeToRefs } from 'pinia'
 import { login } from '../../core/libs/requests'
 import { useUserStore } from '../../store'
 import { loginAccountIcon, loginPswIcon } from '@designer-hub/assets/src/svgs'
 
 const userStore = useUserStore()
+const { isLogined } = storeToRefs(userStore)
 const { setUserInfo } = userStore
 const formData = ref({
   mobile: '',
@@ -26,6 +29,11 @@ const handleLogin = async () => {
     uni.reLaunch({ url: '/pages/home/index' })
   }
 }
+onLoad(() => {
+  if (isLogined.value) {
+    uni.reLaunch({ url: '/pages/home/index' })
+  }
+})
 </script>
 <template>
   <div class="flex-grow flex flex-col items-center justify-start px-7.5 bg-[#ffffff] pt-[100px]">
@@ -35,14 +43,26 @@ const handleLogin = async () => {
         欢迎来到筑巢荟
       </div>
     </div>
-    <div class="w-full form">
-      <div class="bg-[#F6F6F6] item mb-[10px] flex items-center">
-        <wd-img :src="loginAccountIcon" mode="widthFix" width="19px" class="mr-[16px]" />
-        <wd-input type="number" placeholder="请输入手机号" v-model="formData.mobile" />
+    <div class="w-full flex flex-col gap-6.5">
+      <div class="bg-[#F6F6F6] flex items-center h-12.5 px-5 rounded-full gap-4">
+        <wd-img :src="loginAccountIcon" mode="widthFix" width="19" />
+        <wd-input
+          no-border
+          type="number"
+          placeholder="请输入手机号"
+          v-model="formData.mobile"
+          custom-class="bg-transparent!"
+        />
       </div>
-      <div class="bg-[#F6F6F6] item flex items-center">
-        <wd-img :src="loginPswIcon" mode="widthFix" width="19px" class="mr-[16px]" />
-        <wd-input type="number" placeholder="请输入密码" v-model="formData.password" />
+      <div class="bg-[#F6F6F6] flex items-center h-12.5 px-5 rounded-full gap-4">
+        <wd-img :src="loginPswIcon" mode="widthFix" width="19" />
+        <wd-input
+          no-border
+          type="number"
+          placeholder="请输入密码"
+          v-model="formData.password"
+          custom-class="flex-1 bg-transparent!"
+        />
       </div>
     </div>
     <div class="w-full flex items-center justify-between mt-[19px]">
@@ -67,17 +87,4 @@ const handleLogin = async () => {
 .title {
   width: 100%;
 }
-.form {
-  .item {
-    // height: 50px;
-    padding: 10px;
-    border-radius: 10px;
-    :deep(.wd-input) {
-      width: 100%;
-      height: 100%;
-      background: transparent;
-      border: none;
-    }
-  }
-}
 </style>

+ 2 - 2
packages/merchant/src/types/uni-pages.d.ts

@@ -4,11 +4,11 @@
 // Generated by vite-plugin-uni-pages
 
 interface NavigateToOptions {
-  url: "/pages/home/index" |
+  url: "/pages/login/index" |
        "/pages/designer/detail" |
        "/pages/designer/homepage" |
        "/pages/designer/index" |
-       "/pages/login/index" |
+       "/pages/home/index" |
        "/pages/mine/index" |
        "/pages/scan_code/index" |
        "/pages/scan_code/merchant_settings" |