index.vue 2.54 KB
<template>
  <div class="home nafmii-head-bg1">
    <nafm-header :leftArrow="false" navClass="nafmii-head-bg1">
      <div class="head-custom-container">
        <SearchFirst :placeholder="$t('home.searchPlaceholder')" @jumpPage="handleSearch" />
        <div class="head-message-box">
          <img src="@/assets/icon/message.png" alt="">
        </div>
      </div>
    </nafm-header>
    <main>
      <HomeBanner />
      <MenuModule />
      <DataModule v-for="item in modules" :key="item.type" v-bind="item" @clickTop="handleTop(item)" />
    </main>
  </div>
</template>
<script>
import SearchFirst from '@/components/SearchFirst'
import HomeBanner from './components/HomeBanner'
import MenuModule from './components/MenuModule'
import DataModule from './components/DataModule'
export default {
  name: "Home",
  components: { HomeBanner, MenuModule, DataModule, SearchFirst },
  data () {
    console.log();
    return {
      modules: [
        { type: '1', name: this.$t('home.disclosure'), dateText: this.$t('home.disclosureDate'), isTop: true },
        { type: '2', name: this.$t('home.news'), dateText: this.$t('home.updateDate'), isTop: false },
        { type: '3', name: this.$t('home.registered'), dateText: this.$t('home.updateDate'), isTop: false }
      ]
    };
  },
  methods: {
    jumpLogin () {
      this.$router.push({
        name: "Login",
      });
    },

    handleSearch () { },

    handleTop (module) {
      const modules = []
      for (const item of this.modules) {
        const isTop = item.type == module.type
        isTop ? modules.unshift(item) : modules.push(item)
        Object.assign(item, { isTop })
      }
      this.modules = modules
    }
  },
};
</script>


<style lang="less" scoped>
.home {
  @PaddingSize: 15px;

  main {
    padding: 0 @PaddingSize;
  }
}

@PaddingSize: 15px;
@HeadHeight: 50px;
.head-custom-container {
  width: 100%;
  height: @HeadHeight;
  display: flex;
  align-items: center;

  @InputHeight: 33px;
  .search-input-box {
    width: 100%;
    height: @InputHeight;
    border-radius: calc(@InputHeight / 2);
    background-color: rgba(255, 255, 255, 0.2);
    padding: 0 @PaddingSize;
    display: flex;
    align-items: center;

    @SearchIconSize: 12px;
    .search-icon {
      background: white;
      width: @SearchIconSize;
      height: @SearchIconSize;
    }
    .search-placeholder {
      color: white;
      font-size: 12px;
      padding-left: 22px;
    }
  }
  @MessageBoxSize: 23px;
  .head-message-box {
    width: @MessageBoxSize;
    height: @MessageBoxSize;
    margin-left: @PaddingSize;
  }
}
</style>