提交 07e78f78 authored 作者: 张烨's avatar 张烨

feat:市场限制准入-概览页顶部增加新增调查数量显示

上级 33ae4eca
......@@ -11,10 +11,11 @@ export function getStatCount(params) {
}
// 分类接口
export function getStatSort() {
export function getStatSort(params) {
return request({
method: 'GET',
url: `/api/marketsearchHome/statSort`
url: `/api/marketsearchHome/statSort`,
params
})
}
......
......@@ -26,7 +26,7 @@
{{ item.sortDescription }}
</div>
</div>
<div class="item-dot">+{{ "999" }}</div>
<div class="item-dot" v-if="item.addInvestCount">+{{ item.addInvestCount }}</div>
</div>
</div>
</div>
......@@ -276,6 +276,7 @@ import CarouselItem301 from '@/views/marketAccessRestrictions/marketAccessHome/c
import CarouselItem232 from '@/views/marketAccessRestrictions/marketAccessHome/com/CarouselItem232.vue';
import setChart from "@/utils/setChart";
import { getDateBefore } from "@/views/marketAccessRestrictions/utils/index.ts";
import router from "@/router";
import createLineChart from "@/views/marketAccessRestrictions/utils/baseLineChart";
......@@ -330,9 +331,12 @@ let containerRef = ref(null);
// 首页分类
const sortInfo = ref([]);
const handleGetStatSort = async (event) => {
console.log('周期筛选', event)
let day = 365
if (event?.time === '近一周') day = 7
if (event?.time === '近一月') day = 30
if (event?.time === '近一年') day = 365
try {
const res = await getStatSort();
const res = await getStatSort({startDate: getDateBefore(day)});
console.log("首页分类", res);
// sortInfo.value = res.data.sort((a, b) => a.sortCode - b.sortCode);
sortInfo.value = res.data;
......
// 数字转中文(支持 0-99 整数)
export const onNumToChinese = (num:any) => {
/**
* 数字转中文(支持 0-99 整数)
* @param num 需要转化的数字
*/
export const onNumToChinese = (num:number) => {
// 1. 基础校验:只处理 0-99 的整数
if (!Number.isInteger(num) || num < 0 || num > 99) return '100';
// 2. 定义基础字符
......@@ -22,3 +25,20 @@ export const onNumToChinese = (num:any) => {
return singleChars[ten] + tenChar + (unit === 0 ? '' : singleChars[unit]);
}
}
/**
* 获取 n 天前的日期,格式:YYYY-MM-DD
* @param num 往前推的天数
*/
export const getDateBefore = (num: number) => {
const now = new Date();
const targetTime = now.getTime() - num * 24 * 60 * 60 * 1000;
const targetDate = new Date(targetTime);
const year = targetDate.getFullYear();
const month = String(targetDate.getMonth() + 1).padStart(2, '0');
const day = String(targetDate.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论