kongdeqiang
2026-02-24 8613999daac6a42bef5694f43c78d0988251137e
src/components/page/IndexXTYH.vue
@@ -228,6 +228,8 @@
    }
  },
  created(){
    //39服务器用的是code2字段,183服务器用的是code字段,这样就可以达到183访问的时候重新跳转到39服务器页面
    this.$message = Message; // 挂载全局Message,避免重复引入
    this.code = ''
    this.code2 = ''
@@ -254,36 +256,28 @@
      return;
    }
    var url = decodeURIComponent(window.location.href);
    const getUrlParams=(url) => {
      const params = {};
      const queryIndex = url.indexOf('?');
      if (queryIndex === -1) return params;
      const query = url.slice(queryIndex + 1);
      query.split('&').forEach(item => {
        const [key, val] = item.split('=');
        if (key) params[key] = val || '';
      });
      return params;
    }
    const params = getUrlParams(url);
    this.code = params.code || '';
    this.code2 = params.code2 || '';
    // 优化跳转逻辑(避免重复跳转)
    if (Object.keys(params).length > 2 && params.code && params.code2) {
      // 仅当参数完整时跳转(避免无限循环)
      window.location.href = `http://hesuancj.cn/#/index2?code=${encodeURIComponent(params.code)}&state=STATE&code2=${encodeURIComponent(params.code2)}`;
    var url = window.location.href;
    url = decodeURIComponent(url)
    var count = url.split('?').length-1;
    if(count >1){  //获取用户信息后跳回来本页面
      let data = this.getCodeFromUrl(url)
      window.location.href = `http://hesuancj.cn/#/index2?code=${encodeURIComponent(data.code)}&state=STATE&code2=${encodeURIComponent(data.code2)}`
      return;
    }
    var cs = url.split('?')[1];
    var cs_arr = cs.split('&');
    var cs={};
    for(var i=0;i<cs_arr.length;i++){
      cs[cs_arr[i].split('=')[0]] = cs_arr[i].split('=')[1]
    }
    this.code2 = cs.code2;
    this.code = cs.code;
    //初始化跳转 39 服务器
    if(this.code2 == null || this.code2 == ''){
      window.location.href = `http://hesuancj.cn/#/index2?code2=${params.code || ''}`;
      //window.location.href = "http://60.0.121.40:8889/#/IndexXTYH39?code2="+cs.code   //测试用的
      window.location.href = "http://hesuancj.cn/#/index2?code2="+cs.code  //正式
      return;
    }
    if(this.code != null && this.code != '') {
      this.dialogVisible = true  //立即支付弹框
    }else {