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

require("../../provider/pipe.js");

Page({
    data: {
        statusBarHeight: "",
        titleBarHeight: "",
        userinfo: "",
        info: {
            total_score: 100,
            pass_score: 60,
            paper_time: 90,
            highest: 0
        }
    },
    onLoad: function(t) {
        wx.getStorageSync("uid") ? (t = wx.getStorageSync("userinfo"), this.setData({
            statusBarHeight: getApp().globalData.statusBarHeight,
            titleBarHeight: getApp().globalData.titleBarHeight,
            userinfo: t
        }), this.preExamInfo()) : wx.navigateTo({
            url: "/pages/login/login"
        });
    },
    goBack: function() {
        wx.navigateBack({
            delta: 1
        });
    },
    goExam: function(a) {
        console.log(a), t.globalData.item = a.currentTarget.dataset.item, wx.navigateTo({
            url: "../exam/exam?exam_type=" + a.currentTarget.id
        });
    },
    goSimulate: function(a) {
        t.globalData.item = a.currentTarget.dataset.item, wx.navigateTo({
            url: "/pages/type-lx/type-lx?type=" + a.currentTarget.id
        });
    },
    onShow: function() {
        this.preExamInfo();
    },
    preExamInfo: function() {
        var t = this;
        a.preExamInfo({
            uid: wx.getStorageSync("uid")
        }).then(function(a) {
            a.data.highest || (a.data.highest = 0), t.setData({
                info: a.data
            });
        }).catch(function(t) {
            console.log(t);
        });
    },
    onShareAppMessage: function() {}
});