myactivity.js 2.5 KB
const app =getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {
        nav: 1,
        navs: 1,
        list:'',
        datalist:''
    },
    onLoad: function (options) {
    },

    onReady: function () {
    },
    onShow: function () {
        let that = this;
        that.getList();
    },
    //活动列表
    getList() {
        
        let that = this;
        let url = '/index/second/activityList';
        let head = {
            'XX-Token': wx.getStorageSync('token')
        }
        let d = {
            status:that.data.navs
        }
        app.post(url, d, head).then((res) => {
            // console.log(res)
            that.setData({
                list: res
            })

        }).catch((err) => {

        })
    },
    //完成列表
    getListend() {
        
        let that = this;
        let url = '/index/second/commitList';
        let head = {
            'XX-Token': wx.getStorageSync('token')
        }
        let d = {
            status:that.data.nav-1
        }

        console.log(d)
        app.post(url, d, head).then((res) => {
            console.log(res)
            that.setData({
                datalist: res
            })

        }).catch((err) => {

        })
    },



    // 导航
    bindNav(e) {
        var nav = e.currentTarget.dataset.nav
        console.log(nav)
        this.setData({
            nav
        })
        this.getList();
        this.getListend()
    },
    // 导航
    bindtype(e) {
        var navs = e.currentTarget.dataset.navs
        console.log(navs)
        this.setData({
            navs
        })
        this.getList();
    },
    // 打卡
    getdaka(e) {
        var id =e.currentTarget.dataset.id
        wx.navigateTo({
            url: '/pages/myactivity/myactivity_active/myactivity_active?id='+id,
        })

    },
    // 提交报告
    getreport() {
        wx.navigateTo({
            url: '/pages/myactivity/myactivity_report/myactivity_report',
        })

    },








    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})