首页

js谷歌地图 根据国家添加不同的点击事件

前端达人

以下是在 JavaScript 和 Google 地图 API 中添加点击事件,根据国家进行不同操作的示例代码:


//创建地图对象
var map = new google.maps.Map(document.getElementById('map'), {
  zoom: 4,
  center: {lat: 37.0902, lng: -95.7129}
});

//创建信息窗口(infowindow)
var infowindow = new google.maps.InfoWindow();

//创建一个数组来存储标记
var markers = [];

//为每个国家添加点击事件
google.maps.event.addListener(map, 'click', function(event) {
  //获取点击位置的经纬度坐标
  var latLng = event.latLng;

  //使用地理编码器(geocoder)将经纬度坐标转换为地址信息
  var geocoder = new google.maps.Geocoder();
  geocoder.geocode({'location': latLng}, function(results, status) {
    if (status === 'OK') {
      if (results[0]) {
        //获取点击位置所在的国家名称
        var countryName = '';
        for (var i = 0; i < results[0].address_components.length; i++) {
          var component = results[0].address_components[i];
          if (component.types.indexOf('country') !== -1) {
            countryName = component.long_name;
            break;
          }
        }

        //根据国家名称执行相应操作
        switch (countryName) {
          case 'China':
            alert('您点击了中国');
            break;
          case 'United States':
            alert('您点击了美国');
            break;
          default:
            alert('您点击了' + countryName);
        }

        //创建标记并将其添加到地图上
        var marker = new google.maps.Marker({
          position: latLng,
          map: map
        });

蓝蓝设计建立了UI设计分享群,每天会分享国内外的一些优秀设计,如果有兴趣的话,可以进入一起成长学习,请加微信ban_lanlan,报下信息,蓝小助会请您入群。欢迎您加入噢~~ 希望得到建议咨询、商务合作,也请与我们联系01063334945。  分享此文一切功德,皆悉回向给文章原作者及众读者. 免责声明:蓝蓝设计尊重原作者,文章的版权归原作者。如涉及版权问题,请及时与我们取得联系,我们立即更正或删除。  蓝蓝设计www.lanlanwork.com )是一家专注而深入的界面设计公司,为期望卓越的国内外企业提供卓越的UI界面设计、BS界面设计 、 cs界面设计 、 ipad界面设计 、 包装设计 、 图标定制 、 用户体验 、交互设计、 网站建设 平面设计服务UI设计公司、界面设计公司、UI设计服务公司、数据可视化设计公司、UI交互设计公司、高端网站设计公司、UI咨询、用户体验公司、软件界面设计公司 

用cesium.js 制作一个球形地图

前端达人

要用 Cesium.js 制作一个球形地图,可以按照以下步骤:

  1. 在 HTML 文件中添加 Cesium.js 库文件的引用。可以通过以下方式获取最新版的 Cesium.js 库文件链接:https://cesium.com/downloads/。

  2. 创建一个 div 元素来容纳地球场景,并设置其样式以占满整个屏幕。

  3. 在 JavaScript 文件中创建 Cesium.Viewer 对象并将其附加到之前创建的 div 元素上。这将在屏幕上显示一个球体,并启动 Cesium.js 场景。

  4. 可以通过更改 Viewer 对象的属性来自定义地球的外观和行为。例如,可以更改摄像机的位置和方向、加载不同类型的地图数据、添加标记等等。

以下是一个简单的示例代码:


<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>My Cesium App</title>
    <style>
        #cesiumContainer {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
            overflow: hidden;
        }
    </style>
    <script src="https://cesium.com/downloads/cesiumjs/releases/1.85/Build/Cesium/Cesium.js"></script>
    <link href="https://cesium.com/downloads/cesiumjs/releases/1.85/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
</head>
<body>
    <div id="cesiumContainer"></div>
    <script>
        var viewer = new Cesium.Viewer('cesiumContainer');
    </script>
</body>
</html>
这将创建一个简单的地球场景,可以在其中添加更
蓝蓝设计建立了UI设计分享群,每天会分享国内外的一些优秀设计,如果有兴趣的话,可以进入一起成长学习,请加微信ban_lanlan,报下信息,蓝小助会请您入群。欢迎您加入噢~~ 希望得到建议咨询、商务合作,也请与我们联系01063334945。  分享此文一切功德,皆悉回向给文章原作者及众读者. 免责声明:蓝蓝设计尊重原作者,文章的版权归原作者。如涉及版权问题,请及时与我们取得联系,我们立即更正或删除。  蓝蓝设计www.lanlanwork.com )是一家专注而深入的界面设计公司,为期望卓越的国内外企业提供卓越的UI界面设计、BS界面设计 、 cs界面设计 、 ipad界面设计 、 包装设计 、 图标定制 、 用户体验 、交互设计、 网站建设 平面设计服务UI设计公司、界面设计公司、UI设计服务公司、数据可视化设计公司、UI交互设计公司、高端网站设计公司、UI咨询、用户体验公司、软件界面设计公司 

CSS旋转 动画效果

前端达人

目录

动画基本使用

 动画序列

 动画常见属性

动画简写属性

大数据热点图案例

速度曲线之steps步长


动画基本使用

动画(animation)是CSS3中具有颠覆性的特征之一,可通过设置多个节点来精确控制一个或一组动画,常 用来实现复杂的动画效果。

相比较过渡,动画可以实现更多变化,更多控制,连续自动播放等效果。

制作动画分为两步: 1.先定义动画 2.再使用(调用)动画

1. 用keyframes 定义动画(类似定义类选择器)

@keyframes 动画名称 {

                   0%{

                                width:100px;

                                }

                        100%{

                                width:200px;

                }

}

动画序列 

0% 是动画的开始,100% 是动画的完成。这样的规则就是动画序列。

在 @keyframes 中规定某项 CSS 样式,就能创建由当前样式逐渐改为新样式的动画效果。

动画是使元素从一种样式逐渐变化为另一种样式的效果。您可以改变任意多的样式任意的次数。

请用百分比来规定变化发生的时间,或用关键词 "from" 和 "to",等同于 0% 和 100%。

2. 元素使用动画

div {

width: 200px;

height: 200px;

background-color: aqua;

margin: 100px auto; /* 调用动画 */

animation-name: 动画名称;

/* 持续时间 */ animation-duration: 持续时间; } 

 
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Document</title>
  8. <style>
  9. /* 我们想页面一打开,一个盒子就从左边走到右边 */
  10. /* 1. 定义动画 */
  11. @keyframes move {
  12. /* 开始状态 */
  13. 0% {
  14. transform: translateX(0px);
  15. }
  16. /* 结束状态 */
  17. 100% {
  18. transform: translateX(1000px);
  19. }
  20. }
  21. div {
  22. width: 200px;
  23. height: 200px;
  24. background-color: pink;
  25. /* 2. 调用动画 */
  26. /* 动画名称 */
  27. animation-name: move;
  28. /* 持续时间 */
  29. animation-duration: 2s;
  30. }
  31. </style>
  32. </head>
  33. <body>
  34. <div></div>
  35. </body>
  36. </html>

 动画序列

 
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Document</title>
  8. <style>
  9. /* from to 等价于 0% 和 100% */
  10. /* @keyframes move {
  11. from {
  12. transform: translate(0, 0);
  13. }
  14. to {
  15. transform: translate(1000px, 0);
  16. }
  17. } */
  18. /* 动画序列 */
  19. /* 1. 可以做多个状态的变化 keyframe 关键帧 */
  20. /* 2. 里面的百分比要是整数 */
  21. /* 3. 里面的百分比就是 总的时间(我们这个案例10s)的划分 25% * 10 = 2.5s */
  22. @keyframes move {
  23. 0% {
  24. transform: translate(0, 0);
  25. }
  26. 25% {
  27. transform: translate(1000px, 0)
  28. }
  29. 50% {
  30. transform: translate(1000px, 500px);
  31. }
  32. 75% {
  33. transform: translate(0, 500px);
  34. }
  35. 100% {
  36. transform: translate(0, 0);
  37. }
  38. }
  39. div {
  40. width: 100px;
  41. height: 100px;
  42. background-color: pink;
  43. animation-name: move;
  44. animation-duration: 10s;
  45. }
  46. </style>
  47. </head>
  48. <body>
  49. <div>
  50. </div>
  51. </body>
  52. </html>

 动画常见属性

 
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Document</title>
  8. <style>
  9. @keyframes move {
  10. 0% {
  11. transform: translate(0, 0);
  12. }
  13. 100% {
  14. transform: translate(1000px, 0);
  15. }
  16. }
  17. div {
  18. width: 100px;
  19. height: 100px;
  20. background-color: pink;
  21. /* 动画名称 */
  22. animation-name: move;
  23. /* 持续时间 */
  24. /* animation-duration: 2s; */
  25. /* 运动曲线 */
  26. /* animation-timing-function: ease; */
  27. /* 何时开始 */
  28. animation-delay: 1s;
  29. /* 重复次数 iteration 重复的 conut 次数 infinite 无限 */
  30. /* animation-iteration-count: infinite; */
  31. /* 是否反方向播放 默认的是 normal 如果想要反方向 就写 alternate */
  32. /* animation-direction: alternate; */
  33. /* 动画结束后的状态 默认的是 backwards 回到起始状态 我们可以让他停留在结束状态 forwards */
  34. /* animation-fill-mode: forwards; */
  35. /* animation: name duration timing-function delay iteration-count direction fill-mode; */
  36. /* animation: move 2s linear 0s 1 alternate forwards; */
  37. /* 前面2个属性 name duration 一定要写 */
  38. /* animation: move 2s linear alternate forwards; */
  39. }
  40. div:hover {
  41. /* 鼠标经过div 让这个div 停止动画,鼠标离开就继续动画 */
  42. animation-play-state: paused;
  43. }
  44. </style>
  45. </head>
  46. <body>
  47. <div>
  48. </div>
  49. </body>
  50. </html>

动画简写属性

linear 匀速

animation:动画名称 持续时间 运动曲线 何时开始 播放次数 是否反方向 动画起始或者结束的状态

animation: myfirst 5s linear 2s infinite alternate;

简写属性里面不包含 animation-play-state

暂停动画:animation-play-state: puased; 经常和鼠标经过等其他配合使用

想要动画走回来 ,而不是直接跳回来:animation-direction : alternate

盒子动画结束后,停在结束位置: animation-fill-mode : forwards 

大数据热点图案例

还没听。。


速度曲线之steps步长
 

animation-timing-function:规定动画的速度曲线,默认是“ease“

 
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Document</title>
  8. <style>
  9. div {
  10. overflow: hidden;
  11. font-size: 20px;
  12. width: 0;
  13. height: 30px;
  14. background-color: pink;
  15. /* 让我们的文字强制一行内显示 */
  16. white-space: nowrap;
  17. /* steps 就是分几步来完成我们的动画 有了steps 就不要在写 ease 或者linear 了 */
  18. animation: w 4s steps(10) forwards;
  19. }
  20. @keyframes w {
  21. 0% {
  22. width: 0;
  23. }
  24. 100% {
  25. width: 200px;
  26. }
  27. }
  28. </style>
  29. </head>
  30. <body>
  31. <div>世纪佳缘我在这里等你</div>
  32. </body>
  33. </html>

CSS基础学习——动画

前端达人

一、CSS3 2D变形(利用Transfrom方法)

1、rotate(angle)
元素顺时针旋转给定的角度。允许负值,元素将逆时针旋转。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    div{
        width: 100px;
        height: 100px;
        border: 1px solid red;
        transform: rotate(30deg) ;
        margin: 200px auto;
    }
</style>
<body>
    <div>

    </div>
</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

效果如图
在这里插入图片描述
如果当rotate里面的值为负数时,比如ratate(-10deg),效果如图:
在这里插入图片描述

2、 translate(x,y)方法
通过 translate() 方法,元素从其当前位置移动,根据给定的 left(x 坐标) 和 top(y 坐标) 位置参数。也就是相对于页面左部和顶部的距离

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    div {
        width: 100px;
        height: 100px;
        border: 1px solid red;
        transform: translate(20px, 20px);
    }

</style>
<body>

    <div></div>
</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

效果如下
在这里插入图片描述
初次之外还有其他的参数

transform: translate(200px);
如果只带一个参数,这个参数代表的是x方向位移值,y方向位移为0

transform: translateX(200px);
对X方向移动

transform: translateY(200px);
对Y方向移动

3、scale() 方法
通过 scale() 方法,元素的尺寸会增加或减少,根据给定的宽度(X 轴)和高度(Y 轴)参数

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    div {
        width: 100px;
        height: 100px;
        border: 1px solid red;
        transform: scale(2,0.5);
        margin: 20px auto;
    }

</style>
<body>

    <div></div>
</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

效果如图
在这里插入图片描述
可以看到,长边变为了原来的两倍,宽边变为了原来的0.5倍

transform: scale(1.5);x轴和y轴都放大1.5倍
transform: scaleX(1.5);x轴放大1.5倍
transform: scaleY(1.5);y轴放大1.5倍
transform-origin: left top;改变中心点位置为左上角,当然还可以自由搭配,右下(right bottom),右上(right top)

4、 skew() 方法
通过 skew() 方法,元素翻转给定的角度,根据给定的水平线(X 轴)和垂直线(Y 轴)参数。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    div {
        width: 100px;
        height: 100px;
        border: 1px solid red;
        transform: skew(30deg,30deg);
        margin: 200px auto;
    }

</style>
<body>

    <div></div>
</body>
</html> 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

效果如图

在这里插入图片描述
意思就是:围绕 X 轴把元素翻转 30 度,围绕 Y 轴翻转 30 度。可能看起来比较抽象

transform: skew(230deg);如果只带一个参数,只有x轴方向的扭曲
transform: skewX(230deg); 对X轴进行翻转
transform: skewY(230deg); 对Y轴进行翻转

其实还是很好理解的,比如两个图叠加在一起

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    .demo{
        width: 200px;
        height: 200px;
        margin: 200px auto;
        border: 1px solid #000;
    }

    .box{
        width: 200px;
        height: 200px;
        border: 1px solid red;
        transform: skew(5deg,0deg);
    }

</style>
<body>
<div class="demo">
    <div class="box"></div>
</div>

</body>
</html> 
  • 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

在这里插入图片描述
可以看到,所谓的X轴翻转,其实就是x方向的移动,上面的线向左移动5px,下面的线向右移动5px,加入Y也一样
比如:transform: skew(0deg,5deg);
在这里插入图片描述
左边的线向上移动5px,右边的线向下移动5px,同时改变时 transform: skew(5deg,5deg);

在这里插入图片描述
最好记的方式就是对角线的同时移动,左上右下是排斥,左下右上是吸引

5、matrix() 方法
matrix() 方法把所有 2D 转换方法组合在一起。
matrix() 方法需要六个参数,包含数学函数,允许您:旋转、缩放、移动以及倾斜元素。

如题:将div右移100px,下移200px,旋转30度,x轴缩放1.5倍,y轴缩放2倍。

(1)transform: translate(100px, 200px) rotate(30deg) scale(1.5, 2);

(2)transform: matrix(1.299, 0.75, -1, 1.732, 100, 200)

计算方法
在这里插入图片描述
效果如图
在这里插入图片描述

6、transform-origin 属性
允许你改变被转换元素的位置
语法: transform-origin: x-axis y-axis z-axis;
属性值:
x-axis :定义视图被置于 X 轴的何处。可能的值:left,center,right,length,%。
y-axis :定义视图被置于 Y 轴的何处。可能的值:top,center,bottom,length,%。
z-axis :定义视图被置于 Z 轴的何处。可能的值:length。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>transform-origin</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .demo{
            width: 200px;
            height: 200px;
            margin: 200px auto;
            border: 1px solid #000;
        }
        .box{
            width: 200px;
            height: 200px;
            background-color: #f00;
            transform: rotate(60deg);
            transform-origin: right bottom;
        }
    </style>
</head>
<body>
<div class="demo">
    <div class="box"></div>
</div>
</body>
</html> 
  • 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

效果如图
在这里插入图片描述
形象的来说,就是规定你从哪个角开始旋转,比如规定右下角旋转,则图形以右下角为旋转角,顺时针旋转60°

二、CSS3 3D变形

1、perspective属性
perspective 属性定义 3D 元素距视图的距离,以像素计。该属性允许您改变 3D 元素查看 3D 元素的视图。
当为元素定义 perspective 属性时,其子元素会获得透视效果,而不是元素本身。
注释:perspective 属性只影响 3D 转换元素。
语法: perspective: number|none;
属性值:
number :元素距离视图的距离,以像素计。
none :默认值。与 0 相同。不设置透视

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>perspective</title>
    <style>
        .father{
            position: relative;
            width: 200px;
            height: 200px;
            padding: 10px;
            margin: 200px auto;
            border: 1px solid #999;
            perspective: 150px;
        }
        .son{
            width: 100px;
            height: 50px;
            padding: 50px;
            position: absolute;
            border: 1px solid #f00;
            background-color: #0ff;
            transform: rotateX(45deg);
        }
    </style>
</head>
<body>
<div class="father">
    <div class="son"></div>
</div>
</body>
</html> 
  • 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

效果如图
在这里插入图片描述

2、trasform-style属性
transform-style 属性规定如何在 3D 空间中呈现被嵌套的元素。
注释:该属性必须与 transform 属性一同使用。
语法: transform-style: flat|preserve-3d;
属性值:
flat :子元素将不保留其 3D 位置。
preserve-3d :子元素将保留其 3D 位置。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>transform-style</title>
    <style>
        .wrapper{
            width: 200px;
            height: 100px;
            margin: 200px auto;
        }
        .div1,.div2{
            width: 200px;
            height: 100px;
            padding: 20px;
        }
        .div1{
            background-color: #f00;
            transform: rotateY(30deg);
            transform-style: preserve-3d;

        }
        .div2{
            background-color: #655fff;
            transform: rotateY(45deg);
        }
    </style>
</head>
<body>
<div class="wrapper">
    <div class="div1">div1
        <div class="div2">div2</div>
    </div>
</div>
</body>
</html> 
  • 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

效果如图
在这里插入图片描述

3、CSS3过渡
transition 属性是一个简写属性,用于设置四个过渡属性:
transition-property:规定设置过渡效果的 CSS 属性的名称。
transition-duration:规定完成过渡效果需要多少秒或毫秒。
transition-timing-function:规定速度效果的速度曲线。
transition-delay:定义过渡效果何时开始。
注释:请始终设置 transition-duration 属性,否则时长为 0,就不会产生过渡效果。
语法: transition: property duration timing-function delay;

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>transition过渡动画</title>
    <style>
        .box{
            width: 100%;
            height: 300px;
            position: relative;
            border: 1px solid #eee;
        }
        .demo{
            width: 100px;
            height: 100px;
            background-color: #f00;
            position: absolute;
            left: 100px;
            top: 100px;
            transform: rotate(0deg);
            transition-property: all;
            transition-duration: .8s;
        }
        .box:hover .demo{
            left: 500px;
            width: 300px;
            transform: rotate(45deg);
        }
    </style>
</head>
<body>
<div class="box">
    <div class="demo"></div>
</div>
</body>
</html> 
  • 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

或者

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>transition过渡动画</title>
    <style>
        .box{
            width: 100%;
            height: 300px;
            position: relative;
            border: 1px solid #eee;
        }
        .demo{
            width: 100px;
            height: 100px;
            background-color: #f00;
            position: absolute;
            left: 100px;
            top: 100px;
            transform: rotate(0deg);
            transition: left 2s ease 500ms, width 5s ease-in-out;
        }
        .box:hover .demo{
            left: 500px;
            width: 300px;
            transform: rotate(45deg);
        }
    </style>
</head>
<body>
<div class="box">
    <div class="demo"></div>
</div>
</body>
</html> 
  • 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

可以自行实验一下

4、CSS3动画

使用@keyframes
通过 @keyframes 规则,您能够创建动画。
创建动画的原理是,将一套 CSS 样式逐渐变化为另一套样式。
在动画过程中,您能够多次改变这套 CSS 样式。
以百分比来规定改变发生的时间,或者通过关键词 “from” 和 “to”,等价于 0% 和 100%。
0% 是动画的开始时间,100% 动画的结束时间。
为了获得最佳的浏览器支持,您应该始终定义 0% 和 100% 选择器。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>关键帧动画</title>
    <style>
        .box{
            width: 100%;
            height: 800px;
            position: relative;
        }
        .demo{
            width: 100px;
            height: 100px;
            background-color: #ff0000;
            -webkit-border-radius: 50%;
            -moz-border-radius: 50%;
            border-radius: 50%;
            position: absolute;
            /*animation: move 5s ease-in-out infinite alternate ;*/
            -webkit-animation: move 5s ease-in-out 500ms 2 alternate ;
            -moz-animation: move 5s ease-in-out 500ms 2 alternate ;
            -ms-animation: move 5s ease-in-out 500ms 2 alternate ;
            -o-animation: move 5s ease-in-out 500ms 2 alternate ;
            animation: move 5s ease-in-out 500ms 2 alternate ;
        }
        @keyframes move {
            0%{
                left: 100px;
            }
            45%{
                left: 200px;
                top: 100px;
                background-color: #00f;
            }
            75%{
                left: 400px;
                top: 300px;
                background-color: #64ff77;
            }
            100%{
                left: 500px;
                top: 500px;
                background-color: #ff4975;
            }
        }
    </style>
</head>
<body>
<div class="box">
    <div class="demo"></div>
</div>
</body>
</html> 
  • 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

或者

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>关键帧动画</title>
    <style>
        .box{
            width: 100%;
            height: 800px;
            position: relative;
        }
        .demo{
            width: 100px;
            height: 100px;
            background-color: #ff0000;
            -webkit-border-radius: 50%;
            -moz-border-radius: 50%;
            border-radius: 50%;
            position: absolute;
            /*animation: move 5s ease-in-out infinite alternate ;*/
            -webkit-animation: move 5s ease-in-out 500ms 2 alternate ;
            -moz-animation: move 5s ease-in-out 500ms 2 alternate ;
            -ms-animation: move 5s ease-in-out 500ms 2 alternate ;
            -o-animation: move 5s ease-in-out 500ms 2 alternate ;
            animation: move 5s ease-in-out 500ms 2 alternate ;
        }
        @keyframes move {
           from{
                left: 100px;
            }
            to{
                left: 500px;
                background-color: #00f;
            }
        }

    </style>
</head>
<body>
<div class="box">
    <div class="demo"></div>
</div>
</body>
</html> 
  • 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

animation:move 5s ease-in-out 500ms 2 alternate

move:表示animation-name ,动画名称

5s:表示animation-duration,时长

ease-in-out:表示animation-timing-function 规定动画的速度曲线

除此以外还有:
linear:动画从头到尾的速度是相同的。
ease:默认。动画以低速开始,然后加快,在结束前变慢。
ease-in:动画以低速开始。
ease-out:动画以低速结束。
ease-in-out:动画以低速开始和结束。

500ms:表示animation-delay,规定在动画开始之前的延迟。

2 :表示animation-iteration-count,规定动画应该播放的次数。

alternate:表示animation-direction,规定是否应该轮流反向播放动画,如果 animation-direction 值是 “alternate”,则动画会在奇数次数(1、3、5 等等)正常播放,而在偶数次数(2、4、6 等等)向后播放。。



蓝蓝设计建立了UI设计分享群,每天会分享国内外的一些优秀设计,如果有兴趣的话,可以进入一起成长学习,请加微信ban_lanlan,报下信息,蓝小助会请您入群。欢迎您加入噢~~

希望得到建议咨询、商务合作,也请与我们联系01063334945。 



分享此文一切功德,皆悉回向给文章原作者及众读者. 免责声明:蓝蓝设计尊重原作者,文章的版权归原作者。如涉及版权问题,请及时与我们取得联系,我们立即更正或删除。 



蓝蓝设计www.lanlanwork.com )是一家专注而深入的界面设计公司,为期望卓越的国内外企业提供卓越的UI界面设计、BS界面设计 、 cs界面设计 、 ipad界面设计 、 包装设计 、 图标定制 、 用户体验 、交互设计、 网站建设 平面设计服务UI设计公司、界面设计公司、UI设计服务公司、数据可视化设计公司、UI交互设计公司、高端网站设计公司、UI咨询、用户体验公司、软件界面设计公司

用css画一个空心圆环,使用纯CSS画一个圆环(代码示例)

前端达人

本篇文章通过代码示例介绍一下使用纯CSS画圆环的方法。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。

3b98c20306e2c9d95532ec8bb7753265.png

画圆环思想很简单:首先画两个圆,设置不同的背景色;然后让两个圆的圆心重合即可。

难度系数

☆☆

HTML

解析:此处有父容器

CSS.container {

position: relative;

top: 0;

left: 0;

width: 300px;

height: 300px;

background-color: lightgrey;

}

.ring-style {

display: inline-block;

position: absolute;

top: 50%;

left: 50%;

transform: translate(-50%, -50%);

background-color: blue;

width: 260px;

height: 260px;

border-radius: 260px;

}

.ring-style::before {

content: ' ';

display: inline-block;

position: absolute;

top: 50%;

left: 50%;

transform: translate(-50%, -50%);

background-color: white;

width: 200px;

height: 200px;

border-radius: 200px;

}

解析:设置元素的宽高、圆角效果,即可画出一个圆

通过 ::before 伪元素和本体元素,创建两个圆

通过基于父容器的绝对定位,设置 top、left、translate 属性,让元素基于父容器水平、竖直居中,即可让两个圆的圆心重合

【推荐教程:CSS视频教程 】

效果图

e6b5a99b91be36358f46cb9fa35bf984.png

知识点border-radius

::before && ::after

元素水平、竖直居中

蓝蓝设计建立了UI设计分享群,每天会分享国内外的一些优秀设计,如果有兴趣的话,可以进入一起成长学习,请加微信ban_lanlan,报下信息,蓝小助会请您入群。欢迎您加入噢~~
希望得到建议咨询、商务合作,也请与我们联系01063334945。 

分享此文一切功德,皆悉回向给文章原作者及众读者. 免责声明:蓝蓝设计尊重原作者,文章的版权归原作者。如涉及版权问题,请及时与我们取得联系,我们立即更正或删除。 

蓝蓝设计www.lanlanwork.com )是一家专注而深入的界面设计公司,为期望卓越的国内外企业提供卓越的UI界面设计、BS界面设计 、 cs界面设计 、 ipad界面设计 、 包装设计 、 图标定制 、 用户体验 、交互设计、 网站建设 平面设计服务UI设计公司、界面设计公司、UI设计服务公司、数据可视化设计公司、UI交互设计公司、高端网站设计公司、UI咨询、用户体验公司、软件界面设计公司

Echarts legend属性使用

前端达人

Echarts的legend属性是对图例组件的相关配置
而legend就是Echarts图表中对图形的解释部分:
图例

其中legend自身常用的配置属性如下:

orient

设置图例的朝向

属性值:

vertical // 垂直显示
或者
horizontal // 水平显示

legend: { orient: 'vertical' } 
  • 1
  • 2
  • 3

vertical

 legend: { orient: 'horizontal' } 
  • 1
  • 2
  • 3

horizontal

x/y(left/top)

设置图例在X轴方向上的位置以及在Y轴方向上的位置

位置 取值
x/left left/center/right
y /top top/center/bottom

例子:

legend: { orient: 'vertical', x:'right', y:'center' } 
  • 1
  • 2
  • 3
  • 4
  • 5

x/y

样式设置

属性 说明
backgroundColor 背景颜色
borderColor 边框颜色
borderWidth 边框宽度
padding 内边距

注意:边框宽度和内边距属性值为数值,不加单位。

legend: { orient: 'vertical', x:'center', y:'top', backgroundColor: '#fac858', borderColor: '#5470c6', borderWidth: '200', } 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

echarts

itemGap

控制每一项的间距,也就是图例之间的距离
属性值为数值,不带单位

legend: { orient: 'horizontal', x:'center', y:'top', itemGap: 40 } 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

echarts

itemHeight

控制图例图形的高度
属性值为数字,不加单位

legend: { orient: 'horizontal', x:'center', y:'top', itemHeight: 5 } 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

echarts

textStyle

设置图例文字样式
属性值为一个对象

legend: { orient: 'horizontal', x:'center', y:'top', textStyle: { color: 'red', fontSize: '20px', fontWeight: 700 } } 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

echarts

selected

设置图例的某个选项的数据默认是显示还是隐藏。
false: 隐藏
属性值:对象,属性值内容:图例上的数据与boolean构成键值对
如果某选项设置为false,那么图标上的数据也会默认不显示,而图例会以灰色样式显示

legend: { orient: 'horizontal', x:'center', y:'top', selected:{ '搜索引擎': false, '联盟广告': false } } 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

echarts

data

图例上显示的文字信息,如果不设置该项,默认会以series设置的信息作为图例信息。如果设置该项,必须与series设置的信息一致,才会生效。
而该属性的作用:可以单独对图例中某个选项进行单独设置样式
比如:

legend: { orient: 'horizontal', x:'center', y:'top', data:[{ name: '搜索引擎', icon: 'circle', textStyle: {fontWeight: 'bold', color: 'orange'} },'直接访问','邮件营销','联盟广告','视频广告'] } 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

以上单独设置中
name:指定该项的名称,必填
icon:指定图例项的icon,可以为内置的图形7个图形,或者自定义图标的形式:'image://url'
textStyle::设置文本样式
echarts





蓝蓝设计建立了UI设计分享群,每天会分享国内外的一些优秀设计,如果有兴趣的话,可以进入一起成长学习,请加微信ban_lanlan,报下信息,蓝小助会请您入群。欢迎您加入噢~~

希望得到建议咨询、商务合作,也请与我们联系01063334945。 



分享此文一切功德,皆悉回向给文章原作者及众读者. 免责声明:蓝蓝设计尊重原作者,文章的版权归原作者。如涉及版权问题,请及时与我们取得联系,我们立即更正或删除。 



蓝蓝设计www.lanlanwork.com )是一家专注而深入的界面设计公司,为期望卓越的国内外企业提供卓越的UI界面设计、BS界面设计 、 cs界面设计 、 ipad界面设计 、 包装设计 、 图标定制 、 用户体验 、交互设计、 网站建设 平面设计服务UI设计公司、界面设计公司、UI设计服务公司、数据可视化设计公司、UI交互设计公司、高端网站设计公司、UI咨询、用户体验公司、软件界面设计公司

