li.shaoyi 5 mesi fa
parent
commit
daf312b88e

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

@@ -26,6 +26,21 @@ const routes: RouteRecordRaw[] = [
     }
   },
   {
+    path: '/register',
+    name: 'register',
+    component: Page,
+    children: [
+      {
+        path: '',
+        name: '',
+        component: () => import('../views/user/register/home.vue'),
+        meta: {
+          ignoreAuth: true,
+        }
+      }
+    ]
+  },
+  {
     path: '/',
     component: Page,
     children: [

+ 23 - 6
src/packages/mobile/views/user/register/Index.vue

@@ -1,7 +1,7 @@
 <template>
   <app-view class="g-form register">
     <template #header>
-      <app-navbar :title="$t('user.register.title')" />
+      <app-navbar :title="$t('user.register.title')" :show-back-button="showBackButton" />
     </template>
     <Form ref="formRef" class="g-form__container register__form" @submit="formSubmit">
       <CellGroup :inset="insetStyle">
@@ -72,13 +72,13 @@
         </Button>
       </div>
       <app-reward :show="showReward" :value="redEnvelope" :title="$t('user.register.registersuccess')"
-        @click="router.back()" />
+        @click="routerAction" />
     </template>
   </app-view>
 </template>
 
 <script lang="ts" setup>
-import { reactive, shallowRef, ref, computed, onMounted } from 'vue'
+import { reactive, shallowRef, ref, computed, onMounted, useAttrs } from 'vue'
 import { CellGroup, Cell, Button, Field, Form, FormInstance, Checkbox, showFailToast, showToast, FieldRule, Popup, Picker, PickerConfirmEventParams, showSuccessToast } from 'vant'
 import { useCountDown } from '@vant/use'
 import { fullloading, dialog } from '@/utils/vant'
@@ -93,6 +93,10 @@ import AppReward from '@mobile/components/modules/reward/index.vue'
 // import AppQrcodeScan from '@mobile/components/base/qrcode-scan/index.vue'
 
 defineProps({
+  showBackButton: {
+    type: Boolean,
+    default: true
+  },
   showYhkhfxgzs: {
     type: Boolean,
     default: true
@@ -103,6 +107,10 @@ defineProps({
   }
 })
 
+const emit = defineEmits<{ (event: string, ...args: unknown[]): void }>()
+
+const attrs = useAttrs()
+
 // 是否弹出选择器
 const show = shallowRef(false)
 const datalist = computed(() => {
@@ -121,7 +129,7 @@ const onConfirm = ({ selectedValues: [value] }: PickerConfirmEventParams) => {
   countryCode.value = value.toString()
 }
 
-const { router, routerTo } = useNavigation()
+const { router, routerTo, getQueryString } = useNavigation()
 const globalStore = useGlobalStore()
 const errorInfoStore = useErrorInfoStore()
 const registrationCodeRule = globalStore.getSystemInfo('registrationCodeRule')
@@ -161,7 +169,7 @@ const formData = reactive<Model.RegisterReq>({
   mobilephone: '',
   loginpwd: '',
   vcode: '',
-  refernum: '',
+  refernum: getQueryString('code') ?? '',
   isaudit: 1,
   userinfotype: 1,
   usertype: 5,
@@ -231,6 +239,15 @@ const formRules: { [key: string]: FieldRule[] } = {
 //   formData.refernum = text
 // }
 
+// 路由跳转
+const routerAction = () => {
+  if (attrs.onRouterAction) {
+    emit('routerAction')
+  } else {
+    router.back()
+  }
+}
+
 // 发送手机验证码
 const sendVerifyCode = () => {
   formRef.value?.validate('mobilephone').then(() => {
@@ -256,7 +273,7 @@ const getRegisterMoney = (accountid: number) => {
       message: t('user.register.tips8'),
       confirmButtonText: t('operation.confirm')
     }).then(() => {
-      router.back()
+      routerAction()
     })
   }
   return queryMyRegisterMoney({

+ 10 - 0
src/packages/mobile/views/user/register/home.vue

@@ -0,0 +1,10 @@
+<template>
+  <PageView :show-back-button="false" @router-action="backHome" />
+</template>
+
+<script lang="ts" setup>
+import { useNavigation } from '@mobile/router/navigation'
+import PageView from './Index.vue'
+
+const { backHome } = useNavigation()
+</script>

+ 19 - 0
src/packages/tss/router/index.ts

@@ -26,6 +26,25 @@ const routes: Array<RouteRecordRaw> = [
     },
   },
   {
+    path: '/register',
+    name: 'register',
+    component: Page,
+    children: [
+      {
+        path: '',
+        name: '',
+        component: () => import('@mobile/views/user/register/home.vue'),
+        meta: {
+          ignoreAuth: true,
+        },
+        props: {
+          showYhkhfxgzs: false,
+          insetStyle: false
+        }
+      }
+    ]
+  },
+  {
     path: '/',
     component: Page,
     children: [