"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.byIdEchoMessage = void 0;
exports.categoryAdd = categoryAdd;
exports.categoryDisplay = categoryDisplay;
exports.categoryList = categoryList;
exports.comPanyImgPost = void 0;
exports.formAdd = formAdd;
exports.formQuery = formQuery;
exports.formSubmit = formSubmit;
exports.formUpdate = formUpdate;
exports.getShopList = exports.getShopById = exports.getImgThemeListById = void 0;
exports.getSolitaireData = getSolitaireData;
exports.prizeMessage = exports.parseqrcode = exports.lottery = exports.imgUpload = exports.getcomPanyImglist = exports.getWechatUserInfo = exports.getTplImgList = void 0;
exports.templateAdd = templateAdd;
exports.templateList = templateList;
exports.templateQuery = templateQuery;
exports.writePrizeAddress = exports.tencentCos = void 0;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _axios = _interopRequireDefault(require("../utils/axios"));
// 图片上传
var imgUpload = /*#__PURE__*/function () {
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(obj) {
    return _regenerator["default"].wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            return _context.abrupt("return", (0, _axios["default"])({
              url: '/upload',
              method: 'post',
              data: obj
            }));
          case 1:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));
  return function imgUpload(_x) {
    return _ref.apply(this, arguments);
  };
}();
// 企业活码图片上传
exports.imgUpload = imgUpload;
var comPanyImgPost = /*#__PURE__*/function () {
  var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(obj) {
    return _regenerator["default"].wrap(function _callee2$(_context2) {
      while (1) {
        switch (_context2.prev = _context2.next) {
          case 0:
            return _context2.abrupt("return", (0, _axios["default"])({
              url: '/act/imgadd',
              method: 'post',
              data: (0, _extends2["default"])({
                ContentType: 'application/json'
              }, obj)
            }));
          case 1:
          case "end":
            return _context2.stop();
        }
      }
    }, _callee2);
  }));
  return function comPanyImgPost(_x2) {
    return _ref2.apply(this, arguments);
  };
}();
// 获得企业活码 logo/二维码
exports.comPanyImgPost = comPanyImgPost;
var getcomPanyImglist = /*#__PURE__*/function () {
  var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(obj) {
    return _regenerator["default"].wrap(function _callee3$(_context3) {
      while (1) {
        switch (_context3.prev = _context3.next) {
          case 0:
            return _context3.abrupt("return", (0, _axios["default"])({
              url: '/act/compimglist',
              method: 'post',
              data: (0, _extends2["default"])({
                ContentType: 'application/json'
              }, obj)
            }));
          case 1:
          case "end":
            return _context3.stop();
        }
      }
    }, _callee3);
  }));
  return function getcomPanyImglist(_x3) {
    return _ref3.apply(this, arguments);
  };
}();
// 获得主题id下的4张图片
exports.getcomPanyImglist = getcomPanyImglist;
var getImgThemeListById = /*#__PURE__*/function () {
  var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(obj) {
    return _regenerator["default"].wrap(function _callee4$(_context4) {
      while (1) {
        switch (_context4.prev = _context4.next) {
          case 0:
            return _context4.abrupt("return", (0, _axios["default"])({
              url: '/act/tplimglist',
              method: 'post',
              data: (0, _extends2["default"])({
                ContentType: 'application/json'
              }, obj)
            }));
          case 1:
          case "end":
            return _context4.stop();
        }
      }
    }, _callee4);
  }));
  return function getImgThemeListById(_x4) {
    return _ref4.apply(this, arguments);
  };
}();
//  没有主题id，获得所有图片(例如不是主题点进来的，直接拖头图组件)
exports.getImgThemeListById = getImgThemeListById;
var getTplImgList = /*#__PURE__*/function () {
  var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(obj) {
    return _regenerator["default"].wrap(function _callee5$(_context5) {
      while (1) {
        switch (_context5.prev = _context5.next) {
          case 0:
            return _context5.abrupt("return", (0, _axios["default"])({
              url: '/act/imglist',
              method: 'post',
              data: (0, _extends2["default"])({
                ContentType: 'application/json'
              }, obj)
            }));
          case 1:
          case "end":
            return _context5.stop();
        }
      }
    }, _callee5);
  }));
  return function getTplImgList(_x5) {
    return _ref5.apply(this, arguments);
  };
}();
// 获取商品列表
exports.getTplImgList = getTplImgList;
var getShopList = /*#__PURE__*/function () {
  var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(obj) {
    return _regenerator["default"].wrap(function _callee6$(_context6) {
      while (1) {
        switch (_context6.prev = _context6.next) {
          case 0:
            return _context6.abrupt("return", (0, _axios["default"])({
              url: '/commodity/list',
              method: 'post',
              data: (0, _extends2["default"])({
                ContentType: 'application/json'
              }, obj)
            }));
          case 1:
          case "end":
            return _context6.stop();
        }
      }
    }, _callee6);
  }));
  return function getShopList(_x6) {
    return _ref6.apply(this, arguments);
  };
}();
// 通过Id获取商品详细信息
exports.getShopList = getShopList;
var getShopById = /*#__PURE__*/function () {
  var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(id) {
    return _regenerator["default"].wrap(function _callee7$(_context7) {
      while (1) {
        switch (_context7.prev = _context7.next) {
          case 0:
            return _context7.abrupt("return", (0, _axios["default"])({
              url: "/commodity/" + id,
              method: 'get'
            }));
          case 1:
          case "end":
            return _context7.stop();
        }
      }
    }, _callee7);
  }));
  return function getShopById(_x7) {
    return _ref7.apply(this, arguments);
  };
}();

