Web开发及人机交互导论 大作业(二)

简介: Web开发及人机交互导论 大作业(二)

2. Functional Description


①Find bikes available nearby

In this function, we introduce the API of AutoNavi map to realize the positioning and searching of available bikes around users. After the project enters the back-end development, the positioning device on each bicycle can be used to refresh the positioning on the map in real time. This will greatly facilitate users to find their most convenient bikes.


9777246d79624911ab789ec26ba3696b.png


Source code:

During the programming implementation, the map container is built and the corresponding and scaling levels are set. Then create the corresponding marker point.


<div id="container"></div>  
<script>  
    //初始化地图插件  
    window.onload = function () {  
        var map = new AMap.Map("container", {  
            zoom: 15, //设置地图显示的缩放级别  
            center: [113.93318, 22.53701] //设置地图中心点坐标  
        });  
        // 创建一个 Marker 实例:(标记点)  
        var marker1 = new AMap.Marker({  
            position: new AMap.LngLat(113.98338, 22.53711),  
            title: "bicycle1 available"  
        });  
        var marker2 = new AMap.Marker({  
            position: new AMap.LngLat(113.91358, 22.53761),  
            title: "bicycle2 available"  
        });  
        var marker3 = new AMap.Marker({  
            position: new AMap.LngLat(113.93408, 22.59741),  
            title: "bicycle3 available"  
        });  
        var marker4 = new AMap.Marker({  
            position: new AMap.LngLat(113.98310, 22.54709),  
            title: "bicycle4 available"  
        });  
        var marker5 = new AMap.Marker({  
            position: new AMap.LngLat(113.93314, 22.53704),  
            title: "bicycle5 available"  
        });  
        // 将创建的点标记添加到已有的地图实例:  
        map.add(marker1);  
        map.add(marker2);  
        map.add(marker3);  
        map.add(marker4);  
        map.add(marker5);  
    }  
</script> 


②Price calculating and path planning

0e57e54c740c4743a90e4c6b0a3de1c2.png

After the departure and destination points and corresponding prices are set, the prices are automatically calculated and the route is planned.

d5c8022a208242aab8c82e425d35b285.png

Source code:

To achieve this function, we first design the input box and set the initial value of the corresponding element. Then link into the AutoNavi map API, build the map container, and put the map and route plan into the container. Finally, the calculation is done through JavaScript and the container is set to the anchor point. When the button is clicked, the route is calculated and jumps to the anchor point, so that the user can see the price and route planning directly. In order to make the jump of the anchor not abrupt, smooth sliding is achieved through JavaScript, which makes the website more beautiful.

<div id="search">  
    <div id="searchText">Departure: </div><input type="text" name="" id="startNode" /><br /><br />  
    <div id="searchText">Destination: </div><input type="text" name="" id="endNode" /><br /><br />  
    <div id="searchText">Basic Distance: </div><input type="text" name="" id="send" value="2" /><br /><br />  
    <div id="searchText">Basic Price: </div><input type="text" name="" id="startPrice" value="0.1" /><br /><br />  
    <div id="searchText">Price Per Kilometre: </div><input type="text" name="" id="price" value="0.2" /><br /><br />  
    <a><button id="btn">Start to Calculate</button></a>  
</div>  
<div id="window-container">  
    <table id="window" align="center">  
        <tr>  
            <td>  
                <div id="container" align="center"></div>  
            </td>  
            <td>  
                <div id="panel"></div>  
            </td>  
        </tr>  
    </table>  
</div>  
<div id="result" align="center">  
    <br />  
    <b>Total Distance: </b><span id="road">xx km</span>        
          <b>Total Price: </b><span id="endPrice">xx ¥</span><br />  
