li.shaoyi 2 anni fa
parent
commit
e16d5e052a
25 ha cambiato i file con 263 aggiunte e 92 eliminazioni
  1. 34 12
      src/hooks/navigation/index.ts
  2. 20 5
      src/packages/mobile/App.vue
  3. 10 15
      src/packages/mobile/components/base/tabbar/index.vue
  4. 2 0
      src/packages/mobile/components/layouts/index.ts
  5. 23 0
      src/packages/mobile/components/layouts/navback/index.less
  6. 26 2
      src/packages/mobile/components/layouts/navback/index.vue
  7. 1 6
      src/packages/mobile/components/layouts/navbar/index.vue
  8. 25 0
      src/packages/mobile/components/modules/quick-login/index.vue
  9. 3 8
      src/packages/mobile/router/animateRouter.ts
  10. 45 0
      src/packages/mobile/router/index.ts
  11. 2 1
      src/packages/mobile/views/bank/sign/index.vue
  12. 22 9
      src/packages/mobile/views/home/index.vue
  13. 2 1
      src/packages/mobile/views/mine/address/components/edit/index.vue
  14. 2 1
      src/packages/mobile/views/mine/generalize/components/promotion/index.vue
  15. 2 1
      src/packages/mobile/views/mine/invoice/components/edit/index.vue
  16. 6 3
      src/packages/mobile/views/mine/main/index.vue
  17. 8 4
      src/packages/mobile/views/mine/order/detail/purchasetrade/index.vue
  18. 2 1
      src/packages/mobile/views/mine/order/detail/transfer/index.vue
  19. 2 1
      src/packages/mobile/views/mine/order/detail/wrorder/index.vue
  20. 2 1
      src/packages/mobile/views/purchase/detail/index.vue
  21. 6 0
      src/packages/mobile/views/user/login/index.less
  22. 6 12
      src/packages/mobile/views/user/login/index.vue
  23. 2 1
      src/packages/mobile/views/user/logoff/index.vue
  24. 3 3
      src/packages/pc/views/auth/login/index.vue
  25. 7 5
      src/utils/vant/index.ts

+ 34 - 12
src/hooks/navigation/index.ts

@@ -10,6 +10,12 @@ export function useNavigation() {
         sessionStorage.setItem('globalUrlParams', JSON.stringify(params))
     }
 
