|
@@ -0,0 +1,237 @@
|
|
|
+<script setup>
|
|
|
+import { useTemplateRef } from "vue"
|
|
|
+import {apiSystemCommon} from '@/api/system'
|
|
|
+import { useRouter } from "vue-router"
|
|
|
+import {useUserInfo} from '@/hooks/userInfo'
|
|
|
+
|
|
|
+const {setToken}=useUserInfo()
|
|
|
+const router=useRouter()
|
|
|
+
|
|
|
+//图形验证码
|
|
|
+const imgCodeUrl=ref('')
|
|
|
+let imgCodeId=''
|
|
|
+async function getImgCode(){
|
|
|
+ const res=await apiSystemCommon.getImgCode()
|
|
|
+ if(res.Ret!==200) return
|
|
|
+ imgCodeUrl.value=res.Data.Base64Blob
|
|
|
+ imgCodeId=res.Data.Id
|
|
|
+}
|
|
|
+getImgCode()
|
|
|
+
|
|
|
+// 手机号区号
|
|
|
+const telCodeOpts = ref([])
|
|
|
+async function getMobileAreaCode(){
|
|
|
+ const res=await apiSystemCommon.getMobileAreaCode()
|
|
|
+ if(res.Ret!==200) return
|
|
|
+ telCodeOpts.value=res.Data||[]
|
|
|
+ if(telCodeOpts.value.length>0){
|
|
|
+ formData.telCode=telCodeOpts.value[0].Value
|
|
|
+ }
|
|
|
+}
|
|
|
+getMobileAreaCode()
|
|
|
+
|
|
|
+const keepLogin=ref(false)
|
|
|
+const FORM_RULES = {
|
|
|
+ telVerifyCode: [{ required: true, message: '请输入验证码' }],
|
|
|
+ tel:[{ required: true, message: '请输入手机号' }],
|
|
|
+ imgVerifyCode:[{ required: true, message: '请输入图像验证码' }],
|
|
|
+};
|
|
|
+const formData = reactive({
|
|
|
+ tel: '',
|
|
|
+ telCode: '',
|
|
|
+ telVerifyCode: '',
|
|
|
+ imgVerifyCode: '',
|
|
|
+})
|
|
|
+
|
|
|
+const formIns=useTemplateRef('formIns')
|
|
|
+async function onSubmit(){
|
|
|
+ const validate=await formIns.value.validate()
|
|
|
+ if(validate!==true) return
|
|
|
+
|
|
|
+ const res=await apiSystemCommon.userLogin({
|
|
|
+ VerifyCode:formData.telVerifyCode,
|
|
|
+ Mobile:formData.tel,
|
|
|
+ TelAreaCode:formData.telCode,
|
|
|
+ IsRemember:Number(keepLogin.value)
|
|
|
+ })
|
|
|
+ if(res.Ret!==200) return
|
|
|
+ setToken(res.Data.Authorization)
|
|
|
+ router.replace('/etaChart/index')
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// 获取手机号验证码
|
|
|
+let countDownTimer=null
|
|
|
+const countDownTime=ref(60)
|
|
|
+const isSendCode=ref(false)
|
|
|
+async function handleMobileVerifyCode(){
|
|
|
+ if(isSendCode.value) return
|
|
|
+ if(!formData.tel){
|
|
|
+ MessagePlugin.warning('请填写手机号')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(!formData.imgVerifyCode){
|
|
|
+ MessagePlugin.warning('请填写图形验证码')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const res=await apiSystemCommon.getMobileVerifyCode({
|
|
|
+ CaptchaId:imgCodeId,
|
|
|
+ CaptchaCode:formData.imgVerifyCode,
|
|
|
+ Mobile:formData.tel,
|
|
|
+ TelAreaCode:formData.telCode
|
|
|
+ })
|
|
|
+ if(res.Ret!==200) return
|
|
|
+ isSendCode.value=true
|
|
|
+ countDownTime.value=60
|
|
|
+ countDownTimer=setInterval(()=>{
|
|
|
+ countDownTime.value--
|
|
|
+ if(countDownTime.value<0){
|
|
|
+ isSendCode.value=false
|
|
|
+ clearInterval(countDownTimer)
|
|
|
+ }
|
|
|
+ },1000)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <div class="login-page">
|
|
|
+ <img class="bg-img" src="@/assets/imgs/login_bg.png" alt="" />
|
|
|
+ <div class="flex main-wrap">
|
|
|
+ <img class="logo-icon" src="@/assets/imgs/logo_login.png" alt="" />
|
|
|
+ <div class="login-form-wrap">
|
|
|
+ <div class="en-login-label">Login</div>
|
|
|
+ <div class="login-label">登录</div>
|
|
|
+ <div class="login-tips">sign in to continue</div>
|
|
|
+ <t-form
|
|
|
+ ref="formIns"
|
|
|
+ :rules="FORM_RULES"
|
|
|
+ :data="formData"
|
|
|
+ :colon="true"
|
|
|
+ :label-width="0"
|
|
|
+ @submit="onSubmit"
|
|
|
+ >
|
|
|
+ <t-form-item name="tel">
|
|
|
+ <div class="flex form-item-box">
|
|
|
+ <t-select v-model="formData.telCode" style="width:80px">
|
|
|
+ <t-option
|
|
|
+ v-for="item in telCodeOpts"
|
|
|
+ :key="item.Value"
|
|
|
+ :label="item.Name"
|
|
|
+ :value="item.Value"
|
|
|
+ />
|
|
|
+ </t-select>
|
|
|
+ <t-input class="tel-input" placeholder="请输入手机号" v-model="formData.tel" style="flex:1"></t-input>
|
|
|
+ </div>
|
|
|
+ </t-form-item>
|
|
|
+ <t-form-item name="telVerifyCode">
|
|
|
+ <div class="flex form-item-box">
|
|
|
+ <t-input placeholder="请输入验证码" v-model="formData.telVerifyCode" style="flex:1"></t-input>
|
|
|
+ <span class="get_telcode_btn" @click="handleMobileVerifyCode" v-if="!isSendCode">获取验证码</span>
|
|
|
+ <span v-else class="get_telcode_btn" style="color:#666">{{countDownTime}}s</span>
|
|
|
+ </div>
|
|
|
+ </t-form-item>
|
|
|
+ <t-form-item name="imgVerifyCode">
|
|
|
+ <div class="flex form-item-box" style="padding-top:6px;padding-bottom:6px;">
|
|
|
+ <t-input placeholder="请输入图形验证码" v-model="formData.imgVerifyCode" style="flex:1"></t-input>
|
|
|
+ <img class="img-code" :src="imgCodeUrl" alt="" @click="getImgCode">
|
|
|
+ </div>
|
|
|
+ </t-form-item>
|
|
|
+ <div>
|
|
|
+ <t-checkbox v-model="keepLogin">60天内保持登录</t-checkbox>
|
|
|
+ </div>
|
|
|
+ <t-button class="submit-btn" block shape="round" type="submit">登录</t-button>
|
|
|
+
|
|
|
+ </t-form>
|
|
|
+ <p class="bottom-tips">共享社区资源,共创市场领先</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.login-page {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ position: relative;
|
|
|
+ background-color: #edf2f7;
|
|
|
+ .bg-img {
|
|
|
+ position: absolute;
|
|
|
+ bottom: 0;
|
|
|
+ right: 0;
|
|
|
+ max-width: 100%;
|
|
|
+ max-height: 100%;
|
|
|
+ }
|
|
|
+ .main-wrap {
|
|
|
+ height: 100%;
|
|
|
+ padding-top: 67px;
|
|
|
+ padding-left: 39px;
|
|
|
+ position: relative;
|
|
|
+ z-index: 10;
|
|
|
+ flex-direction: column;
|
|
|
+ .logo-icon {
|
|
|
+ width: 374px;
|
|
|
+ }
|
|
|
+ .login-form-wrap {
|
|
|
+ margin-left: 160px;
|
|
|
+ width: 400px;
|
|
|
+ flex: 1;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ .en-login-label {
|
|
|
+ font-size: 34px;
|
|
|
+ line-height: 47px;
|
|
|
+ }
|
|
|
+ .login-label {
|
|
|
+ font-size: 54px;
|
|
|
+ line-height: 75px;
|
|
|
+ }
|
|
|
+ .login-tips {
|
|
|
+ color: #999999;
|
|
|
+ margin-bottom: 28px;
|
|
|
+ }
|
|
|
+ .form-item-box {
|
|
|
+ border: 1px solid #3d5eff;
|
|
|
+ padding: 10px 40px 10px 16px;
|
|
|
+ border-radius: 40px;
|
|
|
+ width: 100%;
|
|
|
+ background-color: #fff;
|
|
|
+ align-items: center;
|
|
|
+ :deep(.t-input){
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ :deep(.t-input--focused){
|
|
|
+ box-shadow: none;
|
|
|
+ }
|
|
|
+ .tel-input{
|
|
|
+ border-left: 1px solid var(--border-color);
|
|
|
+ }
|
|
|
+ .get_telcode_btn{
|
|
|
+ color: var(--td-brand-color);
|
|
|
+ cursor: pointer;
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+ .img-code{
|
|
|
+ width: 80px;
|
|
|
+ height: 40px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .submit-btn{
|
|
|
+ background: linear-gradient(90deg, #7C54FF 0%, #4B64F7 100%);
|
|
|
+ height: 40px;
|
|
|
+ margin-top: 40px;
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ .bottom-tips{
|
|
|
+ text-align: center;
|
|
|
+ color: #999999;
|
|
|
+ font-size: 20px;
|
|
|
+ margin-top: 60px;
|
|
|
+ margin-bottom: 150px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|