function e(e, t) {
    var n = (e = e.replace(/(#\/)(.*)/, "")).match(new RegExp("(^|&)" + t + "=([^&]*)(&|$)", "i"));
    return null !== n ? unescape(n[2]) : null;
}

var t = getApp();

module.exports = {
    backApp: function(e) {
        if (e) try {
            wx.setStorageSync("we7_webview", e);
        } catch (e) {
            console.log(e);
        }
        if (1 < (e = getCurrentPages()).length) for (var t in e) "wn_storex/pages/view/index" === e[t].__route__ && wx.navigateBack({
            data: e.length - t + 1
        });
    },
    urlAddCode: function(n) {
        var r = wx.getStorageSync("userInfo"), a = function(t) {
            var r = e(n, "state");
            n.indexOf("http") || r || (n = n.replace(/index.php\?/, "index.php?from=wxapp&state=we7sid-" + t.sessionid + "&")), 
            (t = getCurrentPages()) && (t = t[getCurrentPages().length - 1]), t.setData({
                url: n
            });
        };
        r.sessionid ? a(r) : t.util.getUserInfo(a);
    }
};