编辑我的页面跳转,完成积分和优惠券页面的创建(内容还没写多少)
This commit is contained in:
84
pages/integral/index.js
Normal file
84
pages/integral/index.js
Normal file
@@ -0,0 +1,84 @@
|
||||
// pages/integral/index.js
|
||||
import request from "../../utils/request"
|
||||
import { getCurrentIntegral } from "../../service/system";
|
||||
const { OK } = request;
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
integral: 0,
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
this.getIntegral();
|
||||
},
|
||||
jumpToRecord() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/integralRecord/index',
|
||||
})
|
||||
},
|
||||
async getIntegral() {
|
||||
const { code, message, data } = await getCurrentIntegral();
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
integral: data?.balance || 0
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
7
pages/integral/index.json
Normal file
7
pages/integral/index.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"navigator": "/components/navigator/index",
|
||||
"discount-coupon": "/components/discountCoupon/index"
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
11
pages/integral/index.wxml
Normal file
11
pages/integral/index.wxml
Normal file
@@ -0,0 +1,11 @@
|
||||
<!--pages/integral/index.wxml-->
|
||||
<navigator title="积分兑换" canBack="{{true}}" />
|
||||
<view class="integralWrapper">
|
||||
<view class="currentIntegral">
|
||||
<view class="number"> 当前积分: {{ integral }} </view>
|
||||
<view class="primaryTextBtn" bind:tap="jumpToRecord"> 查看积分明细 </view>
|
||||
</view>
|
||||
<view class="ticketList">
|
||||
<discount-coupon />
|
||||
</view>
|
||||
</view>
|
19
pages/integral/index.wxss
Normal file
19
pages/integral/index.wxss
Normal file
@@ -0,0 +1,19 @@
|
||||
/* pages/integral/index.wxss */
|
||||
|
||||
page {
|
||||
background-color: rgb(242,243,245);
|
||||
}
|
||||
|
||||
.integralWrapper {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.currentIntegral {
|
||||
font-size: 34rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.ticketList {
|
||||
margin-top: 20rpx;
|
||||
}
|
Reference in New Issue
Block a user