<template>
  <view class="page-SemiProduct">
    <view class="header">
      <view class="welcome">
        <view class="name">Hi, {{ session.user.userName }}</view>
        <view class="logout" @click="session.logout()">
          <u-icon name="info-circle"></u-icon>
          <text>{{ $t('message.rawMenu_SignOut') }}</text>
        </view>
      </view>
      <view class="date">{{ today }}</view>
    </view>
    <view class="container">
      <u-row :gutter="30">
        <u-col :span="12" v-for="(item, index) in model.menuList" :key="index">
          <u-button
            @click="
              uni.navigateTo({
                url: `${item.href}?childData=${JSON.stringify(item.childResource)}`,
              })
            "
          >
            <u-icon size="80" :name="item.iconClass"></u-icon>
            <text class="name">
              {{
                session.lang == 'en'
                  ? index + 1 + ' ' + item.engResourceName
                  : index + 1 + ' ' + item.resourceName
              }}</text
            >
          </u-button>
        </u-col>
        <!-- <u-col :span="12">
          <u-button @click="toPage(page.SemiProduct.inbound.index)">
            <u-icon size="80" name="/static/icons/icon-01.png"></u-icon>
            <text class="name">1.{{ $t('message.SemiProductEnterTheWarehouse') }}</text>
          </u-button>
        </u-col>
        <u-col :span="12">
          <u-button @click="toPage(page.SemiProduct.outbound.index)">
            <u-icon size="80" name="/static/icons/icon-01.png"></u-icon>
            <text class="name">2.{{ $t('message.SemiProductGetOutOfTheWarehouse') }}</text>
          </u-button>
        </u-col>
        <u-col :span="12">
          <u-button @click="toPage(page.SemiProduct.DumpList.index)">
            <u-icon size="80" name="/static/icons/icon-02.png"></u-icon>
            <text class="name">3.{{ $t('message.SemiProductZC') }}</text>
          </u-button>
        </u-col> -->
      </u-row>
    </view>
  </view>
</template>

<script lang="ts">
import { Component } from 'vue-property-decorator';
import { BasePage } from '@/components/base/page';
import dayjs from 'dayjs';
import model from './model';

@Component
export default class RawHome extends BasePage {
  today = dayjs().format('YYYY-MM-DD dddd');
  model = model;
  onLoad() {
    this.model.getMenuList();
  }
}
</script>

<style lang="scss" scoped>
.page-SemiProduct {
  background-color: #f4f7fc;
  min-height: 100%;

  .header {
    background-color: #255cea;
    padding: 60rpx 30rpx 40rpx;
    color: #fff;
    box-shadow: 0 1rpx 5rpx #6b90ef;
    .welcome {
      display: flex;
      justify-content: space-between;
      .name {
        font-size: 44rpx;
        font-weight: 500;
      }
    }
    .date {
      margin-top: 30rpx;
      font-size: 28rpx;
      font-weight: 400;
      opacity: 0.7;
    }
  }

  .container {
    margin-top: 36rpx;
    padding: 30rpx 15rpx 0;
    .u-row {
    }
    .u-col {
      margin-bottom: 30rpx;
    }
    .u-btn {
      height: 160rpx;
      padding: 0 30rpx;
      border: 1px solid #f0f5fc;
      color: #42465a;
      font-size: 30rpx;
      font-weight: 400;
      &:after {
        border-color: #f0f5fc;
        border-radius: 4rpx;
      }
      .name {
        flex: 1;
        margin-left: 32rpx;
        text-align: left;
      }
    }
  }
}
</style>
