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

View File

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