Blame view

ceres-uniapp-master/config/requestApi.js 953 Bytes
3f535f30   杨鑫   '初始'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  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
          }
          uni.request({
              url: API.doPointer,
              data: data,
              method: 'post',
              header: header,
              success: res => {
                  resolve(res)
              },
              fail: res => {
                  reject(res)
              },
          })
      });
  }