1、baseurl

This commit is contained in:
2025-07-18 18:06:55 +08:00
parent b837e4da11
commit e233e2be86
69 changed files with 340 additions and 1912 deletions

View File

@ -1,6 +1,15 @@

let NAV_MENU_STATUS = false;
const requestApi = 'http://proxy.apiapl.com/api/v1';
let requestApi;
if (window.location.protocol === "file:") {
// 本地打开 index.htmlfile://),默认指向本地开发服务
requestApi = "http://192.168.2.22:8086/api/v1";
} else {
// 部署到服务器时自动适配
requestApi = `${window.location.protocol}//${window.location.host}/api/v1`;
}
let kwdValue = new URLSearchParams(window.location.search).get('kwd');
let invitCode = new URLSearchParams(window.location.search).get('code');
if (kwdValue) {
@ -10,7 +19,7 @@ if(invitCode){
localStorage.setItem("invitCode", invitCode);
}
// const $POST_P = async (u, d) => $.post(_payApi + u, { ...d,session: localStorage.getItem("session") || "" });
// const requestApi = 'http://proxy.apiapl.com/api/v1';
// const requestApi = `${window.location.protocol}//${window.location.host}`;
const loading = async (v) =>{
if (typeof v == "undefined" || v) {
if ($(".lo_loading").length) {

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,14 @@
const rParam = searchParams.get("r");
let submitFlag = false;
$(".login_btn").on("click", function () {
$(".login_btn").on("click", login);
$("#login-code input").on("keydown", function (e) {
if (e.key === "Enter" || e.keyCode === 13) {
login();
}
});
function login() {
let _lang = $("#language").val();
var email = $("#login_email input").val();
var password = $("#login_pwd input").val();
@ -28,6 +35,15 @@
$("#login_pwd").removeClass("error");
$("#login_pwd .error_tip").hide();
}
if (code == "" || code == undefined) {
$("#login-code").addClass("error");
$("#login-code .error_tip").show();
} else {
$("#login-code").removeClass("error");
$("#login-code .error_tip").hide();
}
if (submitFlag) return;
submitFlag = true;
$(".loading-mask").show();
@ -76,10 +92,11 @@
},
error: function () {
submitFlag = false;
reloadCaptcha();
$(".loading-mask").hide();
},
});
});
}
const $passwordInput = $("#login_pwd input");
const $eyeIcon = $("#eyeIcon");

View File

@ -1,6 +1,6 @@

// let NAV_MENU_STATUS = false;
const requestApi = 'http://proxy.apiapl.com/api/v1';
const requestApi = `${window.location.protocol}//${window.location.host}`;
let kwdValue = new URLSearchParams(window.location.search).get('kwd');
let invitCode = new URLSearchParams(window.location.search).get('code');

View File

@ -1,2 +1,2 @@
const requestUrl="http://proxy.apiapl.com/api/v1";
const baseUrl="http://proxy.apiapl.com";
const requestUrl="http://192.168.2.22:8086/api/v1";
const baseUrl="http://192.168.2.22:8086";

View File

@ -1,94 +1,168 @@

