newsTypes.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <div class="content">
  3. <big-title>
  4. {{lang===langType.cn?"新闻中心":getAbbrText("新闻中心")}}
  5. </big-title>
  6. <div class="conBox product-type">
  7. <p
  8. v-for="(item,i) in types"
  9. :key="item.key"
  10. :class="`type-item ${item.key===type?'type-selected':''}`"
  11. @click="selectType(item.key)"
  12. >
  13. <span class="icon-box">
  14. <svg-icon :icon-class="item.icon"/>
  15. </span>
  16. <span class="type-name">{{lang===langType.cn?item.title:getAbbrText(item.title)}}</span>
  17. </p>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. import langMap from "@/map/langMap";
  23. import {sTypes} from "~/map/newMap";
  24. import BigTitle from "~/components/public/bigTitle.vue";
  25. export default {
  26. name: "newsTypes",
  27. components: {BigTitle},
  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: sTypes
  40. }
  41. },
  42. methods:{
  43. getLangText(str) {
  44. return langMap.getText(this.lang, str);
  45. },
  46. getAbbrText(str) {
  47. return langMap.getAbbrText(this.lang, str);
  48. },
  49. selectType(nextType){
  50. console.log(nextType)
  51. if (this.type === nextType){
  52. return 0;
  53. }
  54. this.$root.$emit('changeNewsType',nextType);
  55. }
  56. }
  57. }
  58. </script>
  59. <style scoped>
  60. .content{
  61. cursor: default;
  62. }
  63. .content .big-title{
  64. margin-top: 10px;
  65. margin-bottom: 30px;
  66. }
  67. .product-type{
  68. height: 120px;
  69. display: grid;
  70. grid-template-columns: repeat(4,1fr);
  71. }
  72. .product-type .type-item{
  73. width: auto;
  74. height: 100%;
  75. cursor: pointer;
  76. }
  77. .product-type .type-item:hover{
  78. color: orangered;
  79. }
  80. .content .product-type .type-selected{
  81. color: #f88330;
  82. }
  83. .product-type .type-item .icon-box{
  84. width: 100%;
  85. height: 50px;
  86. display: flex;
  87. justify-content: center;
  88. align-items: center;
  89. font-size: 4rem;
  90. padding-bottom: 20px;
  91. }
  92. .product-type .type-selected .icon-box{
  93. border-bottom: 1px solid deepskyblue;
  94. }
  95. .product-type .type-item .type-name{
  96. width: 100%;
  97. height: 60px;
  98. font-size: 1.3rem;
  99. display: flex;
  100. justify-content: center;
  101. align-items: center;
  102. }
  103. </style>