|
|
@@ -1,31 +1,130 @@
|
|
|
<template>
|
|
|
- <AppLogin :logo-src="logoImage" :show-yhkhfxgzs="false" :show-yszc="false" :show-report="false" />
|
|
|
+ <app-statusbar class="login">
|
|
|
+ <app-navback class="login-navback" />
|
|
|
+ <app-statusbar class="login-luanguage">
|
|
|
+ <app-luanguage v-if="globalStore.getSystemInfo('i18nEnabled')" />
|
|
|
+ </app-statusbar>
|
|
|
+ <div class="login-logo">
|
|
|
+ <slot name="logo">
|
|
|
+ <img src="../../../assets/images/login-logo.png" />
|
|
|
+ </slot>
|
|
|
+ </div>
|
|
|
+ <Form class="login-form" @submit="formSubmit">
|
|
|
+ <CellGroup inset>
|
|
|
+ <Field v-model="formData.userName" name="account" size="large"
|
|
|
+ :placeholder="$t('user.login.Pleaseenterausername')"
|
|
|
+ :rules="[{ required: true, message: $t('user.login.Pleaseenterausername') }]">
|
|
|
+ <template #left-icon>
|
|
|
+ <img src="../../../assets/images/icons/phone.svg" width="24" />
|
|
|
+ </template>
|
|
|
+ </Field>
|
|
|
+ <Field v-model="formData.password" name="password" type="password" size="large"
|
|
|
+ :placeholder="$t('user.login.Pleaseenterthepassword')"
|
|
|
+ :rules="[{ required: true, message: $t('user.login.Pleaseenterthepassword') }]" autocomplete="off">
|
|
|
+ <template #left-icon>
|
|
|
+ <img src="../../../assets/images/icons/lock.svg" width="24" />
|
|
|
+ </template>
|
|
|
+ </Field>
|
|
|
+ <Cell>
|
|
|
+ <template #value>
|
|
|
+ <SliderVerify @statu="slide" style="width: 100%;" v-if="showSliderVerify" />
|
|
|
+ </template>
|
|
|
+ </Cell>
|
|
|
+ </CellGroup>
|
|
|
+ <div class="login-footer__trem" style="padding-top: 10px;">
|
|
|
+ <Checkbox shape="square" icon-size="16px" v-model="checked">{{ $t('user.login.checked') }}</Checkbox>
|
|
|
+ <span @click="routerTo('rules-zcxy')">{{ $t('user.login.ruleszcxy') }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="button-submit">
|
|
|
+ <Button type="danger" native-type="submit" block>{{ $t('user.login.login') }}</Button>
|
|
|
+ </div>
|
|
|
+ </Form>
|
|
|
+ <div class="login-link">
|
|
|
+ <span @click="navigationTo('user-register')" v-if="globalStore.hasSystemModule('register')">{{
|
|
|
+ $t('user.login.register') }}</span>
|
|
|
+ <span @click="navigationTo('user-forget')">{{ $t('user.login.forgetpassword') }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="login-footer">
|
|
|
+ <div class="login-footer__version">
|
|
|
+ <span>v1.0.{{ appVersion }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </app-statusbar>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { onMounted, onUnmounted } from 'vue'
|
|
|
-// import { dialog } from '@/utils/vant'
|
|
|
-// import { useLoginStore, i18n } from '@/stores'
|
|
|
-import plus from '@/utils/h5plus'
|
|
|
-import AppLogin from '@mobile/components/layouts/login/index.vue'
|
|
|
-import logoImage from '../../../assets/images/login-logo.png'
|
|
|
-
|
|
|
-// const { t } = i18n.global
|
|
|
-// const loginStore = useLoginStore()
|
|
|
-
|
|
|
-onMounted(() => {
|
|
|
- plus.setStatusBarStyle('dark')
|
|
|
-})
|
|
|
-
|
|
|
-onUnmounted(() => {
|
|
|
- plus.setStatusBarStyle('light')
|
|
|
-
|
|
|
- // setTimeout(() => {
|
|
|
- // if (loginStore.token) {
|
|
|
- // dialog({ message: t('user.login.tips7'), confirmButtonText: t('operation.confirm') })
|
|
|
- // }
|
|
|
- // }, 500)
|
|
|
-})
|
|
|
+import { shallowRef } from 'vue'
|
|
|
+import { Button, Field, CellGroup, Cell, Form, Checkbox, showFailToast, showToast } from 'vant'
|
|
|
+import { fullloading, dialog } from '@/utils/vant'
|
|
|
+import { useLogin } from '@/business/login'
|
|
|
+import { useNavigation } from '@mobile/router/navigation'
|
|
|
+import { useGlobalStore, i18n } from '@/stores'
|
|
|
+import service from '@/services'
|
|
|
+import SliderVerify from '@/components/base/slider-verify/index.vue' // 临时调用,待优化
|
|
|
+import AppLuanguage from '@mobile/components/modules/luanguage/index.vue'
|
|
|
+
|
|
|
+const { global: { t } } = i18n
|
|
|
+const globalStore = useGlobalStore()
|
|
|
+const { setGlobalUrlParams, routerTo, routerBack } = useNavigation()
|
|
|
+const { formData, userLogin } = useLogin()
|
|
|
+const checked = shallowRef(false) // 是否同意协议管理
|
|
|
+const showSliderVerify = shallowRef(true) // 验证滑块组件重载
|
|
|
+const sliderVerifyStatus = shallowRef(false) // 滑块验证状态
|
|
|
+
|
|
|
+const meta = document.getElementsByTagName('meta')
|
|
|
+const appVersion = meta.namedItem('revised')?.content ?? '0'
|
|
|
+
|
|
|
+// 导航跳转
|
|
|
+const navigationTo = (name: string) => {
|
|
|
+ fullloading((hideLoading) => {
|
|
|
+ service.onReady().then(() => {
|
|
|
+ hideLoading()
|
|
|
+ routerTo(name)
|
|
|
+ }).catch(() => {
|
|
|
+ showFailToast(t('user.login.startfailure'))
|
|
|
+ })
|
|
|
+ }, t('user.login.loading'))
|
|
|
+}
|
|
|
+
|
|
|
+// 滑块验证
|
|
|
+const slide = (vfcStatu: { statu: string }) => {
|
|
|
+ if (vfcStatu.statu === 'success') {
|
|
|
+ sliderVerifyStatus.value = true
|
|
|
+ } else {
|
|
|
+ sliderVerifyStatus.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const formSubmit = () => {
|
|
|
+ if (sliderVerifyStatus.value) {
|
|
|
+ if (checked.value) {
|
|
|
+ fullloading((hideLoading) => {
|
|
|
+ userLogin().then((forcedPasswordChange) => {
|
|
|
+ hideLoading()
|
|
|
+ if (forcedPasswordChange) {
|
|
|
+ dialog(t('user.login.tips1')).then(() => {
|
|
|
+ setGlobalUrlParams({ forcedPasswordChange })
|
|
|
+ routerTo('user-password', true)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ routerBack()
|
|
|
+ }
|
|
|
+ }).catch((err) => {
|
|
|
+ showSliderVerify.value = false
|
|
|
+ sliderVerifyStatus.value = false
|
|
|
+ formData.password = ''
|
|
|
+ hideLoading(err, 'fail')
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ showSliderVerify.value = true
|
|
|
+ }, 0)
|
|
|
+ })
|
|
|
+ }, t('user.login.logining'))
|
|
|
+ } else {
|
|
|
+ showToast(t('user.login.tips2'))
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="less">
|