</div>  
<div id="navigation">  
    <script>  
        var send = document.querySelector('#send')  
        var startPrice = document.querySelector('#startPrice')  
        var price = document.querySelector('#price')  
        var road = document.querySelector('#road')  
        var endPrice = document.querySelector('#endPrice')  
        //初始化地图  
        var map = new AMap.Map('container', {  
            center: [113.943487, 22.538249],  
            lang: "en"  
        });  
        new AMap.Autocomplete({  
            input: 'startNode'  
        });  
        new AMap.Autocomplete({  
            input: 'endNode'  
        });  
        btn.onclick = function () {  
            if (send.value && startPrice.value && price.value) {  
                //建立地图  
                new AMap.Riding({  
                    map: map,  
                    panel: 'panel'  
                }).search([  
                    { keyword: startNode.value, city: '深圳' },  
                    { keyword: endNode.value, city: '深圳' }  
                ], function (status, data) {  
                    var distance = data.routes[0].distance  
                    console.log(data);  
                    console.log(data.routes[0].distance)  
                    //通过距离计算价格  
                    if (distance > send.value * 1000) {  
                        var newPrice = parseInt(startPrice.value) + Math.ceil(distance / 1000 - send.value) * price.value  
                        endPrice.innerText = newPrice + ' ¥'  
                    } else {  
                        endPrice.innerText = startPrice.value + ' ¥'  
                    }  
                    road.innerText = (distance / 1000).toFixed(2) + ' km'  
                })  
                //锚点平滑滑动  
                let anchorElement = document.getElementById('window-container');  
                if (anchorElement) {  
                    anchorElement.scrollIntoView({ behavior: 'smooth' });  
                }  
            } else {  
                alert('Please complete the information')  
            }  
        };  
    </script>  
</div>  


③Message board

In order to enable users to contact with us, in addition to the QQ for contact, also can give us a message to get in touch with us.

In this project, we created a form that allows users to leave messages by filling in the form. We also use JavaScript to check what is entered if the data is improperly formatted or forgotten. We will give you eye-catching hints.

It is worth noticing that in this project we also introduced a Layui framework for layout purposes.


a69524f9c4d047b2bb263503dd02438a.png


Source code:


4ed0c3b188ea47468125978ddb687087.png


a0b89b955dbf44738b56a5c6071cff72.png

Website Layout,and Website Presentational, Enhancement

1. CSS design document and functional description


①Top:

Top navigation is in the vast majority of pages, playing the role of navigation which makes it convenient for users to choose information they want.

146dcb8932114953b9732b736dd39456.png


104dba9d5f2f4c55a2450537c6ebd8b0.png


②Footer:

The bottom footer is also present on most pages and acts as a copyright notice.


02eb7d13e9144b63b337af8c541fd2b7.png

1ca724138eaa43e2a3fa5d8e2880bff5.png

95d821477ec444d39e87c1d9864d48ab.png


③Index:


a9c69f0c13ef42d4a2c5bde9a2e6f64f.png

fd7eeefe532143f6bd79d7f6673e095e.png


③About Us&employees&employmers:

In the four pages under this section, the CSS styling is basically the same, with only a few differences. Only one is shown here.


1efdf4657e524ba0bf80923fc2818e5f.png


④Administration, Legislation and Insurance Information.

Due to the uncertainty of the content of relevant laws, ‘Sample document.’ is only used here instead of the actual content.


b7094801bc5b428fb1b34f2cd457b76d.png


⑤Price Calculator:

Most of CSS styles of this page are similar to the rest of the page, so we don’t show them, just the different parts.


ebc822072efe41a09b213ffdb321093c.png

30c937a560a54d03967ba50bdcefab3c.png


⑥Contact Us:

Most of CSS styles of this page are similar to the rest of the page, so we don’t show them, just the different parts.

This page is set with layui which makes the website more beautiful.


2c1a4ab796fd4a44830ff7eda6822775.png


On this page, we use JavaScript to validate the input:


2ab3bbe5f8aa4bb9875dc16f67bcc16c.png


2. User manual for the functions


①For employers:

For employers, you are welcomed to visit this website.

This website provides you with a wealth of information about Shared bikes. You can have a deeper understanding of our services in this website. You can also subscribe to our bike-sharing service on this website for your employees.

The first thing you see is the home page, no matter which page you are in you can click the left art character or the navigation ‘HOME’ to jump to the homepage.


6af9896b6989439889f49e1de1c69ebc.png


You can click “About us” to view some information about us. Here are your reasons to share, our advantages, our service and our contact.

24d3f41ecd084ffbba25b01b065b70a0.png

