This commit is contained in:
杜恒
2021-01-20 14:15:32 +08:00
parent 1fadaa1073
commit 4e31dbdf81
8 changed files with 420 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@@ -257,6 +257,33 @@
position: sticky;
margin-bottom: 0;
}
&-title {
display: flex;
align-items: center;
border-bottom: 1px solid var(--classC);
font-size: 16px;
font-weight: 500;
height: 45px;
line-height: 45px;
padding: 0 15px;
color: var(--main);
.icon {
width: 18px;
height: 18px;
margin-right: 8px;
fill: var(--main);
}
.line {
width: 10px;
height: 1px;
background: #54b5db;
margin-left: 12px;
}
}
&-contain {
position: relative;
padding: 15px;
}
&.author {
background: var(--background);
padding: 45px 15px 15px;
@@ -295,6 +322,182 @@
object-fit: cover;
z-index: 1;
}
.user {
position: relative;
z-index: 4;
display: flex;
flex-direction: column;
align-items: center;
padding-bottom: 15px;
.avatar {
width: 75px;
height: 75px;
border-radius: 50%;
overflow: hidden;
margin-bottom: 10px;
object-fit: cover;
transition: transform 0.75s;
background: var(--background);
padding: 5px;
&:hover {
transform: rotate(360deg);
}
}
.link {
color: var(--theme);
margin-bottom: 10px;
font-size: 16px;
font-weight: 500;
&:hover {
text-decoration: underline;
}
}
.motto {
color: var(--main);
text-align: center;
}
}
.count {
width: 100%;
padding-bottom: 15px;
display: flex;
align-items: center;
border-bottom: 1px solid var(--classC);
.item {
min-width: 0;
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
color: var(--routine);
font-size: 12px;
&:first-child {
border-right: 1px solid var(--classC);
}
.num {
max-width: 70px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-weight: 500;
font-size: 22px;
color: var(--main);
margin-bottom: 3px;
text-shadow: var(--text_shadow);
}
}
}
.list {
padding-top: 15px;
.item {
display: flex;
align-items: center;
justify-content: space-between;
line-height: 30px;
.link {
position: relative;
color: var(--routine);
max-width: 85%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
&::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 0;
height: 1px;
background: var(--theme);
transition: all 0.35s;
}
&:hover {
color: var(--theme);
&::after {
width: 100%;
}
}
}
.icon {
fill: var(--routine);
}
}
}
}
&.timelife {
background: var(--background);
.item {
margin-bottom: 15px;
&:last-child {
margin-bottom: 0;
}
.title {
font-size: 12px;
color: var(--minor);
margin-bottom: 5px;
display: flex;
align-items: center;
.text {
color: var(--theme);
font-weight: 500;
font-size: 14px;
margin: 0 5px;
}
}
.progress {
display: flex;
align-items: center;
&-bar {
height: 10px;
border-radius: 5px;
overflow: hidden;
background: var(--classC);
width: 0;
min-width: 0;
flex: 1;
margin-right: 5px;
&-inner {
width: 0;
height: 100%;
border-radius: 5px;
transition: width 0.35s;
animation: progress 750ms linear infinite;
&-0 {
background: #bde6ff;
background-image: linear-gradient(135deg, #50bfff 25%, transparent 25%, transparent 50%, #50bfff 50%, #50bfff 75%, transparent 75%, transparent 100%);
background-size: 30px 30px;
}
&-1 {
background: #ffd980;
background-image: linear-gradient(135deg, #f7ba2a 25%, transparent 25%, transparent 50%, #f7ba2a 50%, #f7ba2a 75%, transparent 75%, transparent 100%);
background-size: 30px 30px;
}
&-2 {
background: #ffa9a9;
background-image: linear-gradient(135deg, #ff4949 25%, transparent 25%, transparent 50%, #ff4949 50%, #ff4949 75%, transparent 75%, transparent 100%);
background-size: 30px 30px;
}
&-3 {
background: #67c23a;
background-image: linear-gradient(135deg, #4f9e28 25%, transparent 25%, transparent 50%, #4f9e28 50%, #4f9e28 75%, transparent 75%, transparent 100%);
background-size: 30px 30px;
}
}
}
&-percentage {
color: var(--minor);
}
}
}
}
}
}
@keyframes progress {
0% {
background-position: 0 0;
}
100% {
background-position: 30px 0;
}
}

View File

@@ -26,6 +26,65 @@ window.Joe = function () {
}
});
}
/* Timelife */
{
let timelife = [
{ title: '今日已经过去', endTitle: '小时', num: 0, percent: '0%' },
{ title: '这周已经过去', endTitle: '天', num: 0, percent: '0%' },
{ title: '本月已经过去', endTitle: '天', num: 0, percent: '0%' },
{ title: '今年已经过去', endTitle: '个月', num: 0, percent: '0%' }
];
{
let nowDate = +new Date();
let todayStartDate = new Date(new Date().toLocaleDateString()).getTime();
let todayPassHours = (nowDate - todayStartDate) / 1000 / 60 / 60;
let todayPassHoursPercent = (todayPassHours / 24) * 100;
timelife[0].num = parseInt(todayPassHours);
timelife[0].percent = parseInt(todayPassHoursPercent) + '%';
}
{
let weeks = { 0: 7, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6 };
let weekDay = weeks[new Date().getDay()];
let weekDayPassPercent = (weekDay / 7) * 100;
timelife[1].num = parseInt(weekDay);
timelife[1].percent = parseInt(weekDayPassPercent) + '%';
}
{
let year = new Date().getFullYear();
let date = new Date().getDate();
let month = new Date().getMonth() + 1;
let monthAll = new Date(year, month, 0).getDate();
let monthPassPercent = (date / monthAll) * 100;
timelife[2].num = date;
timelife[2].percent = parseInt(monthPassPercent) + '%';
}
{
let month = new Date().getMonth() + 1;
let yearPass = (month / 12) * 100;
timelife[3].num = month;
timelife[3].percent = parseInt(yearPass) + '%';
}
let htmlStr = '';
timelife.forEach((item, index) => {
htmlStr += `
<div class="item">
<div class="title">
${item.title}
<span class="text">${item.num}</span>
${item.endTitle}
</div>
<div class="progress">
<div class="progress-bar">
<div class="progress-bar-inner progress-bar-inner-${index}" style="width: ${item.percent}"></div>
</div>
<div class="progress-percentage">${item.percent}</div>
</div>
</div>
`;
});
$('.joe_aside__item-contain').html(htmlStr);
}
};
document.addEventListener('DOMContentLoaded', () => Joe());