适配 all-in-one lite 前端运行

This commit is contained in:
Chopper711
2026-06-11 14:57:51 +08:00
parent f05d03e770
commit be3b896df9
5 changed files with 54 additions and 12 deletions

View File

@@ -226,7 +226,11 @@ export default {
this.$refs[name].validate((valid) => {
if (valid) {
if (this.type) {
this.$refs.verify.init();
if (this.loginCaptchaBypassEnabled()) {
this.verifyChange({status: true});
} else {
this.$refs.verify.init();
}
} else {
let data = JSON.parse(JSON.stringify(this.formSms));
apiLogin.smsLogin(data).then((res) => {
@@ -325,9 +329,16 @@ export default {
// 开启滑块验证
verifyBtnClick() {
if (!this.verifyStatus) {
if (this.loginCaptchaBypassEnabled()) {
this.verifyStatus = true;
return;
}
this.$refs.verify.init();
}
},
loginCaptchaBypassEnabled() {
return typeof BASE !== "undefined" && (BASE.LOGIN_CAPTCHA_BYPASS === true || BASE.LOGIN_CAPTCHA_BYPASS === "true");
},
handleWebLogin(type) {
// 第三方登录
webLogin(type);

View File

@@ -29,6 +29,7 @@
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<script type="text/javascript" src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
<script type="text/javascript" src="<%= BASE_URL %>config.local.js"></script>
<!-- built files will be auto injected -->
</body>
</html>

View File

@@ -10,21 +10,33 @@
* 默认.env 文件中的变量作为开发环境的环境变量。
* env文件修改的话需要重新编译项目。
*/
const runtimeBase = typeof window !== "undefined" && window.BASE ? window.BASE : {};
const apiDev = runtimeBase.API_DEV || {};
const apiProd = runtimeBase.API_PROD || {};
const runtimeApi = apiProd.common || apiDev.common || "";
const normalizeUrl = (url) => {
if (!url) {
return "";
}
return url.endsWith("/") ? url : `${url}/`;
};
export default {
// 网站名称
WEBSITE_NAME: process.env.VUE_APP_WEBSITE_NAME || "LiLi IM",
// 默认请求IM的API
BASE_API_URL: process.env.VUE_APP_API_BASE_URL || "",
BASE_API_URL: runtimeApi || process.env.VUE_APP_API_BASE_URL || "",
// 默认请求的WS
BASE_WS_URL: process.env.VUE_APP_WEB_SOCKET_URL || "",
BASE_WS_URL: runtimeBase.IM_WS_URL || process.env.VUE_APP_WEB_SOCKET_URL || "",
// 默认请求公有接口相关 API
BASE_COMMON: process.env.VUE_APP_COMMON || "",
BASE_COMMON: apiProd.common || apiDev.common || process.env.VUE_APP_COMMON || "",
// 默认请求用户相关API
BASE_BUYER: process.env.VUE_APP_BUYER || "",
BASE_BUYER: apiProd.buyer || apiDev.buyer || process.env.VUE_APP_BUYER || "",
// 默认请求卖家相关的API
BASE_SELLER: process.env.VUE_APP_SELLER || "",
BASE_SELLER: apiProd.seller || apiDev.seller || process.env.VUE_APP_SELLER || "",
// 点击商品跳转到的地址
PC_URL: process.env.VUE_APP_PC_URL || "https://pc-b2b2c.pickmall.cn",
PC_URL: normalizeUrl(runtimeBase.PC_URL || process.env.VUE_APP_PC_URL || "https://pc-b2b2c.pickmall.cn"),
// 订单跳转商家订单页面
PC_STORE: process.env.VUE_APP_PC_STORE || 'https://store-b2b2c.pickmall.cn',
PC_STORE: normalizeUrl(runtimeBase.PC_STORE || process.env.VUE_APP_PC_STORE || "https://store-b2b2c.pickmall.cn"),
};

View File

@@ -132,7 +132,11 @@ export default {
// 登录操作
this.$refs.usernameLoginForm.validate((valid) => {
if (valid) {
this.$refs.verify.init();
if (this.loginCaptchaBypassEnabled()) {
this.verifyChange({ status: true });
} else {
this.$refs.verify.init();
}
}
});
},
@@ -155,9 +159,12 @@ export default {
})
.catch(() => {
this.loading = false;
});
});
this.$refs.verify.show = false;
},
loginCaptchaBypassEnabled() {
return typeof BASE !== "undefined" && (BASE.LOGIN_CAPTCHA_BYPASS === true || BASE.LOGIN_CAPTCHA_BYPASS === "true");
},
},
};
</script>

View File

@@ -216,7 +216,11 @@ export default {
if (this.loginType == 'passwordLogin') {
this.$refs.usernameLoginForm.validate((valid) => {
if (valid) {
this.$refs.verify.init();
if (this.loginCaptchaBypassEnabled()) {
this.verifyChange({ status: true });
} else {
this.$refs.verify.init();
}
}
});
} else if (this.loginType == 'mobileLogin') {
@@ -268,9 +272,16 @@ export default {
// 开启滑块验证
verifyBtnClick() {
if (!this.verifyStatus) {
if (this.loginCaptchaBypassEnabled()) {
this.verifyStatus = true;
return;
}
this.$refs.verify.init();
}
},
loginCaptchaBypassEnabled() {
return typeof BASE !== "undefined" && (BASE.LOGIN_CAPTCHA_BYPASS === true || BASE.LOGIN_CAPTCHA_BYPASS === "true");
},
},
};
</script>