add educate page

This commit is contained in:
2026-02-01 16:20:13 +03:30
parent 4cbe3b6b0d
commit b2b8b70099
13 changed files with 304 additions and 389 deletions
-4
View File
@@ -81,7 +81,6 @@
</template>
<script lang="ts" setup>
import {colors} from './themeConfig'
import pkg from '../package.json'
import {useRegisterSW} from 'virtual:pwa-register/vue'
import {computed, h, onMounted, ref} from 'vue'
@@ -89,12 +88,9 @@ import {update} from 'lodash'
import img_topGradiant from '@/views/login/assets/img/gr_top_white.svg'
import img_pattern from '@/views/login/assets/img/pattern.svg'
import {LoadingOutlined} from '@ant-design/icons-vue'
import img_bottomGradiant from '@/views/login/assets/img/gr_bottom_white.svg'
import logoFull from '@/assets/img/logo_full_.png'
import {DotLottieVue} from '@lottiefiles/dotlottie-vue'
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import {getConfig} from "@/api/config";
import {useConfigStore} from "@/store/configStore";
import { ConfigProvider as AConfigProvider } from 'ant-design-vue'
Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

+16 -13
View File
@@ -43,17 +43,15 @@ const currentRoute = computed(() => {
})
async function start() {
// console.log('ffffffffffffffffffffffffffffffffffffffffff')
if (getToken()) {
// await userStore.getMyInfo()
await walletStore.getLimitedPrice()
await walletStore.getLimitedBuyGold()
await fundStore.getMyFund()
}
}
const win = window as Window & { isWhatsappBtnAdded?: boolean };
const win = window as Window & { isWhatsappBtnAdded?: boolean }
export function setTruth() {
fingerPosition = true
@@ -89,7 +87,6 @@ router.beforeEach(async (to, from, next) => {
}
// Start a new timeout to reset fingerprint after 5 seconds of inactivity
if (from.name !== 'login' || from.name !== undefined) {
console.log(from.name)
timeoutId = setTimeout(async () => {
if (hasFingerPrint) {
fingerPosition = false
@@ -109,8 +106,8 @@ router.beforeEach(async (to, from, next) => {
// If the user has a token
if (getToken()) {
await userStore.getMyInfo()
const finger_print =userStore.userInfo.finger_print
console.log(finger_print)
const finger_print= userStore.userInfo.finger_print
// console.log(finger_print)
// const { finger_print } = await getMe()
hasFingerPrint = finger_print
// If on an Apple device and fingerprint exists
@@ -129,7 +126,6 @@ router.beforeEach(async (to, from, next) => {
goToLogin(to, next) // Redirect to login if authentication fails
}
} else {
console.log('salam')
if (from.path === '/') {
// goToHome(to, next)
}
@@ -140,7 +136,7 @@ router.beforeEach(async (to, from, next) => {
}
} else {
// If no token, handle redirect to login or allow access to login or 404
if (['login', '404'].includes(to.name as string)) {
if (['login', '404','educate'].includes(to.name as string)) {
return next() // Allow access to login or 404
}
goToLogin(to, next) // Redirect to login if no token
@@ -157,7 +153,7 @@ router.beforeEach(async (to, from, next) => {
return next() // Proceed to the intended route
} else {
// If no token, ensure proper redirection to login or 404
if (['login', '404'].includes(to.name as string)) {
if (['login', '404','educate'].includes(to.name as string)) {
return next() // Allow access to login or 404
}
return next({ name: 'login' })
@@ -168,15 +164,22 @@ router.beforeEach(async (to, from, next) => {
if (getToken() && !hasFingerPrint) {
next()
} else {
goToLogin(to, next)
if (['login', '404','educate'].includes(to.name as string)) {
if (to.name === 'login'){
goToLogin(to, next)
return
} else {
return next()
}
// Allow access to login or 404
}
}
/* if (to.name !== 'login') {
return next({ name: 'login' }) // Redirect to login
} else {
return next() // If already on the login page, don't redirect
}*/
/* console.log('sssssssssssssssssssssssss')
return next({ name: 'login' })*/
/* return next({ name: 'login' })*/
}
}
})
+5 -1
View File
@@ -129,7 +129,11 @@ const router = createRouter({
name: '404',
component: () => import('../views/base/404.vue')
},
{
path: '/educate',
name: 'educate',
component: () => import('@/views/base/educate/index.vue')
},
/* {
path: `/single/login`,
name: 'login',
+12 -6
View File
@@ -40,12 +40,7 @@
</div>
</div>
</div>
<div class="wrap-fix bottom-0 px-10 py-6 flex gap-2 bg-white">
<!-- <a href="https://t.me/saminn_gold">-->
<!-- <img src="@/assets/img/telegram.png" alt="" class="h-10 w-10"/>-->
<!-- </a>-->
<!-- garoosi-->
<div v-if="config.config.name === 'garoosi'" class="wrap-fix bottom-0 px-10 py-6 flex gap-2 bg-white">
<a class="w-full" href="tel:09931127454">
<BasicButton class="w-full" type="primary">تماس با پشتیبانی</BasicButton>
</a>
@@ -53,6 +48,14 @@
<img src="@/assets/img/bale.png" alt="" class="h-10 w-10"/>
</a>
</div>
<div v-else class="wrap-fix bottom-0 px-10 py-6 flex gap-2 bg-white">
<!-- <a class="w-full" href="tel:09931127454">-->
<BasicButton class="w-full" type="primary">تماس با پشتیبانی</BasicButton>
<!-- </a>-->
<!-- <a href="https://t.me/saminn_gold">-->
<img src="@/assets/img/telegram.png" alt="" class="h-10 w-10"/>
<!-- </a>-->
</div>
</div>
</div>
<!-- <ActionSheet v-model:show="editPassVisible">salam</ActionSheet>-->
@@ -78,6 +81,9 @@ import { useUserStore } from '@/store/userStore'
import BaseDatePicker from '@/components/BasicPacks/BaseDatePicker'
import img_pattern from "@/views/login/assets/img/pattern.svg";
import {useConfigStore} from "@/store/configStore";
import {useConfigStore} from "@/store/configStore";
const config=useConfigStore()
const userFormState = ref<User>({
fname: '',
+232
View File
@@ -0,0 +1,232 @@
<template>
<div>
<div class="wrap-fix z-1 bg-white py-3 px-3 text-black font-bold drop-shadow flex">
<div @click="router.back()" class="cursor-pointer">
<BasicIcon icon="vuesax-linear:arrow-right-1" />
</div>
<div class="mr-2">آموزش نرم افزار</div>
</div>
<div class="pt-10">
<div>
<!-- <img :src="img" alt="" class="mt-2 w-full absolute bottom-0" />-->
<!-- <img :src="config.config.avatar" alt="" class="mt-2 w-full absolute bottom-0">-->
</div>
<div class="text-justify text-base z-200000 relative">
<div class="px-10">
<div class="h-20vh flex justify-center">
<img :src="config.config.avatar" alt="" class="mb-20 h-15vh mt-5">
</div>
<div class="overflow-y-auto h-60vh pb-10 border-[#093D51]">
<div
class="mt-5 text-5 border-solid border-2 border-[#093D51] text-[#093D51] rounded-[12px] p-4"
>
<div class="mt-3 text-sm font-bold text-[#093D51]">
«بخش خرید محصول به‌صورت ۲۴ ساعته فعال نیست و فقط در روزهای کاری، بین ساعت ۱۳ تا ۱۸ امکان ثبت سفارش وجود دارد.»
</div>
<div class="w-full h-1px my-3 bg-secondary"></div>
<div class="font-bold text-sm text-[#093D51]">
شیوهٔ ثبت ‌نام در گروسی گالری
</div>
<div class="mt-5 text-xs leading-5">
• برای ثبت‌نام در گروسی گالری، اگر قبلاً حساب کاربری دارید می‌توانید از طریق پیامک وارد شوید.<br />
• اگر حساب کاربری ندارید، "از این قسمت" وارد صفحه ثبت نام شده و با وارد کردن نام و شماره تلفنی که با کد ملی شما مطابقت دارد، حساب کاربری بسازید.<br />
• الزامی به وارد کردن کد معرف نیست.
</div>
<img :src="img1" />
<div class="w-full h-1px my-3 bg-secondary"></div>
<div class="font-bold mt-4 text-sm text-[#093D51]">
شارژ کیف پول
</div>
<div class="mt-5 text-xs leading-5">
• ابتدا کیف پول را در منو انتخاب کرده، مبلغ مورد نظر را وارد نموده و دکمه واریز را انتخاب کنید تا کیف پول شما شارژ شود.<br />
</div>
<img :src="img2" />
<div class="w-full h-1px my-3 bg-secondary"></div>
<div class="font-bold mt-4 text-sm text-[#093D51]">
شیوهٔ خرید از گروسی گالری
</div>
<div class="mt-5 text-xs leading-5">
• سپس از بخش «خرید و فروش» انتخاب کنید که طلای آب‌شده می‌خواهید یا گنج (شامل گوی، شمش یا مکعب).<br />
• توجه داشته باشید کارمزد طلای آب‌شده حدود ۲٪ است و کارمزد ریالی گنج در پایین صفحه قیمت درج شده است.
</div>
<img :src="img4" />
<div class="w-full h-1px my-3 bg-secondary"></div>
<div class="font-bold mt-4 text-sm text-[#093D51]">
شیوهٔ فروش در گروسی گالری
</div>
<div class="mt-5 text-xs leading-5">
• برای فروش محصولاتی که خریداری کرده‌اید، ابتدا مقدار فروش خود را در اپلیکیشن بله به پشتیبانی به شماره 09931127454 اطلاع دهید.<br />
• سپس به بخش «خرید و فروش» مراجعه کرده، محصول موردنظر را انتخاب و گزینه فروش را بزنید تا مبلغ قابل دریافت نمایش داده شود.<br />
• مبلغ به کیف پول شما واریز می‌شود و از طریق پیام پشتیبانی می‌توانید درخواست برداشت دهید.<br />
• اگر موجودی کیف پول بیش از ۱۰ میلیون تومان باشد، مبلغ تا پایان روز کاری بعد به حساب اعلام‌شده شما واریز خواهد شد.
</div>
<div class="w-full h-1px my-3 bg-secondary"></div>
<div class="font-bold mt-4 text-sm text-[#093D51]">
شیوهٔ دریافت فیزیکی طلا (ارسال)
</div>
<div class="mt-5 text-xs leading-5">
• ابتدا موجودی محصول موردنظر را با پشتیبانی در واتساپ هماهنگ کنید.<br />
• سپس روی لوگو کلیک کرده، گزینه «برداشت فیزیکی» و بعد «درخواست جدید» را انتخاب کنید.<br />
• محصولات خریداری‌شده و تعداد آن‌ها را مشخص کرده و آدرس خود را ثبت نمایید.<br />
• پشتیبانی عکس و وزن محصول را برای شما ارسال می‌کند.<br />
• ارسال به‌صورت پس‌کرایه و بیمه‌شده انجام می‌شود.<br />
• توجه داشته باشید گوی معمولاً ۳ تا ۷ روز کاری بعد آماده ارسال است و شمش‌های مینیاتوری ۵ تا ۱۵ روز کاری پس از ثبت درخواست آماده خواهند شد.
</div>
<div class="w-full h-1px my-3 bg-secondary"></div>
<div class="font-bold mt-4 text-sm text-[#093D51]">
پاداش معرفی
</div>
<div class="mt-5 text-xs leading-5">
• در صفحه اصلی روی "تنظیمات" کلیک کرده و وارد حساب کاربری خود شوید.
</div>
<!-- <img :src="img2" />-->
<div class="mt-5 text-xs leading-5">
• سپس گزینه «اشتراک‌گذاری» یا «کپی لینک» را انتخاب کرده و لینک دعوت را برای دوستانتان ارسال کنید.<br />
• در صورتی که دوستان شما از طریق لینک شما ثبت‌نام کنند، به‌صورت خودکار ۱ سوت طلا به‌عنوان پاداش دریافت خواهید کرد.
</div>
<!-- <img :src="img3" />-->
</div>
</div>
</div>
<div v-if="config.config.name === 'garoosi'" class="wrap-fix bottom-0 px-10 py-6 flex gap-2 bg-white">
<a class="w-full" href="tel:09931127454">
<BasicButton class="w-full" type="primary">تماس با پشتیبانی</BasicButton>
</a>
<a href="https://ble.ir/garoosi_gallery">
<img src="@/assets/img/bale.png" alt="" class="h-10 w-10"/>
</a>
</div>
<div v-else class="wrap-fix bottom-0 px-10 py-5 flex gap-2 bg-white">
<a class="w-full" href="">
<BasicButton class="w-full" type="primary">تماس با پشتیبانی</BasicButton>
</a>
<a href="">
<BasicButton icon="vuesax-linear:whatsapp" />
</a>
</div>
</div>
</div>
<!-- <ActionSheet v-model:show="editPassVisible">salam</ActionSheet>-->
</div>
</template>
<script lang="ts" setup>
import { onMounted, reactive, ref } from 'vue'
import img from '@/assets/img/user_ly1.svg'
import img1 from '@/assets/img/1.png'
import img2 from '@/assets/img/2.png'
import img4 from '@/assets/img/4.png'
import { loading } from '@/utils'
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import type { User } from '@/models/login'
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
import router from '@/router'
import type { FormInstance } from 'ant-design-vue'
import { message } from 'ant-design-vue'
import { updateMe } from '@/api/me'
import { useUserStore } from '@/store/userStore'
import {useConfigStore} from "@/store/configStore";
const config=useConfigStore()
const userFormState = ref<User>({
fname: '',
lname: '',
mobile: undefined,
birth_date: '',
phone_number: '',
province: '',
city: '',
n_code: undefined
})
const formRef = ref<FormInstance>()
const userStore = useUserStore()
// const editPassVisible = ref<boolean>(false)
const editPassVisible = ref<boolean>(false)
function setForm() {
userFormState.value = userStore.userInfo
}
function copyCode() {
// nextTick(() => {
const val = userStore.userInfo?.referral_id
navigator.clipboard.writeText(val)
message.info('کد رونوشت شد')
// })
}
function shareCode() {
// nextTick(() => {
const val = `🌟طلای ساخته شده یا آبشده فرقی نداره از ۱۰۰ تومن طلا بخر
با خرید مستمر گنج حتی با مبالغ کم پس‌اندازتو طلایی کن!
این دعوت نامه از طرف "${userStore.userInfo?.name}" عزیز برای شما ارسال شده تا شما هم عضو گنج طلای افجود بشید .
روی لینک زیر کلیک کنید و ثبت نام خود را تکمیل کنید.
afjod.com/login?id=${userStore.userInfo?.referral_id}`
navigator.share({
title: 'افجود',
text: val
})
// message.info('کد رونوشت شد')
// })
}
const resetData = () => {
formRef.value?.resetFields()
userFormState.value = {
fname: '',
lname: '',
mobile: undefined,
birth_date: '',
phone_number: '',
province: '',
city: '',
n_code: undefined
}
}
onMounted(() => {
setForm()
})
function ok() {
formRef.value?.validateFields().then(async () => {
try {
loading.value = true
await updateMe(userFormState.value)
await userStore.getMyInfo()
editPassVisible.value = false
message.success('اطلاعات شما با موفقیت به روز رسانی شد')
} catch (e) {
console.log(e)
} finally {
loading.value = false
}
})
}
</script>
<style scoped>
/*.fade-enter-active,
.fade-leave-active {
transition: opacity 0.2s ease;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}*/
/*.trans{
transition: height 1s;
}*/
</style>
@@ -16,12 +16,7 @@
<div class=" font-bold text-sm text-primary text-center">جواز کسب و کار</div>
<!-- <img :src="permission1" alt="" class="w-full">-->
<div class="mt-5 text-xs"></div>
<div class="wrap-fix bottom-0 px-2 py-6 flex gap-2 bg-white">
<!-- <a href="https://t.me/saminn_gold">
<img src="@/assets/img/telegram.png" alt="" class="h-10 w-10"/>
</a>-->
<!-- garoosii-->
<div v-if="config.config.name === 'garoosi'" class="wrap-fix bottom-0 px-2 py-6 flex gap-2 bg-white">
<a class="w-full" href="tel:09931127454">
<BasicButton class="w-full" type="primary">تماس با پشتیبانی</BasicButton>
</a>
@@ -29,6 +24,14 @@
<img src="@/assets/img/bale.png" alt="" class="h-10 w-10"/>
</a>
</div>
<div v-else class="wrap-fix bottom-0 px-2 py-6 flex gap-2 bg-white">
<!-- <a href="https://t.me/saminn_gold">-->
<img src="@/assets/img/telegram.png" alt="" class="h-10 w-10"/>
<!-- </a>-->
<!-- <a class="w-full" href="tel:09931127454">-->
<BasicButton class="w-full" type="primary">تماس با پشتیبانی</BasicButton>
<!-- </a>-->
</div>
</div>
</div>
</div>
@@ -43,9 +46,6 @@ import img from '@/assets/img/user_ly1.svg'
// import gr_bottom from './assets/img/gr_bottom_white.svg'
import { loading } from '@/utils'
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import BasicActionSheet from '@/components/BasicPacks/BasicActionSheet.vue'
import { lengthValidation, required } from '@/utils/inputRules'
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
import type { User } from '@/models/login'
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
import router from '@/router'
@@ -53,8 +53,10 @@ import type { FormInstance } from 'ant-design-vue'
import { message } from 'ant-design-vue'
import { updateMe } from '@/api/me'
import { useUserStore } from '@/store/userStore'
import BaseDatePicker from '@/components/BasicPacks/BaseDatePicker'
import {useConfigStore} from "@/store/configStore";
import {useConfigStore} from "@/store/configStore";
const config=useConfigStore()
const userFormState = ref<User>({
fname: '',
+7 -2
View File
@@ -298,12 +298,16 @@
<div class="mt-2">
<span>جهت شارژ حساب کاربری خود، کلمه "شماره حساب" را برای پشتیبانی ارسال نمایید.</span>
</div>
<BasicButton class="mt-4">
<!-- garosii-->
<BasicButton v-if="config.config.name === 'garoosi'" class="mt-4">
<a class="w-full" href="https://ble.ir/garoosi_gallery">
پیام به پشتیبانی
</a>
</BasicButton>
<BasicButton v-else>
<a class="w-full" href="">
پیام به پشتیبانی
</a>
</BasicButton>
</div>
<template #footer>
@@ -355,6 +359,7 @@ const chargeAccountModal = ref<boolean>(false)
const showConfirmCode = ref<boolean>(false)
const refOtpInput = ref<InstanceType<typeof VOtpInput> | null>(null)
const config = useConfigStore()
onMounted(() => {
if (router.currentRoute.value.query.state === 'deposit') {
isDeposit.value = true
+11 -350
View File
@@ -1,6 +1,6 @@
<template>
<div class="w-full flex flex-col">
<img :src="config.config.avatar" alt="" class="z-100 rounded-full aspect-square self-center w-42 " STYLE="margin-bottom: 60px">
<img :src="config.config.avatar" alt="" class="z-100 rounded-full aspect-square self-center w-36 " STYLE="margin-bottom: 60px">
<!-- <div class="font-bold text-center text-xl">{{ URLUserType() === 'single' ? 'ورود' : 'ورود همکار' }}</div>-->
<!-- <div v-if="URLUserType() === 'single'" class="font-bold text-center text-xl">ورود</div>-->
@@ -117,11 +117,14 @@
ورود با اثر انگشت
</div>
</BasicButton>
<div class="flex gap-1 justify-center mt-5 text-xs" @click="$emit('register',true)">اگر حساب کاربری ندارید
<div class="cursor-pointer flex gap-1 justify-center mt-5 text-xs" @click="$emit('register',true)">اگر حساب کاربری ندارید
<div class="font-bold text-primary">از این قسمت</div>
ثبت نام کنید.
</div>
</a-form-item>
<BasicButton v-if="config.config.name === 'garoosi'" class="w-full !font-bold" @click="goToEducate">
<div class="flex gap-2 items-center">آموزش کار با نرم افزار</div>
</BasicButton>
</a-form>
<!-- <div v-if="URLUserType() === 'single'" class="fixed bottom-5 left-0 right-0 text-center">
@@ -136,7 +139,6 @@
<script lang="ts" setup>
import { mobileValidation, required } from '@/utils/inputRules'
// import type {UserMobile} from "@/models/login";
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import { authenticateWithFingerprint, getToken, loading, removeToken, setToken, URLUserType } from '@/utils'
@@ -151,16 +153,14 @@ import { loginCustomer, verifyToken } from '@/api/login'
import router from '@/router'
import { useUserStore } from '@/store/userStore'
import { useWalletStore } from '@/store/walletStore'
import logo from '@/assets/img/logo.png'
import { fingerPosition, setTruth } from '@/main'
import {useConfigStore} from "@/store/configStore";
const config=useConfigStore()
const { time, onFinish, reset } = useCountdownTimer('00:02:00', 'mm:ss')
const enableSendAgainCode = ref<boolean>(false)
const stepTwoVerify = ref<boolean>(false)
const formRef = ref<FormInstance>()
const config=useConfigStore()
const userStore = useUserStore()
const walletStore = useWalletStore()
const data = reactive(['ورود با پیامک', 'ورود با کلمه عبور'])
@@ -297,9 +297,11 @@ const getcode=()=>{
console.log('not supported');
}
}
const goToEducate = () => {
router.push({ name: "educate" })
}
</script>
<style lang="less">
.animate.right {
right: 0;
@@ -310,345 +312,4 @@ const getcode=()=>{
transform: translate(100%, 0);
}
</style>
<!--
<template>
<div class="w-full flex flex-col">
<img :src="logo" alt="" class="z-100 w-full aspect-square self-center h-20">
<img :src="logoFull" alt="" class="z-100 w-50 aspect-square self-center mb-5 h-10">
&lt;!&ndash; <div class="font-bold text-center text-xl">{{ URLUserType() === 'single' ? 'ورود' : 'ورود همکار' }}</div>&ndash;&gt;
&lt;!&ndash; <div v-if="URLUserType() === 'single'" class="font-bold text-center text-xl">ورود</div>&ndash;&gt;
&lt;!&ndash; <div v-else class="font-bold text-center text-xl">ورود همکار</div>&ndash;&gt;
<a-form ref="formRef" :model="userFormState" class="!mt-5" name="basic" @finish="phoneVerification">
&lt;!&ndash; <a-segmented v-model:value="value" :options="data" />&ndash;&gt;
<div class="flex justify-evenly w-full px-2 h-11 items-center bg-gray-50 relative rounded mb-5">
<div :class="isSMS?'text-primary':'text-gray-400'" class="w-full text-center z-2"
@click.stop="setIsSMS(true) ">
ورود با پیامک
</div>
<div :class="!isSMS?'text-primary':'text-gray-400'" class="w-full text-center z-2"
@click.stop="setIsSMS(false) ">
ورود با کلمه عبور
</div>
&lt;!&ndash; <div ref="bganim" class="absolute bg-white h-8 w-1/2 rounded-lg " :style="`transform: translateX(${isDeposit? '0':'-100%'}); left: ${isDeposit? '0':'100%'}`"></div>&ndash;&gt;
<div ref="bganim" :style="useStyle()"
class="absolute bg-white h-8 w-1/2 rounded-lg animate right"></div>
</div>
&lt;!&ndash; <transition name="fade" mode="out-in">&ndash;&gt;
<a-form-item v-if="!stepTwoVerify" :rules="[required('شماره تلفن'),mobileValidation()]"
class="home_appear_fade_in_down" label="شماره تلفن"
name="mobile">
<BasicInput v-model:value="userFormState.mobile" place-holder="شماره تلفن" size="large" type="number" />
</a-form-item>
&lt;!&ndash; </transition>&ndash;&gt;
&lt;!&ndash; <transition name="fade" mode="out-in">&ndash;&gt;
<a-form-item v-if="!isSMS" :rules="[required('کلمه عبور')]" class="home_appear_fade_in_down" label="کلمه عبور"
name="password">
&lt;!&ndash; <BasicInput v-model:value="userFormState.password" size="large" place-holder="کلمه عبور"/>&ndash;&gt;
<AInputPassword v-model:value="userFormState.password" place-holder="کلمه عبور" size="large" />
</a-form-item>
<div v-else-if="!stepTwoVerify" class="h-[90px]"></div>
<div v-else>
<AFormItem
:rules="[
{
required: true,
message: 'کد ارسال شده را وارد نمایید',
},
{
min: 4,
max: 4,
message: 'کد ارسال شده را وارد نمایید',
},
]"
class="error-token"
name="token"
>
<OtpInput
ref="refOtpInput"
:is-input-num="true"
:num-inputs="4"
:should-auto-focus="true"
autocomplete="one-time-code"
class="mt-5 justify-center"
input-classes="otp-input"
separator=""
style="direction: ltr"
value=""
@on-change="handleOnChange"
@on-complete="handleOnComplete"
/>
</AFormItem>
<div class="flex items-center my-[23px] justify-center">
<span class="text-gray-400 mt-1">{{ userFormState.mobile }}</span>
<div class="flex items-center text-gray-700 mr-2" @click="stepTwoVerify = false">
<span class="ml-1">ویرایش شماره</span>
<BasicIcon icon="vuesax-linear:edit" size="20" />
</div>
</div>
<div class="mb-2 w-full">
<AButton :disabled="!enableSendAgainCode" class="w-full" type="dashed" @click="reSendCode">
<div v-if="!enableSendAgainCode" class="flex w-full justify-center">
<span>ارسال مجدد کد در </span>
<span class="text-primary mx-1">{{ time }}</span>
<span> دیگر </span>
</div>
<div v-else>
ارسال مجدد کد تایید
</div>
</AButton>
</div>
</div>
&lt;!&ndash; </transition>&ndash;&gt;
<a-form-item>
&lt;!&ndash; <div class="flex text-gray-600 text-xs my-2">با ورود یا ثبت نام
<div class="mx-1 font-bold">شرایط و قوانین</div>
را میپذیرم
</div>&ndash;&gt;
<BasicButton
:disabled="loading"
class=" w-full py-2"
html-type="submit"
type="primary"
>
<div>
<a-spin v-if="loading" size="small" />
<div v-else>{{ !isSMS ? 'ورود' : stepTwoVerify ? 'ورود' : 'ارسال کد' }}</div>
</div>
</BasicButton>
<BasicButton
v-if="getToken() && userStore.userInfo?.finger_print"
:disabled="loading"
class=" w-full py-2 mt-2"
@click="enterFingerPrint"
>
<div>
ورود با اثر انگشت
</div>
</BasicButton>
<div class="flex gap-1 justify-center mt-5 text-xs" @click="$emit('register',true)">اگر حساب کاربری ندارید
<div class="font-bold text-[#0A1B37]">از این قسمت</div>
ثبت نام کنید.
</div>
</a-form-item>
</a-form>
&lt;!&ndash; <div v-if="URLUserType() === 'single'" class="fixed bottom-5 left-0 right-0 text-center">
<a class="w-full text-center"
href="https://abshode.peransagold.com/">ورود
همکار</a>
</div>&ndash;&gt;
</div>
</template>
<script lang="ts" setup>
import { mobileValidation, required } from '@/utils/inputRules'
// import type {UserMobile} from "@/models/login";
import BasicInput from '@/components/BasicPacks/BasicInput.vue'
import BasicButton from '@/components/BasicPacks/BasicButton.vue'
import {
authenticateWithFingerprint,
getToken,
loading,
removeToken,
setFingerPrint,
setToken,
URLUserType
} from '@/utils'
import { onMounted, reactive, ref } from 'vue'
import OtpInput from 'vue3-otp-input'
import type { Login } from '@/models/login'
import type { FormInstance } from 'ant-design-vue'
import { message } from 'ant-design-vue'
import BasicIcon from '@/components/BasicPacks/BasicIcon.vue'
import useCountdownTimer from '@/utils/useCountdownTimer'
import { loginCustomer, verifyToken } from '@/api/login'
import router from '@/router'
import { useUserStore } from '@/store/userStore'
import { useWalletStore } from '@/store/walletStore'
import logo from '@/assets/img/logo.svg'
import { fingerPosition, setFingerPosition, setFingerTimeOut, setTruth } from '@/main'
const { time, onFinish, reset } = useCountdownTimer('00:02:00', 'mm:ss')
const enableSendAgainCode = ref<boolean>(false)
const stepTwoVerify = ref<boolean>(false)
const formRef = ref<FormInstance>()
const userStore = useUserStore()
const walletStore = useWalletStore()
const data = reactive(['ورود با پیامک', 'ورود با کلمه عبور'])
const value = ref(data[0])
const refOtpInput = ref<InstanceType<typeof VOtpInput> | null>(null)
const userFormState = reactive<Login>({
provider: 'customer'
})
//time
onFinish(() => {
enableSendAgainCode.value = true
})
const isAuthenticated = ref(false);
onMounted(async () => {
if (getToken()) {
const result = await authenticateWithFingerprint();
setFingerPosition(result)
if (result) {
isAuthenticated.value = true;
await router.push({ name: 'home' }); // Redirect to home on successful authentication
} else {
isAuthenticated.value = false;
// Handle failed authentication
}
}
});
async function reSendCode() {
userFormState.token = undefined
// refOtpInput.value?.clearInput()
enableSendAgainCode.value = false
await loginCustomer(userFormState)
reset()
}
const isSMS = ref<boolean>(true)
function setIsSMS(val: boolean) {
isSMS.value = val
if (!val) stepTwoVerify.value = false
userFormState.token = ''
userFormState.password = ''
// console.log(bganim.value.classList)
// bganim?.value?.classList.add(val?'right':'left')
// bganim?.value?.style.transform = `translateX(${val ? '0' : '-100'});`
// bganim?.value?.style.animationDirection = val? 'normal':'reverse'
// val? bganim?.value?.classList?.add("move") : bganim?.value?.classList?.remove("move")
// const el = bganim.value?.
// el.
}
async function enterFingerPrint() {
const fingerPrint = await authenticateWithFingerprint()
if (fingerPrint) {
setTruth()
await router.push({ name: 'home' })
} else {
message.error('خطا در اعتبارسنجی')
}
}
function useStyle() {
if (isSMS.value) return 'right: 2%;'
// if (isDeposit.value) return 'animation-direction: normal'
// else return 'animation-direction: reverse'
else return ' right: 98%; transform: translate(100%, 0);'
}
function handleOnChange(value: string) {
userFormState.token = value
// formRef.value?.validateFields()
}
async function handleOnComplete(value: string) {
userFormState.token = value
phoneVerification()
}
async function login(accessToken: string | undefined) {
setToken(accessToken)
setFingerTimeOut(router.currentRoute.value)
await userStore.getMyInfo()
// console.log(URLUserType())
// console.log(userStore.userInfo?.type)
/* if (userStore.userInfo?.type === (URLUserType() === 'customer' ? 1 : 2)) {*/
await walletStore.getMyWallet()
setTruth()
await router.push({ name: 'home' })
/* } else {
removeToken()
userStore.removeInformation()
message.error('شما مجوز ورود به این بخش را ندارید')
}*/
}
function phoneVerification() {
formRef.value?.validateFields().then(async () => {
try {
loading.value = true
if (isSMS.value) {
if (!stepTwoVerify.value) {
userFormState.token = undefined
userFormState.password = undefined
userFormState.provider = 'customer'
const { id } = await loginCustomer(userFormState)
userFormState.id = id
stepTwoVerify.value = true
getcode()
reset()
} else {
const { access_token } = await verifyToken(userFormState)
await login(access_token)
}
} else {
userFormState.token = undefined
const { access_token } = await loginCustomer(userFormState)
await login(access_token)
}
} catch (e) {
console.log(e)
} finally {
loading.value = false
}
})
}
const getcode=()=>{
if ('OTPCredential' in window) {
console.log('run')
const ac = new AbortController();
navigator.credentials
.get({
otp: { transport: ['sms'] },
signal: ac.signal,
})
.then((otp) => {
console.log('otp recived');
userFormState.token = otp?.code;
refOtpInput.value.fillInput(otp?.code)
phoneVerification();
ac.abort();
})
.catch((err) => {
ac.abort();
console.log(err);
});
} else {
console.log('not supported');
}
}
</script>
<style lang="less">
.animate.right {
right: 0;
}
.animate.right.move {
right: 100%;
transform: translate(100%, 0);
}
</style>-->
</style>
+9 -3
View File
@@ -1,6 +1,6 @@
<template>
<div class="w-full flex flex-col">
<img :src="config.config.avatar" alt="" class="z-100 rounded-full aspect-square self-center w-42 " STYLE="">
<img :src="config.config.avatar" alt="" class="z-100 rounded-full aspect-square self-center w-36 " STYLE="">
<div class="font-bold text-center text-xl">ثبت نام</div>
<a-form ref="formRef" :model="userFormState" class="!mt-5" name="basic"
@finish="registerAccount">
@@ -38,11 +38,14 @@
<div v-else>ثبت نام</div>
</div>
</BasicButton>
<div class="flex gap-1 justify-center mt-5 text-xs" @click="$emit('register',false)">اگر حساب کاربری دارید
<div class="cursor-pointer flex gap-1 justify-center mt-5 text-xs" @click="$emit('register',false)">اگر حساب کاربری دارید
<div class="font-bold text-primary">از این قسمت</div>
وارد شوید.
</div>
</a-form-item>
<BasicButton v-if="config.config.name === 'garoosi'" class="w-full !font-bold" @click="goToEducate">
<div class="flex gap-2 items-center">آموزش کار با نرم افزار</div>
</BasicButton>
</a-form>
<DialogVantOneButton v-model:show="registeredInfo" :closeOnClickOverlay="false" :timeOut="-1">
<template v-slot:img>
@@ -127,7 +130,6 @@ import registerDelayImage from '@/assets/img/registerDelay.svg'
import DialogVantOneButton from '@/components/DialogVantOneButton.vue'
import { registerCustomer } from '@/api/login'
import router from '@/router'
import logo from "@/assets/img/logo.png";
import {useConfigStore} from "@/store/configStore";
const config = useConfigStore()
@@ -191,6 +193,10 @@ function registerAccount() {
})
}
const goToEducate = () => {
router.push({ name: "educate" })
}
</script>