123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- const app = getApp();
- var utils = require("../../../utils/http");
- let activitypage = 1;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- activitylist: [],
- imgUrl: app.globalData.imgUrl,
- type: '',
- datashow: false,
- wshareshow: false,
- activityType: '',
- nowidx:''
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- wx.hideShareMenu({
- menus: ['shareAppMessage', 'shareTimeline']
- })
- wx.showLoading({
- title: '加载中...',
- })
- this.activityfun();
- },
- setypetap: function (e) {
- this.setData({
- type: e.currentTarget.dataset.type
- })
- this.activityfun();
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- activityfun: function () {
- var that = this;
- activitypage = 1;
- utils.$get({
- url: app.globalData.webUrl + 'api/activity/list',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- page: 1,
- type: '',
- in:7
- },
- success: function (res) {
- // Timestate, 0未开始,1进行中,2已结束
- if (res.data.code == '0') {
- that.setData({
- activitylist: res.data.data,
- datashow: true
- })
- }
- setTimeout(function () {
- wx.hideLoading()
- }, 1000)
- }
- })
- },
- activitytap: function (e) {
- let that = this;
- wx.navigateTo({
- url: '/customer/pages/activitymsg/activitymsg?aid=' + e.currentTarget.dataset.aid
- })
- },
- sharetpa(e){
- this.setData({
- wshareshow:true,
- nowidx:e.currentTarget.dataset.idx
- })
- },
- shareurltap: function () {
- wx.showLoading({
- title: '加载中...',
- })
- this.shareactivitytap();
- util.schemefun('/share/pages/activitymsg/activitymsg', 'aid=' + this.data.activitylist[this.data.nowidx].id + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype, this.data.activitylist[this.data.nowidx].id, 'activity', '');
- },
- setpostertap: function () {
- wx.navigateTo({
- url: '/index/pages/setposter/setposter?type=activity&aid=' + this.data.activitylist[this.data.nowidx].id + "&listshare=",
- })
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- this.activityfun();
- wx.stopPullDownRefresh()
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- var that = this;
- activitypage = activitypage * 1 + 1;
- utils.$get({
- url: app.globalData.webUrl + 'api/activity/list',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- page: activitypage,
- type: '',
- in:7
- },
- success: function (res) {
- let activitylist = that.data.activitylist;
- if (res.data.code == '0') {
- activitylist = activitylist.concat(res.data.data)
- that.setData({
- activitylist: activitylist,
- })
- }
- }
- })
- },
- dothis(){},
- shareactivitytap: function (aid) {
- let that = this;
- utils.$post({
- url: app.globalData.webUrl + 'api/share/addlog',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- id: aid,
- type: 'activity',
- },
- success: function (r) {}
- })
- },
- addsharetap: function (type) {
- let that = this;
- utils.$post({
- url: app.globalData.webUrl + 'api/share/addlog',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- id: '0',
- type: type,
- },
- success: function (r) {}
- })
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function (e) {
- let idx=e.target.dataset.idx;
- var img = this.data.activitylist[idx].poster;
- // this.shareactivitytap(this.data.activitylist[idx].id);
- this.addsharetap('toolAll');
- return {
- title: this.data.activitylist[idx].title,
- imageUrl: img,
- path: '/share/pages/activitymsg/activitymsg?aid=' + this.data.activitylist[idx].id + '&uid=' + app.globalData.personMsg.id + "&ctp=" + app.globalData.clientype
- }
- }
- })
|