PcHeader.vue 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599
  1. <template>
  2. <header>
  3. <div class="topbar com-margin-auto com-flex com-width-1400">
  4. <nuxt-link :to="{ name: 'index' }">
  5. <img
  6. src="@/assets/img/logo.png"
  7. alt="PromoCollection Logo"
  8. id="logo" />
  9. </nuxt-link>
  10. <div class="search-input">
  11. <el-input
  12. v-model="keyword"
  13. placeholder="Search item here"
  14. @focus="focus"
  15. @blur="blur"
  16. @keyup.enter.native="goSearchResultPage">
  17. <i
  18. slot="suffix"
  19. class="el-input__icon el-icon-search"
  20. @click="goSearchResultPage"></i>
  21. </el-input>
  22. <div
  23. v-loading="loading"
  24. class="search-detail flex column stretch"
  25. :style="{ display: showType }">
  26. <div
  27. class="flex-auto flex center stretch no-result"
  28. v-if="
  29. !loading && result.cate.length < 1 && productsList.length < 1
  30. ">
  31. No results found for “{{ keyword }}”
  32. </div>
  33. <div
  34. v-else
  35. class="flex-auto flex stretch"
  36. style="overflow: hidden">
  37. <div class="category-list flex column start stretch">
  38. <p class="autocomplete-title sub">CATEGORIES</p>
  39. <ul class="stretch">
  40. <li
  41. v-for="item in result.firstCate"
  42. :key="item.id"
  43. class="flex column stretch">
  44. <nuxt-link
  45. :to="{
  46. name: 'category-firstCategory',
  47. params: {
  48. firstCategory: item.name
  49. .replace(/\s+/g, '-')
  50. .replace('-&', '')
  51. .toLowerCase(),
  52. },
  53. }">
  54. <p>{{ item.name }}</p>
  55. </nuxt-link>
  56. </li>
  57. <p
  58. v-if="result.subCate.length"
  59. class="autocomplete-title">
  60. SUB CATEGORIES
  61. </p>
  62. <li
  63. v-for="item in result.subCate"
  64. :key="item.id"
  65. class="flex column stretch">
  66. <nuxt-link
  67. v-if="item.lev === 2"
  68. :to="{
  69. name: 'category-firstCategory-secondCategory',
  70. params: {
  71. firstCategory: item.parentName
  72. .replace(/\s+/g, '-')
  73. .replace('-&', '')
  74. .toLowerCase(),
  75. secondCategory: item.name
  76. .replace(/\s+/g, '-')
  77. .replace('-&', '')
  78. .toLowerCase(),
  79. },
  80. }">
  81. <p>{{ item.name }}</p>
  82. </nuxt-link>
  83. <nuxt-link
  84. v-else
  85. :to="{
  86. name: 'category-firstCategory-secondCategory-thirdCategory',
  87. params: {
  88. firstCategory: item.grandName
  89. .replace(/\s+/g, '-')
  90. .replace('-&', '')
  91. .toLowerCase(),
  92. secondCategory: item.parentName
  93. .replace(/\s+/g, '-')
  94. .replace('-&', '')
  95. .toLowerCase(),
  96. thirdCategory: item.name
  97. .replace(/\s+/g, '-')
  98. .replace('-&', '')
  99. .toLowerCase(),
  100. },
  101. }">
  102. <p>{{ item.name }}</p>
  103. </nuxt-link>
  104. </li>
  105. </ul>
  106. </div>
  107. <div class="product-list flex-auto flex column stretch">
  108. <div class="flex between start">
  109. <p class="autocomplete-title">PRODUCTS</p>
  110. <nuxt-link
  111. v-if="result.total"
  112. :to="{
  113. name: 'category-searchResult',
  114. query: { keyword: keyword },
  115. }">
  116. <div class="seeAllResult">
  117. Show all {{ result.total }} Results
  118. </div>
  119. </nuxt-link>
  120. </div>
  121. <ul
  122. class="flex-auto flex column stretch"
  123. style="overflow-y: auto">
  124. <li
  125. v-for="item in productsList"
  126. :key="item.id">
  127. <nuxt-link
  128. :to="{
  129. name: 'product-code',
  130. params: { code: item.product_code },
  131. }">
  132. <img
  133. :src="
  134. item.image && !$mediaRegExp.test(item.image)
  135. ? $OSS_PREFIX + item.image
  136. : $utils.generateResizedImageUrl(item.image, 100)
  137. "
  138. alt="" />
  139. <div class="product-info">
  140. <p style="width:94%;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">{{ item.alias_name || item.product_name }}</p>
  141. <p>{{ item.product_code }}</p>
  142. </div>
  143. </nuxt-link>
  144. </li>
  145. <div
  146. class="no-result"
  147. v-if="!loading && productsList.length < 1">
  148. No results found for “{{ keyword }}”
  149. </div>
  150. </ul>
  151. </div>
  152. </div>
  153. <div class="sth-else">
  154. <span>Can't find what you're looking for?</span>
  155. <nuxt-link
  156. :to="{
  157. name: 'news-newsName',
  158. params: { newsName: 'indent-ideas', id: indentIdeasArticle.id },
  159. hash: '#formTag',
  160. }">
  161. click here
  162. </nuxt-link>
  163. </div>
  164. </div>
  165. </div>
  166. <div
  167. class="topbar-item com-flex"
  168. style="cursor: default"
  169. v-if="email">
  170. <img
  171. src="@/assets/img/help.png"
  172. alt="help" />
  173. <div class="topbar-item-right com-flex-item">
  174. <p style="margin-bottom: 6px">(+44)203 916 5098</p>
  175. <p>info@promocollection.uk</p>
  176. </div>
  177. </div>
  178. <div class="topbar-item com-flex">
  179. <div
  180. class="topbar-item com-flex"
  181. v-if="!email">
  182. <img src="@/assets/img/login.png" />
  183. <div class="topbar-item-right com-flex-item">
  184. <p @click="openDialog">Login</p>
  185. </div>
  186. </div>
  187. <div
  188. class="topbar-item"
  189. v-else>
  190. <el-popover
  191. placement="bottom-end"
  192. width="292"
  193. trigger="click"
  194. ref="userPopover">
  195. <div
  196. slot="reference"
  197. class="topbar-item-right-myAccount">
  198. <!-- <div class="greeting">
  199. Hello {{ $store.state.userInfo.contacts }}
  200. </div> -->
  201. <div class="flex center">
  202. <img src="@/assets/img/login.png" />
  203. <p>Hello, {{ $store.state.userInfo.contacts }}</p>
  204. <span class="el-icon-caret-bottom"></span>
  205. </div>
  206. </div>
  207. <div
  208. class="user-menu-panel flex column center"
  209. @click="closePopoverAndNavigate">
  210. <!-- <div class="greeting">
  211. Hello {{ $store.state.userInfo.contacts }}
  212. </div> -->
  213. <div class="user-menu-wrap">
  214. <div class="user-menu">
  215. <div class="menu-title">Client Portal</div>
  216. <!-- <div class="sub-menu">
  217. <nuxt-link
  218. :to="{
  219. path: '/home/myDetail',
  220. query: { type: 'enquiry' },
  221. }">
  222. <div class="flex">
  223. <div class="icon order"></div>
  224. <div class="sub-title">My Enquires</div>
  225. </div>
  226. </nuxt-link>
  227. </div> -->
  228. <div class="sub-menu">
  229. <nuxt-link
  230. :to="{
  231. path: '/home/myDetail',
  232. query: { type: 'all-orders' },
  233. }">
  234. <div class="flex">
  235. <div class="icon order"></div>
  236. <div class="sub-title">My Orders</div>
  237. </div>
  238. </nuxt-link>
  239. </div>
  240. <div style="height: 4px; width: 1px"></div>
  241. <div class="menu-title">Marketing Resources</div>
  242. <!-- <div class="sub-menu">
  243. <nuxt-link to="/home/video">
  244. <div class="flex">
  245. <div class="icon video"></div>
  246. <div class="sub-title">Videos</div>
  247. </div>
  248. </nuxt-link>
  249. </div> -->
  250. <!-- <div class="sub-menu">
  251. <a
  252. href="https://www.flipsnack.com/promocollection/"
  253. target="_blank">
  254. <div class="flex">
  255. <div class="icon book"></div>
  256. <div class="sub-title">Catalogue</div>
  257. </div>
  258. </a>
  259. </div> -->
  260. <div class="sub-menu">
  261. <nuxt-link to="/media">
  262. <div class="flex">
  263. <div class="icon book"></div>
  264. <div class="sub-title">Media Centre</div>
  265. </div>
  266. </nuxt-link>
  267. </div>
  268. <div class="sub-menu">
  269. <a
  270. href="mailto:Info@promocollection.uk?subject=Sample%20Request">
  271. <div class="flex">
  272. <div class="icon mail"></div>
  273. <div class="sub-title">Sample Request</div>
  274. </div>
  275. </a>
  276. </div>
  277. <div class="sub-menu">
  278. <a
  279. href="mailto:Info@promocollection.uk?subject=Free%20Mockup%20Request">
  280. <div class="flex">
  281. <div class="icon mail"></div>
  282. <div class="sub-title">Mockup Request</div>
  283. </div>
  284. </a>
  285. </div>
  286. <div class="menu-title">
  287. <nuxt-link
  288. :to="{
  289. path: '/home/myDetail',
  290. query: { type: 'profile' },
  291. }">
  292. My Profile
  293. </nuxt-link>
  294. </div>
  295. <div class="menu-title">
  296. <div
  297. class="btn-logout"
  298. @click="logout">
  299. Sign Out
  300. </div>
  301. </div>
  302. </div>
  303. </div>
  304. </div>
  305. </el-popover>
  306. </div>
  307. </div>
  308. </div>
  309. <nav>
  310. <ul class="com-width-1400 com-minwidth-1024 com-margin-auto">
  311. <li class="nav-list">
  312. <div class="nav-list-title">
  313. <span
  314. class="shopProducts"
  315. @click.stop="openShopProduct">
  316. Shop Products
  317. <i
  318. :class="
  319. isShopBlock ? 'el-icon-arrow-up' : 'el-icon-arrow-down'
  320. "></i>
  321. </span>
  322. </div>
  323. <Transition name="category">
  324. <div
  325. class="nav-menu border-radius"
  326. v-show="isShopBlock"
  327. @click="closeAllBlock">
  328. <div class="nav-menu-content">
  329. <div
  330. class="nav-menu-item"
  331. v-for="item1 in categoryList"
  332. :key="item1.id">
  333. <div class="primary-classification">
  334. <nuxt-link
  335. :to="{
  336. name: 'category-firstCategory',
  337. params: {
  338. firstCategory: item1.name
  339. .replace(/\s+/g, '-')
  340. .replace('-&', '')
  341. .toLowerCase(),
  342. },
  343. }">
  344. <div class="menu-item-icon">
  345. <img
  346. :src="
  347. item1.style && !$mediaRegExp.test(item1.style)
  348. ? $OSS_PREFIX + item1.style
  349. : item1.style
  350. "
  351. alt="" />
  352. </div>
  353. <div class="menu-item-title">
  354. {{ item1.name }}
  355. </div>
  356. </nuxt-link>
  357. <div class="menu-separator"></div>
  358. </div>
  359. <div
  360. class="secondary-classification"
  361. v-for="item2 in item1.child"
  362. :key="item2.id">
  363. <nuxt-link
  364. :to="{
  365. name: 'category-firstCategory-secondCategory',
  366. params: {
  367. firstCategory: item1.name
  368. .replace(/\s+/g, '-')
  369. .replace('-&', '')
  370. .toLowerCase(),
  371. secondCategory: item2.name
  372. .replace(/\s+/g, '-')
  373. .replace('-&', '')
  374. .toLowerCase(),
  375. },
  376. }">
  377. {{ item2.name }}
  378. </nuxt-link>
  379. </div>
  380. </div>
  381. </div>
  382. </div>
  383. </Transition>
  384. </li>
  385. <!-- <li class="nav-list">
  386. <div class="nav-list-title">
  387. <span
  388. class="LeadTime"
  389. @click.stop="openLeadTime">
  390. By Lead Time
  391. <i :class="isShopBlock?'el-icon-arrow-up':'el-icon-arrow-down'"></i>
  392. </span>
  393. </div>
  394. <Transition name="leadTime">
  395. <ul
  396. class="leadTime-list border-radius"
  397. v-show="isLeadTimeBlock"
  398. @click="closeAllBlock">
  399. <li
  400. class="leadTime-list-item"
  401. v-for="item in leadTime"
  402. :key="item.id">
  403. <nuxt-link
  404. :to="{ name: 'category', query: { lead_time: item.id } }">
  405. {{ item.name }}
  406. </nuxt-link>
  407. </li>
  408. </ul>
  409. </Transition>
  410. </li>
  411. <li class="nav-list">
  412. <div class="nav-list-title">
  413. <span
  414. class="Budget"
  415. @click.stop="openBudget"
  416. >By Budget
  417. <i :class="isShopBlock?'el-icon-arrow-up':'el-icon-arrow-down'"></i>
  418. </span>
  419. </div>
  420. <Transition name="budge">
  421. <ul
  422. class="budget-list border-radius"
  423. v-show="isBudgetBlock"
  424. @click.stop="closeAllBlock">
  425. <div
  426. class="budget-list-item"
  427. v-for="item in budget"
  428. :key="item.id">
  429. {{ item.name }}
  430. <div class="sub-item-wrap border-radius flex column stretch">
  431. <div class="budget-list-sub-item-title">QTY Needed</div>
  432. <div
  433. class="budget-list-item"
  434. v-for="(v, i2) in qtyList"
  435. :key="`${item.id}-${i2}`">
  436. <nuxt-link
  437. :to="{
  438. name: 'category',
  439. query: { pricetype: item.id, qty: v.value },
  440. }">
  441. {{ v.name }}
  442. </nuxt-link>
  443. </div>
  444. </div>
  445. </div>
  446. </ul>
  447. </Transition>
  448. </li> -->
  449. <li
  450. class="nav-list"
  451. @click="closeAllBlock">
  452. <!-- <a :href="'/category?feature=54'"> New products</a> -->
  453. <div class="nav-list-title">
  454. <nuxt-link
  455. :to="{ name: 'category', query: { feature: 54 } }"
  456. target="_self">
  457. New Products
  458. </nuxt-link>
  459. </div>
  460. </li>
  461. <li
  462. class="nav-list"
  463. @click="closeAllBlock">
  464. <div class="nav-list-title">
  465. <a href="/article/Compliance">
  466. Compliance
  467. </a>
  468. </div>
  469. </li>
  470. <li
  471. class="nav-list"
  472. @click="closeAllBlock">
  473. <div class="nav-list-title">
  474. <nuxt-link
  475. id="indentLink"
  476. :to="{
  477. name: 'news-newsName',
  478. params: { newsName: 'indent-ideas', id: indentIdeasArticle.id },
  479. }"
  480. target="_self">
  481. Bespoke Service
  482. </nuxt-link>
  483. </div>
  484. </li>
  485. <!-- <li
  486. class="nav-list"
  487. @click="closeAllBlock">
  488. <div class="nav-list-title">
  489. <nuxt-link
  490. to="/category/apparel/socks"
  491. target="_self">
  492. Sock Collection
  493. </nuxt-link>
  494. </div>
  495. </li> -->
  496. <!-- <li
  497. class="nav-list compare-list"
  498. @click="closeAllBlock">
  499. <div class="nav-list-title">
  500. <el-badge
  501. :value="compareList.length"
  502. class="item"
  503. v-show="compareList.length">
  504. </el-badge>
  505. <span>Wishlist</span>
  506. </div>
  507. <div class="compare-product">
  508. <div class="compare-product-title">
  509. <p>Product to Compare</p>
  510. <el-button
  511. class="compare-btn"
  512. size="mini"
  513. @click="compareAll">
  514. Compare All
  515. </el-button>
  516. </div>
  517. <div class="red-line"></div>
  518. <div
  519. class="prompt-info"
  520. v-show="!compareList.length">
  521. <ul>
  522. <li>
  523. Select products to compare by clicking the "Compare list +"
  524. batton on any product listing.
  525. </li>
  526. <li>You can compare up to 5 products.</li>
  527. <li>
  528. After selecting products, click on the "Compare All" button to
  529. view the comparison chart.
  530. </li>
  531. </ul>
  532. </div>
  533. <ul>
  534. <li
  535. v-for="item in compareList"
  536. :key="item.id">
  537. <div class="item-left">
  538. <img
  539. :src="
  540. item.main.image &&
  541. item.main.image.indexOf(
  542. 'http://promocollection.s3.ap-southeast-2.amazonaws.com'
  543. ) != -1
  544. ? item.main.image
  545. : 'https://www.promocollection.uk/' +
  546. item.main.image
  547. " />
  548. <p>{{ item.product_name }}</p>
  549. </div>
  550. <div
  551. class="item-right"
  552. @click="clearCompare(item.id)">
  553. <i class="el-icon-error"></i>
  554. </div>
  555. </li>
  556. </ul>
  557. <el-button
  558. class="clear-btn"
  559. size="mini"
  560. @click="clearAll"
  561. v-show="compareList.length">
  562. Clear All
  563. </el-button>
  564. </div>
  565. </li> -->
  566. </ul>
  567. </nav>
  568. <div class="header-redLine"></div>
  569. </header>
  570. </template>
  571. <script>
  572. import { mapMutations } from 'vuex'
  573. import cloneDeep from 'lodash.clonedeep'
  574. import algoliasearch from 'algoliasearch'
  575. export default {
  576. data() {
  577. return {
  578. // loaded: false,
  579. loading: false,
  580. timer: '',
  581. keyword: '',
  582. result: { cate: [], subCate: [], firstCate: [] },
  583. showType: 'none',
  584. matchingList: [],
  585. categoryList: [],
  586. // leadTime: [],
  587. budget: [],
  588. compareList: [],
  589. indentIdeasArticle: {},
  590. complianceArticle: {},
  591. isShopBlock: false,
  592. isLeadTimeBlock: false,
  593. isBudgetBlock: false,
  594. qtyList: [
  595. {
  596. value: 50,
  597. name: 50,
  598. },
  599. {
  600. value: 100,
  601. name: 100,
  602. },
  603. {
  604. value: 250,
  605. name: 250,
  606. },
  607. {
  608. value: 500,
  609. name: 500,
  610. },
  611. {
  612. value: 1000,
  613. name: '1,000',
  614. },
  615. {
  616. value: 2500,
  617. name: '2,500',
  618. },
  619. {
  620. value: 5000,
  621. name: '5,000',
  622. },
  623. {
  624. value: 10000,
  625. name: '10,000',
  626. },
  627. ],
  628. index: null,
  629. }
  630. },
  631. async fetch() {
  632. const p1 = this.$axios.post('/uk-api/common/shopProductList').then(res => {
  633. if (res.code === 1) {
  634. this.categoryList = res.result
  635. }
  636. })
  637. // const p2 = this.$axios.get('/api/home/lead_time').then(res => {
  638. // if (res.code === 1) {
  639. // this.leadTime = res.result.sort((a, b) => a.rank - b.rank)
  640. // }
  641. // })
  642. // const p3 = this.$axios
  643. // .post('/api/common/goodsFilterList', { pid: 2 })
  644. // .then(res => {
  645. // if (res.code === 1) {
  646. // this.budget = res.result
  647. // }
  648. // })
  649. const p4 = this.$axios
  650. .post('/uk-api/home/articleList', { keyword: 'Indent Ideas' })
  651. .then(res => {
  652. this.indentIdeasArticle = res.result.data[0] || {}
  653. })
  654. const p5 = this.$axios
  655. .post('/uk-api/home/articleList', { keyword: 'Compliance' })
  656. .then(res => {
  657. this.complianceArticle = res.result.data[0] || {}
  658. })
  659. // 并联异步操作,总耗时===耗时最长的单个请求。之前的逻辑是串联,总耗时为所有请求耗时的累加
  660. await Promise.all([p1, p4, p5])
  661. },
  662. computed: {
  663. email() {
  664. return this.$store.state.userInfo?.email
  665. },
  666. compareLists() {
  667. return this.$store.state.compareList
  668. },
  669. productsList() {
  670. if (this.result?.goods) {
  671. return this.result.goods.map(item => {
  672. const temp = {
  673. ...item,
  674. }
  675. if (item.img) {
  676. temp.image = !this.$mediaRegExp.test(item.img)
  677. ? this.$OSS_PREFIX + item.img
  678. : item.img
  679. }
  680. return temp
  681. })
  682. } else {
  683. return []
  684. }
  685. },
  686. },
  687. watch: {
  688. keyword: {
  689. handler(newValue, oldValue) {
  690. // if (newValue.length > 2 && this.loaded) {
  691. if (newValue.length > 2) {
  692. this.debounce(this.search, 700)
  693. } else {
  694. setTimeout(() => {
  695. this.showType = 'none'
  696. }, 501)
  697. }
  698. },
  699. deep: true,
  700. },
  701. compareLists: {
  702. handler(newValue, oldValue) {
  703. if (newValue) {
  704. this.compareList = cloneDeep(newValue)
  705. }
  706. },
  707. deep: true,
  708. immediate: true,
  709. },
  710. $route(to, from) {
  711. if (to.path == from.path && to.query.keyword != from.query.keyword) {
  712. location.reload()
  713. }
  714. if (!to.query.keyword) {
  715. this.keyword = ''
  716. }
  717. },
  718. },
  719. created() {},
  720. mounted() {
  721. // if (this.$route.query.keyword && this.$route.query.keyword.length) {
  722. // this.keyword = this.$route.query.keyword
  723. // }
  724. // setTimeout(() => {
  725. // this.loaded = true
  726. // }, 0)
  727. window.addEventListener('click', this.closeLeadtimeAndBudget)
  728. if (process.env.NODE_ENV === 'development') {
  729. const client = algoliasearch(
  730. '7KGEFE6I2Z',
  731. 'e39e202ace0a2fa12ea61095e6ede35d'
  732. )
  733. this.index = client.initIndex('test_uk')
  734. } else {
  735. const client = algoliasearch(
  736. '2340OWI595',
  737. '2d4c53cdcf2bab0c361e589c2c2272fa'
  738. )
  739. this.index = client.initIndex('product_uk')
  740. }
  741. },
  742. beforeDestroy() {
  743. window.removeEventListener('click', this.closeLeadtimeAndBudget)
  744. },
  745. methods: {
  746. ...mapMutations([
  747. 'openDialog',
  748. 'clearUserInfo',
  749. // 'clearCompareList',
  750. ]),
  751. debounce(fn, wait) {
  752. if (this.timer !== null) {
  753. clearTimeout(this.timer)
  754. }
  755. this.timer = setTimeout(fn, wait)
  756. },
  757. search() {
  758. this.result = { cate: [], subCate: [], firstCate: [] }
  759. this.showType = 'flex'
  760. this.loading = true
  761. const key = this.keyword ? this.keyword.trim() : ''
  762. if (this.index) {
  763. this.index
  764. .search(key, {
  765. hitsPerPage: 1000,
  766. })
  767. .then(({ nbHits, hits }) => {
  768. const temp = {
  769. goods: [],
  770. total: nbHits || hits.length || 0,
  771. cate: [],
  772. firstCate: [],
  773. subCate: [],
  774. }
  775. const t1 = []
  776. const t2 = []
  777. hits
  778. .filter(i => i.status === 1 || i.status === '1' || i.status)
  779. .forEach(item => {
  780. let colorImg = ''
  781. item.colour_imgs = JSON.parse(item.colour_imgs)
  782. item.colour_imgs.sort((a, b) => a.name.length - b.name.length)
  783. if (
  784. Array.isArray(item.colour_imgs) &&
  785. item.colour_imgs.length
  786. ) {
  787. item.colour_imgs.forEach(colorItem => {
  788. if (colorItem.name && colorItem.name.length) {
  789. if (
  790. new RegExp(colorItem.name.toLowerCase(), 'i').test(key)
  791. ) {
  792. console.log(
  793. item.product_code,
  794. colorItem.name,
  795. 'replace'
  796. )
  797. colorImg = colorItem.img
  798. } else if (
  799. /\s/.test(colorItem.name) &&
  800. colorItem.name
  801. .split(' ')
  802. .filter(a => a.length > 0)
  803. .some(b => new RegExp(b.toLowerCase(), 'i').test(key))
  804. ) {
  805. console.log(
  806. item.product_code,
  807. colorItem.name,
  808. 'advance replace'
  809. )
  810. colorImg = colorItem.img
  811. }
  812. }
  813. })
  814. item.colour_imgs.forEach(i => {
  815. if (i.name && i.name.length) {
  816. if (key.toLowerCase().includes(i.name.toLowerCase())) {
  817. console.log(
  818. item.product_code,
  819. i.name,
  820. 'complete replace'
  821. )
  822. colorImg = i.img
  823. }
  824. }
  825. })
  826. console.log('---')
  827. }
  828. temp.goods.push({
  829. ...item,
  830. img: colorImg || item.image || item.img,
  831. product_name: item.alias_name || item.product_name || item.name,
  832. })
  833. if (!item.category_id) return
  834. const id = parseInt(item.category_id)
  835. const categoryResult = this.getCategoryFromTree(
  836. id,
  837. this.categoryList
  838. )
  839. switch (categoryResult.lev) {
  840. case 1:
  841. if (!t1.includes(id)) {
  842. t1.push(id)
  843. temp.firstCate.push(categoryResult)
  844. }
  845. break
  846. case 2:
  847. case 3:
  848. if (!t2.includes(id)) {
  849. t2.push(id)
  850. temp.subCate.push(categoryResult)
  851. }
  852. // 当前商品在2 3 级, 搜索出来的分类里面应同时展示1级.
  853. if (!t1.includes(categoryResult.root.id)) {
  854. t1.push(categoryResult.root.id)
  855. temp.firstCate.push(categoryResult.root)
  856. }
  857. // no default
  858. }
  859. })
  860. this.result = temp
  861. })
  862. .finally(() => {
  863. this.loading = false
  864. })
  865. }
  866. },
  867. focus() {
  868. clearTimeout(this.timer)
  869. if (this.keyword) {
  870. this.showType = 'flex'
  871. }
  872. },
  873. blur() {
  874. this.timer = setTimeout(() => {
  875. this.showType = 'none'
  876. }, 200)
  877. },
  878. goSearchResultPage() {
  879. // 匹配同组件的路由更改query时, 页面不会被刷新
  880. // this.$router.push({
  881. // name: 'category-searchResult',
  882. // query: { keyword: this.keyword },
  883. // })
  884. location.href =
  885. location.origin +
  886. `/category/searchResult?keyword=${encodeURIComponent(this.keyword)}`
  887. },
  888. logout() {
  889. this.$store.dispatch('logout').then(() => {
  890. this.$router.push('/')
  891. })
  892. },
  893. compareAll() {
  894. if (this.compareList.length) {
  895. this.$router.push('/home/compareList')
  896. }
  897. },
  898. // clearCompare(id) {
  899. // this.$axios
  900. // .post('/api/home/compare_clear', {
  901. // id,
  902. // compare_keys: 'keys',
  903. // })
  904. // .then(res => {
  905. // if (res.code === 1) {
  906. // this.compareList.splice(
  907. // this.compareList.findIndex(item => item.id === id),
  908. // 1
  909. // )
  910. // }
  911. // })
  912. // },
  913. // clearAll() {
  914. // if (this.compareList.length) {
  915. // this.$axios
  916. // .post('/api/home/compare_clear', {
  917. // id: 0,
  918. // compare_keys: 'keys',
  919. // })
  920. // .then(res => {
  921. // if (res.code === 1) {
  922. // this.clearCompareList()
  923. // }
  924. // })
  925. // }
  926. // },
  927. openShopProduct() {
  928. this.isShopBlock = !this.isShopBlock
  929. this.isLeadTimeBlock = false
  930. this.isBudgetBlock = false
  931. },
  932. // openLeadTime() {
  933. // this.isLeadTimeBlock = !this.isLeadTimeBlock
  934. // this.isShopBlock = false
  935. // this.isBudgetBlock = false
  936. // },
  937. openBudget() {
  938. this.isBudgetBlock = !this.isBudgetBlock
  939. this.isLeadTimeBlock = false
  940. this.isShopBlock = false
  941. },
  942. closeAllBlock() {
  943. this.isShopBlock = false
  944. this.isLeadTimeBlock = false
  945. this.isBudgetBlock = false
  946. },
  947. closeLeadtimeAndBudget(e) {
  948. const className = e.target?.className
  949. if (!['shopProducts', 'LeadTime', 'Budget'].includes(className)) {
  950. this.isShopBlock = false
  951. this.isLeadTimeBlock = false
  952. this.isBudgetBlock = false
  953. }
  954. },
  955. closePopoverAndNavigate() {
  956. this.$refs.userPopover.doClose()
  957. },
  958. // 从分类树数据里面找到对应分类
  959. getCategoryFromTree(id, tree) {
  960. let result = {}
  961. if (!tree.length) return result
  962. tree.forEach(i => {
  963. if (i.id === id) {
  964. result = cloneDeep(i)
  965. result.lev = 1
  966. }
  967. if (!Array.isArray(i.child)) return
  968. i.child.forEach(secondCate => {
  969. if (secondCate.id === id) {
  970. result = cloneDeep(secondCate)
  971. result.parentName = i.name
  972. result.lev = 2
  973. result.root = {
  974. name: i.name,
  975. id: i.id,
  976. pid: 0,
  977. }
  978. }
  979. if (!Array.isArray(secondCate.child)) return
  980. secondCate.child.forEach(thirdCate => {
  981. if (thirdCate.id === id) {
  982. result = cloneDeep(thirdCate)
  983. result.parentName = secondCate.name
  984. result.grandName = i.name
  985. result.lev = 3
  986. result.root = {
  987. name: i.name,
  988. id: i.id,
  989. pid: 0,
  990. }
  991. }
  992. })
  993. })
  994. })
  995. return result
  996. },
  997. },
  998. }
  999. </script>
  1000. <style lang="scss" scoped>
  1001. .product-info {width:100%;}
  1002. header {
  1003. width: 100%;
  1004. position: fixed;
  1005. top: 0px;
  1006. left: 0px;
  1007. z-index: 100;
  1008. background-color: #fff;
  1009. .topbar {
  1010. min-width: 800px;
  1011. height: 92px;
  1012. display: flex;
  1013. align-items: center;
  1014. #logo {
  1015. cursor: pointer;
  1016. }
  1017. .search-input {
  1018. flex: 1;
  1019. padding: 0 26px 0 50px;
  1020. position: relative;
  1021. .search-detail {
  1022. z-index: 101;
  1023. padding: 12px 0 8px;
  1024. box-sizing: border-box;
  1025. width: calc(100% - 76px);
  1026. height: 320px;
  1027. position: absolute;
  1028. top: 52px;
  1029. background: #ffffff;
  1030. border: 1px solid #bebebe;
  1031. border-radius: 4px;
  1032. font-size: 12px;
  1033. font-weight: 400;
  1034. color: #333333;
  1035. .autocomplete-title {
  1036. height: 36px;
  1037. line-height: 36px;
  1038. margin-bottom: 8px;
  1039. font-size: 14px;
  1040. font-weight: bold;
  1041. color: #000000;
  1042. }
  1043. .category-list {
  1044. box-sizing: border-box;
  1045. padding: 0 12px;
  1046. height: 100%;
  1047. width: 35%;
  1048. min-width: 35%;
  1049. border-right: 1px solid #7f7f7f;
  1050. position: relative;
  1051. ul {
  1052. overflow-y: auto;
  1053. li {
  1054. width: 100%;
  1055. position: relative;
  1056. p {
  1057. box-sizing: border-box;
  1058. padding: 0 8px;
  1059. width: 100%;
  1060. height: 50px;
  1061. line-height: 50px;
  1062. color: #333;
  1063. font-size: 14px;
  1064. cursor: pointer;
  1065. &:hover {
  1066. background-color: #f5f5f5;
  1067. color: #0b6dc9;
  1068. }
  1069. }
  1070. }
  1071. }
  1072. }
  1073. .product-list {
  1074. padding: 0 16px;
  1075. ul li {
  1076. margin-bottom: 10px;
  1077. a {
  1078. display: flex;
  1079. justify-content: flex-start;
  1080. align-items: center;
  1081. img {
  1082. width: 43px;
  1083. height: 43px;
  1084. }
  1085. p {
  1086. height: 24px;
  1087. line-height: 24px;
  1088. margin-left: 5px;
  1089. }
  1090. }
  1091. &:hover {
  1092. background: #f5f5f5;
  1093. p {
  1094. color: #0b6dc9;
  1095. }
  1096. }
  1097. }
  1098. .seeAllResult {
  1099. text-align: center;
  1100. font-size: 14px;
  1101. font-weight: bold;
  1102. background-color: #00213b;
  1103. color: #fff;
  1104. padding: 0 12px;
  1105. line-height: 26px;
  1106. height: 26px;
  1107. border-radius: 4px;
  1108. }
  1109. }
  1110. .sth-else {
  1111. margin-top: 4px;
  1112. text-align: center;
  1113. height: 24px;
  1114. line-height: 24px;
  1115. font-size: 18px;
  1116. font-weight: 600;
  1117. color: #00213b;
  1118. a {
  1119. display: inline-block;
  1120. padding: 0 6px;
  1121. border-radius: 4px;
  1122. background-color: #00213b;
  1123. color: #fff;
  1124. box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.2);
  1125. }
  1126. a:hover {
  1127. background-color: #000;
  1128. }
  1129. }
  1130. }
  1131. }
  1132. .topbar-item {
  1133. font-weight: bold;
  1134. white-space: nowrap;
  1135. cursor: pointer;
  1136. .topbar-item-right {
  1137. padding: 0 30px 0 12px;
  1138. }
  1139. .topbar-item-right-myAccount {
  1140. // display: flex;
  1141. // align-items: center;
  1142. position: relative;
  1143. p {
  1144. margin-left: 10px;
  1145. }
  1146. .greeting {
  1147. position: absolute;
  1148. top: -20px;
  1149. left: 30px;
  1150. }
  1151. }
  1152. }
  1153. }
  1154. nav {
  1155. background-color: #00213b;
  1156. height: 52px;
  1157. // font-family: ProximaNova-Regular;
  1158. ul {
  1159. display: flex;
  1160. justify-content: space-between;
  1161. align-items: center;
  1162. li.nav-list {
  1163. width: 170px;
  1164. height: 52px;
  1165. font-size: 16px;
  1166. font-weight: 400;
  1167. color: #ffffff;
  1168. text-align: center;
  1169. line-height: 52px;
  1170. .nav-list-title {
  1171. font-weight: 600;
  1172. }
  1173. a {
  1174. display: block;
  1175. width: 100%;
  1176. color: #ffffff;
  1177. }
  1178. span {
  1179. display: inline-block;
  1180. cursor: pointer;
  1181. .el-icon-arrow-up,
  1182. .el-icon-arrow-down {
  1183. margin-left: 5px;
  1184. text-align: center;
  1185. }
  1186. }
  1187. .nav-menu {
  1188. width: 1400px;
  1189. height: 395px;
  1190. color: #fff;
  1191. background-color: RGB(56 54 55);
  1192. overflow: hidden;
  1193. .nav-menu-content {
  1194. box-sizing: border-box;
  1195. padding: 20px 0 0 20px;
  1196. margin: 0 auto;
  1197. display: flex;
  1198. justify-content: space-between;
  1199. .nav-menu-item {
  1200. position: relative;
  1201. width: 130px;
  1202. }
  1203. .primary-classification {
  1204. $width: 85px;
  1205. .menu-item-icon {
  1206. width: $width;
  1207. height: $width;
  1208. img {
  1209. width: 100%;
  1210. height: 100%;
  1211. }
  1212. }
  1213. &:hover {
  1214. .menu-item-title {
  1215. color: #0b6dc9;
  1216. }
  1217. }
  1218. .menu-item-title {
  1219. margin-top: 5px;
  1220. height: 24px;
  1221. font-size: 15px;
  1222. // font-size: 1.1rem;
  1223. font-weight: bold;
  1224. text-align: left;
  1225. line-height: 24px;
  1226. cursor: pointer;
  1227. white-space: normal;
  1228. word-break: keep-all;
  1229. overflow: hidden;
  1230. }
  1231. .menu-separator {
  1232. width: $width;
  1233. height: 1px;
  1234. background-color: #666;
  1235. margin: 12px 0;
  1236. }
  1237. }
  1238. .secondary-classification {
  1239. width: 100%;
  1240. font-size: 13px;
  1241. font-weight: 400;
  1242. line-height: 24px;
  1243. text-align: left;
  1244. cursor: pointer;
  1245. white-space: normal;
  1246. word-break: keep-all;
  1247. overflow: hidden;
  1248. }
  1249. }
  1250. }
  1251. .leadTime-list,
  1252. .budget-list {
  1253. display: flex;
  1254. flex-direction: column;
  1255. justify-content: flex-start;
  1256. color: #fff;
  1257. background-color: RGB(56 54 55);
  1258. text-align: center;
  1259. font-size: 14px;
  1260. width: 171px;
  1261. box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.15);
  1262. .budget-list-item,
  1263. .leadTime-list-item {
  1264. width: 171px;
  1265. height: 40px;
  1266. line-height: 40px;
  1267. min-height: 40px;
  1268. a {
  1269. display: block;
  1270. width: 100%;
  1271. height: 100%;
  1272. }
  1273. }
  1274. }
  1275. .sub-item-wrap {
  1276. display: none;
  1277. z-index: 1;
  1278. background-color: rgb(56 54 55);
  1279. position: absolute;
  1280. top: 0;
  1281. left: 170px;
  1282. .budget-list-item {
  1283. cursor: pointer;
  1284. }
  1285. .budget-list-sub-item-title {
  1286. width: 171px;
  1287. height: 40px;
  1288. line-height: 40px;
  1289. min-height: 40px;
  1290. }
  1291. // color: red;
  1292. }
  1293. .budget-list-item {
  1294. position: relative;
  1295. overflow: visible;
  1296. &:hover {
  1297. .sub-item-wrap {
  1298. display: flex;
  1299. }
  1300. }
  1301. }
  1302. .leadTime-list {
  1303. height: 280px;
  1304. }
  1305. .budget-list {
  1306. height: 360px;
  1307. }
  1308. .compare-product {
  1309. width: 543px;
  1310. background: #fff;
  1311. color: #333333;
  1312. box-shadow: 0px 1px 10px 0px rgba(7, 5, 5, 0.13);
  1313. margin-left: -372px;
  1314. padding: 31px 13px 14px 29px;
  1315. box-sizing: border-box;
  1316. visibility: hidden;
  1317. opacity: 0;
  1318. .compare-product-title {
  1319. display: flex;
  1320. justify-content: space-between;
  1321. align-items: center;
  1322. p {
  1323. font-size: 24px;
  1324. font-weight: bold;
  1325. }
  1326. .compare-btn {
  1327. width: 136px;
  1328. height: 38px;
  1329. background: #00213b;
  1330. border-radius: 4px;
  1331. color: #ffffff;
  1332. font-size: 14px;
  1333. }
  1334. }
  1335. .red-line {
  1336. width: 27px;
  1337. height: 7px;
  1338. background: #e90000;
  1339. }
  1340. .prompt-info {
  1341. font-size: 14px;
  1342. text-align: left;
  1343. line-height: 24px;
  1344. }
  1345. ul {
  1346. display: flex;
  1347. flex-direction: column;
  1348. justify-content: flex-start;
  1349. margin-top: 10px;
  1350. li {
  1351. display: flex;
  1352. justify-content: space-between;
  1353. align-items: center;
  1354. width: 500px;
  1355. .item-left {
  1356. display: flex;
  1357. justify-content: flex-start;
  1358. align-items: center;
  1359. img {
  1360. width: 30px;
  1361. height: 30px;
  1362. margin-right: 10px;
  1363. }
  1364. }
  1365. .el-icon-error {
  1366. color: #e90000;
  1367. font-size: 21px;
  1368. }
  1369. }
  1370. }
  1371. .clear-btn {
  1372. background: #e90000;
  1373. color: #fff;
  1374. font-size: 14px;
  1375. padding: 10px 20px;
  1376. }
  1377. }
  1378. &:hover {
  1379. div.nav-list-title {
  1380. color: #333333;
  1381. background-color: #e3e3e3;
  1382. a {
  1383. color: #333333;
  1384. background-color: #e3e3e3;
  1385. }
  1386. .el-icon-arrow-down {
  1387. color: #333333;
  1388. }
  1389. }
  1390. .compare-product {
  1391. opacity: 1;
  1392. visibility: visible;
  1393. transition: all 0.5s;
  1394. }
  1395. }
  1396. .menu-item-title:hover,
  1397. .secondary-classification:hover a {
  1398. color: #0b6dc9;
  1399. }
  1400. .leadTime-list-item:hover,
  1401. .budget-list-item:hover {
  1402. background: #0b6dc9;
  1403. color: #f5f5f5;
  1404. & > a {
  1405. background: #0b6dc9;
  1406. color: #f5f5f5;
  1407. width: 100%;
  1408. height: 100%;
  1409. }
  1410. }
  1411. }
  1412. }
  1413. }
  1414. :deep(.el-badge.item .el-badge__content) {
  1415. background-color: #e90000;
  1416. }
  1417. .header-redLine {
  1418. height: 4px;
  1419. background: #e90000;
  1420. }
  1421. }
  1422. :deep(.el-input) {
  1423. .el-input__inner {
  1424. border-radius: 18px;
  1425. }
  1426. }
  1427. :deep(.el-menu-item-group__title) {
  1428. padding: 0;
  1429. }
  1430. :deep(.el-submenu__title) {
  1431. font-family: Proxima Nova;
  1432. font-size: 14px;
  1433. color: #333333;
  1434. height: 40px;
  1435. line-height: 40px;
  1436. font-weight: bold;
  1437. &:hover {
  1438. color: #1a72b7;
  1439. }
  1440. }
  1441. :deep(.el-menu-item) {
  1442. font-family: Proxima Nova;
  1443. height: 40px;
  1444. line-height: 40px;
  1445. font-weight: bold;
  1446. color: #333333;
  1447. a {
  1448. display: inline-block;
  1449. width: 100%;
  1450. }
  1451. &:hover a {
  1452. color: #1a72b7;
  1453. }
  1454. }
  1455. :deep(.el-menu-item.is-active) {
  1456. a {
  1457. color: #1a72b7;
  1458. }
  1459. }
  1460. :deep(.el-menu-item-group) {
  1461. font-family: Proxima Nova;
  1462. .el-menu-item {
  1463. font-size: 12px;
  1464. font-weight: 400;
  1465. color: #333333;
  1466. &:hover a {
  1467. color: #1a72b7;
  1468. }
  1469. }
  1470. .is-active a {
  1471. color: #1a72b7;
  1472. font-size: 12px;
  1473. font-weight: 400;
  1474. }
  1475. }
  1476. @keyframes fade {
  1477. 0% {
  1478. height: 0;
  1479. }
  1480. }
  1481. .category-enter-active,
  1482. .leadTime-enter-active,
  1483. .budge-enter-active {
  1484. overflow: hidden;
  1485. animation: fade 0.3s ease-in-out;
  1486. }
  1487. .category-leave-active,
  1488. .leadTime-leave-active,
  1489. .budge-leave-active {
  1490. overflow: hidden;
  1491. animation: fade 0.3s ease-in-out reverse;
  1492. }
  1493. .border-radius {
  1494. border-radius: 6px;
  1495. }
  1496. .no-result {
  1497. margin-top: 120px;
  1498. font-size: 34px;
  1499. font-family: Proxima Nova;
  1500. font-weight: 600;
  1501. color: #797979;
  1502. }
  1503. .user-menu-panel {
  1504. width: 292px;
  1505. box-sizing: border-box;
  1506. padding: 0 0 20px;
  1507. font-size: 15px;
  1508. font-family: ProximaNova-Semibold, sans-serif;
  1509. color: #333;
  1510. & div {
  1511. box-sizing: border-box;
  1512. }
  1513. & > div {
  1514. padding-left: 27px;
  1515. padding-right: 27px;
  1516. }
  1517. .greeting {
  1518. width: 270px;
  1519. font-weight: 600;
  1520. padding-top: 18px;
  1521. padding-bottom: 18px;
  1522. padding-left: 11px;
  1523. padding-right: 11px;
  1524. border-bottom: 1px solid rgba(#002369, 0.3);
  1525. }
  1526. .btn-logout {
  1527. display: inline-block;
  1528. cursor: pointer;
  1529. }
  1530. }
  1531. .user-menu-wrap {
  1532. width: 100%;
  1533. padding-top: 6px;
  1534. padding-bottom: 24px;
  1535. }
  1536. .user-menu {
  1537. margin-top: 8px;
  1538. .menu-title {
  1539. font-weight: 600;
  1540. line-height: 36px;
  1541. }
  1542. .sub-menu {
  1543. font-family: Proxima Nova, sans-serif;
  1544. padding-left: 14px;
  1545. display: flex;
  1546. align-items: center;
  1547. .icon {
  1548. display: inline-block;
  1549. width: 20px;
  1550. height: 20px;
  1551. margin-right: 8px;
  1552. background-position: center;
  1553. background-repeat: no-repeat;
  1554. background-size: contain;
  1555. &.book {
  1556. background-image: url(~@/assets/img/header/book.png);
  1557. }
  1558. &.folder {
  1559. background-image: url(~@/assets/img/header/folder.png);
  1560. }
  1561. &.mail {
  1562. background-image: url(~@/assets/img/header/mail.png);
  1563. }
  1564. &.order {
  1565. background-image: url(~@/assets/img/header/order.png);
  1566. }
  1567. &.video {
  1568. background-image: url(~@/assets/img/header/video.png);
  1569. }
  1570. }
  1571. .sub-title {
  1572. display: inline-block;
  1573. line-height: 36px;
  1574. font-size: 14px;
  1575. }
  1576. &:hover {
  1577. .sub-title {
  1578. color: #409eff;
  1579. }
  1580. }
  1581. }
  1582. }
  1583. </style>