@@ -93,11 +86,9 @@
- {{
+ {{
$t('login.form_button') }}
-
@@ -126,7 +117,6 @@ import { StorageEnum } from '@/enums/storageEnum'
import { icon } from '@/plugins'
import { routerTurnByName } from '@/utils'
import { getTenantIdByNameApi, getUserProfileApi, loginApi, getCodeImg } from '@/api/path'
-import { Verify } from '@/components/Verifition'
interface FormState {
username: string
@@ -143,16 +133,16 @@ const show = ref(false)
const showBg = ref(false)
const systemStore = useSystemStore()
+const codeUrl = ref("");
const t = window['$t']
const formInline = reactive({
tenantName: '闻荫源码',
username: 'admin',
password: 'admin123',
- code:'',
+ code: "",
uuid:''
})
-const codeUrl = ref("");
const rules = {
username: {
@@ -196,36 +186,6 @@ const getImageUrl = (name: string, folder: string) => {
return new URL(`../../assets/images/${folder}/${name}.png`, import.meta.url).href
}
-// 打乱图片顺序
-const shuffleHandle = () => {
- shuffleTimiing.value = setInterval(() => {
- bgList.value = shuffle(bgList.value)
- }, carouselInterval)
-}
-
-// 验证码
-const verify = ref()
-const captchaType = ref('blockPuzzle') // blockPuzzle 滑块 clickWord 点击文字
-const captchaEnable = import.meta.env.VITE_APP_CAPTCHA_ENABLE
-// 获取验证码
-// const getCode = async () => {
-// // 情况一,未开启:则直接登录
-// if (captchaEnable === 'false') {
-// await handleSubmit({})
-// } else {
-// // 情况二,已开启:则展示验证码;只有完成验证码的情况,才进行登录
-// // 弹出验证码
-// verify.value.show()
-// }
-// }
-
-function getCode() {
- getCodeImg().then(res => {
- codeUrl.value = "data:image/gif;base64," + res.img;
- formInline.uuid = res.uuid;
- });
-}
-
// 多租户
const tenantEnable = import.meta.env.VITE_APP_TENANT_ENABLE
// 获取租户 ID
@@ -241,7 +201,6 @@ const getTenantId = async () => {
}
}
-
// 登录
const handleSubmit = async (params: any) => {
formRef.value.validate(async (errors: any) => {
@@ -249,13 +208,14 @@ const handleSubmit = async (params: any) => {
// 获取租户 ID
await getTenantId()
- const { username, password } = formInline
+ const { username, password, code, uuid } = formInline
loading.value = true
// 提交请求【登录】
const loginRes = await loginApi({
username,
password,
- captchaVerification: params.captchaVerification
+ code,
+ uuid
})
if (loginRes && loginRes.data) {
// ① Token 信息(先存储下,保证可以加载个人信息)
@@ -289,7 +249,13 @@ const handleSubmit = async (params: any) => {
}
})
}
-
+//获取验证码
+const getCode = async () => {
+ getCodeImg().then(res => {
+ codeUrl.value = "data:image/gif;base64," + res.img;
+ formInline.uuid = res.uuid;
+ });
+}
onMounted(() => {
setTimeout(() => {
show.value = true
@@ -298,8 +264,8 @@ onMounted(() => {
setTimeout(() => {
showBg.value = true
}, 100)
+
getCode()
- shuffleHandle()
})