This commit is contained in:
2019-12-24 16:32:27 +08:00
parent 68a7aea72c
commit f9ef1a34bd
34 changed files with 136 additions and 55 deletions

View File

@@ -7,14 +7,20 @@ Page({
*/
data: {
openid:"",
username:"啦啦啦"
username:"",
img:"",
frozen_money:""
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
// request({
// url:"User/validateOpenid"
// }).then((res)=>{
// })
},
toorder() {
wx.navigateTo({
@@ -58,7 +64,11 @@ Page({
*/
login(){
if(this.data.openid == ""){
wx.navigateTo({
wx.navigateTo({ // request({
// url:"User/validateOpenid"
// }).then((res)=>{
// })
url:"/pages/login/login"
})
}
@@ -71,13 +81,22 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function() {
this.setData({
openid:wx.getStorageSync("openid")
})
// this.setData({
// openid:wx.getStorageSync("openid")
// })
request({
url:"User/validateOpenid"
}).then((res)=>{
// console.log(res)
console.log(res)
if(res.data.code != 400){
this.setData({
username:res.data.data.nick_name,
img:res.data.data.head_pic,
frozen_money:res.data.data.frozen_money
})
}
})
},

View File

@@ -1,12 +1,12 @@
<view class="box">
<view class="card">
<view class="user">
<image class="head"></image>
<text bind:tap="login">{{openid == ""?'点击登录':username}}</text>
<image class="head" src="{{img}}"></image>
<text bind:tap="login">{{username == ""?'点击登录':username}}</text>
</view>
<view class="balance">
<text>账户余额</text>
<text>480.00</text>
<text>{{frozen_money}}</text>
</view>
</view>
<view class="list">