12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436 |
- <template>
- <div class="signin-container register-container" style="height: calc(100%)">
- <top-color v-show="false"></top-color>
- <div class="signin-box register-box">
- <!--注册-->
- <div v-if="!loginFlag" class="register-center">
- <div class="register-title">
- <span style="
- font-size: 18px;
- font-weight: bold;
- color: rgba(51, 51, 51, 1);
- ">{{ $t('login.zhuc') }}</span>
- <span v-if="registerFlag">{{ $t('login.existingAccounts') + '?'
- }}<span @click="returnLogin"
- style="cursor: pointer; color: #1d6ced; font-weight: 400">{{ $t('login.clickLogin') }}</span></span>
- </div>
- <el-form v-if="registerFlag" label-position="top" class="register-form" ref="registerForm" :model="registerForm"
- :rules="registerFormRules" auto-complete="on">
- <!-- 联系人/手机号 -->
- <div style="display: flex; justify-content: center">
- <el-form-item prop="linkmanName" :label="$t('login.register04')">
- <el-input v-model="registerForm.linkmanName" maxlength="20" :placeholder="$t('login.registerVerif04')" />
- </el-form-item>
- <el-form-item prop="linkmanPhone" :label="$t('login.register05')" style="margin-left: 20px">
- <el-input v-model="registerForm.linkmanPhone" maxlength="20" :placeholder="$t('login.registerVerif05')" />
- </el-form-item>
- </div>
- <!-- 密码 -->
- <el-form-item prop="password" :label="$t('login.register06')">
- <el-input v-model="registerForm.password" type="password" :placeholder="$t('login.verification01')" />
- </el-form-item>
- <!-- 确认密码 -->
- <el-form-item prop="confirmPassword" :label="$t('login.register07')">
- <el-input v-model="registerForm.confirmPassword" type="password"
- :placeholder="$t('login.verification01')" />
- </el-form-item>
- <!-- 验证码 -->
- <el-form-item prop="veriCode" :label="$t('login.register08')">
- <div style="display: flex; justify-content: space-between">
- <el-input v-model="registerForm.veriCode" :disabled="disabledFlag" class="code_style"
- :placeholder="$t('login.registerVerif08')" />
- <div>
- <ws-button v-show="verification" type="primary" @click="toSend">{{ $t('login.sendVerification') }}
- </ws-button>
- <ws-button v-show="!verification" class="retry" disabled>{{ $t('login.retry') }}({{ count }})s
- </ws-button>
- </div>
- </div>
- </el-form-item>
- <!-- 注册/取消按钮 -->
- <div style="display: flex; justify-content: space-between">
- <div style="width: 30%">
- <el-button :loading="loading" style="width: 100%" @click.native.prevent="handleCancel">
- {{ $t('button.cancel') }}
- </el-button>
- </div>
- <div style="width: 67%">
- <el-button :loading="registerLoading" type="primary" style="width: 100%"
- @click.native.prevent="handleRegister">{{ $t('login.register') }}</el-button>
- </div>
- </div>
- <!-- 描述 -->
- <div class="form-tip">
- {{ $t('login.registerTip') }}
- </div>
- </el-form>
- <!-- 注册完成的页面 -->
- <div v-if="!registerFlag" class="register-form">
- <div style="
- display: flex;
- justify-content: center;
- align-items: center;
- margin: 80px 0 40px;
- ">
- <i class="iconfont iconregisterOky" style="color: #1d6ced; font-size: 40px" />
- <span class="registerSuccess">
- {{ $t('login.registerSuccess') }}</span>
- </div>
- <p>{{ $t('login.PromptSuccessfulRegistration') }}</p>
- <el-button :loading="loading" class="registration-completed" @click.native.prevent="returnToLogin">
- {{ $t('login.complete') }}
- </el-button>
- </div>
- </div>
- <!--登录-->
- <div class="flex" v-if="loginFlag">
- <div>
- <img style="width: 591px" src="../../../public/img/transport.png" alt="" />
- </div>
- <!-- 登录框主体 -->
- <div class="login-box">
- <div class="login-head">
- <div class="logo" />
- </div>
- <div class="login-body">
- <!-- 快捷登录
- <el-form
- ref="loginForm2"
- class="fastLoginForm"
- :model="queryLoginForm"
- :rules="queryRules"
- auto-complete="on"
- hide-required-asterisk=true
- label-position="left"
- size="medium">
- <el-form-item prop="mobilePhone"
- class="userCellPhone" label='+86'>
- <el-input v-model="queryLoginForm.mobilePhone"
- :placeholder="$t('login.select03')" />
- </el-form-item>
- <el-form-item prop="veriCode"
- class="veriCode">
- <div>
- <el-input v-model="queryLoginForm.veriCode"
- :placeholder="$t('login.select04')" />
- </div>
- <div>
- <el-button style="width: 30%;border-radius: 20px;"
- v-if="showVerification"
- type="primary"
- @click="fastSendVerification">{{ $t('login.sendVerification') }}</el-button>
- <el-button style="width: 30%;border-radius: 20px;"
- v-if="!showVerification"
- disabled>{{ $t('login.retry') }}({{ count }})s</el-button>
- </div>
- </el-form-item>
- <el-button :loading="loading"
- type="primary"
- class="phone-signIn"
- @click.native.prevent="handleFastLogin">{{ $t('login.login') }}</el-button>
- </el-form> -->
- <ul>
- <!-- <li @click="
- tabsOne = false
- $refs['loginForm2'].resetFields()
- " :class="{ selected: !tabsOne }">
- {{ $t('login.fastLogin') }}
- </li>
- <li @click="
- tabsOne = true
- $refs['loginForm'].resetFields()
- " :class="{ selected: tabsOne }">
- {{ $t('login.noLogin') }}
- </li> -->
- </ul>
- <el-form v-show="tabsOne" ref="loginForm" :model="loginForm" :rules="getFormRules" auto-complete="on"
- label-position="left">
- <el-form-item prop="companyName">
- <!-- <el-input v-model="loginForm.companyName" :placeholder="$t('login.verification08')" /> -->
- <el-select v-model="loginForm.companyName" filterable placeholder="请选择" class="comp-select">
- <el-option v-for="item in compOptionList" :key="item.compName" :label="item.compName" :value="item.compName">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item prop="username">
- <el-input ref="username" v-model="loginForm.username" :placeholder="$t('login.select01')"
- name="username" type="text" auto-complete="on" />
- </el-form-item>
- <el-form-item prop="password" style="margin-bottom: 20px">
- <el-input :key="passwordType" ref="password" v-model="loginForm.password" :type="passwordType"
- :placeholder="$t('login.select02')" name="password" auto-complete="on"
- @keyup.enter.native="handleLogin" />
- <span class="show-pwd" @click="showPwd">
- <i class="iconfont" :class="
- passwordType === 'password'
- ? 'iconbukejian'
- : 'iconkejian'
- " />
- </span>
- </el-form-item>
- <el-row>
- <div class="remember-information">
- <el-checkbox v-model="rememberMe" class="fl">
- <span>{{
- $t('login.rememberPwd')
- }}</span>
- </el-checkbox>
- <!-- <div class="fr pointer forget-pwd">
- <LangSelectText />
- <span style="margin: 0 5px">|</span>
- <span @click="forgetPassword">{{
- $t('login.forgetPwd')
- }}</span>
- </div> -->
- </div>
- </el-row>
- <div class="sign_up">
- <el-button :loading="loading" type="primary" class="signIn-buttom" @click.native.prevent="handleLogin">
- {{ $t('login.login') }}
- </el-button>
- <!-- <span class="register-buttom" @click="toRegister">{{
- $t('login.register')
- }}</span> -->
- </div>
- </el-form>
- <!-- 快捷登录 -->
- <el-form v-show="!tabsOne" ref="loginForm2" class="fastLoginForm" :model="queryLoginForm"
- :rules="queryRules" auto-complete="on" label-position="left">
- <el-form-item prop="mobilePhone" class="userCellPhone">
- <el-input v-model="queryLoginForm.mobilePhone" :placeholder="$t('login.select03')" />
- </el-form-item>
- <el-form-item prop="veriCode" class="veriCode">
- <div>
- <el-input v-model="queryLoginForm.veriCode" :placeholder="$t('login.select04')" />
- </div>
- <div>
- <el-button style="width: 30%; border-radius: 20px" v-if="showVerification" type="primary"
- @click="fastSendVerification">{{ $t('login.sendVerification') }}</el-button>
- <el-button style="width: 30%; border-radius: 20px" v-if="!showVerification" disabled>
- {{ $t('login.retry') }}({{ count }})s
- </el-button>
- </div>
- </el-form-item>
- <el-button :loading="loading" type="primary" class="phone-signIn" @click.native.prevent="handleFastLogin">
- {{ $t('login.login') }}
- </el-button>
- </el-form>
- <div class="make-easier">
- <!-- <p>{{ $t('common.makeEasier') }}</p> -->
- <!-- <BaseLink @click="goBackstage" :underline="false" type="primary">
- {{ $t('common.goBackstage') }}
- </BaseLink> -->
- </div>
- </div>
- </div>
- </div>
- </div>
- <!--忘记密码消息弹框盒子-->
- <el-dialog class="dialog" :title="$t('login.retrievePassword')" @close="resetForm" :visible.sync="messageBox"
- width="30%" center>
- <!--弹框主体-->
- <el-form ref="forgetDate" :model="forgetDate" :rules="getforgetRules" label-width="100px">
- <el-form-item :label="$t('login.phoneNumber') + $t('common.colon')" prop="userCellPhone" class="userCellPhone">
- <div style="display: flex">
- <el-input v-model="forgetDate.userCellPhone" :placeholder="$t('login.select03')" />
- <div class="time-button ml10">
- <el-button v-show="showVerification" type="primary" @click="sendVerification">
- {{ $t('login.sendVerification') }}
- </el-button>
- <el-button v-show="!showVerification" class="retry" disabled>{{ $t('login.retry') }}({{ count }})s
- </el-button>
- </div>
- </div>
- </el-form-item>
- <el-form-item :label="$t('login.verificationCode') + $t('common.colon')" prop="veriCode">
- <el-input v-model="forgetDate.veriCode" :placeholder="$t('login.select04')" />
- </el-form-item>
- <el-form-item :label="$t('login.newPassword') + $t('common.colon')" prop="password">
- <el-input v-model="forgetDate.password" :placeholder="$t('login.select05')" />
- </el-form-item>
- <el-form-item :label="$t('login.confirmPassword') + $t('common.colon')" prop="againPassword">
- <el-input v-model="forgetDate.againPassword" :placeholder="$t('login.select06')" />
- </el-form-item>
- </el-form>
- <!--弹框底部-->
- <span slot="footer" class="dialog-footer">
- <el-button @click="resetForm">{{ $t('showMessage.cancel') }}</el-button>
- <el-button type="primary" @click="submitForm">{{
- $t('showMessage.saveButton')
- }}</el-button>
- </span>
- </el-dialog>
- <!-- 试用到期/停用 -->
- <trialDialog v-if="trialDialog" :phone="phone" :trialDialog="trialDialog" @close="trialDialogClose"></trialDialog>
- <stopDialog v-if="stopDialog" :phone="phone" :stopDialog="stopDialog" @close="stopDialogClose"></stopDialog>
- <verifyDialog v-if="verifyDialog" :phone="phone" :verifyDialog="verifyDialog" @close="verifyDialogClose">
- </verifyDialog>
- <agreementDialog v-if="dialogAgreement" @close="agreementClose">
- </agreementDialog>
- <!-- 服务协议 -->
- <el-dialog :visible.sync="dialogService" width="35%" custom-class="service" :showClose="true"
- :before-close="serviceClose" :closeOnClickModal="true" :appendToBody="true">
- <serviceDialog @close="serviceClose"></serviceDialog>
- </el-dialog>
- </div>
- </template>
- <script>
- import Cookies from 'js-cookie'
- import zhJs from '../../lang/zh'
- import {
- validPassword,
- validUserCellPhone,
- validUserVeriCode,
- } from '@/utils/validate'
- // 客服
- import serviceDialog from './components/serviceDialog'
- // 服务协议
- import agreementDialog from './components/agreementDialog'
- // 试用到期
- import trialDialog from './components/trialDialog'
- // 停用
- import stopDialog from './components/stopDialog'
- //待核实
- import verifyDialog from './components/verifyDialog'
- import {
- register
- } from '@/model/signIn/index'
- import {
- retrievePassword,
- sendVeriCode,
- sendRegisterCode,
- getTenantInfoByUser,
- getcompList,
- } from '@/model/signIn/index'
- import {
- EventBus
- } from 'base-core-lib'
- import LangSelectText from '@/components/LangSelectText'
- import topColor from '@/layout/index/top/top-color'
- import {
- mapActions,
- mapGetters
- } from 'vuex'
- export default {
- name: 'Login',
- filters: {
- phoneFilter(val) {
- const reg = /^(.{3}).*(.{4})$/
- return val.replace(reg, '$1****$2')
- },
- },
- components: {
- LangSelectText,
- trialDialog,
- stopDialog,
- verifyDialog,
- agreementDialog,
- serviceDialog,
- topColor,
- },
- data() {
- const validPasswordRule = (rule, value, callback) => {
- if (!validPassword(value)) {
- callback(new Error(this.$t('login.verification01')))
- } else {
- callback()
- }
- }
- const validPasswordRule2 = (rule, value, callback) => {
- if (value === '') {
- callback(new Error(this.$t('login.verification02')))
- } else if (value !== this.forgetDate.password) {
- callback(new Error(this.$t('login.verification03')))
- } else {
- callback()
- }
- }
- const validUserVeriCodeRule = (rule, value, callback) => {
- if (!validUserVeriCode(value)) {
- callback(new Error(this.$t('login.verification04')))
- } else {
- callback()
- }
- }
- const validUserCellPhoneRule = (rule, value, callback) => {
- if (!validUserCellPhone(value)) {
- callback(new Error(this.$t('login.verification05')))
- } else {
- callback()
- }
- }
- return {
- compOptionList: [],
- compValue: '黑龙江中天昊元贸易有限公司',
- dialogService: false, //客服
- dialogAgreement: false, //服务协议
- phone: '',
- verifyDialog: false,
- stopDialog: false,
- trialDialog: false, //试用到期/试用未到期
- registerLoading: false,
- verification: true,
- disabledFlag: true,
- loginFlag: true,
- registerFlag: true,
- registerFormRules: {
- tenantName: [{
- required: true,
- message: this.$t('login.registerVerif01'),
- trigger: 'blur',
- }, ],
- tenantEnName: [{
- required: true,
- message: this.$t('login.registerVerif02'),
- trigger: 'blur',
- }, ],
- compSimpleNameEn: [{
- required: true,
- message: this.$t('login.registerVerif03'),
- trigger: 'blur',
- }, ],
- linkmanName: [{
- required: true,
- message: this.$t('login.registerVerif04'),
- trigger: 'blur',
- }, ],
- linkmanPhone: [{
- required: true,
- trigger: 'blur',
- validator: validUserCellPhoneRule.bind(this),
- }, ],
- password: [{
- required: true,
- trigger: 'blur',
- validator: validPasswordRule,
- // validator: validPasswordRule4.bind(this)
- }, ],
- confirmPassword: [{
- required: true,
- trigger: 'blur',
- validator: validPasswordRule,
- // validator: validPasswordRule3.bind(this)
- }, ],
- veriCode: [{
- required: true,
- trigger: 'blur',
- validator: validUserVeriCodeRule.bind(this),
- }, ],
- },
- // 注册表单
- registerForm: {
- tenantName: '',
- tenantEnName: '',
- compSimpleNameEn: '',
- tenantSource: '1',
- linkmanName: '',
- linkmanPhone: '',
- password: '',
- confirmPassword: '',
- veriCode: '',
- },
- tabsOne: true,
- zhArray: [], //国际化数组
- timer: null,
- loading: false,
- rememberMe: true,
- showDialog: false,
- showVerification: true,
- messageBox: false,
- passwordType: 'password',
- count: '',
- userCellPhone: '',
- userKind: '',
- forgetDate: {
- userCellPhone: '',
- password: '',
- againPassword: '',
- veriCode: '',
- },
- loginForm: {
- username: '',
- password: '',
- companyName: '', // 公司域名
- },
- queryLoginForm: {
- mobilePhone: '',
- veriCode: '',
- },
- queryRules: {
- mobilePhone: [{
- required: true,
- validator: validUserCellPhoneRule,
- trigger: 'change',
- }, ],
- veriCode: [{
- required: true,
- trigger: 'blur',
- validator: validUserVeriCodeRule,
- }, ],
- },
- companyLogoUrl: '',
- companyName: '',
- getforgetRules: {
- userCellPhone: [{
- required: true,
- trigger: 'blur',
- validator: validUserCellPhoneRule,
- }, ],
- veriCode: [{
- required: true,
- trigger: 'blur',
- validator: validUserVeriCodeRule,
- }, ],
- password: [{
- required: true,
- trigger: 'blur',
- validator: validPasswordRule,
- }, ],
- againPassword: [{
- required: true,
- trigger: 'blur',
- validator: validPasswordRule2,
- }, ],
- },
- getFormRules: {
- username: [{
- required: true,
- message: this.$t('login.verification06'),
- trigger: 'change',
- }, ],
- password: [{
- required: true,
- trigger: 'change',
- validator: validPasswordRule,
- // validator: validPasswordRule4.bind(this)
- }, ],
- companyName: {
- required: true,
- message: this.$t('login.verification08'),
- trigger: 'change',
- },
- },
- }
- },
- computed: {
- ...mapGetters(['systemVersion']),
- },
- mounted() {
- this.loginForm.companyName = Cookies.get('ws_login_companyShortName') ?
- Cookies.get('ws_login_companyShortName') :
- ''
- this.loginForm.username = Cookies.get('ws_login_account') ?
- Cookies.get('ws_login_account') :
- ''
- this.loginForm.password = Cookies.get('ws_login_pwd') ?
- Cookies.get('ws_login_pwd') :
- ''
- this.rememberMe = Cookies.get('ws_login_rememberMe') === '1'
- localStorage.setItem('ws_login_type', 2)
- const arr = JSON.parse(JSON.stringify(zhJs))
- this.loop(arr, null)
- if (this.loginForm.username === '') {
- this.$refs.username.focus()
- } else if (this.loginForm.password === '') {
- this.$refs.password.focus()
- }
- this.compList()
- },
- watch: {
- loginFlag(value) {
- if (value) {
- this.loginForm.domainName = Cookies.get('compSimpleName')
- this.loginForm.username = Cookies.get('phone')
- }
- },
- },
- methods: {
- ...mapActions('user', ['login', 'fastLogin']),
- async getTenantUser() {
- let newList = {
- companyName: this.loginForm.companyName,
- username: this.loginForm.username,
- password: this.loginForm.password,
- }
- const response = await getTenantInfoByUser(newList).toPromise()
- return response
- },
- compList() {
- getcompList()
- .toPromise()
- .then((res) => {
- console.log('公司下拉列表数据',res)
- this.compOptionList = res
-
- })
- .catch((err) => {})
- },
- serviceClose() {
- this.dialogService = false
- },
- agreementClose() {
- this.dialogAgreement = false
- },
- verifyDialogClose() {
- this.verifyDialog = false
- },
- // 停用
- stopDialogClose() {
- this.stopDialog = false
- },
- // 试用
- trialDialogClose() {
- this.trialDialog = false
- },
- goHome() {
- window.open('http://www.yinghaikeji.com', '_blank')
- },
- goRecordNum() {
- window.open('http://beian.miit.gov.cn', '_blank')
- },
- returnLogin() {
- this.$nextTick(function() {
- this.$refs.registerForm.resetFields()
- })
- clearInterval(this.timer)
- this.loginFlag = true
- },
- // 发送验证码
- toSend() {
- if (this.registerForm.linkmanPhone) {
- if (validUserCellPhone(this.registerForm.linkmanPhone)) {
- this.disabledFlag = false
- clearInterval(this.timer)
- this.timer = null
- const TIME_COUNT = 60
- if (!this.timer) {
- this.count = TIME_COUNT
- this.verification = false
- let data = {
- mobilePhone: this.registerForm.linkmanPhone,
- }
- sendRegisterCode(data)
- .toPromise()
- .then((res) => {
- this.timer = setInterval(() => {
- if (this.count > 0 && this.count <= TIME_COUNT) {
- this.count--
- } else {
- this.verification = true
- clearInterval(this.timer)
- this.timer = null
- }
- }, 1000)
- })
- .catch((err) => {
- this.verification = true
- })
- }
- } else {
- EventBus.$emit('error', this.$t('login.registerVerif09'))
- }
- } else {
- EventBus.$emit('error', this.$t('login.registerVerif05'))
- }
- },
- // 取消
- handleCancel() {
- clearInterval(this.timer)
- this.$nextTick(function() {
- this.$refs.registerForm.resetFields()
- })
- this.loginFlag = true
- },
- // 注册
- handleRegister() {
- this.$refs.registerForm.validate((valid) => {
- if (valid) {
- this.registerLoading = true
- register({
- ...this.registerForm,
- tenantName: this.registerForm.compSimpleNameEn,
- tenantEnName: this.registerForm.compSimpleNameEn,
- })
- .toPromise()
- .then((res) => {
- Cookies.set('compSimpleName', this.registerForm.compSimpleNameEn)
- Cookies.set('phone', this.registerForm.linkmanPhone)
- this.registerFlag = false
- this.registerLoading = false
- })
- .catch((error) => {
- this.registerLoading = false
- })
- } else {
- return false
- }
- })
- },
- toManage() {
- window.location.href = this.$store.getters.baseInfo.comanyMgrUrl
- },
- returnToLogin() {
- this.loginFlag = true
- },
- toRegister() {
- this.disabledFlag = true
- this.verification = true
- this.registerFlag = true
- this.$nextTick(function() {
- this.$refs.registerForm.resetFields()
- })
- clearInterval(this.timer)
- this.loginFlag = false
- },
- goBackstage() {
- // window.location.href = this.$store.getters.baseInfo.comanyMgrUrl
- },
- /* 忘记密码*/
- forgetPassword() {
- this.showVerification = true
- this.messageBox = true
- },
- /* 点击取消*/
- resetForm() {
- this.messageBox = false
- this.forgetDate.userCellPhone = ''
- this.forgetDate.veriCode = ''
- this.forgetDate.password = ''
- this.forgetDate.againPassword = ''
- this.$refs.forgetDate.resetFields()
- },
- /* 点击保存*/
- submitForm() {
- this.$refs.forgetDate.validate((valid) => {
- if (valid) {
- const data = {
- mobilePhone: this.forgetDate.userCellPhone,
- veriCode: this.forgetDate.veriCode,
- password: this.forgetDate.againPassword,
- }
- retrievePassword(data)
- .toPromise()
- .then((response) => {
- EventBus.$emit(
- 'success',
- this.$t('showMessage.modifySuccessfully')
- )
- this.messageBox = false
- })
- .catch((error) => {
- if (error.code === 'AUTH_004') {
- EventBus.$emit('error', this.$t('message.AUTH_004'))
- this.forgetDate.veriCode = ''
- } else if (error.code === 'AUTH_006') {
- EventBus.$emit('error', this.$t('message.AUTH_006'))
- this.forgetDate.againPassword = ''
- this.forgetDate.password = ''
- }
- })
- } else {
- EventBus.$emit('error', this.$t('showMessage.failToSave'))
- return false
- }
- })
- },
- /* 点击发送验证码*/
- sendVerification() {
- if (this.forgetDate.userCellPhone === '') {
- EventBus.$emit('error', this.$t('login.registerVerif05'))
- } else {
- clearInterval(this.timer)
- this.timer = null
- const TIME_COUNT = 60
- if (!this.timer) {
- this.count = TIME_COUNT
- this.showVerification = false
- this.postVerification()
- this.timer = setInterval(() => {
- if (this.count > 0 && this.count <= TIME_COUNT) {
- this.count--
- } else {
- this.showVerification = true
- clearInterval(this.timer)
- this.timer = null
- }
- }, 1000)
- }
- }
- },
- /* 发送验证码*/
- postVerification() {
- sendVeriCode({
- mobilePhone: this.forgetDate.userCellPhone
- })
- .toPromise()
- .then((response) => {})
- },
- /* 点击发送验证码*/
- fastSendVerification() {
- if (!this.queryLoginForm.mobilePhone) {
- EventBus.$emit('error', this.$t('login.verification05'))
- return
- }
- clearInterval(this.timer)
- this.timer = null
- const TIME_COUNT = 60
- if (!this.timer) {
- this.count = TIME_COUNT
- this.showVerification = false
- this.fastPostVerification()
- this.timer = setInterval(() => {
- if (this.count > 0 && this.count <= TIME_COUNT) {
- this.count--
- } else {
- this.showVerification = true
- clearInterval(this.timer)
- this.timer = null
- }
- }, 1000)
- }
- },
- /* 快捷登录发送验证码*/
- fastPostVerification() {
- sendVeriCode({
- mobilePhone: this.queryLoginForm.mobilePhone
- })
- .toPromise()
- .then((response) => {})
- // .catch(error => {
- // if (error.code === 'AUTH_003') {
- // EventBus.$emit('error', this.$t('message.AUTH_003'))
- // }
- // })
- },
- showPwd() {
- if (this.passwordType === 'password') {
- this.passwordType = ''
- } else {
- this.passwordType = 'password'
- }
- this.$nextTick(() => {
- this.$refs.password.focus()
- })
- },
- handleLogin() {
- this.$refs.loginForm.validate(async (valid) => {
- if (valid) {
- const res = await this.login(this.loginForm)
- localStorage.setItem('ws_login_type', 2)
- Cookies.set('ws_login_companyShortName', this.loginForm.companyName, {
- expires: 365,
- })
- Cookies.set('ws_login_account', this.loginForm.username, {
- expires: 365,
- })
- if (this.rememberMe) {
- Cookies.set('ws_login_pwd', this.loginForm.password, {
- expires: 365,
- })
- Cookies.set('ws_login_rememberMe', 1, {
- expires: 365
- })
- } else {
- Cookies.remove('ws_login_companyShortName')
- Cookies.remove('ws_login_account')
- Cookies.remove('ws_login_pwd')
- Cookies.set('ws_login_rememberMe', 0, {
- expires: 365
- })
- }
- const redirect = this.$route.query.redirect
- if (redirect) {
- this.$router.push(redirect)
- } else {
- this.$router.push('/')
- }
- const data = await this.getTenantUser()
- localStorage.setItem(
- 'ws_login_getTenantInfoByUser',
- JSON.stringify({
- ...data,
- loginInfo: res
- })
- )
- localStorage.setItem(
- 'ws_login_accountId',
- JSON.stringify(res.accountId)
- )
- } else {
- return false
- }
- })
- },
- loop(arr, father) {
- for (let i in arr) {
- if (typeof arr[i] == 'object') {
- if (father) {
- this.loop(arr[i], father + '.' + i)
- } else {
- this.loop(arr[i], i)
- }
- } else {
- let obj = {
- key: father + '.' + i,
- value: arr[i],
- }
- this.zhArray.push(obj)
- }
- }
- localStorage.setItem(
- 'InterNational_zh_array',
- JSON.stringify(this.zhArray)
- )
- },
- // 快捷登录
- handleFastLogin() {
- this.$refs['loginForm2'].validate(async (valid) => {
- if (valid) {
- const res = await this.fastLogin(this.queryLoginForm)
- localStorage.setItem('ws_login_type', 2)
- const redirect = this.$route.query.redirect
- if (redirect) {
- this.$router.push(redirect)
- } else {
- this.$router.push('/')
- }
- const {
- data
- } = await this.getTenantUser()
- localStorage.setItem(
- 'ws_login_getTenantInfoByUser',
- JSON.stringify({
- ...data,
- loginInfo: res
- })
- )
- localStorage.setItem(
- 'ws_login_accountId',
- JSON.stringify(res.accountId)
- )
- }
- })
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- $svg: #a7a8a9;
- $dark_gray: #889aa4;
- .signin-container {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- min-height: 100%;
- width: 100%;
- background-repeat: no-repeat;
- background-position: center center;
- background-size: cover;
- overflow: hidden;
- .register-center {
- .register-title {
- padding-bottom: 20px;
- border-bottom: 1px solid #ccc;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .register-form {
- padding: 20px 30px;
- .form-tip {
- margin-top: 20px;
- color: #999999;
- font-size: 12px;
- }
- p {
- font-size: 14px;
- color: #333333;
- padding-bottom: 100px;
- line-height: 24px;
- }
- .registration-completed {
- width: 100%;
- border: 1px solid #1e6ced;
- background-color: #edf4ff;
- color: #1e6ced;
- }
- }
- /deep/ .el-form-item.is-required:not(.is-no-asterisk)>.el-form-item__label:before,
- .el-form-item.is-required:not(.is-no-asterisk) .el-form-item__label-wrap>.el-form-item__label:before {
- content: '';
- }
- /deep/ .el-form-item__content {
- line-height: 32px;
- }
- /deep/ .el-form-item__error {
- padding: 2px;
- }
- /deep/ .el-form-item__label {
- line-height: 12px;
- }
- /deep/ .el-input__inner {
- height: 34px;
- }
- /deep/ .el-form-item {
- margin-bottom: 20px;
- }
- .code_style {
- /*/deep/ .el-input{*/
- width: 65% !important;
- /*}*/
- }
- max-width: 480px;
- margin: 0 auto;
- width: 100%;
- background-color: #fff;
- padding: 20px;
- border-radius: 8px;
- .login-title {
- font-size: 26px;
- text-align: center;
- padding: 2%;
- color: #666;
- margin-bottom: 10%;
- display: inline-block;
- }
- .remember-information {
- cursor: pointer;
- padding-bottom: 50px;
- .forget-pwd {
- display: inline-block;
- white-space: nowrap;
- color: #999;
- font-size: 12px;
- line-height: 19px;
- }
- }
- .svg-container {
- color: $svg;
- width: 30px;
- position: absolute;
- height: 32px;
- line-height: 32px;
- border-radius: 8px;
- top: 0;
- left: 0;
- z-index: 9;
- }
- .show-pwd {
- position: absolute;
- right: 14px;
- top: 0;
- font-size: 16px;
- color: $dark_gray;
- cursor: pointer;
- user-select: none;
- }
- }
- .login-box {
- width: 420px;
- display: flex;
- flex-direction: column;
- .login-head {
- display: flex;
- flex-direction: column;
- align-items: center;
- color: #fff;
- font-size: 16px;
- .logo {
- background-image: url('../../../public/img/logo.png');
- background-position: center center;
- background-repeat: no-repeat;
- width: 260px;
- height: 68px;
- background-size: 100% 100%;
- }
- &>span {
- text-align: center;
- }
- }
- .login-body {
- display: flex;
- padding: 5px 30px 15px;
- flex-direction: column;
- align-items: center;
- height: 410px;
- z-index: 1000;
- position: relative;
- &>ul {
- color: #fff;
- width: 100%;
- list-style: none;
- display: flex;
- flex-direction: row;
- flex-wrap: nowrap;
- justify-content: center;
- padding: 0;
- margin: 0 0 32px 0;
- li {
- padding: 10px 0px;
- cursor: pointer;
- font-size: 18px;
- &:nth-child(1) {
- margin-right: 40px;
- }
- }
- .selected {
- border-bottom: 2px solid #fff;
- font-weight: 600;
- }
- }
- &>form {
- align-self: center;
- width: 100%;
- /deep/.el-input__inner {
- text-indent: 12px;
- background-color: transparent;
- border-left: none;
- border-top: none;
- border-right: none;
- border-radius: 0;
- border: 1px solid #e5e8ed!important;
- color: #000;
- padding: 0;
- padding: 5px 10px;
- border-radius: 30px;
- }
- /deep/ .el-input__inner::-webkit-input-placeholder {
- color: #e5e8ed;
- font-weight: bold;
- }
- /deep/.userCellPhone {
- position: relative;
- .el-form-item__label {
- position: absolute;
- top: 12px;
- left: 9px;
- }
- .el-input__inner {
- text-indent: 34px !important;
- }
- }
- }
- & .fastLoginForm {
- margin-top: 38px;
- }
- .qiye {
- background-image: url('../../assets/images/page/login/qiye.png');
- background-repeat: no-repeat;
- background-position: center center;
- background-size: 55%;
- }
- .veriCode {
- position: relative;
- & /deep/.el-form-item__content {
- display: flex;
- flex-direction: row;
- &>div:nth-child(1) {
- width: 100%;
- }
- &>div:nth-child(2) {
- width: 36%;
- margin-left: 15px;
- position: absolute;
- right: 1px;
- & .el-button {
- width: 100% !important;
- background: #fff;
- border: 1px solid #fff;
- color: #7cbe25;
- span {
- border-left: 1px solid #e9ecf0;
- padding: 0 20px;
- }
- }
- }
- }
- }
- .remember-information {
- cursor: pointer;
- padding-bottom: 50px;
- .forget-pwd {
- display: inline-block;
- white-space: nowrap;
- // color: #fff;
- font-size: 12px;
- line-height: 19px;
- }
- }
- .svg-container {
- color: #a7a8a9;
- width: 30px;
- position: absolute;
- height: 32px;
- line-height: 32px;
- border-radius: 8px;
- top: 0;
- left: 0;
- z-index: 9;
- text-align: center;
- }
- .show-pwd {
- position: absolute;
- right: 14px;
- top: 0;
- font-size: 16px;
- color: #889aa4;
- cursor: pointer;
- user-select: none;
- }
- .make-easier {
- display: flex;
- color: #fff;
- font-size: 12px;
- text-align: center;
- line-height: 32px;
- p {
- margin: 0;
- }
- span {
- display: block;
- color: #4489f9;
- cursor: pointer;
- font-weight: 600;
- }
- }
- }
- }
- .login-footer {
- text-align: center;
- color: #9a9a9a;
- padding: 2% 0;
- font-size: 12px;
- min-width: 456px;
- &>ul {
- display: flex;
- margin: 0;
- padding: 0;
- width: 100%;
- list-style: none;
- flex-direction: row;
- justify-content: center;
- padding: 0 120px;
- li {
- padding: 0px 20px;
- border-right: 1px solid #9a9a9a;
- // cursor: pointer;
- }
- // TODO:英文还没有设计好先不上
- // li:hover {
- // color: #4489f9;
- // }
- &>li:last-child {
- border-right: none;
- }
- }
- .nav {
- display: flex;
- flex-direction: row;
- justify-content: center;
- }
- .copyright {
- padding: 5px 0;
- }
- .version {
- font-weight: bold;
- padding: 4% 0;
- display: block;
- color: #666;
- font-size: 15px;
- }
- .project-name {
- font-weight: 600;
- font-size: 16px;
- }
- }
- }
- .register-container {
- overflow: auto;
- .register-box {
- margin: 20px 0;
- }
- .signin-box {
- z-index: 100;
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- }
- .login-box {
- width: 420px;
- margin: 0 auto;
- }
- @-webkit-keyframes animate-cloud {
- from {
- background-position: 600px 100%;
- }
- to {
- background-position: 0 100%;
- }
- }
- @-moz-keyframes animate-cloud {
- from {
- background-position: 600px 100%;
- }
- to {
- background-position: 0 100%;
- }
- }
- @-ms-keyframes animate-cloud {
- from {
- background-position: 600px 100%;
- }
- to {
- background-position: 0 100%;
- }
- }
- @-o-keyframes animate-cloud {
- from {
- background-position: 600px 100%;
- }
- to {
- background-position: 0 100%;
- }
- }
- //新增
- .sign_up {
- text-align: center;
- width: 100%;
- .signIn-buttom {
- width: 75%;
- margin-bottom: 10px;
- border-radius: 20px;
- }
- .register-buttom {
- width: 15%;
- margin: 0 auto;
- // color: #fff;
- display: block;
- text-align: center;
- font-size: 12px;
- cursor: pointer;
- }
- }
- .phone-signIn {
- width: 100%;
- border-radius: 20px;
- display: block;
- margin: 0 auto;
- background: #7cbe25;
- color: #fff;
- border: 1px solid #7cbe25;
- padding: 20px !important;
- line-height: 2px;
- }
- .registerSuccess {
- font-size: 30px;
- height: 28px;
- margin-left: 9px;
- line-height: 24px;
- font-weight: bold;
- color: rgb(51, 51, 51);
- }
- /deep/ .service {
- border-radius: 7px !important;
- /deep/ .el-dialog__header {
- display: none;
- }
- /deep/ .el-dialog__body {
- padding: 0 !important;
- }
- }
- .signin-box {
- >>>.el-form-item__label {
- line-height: 12px !important;
- }
- }
- .comp-select{
- width: 100%;
-
- }
- </style>
|