-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
newtab.tsx
148 lines (137 loc) · 3.56 KB
/
newtab.tsx
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import { ReloadOutlined } from '@ant-design/icons';
import fetch from '@toolkit-fe/request';
import { Button, Carousel } from "antd";
import { useEffect, useState } from "react";
import "antd/dist/antd.css"
function IndexNewtab() {
const [imgList, setImgList] = useState([
{
url: "https://lexmin.oss-cn-hangzhou.aliyuncs.com/statics/browser-extensions/yuai.jpg",
name: "渝爱"
},
{
url: "https://lexmin.oss-cn-hangzhou.aliyuncs.com/statics/browser-extensions/src%3Dhttp___safe-img.xhscdn.com_bw1_185b6252-f3f1-4f9f-ba03-7b10bad853ef_imageView2_2_w_1080_format_jpg%26refer%3Dhttp___safe-img.xhscdn.webp",
name: "福宝"
},
{
url: "https://lexmin.oss-cn-hangzhou.aliyuncs.com/statics/browser-extensions/src%3Dhttp___safe-img.xhscdn.com_bw1_576dc3ec-016c-4809-806d-c861feb20d26_imageView2_2_w_1080_format_jpg%26refer%3Dhttp___safe-img.xhscdn.webp",
name: "福宝"
},
{
url: "https://lexmin.oss-cn-hangzhou.aliyuncs.com/statics/browser-extensions/src%3Dhttp___safe-img.xhscdn.com_bw1_8a00941f-56c3-4b33-96db-425540b48abd_imageView2_2_w_1080_format_jpg%26refer%3Dhttp___safe-img.xhscdn.webp",
name: "福宝"
},
{
url: "https://lexmin.oss-cn-hangzhou.aliyuncs.com/statics/browser-extensions/u%3D167677896%2C2615296049%26fm%3D253%26fmt%3Dauto%26app%3D138%26f%3DJPEG.webp",
name: "福宝"
},
{
url: "https://lexmin.oss-cn-hangzhou.aliyuncs.com/statics/browser-extensions/u%3D2903620256%2C2383358246%26fm%3D253%26fmt%3Dauto%26app%3D138%26f%3DJPEG.webp",
name: "福宝"
}
])
const year = new Date().getFullYear()
const month = new Date().getMonth() + 1
const date = new Date().getDate()
const currentDate = `${year}-${month}-${date}`
const initImgList = async() => {
fetch(
"https://lexmin.oss-cn-hangzhou.aliyuncs.com/statics/browser-extensions/pandas.json", {}
).then((res: any[])=>{
console.log('resssxixiix', res)
if (res?.length) {
setImgList(res)
}
})
}
useEffect(()=>{
initImgList()
}, [])
return (
<div>
<Carousel autoplay>
{imgList.map((item) => {
return (
<div
style={{
height: "100vh",
width: "100vw"
}}>
<img
style={{
width: "100vw",
height: "100vh",
display: "block",
objectFit: 'cover',
}}
src={item.url}
/>
</div>
)
})}
</Carousel>
<Button
type='primary'
style={{
position: 'fixed',
top: '20px',
right: '20px',
display: 'flex',
alignItems: 'center',
color: '#fff',
opacity: '0.8'
}}
onClick={()=>{
setImgList([])
initImgList()
}}
>
<span style={{
marginRight: '4px'
}}>
刷新
</span>
<ReloadOutlined rev='' />
</Button>
{/* <div
style={{
position: 'fixed',
top: 0,
right: 0,
display: 'flex',
alignItems: 'center',
color: '#fff',
background: '#4c86ff'
}}
>
</div> */}
<div
style={{
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
textAlign: 'center',
background: 'rgba(0, 0,0,0.4)',
borderRadius: '8px',
padding: '20px',
color: '#fff'
}}
>
<h1 style={{
color: 'white'
}}>Hello</h1>
<h1
style={{
color: "white"
}}>
欢迎来到 Panda 星球
</h1>
<div style={{
fontSize: '16px'
}}>今天是 {currentDate}</div>
</div>
</div>
)
}
export default IndexNewtab