优化了侧边栏数据请求代码
This commit is contained in:
parent
7ca272ab7e
commit
c4e53ee2b6
@ -15,7 +15,7 @@ const message = ref(''); // 用于存储要发送的消息
|
|||||||
* 万策页面进行保存筛选条件(保存的是一个请求参数),可在数据库的user_strategy表中查看。
|
* 万策页面进行保存筛选条件(保存的是一个请求参数),可在数据库的user_strategy表中查看。
|
||||||
* 通过https://wance.cqxqg.tech/api/v1/strategy/getStockPageList接口发送请求得到相关股票数据。
|
* 通过https://wance.cqxqg.tech/api/v1/strategy/getStockPageList接口发送请求得到相关股票数据。
|
||||||
* 后端的逻辑处理可在src/akshare_data/router.py文件中查看。
|
* 后端的逻辑处理可在src/akshare_data/router.py文件中查看。
|
||||||
* 由于user_strategy表中的信息仅仅是请求参数,对我在后续中对分组管理操作无任何帮助,所以我将请求返回来的数据进行存储在
|
* 由于user_strategy表中的信息仅仅是请求参数,对我在后续中对分组管理操作无法对接,所以我将请求返回来的数据进行存储在
|
||||||
* 新的一个数据库表中,名为new_user_strategy的数据库表中。
|
* 新的一个数据库表中,名为new_user_strategy的数据库表中。
|
||||||
* 最后通过新的接口,得到股票数据,显示在侧边栏中。
|
* 最后通过新的接口,得到股票数据,显示在侧边栏中。
|
||||||
* 下面代码的逻辑大致就是这样。
|
* 下面代码的逻辑大致就是这样。
|
||||||
@ -193,27 +193,30 @@ let stocktypes = ref<StockType[]>([
|
|||||||
info: [],
|
info: [],
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
axios({
|
|
||||||
url: 'http://127.0.0.1:8012/akshare/ganggudata',
|
const fetchData = async () => {
|
||||||
method: 'get',
|
const urls = [
|
||||||
}).then((res) => {
|
'http://127.0.0.1:8012/akshare/ganggudata',
|
||||||
stocktypes.value[0].info = res.data
|
'http://127.0.0.1:8012/akshare/meigudata',
|
||||||
cacheinfo.value.push(res.data)
|
'http://127.0.0.1:8012/akshare/hushendata'
|
||||||
})
|
];
|
||||||
axios({
|
|
||||||
url: 'http://127.0.0.1:8012/akshare/meigudata',
|
try {
|
||||||
method: 'get',
|
const responses = await Promise.all(urls.map(url => axios.get(url)));
|
||||||
}).then((res) => {
|
responses.forEach((res, index) => {
|
||||||
stocktypes.value[1].info = res.data
|
stocktypes.value[index].info = res.data;
|
||||||
cacheinfo.value.push(res.data)
|
cacheinfo.value.push(res.data);
|
||||||
})
|
});
|
||||||
axios({
|
} catch (error) {
|
||||||
url: 'http://127.0.0.1:8012/akshare/hushendata',
|
console.error('Error fetching data:', error);
|
||||||
method: 'get',
|
}
|
||||||
}).then((res) => {
|
};
|
||||||
stocktypes.value[2].info = res.data
|
|
||||||
cacheinfo.value.push(res.data)
|
fetchData();
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --------------------切换是否可见--------------------------
|
// --------------------切换是否可见--------------------------
|
||||||
const changestate = (item: any) => {
|
const changestate = (item: any) => {
|
||||||
item.state = !item.state
|
item.state = !item.state
|
||||||
|
Loading…
Reference in New Issue
Block a user