1234567891011121314151617181920212223242526272829 |
- "use strict";
- const common_vendor = require("../common/vendor.js");
- const BASE_URL = "https://m.douban.com";
- const newRequest = (options) => {
- return new Promise((resolve, reject) => {
- common_vendor.index.request({
- url: BASE_URL + options.url,
- //仅为示例,并非真实接口地址。
- method: options.method || "GET",
- data: options.data || {},
- header: {
- "custom-header": "hello"
- //自定义请求头信息
- },
- success: (res) => {
- common_vendor.index.__f__("log", "at utils/request.js:12", res.data);
- resolve(res);
- },
- fail: (err) => {
- common_vendor.index.showToast({
- title: "请求失败"
- });
- reject(err);
- }
- });
- });
- };
- exports.newRequest = newRequest;
- //# sourceMappingURL=../../.sourcemap/mp-weixin/utils/request.js.map
|