channel.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <view class="container clearfix" >
  3. <tui-skeleton
  4. v-if="skeletonShow"
  5. backgroundColor="#fafafa"
  6. borderRadius="10rpx"
  7. :isLoading="true"
  8. :loadingType="5"
  9. />
  10. <template v-else>
  11. <view class="navbars-content clearfix">
  12. <view class="nav-item" v-for="(item,index) in list" :key="index" @click="NavToDetailPage(item,index)">
  13. <view class="icon">
  14. <image class="icon-image" :src="item.icon" mode="widthFix"></image>
  15. </view>
  16. <view class="name">{{ item.name }}</view>
  17. </view>
  18. </view>
  19. </template>
  20. </view>
  21. </template>
  22. <script>
  23. import cmsMixins from '@/mixins/cmsMixins.js'
  24. import { mapState,mapMutations} from 'vuex';
  25. export default{
  26. mixins: [cmsMixins],
  27. data(){
  28. return{
  29. skeletonShow: true,
  30. list:[]
  31. }
  32. },
  33. onLoad(option) {
  34. },
  35. methods:{
  36. async getHomeInformation() {
  37. //初始化首页数据
  38. try{
  39. const res = await this.CommonService.GetHomeModulesDataInfo({ source: 2 })
  40. const data = res.data
  41. this.list = data.shortcutList || [] // 快捷运营
  42. setTimeout(() => {
  43. this.skeletonShow = false
  44. }, 1000)
  45. }catch(e){
  46. //TODO handle the exception
  47. this.$util.msg(error.msg, 2000)
  48. }
  49. },
  50. // 链接跳转
  51. NavToDetailPage(pros) {
  52. // 采美快捷运营点击量统计
  53. this.cmsMoudleHits(4, pros.id)
  54. this.$api.FlooryNavigateTo(pros)
  55. },
  56. },
  57. onShow() {
  58. this.getHomeInformation()
  59. }
  60. }
  61. </script>
  62. <style lang="scss">
  63. page{
  64. background-color: #FFFFFF;
  65. }
  66. .navbars-content{
  67. width: 100%;
  68. height: auto;
  69. box-sizing: border-box;
  70. padding: 40rpx 0rpx;
  71. .nav-item{
  72. width: 25%;
  73. height: auto;
  74. float: left;
  75. margin-bottom: 40rpx;
  76. .icon{
  77. width: 100rpx;
  78. height: 100rpx;
  79. margin: 0 auto;
  80. position: relative;
  81. .icon-image{
  82. width: 100rpx;
  83. height: 100rpx;
  84. display: block;
  85. }
  86. }
  87. .name{
  88. width: 100%;
  89. height: 40rpx;
  90. line-height: 40rpx;
  91. text-align: center;
  92. font-size: $font-size-26;
  93. color: #666666;
  94. }
  95. }
  96. }
  97. </style>