接着做首页的充值,,调试接口
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { alertInfo } from "../../utils/index";
|
||||
|
||||
// pages/home/index.js
|
||||
Page({
|
||||
|
||||
@@ -5,15 +7,14 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
user: {}
|
||||
user: {},
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const user = wx.getStorageSync('user')
|
||||
this.setData({ user })
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -21,6 +22,23 @@ Page({
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
changeMoney(e) {
|
||||
const { money } = e.currentTarget.dataset;
|
||||
this.setData({
|
||||
money
|
||||
})
|
||||
},
|
||||
onChangeMoney(e) {
|
||||
console.log('e', e)
|
||||
this.setData({ money: Number(e.detail) })
|
||||
},
|
||||
recharge() {
|
||||
const { user, money } = this.data;
|
||||
if (!user || !user.id) {
|
||||
alertInfo("请先登录")
|
||||
return
|
||||
}
|
||||
},
|
||||
jumpToLogin() {
|
||||
wx.navigateTo({
|
||||
@@ -31,7 +49,8 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
const user = wx.getStorageSync('user')
|
||||
this.setData({ user })
|
||||
},
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user