You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
215 lines
4.8 KiB
215 lines
4.8 KiB
var Api = require('../../utils/common.js'); |
|
var re = require('../../utils/request.js'); |
|
Page({ |
|
|
|
/** |
|
* 页面的初始数据 |
|
*/ |
|
data: { |
|
scrolls:[], |
|
navTab: ['我的加入','我的管理'], |
|
currentTab: 0, |
|
myjoinList:[ |
|
{img:'../../images/logo.jpg',name:'众行天下户外',activing:'21',allact:'30'} |
|
,{img:'../../images/logo.jpg',name:'众行天下户外',activing:'21',allact:'30'} |
|
,{img:'../../images/logo.jpg',name:'众行天下户外',activing:'21',allact:'30'} |
|
], |
|
create:true |
|
}, |
|
toSearch:function(){ |
|
wx.navigateTo({ |
|
url: '../index/search/search' |
|
}) |
|
}, |
|
currentTab: function (e) { |
|
var that = this; |
|
if (that.data.currentTab == e.currentTarget.dataset.idx){ |
|
return; |
|
} |
|
|
|
that.setData({ |
|
currentTab: e.currentTarget.dataset.idx, |
|
}) |
|
console.log(e.currentTarget.dataset.idx) |
|
if(e.currentTarget.dataset.idx=='1'){ |
|
that.setData({ |
|
create:false |
|
}) |
|
that.getMyManageClubList(); |
|
}else{ |
|
that.setData({ |
|
create:true |
|
}); |
|
that.getMyJoinClubList(); |
|
} |
|
}, |
|
toaddmark:function(){ |
|
// wx.navigateTo({ |
|
// url: './mark/mark' |
|
// }) |
|
}, |
|
creatClub:function(){ |
|
// 判断是否可以创建俱乐部 |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData={ |
|
}; |
|
re.request(Api.checkUserClubRole(), postData, header).then((res) => { |
|
let msg = res.data.msg; |
|
if(msg != 'OK'){ |
|
wx.showToast({ |
|
title: msg, |
|
icon: 'none', |
|
duration: 3000 |
|
}) |
|
}else{ |
|
wx.navigateTo({ |
|
url: './createClub/createClub' |
|
}) |
|
} |
|
}) |
|
|
|
}, |
|
clubdetail:function(e){ |
|
var id = e.currentTarget.id; |
|
// console.log(e); |
|
if(+e.currentTarget.dataset['status'] != 1){ |
|
wx.showToast({ |
|
title: '该俱乐部审核未通过', |
|
icon: 'none' |
|
}); |
|
return; |
|
} |
|
wx.navigateTo({ |
|
url: './clubDetail/clubDetail?id='+id |
|
}) |
|
}, |
|
toclub:function(){ |
|
wx.navigateTo({ |
|
url: './clublist/clublist?id=' |
|
}) |
|
}, |
|
/** |
|
* 生命周期函数--监听页面加载 |
|
*/ |
|
onLoad: function (options) { |
|
|
|
}, |
|
getClubList:function(){ |
|
var that = this; |
|
const imgUrl = wx.getStorageSync('imgUrl') |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
var postData={ |
|
pageSize:3, |
|
pageNum:1 |
|
}; |
|
re.request(Api.getclubList(), postData, header).then((res) => { |
|
let datas = res.data.data; |
|
let lists=[]; |
|
for(let key in datas){ |
|
if(datas[key].length){ |
|
for(var i=0;i<datas[key].length;i++){ |
|
datas[key][i].clubLogo = imgUrl + datas[key][i].clubLogo; |
|
} |
|
} |
|
lists.push({name:key,val:datas[key]}) |
|
} |
|
that.setData({ |
|
scrolls:lists |
|
}) |
|
}) |
|
}, |
|
getMyJoinClubList:function(){ |
|
var that = this; |
|
const imgUrl = wx.getStorageSync('imgUrl') |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
re.request(Api.getMyJoinClubList(), '', header).then((res) => { |
|
let datas = res.data.data; |
|
console.log(datas) |
|
for(var i=0;i<datas.length;i++){ |
|
datas[i].clubLogo = datas[i].clubLogo; |
|
} |
|
that.setData({ |
|
myjoinList:datas |
|
}) |
|
}) |
|
}, |
|
getMyManageClubList:function(){ |
|
var that = this; |
|
const imgUrl = wx.getStorageSync('imgUrl') |
|
var header = { |
|
token:wx.getStorageSync('token'), |
|
"Content-Type": "application/x-www-form-urlencoded" |
|
}; |
|
re.request(Api.getMyManageClubList(), '', header).then((res) => { |
|
let datas = res.data.data; |
|
// for(var i=0;i<datas.length;i++){ |
|
// datas[i].clubLogo = imgUrl + datas[i].clubLogo; |
|
// } |
|
that.setData({ |
|
myjoinList:datas |
|
}) |
|
}) |
|
}, |
|
/** |
|
* 生命周期函数--监听页面初次渲染完成 |
|
*/ |
|
onReady: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面显示 |
|
*/ |
|
onShow: function () { |
|
this.getClubList(); |
|
if(this.data.currentTab==0&&this.data.create==true){ |
|
this.getMyJoinClubList(); |
|
}else if(this.data.currentTab==1&&this.data.create==false) { |
|
this.getMyManageClubList() |
|
} |
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面隐藏 |
|
*/ |
|
onHide: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 生命周期函数--监听页面卸载 |
|
*/ |
|
onUnload: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
*/ |
|
onPullDownRefresh: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 页面上拉触底事件的处理函数 |
|
*/ |
|
onReachBottom: function () { |
|
|
|
}, |
|
|
|
/** |
|
* 用户点击右上角分享 |
|
*/ |
|
onShareAppMessage: function () { |
|
|
|
} |
|
}) |