超详细的VSCode下载和安装教程以及解决VSCode下载速度特别慢的问题

前端达人

1. 引言

今天用WebStorm运行前端代码时,发现不太好打断点。

于是,打算改用VSCode来运行前端代码,但前提是要安装VSCode,如下便是超详细的VSCode安装教程以及解决VSCode下载速度特别慢的问题。

2. 下载VSCode

  1. 打开VSCode官网

https://code.visualstudio.com

在这里插入图片描述

  1. download下载

在这里插入图片描述

在这里插入图片描述

  1. 下载特别慢
    在这里插入图片描述

你会发现VSCode官网地址下载很慢,或者下着下着就暂停了,如下图所示:

在这里插入图片描述

如果下载完成,那得等到猴年马月。

3. 解决VSCode下载速度特别慢

  1. 单击右下角全部显示

我是用chrome浏览器,点击右下角的全部显示按钮,可以跳转到下载内容页面。

如果你是用其他浏览器,可能使用其他方式跳转到下载内容页面。

在这里插入图片描述

在这里插入图片描述

  1. 鼠标放置在下图红框中,右键鼠标,复制链接地址

在这里插入图片描述

  1. 将复制号的下载链接地址放到任意地方,并将蓝色区域的地址替换成国内镜像地址:vscode.cdn.azure.cn

