var t = getApp(), a = require("../../provider/dataApi.js");

Page({
    data: {
        isData: !0,
        isListData: !1,
        isloading: !0,
        statusBarHeight: "",
        titleBarHeight: "",
        height: "",
        op: "",
        allList: [],
        oneList: [],
        twoList: [],
        threeList: [],
        info: {
            oneIndex: 0,
            twoIndex: 0
        }
    },
    onLoad: function(a) {
        console.log(wx.getSystemInfoSync()), this.setData({
            statusBarHeight: getApp().globalData.statusBarHeight,
            titleBarHeight: getApp().globalData.titleBarHeight,
            height: wx.getSystemInfoSync().windowHeight,
            op: t.globalData.op
        }), 1 == a.type && this.setData({
            params: a
        }), console.log(t.globalData.op), this.getSequence();
    },
    getSequence: function() {
        var t = this;
        a.sequence({
            uid: wx.getStorageSync("uid"),
            op: "getallspecial"
        }).then(function(a) {
            console.log(a), t.setData({
                allList: a.data.list,
                isloading: !1
            }), t.handleAllList();
        }).catch(function(a) {
            console.log(a), t.setData({
                isloading: !1
            });
        });
    },
    goBack: function() {
        wx.navigateBack({
            delta: 1
        });
    },
    bindOneChange: function(t) {
        t = +t.detail.value;
        var a = {};
        this.setData((a["info.oneIndex"] = t, a["info.twoIndex"] = 0, a)), this.handleTwoList(t, 0);
    },
    bindTwoChange: function(t) {
        t = +t.detail.value;
        var a = {};
        this.setData((a["info.twoIndex"] = t, a)), this.handleThreeList(t);
    },
    clickThreeItemBtn: function(a) {
        var n = this.data.params;
        t.globalData.lib_id = a.currentTarget.dataset.item.id, n && 1 == n.type ? wx.navigateTo({
            url: "../type-lx/type-lx"
        }) : wx.navigateTo({
            url: "/pages/practice/practice"
        });
    },
    handleAllList: function() {
        var t = this.data.info, a = this.data.allList;
        if (!(a.length <= 0)) {
            console.log(a), a.forEach(function(t) {
                var a = 2;
                t.son && 0 < t.son.length && t.son.forEach(function(t) {
                    1 == t.is_can && (a = 1);
                }), t.isCan = a;
            }), (a = a.filter(function(t) {
                return 1 == t.isCan;
            })).forEach(function(t) {
                var a = [];
                0 < t.son.length && t.son.forEach(function(t) {
                    1 == t.is_can && a.push(t);
                }), t.son = a;
            }), console.log(a);
            var n = !1;
            0 < a.length && (n = !0), this.setData({
                oneList: a,
                isListData: n
            }), 0 < a.length && this.handleTwoList(t.oneIndex, t.twoIndex);
        }
    },
    handleTwoList: function(t, a) {
        this.setData({
            twoList: this.data.oneList[t].son
        }), this.handleThreeList(a);
    },
    handleThreeList: function(t) {
        var a = this.data.twoList, n = [], e = !1;
        a[t].son && 0 < a[t].son.length && (n = this.data.twoList[t].son, e = !0), this.setData({
            threeList: n,
            isData: e
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});