当前位置:   article > 正文

微信小程序个人中心页面 案例

微信小程序个人中心页面

微信小程序 开发,经常会遇到个人中心页面 的需求,为了方便大家使用,决定将个人总想页面进行开源,以供大家参考交流。

一、效果预览

     

 二、源代码

abouthe.json文件

  1. {
  2. "usingComponents": {},
  3. "navigationBarBackgroundColor": "#F2F2F2",
  4. "backgroundTextStyle": "light",
  5. "disableScroll":true,
  6. "navigationStyle": "custom"
  7. }

abouthe.wxml文件

  1. <!-- 用户列表选项 -->
  2. <scroll-view class='scbg' scroll-y='true'>
  3. <view class="parent_catainer">
  4. <!-- 头部 -->
  5. <!-- style="background-image: url('/images/persons/mind_head_bg.jpg');" -->
  6. <view class="container_head">
  7. <image class="head_img" src="/images/mind_head_bg.jpg"></image>
  8. <view class="head_pers_info" bindtap="head_pers_info">
  9. <view class="head_pic">
  10. <image class="head_pic_content" mode="aspectFit" src="/images/lemon.png"></image>
  11. </view>
  12. <view class="inf_content">
  13. <text class="user_info">李大锤</text>
  14. <text class="family_info_ct_phone">联系电话:17365963369</text>
  15. <text class="family_info_ct">关联账号:王老师 </text>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="userItemListView">
  20. <view class="my_priview_md" bindtap="myappointpage">
  21. <image class="my_priview" src="/images/mine_fiend.png"></image>
  22. <text>我的预约</text>
  23. <view class="arrow"></view>
  24. </view>
  25. <view class="my_priview_md" bindtap="openmyorder">
  26. <image class="my_priview" src="/images/mine_fiend.png"></image>
  27. <text>我的订单</text>
  28. <view class="arrow"></view>
  29. </view>
  30. <view class="my_priview_md" bindtap="myaid">
  31. <image class="my_priview" src="/images/mine_fiend.png"></image>
  32. <text>我的救助</text>
  33. <view class="arrow"></view>
  34. </view>
  35. <view class="my_priview_md" bindtap="myfriend">
  36. <image class="my_priview" src="/images/mine_fiend.png"></image>
  37. <text>我的亲友</text>
  38. <view class="arrow"></view>
  39. </view>
  40. <view class="my_priview_md" bindtap="mycollection">
  41. <image class="my_priview" src="/images/mine_fiend.png"></image>
  42. <text>我的收藏</text>
  43. <view class="arrow"></view>
  44. </view>
  45. </view>
  46. <view class="userItemListView">
  47. <view class="my_priview_md" bindtap="bind">
  48. <image class="my_priview" src="/images/mine_fiend.png"></image>
  49. <text>个人资料</text>
  50. <view class="arrow"></view>
  51. </view>
  52. <view class="my_priview_md" bindtap="updatepassword">
  53. <image class="my_priview" src="/images/mine_fiend.png"></image>
  54. <text>修改密码</text>
  55. <view class="arrow"></view>
  56. </view>
  57. <view class="my_priview_md" bindtap="aboutus" hidden="true">
  58. <image class="my_priview" src="/images/mine_fiend.png"></image>
  59. <text>关于我们</text>
  60. <view class="arrow"></view>
  61. </view>
  62. <view class="my_priview_md" bindtap="logout">
  63. <image class="my_priview" src="/images/mine_fiend.png"></image>
  64. <text>退出登录</text>
  65. <view class="arrow"></view>
  66. </view>
  67. </view>
  68. <view class="last_view"></view>
  69. </view>
  70. </scroll-view>