在这里插入图片描述

https://az764295.vo.msecnd.net/stable/129500ee4c8ab7263461ffe327268ba56b9f210d/VSCodeUserSetup-x64-1.72.1.exe修改为https://vscode.cdn.azure.cn/stable/129500ee4c8ab7263461ffe327268ba56b9f210d/VSCodeUserSetup-x64-1.72.1.exe

将替换后的地址输入到浏览器的地址栏中,如下图所示,按enter键即可快速下载。

在这里插入图片描述

在这里插入图片描述

速度是不是立刻提升了。

4. 安装VSCode

  1. 我同意此协议 -> 下一步

在这里插入图片描述

  1. 选择更换文件夹 -> 下一步

因为我的系统盘(C盘)的内存不够用了,需要更换到其他盘符,我更换到D盘中。

如果你不想更换到其他盘符,可以直接下一步即可。

在这里插入图片描述

在这里插入图片描述

  1. 选择附加任务 -> 下一步。根据你的需求勾选复选框。

在这里插入图片描述

  1. 准备安装 -> 安装

在这里插入图片描述

在这里插入图片描述

  1. 安装完成 -> 完成

在这里插入图片描述

  1. 打开VSCode

在这里插入图片描述





蓝蓝设计建立了UI设计分享群,每天会分享国内外的一些优秀设计,如果有兴趣的话,可以进入一起成长学习,请加微信ban_lanlan,报下信息,蓝小助会请您入群。欢迎您加入噢~~

