解决已知问题
This commit is contained in:
2
.env
2
.env
@@ -11,7 +11,7 @@ VITE_BAIDU_TONGJI_ACCESS_TOKEN=
|
|||||||
|
|
||||||
# 星火AI相关配置(可选)
|
# 星火AI相关配置(可选)
|
||||||
# 配置教程:https://docs.liuyuyang.net/docs/项目部署/API/星火大模型.html
|
# 配置教程:https://docs.liuyuyang.net/docs/项目部署/API/星火大模型.html
|
||||||
VITE_AI_APIPassword=
|
VITE_AI_APIPASSWORD=
|
||||||
VITE_AI_MODEL=lite
|
VITE_AI_MODEL=lite
|
||||||
|
|
||||||
# 高德地图Web API
|
# 高德地图Web API
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ VITE_BAIDU_TONGJI_ACCESS_TOKEN=
|
|||||||
VITE_BAIDU_TONGJI_REFRESH_TOKEN=
|
VITE_BAIDU_TONGJI_REFRESH_TOKEN=
|
||||||
|
|
||||||
# 星火AI相关配置
|
# 星火AI相关配置
|
||||||
VITE_AI_APIPassword=
|
VITE_AI_APIPASSWORD=
|
||||||
VITE_AI_MODEL=
|
VITE_AI_MODEL=
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ export default () => {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Authorization": `Bearer ${import.meta.env.VITE_AI_APIPassword}`
|
"Authorization": `Bearer ${import.meta.env.VITE_AI_APIPASSWORD}`
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
model: import.meta.env.VITE_AI_MODEL,
|
model: import.meta.env.VITE_AI_MODEL,
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export default () => {
|
|||||||
const siteId = import.meta.env.VITE_BAIDU_TONGJI_SITE_ID;
|
const siteId = import.meta.env.VITE_BAIDU_TONGJI_SITE_ID;
|
||||||
const token = import.meta.env.VITE_BAIDU_TONGJI_ACCESS_TOKEN;
|
const token = import.meta.env.VITE_BAIDU_TONGJI_ACCESS_TOKEN;
|
||||||
|
|
||||||
const response = await fetch(`/api/rest/2.0/tongji/report/getData?access_token=${token}&site_id=${siteId}&start_date=${date}&end_date=${date}&metrics=new_visitor_count%2Cnew_visitor_ratio&method=trend%2Ftime%2Fa&gran=day&area=`);
|
const response = await fetch(`/baidu/rest/2.0/tongji/report/getData?access_token=${token}&site_id=${siteId}&start_date=${date}&end_date=${date}&metrics=new_visitor_count%2Cnew_visitor_ratio&method=trend%2Ftime%2Fa&gran=day&area=`);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const { result } = data;
|
const { result } = data;
|
||||||
|
|
||||||
@@ -88,8 +88,8 @@ export default () => {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Spin spinning={loading}>
|
|
||||||
<div className="sm:px-7.5 col-span-12 rounded-lg border border-stroke bg-white px-5 pb-5 pt-7.5 shadow-default dark:border-strokedark dark:bg-boxdark xl:col-span-4">
|
<div className="sm:px-7.5 col-span-12 rounded-lg border border-stroke bg-white px-5 pb-5 pt-7.5 shadow-default dark:border-strokedark dark:bg-boxdark xl:col-span-4">
|
||||||
|
<Spin spinning={loading}>
|
||||||
<div className="mb-3 justify-between gap-4 sm:flex">
|
<div className="mb-3 justify-between gap-4 sm:flex">
|
||||||
<div>
|
<div>
|
||||||
<h5 className="text-xl font-semibold text-black dark:text-white">
|
<h5 className="text-xl font-semibold text-black dark:text-white">
|
||||||
@@ -100,11 +100,7 @@ export default () => {
|
|||||||
|
|
||||||
<div className="mb-2">
|
<div className="mb-2">
|
||||||
<div id="chartThree" className="mx-auto flex justify-center">
|
<div id="chartThree" className="mx-auto flex justify-center">
|
||||||
<ReactApexChart
|
<ReactApexChart options={options} series={state.series} type="donut" />
|
||||||
options={options}
|
|
||||||
series={state.series}
|
|
||||||
type="donut"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -129,7 +125,7 @@ export default () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</Spin>
|
</Spin>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -153,7 +153,7 @@ export default () => {
|
|||||||
const siteId = import.meta.env.VITE_BAIDU_TONGJI_SITE_ID;
|
const siteId = import.meta.env.VITE_BAIDU_TONGJI_SITE_ID;
|
||||||
const token = import.meta.env.VITE_BAIDU_TONGJI_ACCESS_TOKEN;
|
const token = import.meta.env.VITE_BAIDU_TONGJI_ACCESS_TOKEN;
|
||||||
|
|
||||||
const response = await fetch(`/api/rest/2.0/tongji/report/getData?access_token=${token}&site_id=${siteId}&start_date=${startDate}&end_date=${endDate}&metrics=pv_count%2Cip_count&method=overview%2FgetTimeTrendRpt`);
|
const response = await fetch(`/baidu/rest/2.0/tongji/report/getData?access_token=${token}&site_id=${siteId}&start_date=${startDate}&end_date=${endDate}&metrics=pv_count%2Cip_count&method=overview%2FgetTimeTrendRpt`);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const { result } = data;
|
const { result } = data;
|
||||||
setResult(result);
|
setResult(result);
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ export default () => {
|
|||||||
return acc;
|
return acc;
|
||||||
}, {} as { [key: string]: Web[] });
|
}, {} as { [key: string]: Web[] });
|
||||||
|
|
||||||
console.log("grouped:", grouped);
|
|
||||||
setList(grouped);
|
setList(grouped);
|
||||||
setListTemp(data);
|
setListTemp(data);
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
@@ -55,8 +54,6 @@ export default () => {
|
|||||||
// 获取网站类型列表
|
// 获取网站类型列表
|
||||||
const getWebTypeList = async () => {
|
const getWebTypeList = async () => {
|
||||||
const { data } = await getWebTypeListAPI();
|
const { data } = await getWebTypeListAPI();
|
||||||
console.log("typeList:", { data });
|
|
||||||
|
|
||||||
setTypeList(data);
|
setTypeList(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
2
src/types/env.d.ts
vendored
2
src/types/env.d.ts
vendored
@@ -6,7 +6,7 @@ interface ImportMetaEnv {
|
|||||||
readonly VITE_BAIDU_TONGJI_SITE_ID: string;
|
readonly VITE_BAIDU_TONGJI_SITE_ID: string;
|
||||||
readonly VITE_BAIDU_TONGJI_ACCESS_TOKEN: string;
|
readonly VITE_BAIDU_TONGJI_ACCESS_TOKEN: string;
|
||||||
|
|
||||||
readonly VITE_AI_APIPassword: string;
|
readonly VITE_AI_APIPASSWORD: string;
|
||||||
readonly VITE_AI_MODEL: string;
|
readonly VITE_AI_MODEL: string;
|
||||||
|
|
||||||
readonly VITE_GAODE_WEB_API: string;
|
readonly VITE_GAODE_WEB_API: string;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default defineConfig({
|
|||||||
'/baidu': {
|
'/baidu': {
|
||||||
target: 'https://openapi.baidu.com/',
|
target: 'https://openapi.baidu.com/',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
rewrite: (path) => path.replace(/^\/baidu/, ''),
|
||||||
},
|
},
|
||||||
'/qiniu': {
|
'/qiniu': {
|
||||||
target: 'https://rsf.qiniuapi.com/',
|
target: 'https://rsf.qiniuapi.com/',
|
||||||
|
|||||||
Reference in New Issue
Block a user