<template>
  <view class="content">
    <view class="card">
      <view class="items">
        <view class="item" v-for="(item, index) in baseList" :key="index" @click="fnNavigator(index)">
          <image :src="item.img" mode=""></image>
          <view class="text">
            <text>{{ item.title }}</text>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      baseList: [
        {
          img: require('../../static/icon-apps/i9.png'),
          title: '申请',
          url: '/pages/eight_assignments/select_corp_info'
        },
        {
          img: require('../../static/icon-apps/i10.png'),
          title: '待办',
          url: '/pages/eight_assignments/to_do_list',
        },
        {
          img: require('../../static/icon-apps/i11.png'),
          title: '已办',
          url: '/pages/eight_assignments/completed_list',
        },
      ],
      type: '',
      title: ''
    };
  },
  onLoad(query) {
    this.type = query.type;
    this.title = query.title;
    uni.setNavigationBarTitle({
      title: this.title
    });
    // 若得到的 type 类型为 [动火作业],为baseList动态添加 [延时监火] 模块
    // 暂时隐藏,以后若没放开则有缘人看到以后删一下
    if (false) {
      this.baseList.push({
        img: require('../../static/icon-apps/i12.png'),
        title: '延时监火',
        url: '/pages/eight_assignments/hot_work/delay_fire_monitoring/list'
      })
    }
  },
  methods: {
    fnNavigator(e) {
      uni.$u.route({
        url: this.baseList[e].url,
        params: {
          type: this.type,
          title: this.title,
        }
      })
    },
  }
}
</script>

<style lang="scss" scoped>
.items {
  background-color: #fff;
  display: flex;
  flex-wrap: wrap;
  margin-top: -20upx;

  .item {
    flex-basis: calc(100% / 3);
    text-align: center;
    margin-top: 20upx;

    image {
      width: 110upx;
      height: 110upx;
    }

    .text {
      width: 130upx;
      font-size: 28upx;
      margin: auto;
    }
  }
}
</style>