Files
lingji-work-fe/src/views/components/workplace/index.vue

57 lines
1.5 KiB
Vue
Raw Normal View History

2025-06-24 00:02:21 -04:00
<!--
* @Author: RenXiaoDong
* @Date: 2025-06-23 21:11:42
-->
2025-06-16 14:42:26 +08:00
<template>
<div class="m-auto mt-24px max-w-1000px">
2025-07-01 17:28:18 +08:00
<Container title="推荐产品" class="container-body">
<div class="grid grid-cols-3 gap-20px">
<Product v-for="product in products" :key="product.id" :product="product" @refresh="getProductList" />
2025-06-16 14:42:26 +08:00
</div>
2025-07-01 16:39:47 +08:00
<NoData v-if="products.length === 0" />
2025-06-16 14:42:26 +08:00
</Container>
<Container title="成功案例" class="body mt-24px">
<div class="flex flex-wrap">
<Case v-for="item in cases" :key="item.id" class="mt-20px ml-20px" :data="item"></Case>
</div>
2025-07-01 16:39:47 +08:00
<NoData v-if="cases.length === 0" />
2025-06-16 14:42:26 +08:00
</Container>
</div>
</template>
<script setup lang="ts">
import Container from '@/components/container.vue';
2025-06-16 14:42:26 +08:00
import Product from '@/views/components/workplace/modules/product.vue';
import Case from '@/views/components/workplace/modules/case.vue';
import { fetchProductList, fetchSuccessCaseList } from '@/api/all/index';
import { ref, onMounted } from 'vue';
const products = ref([]);
const cases = ref([]);
onMounted(() => {
getProductList();
getSuccessCaseList();
});
const getProductList = async () => {
2025-06-24 00:02:21 -04:00
const { code, data } = await fetchProductList();
if (code === 200) {
products.value = data;
2025-06-23 09:38:09 +08:00
}
2025-06-16 14:42:26 +08:00
};
const getSuccessCaseList = async () => {
2025-06-24 00:02:21 -04:00
const { code, data } = await fetchSuccessCaseList();
if (code === 200) {
cases.value = data;
}
2025-06-16 14:42:26 +08:00
};
</script>
<style scoped lang="scss">
2025-07-01 17:28:18 +08:00
.container-body {
padding-left: 24px !important;
:deep(> div > .title) {
2025-07-01 17:28:18 +08:00
margin-bottom: 16px;
2025-06-16 14:42:26 +08:00
}
}
</style>