abouthe.wxss文件

  1. /* 用户列表选项样式 */
  2. page {
  3. width: 100%;
  4. height: 100%;
  5. background:#f0f0f0;
  6. }
  7. .parent_catainer{
  8. background:#f0f0f0;
  9. }
  10. /* 头部背景图片 */
  11. .container_head{
  12. height: 370rpx;
  13. width: 100%;
  14. display: flex;
  15. justify-content: flex-end;
  16. align-items: flex-end;
  17. }
  18. .head_img {
  19. position: absolute;
  20. width: 100%;
  21. height: 370rpx;
  22. }
  23. .head_pers_info{
  24. height: 200rpx;
  25. width: 100%;
  26. margin-bottom: 50rpx;
  27. justify-content: left;
  28. display: flex;
  29. align-items: center;
  30. flex-direction: row;
  31. position: absolute;
  32. }
  33. .head_pic{
  34. width: 120rpx;
  35. height: 120rpx;
  36. border-radius: 60rpx;
  37. background-color: #08cbb0;
  38. color: #ffffff;
  39. align-items: center;
  40. display: flex;
  41. justify-content: center;
  42. }
  43. .head_pic_content{
  44. position: absolute;
  45. width: 110rpx;
  46. height: 110rpx;
  47. border-radius: 55rpx;
  48. background-color: white;
  49. }
  50. .head_pic{
  51. margin-left: 5%;
  52. }
  53. .inf_content{
  54. display: flex;
  55. flex-direction: column;
  56. margin-left: 10rpx;
  57. align-items: flex-start;
  58. justify-content: center;
  59. color: #ffffff;
  60. padding-bottom: 5rpx;
  61. }
  62. .user_info{
  63. text-align: left;
  64. font-size: 32rpx;
  65. font-weight: bold;
  66. margin-bottom: 8rpx;
  67. }
  68. .family_info_ct_phone{
  69. text-align: center;
  70. justify-content: center;
  71. font-size: 28rpx;
  72. margin-bottom: 2rpx;
  73. }
  74. .family_info_ct{
  75. text-align: center;
  76. justify-content: center;
  77. font-size: 28rpx;
  78. margin-bottom: 2rpx;
  79. width: 500rpx;
  80. overflow: hidden;
  81. white-space: nowrap;
  82. text-align: left;
  83. text-overflow: ellipsis;
  84. }
  85. .userItemListView{
  86. background: #fff;
  87. padding: 0 0rpx;
  88. margin: 24rpx 0;
  89. }
  90. .userItemListView > view{
  91. height: 94rpx;
  92. line-height: 94rpx;
  93. padding-left: 50rpx;
  94. border-bottom: 1rpx solid #F1F1F1;
  95. position: relative;
  96. }
  97. /* 移除最后一个元素的下边框 */
  98. .userItemListView > view:last-child{
  99. border: none;
  100. }
  101. .my_priview_md{
  102. display: flex;
  103. align-items: center;
  104. }
  105. .my_priview{
  106. width: 50rpx;
  107. height: 50rpx;
  108. margin-right: 10rpx;
  109. }
  110. .arrow{
  111. width: 16rpx;
  112. height: 16rpx;
  113. border-top: 4rpx solid #999;
  114. border-right: 4rpx solid #999;
  115. /* 旋转45度 */
  116. transform: rotate(45deg);
  117. /* 调整位置 */
  118. position: absolute;
  119. right: 30rpx;
  120. top: 38rpx;
  121. }
  122. .userItemListView text{
  123. font-size: 30rpx;
  124. }
  125. .last_view{
  126. background:#f0f0f0;
  127. width: 100%;
  128. height:1200rpx;
  129. }

abouthe.ts文件

  1. // pages/personal/myinfo.ts
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. },
  8. /**
  9. * 生命周期函数--监听页面加载
  10. */
  11. onLoad() {
  12. var that = this;
  13. },
  14. /**
  15. * 生命周期函数--监听页面初次渲染完成
  16. */
  17. onReady() {
  18. },
  19. // 退出登录
  20. logout: function () {
  21. wx.showModal({
  22. content: '确定退出登录吗?',
  23. cancelColor: '#666666',//666666
  24. confirmColor: '#666666',
  25. success(res) {
  26. if (res.confirm) {
  27. wx.reLaunch({
  28. url: '/pages/login/login'
  29. })
  30. console.log('用户点击确定')
  31. } else if (res.cancel) {
  32. console.log('用户点击取消')
  33. }
  34. },
  35. fail: function (res) { },//接口调用失败的回调函数
  36. complete: function (res) { },//接口调用结束的回调函数(调用成功、失败都会执行
  37. })
  38. },
  39. /**
  40. * 生命周期函数--监听页面显示
  41. */
  42. onShow() {
  43. wx.hideHomeButton();
  44. wx.hideShareMenu();
  45. },
  46. /**
  47. * 生命周期函数--监听页面隐藏
  48. */
  49. onHide() {
  50. },
  51. /**
  52. * 生命周期函数--监听页面卸载
  53. */
  54. onUnload() {
  55. },
  56. /**
  57. * 页面相关事件处理函数--监听用户下拉动作
  58. */
  59. onPullDownRefresh() {
  60. },
  61. /**
  62. * 页面上拉触底事件的处理函数
  63. */
  64. onReachBottom() {
  65. },
  66. /**
  67. * 用户点击右上角分享
  68. */
  69. onShareAppMessage() {
  70. }
  71. })

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

闽ICP备14008679号