login.vue 15.5 KB

<template>
  <div>
    <modal-comp :visible="modalVisiable" :show-confirm="false" :icon="modalIcon" :content="modalContent" :confirm="modalCallback" :overlay="modalCallback"></modal-comp>
    <modal-simple-comp :visible="modalSimpleVisiable" :show-confirm="false" :icon="modalIcon" :content="modalContent" :confirm="closeModal" :overlay="closeModal" :close="closeModal"></modal-simple-comp>
    <modal-upload-card-comp :visible="modalUploadCardVisiable" :show-confirm="true" :content="modalContent" :confirm="modalCallback" :overlay="modalCallback" :close="closeCallback"></modal-upload-card-comp>
    <!-- 会员协议 -->
    <modal-protocol-comp :visible="modalProtocolVisiable" :overlay="closeModal" :close="closeModal"></modal-protocol-comp>

    <div class="ebg"></div>
    <div class="content">
      <div class="top-space"></div>
      <div class="box">
        <!-- 帐密登陆 -->
        <div v-if="type == 1" class="login">
          <template v-if="!oneAccountCenterOff">
            <div class="login-tit">
              <img v-if="locale == 'zh'" src="@/assets/images/login/login-tit-zh.png">
              <img v-if="locale == 'tc'" src="@/assets/images/login/login-tit-tc.png">
              <img v-if="locale == 'en'" class="img-en" src="@/assets/images/login/login-tit-en.png">
            </div>
            <div class="login-nav">
              <div @click="onLoginTypeHandler(1)" class="login-nav-tit text-r pointer active">{{$t('login.loginType1')}}</div>
              <div class="login-nav-v-line"></div>
              <div @click="onLoginTypeHandler(2)" class="login-nav-tit pointer">{{$t('login.loginType2')}}</div>
            </div>
            <div class="gird-g form">
              <div class="pure-u-1 form-item">
                <div class="label">
                  <img src="@/assets/images/login/icon-login-user.png"> {{$t('login.account')}}
                </div>
                <div class="ipt-wrap">
                  <input v-model="loginForm.userId" :placeholder="$t('login.accountPlaceholder')" class="ipt" :class="{ err : errorTips.e1.length > 0 }" type="text" @blur="userIdLegalCheck">
                </div>
                <div class="validator" v-if="errorTips.e1.length > 0 ">
                  <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.e1}}
                </div>
              </div>
              <div class="pure-u-1 form-item">
                <div class="label">
                  <img src="@/assets/images/login/icon-login-password.png"> {{$t('login.password')}}
                </div>
                <div class="ipt-wrap">
                  <input v-model="loginForm.password" :placeholder="$t('login.passwordPlaceholder')" class="ipt" :class="{ err : errorTips.e2.length > 0 }" type="password">
                </div>
                <div class="validator" v-if="errorTips.e2.length > 0 ">
                  <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.e2}}
                </div>
              </div>
              <div class="pure-u-1 form-item" v-if="type == 1 && loginCheck.showImageCode">
                <div class="ipt-wrap">
                  <input :placeholder="$t('login.verifyPlaceholder')" class="ipt ipt-verify" :class="{ err : errorTips.e3.length > 0 }" type="text" v-model="loginForm.imageValue">
                  <div class="ipt verify-btn pointer vcode" @click="handlerRefreshImageValue">
                    <img :src="values.imageBase64">
                  </div>
                </div>
                <div class="validator" v-if="errorTips.e3.length > 0 ">
                  <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.e3}}
                </div>
              </div>
            </div>
            <div class="login-protocol pointer" :class="{loginLeft:locale!='en'}" @click="loginCheck.agreeProtocol = !loginCheck.agreeProtocol">
              <img v-if="!loginCheck.agreeProtocol" class="check" src="@/assets/images/login/uncheck.png">
              <img v-if="loginCheck.agreeProtocol" class="check" src="@/assets/images/login/check.png">{{$t('login.agree')}} &nbsp;
              <span @click="onProtocolHandler()" class="protocol pointer">{{$t('login.protocol')}}</span>
            </div>
            <div @click="handlerLogin()" class="login-submit pointer flex-center" :class="{disabled: pwdLoginDisabled}">
              <van-loading v-if="loading" />
              <span>{{$t('login.login')}}</span>
            </div>
            <div class="login-func">
              <div @click="toRegisterPage()" class="login-func-btn pointer">{{$t('login.register')}}</div>
              <div @click="onForgetHandler()" class="login-func-btn pointer">{{$t('login.forget')}}</div>
            </div>
          </template>
          <template v-else>


            <!-- 不接入一账通 -OTP登陆 -->
            <div class="login-nav">
              <div class="login-nav-tit text-c pointer active">{{$t('login.loginType1')}}</div>
            </div>
            <div class="gird-g form">
              <div class="pure-u-1 form-item">
                <div class="label">
                  <img src="@/assets/images/login/icon-login-user.png"> {{$t('login.account')}}
                </div>
                <div class="ipt-wrap">
                  <input v-model="loginForm.userId" :placeholder="$t('login.accountPlaceholder')" class="ipt" :class="{ err : errorTips.e1.length > 0 }" type="text" @blur="userIdLegalCheck">
                </div>
                <div class="validator" v-if="errorTips.e1.length > 0 ">
                  <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.e1}}
                </div>
              </div>
              <!-- <div class="pure-u-1 form-item">
                <div class="label">
                  <img src="@/assets/images/login/icon-login-password.png"> {{$t('login.password')}}
                </div>
                <div class="ipt-wrap">
                  <input v-model="loginForm.password" :placeholder="$t('login.passwordPlaceholder')" class="ipt" :class="{ err : errorTips.e2.length > 0 }" type="password">
                </div>
                <div class="validator" v-if="errorTips.e2.length > 0 ">
                  <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.e2}}
                </div>
              </div> -->
              <div class="pure-u-1 form-item">
                <div class="label">
                  <img src="@/assets/images/login/icon-login-phone.png"> {{$t('login.SMSVerificationCode')}}
                </div>
                <div class="ipt-wrap">
                  <div class="ipt ipt2" :class="{ err : errorTips.oe2.length > 0 }">
                    <input :placeholder="$t('login.verifyCodePlaceholder')" class="ipt-code" type="text" v-model="loginForm.otp">
                    <div v-if="times.remain == 0" class="veri-btn pointer" @click="sendOTPWhenOneAccountCenterOff">{{$t('register.verifyCodeGet')}}</div>
                    <div v-else class="veri-btn-default">{{times.tip}}</div>
                  </div>
                </div>
                <div class="validator" v-if="errorTips.oe2.length > 0 ">
                  <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.oe2}}
                </div>
              </div>
            </div>
            <div class="login-protocol pointer" :class="{loginLeft:locale!='en'}" @click="loginCheck.agreeProtocol = !loginCheck.agreeProtocol">
              <img v-if="!loginCheck.agreeProtocol" class="check" src="@/assets/images/login/uncheck.png">
              <img v-if="loginCheck.agreeProtocol" class="check" src="@/assets/images/login/check.png">{{$t('login.agree')}} &nbsp;
              <span @click="onProtocolHandler()" class="protocol pointer">{{$t('login.protocol')}}</span>
            </div>
            <div @click="pwdLoginWhenOneAccountCenterOff()" class="login-submit pointer flex-center" :class="{disabled: pwdLoginDisabledOneAccountCenterOff}">
              <van-loading v-if="loading" />
              <span>{{$t('login.login')}}</span>
            </div>
            <div class="login-func">
              <div @click="toRegisterPage()" class="login-func-btn pointer">{{$t('login.register')}}</div>
            </div>
          </template>
        </div>

        <!-- OTP登陆 -->
        <div v-if="type == 2" class="login">
          <div class="login-tit">
            <img v-if="locale == 'zh'" src="@/assets/images/login/login-tit-zh.png">
            <img v-if="locale == 'tc'" src="@/assets/images/login/login-tit-tc.png">
            <img v-if="locale == 'en'" class="img-en" src="@/assets/images/login/login-tit-en.png">
          </div>
          <div class="login-nav">
            <div @click="onLoginTypeHandler(1)" class="login-nav-tit text-r pointer"> {{$t('login.loginType1')}}</div>
            <div class="login-nav-v-line"></div>
            <div @click="onLoginTypeHandler(2)" class="login-nav-tit pointer active"> {{$t('login.loginType2')}}</div>
          </div>
          <div class="gird-g form">

            <!-- <div class="pure-u-1 form-item">
							<div class="ipt-wrap">
								<img class="down-arrow" src="@/assets/images/reservation/re-down-arrow.png" alt="">
								<select class="ipt" v-model="mobileNoType">
									<option v-for="(item,index) in mobileOptions" :key="index" :value="item.type">{{item.name}}</option>
								</select>
							</div>
						</div> -->
            <div class="pure-u-1 form-item">
              <div class="label">
                <img src="@/assets/images/login/icon-login-phone.png"> {{$t('login.mobile')}}
              </div>
              <div class="ipt-wrap">
                <div class="region-tel ipt-wrap">
                  <img class="down-arrow" src="@/assets/images/reservation/re-down-arrow.png" alt="">
                  <el-select class="ipt" v-model="mobileNoType">
                    <el-option v-for="(item,index) in mobileOptions" :key="index" :value="item.type" :label="item.areaCode"></el-option>
                  </el-select>
                </div>

                <div class="ipt ipt2" :class="{err : errorTips.oe1.length > 0}">
                  <input :placeholder="mobileTip.placeHolder" class="ipt-tel" type="text" :class="{ err : errorTips.oe1.length > 0 }" v-model="loginForm.mobileNo">
                </div>
              </div>
              <div class="validator" v-if="errorTips.oe1.length > 0 ">
                <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.oe1}}
              </div>
            </div>
            <!-- <div class="pure-u-1 form-item">
							<div class="label">
								<img src="@/assets/images/login/icon-login-phone.png"> {{$t('login.mobile')}}
							</div>
							<div class="ipt-wrap">
								<input :placeholder="$t('login.mobilePlaceholder')" class="ipt" type="text" :class="{ err : errorTips.oe1.length > 0 }" v-model="loginForm.mobileNo">
							</div>
							<div class="validator" v-if="errorTips.oe1.length > 0 ">
								<img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.oe1}}
							</div>
						</div> -->
            <div class="pure-u-1 form-item" v-if="type == 2 && loginCheck.showImageCode">
              <div class="ipt-wrap">
                <input :placeholder="$t('login.verifyPlaceholder')" class="ipt ipt-verify" :class="{ err : errorTips.oe3.length > 0 }" type="text" v-model="loginForm.imageValue">
                <div class="ipt verify-btn pointer vcode" @click="handlerRefreshImageValue">
                  <img :src="values.imageBase64">
                </div>
              </div>
              <div class="validator" v-if="errorTips.oe3.length > 0 ">
                <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.oe3}}
              </div>
            </div>
            <div class="pure-u-1 form-item">
              <div class="label">
                <img src="@/assets/images/login/icon-login-message.png"> {{$t('login.verifyCode')}}
              </div>
              <div class="ipt-wrap">
                <div class="ipt ipt2" :class="{ err : errorTips.oe2.length > 0 }">
                  <input :placeholder="$t('login.verifyCodePlaceholder')" class="ipt-code" type="text" v-model="loginForm.otp">
                  <div v-if="times.remain == 0" class="veri-btn pointer" @click="handlerStdSendOTP">{{$t('register.verifyCodeGet')}}</div>
                  <div v-else class="veri-btn-default">{{times.tip}}</div>
                </div>
              </div>
              <div class="validator" v-if="errorTips.oe2.length > 0 ">
                <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.oe2}}
              </div>
            </div>
          </div>
          <div class="login-protocol pointer" @click="loginCheck.agreeProtocol = !loginCheck.agreeProtocol">
            <img v-if="!loginCheck.agreeProtocol" class="check" src="@/assets/images/login/uncheck.png">
            <img v-if="loginCheck.agreeProtocol" class="check" src="@/assets/images/login/check.png"> {{$t('login.agree')}} &nbsp;
            <span @click="onProtocolHandler()" class="protocol pointer">{{$t('login.protocol')}}</span>
          </div>
          <div @click="handlerLogin()" class="login-submit pointer flex-center" :class="{disabled: otpLoginDisabled}">
            <van-loading v-if="loading" />
            <span>{{$t('login.login')}}</span>
          </div>
          <div class="login-func">
            <div @click="toRegisterPage()" class="login-func-btn pointer">{{$t('login.register')}}</div>
            <div @click="onForgetHandler()" class="login-func-btn pointer">{{$t('login.forget')}}</div>
          </div>
        </div>

        <!---->
        <div v-if="type == 3" class="login">
          <!-- <div class="login-tit">
						<img v-if="locale == 'zh'" src="@/assets/images/login/login-tit-zh.png">
						<img v-if="locale == 'tc'" src="@/assets/images/login/login-tit-tc.png">
						<img v-if="locale == 'en'" class="img-en" src="@/assets/images/login/login-tit-en.png">
					</div> -->

          <div class="login-tit2">{{$t('register.title2')}}</div>
          <div class="gird-g form">
            <div class="pure-u-1 form-item">
              <div class="label">
                <img src="@/assets/images/register/icon-register-lock.png"> {{$t('register.newPassword')}}
              </div>
              <div class="ipt-wrap">
                <input :placeholder="$t('register.newPasswordPlaceholder')" class="ipt" type="password" v-model="values.password">
              </div>
              <div class="validator" v-if="errorTips.p4.length > 0 ">
                <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.p4}}
              </div>
            </div>
            <div class="pure-u-1 form-item">
              <div class="label">
                <img src="@/assets/images/register/icon-register-lock.png"> {{$t('register.newPasswordSure')}}
              </div>
              <div class="ipt-wrap">
                <input :placeholder="$t('register.newPasswordSurePlaceholder')" class="ipt" type="password" v-model="values.passwordRepeat">
              </div>
              <div class="validator" v-if="errorTips.p5.length > 0 ">
                <img src="@/assets/images/common/icon-notice.png" alt="">{{errorTips.p5}}
              </div>
            </div>
          </div>
          <div @click="onRegisterHandler()" class="login-submit pointer flex-center" :class="{disabled: submitDisabled}">
            <van-loading v-if="loading" />
            <span>{{$t('register.sure')}}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script src="./login.js"></script>
<style lang="scss" scoped>
@import "./login.scss";
</style>