收藏
回答

有没有大神帮我修改一下这个代码?

App({

    onLaunch: function() {

        wx.hideTabBar();

    },

    onShow: function() {},

    onHide: function() {},

    onError: function(t) {},

    init_app: function() {

        var e = this;

        return wx.getSystemInfo({

            success: function(t) {

                -1 < (e.globalData.sysData = t).model.indexOf("iPhone X") && (e.globalData.isIphoneX = !0);

            }

        }), new Promise(function(a, t) {

            wx.getStorageSync("uid") ? e.http.get("index.get_common_set", {

                showLoading: !1

            }, 60).then(function(t) {

                e.globalData.basic_set = t.data.basic_set, e.globalData.tag_set = t.data.tag_set,

                a();

            }) : wx.login({

                success: function(t) {

                    e.http.get("index.get_openid", {

                        code: t.code

                    }).then(function(t) {

                        t.data.uid && t.data.openid ? (wx.setStorageSync("uid", t.data.uid), wx.setStorageSync("openid", t.data.openid),

                        e.http.get("index.get_common_set", {

                            showLoading: !1

                        }, 500).then(function(t) {

                            e.globalData.basic_set = t.data.basic_set, e.globalData.tag_set = t.data.tag_set,

                            a();

                        })) : wx.showModal({

                            title: "错误",

                            content: "配置异常,请联系管理员检查后台配置",

                            success: function(t) {

                                wx.switchTab({

                                    url: "/weike_zf/pages/index/index"

                                });

                            }

                        });

                    });

                }

            });

        });

    },

    set_navigation_bar: function() {

        wx.setNavigationBarColor({

            frontColor: "#ffffff",

            backgroundColor: this.globalData.basic_set.theme_color

        });

    },

    globalData: {

        sysData: {},

        isIphoneX: !1,

        user_info: {},

        tarbars: [],

        basic_set: {},

        wx_xcx_set: {}

    },

    siteInfo: require("siteinfo.js"),

    http: require("./weike_zf/util/request.js")

});

这个怎么修改

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

1 个回答

  • o0o有脾气的酸奶
    o0o有脾气的酸奶
    2020-05-21

    同步异步的问题

    页面调用set_navigation_bar时

    你的init_app还没有请求到数据

    2020-05-21
    有用
    回复 2
    • LION
      LION
      2020-05-22
      那怎么修改
      2020-05-22
      回复
    • o0o有脾气的酸奶
      o0o有脾气的酸奶
      2020-05-22回复LION
      治标不治本的方法
      写在app.js最下面
      2020-05-22
      回复
登录 后发表内容
问题标签