!function() {
    let t = null;
    var a = getApp();
    Page({
        data: {
            api: a.globalData.api_host,
            data: "",
            placeholder: "蛇、打雷",
            value: "",
            category: a.globalData.category,
            tip: !1,
            tipShow: !1,
            tradition: !1,
            teleShow: !0,
            backtop: !1
        },
        onShow: function() {
            t && t.show().catch(t => {
                console.error(t);
            });
        },
        onLoad: function() {
            for (var e = this, o = e.data.category, i = 0; i < o.length; i++) !function(t) {
                a.request({
                    cate: o[t].id,
                    attr: 1,
                    ps: 30,
                    detail: 0,
                    order: "level DESC,update_time DESC"
                }, function(a) {
                    o[t].list = a.data;
                    for (var i = 0; i < o[t].list.length; i++) {
                        var n = o[t].list[i].title, l = n ? n.split("、") : [];
                        o[t].list[i].title = l[0];
                    }
                    e.setData({
                        category: o
                    }), console.log("category", o);
                });
            }(i);
            this.mengjian();
        },
        mengjian: function() {
            var t = this;
            a.request({
                attr: 8,
                field: "id,title,cate_id",
                order: "level DESC,update_time DESC"
            }, function(e) {
                var o = a.group(e.data, 5);
                t.setData({
                    mengList: e.data,
                    newArray: o
                }), console.log("梦见", o);
            });
        },
        telesClick: function() {
            this.setData({
                teleShow: !1
            });
        },
        tapChange: function() {
            this.setData({
                tradition: !0
            }), wx.pageScrollTo({
                scrollTop: 0
            });
        },
        onPageScroll: function(t) {
            var a = !1;
            t.scrollTop >= 300 && (a = !0), this.setData({
                backtop: a
            });
        },
        handleBacktop: function() {
            wx.pageScrollTo({
                scrollTop: 0,
                duration: 300
            });
        },
        onShareAppMessage: function(t) {
            return {
                title: "星座屋与周公解梦",
                content: "解释你的梦境,感悟你的人生,了解你的心情,梦就是现实的写照！",
                path: "/pages/index2/index2"
            };
        },
        formSubmitHandle: function(t) {
            var a = this, e = t.detail.value.keywords;
            if (!e) return a.setData({
                tip: !0,
                tipShow: !0
            }), setTimeout(function() {
                a.setData({
                    tip: !1
                }), setTimeout(function() {
                    a.setData({
                        tipShow: !1
                    });
                }, 300);
            }, 3e3), !1;
            a.setData({
                value: e
            }), wx.navigateTo({
                url: encodeURI("/pages/search/search?q=" + e)
            });
        }
    });
}();