// 解析二维码返回二维码内容
exports.getShopById = getShopById;
var parseqrcode = /*#__PURE__*/function () {
  var _ref8 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(obj) {
    return _regenerator["default"].wrap(function _callee8$(_context8) {
      while (1) {
        switch (_context8.prev = _context8.next) {
          case 0:
            return _context8.abrupt("return", (0, _axios["default"])({
              url: '/parseqrcode',
              method: 'post',
              data: (0, _extends2["default"])({}, obj)
            }));
          case 1:
          case "end":
            return _context8.stop();
        }
      }
    }, _callee8);
  }));
  return function parseqrcode(_x8) {
    return _ref8.apply(this, arguments);
  };
}();

//  cos相关接口
exports.parseqrcode = parseqrcode;
var tencentCos = {
  authorization: function () {
    var _authorization = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(obj) {
      return _regenerator["default"].wrap(function _callee9$(_context9) {
        while (1) {
          switch (_context9.prev = _context9.next) {
            case 0:
              return _context9.abrupt("return", (0, _axios["default"])({
                url: '/getFederationToken',
                // '/getKey',
                method: 'post',
                data: obj
              }));
            case 1:
            case "end":
              return _context9.stop();
          }
        }
      }, _callee9);
    }));
    function authorization(_x9) {
      return _authorization.apply(this, arguments);
    }
    return authorization;
  }(),
  upload: function () {
    var _upload = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(path, data, conf) {
      return _regenerator["default"].wrap(function _callee10$(_context10) {
        while (1) {
          switch (_context10.prev = _context10.next) {
            case 0:
              return _context10.abrupt("return", (0, _axios["default"])((0, _extends2["default"])({
                url: path,
                method: 'put',
                data: data
              }, conf)));
            case 1:
            case "end":
              return _context10.stop();
          }
        }
      }, _callee10);
    }));
    function upload(_x10, _x11, _x12) {
      return _upload.apply(this, arguments);
    }
    return upload;
  }()
};

// 奖品相关接口
// 奖品配置接口

// 奖品信息
exports.tencentCos = tencentCos;
var prizeMessage = /*#__PURE__*/function () {
  var _ref9 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(obj) {
    return _regenerator["default"].wrap(function _callee11$(_context11) {
      while (1) {
        switch (_context11.prev = _context11.next) {
          case 0:
            return _context11.abrupt("return", (0, _axios["default"])({
              url: '/lottery/getinfo',
              method: 'post',
              data: (0, _extends2["default"])({
                ContentType: 'application/json'
              }, obj)
            }));
          case 1:
          case "end":
            return _context11.stop();
        }
      }
    }, _callee11);
  }));
  return function prizeMessage(_x13) {
    return _ref9.apply(this, arguments);
  };
}();

// 有活动ID的时候，通过这个活动id回显奖品信息
exports.prizeMessage = prizeMessage;
var byIdEchoMessage = /*#__PURE__*/function () {
  var _ref10 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(id) {
    return _regenerator["default"].wrap(function _callee12$(_context12) {
      while (1) {
        switch (_context12.prev = _context12.next) {
          case 0:
            return _context12.abrupt("return", (0, _axios["default"])({
              url: "/lottery/lottery/" + id,
              method: 'get'
            }));
          case 1:
          case "end":
            return _context12.stop();
        }
      }
    }, _callee12);
  }));
  return function byIdEchoMessage(_x14) {
    return _ref10.apply(this, arguments);
  };
}();

// 点击抽奖
exports.byIdEchoMessage = byIdEchoMessage;
var lottery = /*#__PURE__*/function () {
  var _ref11 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(obj) {
    return _regenerator["default"].wrap(function _callee13$(_context13) {
      while (1) {
        switch (_context13.prev = _context13.next) {
          case 0:
            return _context13.abrupt("return", (0, _axios["default"])({
              url: '/lottery/draw',
              method: 'post',
              data: (0, _extends2["default"])({
                ContentType: 'application/json'
              }, obj)
            }));
          case 1:
          case "end":
            return _context13.stop();
        }
      }
    }, _callee13);
  }));
  return function lottery(_x15) {
    return _ref11.apply(this, arguments);
  };
}();

