|
|
@@ -40,6 +40,7 @@
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+ <PasswordMidify v-if="showPasswordMidify" @closed="onClosed" />
|
|
|
</sign-layout>
|
|
|
</template>
|
|
|
|
|
|
@@ -54,9 +55,10 @@ import service from '@/services'
|
|
|
import SignLayout from '../components/layout/index.vue'
|
|
|
import Forget from "../forget/index.vue"
|
|
|
import AppQrcode from '@/components/base/qrcode/index.vue'
|
|
|
+import PasswordMidify from '@pc/components/layouts/header/components/modify/index.vue' // 待优化
|
|
|
import SliderVerify from '@/components/base/slider-verify/index.vue' // 临时调用,待优化
|
|
|
|
|
|
-const { formData, userLogin } = useLogin()
|
|
|
+const { formData, userLogin, userLogout } = useLogin()
|
|
|
const route = useRoute()
|
|
|
const router = useRouter()
|
|
|
const globalStore = useGlobalStore()
|
|
|
@@ -68,6 +70,7 @@ const islogin = shallowRef(true)
|
|
|
const isRegister = shallowRef(false)
|
|
|
const qrContent = shallowRef('')
|
|
|
const rloading = shallowRef(false)
|
|
|
+const showPasswordMidify = shallowRef(false) // 显示修改密码
|
|
|
const showSliderVerify = shallowRef(true) // 验证滑块组件重载
|
|
|
const sliderVerifyStatus = shallowRef(false) // 滑块验证状态
|
|
|
|
|
|
@@ -99,29 +102,40 @@ const slide = (vfcStatu: { statu: string }) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const onClosed = () => {
|
|
|
+ userLogout()
|
|
|
+ showPasswordMidify.value = false
|
|
|
+}
|
|
|
+
|
|
|
const formSubmit = () => {
|
|
|
+ const reset = () => {
|
|
|
+ loading.value = false
|
|
|
+ showSliderVerify.value = false
|
|
|
+ sliderVerifyStatus.value = false
|
|
|
+ formData.password = ''
|
|
|
+ setTimeout(() => {
|
|
|
+ showSliderVerify.value = true
|
|
|
+ }, 0)
|
|
|
+ }
|
|
|
formRef.value?.validate(async (valid) => {
|
|
|
if (valid && sliderVerifyStatus.value) {
|
|
|
try {
|
|
|
- loading.value = true
|
|
|
- await userLogin()
|
|
|
- await menuStore.getUserMenuList()
|
|
|
- const redirect = route.query.redirect
|
|
|
- if (redirect) {
|
|
|
- router.replace(redirect.toString())
|
|
|
+ const forcedPasswordChange = await userLogin()
|
|
|
+ if (forcedPasswordChange) {
|
|
|
+ reset()
|
|
|
+ showPasswordMidify.value = true
|
|
|
} else {
|
|
|
- router.replace('/')
|
|
|
+ await menuStore.getUserMenuList()
|
|
|
+ const redirect = route.query.redirect
|
|
|
+ if (redirect) {
|
|
|
+ router.replace(redirect.toString())
|
|
|
+ } else {
|
|
|
+ router.replace('/')
|
|
|
+ }
|
|
|
}
|
|
|
} catch (err) {
|
|
|
- loading.value = false
|
|
|
- showSliderVerify.value = false
|
|
|
- sliderVerifyStatus.value = false
|
|
|
- formData.password = ''
|
|
|
+ reset()
|
|
|
ElMessage.error('登录失败:' + err as string)
|
|
|
-
|
|
|
- setTimeout(() => {
|
|
|
- showSliderVerify.value = true
|
|
|
- }, 0)
|
|
|
}
|
|
|
}
|
|
|
})
|