<template>
  <view>
    <view class="fast_track">
      <block v-for="(item, index) in oaHomeData" :key="item.id">
        <view class="track_item" @click="navTo(item.paths)">
          <image
            :src="item.icon"
            mode="aspectFit"
            style="width: 77rpx;height: 77rpx;"
          >
          </image>
          <view class="title">{{ item.name }}</view>
        </view>
      </block>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        
      };
    },
    computed:{
      oaHomeData(){
        let arr = [];
        this.$store.state.config?.config?.menu?.forEach((item)=>{
          if(item.paths.includes('pages/oaHome/oaHome')){
            arr=item.children;
          }
        })
        return arr;
      }
    },
    methods: {
      navTo (url) {
        if(url){
          uni.showLoading({
            title: '加载中',
            mask: true
          });
          uni.navigateTo({
          	url: url,
            success() {
              uni.hideLoading()
            },
            fail () {
              uni.switchTab({
                url: url,
                success() {
                  uni.hideLoading()
                },
                fail() {
                  uni.hideLoading()
                }
              });
            },
          })
        }else Toast('暂未开放')
      },
    }
  }
</script>

<style lang="scss">
.fast_track {
  width: 694rpx;
  // height: 331rpx;
  display: flex;
  flex-wrap: wrap;
  justify-content: left;
  align-content: space-between;
  margin: 28rpx auto;
  padding: 15rpx 38.6rpx;
  background-color: #fff;
  border-radius: 12px;

  .track_item {
    width: 154.39rpx;
    font-size: 24.56rpx;
    margin: 25rpx 0;
    display: flex;
    flex-direction: column;
    align-items: center;

    .title {
      margin-top: 14.04rpx;
    }
  }
}
</style>
