123456789101112131415161718192021222324252627282930313233343536373839 |
- import config from '@/config.js';
- import sign from "@/libs/net/sign.js";
- export function request(url, param, isShowLoading = "1", method = 'POST') {
- if (isShowLoading) {
- uni.showLoading({
- title: '正在加载...'
- })
- }
- param=sign(param);
- let header = {};
-
-
- return new Promise((resolve, reject) => {
- uni.request({
- url: config.host + url,
- data: param,
- method: method,
- header: header,
- success(res) {
-
- if (res.data.code === 0) {
- resolve(res.data);
- } else if (res.data.code == 102) {
- reject(res.data);
- } else {
- reject(res.data);
- }
- },
- fail(err) {
- reject(err);
- },
- complete() {
- uni.hideLoading();
- }
- });
- });
- }
|