$(function(){
const url = window.location.href;
const searchParams = new URLSearchParams(new URL(url).search);
const rParam = searchParams.get('r');
let submitFlag = false;
if(localStorage.getItem("invitCode")){
$("#keyword input").val(localStorage.getItem("invitCode"))
$(function () {
const url = window.location.href;
const searchParams = new URLSearchParams(new URL(url).search);
const rParam = searchParams.get("r");
let submitFlag = false;
if (localStorage.getItem("invitCode")) {
$("#keyword input").val(localStorage.getItem("invitCode"));
}
$(".login_btn").on("click", register);
$("#login-code input").on("keydown", function (e) {
if (e.key === "Enter" || e.keyCode === 13) {
register();
}
$(".login_btn").on("click",function (){
let _lang = $('#language').val();
});
var email = $("#login_email input").val();
var password = $("#login_pwd input").val();
var code = $("#keyword input").val();
if (email == "" || email == undefined){
$("#login_email").addClass("error");
$("#login_email .error_tip").show();
return;
}else {
$("#login_email").removeClass("error");
$("#login_email .error_tip").hide();
function register() {
let _lang = $("#language").val();
var email = $("#login_email input").val();
var password = $("#login_pwd input").val();
var confirmPassword = $("#confirm_pwd input").val();
var code = $("#login-code input").val();
var uuid = localStorage.getItem("uuid");
if (email == "" || email == undefined) {
$("#login_email").addClass("error");
$("#login_email .error_tip").show();
return;
} else {
$("#login_email").removeClass("error");
$("#login_email .error_tip").hide();
}
if (password == "" || password == undefined) {
$("#login_pwd").addClass("error");
$("#login_pwd .error_tip").show();
return;
} else {
$("#login_pwd").removeClass("error");
$("#login_pwd .error_tip").hide();
}
if (confirmPassword == "" || confirmPassword == undefined) {
$("#confirm_pwd").addClass("error");
$("#confirm_pwd .error_tip").show();
return;
} else {
$("#confirm_pwd").removeClass("error");
$("#confirm_pwd .error_tip").hide();
}
if (code == "" || code == undefined) {
$("#login-code").addClass("error");
$("#login-code .error_tip").show();
} else {
$("#login-code").removeClass("error");
$("#login-code .error_tip").hide();
}
if (password != confirmPassword) {
messageFn(_lang === "zh" ? "密码不一致" : "password not match");
return;
}
if (submitFlag) return;
submitFlag = true;
$(".loading-mask").show();
$.ajax({
url: requestApi + "/signup",
dataType: "json",
type: "POST",
aysc: false,
contentType: "application/json; charset=utf-8",
data: JSON.stringify({
lang: _lang,
email: email,
pwd: password,
kwd: confirmPassword,
code: code,
uuid: uuid,
}),
success: function (res) {
try {
if (res.code === 200) {
localStorage.setItem("session", res.data.token);
// localStorage.setItem("user", JSON.stringify(res.data));
const expiresDate = new Date();
const expires =
res.data.expire == 0 ? 9999999999999 : res.data.expire;
expiresDate.setDate(expiresDate.getDate() + expires);
const domain = window.location.host.split(".").slice(-2).join(".");
Cookies.set("common_session", res.data.token, {
expires: expiresDate,
domain,
});
messageFn(_lang === "zh" ? "注册成功" : "register success");
window.location.href = "cli-traffic.html";
} else {
messageFn(res.msg);
reloadCaptcha();
}
} catch (err) {
} finally {
submitFlag = false;
$(".loading-mask").hide();
}
if (password == "" || password == undefined){
$("#login_pwd").addClass("error");
$("#login_pwd .error_tip").show();
return;
}else {
$("#login_pwd").removeClass("error");
$("#login_pwd .error_tip").hide();
}
if(submitFlag) return;
submitFlag = true;
$('.loading-mask').show();
$.ajax({
url: requestApi+"/v1/signup",
dataType:"json",
type:"POST",
aysc:false,
data:{
"lang": _lang,
"email": email,
"pwd": password,
"kwd":localStorage.getItem("keyword"),
"pcode": code
},
success:function(res){
submitFlag = false;
$('.loading-mask').hide();
if(res.code == 0){
localStorage.setItem('session',res.data.token);
localStorage.setItem("user", JSON.stringify(res.data));
const expiresDate = new Date();
const expires = res.data.token_cache == 0 ? 9999999999999 : res.data.token_cache;
expiresDate.setDate(expiresDate.getDate() + expires);
const domain = window.location.host.split(".").slice(-2).join(".");
Cookies.set("common_session", res.data.token, { expires: expiresDate, domain});
if(res.data.country != 'CN'){
console.log(res.data.country)
fbq('track', 'Lead');
}
if(!rParam){
window.location.href = '/';
}else{
window.location.href = 'https://cliproxy.com'+rParam;
}
}else{
messageFn(res.msg);
}
},error:function () {
submitFlag = false;
$('.loading-mask').hide();
}
})
},
error: function () {
submitFlag = false;
reloadCaptcha();
$(".loading-mask").hide();
},
});
const $passwordInput = $('#login_pwd input');
const $eyeIcon = $('#eyeIcon');
}
$eyeIcon.on('click', function () {
if ($passwordInput.attr('type') === 'password') {
$passwordInput.attr('type', 'text');
$eyeIcon.attr('src', '/static/common/login/img/pwd-2.png');
const $passwordInput = $("#login_pwd input");
const $confirmPasswordInput = $("#confirm_pwd input");
const $eyeIcon = $("#eyeIcon");
const $confirmEyeIcon = $("#confirmEyeIcon");
const $codeImg = $("#codeImg");
$eyeIcon.on("click", function () {
if ($passwordInput.attr("type") === "password") {
$passwordInput.attr("type", "text");
$eyeIcon.attr("src", "static/picture/pwd-2.png");
} else {
$passwordInput.attr("type", "password");
$eyeIcon.attr("src", "static/picture/pwd-1.png");
}
});
$confirmEyeIcon.on("click", function () {
if ($confirmPasswordInput.attr("type") === "password") {
$confirmPasswordInput.attr("type", "text");
$confirmEyeIcon.attr("src", "static/picture/pwd-2.png");
} else {
$confirmPasswordInput.attr("type", "password");
$confirmEyeIcon.attr("src", "static/picture/pwd-1.png");
}
});
$codeImg.on("click", function () {
reloadCaptcha();
});
function reloadCaptcha() {
$.ajax({
url: requestApi + "/captcha",
dataType: "json",
type: "GET",
async: false,
success: function (res) {
if (res.code === 200) {
$("#codeImg").attr("src", res.data);
localStorage.setItem("uuid", res.id);
} else {
$passwordInput.attr('type', 'password');
$eyeIcon.attr('src', '/static/common/login/img/pwd-1.png');
messageFn(res.msg);
}
},
error: function (err) {
messageFn(err);
},
});
})
}
reloadCaptcha();
});