diff --git a/buyer/src/pages/Login.vue b/buyer/src/pages/Login.vue index 5b120474..b7736dcd 100644 --- a/buyer/src/pages/Login.vue +++ b/buyer/src/pages/Login.vue @@ -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); diff --git a/im/public/index.html b/im/public/index.html index 1dd7f3d8..29971e97 100644 --- a/im/public/index.html +++ b/im/public/index.html @@ -29,6 +29,7 @@ <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %> <% } %> + diff --git a/im/src/config/config.js b/im/src/config/config.js index d5396129..fe283a94 100644 --- a/im/src/config/config.js +++ b/im/src/config/config.js @@ -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 || "", + // 默认请求IM的API + 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"), }; diff --git a/manager/src/views/login.vue b/manager/src/views/login.vue index c1b78198..207cdc80 100644 --- a/manager/src/views/login.vue +++ b/manager/src/views/login.vue @@ -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"); + }, }, }; diff --git a/seller/src/views/login.vue b/seller/src/views/login.vue index 62dfc6d5..4d75f51a 100644 --- a/seller/src/views/login.vue +++ b/seller/src/views/login.vue @@ -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"); + }, }, };