CloudWise-OpenSource / FlyFish

FlyFish is a data visualization coding platform. We can create a data model quickly in a simple way, and quickly generate a set of data visualization solutions by dragging.
https://cloudwise.ai/flyFish.html
GNU General Public License v3.0
764 stars 162 forks source link

数据类型无法使用使用http数据,或者会引起跨域问题 #148

Closed weiyy2012 closed 2 years ago

weiyy2012 commented 2 years ago

问题一:数据类型无法使用使用http数据 step1: 配置: /lcapWeb/lcapWeb/www/web/screen/config/env.js useHttpProxy: true, step2: 应用开发中,数据类型选择http数据 step3:输入http地址 弹窗显示: SyntaxError: Failed to execute 'open' on 'XMLHttpRequest': Invalid URL;没有发起http请求

预期 不弹窗,发起http请求

问题二:会引起跨域问题 step1: 配置: /lcapWeb/lcapWeb/www/web/screen/config/env.js useHttpProxy: false, step2: 应用开发中,数据类型选择http数据 step3:输入http地址 弹窗显示: http请求不成功,提示跨域Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

预期 http请求成功,

github-actions[bot] commented 2 years ago

👋 @weiyy2012,感谢您给 FlyFish 提出了 issue。 ♥️ 我们会尽快确认问题,确认有效后将下一步计划和可能需要的时间回复给您。

RiseHao1029 commented 2 years ago

使用这种方法请求 let loadDataCource = new dv.adapter.DataSource("http", { url: "", method: "", // GET POST interval: "", // 定时拉取 vars: "{}", //json headers: "", apiSuccessCode: "200", apiSuccessCodeField: "code", getDataField: "data" }); loadDataCource.load({ //可以替换掉初始化的传参 }, (data) => {}, () => {}) env.js文件修改,增加代理 window.DATAVI_ENV = (function() { return { debug: true, apiDomain: 'http://127.0.0.1:9090', componentsDir: 'lcapWeb/www/components', useHttpProxy: true, screenAPI: { httpProxy: 'https://docp-ops.cloudwise.com/gateway/lcap-data-server/api/dataplateform/apiProxy', },
} })();