| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514 |
- <template>
- <view class="login-page bg-body" :isHeaderFixed="true" :isLoginPage="true" :class="{ 'dark': isDark }">
- <view class="fixed" />
- <view class="main-content">
- <uni-row class="demo-uni-row">
- <cwg-match-media :min-width="991" style="height: 100%;">
- <uni-col :xs="24" :sm="24" :md="12" :lg="14" :xl="16" style="height: 100%">
- <view class="left-bg" :style="{ backgroundImage: `url(${loginBg})` }">
- <view class="left-box">
- <view class="inner">
- <view class="title w-700">
- {{ `${t('newLoop.item12')} ` }}
- <text class="color-white" v-t="'newLoop.item13'"></text>
- </view>
- <view class="text-white" v-t="'newLoop.item14'"></view>
- </view>
- <view class="left-content">
- <view class="des text-white">
- <text v-html="t('newSignin.item12')"></text>
- <br />
- <text v-html="t('newSignin.item12_1')"></text>
- <br />
- <text v-html="t('newSignin.item10')"></text>
- <br />
- <text v-html="t('newSignin.item11')"></text>
- <br />
- <text v-t="'newSignin.item13'"></text>
- <!-- <cwg-link type="pdf" :title="'newSignin.item13_1'"-->
- <!-- :url="`pdf/Risk-Disclosures-and-Acknowledgements-2020-08.pdf`" target="_blank"-->
- <!-- v-t="'newSignin.item13_1'" class="doc-link" />-->
- <text v-t="'newSignin.item13_2'"></text>
- <!-- <view v-t="'newSignin.item13_3'"></view>
- <text v-t="'newSignin.item13_4'"></text> -->
- </view>
- </view>
- <!-- <image src="/static/images/trust-pilot.png" class="img-fluid mt--10" mode="widthFix"></image>-->
- </view>
- </view>
- </uni-col>
- </cwg-match-media>
- <uni-col :xs="24" :sm="24" :md="12" :lg="10" :xl="8" class="right-f">
- <cwg-match-media :min-width="991">
- <view class="global-header-bar pc-header">
- <view class="header-inner">
- <view class="logo-placeholder"></view> <!-- 左侧可预留放logo或留空 -->
- <LoginHeaderGroup text-color="#fff" :icon-color="isDark ? '#fff' : '#97A1C0'" />
- </view>
- </view>
- </cwg-match-media>
- <!-- 移动端顶部栏:悬浮在上方,深色文字 -->
- <cwg-match-media :max-width="991">
- <view class="mobile-header-bar">
- <!-- <view class="fixed"/>-->
- <LoginHeaderGroup text-color="#fff" :icon-color="isDark ? '#fff' : '#97A1C0'" />
- </view>
- </cwg-match-media>
- <view class="account">
- <view class="company u-flex-y u-flex-y-center">
- <image v-if="!isDark" src="/static/images/vu/logo-full.svg"
- :class="isMobile ? 'company-icon-mini' : 'company-icon'" mode="widthFix"></image>
- <image v-else src="/static/images/vu/logo-full-white.svg"
- :class="isMobile ? 'company-icon-mini' : 'company-icon'" mode="widthFix"></image>
- </view>
- <view class="tab-list">
- <view v-for="tab in tabs" :key="tab.value" class="tab-item" :class="{ active: activeTab === tab.value }"
- @click="handleClick(tab.value)">
- <text class="tab-label">{{ tab.text }}</text>
- </view>
- </view>
- <view v-show="activeTab == 1" style="overflow-y: scroll;">
- <view class="title">
- <view class="tit1">{{ t('newSignin.item1') }}</view>
- <view class="tit2">{{ t('newSignin.item2') }}</view>
- </view>
- <view>
- <uni-forms ref="uFormRef" :model="form" labelWidth="200" label-position="top">
- <uni-forms-item :label="t('newSignup.item7')" prop="loginName">
- <up-input :customStyle="customStyle" v-model="form.loginName" border="none"
- :placeholder="t('signin.form.email')">
- </up-input>
- </uni-forms-item>
- <uni-forms-item :label="t('signin.form.password')" prop="password">
- <up-input :customStyle="customStyle" v-model="form.password" :type="inputType" border="none"
- :placeholder="t('signin.form.password')">
- </up-input>
- </uni-forms-item>
- </uni-forms>
- </view>
- <view class="u-flex u-flex-between u-flex-y-center mb1">
- <view class="check-box">
- <up-checkbox-group v-model="remenber" @change="checkboxChange">
- <up-checkbox size="18" labelSize="16" labelColor="#666666" activeColor="#ea002a"
- :label="t('newSignin.item5')" name="记住我" class="wcg-checkbox"></up-checkbox>
- </up-checkbox-group>
- </view>
- <navigator url="/pages/login/reset" class="account-tip">
- <text>{{ t('signin.forget') }}</text>
- </navigator>
- </view>
- <view class="cwg-button">
- <button type="primary" class="" @click="submit">
- {{ t('signin.login') }}
- </button>
- </view>
- <view @click="activeTab = 2" class="account-tip">
- {{ t('signin.words') }}
- <text>{{ t('signin.signup') }}</text>
- </view>
- </view>
- <view v-show="activeTab == 2" style="overflow-y: scroll;">
- <view class="title">
- <view class="tit1">{{ t('newSignup.item1') }}</view>
- <view class="tit2">{{ t('newSignup.item2') }}</view>
- </view>
- <view>
- <uni-forms ref="regForm" :modelValue="formData" :rules="rules" validate-trigger="blur"
- label-position="top" label-width="120">
- <uni-row :gutter="20" class="formContent">
- <uni-col :xs="24" :md="12">
- <uni-forms-item name="country" :label="t('newSignup.item3')">
- <cwg-combox v-model:value="formData.country" :options="countryOptions" border="none" filterable
- :placeholder="t('newSignup.item4')">
- </cwg-combox>
- </uni-forms-item>
- </uni-col>
- <uni-col :xs="24" :md="12">
- <uni-forms-item name="phone" :label="t('newSignup.item5')">
- <uni-easyinput :customStyle="customStyle" v-model="formData.phone" border="none"
- :placeholder="t('newSignup.item6')"></uni-easyinput>
- </uni-forms-item>
- </uni-col>
- <uni-col :xs="24" :md="12">
- <uni-forms-item name="birthDate" :label="t('newSignup.item18')">
- <uni-datetime-picker type="date" v-model="formData.birthDate"
- :placeholder="t('newSignup.item19')" @change="checkAge" />
- </uni-forms-item>
- </uni-col>
- <uni-col :xs="24" :md="12">
- <uni-forms-item name="email" :label="t('newSignup.item7')">
- <uni-easyinput :customStyle="customStyle" v-model="formData.email"
- :placeholder="t('newSignup.item8')" border="none"
- :disabled="!isAgeValid || !formData.birthDate"></uni-easyinput>
- </uni-forms-item>
- </uni-col>
- <uni-col :xs="24" :md="24">
- <uni-forms-item name="emailCode" :label="t('newSignup.item9')">
- <view style="display: flex;">
- <view style="flex: 1;">
- <uni-easyinput :customStyle="customStyle" class="code" border="none"
- :disabled="!isAgeValid || !formData.birthDate" v-model="formData.emailCode"
- :placeholder="t('newSignup.item10')">
- </uni-easyinput>
- </view>
- <view class="btn-code" @click="(!isAgeValid || !formData.birthDate) ? '' : handleGetCode()">
- {{ getCodeString }}
- </view>
- </view>
- </uni-forms-item>
- </uni-col>
- <uni-col :xs="24" :md="24">
- <view class="agreemnet9">*{{ t('signup.agreemnet9') }}</view>
- </uni-col>
- <uni-col :xs="24" :md="12">
- <uni-forms-item name="password" :label="t('newSignup.item12')">
- <uni-easyinput border="none" :customStyle="customStyle" v-model.trim="formData.password"
- :disabled="!isAgeValid || !formData.birthDate" :placeholder="t('newSignup.item13')"
- type="password"></uni-easyinput>
- </uni-forms-item>
- <uni-col :xs="24" :md="24">
- <uni-forms-item>
- <ul class="pwd">
- <li :class="{ fit: rule1 }" v-t="'signup.form.rules.1st'"></li>
- <li :class="{ fit: rule2 }" v-t="'signup.form.rules.2nd'"></li>
- <li :class="{ fit: rule3 }" v-t="'signup.form.rules.3rd'"></li>
- </ul>
- </uni-forms-item>
- </uni-col>
- </uni-col>
- <uni-col :xs="24" :md="12">
- <uni-forms-item v-if="!isRouteHasId" name="linkValue" :label="t('newSignup.item14')">
- <uni-easyinput border="none" :customStyle="customStyle" v-model.trim="formData.linkValue"
- :disabled="!isAgeValid || !formData.birthDate" :placeholder="t('newSignup.item15')"
- @input="limitAgentIdLength"></uni-easyinput>
- </uni-forms-item>
- </uni-col>
- </uni-row>
- <uni-forms-item name="agree">
- <view class="check-box" @click="toggleAgree">
- <up-checkbox-group v-model="agreeGroup" @change="onAgreeChange">
- <up-checkbox size="18" labelSize="24" labelColor="#666666" activeColor="#ea002a" name="agree"
- class="wcg-checkbox"></up-checkbox>
- </up-checkbox-group>
- <text class="checkbox-label">{{ t('signup.agree') }}</text>
- </view>
- </uni-forms-item>
- <uni-forms-item name="isSubscribeEmail">
- <view class="check-box" @click="toggleSubscribeEmail">
- <up-checkbox-group v-model="subscribeEmailGroup" @change="onSubscribeEmailChange">
- <up-checkbox size="18" labelSize="24" labelColor="#666666" activeColor="#ea002a"
- name="subscribeEmail" class="wcg-checkbox"></up-checkbox>
- </up-checkbox-group>
- <text class="checkbox-label">{{ t('signup.agree1') }}</text>
- </view>
- </uni-forms-item>
- </uni-forms>
- </view>
- <view>
- <button class="regiset-btn" @click="register">
- {{ t('signup.button') }}
- </button>
- </view>
- <view class="login-link">
- <text>{{ t('newSignup.item16') }}</text>
- <view class="link" @click="activeTab = 1">{{ t('newSignup.item17') }}</view>
- </view>
- <view class="des-bottom">
- <text v-t="'signup.agreemnet1'"></text>
- <cwg-link type="pdf" url='pdf/Client_Agreement.pdf' target="_blank" :title="'signup.agreemnet2'"
- class="desc-link" />
- <text v-t="'signup.agreemnet3'"></text>
- <cwg-link type="pdf" url='pdf/Terms&Conditions.pdf' target="_blank" :title="'signup.agreemnet4'"
- class="desc-link" />
- <text v-t="'signup.agreemnet5'"></text>
- <cwg-link type="pdf" url='pdf/Privacy_Policy.pdf' target="_blank" :title="'signup.agreemnet6'"
- class="desc-link" />
- <text v-t="'signup.agreemnet7'"></text>
- </view>
- </view>
- <cwg-match-media :min-width="791">
- <!-- <view class="qr-container">
- <view class="qr-title">
- <view class="line"></view>
- <view class="qr-tit2">{{ t('newSignin.item2') }}</view>
- <view class="line"></view>
- </view>
- <QrCode width="200" height="200" text="cardGuide" :logo="logoImage"></QrCode>
- </view> -->
- </cwg-match-media>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="chat-icon" :class="{ 'chat-icon-expanded': isChatIconExpanded, 'chat-icon-hidden': type == 'chat' }"
- @click="handleChatIconClick">
- <cwg-icon name="chat" color="#fff" />
- </view>
- </view>
- <cwg-global-popup/>
- </template>
- <script setup>
- import { ref, watch, onMounted, computed } from 'vue'
- import { onLoad } from '@dcloudio/uni-app'
- import ls from "@/utils/store2";
- import QrCode from '@/components/QrCode.vue'
- import { post } from '@/utils/request'
- import { userToken } from '@/composables/config'
- import { userApi } from '@/api/user'
- import { ucardApi } from '@/api/ucard'
- import { customApi } from '@/service/custom'
- import { loginApi } from '@/api/login'
- import { countryApi } from '@/api/country'
- import Config from '@/config/index'
- import { showToast } from '@/utils/toast'
- import { useEmailCountdown } from '@/hooks/useEmailCountdown'
- import useGlobalStore from '@/stores/use-global-store'
- import useUserStore from '@/stores/use-user-store'
- import useRouter from '@/hooks/useRouter'
- import { useI18n } from 'vue-i18n'
- import companyLogo from '@/static/images/logo4.png'
- import loginBg from '@/static/images/login-bg.jpeg'
- import LoginHeaderGroup from './components/LoginHeaderGroup.vue'
- import LiveChatService from '@/utils/liveChat.js'
- import { useWindowWidth } from '@/composables/useWindowWidth'
- import { openLocalPdf } from '@/utils/pdf.js'
- import { usePopup } from '@/hooks/usePopup'
- const windowWidth = useWindowWidth(300)
- const isMobile = computed(() => windowWidth.value <= 991)
- const router = useRouter()
- const { t } = useI18n()
- const { Code } = Config
- const userStore = useUserStore()
- const globalStore = useGlobalStore()
- const modeStore = computed(() => globalStore.mode)
- const isDark = computed(() => globalStore.theme === 'dark')
- const tabs = computed(() => [
- { text: t('signin.tabs1'), value: 1, },
- { text: t('signin.tabs2'), value: 2, },
- ])
- const { confirm } = usePopup()
- const activeTab = ref(1)
- // ========== 注册表单相关 ==========
- const {
- time,
- text: getCodeString,
- canSend,
- start,
- restore,
- } = useEmailCountdown()
- const isRouteHasId = ref(false)
- const formData = ref({
- country: 'CN',
- phone: '',
- birthDate: '',
- email: '',
- emailCode: '',
- password: '',
- linkValue: '',
- agree: 0,
- isSubscribeEmail: 0,
- sourceCode: null,
- w: '',
- subId: '',
- oc: '',
- agentId: null,
- ibInvalid: null,
- })
- const rules = {
- country: { rules: [{ required: true, errorMessage: t('vaildate.country.empty'), trigger: 'blur' }] },
- email: {
- rules: [
- { required: true, errorMessage: t('vaildate.email.empty'), trigger: 'blur' },
- { pattern: Config.Pattern.Email, errorMessage: t('vaildate.email.format'), trigger: 'blur' },
- ],
- },
- emailCode: { rules: [{ required: true, errorMessage: t('vaildate.code.empty'), trigger: 'blur' }] },
- password: {
- rules: [
- { required: true, errorMessage: t('vaildate.password.format'), trigger: 'blur' },
- { pattern: Config.Pattern.Password, errorMessage: t('vaildate.password.format'), trigger: 'blur' },
- ],
- },
- agree: {
- rules: [
- {
- validateFunction: (rule, value) => {
- if (value) return true
- return t('vaildate.agree.empty')
- },
- trigger: 'change',
- },
- ],
- },
- phone: {
- rules: [
- { required: true, errorMessage: t('vaildate.phone.format'), trigger: 'blur' },
- { pattern: Config.Pattern.NonNegInt, errorMessage: t('vaildate.phone.format'), trigger: 'blur' },
- ],
- },
- birthDate: { rules: [{ required: true, errorMessage: t('vaildate.birthDate.empty'), trigger: 'change' }] },
- }
- const agreeGroup = ref([])
- const subscribeEmailGroup = ref([])
- const regForm = ref(null)
- const mock_options = ref([])
- const countryCode = ref('my')
- const countryOptions = computed(() => {
- return mock_options.value.map(item => ({
- text: item.enName,
- value: item.code,
- disable: item.isOpenAccount == 0 || item.isOpenAccount === null ? true : false,
- }))
- })
- watch(() => formData.value.agree, (val) => {
- agreeGroup.value = val === 1 ? ['agree'] : []
- }, { immediate: true })
- watch(() => formData.value.isSubscribeEmail, (val) => {
- subscribeEmailGroup.value = val === 1 ? ['subscribeEmail'] : []
- }, { immediate: true })
- const onAgreeChange = (e) => {
- formData.value.agree = e && e.length ? 1 : 0
- }
- const onSubscribeEmailChange = (e) => {
- formData.value.isSubscribeEmail = e && e.length ? 1 : 0
- }
- const toggleAgree = () => {
- const next = agreeGroup.value.length ? [] : ['agree']
- agreeGroup.value = next
- onAgreeChange(next)
- }
- const toggleSubscribeEmail = () => {
- const next = subscribeEmailGroup.value.length ? [] : ['subscribeEmail']
- subscribeEmailGroup.value = next
- onSubscribeEmailChange(next)
- }
- const rule1 = computed(() => {
- if (!formData.value.password) return false
- return /^.{8,16}$/.test(formData.value.password)
- })
- const rule2 = computed(() => {
- return /^(?=.*?[a-z])(?=.*?[A-Z]).*$/.test(formData.value.password)
- })
- const rule3 = computed(() => {
- return /^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?!.*([~!@&%$^\(\)#_]).*\1.*\1)[A-Za-z0-9~!@&%$^\(\)#_]{8,16}$/.test(
- formData.value.password,
- )
- })
- const isAgeValid = computed(() => {
- if (!formData.value.birthDate) {
- return false
- }
- const today = new Date()
- const birthDate = new Date(formData.value.birthDate)
- let age = today.getFullYear() - birthDate.getFullYear()
- const monthDiff = today.getMonth() - birthDate.getMonth()
- if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
- age--
- }
- return age >= 18
- })
- const checkAge = () => {
- if (formData.value.birthDate && !isAgeValid.value) {
- confirm({
- title: t('Msg.SystemPrompt'),
- content: t('signup.ageRestriction'),
- showCancel: false,
- confirmText: t('Btn.Confirm'),
- })
- }
- }
- const limitAgentIdLength = (val) => {
- if (val == null || val === '') return
- const filtered = val.toString().replace(/[^0-9a-zA-Z]/g, '').slice(0, 10)
- if (formData.value.linkValue !== filtered) {
- formData.value.linkValue = filtered
- }
- }
- onLoad((options) => {
- if (options) {
- // 处理 sysLoginToken 参数,自动登录
- if (options.sysLoginToken) {
- handleTokenLogin(options.sysLoginToken)
- return
- }
- // 处理 activeTab 参数,跳转到注册页面
- if (options.activeTab === '2' || options.tab === '2') {
- activeTab.value = 2
- }
- // 处理各种参数格式
- formData.value.sourceCode = options.ex || options.sourceCode || null
- formData.value.w = options.w || options.subId || ''
- formData.value.subId = options.SUBID || options.subId || options.w || ''
- formData.value.oc = options.oc || options.code || ''
- formData.value.email = options.emailAdvertisement || options.email || ''
- // 处理 agentId 参数
- const agentId = options.id || options.agentId || options.p1 || ''
- if (agentId) {
- isRouteHasId.value = true
- formData.value.agentId = Number(agentId)
- formData.value.linkValue = options.subId || options.linkValue || ''
- }
- // 处理 ibInvalid 参数 (如 B0, B1)
- const ibInvalid = options.ibInvalid || options.p3 || ''
- if (ibInvalid) {
- switch (ibInvalid) {
- case 'B0':
- formData.value.ibInvalid = 0
- break
- case 'B1':
- formData.value.ibInvalid = 1
- break
- }
- }
- // 兼容 signup 路径格式 signup/19628/RHOP4WVa/B0
- if (options.p2) {
- formData.value.subId = options.p2
- }
- console.log(formData.value, 1212);
- }
- })
- // 处理 token 自动登录
- const handleTokenLogin = async (token) => {
- try {
- console.log('自动登录,token:', token);
-
- // 存储 token
- userToken.value = atob(token)
-
- // 获取用户信息并跳转
- await getCustomLoginInfo()
-
- // 获取拒绝原因列表
- reasonsRefusalList()
-
- console.log('自动登录成功');
- } catch (error) {
- console.error('自动登录失败:', error);
- // 登录失败不做任何操作,停留在登录页面
- }
- }
- const ho = ref('')
- // 国家列表
- async function getCountry() {
- try {
- let res = await countryApi.Country({})
- if (res.code == 200) {
- mock_options.value = res.data
- } else {
- showToast(res.msg)
- }
- } catch (error) {
- console.error(error)
- }
- }
- const getCountryMsg = async () => {
- let res = await countryApi.CountryGet({})
- if (res.code == Code.StatusOK) {
- countryCode.value = res.msg
- } else {
- console.log(res)
- }
- }
- async function handleGetCode() {
- if (!formData.value.birthDate) {
- showToast(t('vaildate.birthDate.empty'))
- return
- }
- if (!isAgeValid.value) {
- showToast(t('signup.ageRestriction'))
- return
- }
- if (!formData.value.country) {
- showToast(t('vaildate.country.empty'))
- return
- }
- if (!formData.value.email) {
- showToast(t('vaildate.email.empty'))
- return
- }
- if (!Config.Pattern.Email.test(formData.value.email)) {
- showToast(t('vaildate.email.format'))
- return
- }
- if (!canSend.value) return
- await sendEmailCode()
- }
- async function sendEmailCode() {
- try {
- const res = await loginApi.Code({
- ...formData.value,
- })
- if (res.code === 200) {
- showToast(res.msg, 'success')
- start()
- return true
- } else {
- showToast(res.msg, 'error')
- return false
- }
- } catch (e) {
- showToast(e.msg, 'error')
- }
- }
- const register = async () => {
- if (countryCode.value == 'MY' || countryCode.value == 'ID') {
- showToast('Registration not available for this region')
- return
- }
- regForm.value.validate().then(async (res) => {
- const chinaCountryCodes = ['CN']
- const isChina = chinaCountryCodes.includes(formData.value.country)
- const xSystemValue = isChina ? 'B' : 'A'
- let resData = await loginApi.Register(
- { ...formData.value,agree: formData.value.agree ==1 ? true : false },
- { headers: { 'X-System': xSystemValue } },
- )
- if (resData.code == 200) {
- showToast(t('Msg.registerSuc'),'success')
- registLogin()
- } else {
- confirm({
- title: t('Msg.SystemPrompt'),
- content: resData.msg,
- showCancel: false,
- confirmText: t('Btn.Confirm'),
- })
- // showToast(resData.msg,'error')
- }
- }).catch(err => {
- console.log('表单错误信息:', err)
- confirm({
- title: t('Msg.SystemPrompt'),
- content: err.msg,
- showCancel: false,
- confirmText: t('Btn.Confirm'),
- })
- return false
- })
- }
- const registLogin = async () => {
- try {
- let res = await userApi.login({
- loginName: formData.value.email,
- password: formData.value.password,
- })
- if (res.code == 200) {
- userToken.value = res.data
- getRegistLoginInfo()
- } else {
- showToast(res.msg)
- }
- } catch (error) {
- console.error(error)
- }
- }
- const getRegistLoginInfo = async () => {
- try {
- let res = await userApi.getUserInfo()
- if (res.code == 200) {
- userStore.saveUserInfo(res.data)
- showToast(t('Msg.LoginSuccess'))
- setTimeout(() => {
- uni.reLaunch({
- url: '/pages/customer/index',
- })
- }, 1000)
- } else {
- showToast(t('Msg.SystemError'))
- }
- } catch (error) {
- console.error(error)
- }
- }
- const openUrl = (url) => {
- openLocalPdf(url)
- }
- // ========== 注册表单相关结束 ==========
- // 响应式表单数据
- const form = ref({
- loginName: '',
- password: '',
- })
- function submit() {
- if (!form.value.loginName) {
- uni.$u.toast(t('signin.form.email'))
- return
- }
- if (!form.value.password) {
- uni.$u.toast(t('signin.form.password'))
- return
- }
- handleLogin()
- }
- const customStyle = {
- height: '48px',
- 'border-radius': '8px',
- background: 'transparent',
- padding: '0 20px !important',
- position: 'relative',
- }
- const remenber = ref([])
- const checkboxChange = (e) => {
- remenber.value = e
- }
- const fetchUserList = (params) => post('/Login/AcctLogin', params)
- const handleClick = (value) => {
- activeTab.value = value
- }
- async function handleLogin() {
- try {
- const res = await userApi.login({
- loginName: form.value.loginName,
- password: form.value.password,
- })
- if (res.code === 200) {
- userToken.value = res.data
- uni.showToast({ title: t('login.msg0_1'), icon: 'success' })
- getCustomLoginInfo()
- // getCardUserInfo();
- reasonsRefusalList()
- if (remenber.value.length) {
- userStore.saveAccountInfo({
- loginName: form.value.loginName,
- password: form.value.password,
- rememberPassword: true,
- })
- } else {
- userStore.saveAccountInfo({
- loginName: '',
- password: '',
- rememberPassword: false,
- })
- }
- // console.log(1111);
- } else {
- uni.showToast({ title: res.msg })
- // console.log(12112);
- }
- } catch (error) {
- // console.log(error)
- uni.showToast({ title: error.msg, icon: 'error' })
- // console.log(error, 19089);
- }
- }
- async function getCustomLoginInfo() {
- try {
- const res = await userApi.getUserInfo()
- userStore.saveUserInfo(res.data)
- uni.removeStorageSync('systemListCache')
- // 登录更新金额
- uni.$emit('updatePayment')
- // uni.$emit('updateSystemList', 'login')
- if (res.code === 200) {
- switch (modeStore.value) {
- case 'customer':
- router.reLaunch('/pages/customer/dashboard')
- // router.reLaunch('/pages/customer/index')
- break
- case 'ib':
- router.reLaunch('/pages/ib/index')
- break
- case 'follow':
- router.reLaunch('/pages/follow/index')
- break
- default:
- break
- }
- } else {
- uni.$u.toast(res.msg || t('login.msg0'))
- }
- } catch (error) {
- uni.$u.toast(error.msg || t('login.msg0'), 'error')
- // console.log(error, 111);
- }
- }
- async function getCardUserInfo() {
- try {
- const res = await ucardApi.getSingle()
- userStore.saveUserInfo(res.data)
- if (res.code === 200) {
- if (!res.data || res.data.approveStatus != 2) {
- router.push('/pages/mine/improve')
- } else {
- router.push('/pages/card/index')
- }
- } else {
- uni.$u.toast(res.msg || t('login.msg0'))
- }
- } catch (error) {
- // console.log(error, 111);
- }
- }
- async function reasonsRefusalList() {
- try {
- const res = await customApi.reasonsRefusalList()
- if (res.code === 200) {
- pickFields(res.data)
- } else {
- uni.$u.toast(res.msg || t('login.msg0'))
- }
- } catch (error) {
- // console.log(error, 111);
- }
- }
- function pickFields(source, fields = ['content', 'enContent']) {
- const result = {}
- Object.entries(source).forEach(([key, value]) => {
- result[key] = fields.reduce((acc, f) => {
- acc[f] = value[f] ?? null
- return acc
- }, {})
- })
- userStore.saveReasonsOptions(result)
- }
- onMounted(() => {
- if (uni.getStorageSync('logoutToSystem') == 1) {
- uni.removeStorageSync('logoutToSystem')
- uni.removeStorageSync('systemListCache')
- }
- uni.$emit('updateSystemList', 'login')
- const accountInfo = userStore.accountInfo
- if (accountInfo?.rememberPassword) {
- form.value.loginName = accountInfo?.loginName || ''
- form.value.password = accountInfo?.password || ''
- remenber.value = ['记住我']
- } else {
- form.value.loginName = ''
- form.value.password = ''
- remenber.value = []
- }
- // 注册表单初始化
- getCountry()
- getCountryMsg()
- const hostParts = window.location.host.split('.')
- ho.value = hostParts.length > 1 ? hostParts[1] : ''
- globalStore.setMode(ls.get('mode') || 'customer');
- })
- const inputType = ref('password')
- const isChatIconExpanded = ref(false)
- // 处理聊天图标点击
- const handleChatIconClick = () => {
- // 如果还没显示 → 先滑出来
- if (!isChatIconExpanded.value) {
- isChatIconExpanded.value = true
- return
- }
- if (isMobile.value) {
- // router.push('/pages/common/chat')
- } else {
- if (LiveChatService) {
- LiveChatService.showChat()
- }
- }
- setTimeout(() => {
- isChatIconExpanded.value = false
- }, 300)
- }
- </script>
- <style lang="scss" scoped>
- @import "@/uni.scss";
- :deep(uni-content) {
- padding-left: 0 !important;
- }
- .login-page {
- height: 100vh;
- border: none;
- padding: 0;
- position: relative;
- display: flex;
- flex-direction: column;
- }
- .chat-icon {
- width: px2rpx(50);
- height: px2rpx(50);
- border-radius: 50%;
- background-color: #cf1322;
- display: flex;
- align-items: center;
- justify-content: center;
- position: fixed;
- bottom: px2rpx(25);
- right: px2rpx(0);
- z-index: 999;
- cursor: pointer;
- transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
- box-shadow: 0 px2rpx(8) px2rpx(20) rgba(0, 0, 0, 0.15);
- will-change: transform;
- }
- @media screen and (max-width: 991px) {
- .chat-icon {
- right: px2rpx(-25);
- }
- }
- .chat-icon:hover {
- transform: scale(1.1);
- }
- .chat-icon-expanded {
- bottom: px2rpx(20);
- right: px2rpx(20);
- transform: scale(1.1);
- box-shadow: 0 px2rpx(12) px2rpx(30) rgba(0, 0, 0, 0.2);
- }
- .chat-icon-hidden {
- display: none;
- }
- .fixed {
- width: 100%;
- height: var(--status-bar-height);
- background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
- z-index: 9;
- }
- .global-header-bar {
- width: 100%;
- height: px2rpx(60);
- display: flex;
- align-items: center;
- justify-content: center;
- flex-shrink: 0;
- z-index: 100;
- &.pc-header {
- background-color: transparent;
- }
- .header-inner {
- width: 100%;
- padding: 0 5%;
- display: flex;
- justify-content: space-between;
- /* 两端对齐,可放logo和组件 */
- align-items: center;
- }
- }
- .mobile-header-bar {
- //position: absolute;
- //top: px2rpx(20);
- //right: px2rpx(20);
- min-height: px2rpx(46);
- z-index: 10;
- width: 100%;
- display: flex;
- background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
- justify-content: flex-end;
- align-items: center;
- }
- .main-content {
- flex: 1;
- overflow: hidden;
- }
- .demo-uni-row {
- height: 100%;
- margin: 0 !important;
- .left-bg {
- height: 100%;
- min-height: calc(100vh - 120px);
- background-size: cover;
- background-position: center;
- display: flex;
- box-sizing: border-box;
- padding: px2rpx(50);
- //flex-direction: column;
- //align-items: center;
- justify-content: center;
- .left-box {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: flex-start;
- width: 60%;
- //margin-top: px2rpx(20);
- .inner {
- width: 100%;
- text-align: start;
- //margin-bottom: px2rpx(20);
- .section-title {
- //margin-top: px2rpx(10);
- //margin-bottom: px2rpx(10);
- }
- .title {
- margin: 0 0 0 px2rpx(10);
- font-size: px2rpx(56);
- line-height: 1.2;
- color: #fff;
- font-weight: 700;
- text-align: left;
- }
- .w-700 {
- font-weight: 700;
- }
- .subtitle {
- width: 45%;
- font-size: px2rpx(18);
- letter-spacing: px2rpx(1);
- display: block;
- margin-bottom: px2rpx(24);
- color: #ffffff;
- line-height: px2rpx(15);
- font-weight: 500;
- padding: px2rpx(10) px2rpx(20);
- border-radius: px2rpx(100);
- text-transform: uppercase;
- background-color: #e61f1e;
- text-align: center;
- }
- .w-40 {
- max-width: 40%;
- }
- .text-white {
- margin-top: px2rpx(10);
- font-size: px2rpx(18);
- margin-bottom: px2rpx(16);
- line-height: 1.6;
- color: var(--bs-emphasis-color);
- }
- }
- .img-fluid {
- width: 400px;
- height: 33px;
- }
- .mt--10 {
- margin-top: px2rpx(10);
- }
- .h1 {
- // text-align: center;
- color: var(--bs-emphasis-color);
- font-size: 30px;
- margin-top: 30px;
- line-height: 1.5;
- }
- .h6 {
- text-align: start;
- line-height: 20px;
- color: var(--bs-emphasis-color);
- font-size: 14px;
- margin-top: 10px;
- }
- .company {
- padding: px2rpx(10) 0 px2rpx(10) 0;
- position: relative;
- align-items: flex-start !important;
- width: 100%;
- }
- }
- .left-content {
- width: 100%;
- .des {
- text-align: start;
- line-height: 24px;
- color: var(--bs-emphasis-color);
- font-size: 14px;
- //margin-top: px2rpx(20);
- :nth-child(n) {
- display: inline;
- word-break: break-all;
- word-wrap: break-word;
- }
- .doc-link {
- color: var(--color-error);
- text-decoration: underline;
- margin: 0 px2rpx(4);
- }
- }
- }
- }
- .right-f {
- background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
- padding: 0 px2rpx(24);
- height: 100%;
- box-sizing: border-box;
- .account {
- background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
- position: relative;
- height: calc(100vh - 60px);
- display: flex;
- flex-direction: column;
- //justify-content: center;
- padding: 0 px2rpx(24);
- .company {
- padding: px2rpx(20) 0 px2rpx(30) 0;
- position: relative;
- align-items: center !important;
- }
- .company-icon {
- width: px2rpx(234);
- }
- .company-icon-mini {
- width: px2rpx(100);
- }
- }
- }
- }
- .bottom-box {
- width: 100%;
- height: 60px;
- background-color: rgba(var(--bs-body-bg-rgb), var(--bs-bg-opacity)) !important;
- display: flex;
- justify-content: center;
- align-items: center;
- color: #000;
- .bottom-title {
- text-align: center;
- font-size: px2rpx(14);
- font-weight: 500;
- line-height: 1.5;
- color: #666666;
- }
- .ellipsis {
- width: px2rpx(200);
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .cwg-button {
- width: 120px !important;
- padding: px2rpx(4) 0 !important;
- }
- }
- button {
- background-color: #ea002a;
- font-size: px2rpx(14);
- font-weight: normal;
- height: px2rpx(44);
- line-height: px2rpx(44);
- }
- .right-f .account .company {
- padding: px2rpx(20) 0 px2rpx(200) 0;
- position: relative;
- align-items: flex-start !important;
- }
- .logo {
- margin-left: px2rpx(48);
- }
- .left-bg .company-icon {
- width: px2rpx(234);
- }
- .left-bg .left-content {
- position: relative;
- z-index: 1;
- }
- .title {
- margin: px2rpx(15) 0;
- font-size: px2rpx(24);
- font-weight: bolder;
- color: var(--bs-emphasis-color);
- text-align: center;
- i {
- margin-right: px2rpx(10);
- }
- .tit1 {
- font-size: px2rpx(34);
- line-height: 1.5;
- font-weight: bold;
- color: var(--bs-emphasis-color);
- }
- .tit2 {
- font-size: px2rpx(16);
- line-height: 1.5;
- color: #cecece;
- font-weight: 500;
- }
- }
- .qr-title {
- font-size: px2rpx(16);
- line-height: 1.5;
- color: #cecece;
- font-weight: 500;
- text-align: center;
- margin: px2rpx(40) 0;
- display: flex;
- align-items: center;
- justify-content: center;
- .line {
- flex: 1;
- height: 1px;
- background-color: #e4e4e4;
- }
- .qr-tit2 {
- margin: 0 px2rpx(12);
- }
- }
- .input {
- height: px2rpx(44);
- border-radius: px2rpx(8);
- background: #f7f8fa;
- padding: 0 px2rpx(20) !important;
- position: relative;
- }
- .account-icon {
- width: px2rpx(12);
- height: px2rpx(14) !important;
- margin-right: px2rpx(5);
- }
- :deep(.u-input__content__prefix-icon) {
- height: px2rpx(20);
- }
- .regiset-btn {
- margin: px2rpx(20) 0;
- border-radius: px2rpx(8);
- }
- .account-tip {
- color: #666666;
- font-size: px2rpx(16);
- text-align: center;
- cursor: pointer;
- text {
- color: #ea002a;
- }
- }
- :deep(.u-form-item__body) {
- padding: 0 !important;
- padding-bottom: px2rpx(24) !important;
- }
- :deep(.wcg-checkbox) {
- padding: 0 !important;
- }
- .cwg-button {
- padding: px2rpx(34) 0 !important;
- uni-button {
- border-radius: px2rpx(8)
- }
- }
- .tab-list {
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- border-bottom: 1px solid var(--bs-border-color);
- }
- .tab-item {
- width: 50%;
- margin: 0 px2rpx(15);
- padding-right: 0;
- padding-left: 0;
- padding-bottom: 8px;
- text-align: center;
- border-bottom: 2px solid transparent;
- font-weight: 500;
- color: var(--bs-emphasis-color);
- cursor: pointer;
- transition: all 0.3s ease;
- .tab-label {
- font-size: px2rpx(20);
- }
- &:hover,
- &:focus {
- font-weight: 700;
- color: #e32326;
- border-bottom-color: #e32326;
- }
- &.active {
- font-weight: 700;
- color: #e32326;
- border-bottom-color: #e32326;
- }
- }
- /* 注册表单样式 */
- .pwd {
- list-style: none;
- padding-left: 0;
- margin: 0;
- li {
- font-size: px2rpx(12);
- color: var(--bs-heading-color);
- line-height: px2rpx(20);
- position: relative;
- padding-left: px2rpx(16);
- &::before {
- content: '';
- position: absolute;
- left: 0;
- top: 50%;
- transform: translateY(-50%);
- width: px2rpx(6);
- height: px2rpx(6);
- border-radius: 50%;
- background-color: var(--bs-heading-color);
- }
- &.fit {
- color: #67c23a;
- &::before {
- background-color: #67c23a;
- }
- }
- }
- }
- :deep(.formContent) {
- padding: 0 10px;
- .uni-select,
- .uni-combox,
- .uni-easyinput__content,
- //.cwg-combox,
- .uni-date-editor--x {
- padding: 0.5rem px2rpx(10);
- height: 3rem !important;
- //border: none !important;
- border-radius: px2rpx(8);
- }
- .cwg-combox {
- background-color: transparent !important;
- }
- .code {
- .uni-easyinput__content {
- border-radius: px2rpx(8) 0 0 px2rpx(8);
- }
- }
- }
- :deep(.uni-stat-box) {
- height: 100%;
- }
- :deep(.uni-select) {
- height: 100%;
- }
- :deep(.uni-easyinput__content) {
- height: 100%;
- }
- :deep(.uni-date-editor) {
- height: 100%;
- }
- :deep(.uni-date-editor--x) {
- height: 100%;
- }
- .btn-code {
- //margin-left: -10px;
- width: px2rpx(120);
- height: 3rem;
- box-sizing: border-box;
- background-color: #102047;
- //border: 1px solid rgb(229, 229, 229);
- color: #fff;
- text-align: center;
- line-height: 3rem;
- border-radius: 0 px2rpx(8) px2rpx(8) 0;
- cursor: pointer;
- font-size: 14px;
- flex-shrink: 0;
- }
- .check-box {
- padding: 0 px2rpx(10);
- margin-bottom: px2rpx(10);
- display: flex;
- align-items: flex-start;
- cursor: pointer;
- .checkbox-label {
- font-size: px2rpx(16);
- color: #666666;
- margin-left: px2rpx(8);
- line-height: px2rpx(20);
- user-select: none;
- }
- :deep(.u-checkbox) {
- display: flex;
- align-items: flex-start;
- margin: 0;
- }
- }
- .regiset-btn {
- width: 100%;
- height: px2rpx(40);
- line-height: px2rpx(40);
- border-radius: px2rpx(8);
- background-color: var(--color-error);
- color: #fff;
- font-weight: bold;
- }
- .login-link {
- width: 100%;
- margin-top: px2rpx(20);
- text-align: center;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: px2rpx(16);
- line-height: 1.6;
- }
- .link {
- margin-left: px2rpx(5);
- color: #e61f1e;
- padding-bottom: 2px;
- cursor: pointer;
- font-size: px2rpx(16);
- }
- .agreemnet9 {
- text-align: initial;
- color: #e61f1e;
- }
- .des-bottom {
- margin-top: px2rpx(20);
- margin-bottom: px2rpx(40);
- line-height: 20px;
- color: #000;
- font-size: px2rpx(14);
- :deep(.pdf-link) {
- width: auto;
- }
- .desc-link {
- display: inline-block !important;
- color: #e61f1e;
- text-decoration: underline;
- }
- }
- </style>
|