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

Page({
    data: {
        statusBarHeight: "",
        titleBarHeight: "",
        handpapershow: !1,
        resuser: {},
        userinfo: {},
        paperId: "",
        params: {},
        isloading: !0,
        isShowBtn: !0,
        type: ""
    },
    onLoad: function(a) {
        if (wx.getStorageSync("uid")) {
            var t = wx.getStorageSync("userinfo");
            this.setData({
                statusBarHeight: getApp().globalData.statusBarHeight,
                titleBarHeight: getApp().globalData.titleBarHeight,
                userinfo: t,
                params: a
            }), console.log(a), "" != a.paperid && this.setData({
                paperId: a.paperid
            }), 1 == a.type && this.setData({
                resuser: e.globalData.resuser,
                isloading: !1,
                type: a.type
            }), 2 == a.type && (this.setData({
                isShowBtn: !1,
                type: a.type
            }), this.getexamResult());
        } else wx.navigateTo({
            url: "/pages/login/login"
        });
    },
    getexamResult: function() {
        var e = this, t = this.data.params;
        a.myTestExplain({
            uid: wx.getStorageSync("uid"),
            paperid: t.paperid,
            id: t.id
        }).then(function(a) {
            console.log(a), e.setData({
                resuser: a.data.resuser,
                isloading: !1
            });
        }).catch(function(a) {
            console.log(a), e.setData({
                isloading: !1
            });
        });
    },
    goBack: function() {
        wx.navigateBack({
            delta: 1
        });
    },
    seeError: function() {
        var a = this.data.resuser;
        1 == a.is_simple && 2 == a.complete ? this.showTip("试卷中包含主观题，请耐心等待评卷") : (e.globalData.op = "seeErr", 
        e.globalData.paperId = this.data.paperId, wx.navigateTo({
            url: "/pages/practice/practice"
        }));
    },
    backIndex: function() {
        wx.reLaunch({
            url: "/pages/home/home"
        });
    },
    showTip: function(e) {
        wx.showModal({
            title: "提示",
            content: e,
            showCancel: !1,
            confirmText: "关闭",
            success: function(e) {
                console.log(e);
            }
        });
    },
    onShareAppMessage: function() {}
});