
<view class="container">
<view class="userinfo">
<image wx:if="{{userInfo && userInfo.avatarUrl}}" class="userinfo-avatar" src="{{ userInfo.avatarUrl }}" background-size="cover"></image>
<text class="userinfo-nickname">{{ userInfo.nickName }}</text>
</view>
<view style="height:20rpx;background: #eee;width:100%;"></view>
<view class="my-item" style='background:none;display:flex;flex-direction:column;height:auto;'>
<view>
余额 {{balance}} 元, 冻结 {{freeze}} 元
</view>
<view style='display:flex;padding-bottom:20rpx;'>
<button type='primary' style='width:100%;margin-right:70rpx;' bindtap="recharge">充值</button>
<button type='warn' style='width:100%;margin-right:70rpx;' bindtap="withdraw">提现</button>
</view>
</view>
<view class="my-item" style='background:none;display:flex;'>
<view>当前积分 {{score}} </view>
<button wx:if="{{score_sign_continuous == 0}}" style='height:80rpx;margin-right:70rpx;' bindtap="scoresign">每日签到</button>
<button wx:if="{{score_sign_continuous > 0}}" disabled='true' style='height:80rpx;margin-right:70rpx;'>已连续{{score_sign_continuous}}天签到</button>
</view>
<view class="my-item">
<navigator url="/pages/order-list/index" hover-class="navigator-hover">我的订单</navigator>
</view>
<view class="my-item">
<navigator url="/pages/select-address/index" hover-class="navigator-hover">我的收货地址</navigator>
</view>
<view class="my-item">
<navigator url="/pages/mycoupons/index" hover-class="navigator-hover">我的优惠券</navigator>
</view>
<view wx:if="{{!userMobile}}" class="my-item" style="border:none;padding-right:150rpx;width:auto;">
<button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">绑定手机号码</button>
</view>
<view wx:if="{{userMobile}}" class="my-item" style="border:none;padding-right:150rpx;width:auto;">
{{userMobile}}
</view>
<view style="height:20rpx;background: #eee;width:100%;"></view>
<view class="about" bindtap="aboutUs">
关于我们
</view>
<view style="height:20rpx;background: #eee;width:100%;"></view>
<view class="my-item" style="border:none;padding:0rpx;margin:0rpx;background:none;border:none;height:auto;line-height:auto;">
<button type="warn" bindtap="relogin">重新登录</button>
</view>
<view style="height:20rpx;background: #eee;width:100%;"></view>
<view class="version">Powered by EastWorld v {{version}}</view>
<view style="height:20rpx;background: #eee;width:100%;"></view>
</view>
|
.container{
min-height: 100%;
overflow: hidden;
overflow-y: hidden;
}
.userinfo {
display: flex;
flex-direction: column;
padding: 50rpx 0;
align-items: center;
background: #e85654;
width: 750rpx;
}
.userinfo-avatar {
width: 160rpx;
height: 160rpx;
margin: 20rpx;
border-radius: 50%;
}
.userinfo-nickname {
margin-top: 20rpx;
color: #FFF;
}
.version {
width:100%;
height: 40rpx;
line-height: 40rpx;
font-size: 24rpx;
text-align: center;
padding: 40rpx;
}
.my-item{
width: 100%;
background: url(https://cdn.it120.cc/images/weappshop/arrow-right.png) no-repeat 750rpx center;
background-size: 16rpx auto,750rpx auto;
margin: 20rpx 0;
border-bottom: 1px solid #eee;
height: 100rpx;
line-height: 100rpx;
padding-left: 100rpx;
}
.about{
width: 100%;
background: url(https://cdn.it120.cc/images/weappshop/arrow-right.png) no-repeat 750rpx center;
background-size: 16rpx auto,750rpx auto;
margin: 20rpx 0;
height: 80rpx;
line-height: 80rpx;
padding-left: 100rpx;
}
|
const app = getApp()
Page({
data: {
balance:0,
freeze:0,
score:0,
score_sign_continuous:0
},
onLoad() {
},
onShow() {
this.getUserInfo();
this.setData({
version: app.globalData.version
});
this.getUserApiInfo();
this.getUserAmount();
this.checkScoreSign();
},
getUserInfo: function (cb) {
var that = this
wx.login({
success: function () {
wx.getUserInfo({
success: function (res) {
that.setData({
userInfo: res.userInfo
});
}
})
}
})
},
aboutUs : function () {
wx.showModal({
title: '关于我们',
content: '本系统基于开源小程序商城系统 https://github.com/EastWorld/wechat-app-mall 搭建,祝大家使用愉快!',
showCancel:false
})
},
getPhoneNumber: function(e) {
if (!e.detail.errMsg || e.detail.errMsg != "getPhoneNumber:ok") {
wx.showModal({
title: '提示',
content: '无法获取手机号码',
showCancel: false
})
return;
}
var that = this;
wx.request({
url: 'https://api.it120.cc/' + app.globalData.subDomain + '/user/wxapp/bindMobile',
data: {
token: app.globalData.token,
encryptedData: e.detail.encryptedData,
iv: e.detail.iv
},
success: function (res) {
if (res.data.code == 0) {
wx.showToast({
title: '绑定成功',
icon: 'success',
duration: 2000
})
that.getUserApiInfo();
} else {
wx.showModal({
title: '提示',
content: '绑定失败',
showCancel: false
})
}
}
})
},
getUserApiInfo: function () {
var that = this;
wx.request({
url: 'https://api.it120.cc/' + app.globalData.subDomain + '/user/detail',
data: {
token: app.globalData.token
},
success: function (res) {
if (res.data.code == 0) {
that.setData({
apiUserInfoMap: res.data.data,
userMobile: res.data.data.base.mobile
});
}
}
})
},
getUserAmount: function () {
var that = this;
wx.request({
url: 'https://api.it120.cc/' + app.globalData.subDomain + '/user/amount',
data: {
token: app.globalData.token
},
success: function (res) {
if (res.data.code == 0) {
that.setData({
balance: res.data.data.balance,
freeze: res.data.data.freeze,
score: res.data.data.score
});
}
}
})
},
checkScoreSign: function () {
var that = this;
wx.request({
url: 'https://api.it120.cc/' + app.globalData.subDomain + '/score/today-signed',
data: {
token: app.globalData.token
},
success: function (res) {
if (res.data.code == 0) {
that.setData({
score_sign_continuous: res.data.data.continuous
});
}
}
})
},
scoresign: function () {
var that = this;
wx.request({
url: 'https://api.it120.cc/' + app.globalData.subDomain + '/score/sign',
data: {
token: app.globalData.token
},
success: function (res) {
if (res.data.code == 0) {
that.getUserAmount();
that.checkScoreSign();
} else {
wx.showModal({
title: '错误',
content: res.data.msg,
showCancel: false
})
}
}
})
},
relogin:function(){
var that = this;
app.globalData.token = null;
app.login();
wx.showModal({
title: '提示',
content: '重新登陆成功',
showCancel:false,
success: function (res) {
if (res.confirm) {
that.onShow();
}
}
})
},
recharge: function () {
wx.navigateTo({
url: "/pages/recharge/index"
})
},
withdraw: function () {
wx.navigateTo({
url: "/pages/withdraw/index"
})
}
})
|
模板简介:该模板名称为【微信小程序红色个人中心包含签到系统样式设计制作开发教程】,大小是,文档格式为.,推荐使用打开,作品中的图片,文字等数据均可修改,图片请在作品中选中图片替换即可,文字修改直接点击文字修改即可,您也可以新增或修改作品中的内容,该模板来自用户分享,如有侵权行为请联系网站客服处理。欢迎来懒人模板【小程序教程】栏目查找您需要的精美模板。