You can also select the corresponding employers section, get more information to communicate with our customer service to subscribe, and view administration, legislation and insurance Information.

175491dbdcc14458bc41bf2fa8deee66.png

Whenever a problem occurs, you are welcomed to send us a message in ‘Contact Us’ page. Our staff will reply you in 24 hours.


cbb4c0206543408dacea808203a30fff.png


②For employees and other visitors:

For employees, you are welcomed to visit this website.

This website provides you with a wealth of information about Shared bikes. You can have a deeper understanding of our services in this website. You can also enjoy the subscription of our bike-sharing service on this website in your group.

The first thing you see is the home page, no matter which page you are in you can click the left art character or the navigation ‘HOME’ to jump to the homepage.

27211c4f246a41edb6bee1f73f60d68b.png

You can click “About us” to view some information about us. Here are your reasons to share, our advantages, our service and our contact.

6985323fb2ae435b8046d52a131a6a62.png

You can also select the corresponding employees section. Here, you can use our interactive map to find the nearest available Shared bikes quickly and easily.

31fbeeabbba94b9a884aafd632ca95be.png

No matter which page you are in, you can click the right orange button which links some social media platform to share this website to your friends.


408a97c75ece4dc69746227ac21679c1.png


We also provide you with a price calculator. Here you can calculate your costs and plan your path. We will provide you with convenient and safe cycling routes.

06bbf10bba714f81af5675534dbda923.png

Whenever a problem occurs, you are welcomed to send us a message in ‘Contact Us’ page. Our staff will reply you in 24 hours.


6b534d66d21e4247b11128c854c4457d.png


Project Results


4df182619c904384bc990d6e311d76a8.png

Project Summary


Through the design of the bike-sharing website, I learned to make proper layout of the website and proper use of CSS and JavaScript. In addition, I also learned the process of doing a project, from the conception to the implementation of the code. Many difficulties were encountered, such as CSS typesetting errors, JavaScript did not run as desired results. At the beginning, what color to choose for the layout always bothered me. Later, when I saw the orange books on the table, I was inspired and chose orange as the overall style. A lot of difficulties have also occurred with JavaScript in projects. Because I’m not familiar with JavaScript, I often get errors or don’t get the results I want. Finally, after a little bit of testing, fortunately all have been solved. I also learned to read developer documentation for other platforms and use their APIs to achieve the functionality I wanted. This lays the foundation for the future study.


I benefited a lot from the study of front-end design in one semester and the design of this project in one month. The Front-end learning, makes me learn to use HTML to write beautiful pages, learn to use CSS to design the page style, learned to use JavaScript language programming to improve interaction. What’s more learned to reference the appropriate framework to improve the appearance of page style and interaction.


In addition, it also cultivated my character of never giving up. In the design of CSS styles, I will often come across styles that are not what I want them to be. This is where the changes need to be made. Analyzing the causes and making modifications becomes particularly important. Little by little, patient modification and debugging are essential to getting the style right. Every time I tried to correct the mistakes; I had a feeling that some of my knowledge was not solid.


In the future study, I will keep this course in mind, and never forget what this project brings me.

