|
@@ -9,20 +9,21 @@
|
|
density="compact"
|
|
density="compact"
|
|
color="primary"
|
|
color="primary"
|
|
prepend-inner-icon="mdi-email"
|
|
prepend-inner-icon="mdi-email"
|
|
- :rules="[v=> !!v || '请输入企业邮箱', v=> checkEmail(v)]"
|
|
|
|
|
|
+ :rules="[v=> !!v || '请输入企业邮箱', v=> checkEmail(v) || '邮箱格式不正确']"
|
|
></v-text-field>
|
|
></v-text-field>
|
|
- <div class="d-flex">
|
|
|
|
- <v-text-field
|
|
|
|
- v-model="query.code"
|
|
|
|
- label="验证码"
|
|
|
|
- placeholder="请输入邮箱收到的验证码"
|
|
|
|
- variant="outlined"
|
|
|
|
- density="compact"
|
|
|
|
- color="primary"
|
|
|
|
- :rules="[v=> !!v || '请输入邮箱收到的验证码']"
|
|
|
|
- ></v-text-field>
|
|
|
|
- <v-btn color="primary" class="ml-2" style="margin-top: 2px;" @click="emit('getCode')">获取验证码</v-btn>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <v-text-field
|
|
|
|
+ v-model="query.code"
|
|
|
|
+ label="验证码"
|
|
|
|
+ placeholder="请输入邮箱收到的验证码"
|
|
|
|
+ variant="outlined"
|
|
|
|
+ density="compact"
|
|
|
|
+ color="primary"
|
|
|
|
+ :rules="[v=> !!v || '请输入邮箱收到的验证码']"
|
|
|
|
+ >
|
|
|
|
+ <template #append-inner>
|
|
|
|
+ <span class="login-code" @click="handleCode">{{ $t('login.getSmsCode') }}</span>
|
|
|
|
+ </template>
|
|
|
|
+ </v-text-field>
|
|
</v-form>
|
|
</v-form>
|
|
<v-form ref="passwordRef" style="width: 100%;">
|
|
<v-form ref="passwordRef" style="width: 100%;">
|
|
<v-text-field
|
|
<v-text-field
|
|
@@ -60,9 +61,10 @@
|
|
<script setup>
|
|
<script setup>
|
|
defineOptions({ name: 'editPasswordEnt'})
|
|
defineOptions({ name: 'editPasswordEnt'})
|
|
import { ref, reactive, computed } from 'vue'
|
|
import { ref, reactive, computed } from 'vue'
|
|
-import { resetPassword } from '@/api/common/index'
|
|
|
|
|
|
+import { entResetPassword, getEmailCode } from '@/api/common/index'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
import { checkEmail } from '@/utils/validate'
|
|
import { checkEmail } from '@/utils/validate'
|
|
|
|
+import { useRouter } from 'vue-router'; const router = useRouter()
|
|
|
|
|
|
const emit = defineEmits(['cancel', 'getCode'])
|
|
const emit = defineEmits(['cancel', 'getCode'])
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
@@ -70,9 +72,9 @@ const props = defineProps({
|
|
type: String,
|
|
type: String,
|
|
default: ''
|
|
default: ''
|
|
},
|
|
},
|
|
- verifySuccess: {
|
|
|
|
- type: Boolean,
|
|
|
|
- default: false
|
|
|
|
|
|
+ captchaVerification: {
|
|
|
|
+ type: String,
|
|
|
|
+ default: ''
|
|
},
|
|
},
|
|
showCancelBtn: {
|
|
showCancelBtn: {
|
|
type: Boolean,
|
|
type: Boolean,
|
|
@@ -119,23 +121,37 @@ const confirmPassword = computed(() => {
|
|
// emit('cancel')
|
|
// emit('cancel')
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
+const handleCode = async () => {
|
|
|
|
+ if (!query.email || !checkEmail(query.email)) {
|
|
|
|
+ Snackbar.warning('请输入企业邮箱')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ emit('getCode')
|
|
|
|
+ await getEmailCode(query.email)
|
|
|
|
+ Snackbar.success('已发送验证码,请注意查看!')
|
|
|
|
+}
|
|
|
|
+
|
|
// 修改
|
|
// 修改
|
|
const handleSubmit = async () => {
|
|
const handleSubmit = async () => {
|
|
const emailValid = await emailRef.value.validate()
|
|
const emailValid = await emailRef.value.validate()
|
|
const passwordValid = await passwordRef.value.validate()
|
|
const passwordValid = await passwordRef.value.validate()
|
|
if (!emailValid.valid || !passwordValid.valid) return
|
|
if (!emailValid.valid || !passwordValid.valid) return
|
|
- if (!props.verifySuccess) {
|
|
|
|
|
|
+ if (!props.captchaVerification) {
|
|
emit('getCode')
|
|
emit('getCode')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
const data = {
|
|
const data = {
|
|
- password: query.password,
|
|
|
|
|
|
+ ...query,
|
|
|
|
+ captchaVerification: props.captchaVerification,
|
|
}
|
|
}
|
|
loading.value = true
|
|
loading.value = true
|
|
// const api = props.isReset ? resetPassword : updatePassword
|
|
// const api = props.isReset ? resetPassword : updatePassword
|
|
try {
|
|
try {
|
|
- await resetPassword(data)
|
|
|
|
- Snackbar.success('修改成功')
|
|
|
|
|
|
+ await entResetPassword(data)
|
|
|
|
+ Snackbar.success('修改成功,即将为您跳转到登录页面')
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ router.push({ path: '/login', query: { entLogin: true } })
|
|
|
|
+ }, 1000);
|
|
} finally {
|
|
} finally {
|
|
loading.value = false
|
|
loading.value = false
|
|
// handleClose()
|
|
// handleClose()
|
|
@@ -145,4 +161,11 @@ const handleSubmit = async () => {
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
|
|
+.login-code {
|
|
|
|
+ width: 97px;
|
|
|
|
+ color: var(--v-primary-base);
|
|
|
|
+ text-align: end;
|
|
|
|
+ font-size: 12px;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|