希望得到建议咨询、商务合作,也请与我们联系01063334945。 



分享此文一切功德,皆悉回向给文章原作者及众读者. 免责声明:蓝蓝设计尊重原作者,文章的版权归原作者。如涉及版权问题,请及时与我们取得联系,我们立即更正或删除。 



蓝蓝设计www.lanlanwork.com )是一家专注而深入的界面设计公司,为期望卓越的国内外企业提供卓越的UI界面设计、BS界面设计 、 cs界面设计 、 ipad界面设计 、 包装设计 、 图标定制 、 用户体验 、交互设计、 网站建设 平面设计服务UI设计公司、界面设计公司、UI设计服务公司、数据可视化设计公司、UI交互设计公司、高端网站设计公司、UI咨询、用户体验公司、软件界面设计公司

HBuilderX uni-app简单实现静态登录页面(实例)

前端达人

本章用到......uni-app页面跳转uni.navigateTo方法、uni.navigateBack方法。uni-app简单实现邮箱验证码发送点击后读秒样式。登录账号、密码正则表达式验证等

适合刚入门的小伙伴,大佬就没必要看了

静态页面!静态页面!没有绑定后端数据接口

目录

一、HBuilderX下载

二、创建uni-app项目

pages.json配置文件

三、登录页面

 login.vue页面

login.css文件

四、手机短信验证页面

 phoneVerify.vue页面

 phoneVerify.css文件

五、找回密码页面

findBack.vue页面

findBack.css文件

六、邮箱找回密码页面

 mailFandBack.vue页面

mailFandBack.css文件

七、邮箱发送验证成功页面

 emailFinish.vue页面

emailFinish.css文件


一、HBuilderX下载

https://dcloud.io/hbuilderx.html

 官网直接下载解压即可

二、创建uni-app项目

文件-新建-项目

 我这里直接选择默认模板,Vue版本、uniCloud自行选择即可

 创建完成后自动生成文件夹

 文件名这里自动生成原本是index,文件名自行定义即可

页面文件自己新建Vue文件即可

pages.json配置文件

注意!!这个文件后续如果需要新添加新页面时这个文件里一定要配置参数不然页面出不来,代码格式看下面代码↓↓↓↓↓↓↓↓↓


  1. {
  2. // 设置单页面
  3. "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
  4. {
  5. "path": "pages/login/login",
  6. "style": {
  7. // 设置顶部导航栏
  8. "navigationBarTitleText": "",
  9. "navigationBarBackgroundColor": "#FFFFFF"
  10. }
  11. },
  12. {
  13. "path": "pages/login/findBack",
  14. "style": {
  15. "navigationBarTitleText": "找回密码"
  16. }
  17. },
  18. {
  19. "path": "pages/login/mailFindBack",
  20. "style": {
  21. "navigationBarTitleText": "邮箱找回密码"
  22. }
  23. },
  24. {
  25. "path": "pages/login/phoneVerify",
  26. "style": {
  27. "navigationBarTitleText": "",
  28. "navigationBarBackgroundColor": "#FFFFFF"
  29. }
  30. },
  31. {
  32. "path": "pages/login/emailFinish",
  33. "style": {
  34. "navigationBarTitleText": ""
  35. }
  36. }
  37. {
  38. //新添加的Vue页面配置!!!
  39. "path": "",
  40. "style": {
  41. "navigationBarTitleText": ""
  42. }
  43. }
  44. ],
  45. // 设置全部页面
  46. "globalStyle": {
  47. "navigationBarTextStyle": "black",
  48. "navigationBarTitleText": "uni-app",
  49. "navigationBarBackgroundColor": "#F8F8F8",
  50. "backgroundColor": "#F8F8F8"
  51. },
  52. "uniIdRouter": {},
  53. // 设置底部导航栏
  54. "tabBar": {
  55. }
  56. }

类似navigationBarTitleText(导航栏text)、navigationBarBackgroundColor(导航栏背景色)等等属性可以查看相关资料自行配置即可

pages里设置单页面参数,每个页面配置对应path路径参数

globalStyle里设置全局页面参数

js、josn、scss文件等等其他配置文件这里就不多说了自行研究吧!!!因为我也还没搞清楚到底怎么用哈哈哈

进入正题↓↓↓↓↓↓↓↓↓↓↓↓↓代码看着有些乱........凑合看慢慢理解吧

代码里的src图片链接自行修改!!!!(还有css里的URL)

三、登录页面

