当前位置:   article > 正文

hbuilder案例-仿微信界面_hbuilder编写小程序个人中心页面设计代码

hbuilder编写小程序个人中心页面设计代码

目录

运行效果图: 

index.html

sub1.html:

sub2.html:

sub3.html

sub4.html:

chat.html

fdHeader.html

fdBody.html


运行效果图: 

index.html

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  6. <title></title>
  7. <script src="js/mui.min.js"></script>
  8. <link href="css/mui.min.css" rel="stylesheet"/>
  9. <link rel="stylesheet" type="text/css" href="css/Main.css"/>
  10. <script type="text/javascript" charset="utf-8">
  11. mui.init();
  12. //mui加载完成事件
  13. mui.plusReady(function () {
  14. var subPages=["sub1.html","sub2.html","sub3.html","sub4.html"];
  15. var subPageStyle={
  16. top:"44px",
  17. bottom:"50px"
  18. };
  19. var mainView=plus .webview.currentWebview();
  20. for(var i=0;i<subPages .length;i++){
  21. var url=subPages[i ];
  22. var subView=plus.webview.create(url,url ,subPageStyle);
  23. subView.hide();
  24. mainView.append(subView);
  25. }
  26. plus.webview.show(subPages[0]);
  27. //注册轻击事件
  28. mui(".mui-bar-tab").on("tap","a",function(){
  29. var id=this.getAttribute("href");
  30. plus.webview.show(id)
  31. })
  32. })
  33. </script>
  34. </head>
  35. <body>
  36. <header class="mui-bar mui-bar-nav">
  37. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  38. <h1 class="mui-title">微信</h1>
  39. </header>
  40. <nav class="mui-bar mui-bar-tab">
  41. <a class="mui-tab-item mui-active" href="sub1.html">
  42. <span class="mui-icon mui-icon-chatbubble"></span>
  43. <span class="mui-tab-label">微信</span>
  44. </a>
  45. <a class="mui-tab-item" href="sub2.html">
  46. <span class="mui-icon mui-icon-contact"></span>
  47. <span class="mui-tab-label">通讯录</span>
  48. </a>
  49. <a class="mui-tab-item" href="sub3.html">
  50. <span class="mui-icon mui-icon-navigate"></span>
  51. <span class="mui-tab-label">发现</span>
  52. </a>
  53. <a class="mui-tab-item" href="sub4.html">
  54. <span class="mui-icon mui-icon-person"></span>
  55. <span class="mui-tab-label"></span>
  56. </a>
  57. </nav>
  58. </body>
  59. </html>

sub1.html:

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <link href="css/mui.css" rel="stylesheet" />
  8. </head>
  9. <body>
  10. <script src="js/mui.js"></script>
  11. <script type="text/javascript">
  12. mui.init()
  13. mui.plusReady(function() {
  14. mui(".mui-table-view-cell").on("tap", "a", function() {
  15. //获取好友名称
  16. var title=this.getAttribute("title");
  17. mui.openWindow({
  18. url:"chat.html",
  19. id: "chat.html",
  20. extras: {
  21. name:title //自定义扩展参数,可以用来处理页面间传值
  22. },
  23. show: {
  24. autoShow: true, //页面loaded事件发生后自动显示,默认为true
  25. aniShow: "slide-in-right", //页面显示动画,默认为”slide-in-right“;
  26. duration: 100 //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
  27. },
  28. waiting: {
  29. autoShow: true, //自动显示等待框,默认为true
  30. title: '正在加载...'//等待对话框上显示的提示内容
  31. }
  32. })
  33. })
  34. })
  35. </script>
  36. <div class="mui-content">
  37. <ul class="mui-table-view">
  38. <li class="mui-table-view-cell mui-media">
  39. <a href="javascript:;" title="幸福">
  40. <img class="mui-media-object mui-pull-left" src="images/shuijiao.jpg">
  41. <div class="mui-media-body">
  42. 幸福
  43. <p class="mui-ellipsis">能和心爱的人一起睡觉,是件幸福的事情;可是,打呼噜怎么办?</p>
  44. </div>
  45. </a>
  46. </li>
  47. <li class="mui-table-view-cell mui-media">
  48. <a href="javascript:;" title="木屋">
  49. <img class="mui-media-object mui-pull-left" src="images/muwu.jpg">
  50. <div class="mui-media-body">
  51. 木屋
  52. <p class="mui-ellipsis">想要这样一间小木屋,夏天挫冰吃瓜,冬天围炉取暖.</p>
  53. </div>
  54. </a>
  55. </li>
  56. <li class="mui-table-view-cell mui-media">
  57. <a href="javascript:;" title=CBD">
  58. <img class="mui-media-object mui-pull-left" src="images/yuantiao.jpg">
  59. <div class="mui-media-body">
  60. CBD
  61. <p class="mui-ellipsis">烤炉模式的城,到黄昏,如同打翻的调色盘一般.</p>
  62. </div>
  63. </a>
  64. </li>
  65. </ul>
  66. </div>
  67. </body>
  68. </html>