相关文章
|
1月前
|
设计模式 前端开发 数据库
Python Web开发:Django框架下的全栈开发实战
【10月更文挑战第27天】本文介绍了Django框架在Python Web开发中的应用,涵盖了Django与Flask等框架的比较、项目结构、模型、视图、模板和URL配置等内容,并展示了实际代码示例,帮助读者快速掌握Django全栈开发的核心技术。
184 45
|
22天前
|
前端开发 安全 JavaScript
2025年,Web3开发学习路线全指南
本文提供了一条针对Dapp应用开发的学习路线,涵盖了Web3领域的重要技术栈,如区块链基础、以太坊技术、Solidity编程、智能合约开发及安全、web3.js和ethers.js库的使用、Truffle框架等。文章首先分析了国内区块链企业的技术需求,随后详细介绍了每个技术点的学习资源和方法,旨在帮助初学者系统地掌握Dapp开发所需的知识和技能。
2025年,Web3开发学习路线全指南
|
29天前
|
存储 前端开发 JavaScript
如何在项目中高效地进行 Web 组件化开发
高效地进行 Web 组件化开发需要从多个方面入手,通过明确目标、合理规划、规范开发、加强测试等一系列措施,实现组件的高效管理和利用,从而提高项目的整体开发效率和质量,为用户提供更好的体验。
32 7
|
1月前
|
开发框架 搜索推荐 数据可视化
Django框架适合开发哪种类型的Web应用程序?
Django 框架凭借其强大的功能、稳定性和可扩展性,几乎可以适应各种类型的 Web 应用程序开发需求。无论是简单的网站还是复杂的企业级系统,Django 都能提供可靠的支持,帮助开发者快速构建高质量的应用。同时,其活跃的社区和丰富的资源也为开发者在项目实施过程中提供了有力的保障。
|
1月前
|
开发框架 JavaScript 前端开发
TypeScript 是一种静态类型的编程语言,它扩展了 JavaScript,为 Web 开发带来了强大的类型系统、组件化开发支持、与主流框架的无缝集成、大型项目管理能力和提升开发体验等多方面优势
TypeScript 是一种静态类型的编程语言,它扩展了 JavaScript,为 Web 开发带来了强大的类型系统、组件化开发支持、与主流框架的无缝集成、大型项目管理能力和提升开发体验等多方面优势。通过明确的类型定义,TypeScript 能够在编码阶段发现潜在错误,提高代码质量;支持组件的清晰定义与复用,增强代码的可维护性;与 React、Vue 等框架结合,提供更佳的开发体验;适用于大型项目,优化代码结构和性能。随着 Web 技术的发展,TypeScript 的应用前景广阔,将继续引领 Web 开发的新趋势。
40 2
|
1月前
|
前端开发 API 开发者
Python Web开发者必看!AJAX、Fetch API实战技巧,让前后端交互如丝般顺滑!
在Web开发中,前后端的高效交互是提升用户体验的关键。本文通过一个基于Flask框架的博客系统实战案例,详细介绍了如何使用AJAX和Fetch API实现不刷新页面查看评论的功能。从后端路由设置到前端请求处理,全面展示了这两种技术的应用技巧,帮助Python Web开发者提升项目质量和开发效率。
53 1
|
1月前
|
XML 安全 PHP
PHP与SOAP Web服务开发:基础与进阶教程
本文介绍了PHP与SOAP Web服务的基础和进阶知识,涵盖SOAP的基本概念、PHP中的SoapServer和SoapClient类的使用方法,以及服务端和客户端的开发示例。此外,还探讨了安全性、性能优化等高级主题,帮助开发者掌握更高效的Web服务开发技巧。
|
2月前
|
XML JSON API
ServiceStack:不仅仅是一个高性能Web API和微服务框架,更是一站式解决方案——深入解析其多协议支持及简便开发流程,带您体验前所未有的.NET开发效率革命
【10月更文挑战第9天】ServiceStack 是一个高性能的 Web API 和微服务框架,支持 JSON、XML、CSV 等多种数据格式。它简化了 .NET 应用的开发流程,提供了直观的 RESTful 服务构建方式。ServiceStack 支持高并发请求和复杂业务逻辑,安装简单,通过 NuGet 包管理器即可快速集成。示例代码展示了如何创建一个返回当前日期的简单服务,包括定义请求和响应 DTO、实现服务逻辑、配置路由和宿主。ServiceStack 还支持 WebSocket、SignalR 等实时通信协议,具备自动验证、自动过滤器等丰富功能,适合快速搭建高性能、可扩展的服务端应用。
169 3
|
1月前
|
安全 数据库 开发者
Python Web开发:Django框架下的全栈开发实战
【10月更文挑战第26天】本文详细介绍了如何在Django框架下进行全栈开发,包括环境安装与配置、创建项目和应用、定义模型类、运行数据库迁移、创建视图和URL映射、编写模板以及启动开发服务器等步骤,并通过示例代码展示了具体实现过程。
66 2
|
2月前
|
设计模式 测试技术 持续交付
开发复杂Web应用程序
【10月更文挑战第3天】开发复杂Web应用程序
46 2