|
@@ -41,26 +41,10 @@
|
|
|
</span>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <!-- 验证码 -->
|
|
|
- <!-- <el-form-item>
|
|
|
- <div id="captcha" class="captcha">
|
|
|
- <div v-show="captchaStatus === 'ready'" class="captcha_placeholder"> 行为验证™ 安全组件加载中 </div>
|
|
|
- <div v-show="captchaStatus === 'loading'" class="captcha_wait">
|
|
|
- <div class="loading">
|
|
|
- <div class="loading-dot"></div>
|
|
|
- <div class="loading-dot"></div>
|
|
|
- <div class="loading-dot"></div>
|
|
|
- <div class="loading-dot"></div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </el-form-item>-->
|
|
|
-
|
|
|
<el-button size="default" :loading="loading" type="primary" style="width: 100%; margin-bottom: 30px" @click.prevent="handleLogin"
|
|
|
>{{ $t('login.login') }}
|
|
|
</el-button>
|
|
|
</el-form>
|
|
|
- <GoogleVerifyDialog v-if="dialogOpts.dialogVisible" v-bind="dialogOpts" v-model:dialogVisible="dialogOpts.dialogVisible" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -78,7 +62,6 @@ import useStore from '@/store'
|
|
|
// API依赖
|
|
|
// import { getGeetConfig } from '@/api/login'
|
|
|
import { useRoute } from 'vue-router'
|
|
|
-import { LoginFormData } from '@/types'
|
|
|
|
|
|
const { user } = useStore()
|
|
|
const route = useRoute()
|
|
@@ -88,29 +71,19 @@ const passwordRef = ref(/*ElInput*/)
|
|
|
const captchaStatus = ref('ready') // ready loading complete
|
|
|
|
|
|
const state = reactive({
|
|
|
- dialogOpts: {
|
|
|
- dialogVisible: false,
|
|
|
- formData: {
|
|
|
- is_bind_google_code: 1,
|
|
|
- ext: {}
|
|
|
- }
|
|
|
- },
|
|
|
loginForm: {
|
|
|
username: 'admin',
|
|
|
- password: '123456'
|
|
|
+ password: '100607'
|
|
|
},
|
|
|
loginRules: {
|
|
|
username: [{ required: true, message: '用户名不能为空', trigger: 'blur' }],
|
|
|
password: [{ required: true, message: '密码不能为空', trigger: 'blur' }]
|
|
|
},
|
|
|
loading: false,
|
|
|
- passwordType: 'password',
|
|
|
- otherQuery: {},
|
|
|
- clientHeight: document.documentElement.clientHeight
|
|
|
+ passwordType: 'password'
|
|
|
})
|
|
|
-let captcha_obj: any = null
|
|
|
|
|
|
-const { dialogOpts, loginForm, loginRules, loading, passwordType } = toRefs(state)
|
|
|
+const { loginForm, loginRules, loading, passwordType } = toRefs(state)
|
|
|
|
|
|
function showPwd() {
|
|
|
if (state.passwordType === 'password') {
|
|
@@ -124,39 +97,14 @@ function showPwd() {
|
|
|
}
|
|
|
|
|
|
function handleLogin() {
|
|
|
- // if (captcha_obj.getValidate) {
|
|
|
- // const result = captcha_obj.getValidate()
|
|
|
- // if (!result) {
|
|
|
- // return ElMessage.warning('请先完成机器验证')
|
|
|
- // }
|
|
|
loginFormRef.value.validate((valid: boolean) => {
|
|
|
if (valid) {
|
|
|
state.loading = true
|
|
|
- // const challenge = result.geetest_challenge
|
|
|
- // const seccode = result.geetest_seccode
|
|
|
- user
|
|
|
- .login({
|
|
|
- ...state.loginForm
|
|
|
- // challenge,
|
|
|
- // seccode
|
|
|
- } as LoginFormData)
|
|
|
- .then((formData: any) => {
|
|
|
- user.googleLogin()
|
|
|
- // state.dialogOpts = {
|
|
|
- // formData,
|
|
|
- // dialogVisible: true
|
|
|
- // }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- // 重置验证
|
|
|
- // captcha_obj.refresh() // 新的为reset
|
|
|
- })
|
|
|
- .finally(() => {
|
|
|
- state.loading = false
|
|
|
- })
|
|
|
+ user.login(state.loginForm).finally(() => {
|
|
|
+ state.loading = false
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
- // }
|
|
|
}
|
|
|
|
|
|
watch(
|
|
@@ -173,29 +121,6 @@ watch(
|
|
|
)
|
|
|
|
|
|
onMounted(() => {
|
|
|
- // 极验证初始化
|
|
|
- /*getGeetConfig().then(data => {
|
|
|
- // 极验证加载中
|
|
|
- captchaStatus.value = 'loading'
|
|
|
- // eslint-disable-next-line
|
|
|
- // @ts-ignore
|
|
|
- const initGeetest: any = window.initGeetest
|
|
|
- initGeetest(
|
|
|
- {
|
|
|
- ...data,
|
|
|
- product: 'float', // 产品形式,包括:float,popup
|
|
|
- width: '100%' // 该配置已失效
|
|
|
- },
|
|
|
- (captchaObj: any) => {
|
|
|
- captchaObj.appendTo('#captcha')
|
|
|
- captchaObj.onReady(() => {
|
|
|
- // 极验证加载完成
|
|
|
- captchaStatus.value = 'complete'
|
|
|
- })
|
|
|
- captcha_obj = captchaObj
|
|
|
- }
|
|
|
- )
|
|
|
- })*/
|
|
|
})
|
|
|
</script>
|
|
|
|
|
@@ -365,70 +290,5 @@ $light_gray: #eee;
|
|
|
cursor: pointer;
|
|
|
user-select: none;
|
|
|
}
|
|
|
- // todo
|
|
|
- .captcha {
|
|
|
- width: 100%;
|
|
|
- &_placeholder {
|
|
|
- height: 42px;
|
|
|
- width: 100%;
|
|
|
- text-align: center;
|
|
|
- border-radius: 2px;
|
|
|
- background-color: #f3f3f3;
|
|
|
- color: #bbbbbb;
|
|
|
- font-size: 14px;
|
|
|
- letter-spacing: 0.1px;
|
|
|
- line-height: 42px;
|
|
|
- }
|
|
|
- &_wait {
|
|
|
- height: 42px;
|
|
|
- width: 100%;
|
|
|
- text-align: center;
|
|
|
- border-radius: 2px;
|
|
|
- background-color: #f3f3f3;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .loading {
|
|
|
- margin: auto;
|
|
|
- width: 70px;
|
|
|
- height: 20px;
|
|
|
- &-dot {
|
|
|
- &:nth-child(1) {
|
|
|
- animation-delay: 0s;
|
|
|
- }
|
|
|
- &:nth-child(2) {
|
|
|
- animation-delay: 0.1s;
|
|
|
- }
|
|
|
-
|
|
|
- &:nth-child(3) {
|
|
|
- animation-delay: 0.2s;
|
|
|
- }
|
|
|
-
|
|
|
- &:nth-child(4) {
|
|
|
- animation-delay: 0.3s;
|
|
|
- }
|
|
|
- float: left;
|
|
|
- width: 8px;
|
|
|
- height: 8px;
|
|
|
- margin: 18px 4px;
|
|
|
- background: #ccc;
|
|
|
- border-radius: 50%;
|
|
|
- opacity: 0;
|
|
|
- box-shadow: 0 0 2px black;
|
|
|
- animation: loadingFade 1s infinite;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @keyframes loadingFade {
|
|
|
- 0% {
|
|
|
- opacity: 0;
|
|
|
- }
|
|
|
- 50% {
|
|
|
- opacity: 0.8;
|
|
|
- }
|
|
|
- 100% {
|
|
|
- opacity: 0;
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
</style>
|