Skip to content

Commit b98c2c6

Browse files
committed
solved the confirm loop error
1 parent b769d65 commit b98c2c6

File tree

5 files changed

+52
-47
lines changed

5 files changed

+52
-47
lines changed
-16.6 KB
Binary file not shown.
3.93 KB
Binary file not shown.

code/backend/src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
server.port=8080
22

33
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
4-
spring.datasource.url=jdbc:mysql://47.253.44.235:3306/sec_hand?serverTimezone=UTC&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT
4+
spring.datasource.url=jdbc:mysql://47.253.144.78:3306/sec_hand?serverTimezone=UTC&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT
55
spring.datasource.username=root
66
spring.datasource.password=haBshjbwei23432*&
77

code/frontend/src/components/page/order.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,22 @@
5757
}}
5858
</div> -->
5959
</div>
60-
<el-dialog title="Prompt" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
60+
<!-- <el-dialog title="Prompt" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
6161
<span
6262
>Please click 'Confirm' to mark order as complete. Reminder: the transaction will happen offline. Be careful.</span
6363
>
6464
<div class="block"></div>
6565
<span slot="footer" class="dialog-footer">
6666
<el-button type="primary" @click="putOnHold">Confirm</el-button>
6767
</span>
68-
</el-dialog>
68+
</el-dialog> -->
6969

7070
<div class="menu">
7171
<el-button
7272
v-if="userId == orderInfo.userId && orderInfo.orderStatus === 0"
7373
type="danger"
7474
plain
75-
@click="changeOrderStatus(4, orderInfo)"
75+
@click="changeOrderStatus(2, orderInfo)"
7676
>Cancel Order</el-button
7777
>
7878
<!--

code/frontend/src/components/page/sign-in.vue

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<template>
1+
<template>
22
<div class="sign-in-container">
33
<el-card class="box-card">
44
<div class="sign-in-body">
@@ -53,20 +53,20 @@
5353
</div>
5454
</div>
5555

56-
<!-- Verification Code Dialog -->
57-
<el-dialog title="Verify Email" :visible.sync="showVerifyDialog" width="30%">
58-
<span>Enter the 6-digit code sent to your email:</span>
59-
<el-input v-model="activeCode" placeholder="6-digit code" maxlength="6" class="sign-in-input"/>
60-
<div slot="footer" class="dialog-footer">
61-
<el-button @click="verifyCode">Verify</el-button>
62-
</div>
63-
</el-dialog>
56+
<!-- Verification Code Dialog -->
57+
<el-dialog title="Verify Email" :visible.sync="showVerifyDialog" width="30%">
58+
<span>Enter the 6-digit code sent to your email:</span>
59+
<el-input v-model="activeCode" placeholder="6-digit code" maxlength="6" class="sign-in-input" />
60+
<div slot="footer" class="dialog-footer">
61+
<el-button @click="verifyCode">Verify</el-button>
62+
</div>
63+
</el-dialog>
6464
</el-card>
6565
</div>
6666
</template>
6767

6868
<script>
69-
import axios from "axios";
69+
import axios from 'axios';
7070
7171
export default {
7272
name: 'sign-in',
@@ -78,8 +78,8 @@ export default {
7878
userPassword: '',
7979
nickname: ''
8080
},
81-
showVerifyDialog: false,
82-
activeCode: '',
81+
showVerifyDialog: false,
82+
activeCode: ''
8383
};
8484
},
8585
methods: {
@@ -107,21 +107,21 @@ export default {
107107
.signIn(this.userInfo)
108108
.then((res) => {
109109
if (res.status_code === 1) {
110-
this.$confirm(
111-
`A verification email has been sent to ${this.userInfo.email}. Please check your inbox for the 6-digit verification code to activate your email.`,
112-
'Email Sent',
113-
{
114-
confirmButtonText: 'OK',
115-
type: 'info',
116-
// callback: () => {
117-
// // Redirect to login page after confirmation
118-
// this.$router.replace({ path: '/login' });
119-
// }
120-
}
121-
);
110+
this.$confirm(
111+
`A verification email has been sent to ${this.userInfo.email}. Please check your inbox for the 6-digit verification code to activate your email.`,
112+
'Email Sent',
113+
{
114+
confirmButtonText: 'OK',
115+
type: 'info'
116+
// callback: () => {
117+
// // Redirect to login page after confirmation
118+
// this.$router.replace({ path: '/login' });
119+
// }
120+
}
121+
);
122122
123-
//显示输入验证码框
124-
this.showVerifyDialog = true;
123+
// Show verification dialog
124+
this.showVerifyDialog = true;
125125
} else {
126126
this.$message.error('Registration failed, user already exists!');
127127
}
@@ -136,23 +136,28 @@ export default {
136136
}
137137
},
138138
139-
//然后请求后端验证
140-
verifyCode() {
141-
axios.post('http://47.252.36.46:8080/user/verifyCode', {
142-
email: this.userInfo.email,
143-
activeCode: this.activeCode
144-
}).then(res => {
145-
if (res.data.status_code === 1) { // 验证成功
146-
this.$message.success("Registration successful! Account activated.");
147-
this.$router.push('/login');
148-
} else { // 验证失败
149-
this.$message.error("Invalid verification code. Please try again.");
150-
this.showVerifyDialog = true; // 保持弹窗显示状态
151-
}
152-
}).catch(error => {
153-
this.$message.error("An error occurred. Please try again later.");
154-
});
155-
}
139+
// Verify email with 6-digit code
140+
verifyCode() {
141+
axios
142+
.post('http://47.252.36.46:8080/user/verifyCode', {
143+
email: this.userInfo.email,
144+
activeCode: this.activeCode
145+
})
146+
.then((res) => {
147+
if (res.data.status_code === 1) {
148+
// Success
149+
this.$message.success('Registration successful! Account activated.');
150+
this.$router.push('/login');
151+
} else {
152+
// Error
153+
this.$message.error('Invalid verification code. Please try again.');
154+
this.showVerifyDialog = true;
155+
}
156+
})
157+
.catch((error) => {
158+
this.$message.error('An error occurred. Please try again later.');
159+
});
160+
}
156161
}
157162
};
158163
</script>

0 commit comments

Comments
 (0)