index.vue 11 KB

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