先看一下效果图

 login.vue页面


  1. <!-- 登录页面 -->
  2. <template>
  3. <view class="flex-col flex-auto group">
  4. <text class="self-center text_2" v-if="type==1000">手机号登录</text>
  5. <text class="self-center text_2" v-if="type==2000">账号登录</text>
  6. <!-- 手机号登录 -->
  7. <view class="" v-if="type==1000">
  8. <view class="flex-col justify-start items-start text-wrapper">
  9. <input type="text" class="font_1" @input="onInput" placeholder="请输入手机号" v-model="phoneNumber">
  10. </view>
  11. <!-- svg画线 -->
  12. <view style="height: 1px;">
  13. <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  14. <line x1="0" y1="0" x2="400" y2="0" style="stroke:rgb(0,0,0);stroke-width:0.2" />
  15. </svg>
  16. </view>
  17. <view class="flex-col justify-start items-start text-wrapper_2">
  18. <input type="text" password="true" class="font_1" @input="onInput" placeholder="请输入密码" v-model="phonePassword">
  19. </view>
  20. <!-- svg画线 -->
  21. <view style="height: 1px;">
  22. <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  23. <line x1="0" y1="0" x2="400" y2="0" style="stroke:rgb(0,0,0);stroke-width:0.2" />
  24. </svg>
  25. </view>
  26. </view>
  27. <!-- 账号登录 -->
  28. <view class="" v-if="type==2000">
  29. <view class="flex-col justify-start items-start text-wrapper">
  30. <input type="text" class="font_1" @input="onInput" placeholder="请输入用户名" v-model="idNumber">
  31. </view>
  32. <!-- svg画线 -->
  33. <view style="height: 1px;">
  34. <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  35. <line x1="0" y1="0" x2="400" y2="0" style="stroke:rgb(0,0,0);stroke-width:0.2" />
  36. </svg>
  37. </view>
  38. <view class="flex-col justify-start items-start text-wrapper_2">
  39. <input type="text" password="true" class="font_1" @input="onInput" placeholder="请输入用户密码" v-model="idPassword">
  40. </view>
  41. <!-- svg画线 -->
  42. <view style="height: 1px;">
  43. <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  44. <line x1="0" y1="0" x2="400" y2="0" style="stroke:rgb(0,0,0);stroke-width:0.2" />
  45. </svg>
  46. </view>
  47. </view>
  48. <view class="self-start font_1 text_3" @click="type=2000" v-if="type==1000">用账号登录</view>
  49. <view class="self-start font_1 text_3" @click="type=1000" v-if="type==2000">用手机号登录</view>
  50. <!-- 登录按钮1 -->
  51. <view class="flex-col justify-start items-center button" v-if="btnShow">
  52. <button class="font_1 text_4" @click="onSubmit">登 录</button>
  53. </view>
  54. <!-- 登录按钮2 -->
  55. <view class="flex-col justify-start items-center button2" v-else>
  56. <button class="font_1 text_66">登 录</button>
  57. </view>
  58. <view class="flex-row justify-between group_2" v-if="type==1000">
  59. <text class="font_2" @click="onPageJump('/pages/login/phoneVerify')">短信验证码登录</text>
  60. <text class="font_2" @click="onPageJump('/pages/login/findBack')">找回密码</text>
  61. </view>
  62. <view class="flex-row justify-between group_3" v-else>
  63. <text class="font_2" @click="onPageJump('/pages/login/findBack')">找回密码</text>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. export default {
  69. components:{
  70. },
  71. data() {
  72. return {
  73. type: 1000, //判断登录类型手机登录或账号登录
  74. phoneNumber:'', //手机账号
  75. phonePassword:'', //手机密码
  76. idNumber:'', //账号
  77. idPassword:'', //账号密码
  78. btnShow:false, //判断登录按钮显示隐藏
  79. timeOut:null, //添加定时器
  80. }
  81. },
  82. onLoad() {
  83. },
  84. created() {
  85. },
  86. // 方法
  87. methods: {
  88. // 找回密码跳转页面
  89. onPageJump(url) {
  90. uni.navigateTo({
  91. url: url
  92. });
  93. },
  94. // 判断显示登录按钮
  95. onInput() {
  96. this.timeOut && clearTimeout(this.timeOut)
  97. this.timeOut = setTimeout(() => {
  98. if (this.type == 1000) {
  99. if (this.phoneNumber && this.phonePassword) {
  100. this.btnShow = true;
  101. } else {
  102. this.btnShow = false;
  103. }
  104. } else {
  105. if (this.idNumber && this.idPassword) {
  106. this.btnShow = true;
  107. } else {
  108. this.btnShow = false;
  109. }
  110. }
  111. }, 100);
  112. },
  113. // 点击登录
  114. onSubmit(){
  115. // 判断登录方式为手机号登录
  116. if(this.type==1000){
  117. // 判断验证手机号
  118. if(!this.phoneNumber){
  119. uni.showToast({
  120. title: '请输入手机号',
  121. icon: 'none',
  122. });
  123. return;
  124. }
  125. const phoneNumber= /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
  126. if(!phoneNumber.test(this.phoneNumber)){
  127. uni.showToast({
  128. title: '手机号输入不正确',
  129. icon: 'none',
  130. });
  131. return;
  132. }
  133. // 判断验证手机密码
  134. if(!this.phonePassword){
  135. uni.showToast({
  136. title: '请输入密码',
  137. icon: 'none',
  138. });
  139. return;
  140. }
  141. uni.showToast({
  142. title: '正在登录',
  143. icon: 'loading',
  144. });
  145. }else{
  146. // 判断验证账号
  147. if(!this.idNumber){
  148. uni.showToast({
  149. title: '请输入账号',
  150. icon: 'none',
  151. });
  152. return;
  153. }
  154. // 判断验证账号密码
  155. if(!this.idPassword){
  156. uni.showToast({
  157. title: '请输入账号密码',
  158. icon: 'none',
  159. });
  160. return;
  161. }
  162. uni.showToast({
  163. title: '正在登录',
  164. icon: 'loading',
  165. });
  166. }
  167. },
  168. }
  169. }
  170. </script>
  171. <style>
  172. @import"../../style/css/login.css";
  173. </style>

一个小tips:

先说一下这个页面↑↑↑↑↑↑↑↑↑↑↑↑↑↑

svg因为我这里账号、密码input输入框的border边框要设置成小数1px以下0.1px、0.2px、0.3px等等,所以这里用了svg的画图,如果有小伙伴碰到同样问题可以参考一下,不需要的直接style里直接设置border参数即可

uni.showToast是uni-app弹出框的方法直接用就行,参数么。。自己研究研究就行   (例:icon图标参数有四种类型none、loading、success、error)

style外部引用css样式直接用@import相对路径即可

login.css文件

style样式最好还是用自己写的就别直接复制了,我这里用的是平台自动生成的所以比较乱随便看看就行了看多了头疼(仅供参考全局样式可以直接略过)


  1. /************************************************************
  2. ** 全局样式 ** **
  3. ************************************************************/
  4. html {
  5. font-size: 16px;
  6. }
  7. body {
  8. margin: 0;
  9. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
  10. 'Droid Sans', 'Helvetica Neue', 'Microsoft Yahei', sans-serif;
  11. -webkit-font-smoothing: antialiased;
  12. -moz-osx-font-smoothing: grayscale;
  13. }
  14. view,
  15. image,
  16. text {
  17. box-sizing: border-box;
  18. flex-shrink: 0;
  19. }
  20. #app {
  21. width: 100vw;
  22. height: 100vh;
  23. }
  24. .flex-row {
  25. display: flex;
  26. flex-direction: row;
  27. }
  28. .flex-col {
  29. display: flex;
  30. flex-direction: column;
  31. }
  32. .justify-start {
  33. justify-content: flex-start;
  34. }
  35. .justify-end {
  36. justify-content: flex-end;
  37. }
  38. .justify-center {
  39. justify-content: center;
  40. }
  41. .justify-between {
  42. justify-content: space-between;
  43. }
  44. .justify-around {
  45. justify-content: space-around;
  46. }
  47. .justify-evenly {
  48. justify-content: space-evenly;
  49. }
  50. .items-start {
  51. align-items: flex-start;
  52. }
  53. .items-end {
  54. align-items: flex-end;
  55. }
  56. .items-center {
  57. align-items: center;
  58. }
  59. .items-baseline {
  60. align-items: baseline;
  61. }
  62. .items-stretch {
  63. align-items: stretch;
  64. }
  65. .self-start {
  66. align-self: flex-start;
  67. }
  68. .self-end {
  69. align-self: flex-end;
  70. }
  71. .self-center {
  72. align-self: center;
  73. }
  74. .self-baseline {
  75. align-self: baseline;
  76. }
  77. .self-stretch {
  78. align-self: stretch;
  79. }
  80. .flex-1 {
  81. flex: 1 1 0%;
  82. }
  83. .flex-auto {
  84. flex: 1 1 auto;
  85. }
  86. .grow {
  87. flex-grow: 1;
  88. }
  89. .grow-0 {
  90. flex-grow: 0;
  91. }
  92. .shrink {
  93. flex-shrink: 1;
  94. }
  95. .shrink-0 {
  96. flex-shrink: 0;
  97. }
  98. .relative {
  99. position: relative;
  100. }
  101. /* ---------------------------------------------------------------------- */
  102. .group {
  103. padding: 20px 40px 10px;
  104. overflow-y: auto;
  105. }
  106. .text_2 {
  107. color: #020202;
  108. font-size: 20px;
  109. font-family: 'PingFang SC';
  110. line-height: 28px;
  111. text-align: center;
  112. }
  113. .text-wrapper {
  114. margin-top: 42px;
  115. padding-bottom: 12px;
  116. /* border-bottom: solid 1px #888888; */
  117. }
  118. .font_1 {
  119. width: 100%;
  120. font-size: 15px;
  121. font-family: 'PingFang SC';
  122. line-height: 21px;
  123. color: #00000;
  124. }
  125. .text-wrapper_2 {
  126. padding: 20px 0 12px;
  127. /* border-bottom: solid 1px #888888; */
  128. }
  129. .text_3 {
  130. margin-top: 22px;
  131. color: #166bf8;
  132. }
  133. /* 登录按钮1 */
  134. .button button {
  135. margin-top: 324px;
  136. padding: 8px 0 11px;
  137. /* background-color: #166bf880; */
  138. background-image: url('。。。。。。。。。。。。。。。。。。。。');
  139. background-size: 100% 100%;
  140. background-repeat: no-repeat;
  141. border-radius: 5px;
  142. width: 100%;
  143. }
  144. .text_4 {
  145. color: #ffffff;
  146. }
  147. .group_2 {
  148. padding: 50px 62px;
  149. }
  150. .group_3 {
  151. padding: 50px 42%;
  152. }
  153. .font_2 {
  154. font-size: 12px;
  155. font-family: 'PingFang SC';
  156. line-height: 17px;
  157. color: #555555;
  158. }
  159. /* 登录按钮2*/
  160. .button2 button{
  161. width: 100%;
  162. margin-top: 324px;
  163. padding: 8px 0 11px;
  164. background-color: #166bf880;
  165. border-radius: 5px;
  166. line-height: 21px;
  167. font-size: 15px;
  168. }
  169. .text_66 {
  170. color: #ffffff;
  171. }

