60 lines
1.9 KiB
JavaScript
60 lines
1.9 KiB
JavaScript
var t = getApp();
|
|
|
|
Page({
|
|
data: {
|
|
token: t.globalData.token,
|
|
communityList: [],
|
|
sourceUrl: t.baseUrls.sourceUrl
|
|
},
|
|
getMyCommunity: function() {
|
|
var e = this;
|
|
t.restAjax.get(t.restAjax.path(t.apis.mycommunity, [ t.baseUrls.requestUrl ]), {}, {
|
|
headers: {
|
|
token: t.globalData.token
|
|
}
|
|
}, function(t, o) {
|
|
e.setData({
|
|
communityList: o
|
|
});
|
|
}, function(t, e) {
|
|
console.log(e);
|
|
});
|
|
},
|
|
quitCommunity: function(e) {
|
|
var o = e.currentTarget.dataset.id, n = e.currentTarget.dataset.community, a = this;
|
|
wx.showModal({
|
|
cancelColor: "#000000",
|
|
title: "确认退出该社区?",
|
|
success: function(e) {
|
|
e.confirm && t.restAjax.delete(t.restAjax.path(t.apis.quitCommunity, [ t.baseUrls.requestUrl, o ]), {}, {
|
|
headers: {
|
|
token: t.globalData.token
|
|
}
|
|
}, function(t, e) {
|
|
var o = wx.getStorageSync("curCommunityId");
|
|
n == o && (wx.removeStorageSync("areaCode"), wx.removeStorageSync("curCommunityId"),
|
|
wx.removeStorageSync("curCommunityName"), wx.removeStorageSync("areaLevel")), wx.showToast({
|
|
title: "退出成功"
|
|
}), a.getMyCommunity();
|
|
}, function(t, e) {
|
|
console.log(e);
|
|
});
|
|
}
|
|
});
|
|
},
|
|
selectCommunity: function() {
|
|
wx.navigateTo({
|
|
url: "./join/select"
|
|
});
|
|
},
|
|
onLoad: function(t) {},
|
|
onReady: function() {},
|
|
onShow: function() {
|
|
this.getMyCommunity();
|
|
},
|
|
onHide: function() {},
|
|
onUnload: function() {},
|
|
onPullDownRefresh: function() {},
|
|
onReachBottom: function() {},
|
|
onShareAppMessage: function() {}
|
|
}); |