微信小程序个人中心、我的界面(示例四)

微信小程序个人中心、我的界面,九宫格简单布局(示例四)

微信小程序个人中心、我的界面,超简洁的九宫格界面布局,代码粘贴即用。更多微信小程序界面示例,请进入我的主页哦!
个人中心示例界面

1、js代码

Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgPath: '',
    menuList: [
      [{
          'title': '功能一',
          'icon': 'success',
          'iconColor': '#dd6161'
        },
        {
          'title': '功能二',
          'icon': 'success_no_circle',
          'iconColor': 'orange'
        },
        {
          'title': '功能三',
          'icon': 'info',
          'iconColor': '#19be6b'
        }
      ],
      [{
          'title': '功能四',
          'icon': 'warn',
          'iconColor': '#f29100'
        },
        {
          'title': '功能五',
          'icon': 'waiting',
          'iconColor': '#909399'
        },
        {
          'title': '功能六',
          'icon': 'cancel',
          'iconColor': '#606266'
        }
      ],
      [{
          'title': '功能七',
          'icon': 'download',
          'iconColor': 'purple'
        },
        {
          'title': '功能八',
          'icon': 'search',
          'iconColor': '#18b566'
        },
        {
          'title': '功能九',
          'icon': 'clear',
          'iconColor': '#f29100'
        },
      ],
    ],
  },
  // 功能监听
  clickBtn(e) {
    let tag = e.currentTarget.dataset.id;
    console.log('点击信息', tag)
  },
  // 菜单监听
  menuClick(e) {
    let tab = e.currentTarget.dataset.item;
    console.log('点击信息', tab)
  },
  // 头像切换
  avatarClick(e) {
    this.setData({
      imgPath: e.detail.avatarUrl
    })
    console.log('点击信息',e.detail.avatarUrl)
  }
})

2、wxml代码

<view class="top-box">
  <block wx:if="{{imgPath==''}}">
    <button class="avatar center" bindchooseavatar="avatarClick" open-type="chooseAvatar">头像</button>
  </block>
  <block wx:else>
    <view class="center">
      <image class="avatar" src="{{imgPath}}" mode="widthFix" />
    </view>
  </block>
  <view class="nick center">三脚猫的喵</view>
</view>
<view class="center-box center">
  <text bind:tap="clickBtn" data-id="0">功能一</text>
  <text>|</text>
  <text bind:tap="clickBtn" data-id="1">功能二</text>
</view>
<!-- 菜单 -->
<view>
  <block wx:for="{{menuList}}" wx:key="itemA" wx:for-item="itemA" wx:for-index="indexA">
    <view class="row-list">
      <block wx:for="{{itemA}}" wx:key="item" wx:for-item="item" wx:for-index="index">
        <view class="tab-col {{(index==1 || index==4 || index==7)?'border':''}}" bind:tap="menuClick" data-item="{{item}}">
          <icon class="icon-item" type="{{item.icon}}" size="30" color="{{item.iconColor}}"></icon>
          <text>{{item.title}}</text>
        </view>
      </block>
    </view>
  </block>
</view>

3、wxss代码

page {
  font-size: 32rpx;
  background-color: #F1F1F1;
}

.avatar {
  width: 140rpx;
  height: 140rpx;
  border-radius: 120rpx;
  padding: 0;
  font-size: 32rpx;
}

.top-box {
  background-color: #44ADFB;
  padding-bottom: 60rpx;
  border-radius: 0 0 30% 30%;
}

.center {
  display: flex;
  align-items: center;
  flex-direction: row;
  justify-content: center;
}

.nick {
  margin: 20rpx 0;
  font-size: 34rpx;
  color: white;
}

.center-box {
  margin-top: -40rpx;
  color: #525151;
}

.center-box text {
  background-color: white;
  padding: 20rpx 25rpx;
  text-align: center;
}

.center-box text:nth-child(1) {
  border-radius: 50rpx 0 0 50rpx;
}

.center-box text:nth-child(2) {
  color: #44ADFB;
}

.center-box text:nth-child(3) {
  border-radius: 0 50rpx 50rpx 0;
}

.row-list {
  display: flex;
  flex-direction: row;
  text-align: center;
}

.tab-col {
  width: 33.33%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30rpx 0;
  border-bottom: 1rpx solid #FFFFFF;
  color: #525151;
}

.icon-item {
  margin-bottom: 15rpx;
}

.border {
  border-left: 1rpx solid #FFFFFF;
  border-right: 1rpx solid #FFFFFF;
}

4、json代码

{
  "usingComponents": {},
  "navigationBarTitleText": "我的界面",
  "navigationBarBackgroundColor": "#44ADFB"
}

更多微信小程序示例的分享,请进入我的主页查看哦。。。

  • 10
    点赞
  • 29
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
以下是一个简单的微信小程序个人界面代码示例: ```html <view class="container"> <view class="header"> <image class="avatar" src="{{userInfo.avatarUrl}}"></image> <view class="info"> <view class="name">{{userInfo.nickName}}</view> <view class="desc">微信号:{{userInfo.weixinID}}</view> </view> </view> <view class="menu"> <view class="item" bindtap="onTapItem"> <image class="icon" src="/images/icon1.png"></image> <view class="text">我的订单</view> </view> <view class="item" bindtap="onTapItem"> <image class="icon" src="/images/icon2.png"></image> <view class="text">我的收藏</view> </view> <view class="item" bindtap="onTapItem"> <image class="icon" src="/images/icon3.png"></image> <view class="text">我的消息</view> </view> </view> </view> ``` ```css .container { background-color: #f5f5f5; padding: 20rpx; } .header { display: flex; padding: 20rpx; background-color: #ffffff; border-radius: 10rpx; box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1); } .avatar { width: 80rpx; height: 80rpx; border-radius: 50%; } .info { display: flex; flex-direction: column; justify-content: center; margin-left: 20rpx; } .name { font-size: 32rpx; color: #333333; } .desc { font-size: 24rpx; color: #999999; } .menu { display: flex; flex-wrap: wrap; margin-top: 20rpx; background-color: #ffffff; border-radius: 10rpx; box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.1); } .item { display: flex; flex-direction: column; justify-content: center; align-items: center; width: calc(100% / 3); padding: 20rpx; } .icon { width: 60rpx; height: 60rpx; margin-bottom: 10rpx; } .text { font-size: 24rpx; color: #333333; } ``` 该代码中,使用了`<view>`标签作为容器,包含了头像、个人信息和功能菜单三部分。头像和个人信息部分使用了`<image>`和`<view>`标签,利用`display: flex`和`justify-content: center`等CSS属性进行布局。功能菜单部分使用了循环遍历的方式,使用了`<view>`、`<image>`和`<text>`标签进行布局。整体使用了较为简单的CSS样式进行美化。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

三脚猫的喵

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值