|
|
@@ -1,183 +1,82 @@
|
|
|
<template>
|
|
|
- <div class="page find-password-page">
|
|
|
+ <div class="page">
|
|
|
<div class="find-form">
|
|
|
- <div class="upload-label">{{ t('find-password.desc') }}</div>
|
|
|
- <div class="upload-box" @click="triggerFileInput">
|
|
|
- <input ref="fileInput" type="file" accept="image/png, image/jpeg" style="display: none" @change="handleFileChange" />
|
|
|
- <div v-if="!previewUrl" class="upload-placeholder">
|
|
|
- <span class="plus">+</span>
|
|
|
- </div>
|
|
|
- <img v-else :src="previewUrl" class="preview-img" />
|
|
|
+ <remit-input
|
|
|
+ v-model:value="kycForm.signaturePhoto"
|
|
|
+ type="upload"
|
|
|
+ fkey="signaturePhoto"
|
|
|
+ :label="t('find-password.desc')"
|
|
|
+ @change="handleChange"
|
|
|
+ />
|
|
|
+ <div class="find-button">
|
|
|
+ <van-button type="primary" block @click="handleNext1">{{ t('find-password.nextStep') }}</van-button>
|
|
|
</div>
|
|
|
- <div class="tip">{{ t('find-password.tip') }}</div>
|
|
|
- <button class="confirm-btn" :disabled="!file" @click="handleConfirm">{{ t('find-password.nextStep') }}</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { showToast } from 'vant'
|
|
|
+import { useRouter } from 'vue-router'
|
|
|
import { useI18n } from 'vue-i18n'
|
|
|
-import { $Api } from '@/api'
|
|
|
-import { useRoute } from 'vue-router'
|
|
|
+import { showToast } from 'vant'
|
|
|
import { ucardApi } from '@/api/ucard'
|
|
|
-import type { CardInfo } from '@/api/ucard'
|
|
|
-const { t } = useI18n()
|
|
|
+import useUserStore from '@/stores/use-user-store'
|
|
|
+const userStore = useUserStore()
|
|
|
+const userInfo = computed(() => userStore.userInfo)
|
|
|
const route = useRoute()
|
|
|
-const { id } = route.query as { id: string }
|
|
|
-const cardInfo = ref<CardInfo | null>(null)
|
|
|
-const file = ref<File | null>(null)
|
|
|
-const previewUrl = ref('')
|
|
|
-const signaturePhoto = ref('')
|
|
|
-const fileInput = ref<HTMLInputElement | null>(null)
|
|
|
-function triggerFileInput() {
|
|
|
- fileInput.value?.click()
|
|
|
-}
|
|
|
-const getCardInfo = async () => {
|
|
|
- const res = await ucardApi.cardSingle({ id })
|
|
|
- cardInfo.value = res.data
|
|
|
-}
|
|
|
-onMounted(() => {
|
|
|
- getCardInfo()
|
|
|
+const { t } = useI18n()
|
|
|
+const router = useRouter()
|
|
|
+const kycForm = ref({
|
|
|
+ signaturePhoto: '',
|
|
|
+ data: '',
|
|
|
+ uniqueId: '',
|
|
|
})
|
|
|
+const { cardNo, cardTypeId } = route.query as { cardNo: string; cardTypeId: string }
|
|
|
+const formData = ref<typeof kycForm.value>({ cardNo: cardNo, cardTypeId: cardTypeId } as any)
|
|
|
|
|
|
-function handleFileChange(e: Event) {
|
|
|
- const target = e.target as HTMLInputElement
|
|
|
- if (target.files && target.files[0]) {
|
|
|
- const f = target.files[0]
|
|
|
- if (!['image/png', 'image/jpeg'].includes(f.type)) {
|
|
|
- showToast('仅支持PNG、JPG格式')
|
|
|
- return
|
|
|
+const handleNext1 = async () => {
|
|
|
+ if (formData.value.signaturePhoto) {
|
|
|
+ formData.value.uniqueId = userInfo.value?.customInfo?.uniqueId
|
|
|
+ const res = await ucardApi.ucardResetPassword(formData.value as any)
|
|
|
+ if (res.code === 200) {
|
|
|
+ showToast(t('find-password.success'))
|
|
|
+ router.push('/cards')
|
|
|
+ } else {
|
|
|
+ showToast(t('find-password.error'))
|
|
|
}
|
|
|
- file.value = f
|
|
|
- previewUrl.value = URL.createObjectURL(f)
|
|
|
}
|
|
|
}
|
|
|
-const isUploading = ref(false)
|
|
|
-async function handleConfirm() {
|
|
|
- if (!file.value) {
|
|
|
- showToast('请上传签名照片')
|
|
|
- return
|
|
|
- }
|
|
|
- try {
|
|
|
- isUploading.value = true
|
|
|
- showLoadingToast({
|
|
|
- message: '上传中...',
|
|
|
- forbidClick: true,
|
|
|
- })
|
|
|
- const result = await $Api.upload.uploadFile(file.value)
|
|
|
- closeToast()
|
|
|
- showToast('上传成功')
|
|
|
- signaturePhoto.value = result.data
|
|
|
- try {
|
|
|
- await $Api.ucard.ucardResetPassword({
|
|
|
- signaturePhoto: result.data,
|
|
|
- ...cardInfo.value,
|
|
|
- })
|
|
|
- showToast('重置密码成功')
|
|
|
- } catch (error) {
|
|
|
- showToast('重置密码失败,请重试')
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- closeToast()
|
|
|
- showToast('上传失败,请重试')
|
|
|
- } finally {
|
|
|
- isUploading.value = false
|
|
|
- }
|
|
|
+const handleChange = (value: any) => {
|
|
|
+ formData.value = { ...formData.value, [value.key]: value.value }
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
-.find-password-page {
|
|
|
- min-height: 100vh;
|
|
|
- background: linear-gradient(135deg, #232323 0%, #2a2a2a 100%);
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
-}
|
|
|
.find-form {
|
|
|
width: 100%;
|
|
|
- max-width: 340px;
|
|
|
- margin: 0 auto;
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- align-items: center;
|
|
|
- background: rgba(24, 24, 24, 0.92);
|
|
|
+ max-width: 350px;
|
|
|
border-radius: 20px;
|
|
|
- box-shadow: 0 4px 32px 0 rgba(214, 255, 0, 0.08);
|
|
|
- padding: 36px 20px 32px 20px;
|
|
|
-}
|
|
|
-.upload-label {
|
|
|
- color: #fff;
|
|
|
- font-size: 18px;
|
|
|
- font-weight: 500;
|
|
|
- margin-bottom: 22px;
|
|
|
- letter-spacing: 1px;
|
|
|
-}
|
|
|
-.upload-box {
|
|
|
- width: 140px;
|
|
|
- height: 140px;
|
|
|
- background: #181818;
|
|
|
- border-radius: 16px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- margin-bottom: 12px;
|
|
|
- cursor: pointer;
|
|
|
- border: 2px dashed var(--main-yellow);
|
|
|
- transition: border-color 0.2s;
|
|
|
- overflow: hidden;
|
|
|
- box-shadow: 0 2px 12px 0 rgba(214, 255, 0, 0.04);
|
|
|
- &:hover {
|
|
|
- border-color: #fff200;
|
|
|
- }
|
|
|
-}
|
|
|
-.upload-placeholder {
|
|
|
+ padding-top: 28px;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
-}
|
|
|
-.plus {
|
|
|
- font-size: 48px;
|
|
|
- color: var(--main-yellow);
|
|
|
- margin-bottom: 0;
|
|
|
- font-weight: bold;
|
|
|
-}
|
|
|
-.tip {
|
|
|
- color: #bdbdbd;
|
|
|
- font-size: 13px;
|
|
|
- margin-bottom: 18px;
|
|
|
- margin-top: 2px;
|
|
|
- text-align: center;
|
|
|
+ gap: 18px;
|
|
|
}
|
|
|
-.preview-img {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- object-fit: cover;
|
|
|
- border-radius: 16px;
|
|
|
- border: 1.5px solid var(--main-yellow);
|
|
|
- box-shadow: 0 2px 8px 0 rgba(214, 255, 0, 0.08);
|
|
|
-}
|
|
|
-.confirm-btn {
|
|
|
- width: 100%;
|
|
|
- height: 48px;
|
|
|
- background: linear-gradient(90deg, var(--main-yellow) 0%, var(--main-yellow-dark) 100%);
|
|
|
- color: #232323;
|
|
|
- border: none;
|
|
|
- border-radius: 24px;
|
|
|
- font-size: 20px;
|
|
|
- font-weight: bold;
|
|
|
- margin-top: 30px;
|
|
|
- cursor: pointer;
|
|
|
- box-shadow: 0 2px 12px 0 rgba(73, 247, 166, 0.1);
|
|
|
- letter-spacing: 2px;
|
|
|
- transition: background 0.2s, box-shadow 0.2s;
|
|
|
-}
|
|
|
-.confirm-btn:disabled {
|
|
|
- opacity: 0.5;
|
|
|
- cursor: not-allowed;
|
|
|
+.find-button {
|
|
|
+ margin-top: 18px;
|
|
|
+ ::v-deep {
|
|
|
+ .van-button {
|
|
|
+ height: 44px;
|
|
|
+ border-radius: 24px;
|
|
|
+ background: var(--main-yellow);
|
|
|
+ border: none;
|
|
|
+ color: #232323;
|
|
|
+ font-size: var(--font-size-16);
|
|
|
+ font-weight: bold;
|
|
|
+
|
|
|
+ &:active {
|
|
|
+ opacity: 0.9;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|