四、手机短信验证页面

点击登录页面上的短信验证码登录后跳转到此页,跳转方法会用到uni.navigateTo方法在登录页面看代码自行理解吧↑↑↑↑↑↑↑↑↑↑↑

跳转、返回的方法参考文档:

https://www.bookstack.cn/read/uniapp-api/spilt.5.ead34267bd06d88a.mdhttps://www.bookstack.cn/read/uniapp-api/spilt.5.ead34267bd06d88a.md

注意!!添加新页面的时候上面的↑↑↑↑↑↑↑↑↑↑↑pages.json配置文件也需要添加对应的页面配置才行不然页面出不来

效果图:

 phoneVerify.vue页面


  1. <!-- 手机验证找回密码 -->
  2. <template>
  3. <view class="flex-col flex-auto group">
  4. <text class="self-center text_2">手机号+短信验证码登录</text>
  5. <view class="flex-col group_2 space-y-10">
  6. <input type="number" class="self-start font_1" @input="onInput" placeholder="请输入手机号码" v-model="phoneNumber">
  7. <!-- svg画线 -->
  8. <view style="height: 1px;">
  9. <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  10. <line x1="0" y1="0" x2="400" y2="0" style="stroke:rgb(0,0,0);stroke-width:0.2" />
  11. </svg>
  12. </view>
  13. <view class="flex-row justify-between group_3">
  14. <input type="number" class="self-start font_1 text_4" maxlength="6" @input="onInput" placeholder="请输入验证码" v-model="code">
  15. <view class="flex-col justify-start items-center self-center text-wrapper">
  16. <!-- <text class="font_1 text_3" @click="onSetCode()">获取验证码</text> -->
  17. <text v-bind:class="{acquire:isGrey,again:!isGrey}"
  18. v-bind:disabled="dis" type="primary"
  19. @click="onSetCode">
  20. <span v-if="show">获取验证码</span>
  21. <span v-else>重新发送({{count}}s)</span>
  22. </text>
  23. </view>
  24. </view>
  25. <!-- svg画线 -->
  26. <view style="height: 1px;">
  27. <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  28. <line x1="0" y1="0" x2="400" y2="0" style="stroke:rgb(0,0,0);stroke-width:0.2" />
  29. </svg>
  30. </view>
  31. </view>
  32. <view class="self-start font_1 text_5" @click="onPageJump('/pages/login/login')">用密码登录</view>
  33. <view class="flex-col justify-start items-center button" v-if="btnShow">
  34. <button class="font_1 text_6" @click="onSubmit()">登 录</button>
  35. </view>
  36. <!-- 登录按钮2 -->
  37. <view class="flex-col justify-start items-center button2" v-else>
  38. <button class="font_1 text_66">登 录</button>
  39. </view>
  40. <text class="self-center text_7" @click="onPageJump('/pages/login/findBack')">找回密码</text>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. components: {
  46. },
  47. data() {
  48. return {
  49. phoneNumber:'', //手机号验证
  50. code:'', //验证码
  51. dis: false, //判断是否禁用状态
  52. show: true, //判断显示为发送还是重新发送
  53. isGrey: false, //class判断按钮样式
  54. timer: null, //设置计时器,
  55. count: "", //定义常量
  56. num:'', //判断是否为第一次点击
  57. btnShow:false, //判断登录按钮显示隐藏
  58. timeOut:null, //添加定时器
  59. };
  60. },
  61. // 方法
  62. methods: {
  63. // 找回密码跳转页面
  64. onPageJump(url) {
  65. uni.navigateTo({
  66. url: url
  67. });
  68. },
  69. // 发送验证码
  70. onSetCode() {
  71. let TIME_COUNT = 60;
  72. if (!this.timer) {
  73. uni.showToast({
  74. title: '已发送验证码',
  75. icon: 'success',
  76. });
  77. this.count = TIME_COUNT;
  78. this.isGrey = true;
  79. this.show = false;
  80. this.dis = true;
  81. this.timer = setInterval(() => {
  82. if (this.count > 0 && this.count <= TIME_COUNT) {
  83. this.count--;
  84. } else {
  85. this.dis = false;
  86. this.isGrey = false;
  87. this.show = true;
  88. clearInterval(this.timer);
  89. this.timer = null;
  90. }
  91. }, 1000);
  92. }
  93. },
  94. // 判断显示登录按钮
  95. onInput() {
  96. this.timeOut && clearTimeout(this.timeOut)
  97. this.timeOut = setTimeout(() => {
  98. if (this.phoneNumber && this.code) {
  99. this.btnShow = true;
  100. } else {
  101. this.btnShow = false;
  102. }
  103. }, 100);
  104. },
  105. //点击登录
  106. onSubmit(){
  107. // 判断验证手机号
  108. if(!this.phoneNumber){
  109. uni.showToast({
  110. title: '请输入手机号',
  111. icon: 'none',
  112. });
  113. return;
  114. }
  115. const phoneNumber= /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
  116. if(!phoneNumber.test(this.phoneNumber)){
  117. uni.showToast({
  118. title: '手机号输入不正确',
  119. icon: 'none',
  120. });
  121. return;
  122. }
  123. // 判断验证码
  124. if(!this.code){
  125. uni.showToast({
  126. title: '请输入验证码',
  127. icon: 'none',
  128. });
  129. return;
  130. }
  131. uni.showToast({
  132. title: '请稍后...',
  133. icon: 'loading',
  134. });
  135. },
  136. },
  137. };
  138. </script>
  139. <style>
  140. @import"../../style/css/phoneVerify.css";
  141. /* 验证码按钮样式 */
  142. .acquire{
  143. padding: 3px 0px;
  144. background-color: #eeeeee;
  145. border-radius: 5px;
  146. width: 92px;
  147. height: 29px;
  148. color: #666;
  149. font-size: 14px;
  150. line-height: 20px;
  151. text-align: center;
  152. }
  153. .again{
  154. padding: 3px 0px;
  155. background-color: #eeeeee;
  156. border-radius: 5px;
  157. width: 92px;
  158. height: 29px;
  159. color: #000000;
  160. font-size: 14px;
  161. line-height: 20px;
  162. text-align: center;
  163. }
  164. </style>

这个页面因为是静态的没有后端接口只是做的样式,所以验证码读秒这块内容刷新页面时会重置重新开始读秒这里注意一下就行,如果接后端接口实现的话原理也差不多自己慢慢理解就行

大概就长这样:

至于左上角这个返回键的小钮钮是uni-app创建项目时自带的 pages.json配置文件可以配置关闭 用("navigationStyle":"custom")这个参数就能关闭,单页面关闭在pages里配置,全部关闭在globalStyle里配置。

大概长这样:

也可以在Vue页面的方法里用uni.navigateBack方法自己写一个返回的方法。uni.navigateBack返回页面的方法具体怎么用↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓后面的页面会有用到

 phoneVerify.css文件


  1. /************************************************************
  2. ** 全局样式 **
  3. ************************************************************/
  4. html {
  5. font-size: 16px;
  6. }
  7. body {
  8. margin: 0;
  9. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
  10. 'Droid Sans', 'Helvetica Neue', 'Microsoft Yahei', sans-serif;
  11. -webkit-font-smoothing: antialiased;
  12. -moz-osx-font-smoothing: grayscale;
  13. }
  14. view,
  15. image,
  16. text {
  17. box-sizing: border-box;
  18. flex-shrink: 0;
  19. }
  20. #app {
  21. width: 100vw;
  22. height: 100vh;
  23. }
  24. .flex-row {
  25. display: flex;
  26. flex-direction: row;
  27. }
  28. .flex-col {
  29. display: flex;
  30. flex-direction: column;
  31. }
  32. .justify-start {
  33. justify-content: flex-start;
  34. }
  35. .justify-end {
  36. justify-content: flex-end;
  37. }
  38. .justify-center {
  39. justify-content: center;
  40. }
  41. .justify-between {
  42. justify-content: space-between;
  43. }
  44. .justify-around {
  45. justify-content: space-around;
  46. }
  47. .justify-evenly {
  48. justify-content: space-evenly;
  49. }
  50. .items-start {
  51. align-items: flex-start;
  52. }
  53. .items-end {
  54. align-items: flex-end;
  55. }
  56. .items-center {
  57. align-items: center;
  58. }
  59. .items-baseline {
  60. align-items: baseline;
  61. }
  62. .items-stretch {
  63. align-items: stretch;
  64. }
  65. .self-start {
  66. align-self: flex-start;
  67. }
  68. .self-end {
  69. align-self: flex-end;
  70. }
  71. .self-center {
  72. align-self: center;
  73. }
  74. .self-baseline {
  75. align-self: baseline;
  76. }
  77. .self-stretch {
  78. align-self: stretch;
  79. }
  80. .flex-1 {
  81. flex: 1 1 0%;
  82. }
  83. .flex-auto {
  84. flex: 1 1 auto;
  85. }
  86. .grow {
  87. flex-grow: 1;
  88. }
  89. .grow-0 {
  90. flex-grow: 0;
  91. }
  92. .shrink {
  93. flex-shrink: 1;
  94. }
  95. .shrink-0 {
  96. flex-shrink: 0;
  97. }
  98. .relative {
  99. position: relative;
  100. }
  101. /* ------------------------------------------------ */
  102. .group {
  103. padding: 30px 40px 60px;
  104. overflow-y: auto;
  105. }
  106. .text_2 {
  107. color: #020202;
  108. font-size: 20px;
  109. font-family: 'PingFang SC';
  110. line-height: 28px;
  111. }
  112. .group_2 {
  113. margin-top: 42px;
  114. /* border-bottom: solid 1px #888888; */
  115. }
  116. .space-y-10 > view:not(:first-child),
  117. .space-y-10 > text:not(:first-child),
  118. .space-y-10 > image:not(:first-child) {
  119. margin-top: 10px;
  120. }
  121. .font_1 {
  122. font-size: 15px;
  123. font-family: 'PingFang SC';
  124. line-height: 21px;
  125. color: #000000;
  126. }
  127. .group_3 {
  128. padding: 5px 0;
  129. /* border-top: solid 1px #888888; */
  130. }
  131. .text_4 {
  132. margin-top: 8px;
  133. }
  134. .text-wrapper {
  135. padding: 4px 0;
  136. background-color: #eeeeee;
  137. border-radius: 5px;
  138. width: 92px;
  139. height: 29px;
  140. }
  141. .text_3 {
  142. color: #000000;
  143. font-size: 14px;
  144. line-height: 20px;
  145. }
  146. .text_5 {
  147. margin-top: 22px;
  148. color: #166bf8;
  149. }
  150. .button button{
  151. margin-top: 324px;
  152. padding: 8px 0 11px;
  153. /* background-color: #166bf880; */
  154. background-image: url('。。。。。。。。。。。。。。。。。。。。。。');
  155. background-size: 100% 100%;
  156. background-repeat: no-repeat;
  157. border-radius: 5px;
  158. width: 100%;
  159. }
  160. .text_6 {
  161. color: #ffffff;
  162. }
  163. .text_7 {
  164. margin-top: 50px;
  165. color: #555555;
  166. font-size: 12px;
  167. font-family: 'PingFang SC';
  168. line-height: 17px;
  169. }
  170. /* 登录按钮2*/
  171. .button2 button{
  172. width: 100%;
  173. margin-top: 324px;
  174. padding: 8px 0 11px;
  175. background-color: #166bf880;
  176. border-radius: 5px;
  177. line-height: 21px;
  178. font-size: 15px;
  179. }
  180. .text_66 {
  181. color: #ffffff;
  182. }

