1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
| <template>
| <div class="header-bg">
| <div class="title">{{ title }}</div>
| <div class="times">
| <div class="time">{{ now_time }}</div>
| <div class="day">{{ now_day }}</div>
| </div>
| </div>
| </template>
|
| <script>
| import moment from "moment";
| moment.locale("zh-cn");
| export default {
| name: "self-header",
| data() {
| return {
| now_time: "",
| now_day: "",
| // 2023年9月25日星期一
| timer: null,
| };
| },
| methods: {
| updatetime() {
| var date = new Date();
| this.now_time = moment(date).format("HH:mm:ss");
| this.now_day = moment(date).format('YY年MM月DD日dddd');
| // console.log('updatetime')
| // this.now_day = moment(date).format("llll");
| },
| },
| mounted() {
| this.timer = setInterval(this.updatetime, 1000);
| },
| destroyed() {
| if (this.timer) {
| clearInterval(this.timer);
| }
| },
| props: {
| title: {
| type: String,
| default() {
| return "标题";
| },
| },
| },
| };
| </script>
| <style lang="scss" scoped>
| .header-bg {
| background-image: url("../assets/screen/header@2x.png");
| width: 100%;
| height: 120px;
| background-size: 100% 100%;
| position: relative;
| z-index: 2;
| .times {
| position: absolute;
| left: 54px;
| display: flex;
| top: 12px;
| .time {
| width: 79px;
| height: 29px;
| font-size: 1.73rem;
| font-family: PingFangSC-Semibold, PingFang SC;
| font-weight: 600;
| color: #0b1e36;
| margin-right: 1.5rem;
| }
| .day {
| height: 18px;
| font-size: 1.07rem;
| font-family: PingFangSC-Semibold, PingFang SC;
| font-weight: 600;
| margin-top: 0.6rem;
| color: #0b1e36;
| }
| }
| .title {
| font-size: 2.83rem;
| font-family: Arial-Black, Arial;
| font-weight: 900;
| color: #012b5e;
| line-height: 48px;
| background: linear-gradient(180deg, #58bfff 0%, #0e74ff 100%);
| -webkit-background-clip: text;
| -webkit-text-fill-color: transparent;
| position: absolute;
| width: 100%;
| text-align: center;
| top: 1rem;
| }
| }
| </style>
|
|