KindBox.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <div class="component">
  3. <div class="component-content">
  4. <div class="box-first" id="box-first" >
  5. <!-- <div class="box-item">类目:</div>-->
  6. <div class="box-kind" :class="boxFirstFixed == true ? 'isFixed' :''">
  7. <ul id="letter-nav">
  8. <!--| orderBy : 'namelength'-->
  9. <li class="text-num" v-for="(kind, index) in kinds" :style="index <= 6 || boxFirstFixed == true? 'border-bottom: 1px dashed #ccc;': 'border-bottom: 1px dashed #f1f4fb;'">
  10. <img class="content-thumbnail-list" :src="imgList[index]"><a :title="kind.nameCn" @click="scrollTo(kind.id)">{{kind.nameCn}}</a>
  11. </li>
  12. </ul>
  13. </div>
  14. </div>
  15. <div class="showKindId"></div>
  16. <div class="box-catagory clearfix" v-for="(kind, index) in kinds">
  17. <div class="box">
  18. <div class="box-title" :id="kind.id">
  19. <div class="box-smtitle">
  20. <div>
  21. <nuxt-link :to="`/product/kind/${kind.id}`"> <img class="content-thumbnail" :src=kindLogo[index]><span :title="kind.nameCn">{{kind.nameCn}}</span></nuxt-link>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="box-content">
  26. <div class="box-subcatagory">
  27. <div class="childkind" v-for="child in kind.children">
  28. <dl class="dl-horizontal" style="background: #f1f4fb;">
  29. <dt class="dt-title">
  30. <ul>
  31. <li>
  32. <nuxt-link :to="`/product/kind/${child.id}`" :title="child.nameCn"><span>{{child.nameCn}}</span><i class="iconfont icon-arrow-right icon-sm pull-right"></i></nuxt-link>
  33. </li>
  34. </ul>
  35. </dt>
  36. <dd>
  37. <ul class="list-unstyled list-inline">
  38. <li v-if="leaf.nameCn.length<=15" v-for="leaf in child.children">
  39. <nuxt-link :to="`/product/kind/${leaf.id}`" :title="leaf.nameCn"><span>{{leaf.nameCn}}</span></nuxt-link>
  40. </li>
  41. <li style="width: 35%" v-if="leaf.nameCn.length>15" v-for="leaf in child.children">
  42. <nuxt-link :to="`/product/kind/${leaf.id}`" :title="leaf.nameCn">{{leaf.nameCn}}</nuxt-link>
  43. </li>
  44. <li v-if="!child.children || !child.children.length">
  45. <span style="margin-left: 25%;">—</span>
  46. </li>
  47. </ul>
  48. </dd>
  49. </dl>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </template>
  58. <script>
  59. import { scrollTo } from '~utils/scroll'
  60. export default {
  61. name: 'kind-box',
  62. data () {
  63. return {
  64. boxFirstFixed: false,
  65. imgList: [
  66. '/images/component/component-logo/component01.png',
  67. '/images/component/component-logo/component02.png',
  68. '/images/component/component-logo/component03.png',
  69. '/images/component/component-logo/component04.png',
  70. '/images/component/component-logo/component05.png',
  71. '/images/component/component-logo/component06.png',
  72. '/images/component/component-logo/component07.png',
  73. '/images/component/component-logo/component08.png',
  74. '/images/component/component-logo/component09.png',
  75. '/images/component/component-logo/component010.png',
  76. '/images/component/component-logo/component011.png',
  77. '/images/component/component-logo/component012.png',
  78. '/images/component/component-logo/component013.png',
  79. '/images/component/component-logo/component014.png'
  80. ],
  81. kindLogo: [
  82. '/images/component/component-logo/component001.png',
  83. '/images/component/component-logo/component002.png',
  84. '/images/component/component-logo/component003.png',
  85. '/images/component/component-logo/component004.png',
  86. '/images/component/component-logo/component005.png',
  87. '/images/component/component-logo/component006.png',
  88. '/images/component/component-logo/component007.png',
  89. '/images/component/component-logo/component008.png',
  90. '/images/component/component-logo/component009.png',
  91. '/images/component/component-logo/component0010.png',
  92. '/images/component/component-logo/component0011.png',
  93. '/images/component/component-logo/component0012.png',
  94. '/images/component/component-logo/component0013.png',
  95. '/images/component/component-logo/component0014.png'
  96. ]
  97. }
  98. },
  99. computed: {
  100. kinds () {
  101. return this.$store.state.product.kind.kinds.data
  102. }
  103. },
  104. mounted () {
  105. window.addEventListener('scroll', () => {
  106. this.handleScroll()
  107. })
  108. },
  109. methods: {
  110. handleScroll () {
  111. var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
  112. var offsetTop = document.querySelector('#box-first').offsetTop
  113. if (scrollTop > offsetTop) {
  114. this.boxFirstFixed = true
  115. } else {
  116. this.boxFirstFixed = false
  117. }
  118. },
  119. scrollTo: function (el) {
  120. scrollTo(document.getElementById(el), 10, {offset: -58})
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. .component{
  127. width: 100%;
  128. min-width:1190px;
  129. padding: 0;
  130. background: #efeeec;
  131. .component-content{
  132. width:1190px;
  133. margin: 0 auto;
  134. }
  135. }
  136. .box {
  137. margin-bottom: 20px;
  138. -webkit-box-shadow: 0 6px 10px #c8c8c8;
  139. -moz-box-shadow: 0 6px 10px #c8c8c8;
  140. box-shadow: 0 6px 10px #c8c8c8;
  141. }
  142. .box .box-title {
  143. width: 100%;
  144. height: 50px;
  145. background-color: #689cff;
  146. }
  147. .box .box-smtitle span {
  148. display: inline-block;
  149. text-align: left;
  150. padding-left: 30px;
  151. width: 186px;
  152. height: 50px;
  153. line-height: 50px;
  154. font-size: 14px;
  155. font-weight: 100;
  156. }
  157. .box .box-title a {
  158. color: #FFF;
  159. font-weight: bolder;
  160. }
  161. .box .box-title h4 {
  162. margin-top: 5px;
  163. margin-bottom: 5px;
  164. line-height: 30px;
  165. }
  166. .box .box-content {
  167. position: relative;
  168. width: 100%;
  169. margin: 0 auto;
  170. }
  171. .box .box-content .box-subcatagory {
  172. background-color: #f1f4fb;
  173. border-radius: 5px;
  174. }
  175. .box .box-content .box-subcatagory .childkind {
  176. border-bottom: 1px dashed #ccc;
  177. }
  178. .box .box-content .box-subcatagory .childkind:last-child {
  179. border-bottom: none;
  180. }
  181. .box .box-content .box-subcatagory dl, .box .box-content .box-subcatagory ul
  182. {
  183. padding-bottom: 0px;
  184. margin-bottom: 0px;
  185. background-color: #fff;
  186. }
  187. .content-thumbnail{
  188. position: relative;
  189. left: 20px;
  190. top: -1px;
  191. }
  192. .content-thumbnail-list{
  193. position: relative;
  194. top: -2px;
  195. }
  196. .box .box-content .box-subcatagory dl dt {
  197. width: 186px;
  198. height: 50px;
  199. line-height: 50px;
  200. text-align: left;
  201. li {
  202. float: left;
  203. list-style: none;
  204. width: 186px;
  205. color: #fff;
  206. overflow: hidden;
  207. text-overflow: ellipsis;
  208. white-space: nowrap;
  209. .pull-right {
  210. float: right!important;
  211. padding-right: 12px;
  212. }
  213. .iconfont {
  214. font-size: 16px;
  215. font-style: normal;
  216. color: #5079cb;
  217. -webkit-font-smoothing: antialiased;
  218. }
  219. }
  220. &:hover{
  221. background-color: #3c7cf5;
  222. .iconfont{
  223. color: #fff;
  224. }
  225. span{
  226. color: #fff;
  227. }
  228. }
  229. }
  230. .box .box-content .box-subcatagory dl dt span{
  231. width: 125px;
  232. display: inline-block;
  233. overflow: hidden;
  234. text-overflow: ellipsis;
  235. white-space: nowrap;
  236. padding-left: 20px;
  237. color: #5079cb;
  238. }
  239. .box .box-content .box-subcatagory dl dt a {
  240. color: #000;
  241. font-size: 14px;
  242. font-weight: 500;
  243. }
  244. .box .box-content .box-subcatagory dl dt a:hover {
  245. color: #6493FF;
  246. }
  247. .box .box-content .box-subcatagory dl dd {
  248. margin-left: 190px;
  249. }
  250. .box .box-content .box-subcatagory .list-inline {
  251. margin-left: 0;
  252. padding-left: 7px;
  253. }
  254. .box .box-content .box-subcatagory .list-inline>li {
  255. width: 20%;
  256. vertical-align: top;
  257. font-size: 14px;
  258. height: 50px;
  259. line-height: 50px;
  260. }
  261. .box .box-content .box-subcatagory .list-inline>li a {
  262. color: #000;
  263. font-size: 14px;
  264. font-weight: 500;
  265. }
  266. .box .box-content .box-subcatagory .list-inline>li a:hover {
  267. color: #f54802;
  268. span{
  269. text-decoration: underline;
  270. color: #f54802;
  271. }
  272. }
  273. .box-first{
  274. .isFixed {
  275. padding-top: 10px;
  276. width: 1190px;
  277. height: 106px!important;
  278. margin: 0 auto;
  279. position: fixed;
  280. top: 0px;
  281. margin-left: -1px;
  282. z-index:999;
  283. border: #c8c8c8 1px solid;
  284. box-shadow: 0px 6px 10px #c8c8c8;
  285. }
  286. }
  287. /*.box-first .box-item {
  288. float: left;
  289. width: 55px;
  290. margin-left: 30px;
  291. font-size: 14px;
  292. padding-top: 10px;
  293. }*/
  294. .box-first .box-kind {
  295. height: 100px;
  296. font-size: 14px;
  297. /*background-color: #f1f4fb;*/
  298. }
  299. #letter-nav ul, #letter-nav li {
  300. list-style-type: none;
  301. }
  302. #letter-nav{
  303. margin-top: -9px;
  304. }
  305. #letter-nav li {
  306. float: left;
  307. width: 14.285%;
  308. padding: 17px;
  309. overflow: hidden;
  310. text-overflow: ellipsis;
  311. white-space: nowrap;
  312. text-align: center;
  313. background-color: #f1f4fb;
  314. &:hover{
  315. border-bottom: 1px solid #5079cb !important;
  316. background-color: #fff;
  317. }
  318. }
  319. #letter-nav li a {
  320. color: #000;
  321. padding: 5px;
  322. border-radius: 5px;
  323. }
  324. #letter-nav li a:hover {
  325. color: #333;
  326. cursor: pointer;
  327. text-decoration: none;
  328. }
  329. .box-first{
  330. border: #c8c8c8 1px solid;
  331. box-shadow: 0 6px 10px #c8c8c8;
  332. width: 1190px;
  333. display: inline-block;
  334. margin-top: 16px;
  335. margin-bottom: 16px;
  336. padding-top: 10px;
  337. min-height: 108px;
  338. }
  339. </style>