//  奖品地址配置
exports.lottery = lottery;
var writePrizeAddress = /*#__PURE__*/function () {
  var _ref12 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(obj) {
    return _regenerator["default"].wrap(function _callee14$(_context14) {
      while (1) {
        switch (_context14.prev = _context14.next) {
          case 0:
            return _context14.abrupt("return", (0, _axios["default"])({
              url: '/lottery/deliveryadd',
              method: 'post',
              data: (0, _extends2["default"])({
                ContentType: 'application/json'
              }, obj)
            }));
          case 1:
          case "end":
            return _context14.stop();
        }
      }
    }, _callee14);
  }));
  return function writePrizeAddress(_x16) {
    return _ref12.apply(this, arguments);
  };
}();

// 调用微信回来的头像昵称信息
exports.writePrizeAddress = writePrizeAddress;
var getWechatUserInfo = /*#__PURE__*/function () {
  var _ref13 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(obj) {
    return _regenerator["default"].wrap(function _callee15$(_context15) {
      while (1) {
        switch (_context15.prev = _context15.next) {
          case 0:
            return _context15.abrupt("return", (0, _axios["default"])({
              url: '/wechat/get_user_info',
              baseURL: '/pub-api',
              method: 'get',
              data: (0, _extends2["default"])({
                ContentType: 'application/json'
              }, obj)
            }));
          case 1:
          case "end":
            return _context15.stop();
        }
      }
    }, _callee15);
  }));
  return function getWechatUserInfo(_x17) {
    return _ref13.apply(this, arguments);
  };
}();

// 1.新增表单
exports.getWechatUserInfo = getWechatUserInfo;
function categoryAdd(obj) {
  return (0, _axios["default"])({
    url: '/form/category/add',
    baseURL: '/comp-api',
    method: 'post',
    data: (0, _extends2["default"])({}, obj)
  });
}

// 2.新增表单

function categoryDisplay(obj) {
  return (0, _axios["default"])({
    url: '/form/category/display',
    baseURL: '/comp-api',
    method: 'post',
    data: (0, _extends2["default"])({}, obj)
  });
}

// 4.表单分类列表

function categoryList(obj) {
  return (0, _axios["default"])({
    url: '/form/category/list',
    baseURL: '/comp-api',
    method: 'get',
    params: (0, _extends2["default"])({}, obj)
  });
}

// 6.新增表单模板

function templateAdd(obj) {
  return (0, _axios["default"])({
    url: '/form/template/add',
    baseURL: '/comp-api',
    method: 'post',
    data: (0, _extends2["default"])({
      ContentType: 'application/json'
    }, obj)
  });
}

// 9.表单模板列表

function templateList(obj) {
  return (0, _axios["default"])({
    url: '/form/template/list',
    baseURL: '/comp-api',
    method: 'get',
    params: (0, _extends2["default"])({}, obj)
  });
}

// 10.表单模板信息查询

function templateQuery(obj) {
  return (0, _axios["default"])({
    url: '/form/template/query',
    baseURL: '/comp-api',
    method: 'get',
    params: (0, _extends2["default"])({}, obj)
  });
}

// 10.表单模板信息查询

function formSubmit(obj) {
  return (0, _axios["default"])({
    url: '/form/submit',
    baseURL: '/comp-api',
    method: 'post',
    data: (0, _extends2["default"])({
      ContentType: 'application/json'
    }, obj)
  });
}

// 11.新增表单

function formAdd(obj) {
  return (0, _axios["default"])({
    url: '/form/add',
    baseURL: '/comp-api',
    method: 'post',
    data: (0, _extends2["default"])({
      ContentType: 'application/json'
    }, obj)
  });
}

// 12.修改表单

function formUpdate(obj) {
  return (0, _axios["default"])({
    url: '/form/update',
    baseURL: '/comp-api',
    method: 'post',
    data: (0, _extends2["default"])({
      ContentType: 'application/json'
    }, obj)
  });
}
// 14.表单信息查询

function formQuery(obj) {
  return (0, _axios["default"])({
    url: '/form/query',
    baseURL: '/comp-api',
    method: 'get',
    params: (0, _extends2["default"])({}, obj)
  });
}

// 15.接龙记录查询

function getSolitaireData(obj) {
  return (0, _axios["default"])({
    url: '/form/result/list_by_idea_id',
    baseURL: '/comp-api',
    method: 'post',
    data: (0, _extends2["default"])({
      ContentType: 'application/json'
    }, obj)
  });
}

// export const activityAdd = async (obj: any) => {
//   return request({
//     url: '/act/add',
//     method: 'post',
//     data: obj,
//   });
// };
// export const getActivityById = async (id) => {
//   return request({
//     url: `/act/${id}`,
//     method: 'get',
//   });
// };
// export const editActivityById = async (obj) => {
//   return request({
//     url: '/act/edit',
//     method: 'post',
//     data: obj,
//   });
// };
// export const getActivityList = async () => {
//   return request({
//     url: '/act/tpllist',
//     method: 'post',
//   });
// };