<template>
  <view class="page bg-w pt30">
    <up-grid :border="false" :col="gridCol">
      <up-grid-item class="mb25 mt25" v-for="item in roleMenus" :key="item.id" @click="goSystem(item.component)">
        <image style="width: 80px; height: 80px" :src="`/static/images/menus/${item.path}.png`"></image>
        <text class="grid-text">{{ item.name }}</text>
      </up-grid-item>
    </up-grid>
  </view>
  <company-dept-dialog />
</template>
<script setup>
import { reactive, ref, computed, onMounted } from 'vue'
import nx from '@/nx'
import { useGridCol } from '@/nx/hooks/useGridCol'

const roleMenus = computed(() => nx.$store('user').roleMenus)
function goSystem(url) {
  uni.setStorageSync('defaultModule', url)
  uni.reLaunch({ url })
}
onMounted(async () => {
  await nx.$api.assayTask.getAssayTaskPage()
})
const { gridCol } = useGridCol([400, 600], [2, 3, 4])
</script>

<style lang="scss" scoped>
.grid-text {
  font-size: 24px;
}
</style>
