| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="container"> |
| | | <h1 style="font-size:21px;padding-top:30px">早上好! |
| | | <h1 style="font-size: 21px;">{{ greeting +',' + user.userName }} |
| | | <el-dropdown style="float:right"> |
| | | <span class="el-dropdown-link"> |
| | | <img src="../../assets/images/Frame.png"> |
| | |
| | | <script> |
| | | |
| | | import {listRoot} from "@/api/root/index"; |
| | | import { getUserProfile } from "@/api/system/user"; |
| | | |
| | | export default { |
| | | name: "index", |
| | | data(){ |
| | | return{ |
| | | user: {}, |
| | | greeting: "", |
| | | imageSrc: require('../../assets/images/Group 407.png') , |
| | | dropdownList: [ |
| | | { name: '只显示第一代', src: 'Group 407.png' }, |
| | |
| | | }, |
| | | created() { |
| | | |
| | | // this.getCateInfor() |
| | | // for (let i = 0; i < this.contactList.length; i++) { |
| | | // this.formDat[i] = this.contactList[i]; |
| | | // } |
| | | this.setGreeting(); |
| | | this.getUser(); |
| | | }, |
| | | mounted() { |
| | | this.getList(1); |
| | |
| | | } |
| | | }, |
| | | generation_1(){ |
| | | |
| | | |
| | | // alert(127) |
| | | // this.getList(1) |
| | | listRoot(1).then(response => { |
| | |
| | | } |
| | | ); |
| | | }, |
| | | setGreeting() { |
| | | const currentTime = new Date(); |
| | | const currentHour = currentTime.getHours(); |
| | | |
| | | if (currentHour < 12) { |
| | | this.greeting = "早上好"; |
| | | } else if (currentHour < 14) { |
| | | this.greeting = "中午好"; |
| | | } else if (currentHour < 18) { |
| | | this.greeting = "下午好"; |
| | | } else { |
| | | this.greeting = "晚上好"; |
| | | } |
| | | }, |
| | | |
| | | getUser() { |
| | | getUserProfile().then(response => { |
| | | this.user = response.data; |
| | | |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | </script> |