sub2.html:

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <link href="css/mui.css" rel="stylesheet" />
  8. </head>
  9. <body>
  10. <script src="js/mui.js"></script>
  11. <script type="text/javascript">
  12. mui.init()
  13. </script>
  14. <header class="mui-bar mui-bar-nav">
  15. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  16. <h1 class="mui-title">通讯录</h1>
  17. </header>
  18. </body>
  19. </html>

sub3.html

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <link href="css/mui.css" rel="stylesheet" />
  8. </head>
  9. <body>
  10. <script src="js/mui.js"></script>
  11. <script type="text/javascript">
  12. mui.init()
  13. mui.plusReady(function () {
  14. var friends=document.getElementById("friends");
  15. friends.addEventListener("tap",function(){
  16. mui.openWindow({
  17. url:"fdHeader.html",
  18. id: "fdHeader.html"
  19. })
  20. })
  21. })
  22. </script>
  23. <header class="mui-bar mui-bar-nav">
  24. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  25. <h1 class="mui-title">发现</h1>
  26. </header>
  27. <div class="mui-content">
  28. <ul class="mui-table-view">
  29. <li class="mui-table-view-cell mui-left" id="friends">
  30. <img src="images/朋友圈.jpg" width="30px" height="30px" align="absmiddle" />&nbsp;&nbsp;朋友圈
  31. </li>
  32. </ul>
  33. <br>
  34. <ul class="mui-table-view">
  35. <li class="mui-table-view-cell mui-left">
  36. <img src="images/朋友圈.jpg" width="30px" height="30px" align="absmiddle" />&nbsp;&nbsp;朋友圈
  37. </li>
  38. <li class="mui-table-view-cell mui-left">
  39. <img src="images/朋友圈.jpg" width="30px" height="30px" align="absmiddle" />&nbsp;&nbsp;朋友圈
  40. </li>
  41. </ul>
  42. <br>
  43. <ul class="mui-table-view">
  44. <li class="mui-table-view-cell mui-left">
  45. <img src="images/朋友圈.jpg" width="30px" height="30px" align="absmiddle" />&nbsp;&nbsp;朋友圈
  46. </li>
  47. <li class="mui-table-view-cell mui-left">
  48. <img src="images/朋友圈.jpg" width="30px" height="30px" align="absmiddle" />&nbsp;&nbsp;朋友圈
  49. </li>
  50. </ul>
  51. </div>
  52. </body>
  53. </html>

sub4.html:

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <link href="css/mui.css" rel="stylesheet" />
  8. <style type="text/css">
  9. .mui-table-view-cell {
  10. font-size: 18px;
  11. line-height: 20px;
  12. }
  13. </style>
  14. </head>
  15. <body>
  16. <script src="js/mui.js"></script>
  17. <script type="text/javascript">
  18. mui.init()
  19. </script>
  20. <header class="mui-bar mui-bar-nav">
  21. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  22. <h1 class="mui-title">个人中心</h1>
  23. </header>
  24. </body>
  25. </html>

chat.html

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <link href="css/mui.css" rel="stylesheet" />
  8. </head>
  9. <body>
  10. <script src="js/mui.js"></script>
  11. <script type="text/javascript">
  12. mui.init()
  13. </script>
  14. <header class="mui-bar mui-bar-nav">
  15. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  16. <h1 class="mui-title">聊天界面</h1>
  17. </header>
  18. </body>
  19. </html>

fdHeader.html

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <link href="css/mui.css" rel="stylesheet" />
  8. </head>
  9. <body>
  10. <script src="js/mui.js"></script>
  11. <script type="text/javascript">
  12. mui.init({
  13. subpages:[{
  14. url:"fdBody.html",
  15. id:"fdBody.html",
  16. styles:{
  17. top:'44px'
  18. }
  19. }]
  20. })
  21. </script>
  22. <header class="mui-bar mui-bar-nav">
  23. <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
  24. <h1 class="mui-title">朋友圈</h1>
  25. </header>
  26. </body>
  27. </html>

 

fdBody.html

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <link href="css/mui.css" rel="stylesheet" />
  8. </head>
  9. <body>
  10. <script src="js/mui.js"></script>
  11. <script type="text/javascript">
  12. mui.init()
  13. </script>
  14. <div class="mui-content">
  15. adasdfsaf
  16. </div>
  17. </body>
  18. </html>

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/279633
推荐阅读
相关标签
  

闽ICP备14008679号