<template>
  <div class="common_menu_box">
  <van-grid square :gutter="10" :column-num="3" :border="false">
      <van-grid-item
        v-for="item in meum"
        :key="item.value"
        :icon="item.image"
        @click="goInfo(item)"
        :text="item.text"
      />
    </van-grid>
  </div>
</template>

<script>
	import {getRole_noe,getRole_two} from '@/utils/auth'
export default {
  name: 'common_menu',
  data () {
    let menu = []
    const manage_scope = this.$store.getters.user_info.employee_detail.manage_scope
    const is_creator = this.$store.getters.user_info.is_creator
    // if(manage_scope.length > 0){
    // 下面有人，让他能录分
    menu.push({
      value: '1',
      text: '奖扣B分',
      image: 'static/images/callback1.png'
    })
    // }
    if (is_creator == 0) {
      menu.push({
        value: '2',
        text: '积分申请',
        image: 'static/images/caback2.png'
      })
    }
    if (getRole_two()) {
      menu.push({
        value: '3',
        text: '奖扣A分',
        image: 'static/images/caback3.png'
      })
    }
    // if(manage_scope.length > 0){
    menu.push({
      value: '4',
      // text: '绩效工作',
      text: '发布月绩效',
      image: 'static/images/caback4.png'
    })
    // }
    // if(manage_scope.length > 0){
    menu.push({
      value: '5',
      text: '发布任务',
      image: 'static/images/caback5.png'
    })
    // }
    if (getRole_two()) {
      menu.push({
        value: '6',
        text: '发布悬赏',
        image: 'static/images/caback6.png'
      })
    }
    return {
      meum: menu
    }
  },
  methods: {
    goInfo (item) {
      setTimeout(() => {
        if (item.value == 1) {
          // this.$router.push({name: 'integral_entry_b'})
          this.$router.push({name: 'integral_entry_n', query: {type: 2}})
        } else if (item.value == 2) {
          this.$router.push({name: 'integral_apply'})
        } else if (item.value == 3) {
          this.$router.push({name: 'integral_entry_n', query: {type: 1}})
        } else if (item.value == 4) {
          this.$router.push({name: 'efficiency_create_package'})
        } else if (item.value == 5) {
          this.$router.push({name: 'short_task'})
        } else if (item.value == 6) {
          this.$router.push({name: 'temp_task'})
        }
      }, 300)
      this.$emit('confirm', item)
    }
  }
}
</script>

<style  lang="scss" scoped>
  /deep/ .van-grid-item__text {
    font-size: 0.24rem;
    color: #666;
  }

  /deep/ .van-grid-item__icon {
    font-size: 1rem!important;
  }
  /deep/ .van-icon__image {
    width: 1rem;
    height: 1rem;
    border-radius: 1rem;
  }
  .user_index_scroller_com .common_menu_popup{
    border-radius: 0.4rem 0.4rem 0 0;
  }
  .common_menu_box /deep/ .van-grid{
    padding:0 !important;
  }
  .common_menu_box /deep/ .van-grid .van-grid-item__content{
    right:0 !important;
    left:0 !important;
    bottom:0 !important;
    padding:0 !important;
  }
</style>
