This commit is contained in:
Mrx
2026-02-28 11:07:13 +08:00
parent 072a258e53
commit 2fad9bd3dd
2 changed files with 45 additions and 35 deletions

View File

@@ -33,6 +33,8 @@
<script setup> <script setup>
import { aesDecrypt } from "@/utils/crypto"; import { aesDecrypt } from "@/utils/crypto";
import { useAliyunCaptcha } from '@/composables/useAliyunCaptcha'
const { runWithCaptcha } = useAliyunCaptcha()
const showApplyPopup = ref(false); const showApplyPopup = ref(false);
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
@@ -48,6 +50,7 @@ const agentApply = () => {
showApplyPopup.value = true; showApplyPopup.value = true;
}; };
// 跳转到首页 // 跳转到首页
const goToHome = () => { const goToHome = () => {
router.replace("/promote"); router.replace("/promote");
@@ -86,16 +89,20 @@ const submitApplication = async (formData) => {
const isLoggedIn = !!localStorage.getItem("token"); const isLoggedIn = !!localStorage.getItem("token");
const apiCall = isLoggedIn ? applyForAgent : registerByInviteCode; const apiCall = isLoggedIn ? applyForAgent : registerByInviteCode;
// 使用滑块验证码保护申请接口
runWithCaptcha(
(captchaVerifyParam) => {
let postData = { let postData = {
region, region,
mobile, mobile,
wechat_id, wechat_id,
code, code,
referrer, referrer,
captchaVerifyParam,
}; };
return apiCall(postData);
const { data, error } = await apiCall(postData); },
async ({ data, error }) => {
if (data.value && !error.value) { if (data.value && !error.value) {
if (data.value.code === 200) { if (data.value.code === 200) {
showApplyPopup.value = false; showApplyPopup.value = false;
@@ -119,8 +126,11 @@ const submitApplication = async (formData) => {
} }
} else { } else {
console.log("申请失败", data.value); console.log("申请失败", data.value);
showToast({ message: data.value.msg || "申请失败" });
} }
} }
}
);
}; };
</script> </script>

View File

@@ -15,8 +15,8 @@ export default defineConfig({
strictPort: true, // 如果端口被占用则抛出错误而不是使用下一个可用端口 strictPort: true, // 如果端口被占用则抛出错误而不是使用下一个可用端口
proxy: { proxy: {
"/api/v1": { "/api/v1": {
target: "http://127.0.0.1:8888", // 本地接口地址 // target: "http://127.0.0.1:8888", // 本地接口地址
// target: "https://www.quannengcha.com", // 线上接口地址 target: "https://www.quannengcha.com", // 线上接口地址
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path, // 可选:确保路径不被修改 rewrite: (path) => path, // 可选:确保路径不被修改
}, },