Merge branch 'main' of http://172.16.100.91:3000/scout666/fiee-official-website
This commit is contained in:
commit
cfc22f0b1e
1215
src/views/historic-stock/data.js
Normal file
1215
src/views/historic-stock/data.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -44,7 +44,8 @@ import { NDataTable, NButton, NDropdown, NIcon } from "naive-ui";
|
||||
import { reactive, onMounted, h } from "vue";
|
||||
import axios from "axios";
|
||||
import { ChevronDownOutline } from "@vicons/ionicons5";
|
||||
|
||||
import defaultTableData from "../data";
|
||||
console.log("defaultTableData", defaultTableData);
|
||||
// 数据筛选选项
|
||||
const periodOptions = [
|
||||
{ label: "Daily", key: "Daily" },
|
||||
@ -130,106 +131,32 @@ const handleDurationChange = (key) => {
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getPageData();
|
||||
getPageDefaultData();
|
||||
});
|
||||
|
||||
const getPageData = async () => {
|
||||
const getPageDefaultData = async () => {
|
||||
try {
|
||||
// 实际项目中应该根据state.selectedPeriod和state.selectedDuration动态调整API请求
|
||||
let url =
|
||||
"https://stockanalysis.com/api/symbol/a/OTC-MINM/history?type=chart";
|
||||
const res = await axios.get(url);
|
||||
|
||||
// 转换API返回的数据为表格需要的格式
|
||||
// 注意:以下是模拟数据,实际应该根据API返回的数据结构调整
|
||||
state.tableData = [
|
||||
{
|
||||
date: "May 22, 2025",
|
||||
open: "1.87",
|
||||
high: "2.03",
|
||||
low: "1.85",
|
||||
close: "2.00",
|
||||
adjClose: "2.00",
|
||||
change: "-2.44%",
|
||||
volume: "2,103",
|
||||
},
|
||||
{
|
||||
date: "May 21, 2025",
|
||||
open: "2.05",
|
||||
high: "2.05",
|
||||
low: "2.05",
|
||||
close: "2.05",
|
||||
adjClose: "2.05",
|
||||
change: "-",
|
||||
volume: "4",
|
||||
},
|
||||
{
|
||||
date: "May 20, 2025",
|
||||
open: "2.05",
|
||||
high: "2.05",
|
||||
low: "1.86",
|
||||
close: "2.05",
|
||||
adjClose: "2.05",
|
||||
change: "-",
|
||||
volume: "11,042",
|
||||
},
|
||||
{
|
||||
date: "May 19, 2025",
|
||||
open: "2.04",
|
||||
high: "2.05",
|
||||
low: "1.85",
|
||||
close: "2.05",
|
||||
adjClose: "2.05",
|
||||
change: "-",
|
||||
volume: "6,204",
|
||||
},
|
||||
{
|
||||
date: "May 16, 2025",
|
||||
open: "2.05",
|
||||
high: "2.06",
|
||||
low: "1.85",
|
||||
close: "2.05",
|
||||
adjClose: "2.05",
|
||||
change: "2.50%",
|
||||
volume: "3,618",
|
||||
},
|
||||
{
|
||||
date: "May 15, 2025",
|
||||
open: "2.05",
|
||||
high: "2.05",
|
||||
low: "1.93",
|
||||
close: "2.00",
|
||||
adjClose: "2.00",
|
||||
change: "-1.48%",
|
||||
volume: "5,413",
|
||||
},
|
||||
{
|
||||
date: "May 14, 2025",
|
||||
open: "1.95",
|
||||
high: "2.05",
|
||||
low: "1.95",
|
||||
close: "2.03",
|
||||
adjClose: "2.03",
|
||||
change: "4.10%",
|
||||
volume: "8,886",
|
||||
},
|
||||
{
|
||||
date: "May 13, 2025",
|
||||
open: "2.26",
|
||||
high: "2.26",
|
||||
low: "1.80",
|
||||
close: "1.95",
|
||||
adjClose: "1.95",
|
||||
change: "-18.41%",
|
||||
volume: "10,750",
|
||||
},
|
||||
];
|
||||
|
||||
console.log("获取到的数据", state.tableData);
|
||||
let originalData = res.data.data;
|
||||
// 转换为日期格式
|
||||
let calcApiData = originalData.map((item) => [
|
||||
new Date(item[0]).toISOString().split("T")[0], // 转换时间戳为YYYY-MM-DD格式
|
||||
item[1],
|
||||
]);
|
||||
console.log("接口数据", calcApiData);
|
||||
state.tableData = defaultTableData;
|
||||
} catch (error) {
|
||||
console.error("获取数据失败", error);
|
||||
}
|
||||
};
|
||||
const getPageData = async () => {
|
||||
let url =
|
||||
"https://stockanalysis.com/api/symbol/a/OTC-MINM/history?type=chart";
|
||||
const res = await axios.get(url);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
Loading…
Reference in New Issue
Block a user