不想拿比赛名次的参赛就是耍流氓

比赛经历概述

  • 最开始我的确在群里看见了我们辅导员发的这个比赛的通知,但是其实大家都清楚,比赛是最看人了,如果团队里有一个“耗子答辩”,那么这整个比赛过程都会变的异常的难受,所以开始我并不在意,因为我压根凑不齐人。别说啥进比赛群等着组队,可事实这个方案比在线下组水队还差。一直是到后来我的一个高中同学找到的我,拉我上船。在综合考虑下,确实是有搞头,那就干!

  • 比赛一共分成三个部分。第一部分是初赛,还有个初赛指导,不过讲得很拉。第一次去是给比赛足够的尊重,不过看见讲得确实是太拉了,中途就走了,后面我们就只签个到,就直接走了。可令人嘲讽得是,我们由于不知道初赛的提交时间,导致我们的初赛作品实际只做一天,页面就很经典,上中(下-(左,右))。就是我所提供的网站上的推荐板块。但幸在还是过了初赛。

  • 第二部分是复赛,通过初赛呢,大家都比较亢奋,都在豪言壮志的说或者想着要在五一假期里好好做,可真就是三分钟热度。这里我不得不说,效率太低下了(哪有做这么多天的页面还没有js算法),唯一的解释就是五一压根就没推进多少进度。我只做了一个页面,在五月一号二号便完工了(就是我们网站中的热门版块),虽说页面很简单,但是我至少认为看得过去。好在最后经过我们的共同努力,我们的比赛项目还是得到了一个基本的完善。

  • 我们的作品呢也算是有惊无险的进入了决赛,这时呢大家都兴奋起来了,我相信此时此刻是我们队伍凝聚力最强的时候,做ppt做到凌晨三点,连做梦都是我们上台答辩的样子。只不过可惜了,我们最终的成果仅仅只是得到了一个优秀奖,这个结果呢,我想对于我们来说是有点遗憾的,但是也是可以接受的。

知识总结

  • 其实,这次比赛的决赛呢,我是有“争议”的,而这种“争议”也只能映射到我的个人成长上,我看着其它选手使用的vue框架,我便知道事情要坏菜。具体原因呢我就不便多讲了......通过这次比赛,我也明白了很多事理,也想向大家分享,其实比较低级一点的比赛呢可能并没有我们所想的那般严肃,它只看结果,而不看过程。如果让我做此次比赛的总结,那么第一点肯定是我们所做的网站没有其它人那般优秀;但是第二点呢,也是由于我们太过“保守”只注重了比赛的过程而有点忽略比赛的结果;第三点呢,过于注重个人的开发能力而忽略了互联网的进步。

文字背景

图片demo
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
<style>
.item.svelte-109yyfj{
margin-left: auto;
margin-right: auto;
position: relative;/*&设置元素的定位方式为相对定位,这样可以使元素相对于其正常位置进行定位。 */
width: 300px;
height: 306px;
}