+    // 是否有历史页面
+    const hasHistory = () => {
+        const { state } = animateRouter
+        return state.history.length > 1
+    }
+
     // 获取全局Url参数(只能获取一次)
     const getGlobalUrlParams = () => {
         const params = sessionStorage.getItem('globalUrlParams')
@@ -37,19 +43,34 @@ export function useNavigation() {
     }
 
     // 返回指定页面
-    const backTo = <T extends object>(name: string, params?: T) => {
+    // const backTo = <T extends object>(name: string, params?: T) => {
+    //     const { state } = animateRouter
+    //     const total = state.history.length - 1
+    //     const index = state.history.findIndex(((e) => e.name === name))
+
+    //     if (total > -1) {
+    //         if (index > -1) {
+    //             setGlobalUrlParams(params ?? {})
+    //             const delta = total - index
+    //             if (delta > 0) {
+    //                 router.go(-delta)
+    //             } else {
+    //                 router.replace({ name })
+    //             }
+    //         }
+    //     } else {
+    //         router.replace({ name })
+    //     }
+    // }
+
+    // 返回主页
+    const backHomePage = <T extends object>(params?: T) => {
         const { state } = animateRouter
-        const total = state.history.length - 1
-        const index = state.history.findIndex(((e) => e.name === name))
+        const routeHistory = state.history.length - 1
 
-        if (index > -1) {
-            setGlobalUrlParams(params ?? {})
-            const delta = total - index
-            if (delta > 0) {
-                router.go(-delta)
-            } else {
-                router.replace({ name })
-            }
+        setGlobalUrlParams(params ?? {})
+        if (routeHistory) {
+            router.go(-routeHistory)
         }
     }
 
@@ -78,11 +99,12 @@ export function useNavigation() {
     return {
         route,
         router,
+        hasHistory,
         setGlobalUrlParams,
         getGlobalUrlParams,
         getQueryString,
         getQueryStringToNumber,
-        backTo,
+        backHomePage,
         routerBack,
         routerTo,
         beforeRouteLeave,

+ 20 - 5
src/packages/mobile/App.vue

@@ -1,23 +1,38 @@
 <template>
-  <router-view />
+  <router-view v-if="isRouterAlive" />
 </template>
 
 <script lang="ts" setup>
-import { useRouter } from 'vue-router'
+import { shallowRef, nextTick } from 'vue'
+import { useNavigation } from '@/hooks/navigation'
 import { dialog } from '@/utils/vant'
 import { useAuth } from '@/business/auth'
 import eventBus from '@/services/bus'
 
 const { logout } = useAuth()
-const router = useRouter()
+const { backHomePage } = useNavigation()
+const isRouterAlive = shallowRef(true) // 用于页面重新渲染
+
+const quit = (showLogin = false) => {
+  isRouterAlive.value = false
+  backHomePage({ tabName: 'home', showLogin })
+  nextTick(() => {
+    isRouterAlive.value = true
+  })
+}
 
 // 接收用户登出通知
 eventBus.$on('LogoutNotify', (msg) => {
   logout(() => {
     if (msg) {
-      dialog(msg as string)
+      dialog({
+        message: msg as string,
+      }).then(() => {
+        quit(true)
+      })
+    } else {
+      quit()
     }
-    router.replace({ name: 'UserLogin' })
   })
 })
 </script>

+ 10 - 15
src/packages/mobile/components/base/tabbar/index.vue

@@ -2,20 +2,20 @@
   <div class="app-tabbar">
     <div class="app-tabbar__wrapper" :style="styles">
       <template v-for="(item, index) in dataList" :key="index">
-        <div :class="['app-tabbar__item', 'app-tabbar__item--' + item.name, selectedIndex === index && 'is-active']"
-          @click="onChange(index)">
+        <div :class="['app-tabbar__item', 'app-tabbar__item--' + item.name, dataIndex === index && 'is-active']"
+          @click="onClick(index)">
           <slot :item="item" :index="index">
             <!--判断是否图片图标-->
             <template v-if="item.iconType === 'image'">
-              <div :class="['g-icon', selectedIndex === index && 'active']">
-                <img :src="item.activeIcon" v-if="selectedIndex === index" />
+              <div :class="['g-icon', dataIndex === index && 'active']">
+                <img :src="item.activeIcon" v-if="dataIndex === index" />
                 <img :src="item.icon" v-else />
                 <span>{{ item.label }}</span>
               </div>
             </template>
             <template v-else>
               <app-iconfont label-direction="bottom" :icon="item.icon" :active-icon="item.activeIcon"
-                :active="selectedIndex === index">{{ item.label }}</app-iconfont>
+                :active="dataIndex === index">{{ item.label }}</app-iconfont>
             </template>
           </slot>
         </div>
@@ -25,12 +25,12 @@
 </template>
 
 <script lang="ts" setup>
-import { PropType, ref, watch, computed } from 'vue'
+import { PropType, computed } from 'vue'
 import { Tabbar } from './interface'
 import client from '@/utils/client'
 import AppIconfont from '@mobile/components/base/iconfont/index.vue'
 
-const emit = defineEmits(['change', 'update:dataIndex'])
+const emit = defineEmits(['click'])
 
 const props = defineProps({
   // 数据列表
@@ -51,22 +51,17 @@ const props = defineProps({
 })
 
 const { state } = client
-const selectedIndex = ref(props.dataIndex)
 
 const styles = computed(() => ({
   position: props.fixed ? 'fixed' : 'static',
   width: state.clientWidth + 'px',
 }))
 
-const onChange = (index: number) => {
-  if (selectedIndex.value !== index) {
-    selectedIndex.value = index
-    emit('update:dataIndex', index)
-    emit('change', props.dataList[index], index)
+const onClick = (index: number) => {
+  if (props.dataIndex !== index) {
+    emit('click', props.dataList[index], index)
   }
 }
-
-watch(() => props.dataIndex, (val) => onChange(val))
 </script>
 
 <style lang="less" scoped>

+ 2 - 0
src/packages/mobile/components/layouts/index.ts

@@ -3,6 +3,7 @@ import AppPage from './page/index.vue'
 import AppView from './view/index.vue'
 import AppScrollView from './scroll-view/index.vue'
 import AppStatusbar from './statusbar/index.vue'
+import AppNavback from './navback/index.vue'
 import AppNavbar from './navbar/index.vue'
 import AppFooter from './footer/index.vue'
 import AppBlock from './block/index.vue'
@@ -13,6 +14,7 @@ const components = {
     AppFooter,
     AppScrollView,
     AppStatusbar,
+    AppNavback,
     AppNavbar,
     AppBlock,
 }

+ 23 - 0
src/packages/mobile/components/layouts/navback/index.less

@@ -0,0 +1,23 @@
+.app-navback {
+    position: fixed;
+    left: 0;
+    top: 0;
+    z-index: 1;
+    display: inline-flex;
+
+    &:empty {
+        display: none;
+    }
+
+    >.van-icon {
+        display: inline-flex;
+        align-items: center;
+        justify-content: center;
+        height: var(--navbar-height);
+        line-height: 1;
+        font-size: .36rem;
+        color: var(--navbar-backbutton-color);
+        cursor: pointer;
+        padding: 0 .28rem;
+    }
+}

+ 26 - 2
src/packages/mobile/components/layouts/navback/index.vue

@@ -1,6 +1,30 @@
 <template>
-    <div></div>
+    <app-statusbar class="app-navback" @click="goback">
+        <slot>
+            <Icon name="arrow-left" />
+        </slot>
+    </app-statusbar>
 </template>
 
 <script lang="ts" setup>
-</script>
+import { useAttrs } from 'vue'
+import { useRouter } from 'vue-router'
+import { Icon } from 'vant'
+
+const emit = defineEmits<{ (event: string, ...args: unknown[]): void }>()
+const router = useRouter()
+const attrs = useAttrs()
+
+// 返回按钮事件
+const goback = () => {
+    if (attrs.onBack) {
+        emit('back')
+    } else {
+        router.go(-1)
+    }
+}
+</script>
+
+<style lang="less">
+@import './index.less';
+</style>

+ 1 - 6
src/packages/mobile/components/layouts/navbar/index.vue

@@ -1,10 +1,6 @@
 <template>
   <div class="app-navbar" :style="styles">
-    <app-statusbar class="app-navbar__backbutton">
-      <slot name="backbutton">
-        <Icon name="arrow-left" @click="goback" v-if="showBackButton" />
-      </slot>
-    </app-statusbar>
+    <app-navback class="app-navbar__backbutton" @back="goback" v-if="showBackButton" />
     <app-statusbar class="app-navbar__wrapper" @ready="onReady">
       <div class="app-navbar__header">
         <div class="column column--left">
@@ -35,7 +31,6 @@
 <script lang="ts" setup>
 import { useAttrs, computed } from 'vue'
 import { useRouter } from 'vue-router'
-import { Icon } from 'vant'
 import client from '@/utils/client'
 
 const emit = defineEmits<{ (event: string, ...args: unknown[]): void }>()

+ 25 - 0
src/packages/mobile/components/modules/quick-login/index.vue

@@ -0,0 +1,25 @@
+<template>
+    <app-modal direction="right" height="100%" v-model:show="showModal">
+        <app-login />
+    </app-modal>
+</template>
+
+<script lang="ts" setup>
+import { computed } from 'vue'
+import AppModal from '@/components/base/modal/index.vue'
+import AppLogin from '@mobile/views/user/login/index.vue'
+
+const props = defineProps({
+    show: {
+        type: Boolean,
+        default: false
+    }
+})
+
+const emit = defineEmits(['update:show'])
+
+const showModal = computed({
+    get: () => props.show,
+    set: (val) => emit('update:show', val)
+})
+</script>

+ 3 - 8
src/packages/mobile/router/animateRouter.ts

@@ -109,7 +109,7 @@ export default new (class {
             // 倒序查找路由所在的位置
             const index = (() => {
                 for (let i = history.value.length - 1; i >= 0; i--) {
-                    if (history.value[i].fullPath == route.fullPath) {
+                    if (history.value[i].fullPath === route.fullPath) {
                         return i;
                     }
                 }
@@ -131,14 +131,9 @@ export default new (class {
                     transitionName.value = 'route-out'; //后退动画
                 }
             } else {
-                // 忽略重定向的页面
-                if (route.redirectedFrom) {
+                history.value.push(route);
+                if (history.value.length > 1) {
                     transitionName.value = 'route-in'; // 前进动画
-                } else {
-                    history.value.push(route);
-                    if (history.value.length > 1) {
-                        transitionName.value = 'route-in'; // 前进动画
-                    }
                 }
             }
         }

+ 45 - 0
src/packages/mobile/router/index.ts

@@ -101,11 +101,17 @@ const routes: Array<RouteRecordRaw> = [
         path: "details",
         name: "news-details",
         component: () => import("../views/news/details/index.vue"),
+        meta: {
+          ignoreAuth: true,
+        },
       },
       {
         path: "list",
         name: "news-list",
         component: () => import("../views/news/list/index.vue"),
+        meta: {
+          ignoreAuth: true,
+        },
       },
     ],
   },
@@ -284,16 +290,25 @@ const routes: Array<RouteRecordRaw> = [
         path: "ptgz",
         name: "rules-ptgz",
         component: () => import("../views/rules/ptgz/index.vue"),
+        meta: {
+          ignoreAuth: true,
+        },
       },
       {
         path: "myrz",
         name: "rules-myrz",
         component: () => import("../views/rules/myrz/index.vue"),
+        meta: {
+          ignoreAuth: true,
+        },
       },
       {
         path: "ccwl",
         name: "rules-ccwl",
         component: () => import("../views/rules/ccwl/index.vue"),
+        meta: {
+          ignoreAuth: true,
+        },
       },
       {
         path: "zcxy",
@@ -323,46 +338,73 @@ const routes: Array<RouteRecordRaw> = [
         path: "gywm",
         name: "rules-gywm",
         component: () => import("../views/rules/gywm/index.vue"),
+        meta: {
+          ignoreAuth: true,
+        },
       },
       {
         path: "fpsm",
         name: "rules-fpsm",
         component: () => import("../views/rules/fpsm/index.vue"),
+        meta: {
+          ignoreAuth: true,
+        },
       },
       {
         path: "fwrx",
         name: "rules-fwrx",
         component: () => import("../views/rules/fwrx/index.vue"),
+        meta: {
+          ignoreAuth: true,
+        },
       },
       {
         path: "buyrule",
         name: "rules-buyrule",
         component: () => import("../views/rules/buyrule/index.vue"),
+        meta: {
+          ignoreAuth: true,
+        },
       },
       {
         path: "sellrule",
         name: "rules-sellrule",
         component: () => import("../views/rules/sellrule/index.vue"),
+        meta: {
+          ignoreAuth: true,
+        },
       },
       {
         path: "jfgz",
         name: "rules-jf",
         component: () => import("../views/rules/jfgz/index.vue"),
+        meta: {
+          ignoreAuth: true,
+        },
       },
       {
         path: "cght",
         name: "rules-cght",
         component: () => import("../views/rules/cght/index.vue"),
+        meta: {
+          ignoreAuth: true,
+        },
       },
       {
         path: "zrht",
         name: "rules-zrht",
         component: () => import("../views/rules/zrht/index.vue"),
+        meta: {
+          ignoreAuth: true,
+        },
       },
       {
         path: "xhht",
         name: "rules-xhht",
         component: () => import("../views/rules/xhht/index.vue"),
+        meta: {
+          ignoreAuth: true,
+        },
       },
     ],
   },
@@ -436,6 +478,9 @@ const routes: Array<RouteRecordRaw> = [
         path: "ptgz",
         name: "NavigationPTGZ",
         component: () => import("../views/navigation/ptgz/index.vue"),
+        meta: {
+          ignoreAuth: true,
+        },
       },
     ],
   },

+ 2 - 1
src/packages/mobile/views/bank/sign/index.vue

@@ -39,7 +39,8 @@ const { cancelSubmit, formRefresh, bankInfo } = useDoCancelBankSign()
 const { router, routerTo } = useNavigation()
 
 const formSubmit = () => {
-    dialog('确认解约?', {
+    dialog({
+        message: '确认解约?',
         showCancelButton: true
     }).then(() => {
         fullloading((hideLoading) => {

+ 22 - 9
src/packages/mobile/views/home/index.vue

@@ -3,7 +3,7 @@
     <keep-alive>
       <component class="g-flex__body" :is="components[componentId]"></component>
     </keep-alive>
-    <app-tabbar class="home-tabbar" v-model:dataIndex="tabIndex" :data-list="tabList" @change="onChange" />
+    <app-tabbar class="home-tabbar" :data-list="tabList" :dataIndex="tabIndex" @click="onTabClick" />
   </div>
 </template>
 
@@ -13,6 +13,7 @@ import { dialog } from '@/utils/vant'
 import { Tabbar } from '@mobile/components/base/tabbar/interface'
 import { GetAppUpdateInfo } from '@/services/api/common'
 import { useNavigation } from '@/hooks/navigation'
+import { useLoginStore } from '@/stores'
 import plus from '@/utils/h5plus'
 import AppTabbar from '@mobile/components/base/tabbar/index.vue'
 import Home from './components/main/index.vue'
@@ -24,10 +25,11 @@ const components = {
   home: Home,
   purchase: Purchase,
   supplyDemand: SupplyDemand,
-  mine: Mine
+  mine: Mine,
 }
 
-const { getGlobalUrlParams } = useNavigation()
+const { getToken } = useLoginStore()
+const { routerTo, getGlobalUrlParams } = useNavigation()
 const componentId = shallowRef('home')
 const tabIndex = shallowRef(0)
 
@@ -58,14 +60,24 @@ const tabList: Tabbar[] = [
   }
 ]
 
-const onChange = (item: Tabbar) => {
-  componentId.value = item.name
+const onTabClick = ({ name }: Tabbar, index: number) => {
+  if (name === 'home' || getToken()) {
+    tabIndex.value = index
+    componentId.value = name
+  } else {
+    routerTo('UserLogin')
+  }
 }
 
 onActivated(() => {
-  const { tabName } = getGlobalUrlParams()
-  if (tabName) {
-    tabIndex.value = tabList.findIndex((e) => e.name === tabName)
+  const { tabName, showLogin } = getGlobalUrlParams()
+  const index = tabList.findIndex((e) => e.name === tabName)
+  if (index > -1) {
+    tabIndex.value = index
+    componentId.value = tabList[index].name
+  }
+  if (showLogin) {
+    routerTo('UserLogin')
   }
 })
 
@@ -78,7 +90,8 @@ plus.getVersionCode((currentVersionCode) => {
       if (data) {
         const { LastVersionCode, ApkUrl } = data[0] as Model.AppUpdateInfo
         if (Number(LastVersionCode) > Number(currentVersionCode)) {
-          dialog('发现新版本,是否更新?', {
+          dialog({
+            message: '发现新版本,是否更新?',
             showCancelButton: true,
             confirmButtonText: '更新'
           }).then(() => {

+ 2 - 1
src/packages/mobile/views/mine/address/components/edit/index.vue

@@ -105,7 +105,8 @@ const formSubmit = () => {
 
 // 删除地址
 const formDelete = () => {
-    dialog('是否删除该收货地址?', {
+    dialog({
+        message: '是否删除该收货地址?',
         showCancelButton: true
     }).then(() => {
         fullloading((hideLoading) => {

+ 2 - 1
src/packages/mobile/views/mine/generalize/components/promotion/index.vue

@@ -74,7 +74,8 @@ const onRefresh = (finish: () => void) => {
 }
 
 const submit = (item: Model.THJPromotionIncomeRsp) => {
-    dialog('确定要申请支取吗?', {
+    dialog({
+        message: '确定要申请支取吗?',
         showCancelButton: true
     }).then(() => {
         fullloading((hideLoading) => {

+ 2 - 1
src/packages/mobile/views/mine/invoice/components/edit/index.vue

@@ -96,7 +96,8 @@ const formSubmit = () => {
 
 // 删除发票
 const formDelete = () => {
-    dialog('是否删除该发票?', {
+    dialog({
+        message: '是否删除该发票?',
         showCancelButton: true
     }).then(() => {
         fullloading((hideLoading) => {

+ 6 - 3
src/packages/mobile/views/mine/main/index.vue

@@ -158,7 +158,8 @@ const doInOutMoney = (tab: string) => {
         if (signstatus && signstatus === 4) {
           router.push({ name: 'bank-wallet', query: { tab } })
         } else {
-          dialog('请先添加签约账户信息!', {
+          dialog({
+            message: '请先添加签约账户信息!',
             showCancelButton: true,
             confirmButtonText: '去签约'
           }).then(() => {
@@ -170,7 +171,8 @@ const doInOutMoney = (tab: string) => {
       })
     }, '正在加载...')
   } else {
-    dialog('请先实名认证,再进行该操作!', {
+    dialog({
+      message: '请先实名认证,再进行该操作!',
       showCancelButton: true,
       confirmButtonText: '去实名'
     }).then(() => {
@@ -180,7 +182,8 @@ const doInOutMoney = (tab: string) => {
 }
 
 const userLogout = () => {
-  dialog('是否退出当前账号?', {
+  dialog({
+    message: '是否退出当前账号?',
     showCancelButton: true
   }).then(() => {
     eventBus.$emit('LogoutNotify')

+ 8 - 4
src/packages/mobile/views/mine/order/detail/purchasetrade/index.vue

@@ -91,7 +91,8 @@ const openPDF = (file?: string) => {
 const spotConfirmSubmit = () => {
     const param = detail.value
     if (param) {
-        dialog('确认要交收吗?', {
+        dialog({
+            message: '确认要交收吗?',
             showCancelButton: true
         }).then(() => {
             fullloading((hideLoading) => {
@@ -112,7 +113,8 @@ const spotConfirmSubmit = () => {
 const spotApplySubmit = () => {
     const param = detail.value
     if (param) {
-        dialog('确认要违约吗?', {
+        dialog({
+            message: '确认要违约吗?',
             showCancelButton: true
         }).then(() => {
             fullloading((hideLoading) => {
@@ -133,7 +135,8 @@ const spotApplySubmit = () => {
 const spotPlaymentSubmit = () => {
     const param = detail.value
     if (param) {
-        dialog('确认要付款吗?', {
+        dialog({
+            message: '确认要付款吗?',
             showCancelButton: true
         }).then(() => {
             fullloading((hideLoading) => {
@@ -169,7 +172,8 @@ const spotListingSubmit = () => {
 
 /// 转让撤销申请
 const spotCancelSubmit = () => {
-    dialog('确认要撤销转让吗?', {
+    dialog({
+        message: '确认要撤销转让吗?',
         showCancelButton: true
     }).then(() => {
         fullloading((hideLoading) => {

+ 2 - 1
src/packages/mobile/views/mine/order/detail/transfer/index.vue

@@ -67,7 +67,8 @@ const openPDF = (file?: string) => {
 
 /// 转让撤销申请
 const spotCancelSubmit = () => {
-    dialog('确认要转让撤销吗?', {
+    dialog({
+        message: '确认要转让撤销吗?',
         showCancelButton: true
     }).then(() => {
         fullloading((hideLoading) => {

+ 2 - 1
src/packages/mobile/views/mine/order/detail/wrorder/index.vue

@@ -54,7 +54,8 @@ const { cancelSubmit } = useWrListingCancelOrder()
 const spotConfirmSubmit = () => {
     const param = detail.value
     if (param) {
-        dialog('确认要撤销吗?', {
+        dialog({
+            message: '确认要撤销吗?',
             showCancelButton: true
         }).then(() => {
             fullloading((hideLoading) => {

+ 2 - 1
src/packages/mobile/views/purchase/detail/index.vue

@@ -239,7 +239,8 @@ const updateForm = (formValue: Proto.SpotPresaleDestingOrderReq) => {
 }
 
 const onSubmit = () => {
-    dialog('确认立即下单吗?', {
+    dialog({
+        message: '确认立即下单吗?',
         showCancelButton: true
     }).then(() => {
         fullloading(() => {

+ 6 - 0
src/packages/mobile/views/user/login/index.less

@@ -4,6 +4,12 @@
     background: url('@mobile/assets/images/login-bg.jpg') no-repeat center top;
     background-size: 100% 100%;
 
+    &-navback {
+        >.van-icon {
+            color: #333;
+        }
+    }
+
     &-logo {
         height: 3.28rem;
         background: url('@mobile/assets/images/login-logo.png') no-repeat center top;

+ 6 - 12
src/packages/mobile/views/user/login/index.vue

@@ -1,5 +1,6 @@
 <template>
   <app-statusbar class="login">
+    <app-navback class="login-navback" />
     <div class="login-logo"></div>
     <Form class="login-form" @submit="formSubmit">
       <CellGroup>
@@ -34,18 +35,15 @@
 
 <script lang="ts" setup>
 import { shallowRef } from 'vue'
-import { useRoute, useRouter } from 'vue-router'
-import { Button, Field, CellGroup, Form, Checkbox, showFailToast, showToast } from 'vant'
+import { Button, Field, CellGroup, Form, Checkbox, showFailToast, showSuccessToast, showToast } from 'vant'
 import { fullloading } from '@/utils/vant'
 import { useAuth } from '@/business/auth'
 import { useNavigation } from '@/hooks/navigation'
 import service from '@/services'
 import plus from '@/utils/h5plus'
 
-const { routerTo } = useNavigation()
+const { routerBack, routerTo } = useNavigation()
 const { user, login } = useAuth()
-const route = useRoute()
-const router = useRouter()
 const checked = shallowRef(false) // 是否同意协议管理
 const appVersion = shallowRef('') // 应用版本号
 
@@ -66,12 +64,8 @@ const formSubmit = () => {
     fullloading((hideLoading) => {
       login().then(() => {
         hideLoading()
-        const redirect = route.query.redirect
-        if (redirect) {
-          router.replace(redirect.toString())
-        } else {
-          router.replace('/')
-        }
+        routerBack()
+        showSuccessToast('登录成功')
       }).catch((err) => {
         showFailToast(err)
       })
@@ -87,6 +81,6 @@ plus.getVersion((version) => {
 })
 </script>
 
-<style lang="less" scoped>
+<style lang="less">
 @import './index.less';
 </style>

+ 2 - 1
src/packages/mobile/views/user/logoff/index.vue

@@ -29,7 +29,8 @@ import { useAccountCancellation } from '@/business/user'
 const { formSubmit } = useAccountCancellation()
 
 const onSubmit = () => {
-    dialog('账户注销后不能再使用该系统,如果账户有余额需要人工审核才能注销,确定要注销账户吗?', {
+    dialog({
+        message: '账户注销后不能再使用该系统,如果账户有余额需要人工审核才能注销,确定要注销账户吗?',
         showCancelButton: true,
         messageAlign: 'left'
     }).then(() => {

+ 3 - 3
src/packages/pc/views/auth/login/index.vue

@@ -36,14 +36,14 @@ const { getUserMenuList } = useMenuStore()
 const route = useRoute()
 const router = useRouter()
 const formRef = shallowRef<FormInstance>()
-const remember = shallowRef(false) // 记住账号
+//const remember = shallowRef(false) // 记住账号
 
 const formRules: FormRules = {
   LoginID: [
-    { required: true, max: 20, message: '随便输入', trigger: 'blur' }
+    { required: true, max: 20, message: '请输入登录账号', trigger: 'blur' }
   ],
   LoginPWD: [
-    { required: true, max: 16, message: '随便输入', trigger: 'blur' }
+    { required: true, max: 16, message: '请输入登录密码', trigger: 'blur' }
   ]
 }
 

+ 7 - 5
src/utils/vant/index.ts

@@ -48,9 +48,11 @@ export function fullloading(callback: (hideLoading: () => void) => void, message
  * @param message 
  * @param type 
  */
-export function dialog<T = unknown>(message: string, type?: DialogOptions) {
-    return showDialog({
-        message,
-        ...type
-    }) as Promise<T>
+export function dialog(options: string | DialogOptions) {
+    if (typeof options === 'string') {
+        return showDialog({
+            message: options,
+        })
+    }
+    return showDialog(options)
 }