| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- <template>
- <div class="real-pages">
- <div>
- <div class="real-info">
- <div class="title">{{ dataInfo.announcementTitle }}</div>
- <div class="time">{{ dataInfo.createTime }}</div>
- <div class="real-html" v-html="dataInfo.announcementContent"></div>
- </div>
- </div>
- <el-affix :offset="0" target=".real-pages">
- <div class="related-bos">
- <div class="related-box">
- <div class="flex-row-between related-title">
- <div>产品推荐</div>
- <div class="flex-row-start related-huan" @click="getList">
- <el-icon><Sort /></el-icon>
- <div style="margin-left: 4px">换一换</div>
- </div>
- </div>
- <div class="procure-bos">
- <div v-for="(item, index) in dataList" :key="index" class="procure-list" @click="onPath('/plan_info?id=' + item.id)">
- <img :src="item.coverImage" alt="" />
- <div class="procure1">{{ item.title }}</div>
- <div class="procure2">{{ item.releaseTime }}</div>
- </div>
- </div>
- </div>
- </div>
- </el-affix>
- <!--
- <div class="real-shop">
- <div class="shop-head flex-row-start">
- <div class="head1">为您推荐</div>
- <div class="head2">热门流行商品推荐</div>
- </div>
- <div class="data-bos">
- <div v-for="(item, index) in 9" :key="index" class="data-list">
- <img class="data-img" src="@/assets/images/login-background.jpg" alt="" />
- <div class="data-title">格力KFR-72LW/定频冷暖空调柜机3P</div>
- <div class="money">
- <span class="money1">¥1,299</span>
- <span class="money2">¥1,899</span>
- </div>
- </div>
- </div>
- </div> -->
- </div>
- </template>
- <script setup lang="ts">
- import { onPath } from '@/utils/siteConfig';
- import { getYouYzXunInfo } from '@/api/plan/index';
- import { getProcurementProgramList } from '@/api/plan/index';
- const id = ref<any>(null);
- const dataInfo = ref<any>({});
- const route = useRoute();
- const dataList = ref<any>([]);
- onMounted(() => {
- id.value = route.query.id;
- getInfo();
- getList();
- });
- const getInfo = () => {
- getYouYzXunInfo(id.value).then((res) => {
- if (res.code == 200) {
- dataInfo.value = res.data;
- }
- });
- };
- // 封装获取列表的逻辑
- const getList = () => {
- getProcurementProgramList({
- pageSize: 10,
- pageNum: 1
- }).then((res) => {
- if (res.code == 200) {
- if (res.rows && res.rows.length > 0) {
- if (res.rows.length <= 2) {
- dataList.value = res.rows;
- } else {
- dataList.value = getRandomElements(res.rows, 3);
- }
- }
- }
- });
- };
- function getRandomElements(arr: any, count: any) {
- if (count > arr.length) {
- throw new Error('要取的数量不能超过数组长度');
- }
- const copy = [...arr];
- const result = [];
- for (let i = 0; i < count; i++) {
- const randomIndex = Math.floor(Math.random() * copy.length);
- result.push(copy.splice(randomIndex, 1)[0]);
- }
- return result;
- }
- </script>
- <style lang="scss" scoped>
- .real-pages {
- width: 1200px;
- margin: 0 auto;
- display: flex;
- gap: 0 20px;
- padding-bottom: 50px;
- .real-info {
- width: 715px;
- background: #ffffff;
- border-radius: 10px;
- padding: 20px;
- .title {
- font-size: 20px;
- color: #101828;
- }
- .time {
- font-size: 14px;
- color: #364153;
- margin: 10px 0 18px 0;
- }
- .real-html {
- width: 679px;
- :deep(img) {
- max-width: 100%;
- height: auto;
- }
- }
- .img {
- width: 679px;
- height: 351px;
- border-radius: 10px;
- }
- .head {
- font-weight: 600;
- font-size: 14px;
- color: #101828;
- margin: 10px 0 18px 0;
- }
- .info {
- font-size: 14px;
- color: #364153;
- margin-bottom: 15px;
- }
- }
- .real-shop {
- flex: 1;
- .head1 {
- font-weight: 600;
- font-size: 20px;
- color: #101828;
- }
- .head2 {
- font-size: 14px;
- color: #364153;
- margin-left: 10px;
- }
- //数据
- .data-bos {
- display: flex;
- gap: 17px;
- flex-wrap: wrap;
- margin-top: 10px;
- width: 100%;
- .data-list {
- width: 224px;
- background: #ffffff;
- border-radius: 10px;
- padding: 20px 20px 22px 20px;
- cursor: pointer;
- .data-img {
- width: 184px;
- height: 184px;
- border-radius: 10px;
- }
- .data-title {
- margin-top: 4px;
- font-size: 14px;
- color: #101828;
- height: 40px;
- }
- .money {
- margin-top: 4px;
- .money1 {
- font-size: 16px;
- color: #e7000b;
- }
- .money2 {
- font-size: 12px;
- color: #99a1af;
- text-decoration: line-through;
- padding-left: 6px;
- }
- }
- .data-cat {
- width: 86px;
- height: 26px;
- background: #e7000b;
- border-radius: 2px;
- font-size: 14px;
- color: #ffffff;
- line-height: 26px;
- text-align: center;
- margin-top: 16px;
- }
- }
- }
- }
- .related-bos {
- flex: 1;
- .related-box {
- width: 100%;
- background-color: #ffffff;
- border-radius: 10px;
- padding: 20px;
- .related-title {
- font-size: 16px;
- color: #666666;
- .related-huan {
- font-size: 14px;
- cursor: pointer;
- }
- }
- // 采购指南
- .procure-bos {
- width: 100%;
- display: flex;
- flex-direction: column;
- margin-top: 12px;
- gap: 12px 0px;
- .procure-list {
- width: 100%;
- height: 268px;
- background: #ffffff;
- cursor: pointer;
- border-radius: 10px;
- overflow: hidden;
- border: 1px solid #d0d5dd;
- img {
- width: 100%;
- height: 200px;
- border-bottom: 1px solid #d0d5dd;
- }
- .procure1 {
- padding: 12px 0 4px 20px;
- font-weight: 600;
- font-size: 14px;
- color: #101828;
- }
- .procure2 {
- padding-left: 20px;
- font-size: 12px;
- color: #364153;
- }
- }
- }
- }
- }
- }
- </style>
|