wip: 临时提交

This commit is contained in:
Ray.Hao
2025-05-28 23:39:26 +08:00
parent b2333e8b70
commit 9fba279490
37 changed files with 536 additions and 3128 deletions

View File

@@ -92,17 +92,25 @@
<script setup lang="ts">
import { dayjs } from "wot-design-uni";
import LogAPI, { VisitStatsVO } from "@/api/system/log";
// 定义访问统计数据类型
interface VisitStatsVO {
todayUvCount: number;
uvGrowthRate: number;
totalUvCount: number;
todayPvCount: number;
pvGrowthRate: number;
totalPvCount: number;
}
const current = ref<number>(0);
const visitStatsData = ref<VisitStatsVO>({
todayUvCount: 0,
uvGrowthRate: 0,
totalUvCount: 0,
todayPvCount: 0,
pvGrowthRate: 0,
totalPvCount: 0,
todayUvCount: 1234,
uvGrowthRate: 15.6,
totalUvCount: 45678,
todayPvCount: 5678,
pvGrowthRate: 23.4,
totalPvCount: 123456,
});
// 图表数据
@@ -163,6 +171,31 @@ const navList = reactive([
},
]);
// 生成静态的访问趋势数据
const generateStaticTrendData = (days: number) => {
const dates = [];
const ipList = [];
const pvList = [];
const today = new Date();
for (let i = days - 1; i >= 0; i--) {
const date = new Date(today);
date.setDate(today.getDate() - i);
dates.push(dayjs(date).format("MM-DD"));
// 生成模拟数据
ipList.push(Math.floor(Math.random() * 500) + 200);
pvList.push(Math.floor(Math.random() * 1000) + 500);
}
return {
dates,
ipList,
pvList,
};
};
function handleClick(e: any) {
console.log(e);
}
@@ -170,25 +203,27 @@ function onChange(e: any) {
console.log(e);
}
// 加载访问统计数据
// 加载访问统计数据(使用静态数据)
const loadVisitStatsData = async () => {
LogAPI.getVisitStats().then((data) => {
visitStatsData.value = data;
});
// 模拟异步加载
setTimeout(() => {
visitStatsData.value = {
todayUvCount: 1234,
uvGrowthRate: 15.6,
totalUvCount: 45678,
todayPvCount: 5678,
pvGrowthRate: 23.4,
totalPvCount: 123456,
};
}, 100);
};
// 加载访问趋势数据
// 加载访问趋势数据(使用静态数据)
const loadVisitTrendData = () => {
const endDate = new Date();
const startDate = new Date(endDate);
startDate.setDate(endDate.getDate() - recentDaysRange.value + 1);
// 模拟异步加载
setTimeout(() => {
const data = generateStaticTrendData(recentDaysRange.value);
const visitTrendQuery = {
startDate: dayjs(startDate).format("YYYY-MM-DD"),
endDate: dayjs(endDate).format("YYYY-MM-DD"),
};
LogAPI.getVisitTrend(visitTrendQuery).then((data) => {
const res = {
categories: data.dates,
series: [
@@ -203,7 +238,7 @@ const loadVisitTrendData = () => {
],
};
chartData.value = JSON.parse(JSON.stringify(res));
});
}, 100);
};
// 数据范围变化

View File

@@ -115,7 +115,7 @@
import { ref, reactive, computed } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { useToast } from "wot-design-uni";
import { useUserStore } from "@/store/modules/user";
import { useUserStore } from "@/store/modules/user.store";
import UserAPI, { type UserProfileForm } from "@/api/user";
import FileAPI, { type FileInfo } from "@/api/file";
import WechatProfile from "@/components/WechatProfile.vue";

View File

@@ -92,7 +92,7 @@
<script lang="ts" setup>
import { onLoad } from "@dcloudio/uni-app";
import { type LoginFormData } from "@/api/auth";
import { useUserStore } from "@/store/modules/user";
import { useUserStore } from "@/store/modules/user.store";
import { useToast } from "wot-design-uni";
import { ref } from "vue";

View File

@@ -153,8 +153,8 @@
<script lang="ts" setup>
import { useToast } from "wot-design-uni";
import { useUserStore } from "@/store/modules/user";
import { useThemeStore } from "@/store/modules/theme";
import { useUserStore } from "@/store/modules/user.store";
import { useThemeStore } from "@/store/modules/theme.store";
import { computed } from "vue";
const toast = useToast();

View File

@@ -35,7 +35,7 @@
</template>
<script lang="ts" setup>
import { useUserStore } from "@/store/modules/user";
import { useUserStore } from "@/store/modules/user.store";
import { checkLogin } from "@/utils/auth";
import { computed, ref } from "vue";
@@ -193,8 +193,6 @@ const handleLogout = () => {
// 检查登录状态
onLoad(() => {
if (!checkLogin()) return;
getCacheSize();
});
</script>

View File

@@ -114,12 +114,12 @@
<script lang="ts" setup>
import { onLoad, onShow } from "@dcloudio/uni-app";
import { useTheme } from "@/composables/theme/theme";
import { useThemeStore } from "@/store/modules/theme";
import { useTheme } from "@/composables/useTheme";
import { useThemeStore } from "@/store/modules/theme.store";
import { applyThemeOnPageShow } from "@/utils/theme";
import { ref, computed, watch, onMounted } from "vue";
const { toggleTheme, themeVars, theme, setThemeColor } = useTheme();
const { toggleTheme, themeVars, themeState, setThemeColor } = useTheme();
const themeStore = useThemeStore();
// 暗黑模式状态
@@ -151,7 +151,7 @@ const currentThemeColor = computed(() => {
});
// 监听暗黑模式变化
watch(theme, (newTheme) => {
watch(themeState, (newTheme) => {
isDark.value = newTheme === "dark";
});
@@ -240,8 +240,8 @@ const resetTheme = () => {
customColor.value = defaultColor;
// 重置为浅色模式
if (theme.value === "dark") {
toggleTheme("light");
if (themeState.value === "dark") {
toggleTheme();
}
uni.showToast({
@@ -261,7 +261,7 @@ onLoad(() => {
onMounted(() => {
// 初始化暗黑模式状态
isDark.value = theme.value === "dark";
isDark.value = themeState.value === "dark";
customColor.value = currentThemeColor.value;
});