This commit is contained in:
yj 2024-12-23 00:41:59 +08:00
parent 2b68401d29
commit 78c54f2ec6
1 changed files with 19 additions and 7 deletions

View File

@ -6,15 +6,18 @@
<div class="stats-container">
<div class="stat-box quantity-box" style="margin-right: 20px;" @click="goToShangpinIndex">
<span>商品数量</span>
<p>50</p>
<!-- <p>{{ productQuantity }}</p> -->
<p>30</p>
</div>
<div class="stat-box sales-box" style="margin-right: 20px;">
<span>评价数量</span>
<p>120</p>
<!-- <p>{{ commentQuantity }}</p> -->
<p>30</p>
</div>
<div class="stat-box order-box">
<span>订单数量</span>
<p>30</p>
<!-- <p>{{ orderQuantity }}</p> -->
<p>50</p>
</div>
</div>
<!-- 商品公告栏 -->
@ -45,12 +48,12 @@
</div>
</div>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import dayjs from 'dayjs';
//
@ -88,14 +91,17 @@ const currentNoticeIndex = ref(0);
//
const currentNotices = ref([]);
//
const updateCurrentNotices = () => {
const startIndex = currentNoticeIndex.value;
currentNotices.value = notices.value.slice(startIndex, startIndex + 3).map((notice, i) => notices.value[(startIndex + i) % notices.value.length]);
};
onMounted(() => {
//
updateDateTimeAndColor();
//
setInterval(() => {
@ -110,8 +116,15 @@ onMounted(() => {
currentNoticeIndex.value = (currentNoticeIndex.value + 1) % notices.value.length;
updateCurrentNotices();
}, 3000);
});
//
fetchOrderQuantity();
// fetchProductQuantity();
// fetchCommentQuantity();
setInterval(() => {
fetchOrderQuantity();
}, 60000);
});
const updateDateTimeAndColor = () => {
const now = dayjs();
currentDateTime.value = now.format('YYYY-MM-DD HH:mm:ss');
@ -124,7 +137,6 @@ const updateDateTimeAndColor = () => {
};
</script>
<style scoped lang="scss">
.app-container {
padding: 20px;