You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.4 KiB
56 lines
1.4 KiB
import { hideLoading, showLoading } from "../utils/plugIn/globalLoading.js";
|
|
/**
|
|
* @FileDescription:
|
|
* @Author: kahu
|
|
* @Date: 2022/9/29
|
|
* @LastEditors: kahu
|
|
* @LastEditTime: 2022/9/29
|
|
*/
|
|
// const NET = require('../utils/request')
|
|
const API = require('../config/api')
|
|
export function doPointRequest(data){
|
|
// return NET.request(API.doPointer, data, 'post')
|
|
return new Promise((resolve, reject) => {
|
|
let header = {
|
|
"Content-Type": "application/json"
|
|
}
|
|
const res = uni.getStorageSync('storage_key');
|
|
const token = res.token
|
|
if (token) {
|
|
header['Authorization'] = token
|
|
}
|
|
|
|
var project = "";
|
|
// #ifdef H5
|
|
var fullUrl = window.location.search;
|
|
if (fullUrl.indexOf("?") != -1) {
|
|
fullUrl = fullUrl.substring(1);
|
|
var paramStrs = fullUrl.split("&");
|
|
for(let i=0;i<paramStrs.length;i++){
|
|
const newStrs = paramStrs[i].split("=");
|
|
if(newStrs[0] === 'project'){
|
|
project = newStrs[1]
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
// #endif
|
|
if(!project){
|
|
project = uni.getStorageSync('project');
|
|
}
|
|
header['project'] = project
|
|
|
|
uni.request({
|
|
url: API.doPointer,
|
|
data: data,
|
|
method: 'post',
|
|
header: header,
|
|
success: res => {
|
|
resolve(res)
|
|
},
|
|
fail: res => {
|
|
reject(res)
|
|
},
|
|
})
|
|
});
|
|
}
|