functionList.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div class="function_list">
  3. <div class="function_items" v-for="data in datas">
  4. <masker :opacity = "0" class="function_item_img">
  5. <x-img :src="data.img" :key="data.img" :default-src="defalutImg"></x-img>
  6. <div slot="content" class="m-title" :key="data.name">
  7. <span class="rounds"></span>{{data.name}}<span class="rounds"></span>
  8. </br>
  9. <span class="look_btn" @click="link(data.name)">查看全部</span>
  10. </div>
  11. </masker>
  12. <flexbox :gutter="0" wrap="wrap" class="function_item">
  13. <flexbox-item :span="1/4" v-for="item in data.subitem" class="subitem" :key="item">
  14. <div @click="link(item.name)">
  15. <x-img :src="item.img" :key="item.img" :default-src="defalutImg"></x-img>
  16. <p class="item_title">{{item.name}}</p>
  17. </div>
  18. </flexbox-item>
  19. </flexbox>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. import { Masker , Flexbox , FlexboxItem , XImg } from 'vux'
  25. import Api from '../../../lib/api.js'
  26. import Actions from '../../../lib/Actions'
  27. import DefaultImg from '../../../assets/default_img.jpg'
  28. export default {
  29. components:{
  30. Masker,
  31. Flexbox,
  32. FlexboxItem,
  33. XImg
  34. },
  35. created(){
  36. let _self = this;
  37. this.$http.jsonp(Api.functionList()).then(function(res){
  38. _self.datas = res.body.datas["items"];
  39. })
  40. },
  41. mounted(){
  42. this.$store.commit('updateLoadingStatus', {isLoading: false});
  43. },
  44. data(){
  45. return {
  46. datas:[],
  47. defalutImg:DefaultImg
  48. }
  49. },
  50. methods:{
  51. link(title){
  52. let action = Actions.getFilterBlockListPath(title, "", "", "", title);
  53. this.$router.push(action);
  54. }
  55. }
  56. }
  57. </script>
  58. <style scoped>
  59. .m-title {
  60. color: #fff;
  61. font-size: 50px;
  62. text-align: center;
  63. text-shadow: 0 0 2px rgba(0, 0, 0, .5);
  64. font-weight: 500;
  65. position: absolute;
  66. left: 0;
  67. right: 0;
  68. width: 100%;
  69. top: 50%;
  70. transform: translateY(-50%);
  71. }
  72. .rounds {
  73. display: inline-block;
  74. width: 24px;
  75. height: 24px;
  76. background: #fff;
  77. border-radius: 50px;
  78. margin: 0 10px;
  79. line-height: 15px;
  80. }
  81. .look_btn {
  82. font-size: 28px;
  83. border: 1px solid #fff;
  84. border-radius: 10px;
  85. padding: 10px 20px;
  86. }
  87. .item_title {
  88. font-size: 24px;
  89. text-align: center;
  90. margin-bottom: 40px;
  91. }
  92. .function_items:first-child {
  93. margin-top: 0;
  94. }
  95. .function_item_img {
  96. margin-bottom: 40px;
  97. }
  98. .function_item img {
  99. width: 70%;
  100. margin: 0 auto;
  101. }
  102. </style>