[更新]
This commit is contained in:
69
pages/userStored/userStored.js
Normal file
69
pages/userStored/userStored.js
Normal file
@@ -0,0 +1,69 @@
|
||||
// pages/userStored/userStored.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
isUser : false, //用户登录状态
|
||||
canShare : '', //分享按钮状态
|
||||
storedArr : [], //储值权益列表,
|
||||
parentId : '', //分享者id
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad (options) {
|
||||
// 判断是否由分享进入
|
||||
if(options.type == "share"){
|
||||
this.setData({
|
||||
parentId: options.parent_id
|
||||
})
|
||||
|
||||
// 写入缓存
|
||||
wx.setStorage({
|
||||
key : 'parentId',
|
||||
data : options.parent_id
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
onShow(){
|
||||
this.setData({
|
||||
isUser : getApp().globalData.isUser
|
||||
})
|
||||
|
||||
// 获取产品详情
|
||||
this.storedShow();
|
||||
},
|
||||
|
||||
/**
|
||||
* 产品详情
|
||||
*/
|
||||
storedShow(){
|
||||
wx.$api.user.storedList().then(res=>{
|
||||
this.setData({
|
||||
canShare : res.data.canShare,
|
||||
storedArr : res.data.list
|
||||
})
|
||||
}).catch(err=>{})
|
||||
},
|
||||
|
||||
/**
|
||||
* 处理未登录时的转跳
|
||||
*/
|
||||
userNav(e){
|
||||
let pageUrl = e.currentTarget.dataset.url
|
||||
if(this.data.isUser){
|
||||
wx.navigateTo({
|
||||
url: pageUrl
|
||||
})
|
||||
}else{
|
||||
// 去登录
|
||||
wx.navigateTo({
|
||||
url: "/pages/login/login?way=shareLogin"
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user