index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. <template>
  2. <div class="home-pages">
  3. <!-- 头部 -->
  4. <comHead v-if="headData.show" :row="headData" :datas="realList"></comHead>
  5. <!-- 热门方案 -->
  6. <indexTitle :datas="hotTitle"></indexTitle>
  7. <div class="hot-bos">
  8. <div v-for="(item, index) in hotList" :key="index" class="data-list flex-column-center hover-color" @click="onPath(item.url)">
  9. <div class="zi-hover color-[#101828] font-size-[16px] fw-600">{{ item.title || '' }}</div>
  10. <div class="mt-[2px] mb-[12px] color-[#364153] font-size-[14px]">{{ item.subtitle || '' }}</div>
  11. <el-image
  12. class="img"
  13. :src="item.imageUrl ? item.imageUrl : figure"
  14. :fit="item.imgType == 1 ? 'fill' : item.imgType == 2 ? 'contain' : 'cover'"
  15. />
  16. </div>
  17. </div>
  18. <!-- <navigation v-if="hotList.length > 0" :datas="hotList" :row="{ aspectRatio: 170 / 112, imageHeight: 112, number: 5 }"></navigation> -->
  19. <!-- 场景采购 -->
  20. <indexTitle :datas="sceneTitle"></indexTitle>
  21. <imageCube v-if="sceneList.length > 0" :datas="sceneList" :row="{ aspectRatio: 232 / 300 }"></imageCube>
  22. <!-- 大牌推荐 -->
  23. <indexTitle :datas="bigbrandTitle"></indexTitle>
  24. <brand
  25. v-if="bigbrandOne.coverImage && bigbrandList.length > 0"
  26. :row="{ imageUrl: bigbrandOne.coverImage, url: bigbrandOne.url, brandList: bigbrandList }"
  27. ></brand>
  28. <!-- 行家精选 -->
  29. <indexTitle :datas="expertTitle"></indexTitle>
  30. <comGoods :row="{ styleType: 1, goodsShow: [1, 2, 3], goodsTitleType: 3 }" :datas="expertList"></comGoods>
  31. <!-- 采购指南 -->
  32. <indexTitle :datas="procureTitle"></indexTitle>
  33. <advert v-if="procureList.length > 0" :row="{ navlList: procureList, styleType: 1, aspectRatio: 393 / 220 }"></advert>
  34. <!-- 循环-商品楼层 -->
  35. <div v-for="(item1, index1) in homeList" :key="index1">
  36. <discover :row="item1" :datas="item1.shopList"></discover>
  37. </div>
  38. <!-- 项目案例 -->
  39. <indexTitle :datas="projectTitle"></indexTitle>
  40. <comArticle v-if="projectList.length > 0" :datas="projectList" :row="{ dataType: 1, dataNumber: 4 }"></comArticle>
  41. </div>
  42. </template>
  43. <script setup lang="ts">
  44. import { onPath } from '@/utils/siteConfig';
  45. import indexTitle from '@/views/home/pccomponents/pages/indexTitle.vue';
  46. import comHead from '@/views/home/pccomponents/pages/head.vue';
  47. import navigation from '@/views/home/pccomponents/pages/navigation.vue';
  48. import imageCube from '@/views/home/pccomponents/pages/imageCube.vue';
  49. import brand from '@/views/home/pccomponents/pages/brand.vue';
  50. import comGoods from '@/views/home/pccomponents/pages/goods.vue';
  51. import advert from '@/views/home/pccomponents/pages/advert.vue';
  52. import discover from '@/views/home/pccomponents/pages/discover.vue';
  53. import comArticle from '@/views/home/pccomponents/pages/article.vue';
  54. import figure from '@/assets/images/figure.png';
  55. import {
  56. getSearchTitle,
  57. getHomeAdList,
  58. getYouYiZiXunPage,
  59. getEnterpriseMemberEquityList,
  60. getHomeThreeAdList,
  61. getHotSchemeTitle,
  62. getHotSchemeList,
  63. getScenePurchaseTitle,
  64. getScenePurchaseList,
  65. getPlatformFlashSaleTitle,
  66. getPlatformFlashSaleList,
  67. getPlatformFlashSaleBrand,
  68. getExpertSelectionTitle,
  69. getProcurementTopicsList,
  70. getPurchaseGuideTitle,
  71. getExpertSelectionList,
  72. getClassificationFloorList,
  73. getClassificationFloorDetail,
  74. getClassificationFloorLabel,
  75. getClassificationFloorDetail2,
  76. getProjectCaseTitle,
  77. getProjectCaseList,
  78. getHomeNav
  79. } from '@/api/home/index';
  80. const headData = ref<any>({});
  81. const realList = ref<any>([]);
  82. const hotTitle = ref<any>('');
  83. const hotList = ref<any>([]);
  84. const sceneTitle = ref<any>('');
  85. const sceneList = ref<any>([]);
  86. const expertTitle = ref<any>('');
  87. const expertList = ref<any>([]);
  88. const procureTitle = ref<any>('');
  89. const procureList = ref<any>([]);
  90. const projectTitle = ref<any>('');
  91. const projectList = ref<any>([]);
  92. const bigbrandTitle = ref<any>('');
  93. const bigbrandList = ref<any>([]);
  94. const bigbrandOne = ref<any>({});
  95. const homeList = ref<any>([]);
  96. onMounted(() => {
  97. document.documentElement.style.setProperty('--hover-color', '#E7000B');
  98. getHead();
  99. });
  100. //头部
  101. const getHead = async () => {
  102. headData.value.topStyle = 1;
  103. headData.value.toplabel = [];
  104. headData.value.classifyShow = true;
  105. headData.value.headType = 0;
  106. headData.value.leftStyle = 1;
  107. headData.value.carouselList = [];
  108. headData.value.advertNum = 1;
  109. headData.value.advertList = [];
  110. headData.value.realDataType = 1;
  111. headData.value.realNumber = 6;
  112. headData.value.navlList = [];
  113. try {
  114. const datas1 = await getSearchTitle(1);
  115. if (datas1.code == 200) {
  116. datas1.data.forEach((item: any) => {
  117. headData.value.toplabel.push({
  118. title: item.navigationName
  119. });
  120. });
  121. }
  122. const datas2 = await getHomeNav(1);
  123. headData.value.topNav = [];
  124. datas2.data.forEach((item: any) => {
  125. headData.value.topNav.push({
  126. title: item.navigationName,
  127. url: item.url ? item.url : ''
  128. });
  129. });
  130. const datas3 = await getHomeAdList({});
  131. if (datas3.code == 200) {
  132. datas3.data.forEach((item: any) => {
  133. headData.value.carouselList.push({
  134. imageUrl: item.imageUrl,
  135. url: item.link ? item.link : ''
  136. });
  137. });
  138. }
  139. const datas4 = await getHomeThreeAdList({});
  140. if (datas4.code == 200) {
  141. datas4.data.forEach((item: any) => {
  142. headData.value.advertList.push({
  143. imageUrl: item.imageUrl,
  144. url: item.link ? item.link : '',
  145. show: true
  146. });
  147. });
  148. // headData.value.advertList.push( headData.value.advertList[0]);
  149. }
  150. const datas5 = await getYouYiZiXunPage({});
  151. if (datas5.code == 200) realList.value = datas5.data;
  152. const datas6 = await getEnterpriseMemberEquityList({});
  153. if (datas6.code == 200) {
  154. datas6.data.forEach((item: any) => {
  155. headData.value.navlList.push({
  156. imageUrl: item.imageUrl,
  157. title: item.title,
  158. url: item.link ? item.link : ''
  159. });
  160. });
  161. }
  162. headData.value.show = true;
  163. } catch (error) {}
  164. };
  165. //热门方案标题
  166. getHotSchemeTitle({}).then((res) => {
  167. if (res.code == 200) {
  168. res.data.linkUrl = res.data.linkUrl ? res.data.linkUrl : '/plan';
  169. hotTitle.value = res.data;
  170. }
  171. });
  172. //热门方案列表
  173. getHotSchemeList({}).then((res) => {
  174. if (res.code == 200) {
  175. hotList.value = [];
  176. res.data.forEach((item: any, index: any) => {
  177. item.title = item.advertTitle;
  178. item.subtitle = item.advertBrief;
  179. item.imageUrl = item.coverImage;
  180. item.url = item.advertUrl ? item.advertUrl : '';
  181. hotList.value.push(item);
  182. // if (index < 4) hotList.value.push(item);
  183. });
  184. }
  185. });
  186. //场景采购标题
  187. getScenePurchaseTitle({}).then((res) => {
  188. if (res.code == 200) {
  189. res.data.linkUrl = res.data.linkUrl ? res.data.linkUrl : '/plan/procure';
  190. sceneTitle.value = res.data;
  191. }
  192. });
  193. //场景采购列表
  194. getScenePurchaseList({}).then((res) => {
  195. if (res.code == 200) {
  196. res.data.forEach((item: any) => {
  197. item.imageUrl = item.coverImage;
  198. item.url = item.advertUrl ? item.advertUrl : '';
  199. });
  200. sceneList.value = res.data;
  201. }
  202. });
  203. //大牌推荐标题(平台闪购标题)
  204. getPlatformFlashSaleTitle({}).then((res) => {
  205. if (res.code == 200) {
  206. res.data.linkUrl = res.data.linkUrl ? res.data.linkUrl : '/search/brand';
  207. bigbrandTitle.value = res.data;
  208. }
  209. });
  210. //大牌推荐列表(平台闪购列表)
  211. getPlatformFlashSaleList({}).then((res) => {
  212. if (res.code == 200 && res.data.length > 0) {
  213. bigbrandOne.value = res.data[0];
  214. bigbrandOne.value.url = res.data[0].advertUrl ? res.data[0].advertUrl : '';
  215. }
  216. });
  217. //大牌推荐列表(平台闪购列表)-右
  218. getPlatformFlashSaleBrand({}).then((res) => {
  219. if (res.code == 200 && res.data.length > 0) {
  220. res.data.forEach((item: any, index: any) => {
  221. item.title = item.brandName;
  222. item.imageUrl = item.brandLogo;
  223. item.url = '/search?type=1&brandId=' + item.id;
  224. if (index < 10) bigbrandList.value.push(item);
  225. });
  226. }
  227. });
  228. //行家精选标题
  229. getExpertSelectionTitle({}).then((res) => {
  230. if (res.code == 200) {
  231. res.data.linkUrl = res.data.linkUrl ? res.data.linkUrl : '/search/special';
  232. expertTitle.value = res.data;
  233. }
  234. });
  235. //行家精选列表
  236. getExpertSelectionList({}).then((res) => {
  237. if (res.code == 200) {
  238. expertList.value = res.data;
  239. }
  240. });
  241. //采购指南标题
  242. getPurchaseGuideTitle({}).then((res) => {
  243. if (res.code == 200) {
  244. res.data.linkUrl = res.data.linkUrl ? res.data.linkUrl : '/plan/guide';
  245. procureTitle.value = res.data;
  246. }
  247. });
  248. //采购指南列表
  249. getProcurementTopicsList({}).then((res) => {
  250. if (res.code == 200) {
  251. res.data.forEach((item: any) => {
  252. item.title = item.title;
  253. item.subtitle = item.subtitle;
  254. item.imageUrl = item.coverImage;
  255. item.url = '/plan_info/guide?id=' + item.id;
  256. });
  257. procureList.value = res.data;
  258. }
  259. });
  260. //外面循环
  261. getClassificationFloorList({}).then(async (res) => {
  262. if (res.code == 200) {
  263. for (const item of res.data) {
  264. item.title = item.floorName;
  265. item.subtitle = item.floorDescribe;
  266. item.titleUrl = '';
  267. item.planList = [];
  268. item.detectList = [];
  269. item.tabList = [];
  270. item.labelList = [];
  271. item.margin = {
  272. top: 15
  273. };
  274. // if (item.floorLabel) {
  275. // item.labelList = [];
  276. // item.floorLabel.split(',').forEach((item1: any, index1: any) => {
  277. // item.labelList.push({
  278. // title: item1,
  279. // url: ''
  280. // });
  281. // });
  282. // }
  283. try {
  284. const datas1 = await getClassificationFloorDetail(item.floorNo);
  285. if (datas1.code == 200 && datas1.data.length > 0) {
  286. item.imageUrl = datas1.data[0].advertiseImage;
  287. item.url = datas1.data[0].advertiseLink;
  288. datas1.data.forEach((item1: any) => {
  289. item1.title = item1.advertiseName;
  290. item1.subtitle = item1.advertiseDescribe;
  291. item1.imageUrl = item1.advertiseImage;
  292. item1.url = item1.advertiseLink ? item1.advertiseLink : '';
  293. });
  294. if (datas1.data.length > 1) {
  295. item.planList = datas1.data.slice(1, 4);
  296. }
  297. if (datas1.data.length > 4) {
  298. item.detectList = datas1.data.slice(4, 7);
  299. }
  300. }
  301. const datas2 = await getClassificationFloorLabel(item.floorNo);
  302. if (datas2.code == 200) {
  303. datas2.data.forEach((item1: any) => {
  304. if (item1.position == 0) {
  305. item.tabList.push({
  306. title: item1.labelName,
  307. url: item1.labelLink ? item1.labelLink : ''
  308. });
  309. } else {
  310. item.labelList.push({
  311. title: item1.labelName,
  312. url: item1.labelLink ? item1.labelLink : ''
  313. });
  314. }
  315. });
  316. }
  317. item.navList = datas2.data;
  318. const datas3 = await getClassificationFloorDetail2(item.floorNo);
  319. if (datas3.code == 200) item.shopList = datas3.data;
  320. } catch (error) {}
  321. }
  322. homeList.value = res.data;
  323. }
  324. });
  325. //项目案例标题(平台装修-项目案例)
  326. getProjectCaseTitle({}).then((res) => {
  327. if (res.code == 200) {
  328. res.data.linkUrl = res.data.linkUrl ? res.data.linkUrl : '/plan/project';
  329. projectTitle.value = res.data;
  330. }
  331. });
  332. //项目案例列表(平台装修-项目案例)
  333. getProjectCaseList({}).then((res) => {
  334. if (res.code == 200) {
  335. projectList.value = res.data;
  336. }
  337. });
  338. </script>
  339. <style lang="scss" scoped>
  340. .home-pages {
  341. width: 100%;
  342. padding-bottom: 30px;
  343. :deep(.hover-color) {
  344. cursor: pointer;
  345. &:hover {
  346. color: var(--hover-color) !important;
  347. .zi-hover {
  348. color: var(--hover-color) !important;
  349. }
  350. }
  351. }
  352. .hot-bos {
  353. display: flex;
  354. gap: 10px;
  355. width: 100%;
  356. max-width: 1500px;
  357. min-width: 1200px;
  358. margin: 0 auto;
  359. overflow: hidden;
  360. .data-list {
  361. min-height: 170px;
  362. cursor: pointer;
  363. flex: 0 0 calc((100% - 30px) / 4);
  364. background-color: #ffffff;
  365. border-radius: 5px;
  366. padding: 15px 10px;
  367. @media (min-width: 1320px) {
  368. flex: 0 0 calc((100% - 40px) / 5);
  369. }
  370. .img {
  371. height: 112px;
  372. aspect-ratio: 170 / 112;
  373. }
  374. }
  375. }
  376. }
  377. </style>