收藏
回答

Cannot read property 'type' of undefined;怎么修改?

VM596:1 thirdScriptError
Cannot read property 'type' of undefined;at api request success callback function
TypeError: Cannot read property 'type' of undefined
    at e (http://127.0.0.1:41426/appservice/jy_fristcs/utils/util.js:34:58)
    at Object.success (http://127.0.0.1:41426/appservice/jy_fristcs/utils/util.js:27:16)
    at http://127.0.0.1:41426/appservice/we7/resource/js/util.js:94:69
    at o.(anonymous function) (WAService.js:1:1131034)
    at MC (WAService.js:1:1091186)
    at Function.success (WAService.js:1:1092853)
    at WAService.js:1:102995
    at C (WAService.js:1:437200)
    at i.<anonymous> (WAService.js:1:705916)
    at i.emit (WAService.js:1:462750)

/appservice/jy_fristcs/utils/util.js

function e(t, a, e, i) {
    var o = s();
    if ("jy_fristcs/pages/wifi/wifi" == o) if (2 == i[0].type) wx.navigateTo({
        url: "/jy_fristcs/pages/web/web?url=" + encodeURIComponent(i[0].url)
    }); else if (1 == i[0].type && (d = i[0].url1.split("?")[0]) != o) return void wx.redirectTo({
        url: "/" + i[0].url1
    });
    for (var r = 0; r < i.length; r++) if (i[r].sel = !1, 1 == i[r].type) {
        var d = i[r].url1;
        n() == d && ("" != i[r].vice_name ? wx.setNavigationBarTitle({
            title: i[r].vice_name
        }) : wx.setNavigationBarTitle({
            title: i[r].name
        }), i[r].sel = !0);
    }
    t.setData({
        muenList: {
            data: i,
            url: a,
            sel: o,
            color: e
        },
        isshz: !1
    });
}

appservice/we7/resource/js/util.js

  wx.request((_defineProperty(t = {
        url: o,
        data: e.data ? e.data : {},
        header: e.header ? e.header : {},
        method: e.method ? e.method : "GET"
    }, "header", {
        "content-type": "application/x-www-form-urlencoded"
    }), _defineProperty(t, "success", function(t) {
        if (wx.hideNavigationBarLoading(), wx.hideLoading(), t.data.errno) {
            if ("41009" == t.data.errno) return wx.setStorageSync("userInfo", ""), void util.getUserInfo(function() {
                util.request(e);
            });
            if (e.fail && "function" == typeof e.fail) e.fail(t); else if (t.data.message) {
                if (null != t.data.data && t.data.data.redirect) var n = t.data.data.redirect; else n = "";
                a.util.message(t.data.message, n, "error");
            }
        } else if (e.success && "function" == typeof e.success && e.success(t), e.cachetime) {
            var r = {
                data: t.data,
                expire: f + 1e3 * e.cachetime
            };
            wx.setStorageSync(u, r);
        }
    }), _defineProperty(t, "fail", function(t) {
        wx.hideNavigationBarLoading(), wx.hideLoading();
        var n = require("md5.js")(o), a = wx.getStorageSync(n);
        if (a && a.data) return e.success && "function" == typeof e.success && e.success(a),
        console.log("failreadcache:" + o), !0;
        e.fail && "function" == typeof e.fail && e.fail(t);
    }), _defineProperty(t, "complete", function(t) {
        e.complete && "function" == typeof e.complete && e.complete(t);
    }), t));
}, util.getUserInfo = function(e) {
    var t = function() {
        console.log("start login");
        var t = {
            sessionid: "",
            wxInfo: "",
            memberInfo: ""
        };



回答关注问题邀请回答
收藏

2 个回答

  • 老张
    老张
    2019-10-09

    找一下这个type呗。

    2019-10-09
    有用
    回复 2
    • 平度网-优惠券
      平度网-优惠券
      2019-10-09
      请问:如何找?
      2019-10-09
      回复
    • 老张
      老张
      2019-10-10回复平度网-优惠券
      我来调试的话,所有i[r]和i[r].type,i[0]和i[0].type都log出来看一遍再说呗。
      2019-10-10
      回复
  • 西西妈-丝丝运营
    西西妈-丝丝运营
    2019-10-08

    你不应该在这里问这个问题,你因该问自己。错误很清楚,type 没有定义。 type 是来自

    i[0].type

    那i是你在哪定义的。回去你的代码找。

    2019-10-08
    有用
    回复
登录 后发表内容
问题标签