123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- var app = getApp();
- var util = require("../../utils/util.js")
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- bottomLeft: app.bottomLeft,
- appAssetsUrl2: app.appAssetsUrl2,
- stateIndex: 0,
- nodata: util.nodata(),
- stateArray: ['全部','报名中','已结束'],
- id: null,
- obj: {},
- statusList: [],
- params: {
- page:1,
- limit:10
- },
- statusListIndex: 0,
- memberId: null,
- currPage: 1,
- totalPage: 0,
- dataList: [],
- load: false,
- activeInfo: {},
- isSchool: false,
- roleList: ['平台管理员','校园代理人','行家','行家;平台管理员','行家;校园代理人'],
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function(options) {
- this.setData({
- id: options.id,
- memberId: options.id
- })
- if(options.type == '校园代理人') {
- this.getDetail(options.id)
- wx.setNavigationBarTitle({
- title: options.type
- })
- this.setData({
- isSchool: true,
- })
- }else {
- this.activeUser(options.activityId || options.id)
- wx.setNavigationBarTitle({
- title: options.name
- })
- this.setData({
- isSchool: false,
- })
- }
-
- // wx.setNavigationBarTitile({ activityId
- // title: options.name
- // })
- wx.setNavigationBarTitle({
- title: options.name
- })
- },
- stateChange(e) {
- this.setData({
- stateIndex: e.detail.value,
- dataList: [],
- params: {
- page: 1,
- limit: 10
- }
- })
- this.getList()
- },
- activeDetail: function(e) {
- if (e.currentTarget.dataset.id) {
- wx.navigateTo({
- url: '/pages/home/index/activityDetail/activityDetail?id=' + e.currentTarget.dataset.id
- })
- }
- },
- // 校园代理人详情
- getDetail(id) {
- app._get(`campusagent/info/`+id, {
- }, res => {
- if (res.code === 0) {
- this.setData({
- obj: res.campusAgent,
- memberId: res.campusAgent.memberId
- })
- this.getState()
-
- }
- })
- },
- // 活动页进来的管理员信息
- activeUser(id) {
- app._get(`activity/activeCampusAgent`, {
- activityId: id
- }, res => {
- if (res.code === 0) {
- this.setData({
- activeInfo: res.data
- })
- this.getState()
- }
- })
- },
- getState() {
- // debugger
- app._post_form('home/activityStatus', '', null,
- (res) =>{
- if(res.code == 0){
- this.setData({
- statusList: [{itemname:'全部',itemcode:''},...res.data],
- })
- this.getList()
- }
- })
- },
- getList() {
- let that = this
- that.setData({
- load: false
- })
- this.setData({
- params: {
- ...that.data.params,
- status: that.data.statusList[that.data.stateIndex].itemcode,
- memberId: that.data.memberId
- },
- // noMore:isRefresh?false:this.data.noMore
- })
- app._post_form('act/list', '', {...this.data.params},
- function(res) {
- if(res.code == 0){
- that.setData({
- dataList: res.page.list,
- currPage: res.page.currPage,
- totalPage: res.page.totalPage,
- load: true
- })
- }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function() {
-
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function() {
-
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function() {},
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function() {
- let that = this
- if(this.data.currPage >= this.data.totalPage) {
- wx.showToast({
- title: '没有更多了~',
- icon: 'none'
- })
- return false;
- }
- this.setData({
- currPage: that.data.currPage + 1
- })
- this.getList()
- },
- showShareMenu: function() {
- wx.showShareMenu();
- },
- hideShareMenu() {
- wx.hideShareMenu();
- }
- })
|