diff --git a/.env.development b/.env.development
new file mode 100644
index 0000000..aebc220
--- /dev/null
+++ b/.env.development
@@ -0,0 +1,3 @@
+# 开发环境配置
+NODE_ENV=development
+VITE_API_BASE_URL=/api
\ No newline at end of file
diff --git a/.env.production b/.env.production
new file mode 100644
index 0000000..660d973
--- /dev/null
+++ b/.env.production
@@ -0,0 +1,3 @@
+# 生产环境配置
+NODE_ENV=production
+VITE_API_BASE_URL=
\ No newline at end of file
diff --git a/src/pages/home/index.vue b/src/pages/home/index.vue
index 8e4c90c..8be131e 100644
--- a/src/pages/home/index.vue
+++ b/src/pages/home/index.vue
@@ -30,12 +30,13 @@
+
@@ -143,6 +151,7 @@ const formData = ref({
wifeName: '', // 女方姓名
registerDate: '', // 登记日期
qrCode: '', // 二维码
+ status: 0, // 状态 0-未核销 1-已核销
})
const activityInfo = ref({}); // 活动信息
@@ -181,6 +190,24 @@ onMounted(() => {
const countdown = ref(0)
let countdownTimer: number | null = null
+const clearPhone = () => {
+ formData.value.phone = '';
+ formData.value.smsCode = '';
+ formData.value.verifyCode = false;
+ formData.value.marriageNo = '';
+ formData.value.husbandName = '';
+ formData.value.wifeName = '';
+ formData.value.registerDate = '';
+ formData.value.qrCode = '';
+ formData.value.status = 0;
+ countdown.value = 0;
+ if (countdownTimer) {
+ clearInterval(countdownTimer);
+ countdownTimer = null;
+ }
+ localStorage.removeItem('userAs');
+}
+
// 发送验证码
const sendVerificationCode = () => {
const { phone } = formData.value
@@ -251,10 +278,11 @@ const verifyCode = () => {
countdown.value = 0;
// 验证成功如果有二维码,保存到表单
- if (res.data.code) {
+ if (res?.data?.code) {
formData.value = {
...formData.value,
qrCode: res.data.code,
+ status: res.data.status,
}
} else {
formData.value = {
@@ -267,11 +295,14 @@ const verifyCode = () => {
}
}
}).catch((error) => {
+ console.log(error, 66666666666666);
+
localStorage.removeItem('userAs');
message.error('验证码验证失败,请重试');
formData.value = {
...formData.value,
+ smsCode: "",
marriageNo: "",
husbandName: "",
wifeName: "",
@@ -282,6 +313,20 @@ const verifyCode = () => {
hideLoading();
})
}
+// 重置结婚证信息
+function resetMarriageInfo() {
+ formData.value = {
+ ...formData.value,
+ marriageNo: "",
+ husbandName: "",
+ wifeName: "",
+ registerDate: "",
+ qrCode: ""
+ }
+ ocrUploadId.value && (ocrUploadId.value.value = '');
+
+ ocrUploadId.value?.click();
+}
// 处理扫描点击事件
const handleScanClick = () => {
diff --git a/src/utils/axios.ts b/src/utils/axios.ts
index d3a721c..6f17234 100644
--- a/src/utils/axios.ts
+++ b/src/utils/axios.ts
@@ -1,8 +1,11 @@
import axios from 'axios'
+// 从环境变量获取API基础路径
+const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || '/api';
+
// 创建axios实例
const request = axios.create({
- baseURL: '/api', // 与Vite代理配置一致
+ baseURL: API_BASE_URL, // 根据环境变量配置
timeout: 10000, // 请求超时时间
headers: {
'Content-Type': 'application/json',