1404/11/18-delete required rule in referral code &
hidden home page
This commit is contained in:
+3
-3
@@ -73,8 +73,8 @@ function goToLogin(to: RouteLocationNormalized, next: NavigationGuardNext) {
|
||||
}
|
||||
|
||||
function goToHome(to: RouteLocationNormalized, next: NavigationGuardNext) {
|
||||
if (to.name !== 'home') {
|
||||
return next({ name: 'home' }) // Redirect to login
|
||||
if (to.name !== 'buyProduct') {
|
||||
return next({ name: 'buyProduct' }) // Redirect to login
|
||||
} else {
|
||||
return next() // If already on the login page, don't redirect
|
||||
}
|
||||
@@ -151,7 +151,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
if (fingerPosition) {
|
||||
if (getToken()) {
|
||||
if (to.name === 'login') {
|
||||
return next({ name: from.name || 'home' }) // Redirect to home if trying to access login after authentication
|
||||
return next({ name: from.name || 'buyProduct' }) // Redirect to home if trying to access login after authentication
|
||||
}
|
||||
return next() // Proceed to the intended route
|
||||
} else {
|
||||
|
||||
@@ -100,9 +100,13 @@
|
||||
<!-- <canvas ref="canvas" id="canvas1" width="400" height="80" class="w-full"></canvas>-->
|
||||
<div v-if="isToken()" class="bottom-appbar w-auto mx-auto">
|
||||
<div class="tabs">
|
||||
<div :class="setNavColor('home')" class="tab" @click="setRoute('home')">
|
||||
<Icon icon="vuesax-linear:home" />
|
||||
<div class="text-xs mt-1 font-bold">صفحه اصلی</div>
|
||||
<!-- <div :class="setNavColor('home')" class="tab" @click="setRoute('home')">-->
|
||||
<!-- <Icon icon="vuesax-linear:home" />-->
|
||||
<!-- <div class="text-xs mt-1 font-bold">صفحه اصلی</div>-->
|
||||
<!-- </div>-->
|
||||
<div :class="setNavColor('buyProduct')" class="tab" @click="setRoute('buyProduct')">
|
||||
<Icon icon="vuesax-linear:coin" />
|
||||
<div class="text-xs mt-1 font-bold">فروشگاه</div>
|
||||
</div>
|
||||
<div :class="setNavColor('transactions')" class="tab" @click="setRoute('transactions')">
|
||||
<Icon icon="vuesax-linear:receipt-item" />
|
||||
|
||||
@@ -163,10 +163,49 @@
|
||||
<div>کسب درآمد</div>
|
||||
</div>
|
||||
</BasicButton>
|
||||
<BasicButton
|
||||
class="mt-2 w-full"
|
||||
icon=""
|
||||
iconSize="18"
|
||||
size="large"
|
||||
@click="showLogoutConfirm=!showLogoutConfirm"
|
||||
>
|
||||
<div class="flex">
|
||||
<Icon
|
||||
:color="y > 50 ? '' : ''"
|
||||
class="color-transition absolute right-8"
|
||||
icon="vuesax-linear:logout"
|
||||
@click="showLogoutConfirm = true"
|
||||
/>
|
||||
<div>خروج از حساب کاربری</div>
|
||||
</div>
|
||||
</BasicButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<DialogVant v-model:show="showLogoutConfirm" :closeOnClickOverlay="false" :timeOut="-1">
|
||||
<!-- <template v-slot:img>
|
||||
<img :src="registerDelayImage" alt="" class="opacity-80">
|
||||
</template>-->
|
||||
|
||||
<template v-slot:title>
|
||||
<div class="flex flex-col items-center">
|
||||
<DotLottieVue
|
||||
class="w-11rem h-11rem"
|
||||
autoplay
|
||||
src="https://lottie.host/129cf3a1-df84-4758-a856-58c133ae6013/R5RqclXA8G.json"
|
||||
/>
|
||||
<div class="p-5 text-sm">آیا از خروج خود اطمینان دارید؟</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-slot:button>
|
||||
<div class="text-center text-red flex items-center justify-center" @click="logout">
|
||||
<a-spin :spinning="logoutLoading" size="small"> خروج</a-spin>
|
||||
</div>
|
||||
<div class="text-center" @click="showLogoutConfirm = false">انصراف</div>
|
||||
</template>
|
||||
</DialogVant>
|
||||
<BasicActionSheet v-model:show="editPassVisible">
|
||||
<div class="flex justify-center justify-between">
|
||||
<div class="font-bold text-lg">ویرایش اطلاعات</div>
|
||||
@@ -257,7 +296,7 @@
|
||||
import { onMounted, reactive, ref, computed } from 'vue'
|
||||
import img from '@/assets/img/user_ly1.svg'
|
||||
import gr_bottom from './assets/img/gr_bottom_white.svg'
|
||||
import { loading } from '@/utils'
|
||||
import {loading, removeToken} from '@/utils'
|
||||
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
|
||||
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
|
||||
import {
|
||||
@@ -277,6 +316,11 @@ import { message } from 'ant-design-vue'
|
||||
import { updateMe, updatePass } from '@/api/me'
|
||||
import { useUserStore } from '@/store/userStore'
|
||||
import BaseDatePicker from '@/components/BasicPacks/BaseDatePicker'
|
||||
import {DotLottieVue} from "@lottiefiles/dotlottie-vue";
|
||||
import DialogVant from "@/components/DialogVant.vue";
|
||||
import {useWalletStore} from "@/store/walletStore";
|
||||
import Icon from "@/components/BasicPacks/BasicIcon.vue";
|
||||
import {useWindowScroll} from "@vueuse/core/index";
|
||||
const userFormState = ref<User>({
|
||||
fname: '',
|
||||
lname: '',
|
||||
@@ -291,11 +335,29 @@ const userPassForm = ref<Password>({
|
||||
const formRef = ref<FormInstance>()
|
||||
const formPassRef = ref<FormInstance>()
|
||||
const userStore = useUserStore()
|
||||
const showLogoutConfirm = ref<boolean>()
|
||||
const walletStore=useWalletStore()
|
||||
const logoutLoading = ref<boolean>(false)
|
||||
const { x, y } = useWindowScroll()
|
||||
|
||||
// const editPassVisible = ref<boolean>(false)
|
||||
const editPassVisible = ref<boolean>(false)
|
||||
const editPasswordVisible = ref<boolean>(false)
|
||||
|
||||
async function logout() {
|
||||
logoutLoading.value = true
|
||||
// baseConfirm('آیا از حساب کاربری خارج می شوید؟',async () => {
|
||||
userStore.userInfo = undefined
|
||||
walletStore.walletInfo = undefined
|
||||
/* userStore.$reset()
|
||||
walletStore.$reset()*/
|
||||
removeToken()
|
||||
await router.push({ name: 'login' })
|
||||
logoutLoading.value = true
|
||||
window.location.reload()
|
||||
// console.log('salam')
|
||||
// })
|
||||
}
|
||||
function setForm() {
|
||||
userFormState.value = userStore.userInfo
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ async function enterFingerPrint() {
|
||||
const fingerPrint = await authenticateWithFingerprint()
|
||||
if (fingerPrint) {
|
||||
setTruth()
|
||||
await router.push({ name: 'home' })
|
||||
await router.push({ name: 'buyProduct' })
|
||||
} else {
|
||||
message.error('خطا در اعتبارسنجی')
|
||||
}
|
||||
@@ -234,7 +234,7 @@ async function login(accessToken: string | undefined) {
|
||||
/* if (userStore.userInfo?.type === (URLUserType() === 'customer' ? 1 : 2)) {*/
|
||||
await walletStore.getMyWallet()
|
||||
setTruth()
|
||||
await router.push({ name: 'home' })
|
||||
await router.push({ name: 'buyProduct' })
|
||||
/* } else {
|
||||
removeToken()
|
||||
userStore.removeInformation()
|
||||
|
||||
@@ -43,7 +43,7 @@ const userFormState = ref<UserMobile>({
|
||||
})
|
||||
|
||||
function phoneVerification() {
|
||||
router.push({name: 'home' })
|
||||
router.push({name: 'buyProduct' })
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user