diff --git a/src/com/utils.js b/src/com/utils.js index 64ba331..730c58c 100644 --- a/src/com/utils.js +++ b/src/com/utils.js @@ -459,4 +459,31 @@ export function testBank(bank){ export function testPhone(phone){ let reg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/ return reg.test(phone) +} + +// 获取近一周的日期范围 +export function getLastWeekRange() { + // 获取当前日期 + let currentDate = new Date(); + let lastWeekStartDate = new Date(currentDate); + lastWeekStartDate.setDate(currentDate.getDate() - 7); + let lastWeekEndDate = new Date(currentDate); + lastWeekEndDate.setDate(currentDate.getDate() - 1); + return { + startDate: lastWeekStartDate, + endDate: lastWeekEndDate, + }; +} + +// 获取近一月的日期范围 +export function getLastMonthRange() { + let currentDate = new Date(); + let lastMonthStartDate = new Date(currentDate); + lastMonthStartDate.setMonth(currentDate.getMonth() - 1); + let lastMonthEndDate = new Date(currentDate); + lastMonthEndDate.setDate(currentDate.getDate() - 1); + return { + startDate: lastMonthStartDate, + endDate: lastMonthEndDate, + }; } \ No newline at end of file diff --git a/src/components/u-charts/config-ucharts.js b/src/components/u-charts/config-ucharts.js index 17b28b3..70e0b9b 100644 --- a/src/components/u-charts/config-ucharts.js +++ b/src/components/u-charts/config-ucharts.js @@ -71,6 +71,10 @@ const cfu = { return series[index].name+':'+series[index].data+'元' } }, + "windDirection":function(val, index, series, opts){ + let catenames = ['北风','东北风','东风','东南风','南风','西南风','西风','西北风']; + return catenames[val] + }, }, //这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在opts参数,会将demotype与opts中option合并后渲染图表。 "demotype":{ diff --git a/src/pages/index/meteorological.vue b/src/pages/index/meteorological.vue index c8d534d..1c681d5 100644 --- a/src/pages/index/meteorological.vue +++ b/src/pages/index/meteorological.vue @@ -1,34 +1,195 @@