首页 > 小程序教程 > 微信小程序绿色风格个人信息修改保存样式模板制作设计下载

微信小程序绿色风格个人信息修改保存样式模板制作设计下载

上一篇 下一篇
制作好以后效果图如下:
一、wxml页面代码如下:
<view class="page centerPage-wrap" id="userCenterPage" data-router="userCenterPage">
  <view class="centerPage-user-info">
    <view class="js-change-cover" bindtap="choosePhoto">
      <image class="cover-thumb" src="{{ userInfo.cover_thumb }}"></image>
      <label class="ico-moon icon-rightarrow"></label>
    </view>
  </view>
  <view class="centerPage-user-info">
    <view class="centerPage-info-item">
      <label>昵称</label>
      <label class="ico-moon icon-rightarrow"></label>
      <input class="nickname" placeholder="请输入您的昵称" value="{{ userInfo.nickname }}" bindinput="inputNickname" />
    </view>
    <view class="centerPage-info-item">
      <label>性别</label>
      <label class="ico-moon icon-rightarrow"></label>
      <picker mode="selector" class="centerPage-sex" bindchange="changeGender" value="{{ userInfo.sex }}" range="{{ genderArr }}">
        <view class="picker">{{ genderArr[userInfo.sex] }}</view>
      </picker>
    </view>
    <view class="centerPage-info-item" bindtap="bindCellphonePage">
      <label>手机号</label>
      <label class="ico-moon icon-rightarrow"></label>
      <view class="userCenter-tel">{{ phone }}</view>
    </view>
  </view>
</view>
<view class="centerPage-save-btn" bindtap="saveUserInfo">保存</view>
 
二、wxss样式文件代码如下:
page {
  background-color: #eee;
}
.centerPage-wrap .cover-thumb {
  display: block;
  width: 80px;
  height: 80px;
  margin-left: auto;
  margin-right: auto;
  margin-top: 10px;
  margin-bottom: 10px;
  border-radius: 50%;
}
.centerPage-wrap .centerPage-user-info {
  padding-left: 3%;
  padding-right: 3%;
  border-top: 1px solid #d8d8d8;
  border-bottom: 1px solid #d8d8d8;
  margin-top: 15px;
  list-style: none;
  line-height: 40px;
  text-indent: 10px;
  background-color: #fff;
}
.centerPage-wrap.cur-bind-tel .centerPage-user-info {
  display: none;
}
.centerPage-wrap .centerPage-user-info view {
  position: relative;
  border-bottom: 1px solid #ededed;
}
.centerPage-wrap .centerPage-user-info view:last-child {
  border-bottom: none;
}

.centerPage-info-item {
  height: 117rpx;
  line-height: 117rpx;
}
.centerPage-wrap .nickname,
.centerPage-wrap .userCenter-tel,
.centerPage-wrap .centerPage-sex {
  float: right;
  border: none;
  width: 65%;
  line-height: 117rpx;
  height: 117rpx;
  margin-right: 25px;
  color: #888;
  font-size: 14px;
}
.centerPage-wrap .centerPage-sex {
  height: 50px;
}
.centerPage-wrap .icon-rightarrow {
  position: absolute;
  right: 4px;
  top: 50%;
  margin-top: -10px;
  width: 20px;
  height: 20px;
  line-height: 20px;
  font-size: 14px;
  color: #999;
}
.centerPage-wrap .shadow-content {
  width: 80%;
  left: 8%;
  top: 50%;
  margin-top: -150px;
  padding: 3% 2%;
  background-color: #fff;
  font-size: 14px;
}
.centerPage-wrap .shadow-content view {
  line-height: 40px;
  text-indent: 10px;
}
.centerPage-wrap .shadow-content .title {
  font-size: 18px;
  color: #41b80e;
  border-bottom: 2px solid #bcbcbc;
}
.centerPage-wrap .centerPage-sex-p:first-child {
  border-bottom: 1px solid #bcbcbc;
}
.centerPage-wrap .centerPage-sex-p label {
  display: none;
  float: right;
  color: #41b80e;
  margin-right: 10px;
}
.centerPage-wrap .selected label {
  display: block;
}
.centerPage-save-btn {
  margin: 70rpx 50rpx;
  height:90rpx;
  line-height:90rpx;
  background-color: #1AAD19;
  color: #fff;
  border-radius: 2px;
  text-align: center;
}
三、js页面代码如下:
var app = getApp()

Page({
  data: {
    userInfo: {
      nickname: '',
      sex: 0,
      cover_thumb: 'http://img.zhichiwangluo.com/zc_app_default_photo.png'
    },
    genderArr: ['男', '女'],
    isFromBack: false,
    phone: ''
  },
  onLoad: function(){
    var userInfo = app.getUserInfo(),
        phone = userInfo.phone,
        data = {
              'userInfo.nickname': userInfo.nickname,
              'userInfo.sex': userInfo.sex,
              'userInfo.cover_thumb': userInfo.cover_thumb
            };

    if(phone){
      data.phone = phone;
    }
    this.setData(data);
  },
  onShow: function(){
    if(this.data.isFromBack){
      var phone = app.getUserInfo().phone;
      if(phone){
        this.setData({
          phone: phone
        })
      }
    } else {
      this.setData({
        isFromBack: true
      });
    }
  },
  choosePhoto: function(){
    var that = this;
    app.chooseImage(function(imgUrl){
      that.setData({
        'userInfo.cover_thumb': imgUrl
      })
    });
  },
  changeGender: function(e){
    this.setData({
      'userInfo.sex': e.detail.value
    })
  },
  inputNickname: function(e){
    this.setData({
      'userInfo.nickname': e.detail.value
    })
  },
  saveUserInfo: function(){
    var data = this.data.userInfo;

    app.sendRequest({
      url: '/index.php?r=AppData/saveUserInfo',
      method: 'post',
      data: data,
      success: function(res){
        if(res.status === 0){
          app.setUserInfoStorage(data);
          app.turnBack();
        }
      }
    });
  },
  bindCellphonePage: function(){
    app.turnToPage('/pages/bindCellphone/bindCellphone');
  }

})





模板简介:该模板名称为【微信小程序绿色风格个人信息修改保存样式模板制作设计下载】,大小是,文档格式为.,推荐使用打开,作品中的图片,文字等数据均可修改,图片请在作品中选中图片替换即可,文字修改直接点击文字修改即可,您也可以新增或修改作品中的内容,该模板来自用户分享,如有侵权行为请联系网站客服处理。欢迎来懒人模板【小程序教程】栏目查找您需要的精美模板。

相关搜索
  • 下载密码 lanrenmb
  • 下载次数 22,792次
  • 使用软件
  • 文件格式
  • 文件大小
  • 上传时间 06-11
  • 作者 网友投稿
  • 肖像权 人物画像及字体仅供参考
栏目分类 更多 >
热门推荐 更多 >
单页式简历模板 html5 自适应 微信文章 企业网站 响应式 微信素材 微信图片 微信公众平台 微信模板
您可能会喜欢的其他模板