五、找回密码页面

在登录页面点击找回密码后跳转到此页面

同样在pages.json文件里配置对应页面参数↑↑↑↑↑↑↑↑↑

效果图:

 点击通过手机号跳转到手机短信验证页面 也就是第四步的页面点击通过邮箱验证跳转到邮箱验证页面 也就是第六步的页面

findBack.vue页面


  1. <!-- 找回密码 -->
  2. <template>
  3. <view class="flex-col justify-start flex-auto group_3">
  4. <view class="flex-col section">
  5. <view class="flex-row justify-between items-center group_4" @click="onPageJump('/pages/login/phoneVerify')">
  6. <text class="font_1">通过已绑定手机号,用短信验证登录</text>
  7. <image
  8. class="image_5"
  9. src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/637d8bf95a7e3f031010c80e/63e351ec66570000128a304a/16758423632990405565.png"
  10. />
  11. </view>
  12. <view class="flex-row justify-between items-center group_4" @click="onPageJump('/pages/login/mailFindBack')">
  13. <text class="font_1">通过已绑定邮箱重设密码</text>
  14. <image
  15. class="image_5"
  16. src="。。。。。。。。。。。。。。。"
  17. />
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. components: {},
  25. data() {
  26. return {
  27. };
  28. },
  29. methods: {
  30. onPageJump(url) {
  31. uni.navigateTo({
  32. url:url
  33. })
  34. },
  35. },
  36. };
  37. </script>
  38. <style>
  39. @import"../../style/css/findBack.css";
  40. </style>

findBack.css文件


  1. /************************************************************
  2. ** 全局样式 **
  3. ************************************************************/
  4. html {
  5. font-size: 16px;
  6. }
  7. body {
  8. margin: 0;
  9. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
  10. 'Droid Sans', 'Helvetica Neue', 'Microsoft Yahei', sans-serif;
  11. -webkit-font-smoothing: antialiased;
  12. -moz-osx-font-smoothing: grayscale;
  13. }
  14. view,
  15. image,
  16. text {
  17. box-sizing: border-box;
  18. flex-shrink: 0;
  19. }
  20. #app {
  21. width: 100vw;
  22. height: 100vh;
  23. }
  24. .flex-row {
  25. display: flex;
  26. flex-direction: row;
  27. }
  28. .flex-col {
  29. display: flex;
  30. flex-direction: column;
  31. }
  32. .justify-start {
  33. justify-content: flex-start;
  34. }
  35. .justify-end {
  36. justify-content: flex-end;
  37. }
  38. .justify-center {
  39. justify-content: center;
  40. }
  41. .justify-between {
  42. justify-content: space-between;
  43. }
  44. .justify-around {
  45. justify-content: space-around;
  46. }
  47. .justify-evenly {
  48. justify-content: space-evenly;
  49. }
  50. .items-start {
  51. align-items: flex-start;
  52. }
  53. .items-end {
  54. align-items: flex-end;
  55. }
  56. .items-center {
  57. align-items: center;
  58. }
  59. .items-baseline {
  60. align-items: baseline;
  61. }
  62. .items-stretch {
  63. align-items: stretch;
  64. }
  65. .self-start {
  66. align-self: flex-start;
  67. }
  68. .self-end {
  69. align-self: flex-end;
  70. }
  71. .self-center {
  72. align-self: center;
  73. }
  74. .self-baseline {
  75. align-self: baseline;
  76. }
  77. .self-stretch {
  78. align-self: stretch;
  79. }
  80. .flex-1 {
  81. flex: 1 1 0%;
  82. }
  83. .flex-auto {
  84. flex: 1 1 auto;
  85. }
  86. .grow {
  87. flex-grow: 1;
  88. }
  89. .grow-0 {
  90. flex-grow: 0;
  91. }
  92. .shrink {
  93. flex-shrink: 1;
  94. }
  95. .shrink-0 {
  96. flex-shrink: 0;
  97. }
  98. .relative {
  99. position: relative;
  100. }
  101. .font_1 {
  102. font-size: 16px;
  103. font-family: 'PingFang SC';
  104. line-height: 22px;
  105. color: #020202;
  106. }
  107. .group_3 {
  108. padding: 10px 0 586px;
  109. overflow-y: auto;
  110. }
  111. .section {
  112. padding: 0px 16px;
  113. background-color: #ffffff;
  114. }
  115. .group_4 {
  116. padding: 18px 0;
  117. border-bottom: solid 1px #979797;
  118. }
  119. .image_5 {
  120. margin-right: 14px;
  121. width: 12px;
  122. height: 12px;
  123. }

六、邮箱找回密码页面

效果图:

 mailFandBack.vue页面


  1. <!-- 邮件找回密码 -->
  2. <template>
  3. <view class="flex-col flex-auto group">
  4. <text class="self-center text_2">通过邮箱找回密码</text>
  5. <input type="text" class="self-start font_1 text_3" @input="onInput" placeholder="请输入您绑定的邮箱地址" v-model="email">
  6. <!-- svg画线 -->
  7. <view style="height: 1px;">
  8. <svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  9. <line x1="0" y1="0" x2="400" y2="0" style="stroke:rgb(0,0,0);stroke-width:0.2" />
  10. </svg>
  11. </view>
  12. <view class="flex-col justify-start items-center button" v-if="btnShow">
  13. <text class="font_1 text_4" @click="onSubmit()">下一步</text>
  14. </view>
  15. <!-- 下一步按钮2 -->
  16. <view class="flex-col justify-start items-center button2" v-else>
  17. <button class="font_1 text_66">下一步</button>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. components: {
  24. },
  25. data() {
  26. return {
  27. email:'', //邮箱
  28. btnShow:false, //判断登录按钮显示隐藏
  29. timeOut:null, //添加定时器
  30. };
  31. },
  32. methods: {
  33. // 判断显示下一步按钮
  34. onInput() {
  35. this.timeOut && clearTimeout(this.timeOut)
  36. this.timeOut = setTimeout(() => {
  37. if (this.email) {
  38. this.btnShow = true;
  39. } else {
  40. this.btnShow = false;
  41. }
  42. }, 100);
  43. },
  44. // 点击下一步
  45. onSubmit(){
  46. if(!this.email){
  47. uni.showToast({
  48. title: '请输入邮箱',
  49. icon: 'none',
  50. });
  51. return;
  52. }
  53. const email= /^\w{3,}@\w{2,}\.(com|cn|net|com\.cn)$/;
  54. if(!email.test(this.email)){
  55. uni.showToast({
  56. title: '邮箱输入不正确',
  57. icon: 'none',
  58. });
  59. return;
  60. }
  61. uni.showToast({
  62. title: '请稍后...',
  63. icon: 'loading',
  64. });
  65. // 添加定时器延时跳转页面
  66. setTimeout(function(){
  67. uni.navigateTo({
  68. url: '/pages/login/emailFinish'
  69. });
  70. },2000)
  71. }
  72. },
  73. };
  74. </script>
  75. <style>
  76. @import"../../style/css/mailFindBack.css";
  77. </style>

