productTypes.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <div class="content">
  3. <div class="conBox big-title">
  4. <span>
  5. {{lang===langType.cn?"产品类别":getAbbrText("产品类别")}}
  6. </span>
  7. <div class="hr"></div>
  8. </div>
  9. <div class="conBox product-type">
  10. <p
  11. v-for="(item,i) in types"
  12. :key="item.key"
  13. :class="`type-item ${item.key===type?'type-selected':''}`"
  14. @click="selectType(item.key)"
  15. >
  16. <span class="icon-box">
  17. <svg-icon :icon-class="item.icon"/>
  18. </span>
  19. <span class="type-name">{{lang===langType.cn?item.text:getAbbrText(item.text)}}</span>
  20. </p>
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. import langMap from "@/map/langMap";
  26. export default {
  27. name: "productTypes",
  28. props: {
  29. lang:{
  30. default: langMap.lang.cn
  31. },
  32. type:{
  33. default: 'all'
  34. }
  35. },
  36. data(){
  37. return {
  38. langType: langMap.lang,
  39. types:[
  40. {
  41. key: 'all',
  42. icon: 'all',
  43. text: '所有产品'
  44. },
  45. {
  46. key: 'cam',
  47. icon: 'camera2',
  48. text: '多目协同摄像头'
  49. },
  50. {
  51. key: 'aiCam',
  52. icon: 'camera',
  53. text: 'AI摄像头'
  54. },
  55. {
  56. key: 'low',
  57. icon: 'lowPower',
  58. text: '低功耗产品'
  59. },
  60. {
  61. key: 'm2m',
  62. icon: 'm2m',
  63. text: 'm2m产品'
  64. },
  65. {
  66. key: 'sm',
  67. icon: 'smartDev',
  68. text: '智能终端'
  69. },
  70. ]
  71. }
  72. },
  73. methods:{
  74. getLangText(str) {
  75. return langMap.getText(this.lang, str);
  76. },
  77. getAbbrText(str) {
  78. return langMap.getAbbrText(this.lang, str);
  79. },
  80. selectType(nextType){
  81. console.log(nextType)
  82. if (this.type === nextType){
  83. return 0;
  84. }
  85. this.$root.$emit('changeProductType',nextType);
  86. }
  87. }
  88. }
  89. </script>
  90. <style scoped>
  91. .content{
  92. cursor: default;
  93. }
  94. .content .big-title{
  95. margin-top: 10px;
  96. margin-bottom: 30px;
  97. }
  98. .product-type{
  99. height: 120px;
  100. display: grid;
  101. grid-template-columns: repeat(6,1fr);
  102. }
  103. .product-type .type-item{
  104. width: auto;
  105. height: 100%;
  106. cursor: pointer;
  107. }
  108. .product-type .type-item:hover{
  109. color: orangered;
  110. }
  111. .content .product-type .type-selected{
  112. color: #f88330;
  113. }
  114. .product-type .type-item .icon-box{
  115. width: 100%;
  116. height: 50px;
  117. display: flex;
  118. justify-content: center;
  119. align-items: center;
  120. font-size: 4rem;
  121. padding-bottom: 20px;
  122. }
  123. .content .product-type .type-selected .icon-box{
  124. border-bottom: 1px solid deepskyblue;
  125. }
  126. .product-type .type-item .type-name{
  127. width: 100%;
  128. height: 60px;
  129. font-size: 1.3rem;
  130. display: flex;
  131. justify-content: center;
  132. align-items: center;
  133. }
  134. </style>