Kaynağa Gözat

feat(web): skip captcha verification in test mode (VUE_APP_SKIP_CAPTCHA=true)

Sisyphus 2 ay önce
ebeveyn
işleme
929dbbc54a

+ 2 - 1
cfc-web/.env.development

@@ -1 +1,2 @@
-VUE_APP_BASE_API=http://192.168.16.18:9082
+VUE_APP_BASE_API=http://192.168.16.18:9082
+VUE_APP_SKIP_CAPTCHA=true

+ 1 - 0
cfc-web/.env.production

@@ -1 +1,2 @@
 VUE_APP_BASE_API=
+VUE_APP_SKIP_CAPTCHA=true

+ 13 - 0
cfc-web/src/views/Login.vue

@@ -320,6 +320,19 @@ export default {
       captchaPassed: false
     }
   },
+  mounted() {
+    // 测试环境自动跳过滑块验证码
+    if (process.env.VUE_APP_SKIP_CAPTCHA === 'true') {
+      this.$nextTick(() => {
+        this.captchaPassed = true
+        // 将 SliderCaptcha 设为已通过状态
+        if (this.$refs.sliderCaptcha) {
+          this.$refs.sliderCaptcha.status = 'success'
+          this.$refs.sliderCaptcha.currentOffset = this.$refs.sliderCaptcha.trackWidth
+        }
+      })
+    }
+  },
   methods: {
     onCaptchaSuccess() {
       this.captchaPassed = true