123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- <template>
- <div class="home">
- <div class="top">
- <div class="time"><span class="iconfont icon-riqi"></span> {{ currentTime }}</div>
- </div>
- <div class="content">
- <div class="left">
- <div class="klfx modulbox leftbox1">
- <KLFX />
- </div>
- <div class="xsfx modulbox leftbox2">
- <XSFX />
- </div>
- <div class="fqyw modulbox leftbox3">
- <FQYW />
- </div>
- </div>
- <div class="middle">
- <div class="cztj modulbox middlebox1">
- <CZTJ />
- </div>
- <div class="kyfx modulbox middlebox2">
- <KYFX />
- </div>
- <div class="jcpm modulbox middlebox3">
- <JCPM />
- </div>
- </div>
- <div class="right">
- <div class="bxcb modulbox rightbox1">
- <BXCBHB />
- </div>
- <div class="kcfx modulbox rightbox2">
- <KCFX />
- </div>
- <div class="bkfx modulbox rightbox3">
- <BKFX />
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import KLFX from "../components/HomeChart/KLFX.vue";
- import XSFX from "../components/HomeChart/XSFX.vue";
- import FQYW from "../components/HomeChart/FQYW.vue";
- import CZTJ from "../components/HomeChart/CZTJ.vue";
- import KYFX from "../components/HomeChart/KYFX.vue";
- import JCPM from "../components/HomeChart/JCPM.vue";
- import BXCBHB from "../components/HomeChart/BXCBHB.vue";
- import KCFX from "../components/HomeChart/KCFX.vue";
- import BKFX from "../components/HomeChart/BKFX.vue"
- export default {
- name: 'HomeView',
- data () {
- return {
- currentTime: '',//当前时间
- }
- },
- mounted () {
- this.updateTime()//时间
- },
- beforeDestroy () {
- // 在组件销毁前清除定时器,避免内存泄漏
- clearInterval(this.timer);
- },
- methods: {
- //更新时间
- updateTime () {
- // 在组件挂载结束时启动定时器,每秒更新一次时间
- this.currentTime = this.getCurrentTime();
- //每秒更新一次
- this.timer = setInterval(() => {
- this.currentTime = this.getCurrentTime()
- }, 1000);
- },
- getCurrentTime () {
- const now = new Date();
- const year = now.getFullYear();
- const month = String(now.getMonth() + 1).padStart(2, "0");
- const day = String(now.getDate()).padStart(2, "0");
- const hours = String(now.getHours()).padStart(2, "0");
- const minutes = String(now.getMinutes()).padStart(2, "0");
- const seconds = String(now.getSeconds()).padStart(2, "0");
- return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`;
- }
- },
- components: {
- KLFX, XSFX, FQYW, CZTJ, KYFX, JCPM, BXCBHB, KCFX, BKFX
- }
- }
- </script>
- <style scoped lang="scss">
- .home {
- width: 100%;
- height: 100vh;
- color: white;
- padding: 1% 0 0 0;
- .top {
- display: flex;
- height: 7%;
- justify-content: flex-end;
- background-image: url(../assets/bargound/title.png);
- background-repeat: no-repeat;
- background-size: 100% 100%;
- box-sizing: border-box;
- .time {
- color: rgb(174, 201, 222);
- margin-right: 2%;
- font-size: 16px;
- overflow: hidden;
- max-width: 15%;
- white-space: nowrap;
- }
- }
- .content {
- width: 100%;
- height: 91%;
- display: flex;
- justify-content: space-evenly;
- .left {
- height: 100%;
- width: 32%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .leftbox1 {
- width: 100%;
- height: 32%;
- }
- .leftbox2 {
- width: 100%;
- height: 32%;
- min-height: 250px;
- }
- .leftbox3 {
- width: 100%;
- height: 32%;
- min-height: 150px;
- }
- }
- .middle {
- height: 100%;
- width: 32%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .middlebox1 {
- height: 48%;
- min-height: 320px;
- }
- .middlebox2 {
- height: 26%;
- min-height: 130px;
- }
- .middlebox3 {
- height: 22%;
- min-height: 150px;
- }
- }
- .right {
- height: 90vh;
- width: 32%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .rightbox1 {
- height: 25%;
- min-height: 170px;
- }
- .rightbox2 {
- height: 29%;
- min-height: 150px;
- }
- .rightbox3 {
- height: 42%;
- min-height: 280px;
- }
- }
- }
- }
- </style>
|