"use strict";
const common_vendor = require("../common/vendor.js");
function request(urldata) {
  const { url, data, method, header, userInfo } = urldata;
  const baseUrl = "http://192.168.0.218:8086/" + url;
  if (userInfo) {
    common_vendor.index.getStorage({
      key: "userinfo",
      success: (res) => {
        if (res.data) {
          if (res.data.nickName) {
            return new Promise((resolve, reject) => {
              common_vendor.index.request({
                url: baseUrl,
                data,
                method,
                header,
                success: function(res2) {
                  resolve(res2.data);
                },
                fail: function(res2) {
                  reject(res2);
                }
              });
            });
          } else {
            this.$global.lastPage = common_vendor.index.page.route;
            common_vendor.index.reLaunch({ url: "/pages/UserInformation/UserInformation" });
          }
        } else {
          this.$global.lastPage = common_vendor.index.page.route;
          common_vendor.index.navigateTo({ url: "/pages/login/login" });
        }
      }
    });
  } else {
    return new Promise((resolve, reject) => {
      common_vendor.index.request({
        url: baseUrl,
        data,
        method,
        header,
        success: function(res) {
          resolve(res.data);
        },
        fail: function(res) {
          reject(res);
        }
      });
    });
  }
}
exports.request = request;
//# sourceMappingURL=../../.sourcemap/mp-weixin/components/request.js.map
