微信小程序宠物论坛6

微信小程序宠物论坛6

个人主页页面

在这里插入图片描述
JS部分

const db = wx.cloud.database()

Page({
  data:{
    openid:"",
    nickname:"",
    heads:""
  },

onLoad:function(options){
  
  const openid=options.id
  this.setData({
    openid:openid
  })
  console.log(this.data.openid)
  
  db.collection('user').where({
    _openid:openid
    }).get({
    success: res=> {
    this.setData({
      nickname:res.data[0].nickname,
      heads:res.data[0].heads,
      openid:res.data[0]._openid
    })
    // console.log(this.data.nickname)
    // console.log(this.data.heads)
    // const openid=this.data.openid
    // console.log(openid)
    },
    fail:res=>{
    
    }
  })


}

})

WXML部分

<view>
  <view class="userinfo">
      <image  class="userinfo-avatar" src="{{heads}}" background-size="cover"></image>
      <text class="userinfo-nickname">{{nickname}}</text>
  </view>
  <view class="hr"></view>



<!-- 管理员审核部分 -->
  <view wx:if="{{openid=='ovGIO5CsyuDL3aq275lxfqdwmqFw'}}">

     <navigator url="../reviewpost/reviewpost" open-type="navigate">
  <view class="line"></view>
  <view class="item">
    <view class="title">审核帖子</view>
    <view class="detail2">
      <text> ></text>
    </view>
  </view>
     </navigator>
  <view class="line"></view>

  <navigator url="../reviewcomment/reviewcomment" open-type="navigate">
  <view class="line"></view>
  <view class="item">
    <view class="title">审核评论</view>
    <view class="detail2">
      <text> ></text>
    </view>
  </view>
 </navigator>
 <view class="line"></view>
  
  </view>

<navigator url="../mypost/mypost?id={{openid}}" open-type="navigate">
    <view class='item'>
    <view class="title">我的帖子</view>
    <view class="detail2">
      <text> ></text>
    </view>
    </view>
</navigator>

   <navigator url="../mycollect/mycollect?id={{openid}}" open-type="navigate">
  <view class="line"></view>
  <view class="item">
    <view class="title">我的收藏</view>
    <view class="detail2">
      <text> ></text>
    </view>
  </view>
 </navigator>

  <view class="line"></view>

  <navigator url="../aboutus/aboutus" open-type="navigate">
  <view class="item">
    <view class="title">关于我们</view>
    <view class="detail2">
      <text> ></text>
    </view>
  </view>
  </navigator>

 <view class="line"></view>
</view>

WXSS部分

/* pages/mine/mine.wxss */
.userinfo {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #eb6161;
  width: 100%;
  height: 300rpx;
}

.userinfo-avatar {
  width: 128rpx;
  height: 128rpx;
  margin: 20rpx;
  border-radius: 50%;
}

.userinfo-nickname {
  color: black;
}

.header {
  margin: 90rpx 0 90rpx 50rpx;
  border-bottom: 1px solid #ccc;
  text-align: center;
  width: 650rpx;
  height: 300rpx;
  line-height: 450rpx;
}

.header image {
  width: 200rpx;
  height: 200rpx;
}

.content {
  margin-left: 50rpx;
  margin-bottom: 90rpx;
}

.content text {
  display: block;
  color: #9d9d9d;
  margin-top: 40rpx;
}

.bottom {
  border-radius: 80rpx;
  margin: 70rpx 50rpx;
  font-size: 35rpx;
}

/* 用户中心 */

.hr {
  width: 100%;
  height: 15px;
  background-color: #f4f5f6;
}
.item {
  display: flex;
  flex-direction: row;
}
.title {
  padding-top: 15px;
  padding-bottom: 15px;
  padding-left: 15px;
  font-size: 15px;
}

.detail2 {
  font-size: 15px;
  position: absolute;
  right: 10px;
  height: 50px;
  line-height: 50px;
  color: #888;
}

.line {
  border: 1px solid #ccc;
  opacity: 0.2;
}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值