一、做什么
1.1 任务要求:
任务一:构建静态或动态网站。以下要求中选A或B,要求如下: A. 静态网站 采用纯 CSS 或者你喜欢什么 CSS 框架如 Bootstrap、MDB、Tailwind 构建主题自选,页面不少于5页(Web Page)的网站 B. 动态网站 使用任何一个前端框架如 Angular 开发一个应用程序(如英雄之旅、代理事项、图书管理等。),需要 CRUD 即增删改查功能并有一定的样式。 无论您选择静态还是动态网站,网站都需要部署在您最喜欢的网站托管服务器上,如 Gitpage 等(Angular项目可参阅 https://angular.cn/guide/deployment)。 该网站需要放置您的结业报告(请参见任务2)。 任务二:撰写结业报告,要求如下: (1) 题目为《通信软件开发与应用》课程结业报告; (2) 报告需要说明做什么、开发过程、遇到的问题、如何解决、未解决、总结; (3) 该报告以 Web 从你开发的网站上可以访问页面的形式。
1.2 设计主题
本次设计的网页主题是
二、效果显示
首页: 景点页面: 美食页面: 住宿页面: 了解更多页面:
三、实现过程
3.1 主页设计
设计一个topnav类和li
中的item类链接附在导航条上,从而实现主页和其它子页的定位功能; 具体代码:
<div class="topict"> <img src="images/images/tao.png" alt=""> <!-- 主页顶部的图片设计 --> </div> <div class="topnav"> <ul> <li><a href="#数学181GaoLei"><img src="images/校徽.png" alt="school badge" width="40px"></a></li> <!-- 页面导航条logo用我们学校的校徽代替我们学校的校徽 --> <li><a href="webpage.html" >首页</a></li>
<li><a href="index.html">景点</a></li>
<li><a href="food/index.html">美食</a></li>
<li><a href="accommodation.html">住宿</a></li>
<li><a href="vedio.html">了解更多</a></li>
</ul>
</div>
通过一个navright类和.js的文件进行实现 lunbo.js的文件中设计了animate函数手动轮播和showButton函数显示出轮播图片的底部。 js的具体代码:
window.onload = function () {
var container = document.getElementById('container');
var list = document.getElementById('list');
var buttons = document.getElementById('buttons').getElementsByTagName('span');
var prev = document.getElementById('prev');
var next = document.getElementById('next');
var index = 1;
var len = 3;
var animated = false;
var interval = 3000;
var timer;
var size = 1350;
function animate(offset) {
if (offset == 0) {
return;
}
animated = true;
var time = 300;
var inteval = 10;
var speed = offset / (time / inteval);
console.log("speed:" + speed);
var left = parseInt(list.style.left) + offset;
var go = function () {
if ((speed > 0 && parseInt(list.style.left) < left) || (speed < 0 && parseInt(list.style.left) > left)) {
list.style.left = parseInt(list.style.left) + speed + 'px';
console.log(list.style.left);
setTimeout(go, inteval);
} else {
list.style.left = left + 'px';
if (left > -200) {
list.style.left = -size * len + 'px';
}
if (left < ( -size * len)) {
list.style.left = '-' + size + 'px';
}
animated = false;
console.log("left:" + list.style.left);
}
}
go();
}
function showButton() {
for (var i = 0; i < buttons.length; i++) {
if (buttons[i].className == 'on') {
buttons[i].className = '';
break;
}
}
buttons[index - 1].className = 'on';
}
function play() {
timer = setTimeout(function () {
next.onclick();
play();
},
interval);
}
function stop() {
clearTimeout(timer);
}
next.onclick = function () {
if (animated) {
return;
}
if (index == len) {
index = 1;
} else {
index += 1;
}
animate(-size);
showButton();
}
prev.onclick = function () {
if (animated) {
return;
}
if (index == 1) {
index = len;
} else {
index -= 1;
}
animate(size);
showButton();
}
for (var i = 0; i < buttons.length; i++) {
buttons[i].onclick = function () {
if (animated) {
return;
}
if (this.className == 'on') {
return;
}
var myIndex = parseInt(this.getAttribute('index'));
var offset = -size * (myIndex - index);
animate(offset);
index = myIndex;
showButton();
}
}
container.onmouseover = stop;
container.onmouseout = play;
play();
};
HTML文件设计:
</div>
<div class="navright">
<div id="container">
<div id="list" style="left: -1350px;">
<img src="images/picture5.jpg"/>
<img src="images/picture2.jpg"/>
<img src="images/picture4.jpg"/>
<img src="images/picture5.jpg">
<img src="images/picture2.jpg"/></div>
<div id="buttons">
<span index="1"></span>
<span index="2"></span>
<span index="3"></span>
</div>
<a href="javascript:;" id="prev" class="arrow" style="font-size:60px; text-align:center;"><</a>
<a href="javascript:;" id="next" class="arrow" style="font-size:60px; text-align:center;">></a></div>
</div>
</div>
通过调用navboth、navleft、ft类将定位 具体代码:
<div class="navleft">
<h3 font="white 20px arial">简介</h3>
<p class="ft">
四川,简称“川”或“蜀”,省会——成都,位于中国大陆西南腹地,自古就有“天府之国”之美誉,是中国西部门户,大熊猫故乡。四川居住着彝族、藏族、回族、汉族、羌族等民族,是中国第二大藏区、唯一的羌族聚居区、最大的彝族聚居地。旅游资源极为丰富,历来有天下山水在于蜀之说,并有“峨眉天下秀,九寨天下奇,剑门天下险,青城天下幽”之誉。
</p>
<p class="ft">
被誉为“国宝”的珍稀动物大熊猫,85%栖息在四川西北的崇山峻岭之中,四川因此被誉为“大熊猫的故乡”。憨态可掬的大熊猫,是人们最喜爱的珍稀动之一,是世界野生动物保护基金会的标志动物。全国目前有大熊猫自然保护区18个,四川占16个,成都东北建有“大熊猫繁殖研究基地”;距成都136公里的卧龙大熊猫自然保护区是中国三大自然保护区之一,世界野生动物保护基金会在此建有“大熊猫研究中心”。
</p>
</div>
3.2 景点页面设计
该页面的整体设计就是通过列举一个景点再进行文字介绍,总共列举了4个景点。 通过调用section parallax bg1、section static、divstyle类对整体的页面进行布局和设计。 具体代码:
<main class="wrapper"> <section class="section parallax bg1"> </section> <section class="section static"> <div class="divstyle"> <h1>九寨沟</h1> <p> 九寨沟位于四川省阿坝藏族羌族自治州九寨沟县境内。地处青藏高原、川西高原、山地向四川盆地过渡地带,南距成都市300多公里,是一条纵深50余千米的山沟谷地,总面积64297公顷,森林覆盖率超过80%。因沟内有树正寨、荷叶寨、则查洼寨等九个藏族村寨坐落在这片高山湖泊群中而得名。 </p> <p> “九寨归来不看水”,是对九寨沟景色真实的诠释。泉、瀑、河、滩108个海子,构成一个个五彩斑斓的瑶池玉盆。长海、剑岩、诺日朗、树正、扎如、黑海六大景观,呈“Y”字形分布。翠海、叠瀑、彩林、雪峰、藏情、蓝冰,被称为“六绝”。神奇的九寨,被世人誉为“童话世界”,号称“水景之王”。 </p> </div> </section> <section class="section parallax bg2"> </section> <section class="section static"> <div class="divstyle"> <h1>峨眉山乐山大佛</h1> <p>峨眉山(Mount Emei)位于四川省西南部,四川盆地的西南边缘,是中国“四大佛教名山”之一,地势陡峭,风景秀丽,素有“峨眉天下秀”之称,山上的万佛顶最高,海拔3099米,高出峨眉平原2700多米。《峨眉郡志》云:“云鬘凝翠,鬒黛遥妆,真如螓首蛾眉,细而长,美而艳也,故名峨眉山。” </p> <p>峨眉山处于多种自然要素的交汇地区,区系成分复杂,生物种类丰富,特有物种繁多,保存有完整的亚热带植被体系,有植物3200多种,约占中国植物物种总数的1/10。峨眉山还是多种稀有动物的栖居地,动物种类达2300多种。 </p> <p>乐山大佛,又名
凌云大佛,位于四川省乐山市南岷江东岸凌云寺侧,濒大渡河、青衣江和岷江三江汇流处。大佛为弥勒佛坐像,通高71米,是中国最大的一尊摩崖石刻造像。</p> </div> </section> <section class="section parallax bg3"></section> <section class="section static"> <div class="divstyle"> <h1>阆中古城</h1> <p>阆中古城位于四川盆地东北缘、嘉陵江中游,为四大古城之一。阆中古城“5A”景区总面积达4.59平方公里,古城核心区域2平方公里。截至2015年,古城已有2300多年的建城历史,为古代巴国蜀国军事重镇。</p> <p> 阆中古城有张飞庙、永安寺、五龙庙、滕王阁、观音寺、巴巴寺、大佛寺、川北道贡院等8处全国重点文物保护单位;有邵家湾墓群、文笔塔、石室观摩崖造像、雷神洞摩崖造像、牛王洞摩崖造像、红四方面军总政治部旧址、华光楼、阆中文庙等22处省级文物保护单位 </p> </div> </section> <section class="section parallax bg4"></section> <section class="section static"> <div class="divstyle"> <h1>大熊猫栖息地</h1> <p>四川大熊猫栖息地由世界第一只大熊猫发现地宝兴县及中国四川省境内的卧龙自然保护区等7处自然保护区,包括卧龙、四姑娘山、夹金山脉,和青城山—都江堰风景名胜区等9处风景名胜区组成</p> <p> 四川大熊猫栖息地保存的野生大熊猫占全世界30%以上,是全球最大最完整的大熊猫栖息地;是全球所有温带区域(除热带雨林以外)中植物最丰富的区域,被保护国际(CI)选定为全球25个生物多样性热点地区之一,被世界自然基金会(WWF)确定为全球200个生态区之一。 </p> </div> </section> </main>
在页面的右下角设计一个返回首页的按钮,通过<a> </a>
引入首页的超链接 具体代码:
<div class="shouye"><a href="webpage.html">首页</a></div>
<a href="webpage.html" class="shouye">首页</a>
效果展示: 整个页面的样式设计:
.wrapper {
/* The height needs to be set to a fixed value for the effect to work. * 100vh is the full height of the viewport. */
height: 100vh;
/* width: 1400px; */
margin: 0px auto;
/* The scaling of the images would add a horizontal scrollbar, so disable x overflow. */
overflow-x: hidden;
/* Enable scrolling on the page. */
overflow-y: auto;
/* Set the perspective to 2px. This is essentailly the simulated distance from the viewport to transformed objects.*/
perspective: 2px;
}
.section {
/* Needed for children to be absolutely positioned relative to the parent. */
position: relative;
/* The height of the container. Must be set, but it doesn't really matter what the value is. */
height: 90vh;
/* For text formatting. */
display: flex;
align-items: center;
justify-content: center;
color: white;
text-shadow: 0 0 0px #000;
}
.parallax::after {
/* Display and position the pseudo-element */
content: "";
position: absolute<