mailFandBack.css文件


  1. /************************************************************
  2. ** 全局样式 **
  3. ************************************************************/
  4. html {
  5. font-size: 16px;
  6. }
  7. body {
  8. margin: 0;
  9. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
  10. 'Droid Sans', 'Helvetica Neue', 'Microsoft Yahei', sans-serif;
  11. -webkit-font-smoothing: antialiased;
  12. -moz-osx-font-smoothing: grayscale;
  13. }
  14. view,
  15. image,
  16. text {
  17. box-sizing: border-box;
  18. flex-shrink: 0;
  19. }
  20. #app {
  21. width: 100vw;
  22. height: 100vh;
  23. }
  24. .flex-row {
  25. display: flex;
  26. flex-direction: row;
  27. }
  28. .flex-col {
  29. display: flex;
  30. flex-direction: column;
  31. }
  32. .justify-start {
  33. justify-content: flex-start;
  34. }
  35. .justify-end {
  36. justify-content: flex-end;
  37. }
  38. .justify-center {
  39. justify-content: center;
  40. }
  41. .justify-between {
  42. justify-content: space-between;
  43. }
  44. .justify-around {
  45. justify-content: space-around;
  46. }
  47. .justify-evenly {
  48. justify-content: space-evenly;
  49. }
  50. .items-start {
  51. align-items: flex-start;
  52. }
  53. .items-end {
  54. align-items: flex-end;
  55. }
  56. .items-center {
  57. align-items: center;
  58. }
  59. .items-baseline {
  60. align-items: baseline;
  61. }
  62. .items-stretch {
  63. align-items: stretch;
  64. }
  65. .self-start {
  66. align-self: flex-start;
  67. }
  68. .self-end {
  69. align-self: flex-end;
  70. }
  71. .self-center {
  72. align-self: center;
  73. }
  74. .self-baseline {
  75. align-self: baseline;
  76. }
  77. .self-stretch {
  78. align-self: stretch;
  79. }
  80. .flex-1 {
  81. flex: 1 1 0%;
  82. }
  83. .flex-auto {
  84. flex: 1 1 auto;
  85. }
  86. .grow {
  87. flex-grow: 1;
  88. }
  89. .grow-0 {
  90. flex-grow: 0;
  91. }
  92. .shrink {
  93. flex-shrink: 1;
  94. }
  95. .shrink-0 {
  96. flex-shrink: 0;
  97. }
  98. .relative {
  99. position: relative;
  100. }
  101. /* ------------------------------------------------------------------------------ */
  102. .group {
  103. padding: 25px 40px 127px;
  104. overflow-y: auto;
  105. }
  106. .text_2 {
  107. color: #020202;
  108. font-size: 20px;
  109. font-family: 'PingFang SC';
  110. line-height: 28px;
  111. }
  112. .font_1 {
  113. font-size: 15px;
  114. font-family: 'PingFang SC';
  115. line-height: 21px;
  116. }
  117. .text_3 {
  118. margin-top: 42px;
  119. margin-bottom: 12px;
  120. color: #999999;
  121. }
  122. /* .section {
  123. margin-top: 12px;
  124. background-color: #888888;
  125. height: 1px;
  126. } */
  127. .button {
  128. margin-top: 324px;
  129. padding: 8px 0 11px;
  130. /* background-color: #166bf880; */
  131. background-image: url('。。。。。。。。。。。。');
  132. background-size: 100% 100%;
  133. background-repeat: no-repeat;
  134. border-radius: 5px;
  135. }
  136. .text_4 {
  137. color: #ffffff;
  138. }
  139. /* 下一步按钮2*/
  140. .button2 button{
  141. width: 100%;
  142. margin-top: 324px;
  143. padding: 8px 0 11px;
  144. background-color: #166bf880;
  145. border-radius: 5px;
  146. line-height: 21px;
  147. font-size: 15px;
  148. }
  149. .text_66 {
  150. color: #ffffff;
  151. }

七、邮箱发送验证成功页面

效果图:

 emailFinish.vue页面


  1. <template>
  2. <view class="flex-col flex-auto group">
  3. <view class="flex-col group_2">
  4. <image
  5. class="self-center image_5"
  6. src="。。。。。。。。。。。。。。"
  7. />
  8. <text class="self-center text_2">请访问邮件中给出的网页链接地址,根据页面提示完成密码重设。</text>
  9. <view class="flex-col justify-start items-center button">
  10. <button class="text_3" @click="Back">确定</button>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. components: {
  18. },
  19. data() {
  20. return {
  21. };
  22. },
  23. methods: {
  24. // 点击确定返回上一页
  25. Back(){
  26. // 返回到上一个页面
  27. uni.navigateBack({
  28. delta:1,//返回层数,2则上上页,默认delta:1
  29. })
  30. },
  31. },
  32. };
  33. </script>
  34. <style>
  35. @import"../../style/css/emailFinish.css";
  36. </style>

点击返回上一页面可以用uni.navigateBack方法

点击跳转到指定页面可以用uni.navigateTo方法(因为都属于跳转页面也可以用这个方法返回上一页自行理解吧)

大概长这样:

emailFinish.css文件


  1. /************************************************************
  2. ** 全局样式 **
  3. ************************************************************/
  4. html {
  5. font-size: 16px;
  6. }
  7. body {
  8. margin: 0;
  9. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
  10. 'Droid Sans', 'Helvetica Neue', 'Microsoft Yahei', sans-serif;
  11. -webkit-font-smoothing: antialiased;
  12. -moz-osx-font-smoothing: grayscale;
  13. }
  14. view,
  15. image,
  16. text {
  17. box-sizing: border-box;
  18. flex-shrink: 0;
  19. }
  20. #app {
  21. width: 100vw;
  22. height: 100vh;
  23. }
  24. .flex-row {
  25. display: flex;
  26. flex-direction: row;
  27. }
  28. .flex-col {
  29. display: flex;
  30. flex-direction: column;
  31. }
  32. .justify-start {
  33. justify-content: flex-start;
  34. }
  35. .justify-end {
  36. justify-content: flex-end;
  37. }
  38. .justify-center {
  39. justify-content: center;
  40. }
  41. .justify-between {
  42. justify-content: space-between;
  43. }
  44. .justify-around {
  45. justify-content: space-around;
  46. }
  47. .justify-evenly {
  48. justify-content: space-evenly;
  49. }
  50. .items-start {
  51. align-items: flex-start;
  52. }
  53. .items-end {
  54. align-items: flex-end;
  55. }
  56. .items-center {
  57. align-items: center;
  58. }
  59. .items-baseline {
  60. align-items: baseline;
  61. }
  62. .items-stretch {
  63. align-items: stretch;
  64. }
  65. .self-start {
  66. align-self: flex-start;
  67. }
  68. .self-end {
  69. align-self: flex-end;
  70. }
  71. .self-center {
  72. align-self: center;
  73. }
  74. .self-baseline {
  75. align-self: baseline;
  76. }
  77. .self-stretch {
  78. align-self: stretch;
  79. }
  80. .flex-1 {
  81. flex: 1 1 0%;
  82. }
  83. .flex-auto {
  84. flex: 1 1 auto;
  85. }
  86. .grow {
  87. flex-grow: 1;
  88. }
  89. .grow-0 {
  90. flex-grow: 0;
  91. }
  92. .shrink {
  93. flex-shrink: 1;
  94. }
  95. .shrink-0 {
  96. flex-shrink: 0;
  97. }
  98. .relative {
  99. position: relative;
  100. }
  101. /* ------------------------------------------------------------------------------ */
  102. .group {
  103. padding: 25px 40px 127px;
  104. overflow-y: auto;
  105. }
  106. .text_2 {
  107. color: #020202;
  108. font-size: 20px;
  109. font-family: 'PingFang SC';
  110. line-height: 28px;
  111. }
  112. .font_1 {
  113. font-size: 15px;
  114. font-family: 'PingFang SC';
  115. line-height: 21px;
  116. }
  117. .text_3 {
  118. margin-top: 42px;
  119. margin-bottom: 12px;
  120. color: #999999;
  121. }
  122. /* .section {
  123. margin-top: 12px;
  124. background-color: #888888;
  125. height: 1px;
  126. } */
  127. .button {
  128. margin-top: 324px;
  129. padding: 8px 0 11px;
  130. /* background-color: #166bf880; */
  131. background-image: url('。。。。。。。。。。。。。。。');
  132. background-size: 100% 100%;
  133. background-repeat: no-repeat;
  134. border-radius: 5px;
  135. }
  136. .text_4 {
  137. color: #ffffff;
  138. }
  139. /* 下一步按钮2*/
  140. .button2 button{
  141. width: 100%;
  142. margin-top: 324px;
  143. padding: 8px 0 11px;
  144. background-color: #166bf880;
  145. border-radius: 5px;
  146. line-height: 21px;
  147. font-size: 15px;
  148. }
  149. .text_66 {
  150. color: #ffffff;
  151. }

本章也是自己参考相关资料和各位大佬的文章自行整理仅供参考,希望可以帮助到和我一样菜鸡的小伙伴

参考资料:

https://blog.csdn.net/weixin_40614372/article/details/101537653

uni-app官网:

https://uniapp.dcloud.net.cn/component/

登录页面完成后我用的是Strophe.js对接Openfire的接口,然后把Strophe.js的用法加到↑本文的登录页里使用

蓝蓝设计建立了UI设计分享群,每天会分享国内外的一些优秀设计,如果有兴趣的话,可以进入一起成长学习,请加微信ban_lanlan,报下信息,蓝小助会请您入群。欢迎您加入噢~~
希望得到建议咨询、商务合作,也请与我们联系01063334945。 

分享此文一切功德,皆悉回向给文章原作者及众读者. 免责声明:蓝蓝设计尊重原作者,文章的版权归原作者。如涉及版权问题,请及时与我们取得联系,我们立即更正或删除。 

蓝蓝设计www.lanlanwork.com )是一家专注而深入的界面设计公司,为期望卓越的国内外企业提供卓越的UI界面设计、BS界面设计 、 cs界面设计 、 ipad界面设计 、 包装设计 、 图标定制 、 用户体验 、交互设计、 网站建设 平面设计服务UI设计公司、界面设计公司、UI设计服务公司、数据可视化设计公司、UI交互设计公司、高端网站设计公司、UI咨询、用户体验公司、软件界面设计公司

日历

链接

个人资料

蓝蓝设计的小编 http://www.lanlanwork.com

存档