.text.svelte-109yyfj{
position: absolute;/*设置元素的定位方式为绝对定位,这样可以使元素相对于最近的已定位的祖先元素进行定位。 */
width: 100%;
bottom: 0;
left: 0;
padding: 96px 12px 16px;/*设置元素的内边距 */
background: linear-gradient(to top,#000,#0000);/*设置元素的背景颜色,是一个渐变色。这里是核心,如果是普通的背景色会显得非常单调和突兀。 */
color: #fff;
}

.title.svelte-109yyfj{
letter-spacing: 1px;/*设置字符间的空间 */
font-weight: 900;/*设置字体的粗细 */
font-size: 32px;
line-height: 34px;
}

.not-mobile{
height: 306px;
object-fit: cover;/*设置图片去适应元素的大小 */
}
</style>

<div class="item svelte-109yyfj">
<img src="../../image/img.png" alt="" loading="lazy" class="not-mobile">
<div class="text svelte-109yyfj">
<div class="svelte-109yyfj">收藏</div>
<div class="title svelte-109yyfj">74 种最佳虾食谱</div>
</div>
</div>
收藏
74 种最佳虾食谱

无缝轮播图:著有前端入门级功能之称

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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<style>
.carousel-container {
position: relative;
width: 253px;
height: 150px;
margin: 20px auto;/*设置元素的外边距 */
overflow: hidden;/*设置元素的溢出处理方式为隐藏 */
outline: 10px solid #000;
}
.carousel-list{
display: flex;/*设置元素的布局方式为弹性布局 */
width: 100%;
height: 100%;
position: relative;
}
.carousel-item{
justify-content: center;
align-items: center;
font-size: 50px;
font-weight: bold;
flex: 0 0 100%;/*设置元素的伸缩性 */
}
.item-1{
background-color: red;
display: flex;
}
.item-2{
background-color: blue;
display: flex;
}
.item-3{
background-color: green;
display: flex;
}
.carousel-arrow{
position: absolute;
top: 50%;
transform: translateY(-50%);/*设置元素的垂直偏移 */
width: 30px;
height: 30px;
background: #0000007a;
color: #fff;
cursor: pointer;/*设置元素的鼠标样式为手型 */
border-radius: 50%;/*设置元素的边框半径 */
display: flex;
align-items: center;
justify-content: center;
}
.carousel-arrow-left{
left: 10px;
}
.carousel-arrow-right{
right: 10px;
}
.indicator{
position: absolute;
bottom: 10px;
left: 50%;
transform: translateX(-50%);
display: flex;
}

/*其中span.active代表指示器的激活状态;总span数量是轮播图数量*/
.indicator span.active{
background: #fff;
border-color: #fff;
}
.indicator span{
width: 10px;
height: 10px;
margin: 0 3px;
border-radius: 50%;/*设置元素的边框半径 */
cursor: pointer;/*设置元素的鼠标样式为手型 */
border: 2px solid #ccc;
}
</style>


<div class="carousel-container">
<div class="carousel-list">
<div class="carousel-item item-1">1</div>
<div class="carousel-item item-2">2</div>
<div class="carousel-item item-3">3</div>
</div>

<div class="carousel-arrow carousel-arrow-left">&lt;</div>

<div class="carousel-arrow carousel-arrow-right">&gt;</div>

<div class="indicator">
<span class="active"></span>
<span></span>
<span></span>
</div>
</div>


<script>
window.doms={
carouselList:document.querySelector('.carousel-list'),
arrowLeft:document.querySelector('.carousel-arrow-left'),
arrowRight:document.querySelector('.carousel-arrow-right'),
indicators:document.querySelectorAll('.indicator span'),
};/*获取元素 */

const count=doms.indicators.length;/*获取指示器(轮播图)的数量 */
let curIdx=0;/*当前轮播图的索引 */

function moveTo(index){
doms.carouselList.style.transform=`translateX(-${index*100}%)`;/*第一张不移动,第二张移动-100%;第三张移动-200% */
doms.carouselList.style.transition='transform 0.5s';/*设置元素的过渡效果 */
/*设置指示器的激活状态 */
doms.indicators.forEach((indicator,i)=>{
indicator.classList=i===index?'active':'';/*如果i等于index,就添加active类,否则就移除active类 */
});
curIdx=index;/*更新当前轮播图的索引 */
}

/*遍历指示器,为每个指示器添加点击事件 */
doms.indicators.forEach((indicator,index)=>{
indicator.onclick=()=>{
moveTo(index);
};
});

/*无缝轮播图经典套路,overflow: hidden;属性欺骗用户眼睛 */
function init(){
const firstClone=doms.carouselList.firstElementChild.cloneNode(true);/*克隆第一个轮播图 */
const lastClone=doms.carouselList.lastElementChild.cloneNode(true);/*克隆最后一个轮播图 */
doms.carouselList.append(firstClone);/*将克隆的第一个轮播图添加到轮播图列表的最后 */
doms.carouselList.prepend(lastClone);/*将克隆的最后一个轮播图添加到轮播图列表的最前 */
lastClone.style.marginLeft='-100%';/*将克隆的最后一个轮播图向左移动100% */
}
init();


/*以下为左右箭头点击事件 */
function moveLeft(){
if (curIdx===0){
doms.carouselList.style.transition='none';/*设置元素的过渡效果 */
doms.carouselList.style.transform=`translateX(-${count*100}%)`;/*移动到最后一张轮播图 */
doms.carouselList.clientWidth;/*强制重绘 */
moveTo(count-1);/*移动到倒数第二张轮播图 */
}
else{
moveTo(curIdx-1);
}
}


function moveRight(){
if (curIdx===count-1){
doms.carouselList.style.transition='none';/*设置元素的过渡效果 */
doms.carouselList.style.transform='translateX(100%)';/*移动到第一张轮播图 */
doms.carouselList.clientWidth;/*强制重绘 */
moveTo(0);/*移动到第二张轮播图 */
}
else{
moveTo(curIdx+1);
}
}
doms.arrowLeft.onclick=moveLeft;
doms.arrowRight.onclick=moveRight;
</script>

手风琴效果

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
<style>
.accordion13x {
display: flex;
width: 454px;
height: 120px;
flex-direction: row;/* 水平布局 */
}

.accordion13x-title {
flex-grow: 1;/* 均分宽度 */
height: 100%;
padding: 10px;
text-decoration: none;/* 去掉下划线 */
color: #333;
position: relative;/* 相对定位 */
transition: width 0.3s ease-in-out;/* 宽度变化时,动画效果 */
}

.accordion13x-title p1 {
bottom: 30px;
position: absolute;/* 绝对定位 */
}

.accordion13x-title p {
position: absolute;
bottom: 0;
font-size: 10px;
}
</style>

<div class="accordion13x">
<a class="accordion13x-title" href="" style="background-color: red">
<p1>主题1</p1>
<p>主题1的相关描述</p>
</a>
<a class="accordion13x-title" href="" style="background-color: #efefef">
<p1>主题2</p1>
<p>主题2的相关描述</p>
</a>
<a class="accordion13x-title" href="" style="background-color: #1c7430">
<p1>主题3</p1>
<p>主题3的相关描述</p>
</a>
<a class="accordion13x-title" href="" style="background-color: #7abaff">
<p1>主题4</p1>
<p>主题4的相关描述</p>
</a>
<a class="accordion13x-title" href="" style="background-color: #6f42c1">
<p1>主题5</p1>
<p>主题5的相关描述</p>
</a>
</div>

<script>
document.addEventListener('DOMContentLoaded',function () {
var titles = document.getElementsByClassName('accordion13x-title');/* 获取所有标题 */
var accordion = document.getElementsByClassName('accordion13x')[0]; /* 获取accordion元素 */
var accordionWidth = accordion.offsetWidth; /* 获取accordion的宽度 */
var titleWidth = accordionWidth / titles.length; /* 计算每个标题的宽度 */

/* 鼠标移入 */
for (var i = 0; i < titles.length; i++) {
titles[i].addEventListener('mouseover', function(e) { /*为每个.accordion13x-title元素添加一个mouseover事件监听器。当鼠标悬停在元素上时,会执行这个监听器中的代码。*/

/*判断当前遍历到的元素是否是鼠标悬停的元素。如果是,就将其宽度设置为140px;如果不是,就将其宽度设置为titleWidth + 'px'。*/
for (var j = 0; j < titles.length; j++) {
if (titles[j] === e.target) {
titles[j].style.width = '140px';
} else {
titles[j].style.width =titleWidth + 'px';/* 如果直接使用auto那么平滑效果便不会生效 */
}
}
});

/* 鼠标移出 */
titles[i].addEventListener('mouseout', function(e) {
for (var j = 0; j < titles.length; j++) {
titles[j].style.width = titleWidth + 'px';
}
});
}
});
</script>

悬停覆盖效果

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
<style>
.food-style-li {
width: 202px;
height: 176px;
display: flex;
}
.imageBox {
overflow: hidden;/*隐藏动态的部分,不然就暴露了*/
width:100%;
}
.imageBox figure {
margin: 0;
position: relative;
height: 100%;
}

/*.imageBox img {*/
/* width: 100%;*/
/* height: 100%;*/
/*}*/

/* 如果要使用图片就把.img23dp注释掉,上面的img解释。把下面DOM中的div.img23dp注释掉,img给放出来即可 */

.img23dp {
width: 100%;
height: 100%;
background-color: #7abaff;
}

/*:before:在元素内容的前面插入生成的内容。*/
/*:after:在元素内容的后面插入生成的内容。*/
/*content属性是与:before和:after伪元素一起使用的,用于指定插入的内容。它可以包含文本、图片或者为空。*/

.imageBox figure:before, .imageBox figure:after {
content: '';
position: absolute;
height: 100%;
width: 50%;/*这个是控制黑色背景的宽度左边50%,右边50%*/
background: black;
transition: 0.5s;/*过渡时间*/
}
.imageBox figure:before {
left: -50%;/*这个是控制黑色背景的位置*/
top: 0;

}
.imageBox figure:after {
right: -50%;
top: 0;
}
.imageBox figcaption {
position: absolute;
top: 20px;
left: 20px;
right: 20px;
bottom: 20px;
background: #fff;
padding: 20px;
opacity: 0;/*鼠标没悬停前,透明度为0,不显示*/
transition: 0.5s;
transform: translateY(20px);/*文字位置向下移动20px*/
z-index: 1;
}
.imageBox:hover figure:before {
left: 0;
}
.imageBox:hover figure:after {
right: 0;
}
.imageBox:hover figcaption {
opacity: 1; /*透明度变为1,显示出来*/
transform: translateY(0);/*文字位置变为0*/
}
</style>

<div class="food-style">
<div class="food-style-li">
<div class="imageBox">
<figure> <!--<figure>和<figcaption>是HTML5中的元素,主要用于对插图、图表、代码等内容进行标记和描述。-->
<div class="img23dp"></div>
<!-- <img src="img/food4-1.jpg" alt="">-->
<figcaption>
<p1>主题</p1>
<p>主题概述</p>
</figcaption>
</figure>
</div>
</div>
</div>
主题

主题概述

功能的部署

  • 其中除开静态界面外,剩下的功能有:显示用户实时位置和天气信息、评论功能和一个ai助理。其实这些功能全不是自己写的都是调用了第三方的服务。