api/global.js
@@ -1,6 +1,10 @@
// import request from '@/config/request';
import {
   BaseUrl
} from '@/utils/request.js'
// import { resolve } from 'node:path/win32';
// let baseUrl = "/";
// let BaseUrl = "/";
// const CURRENT_KEY = 'CURRENT_KEY';
// const PARAM_KEY = 'PARAM_KEY';
@@ -27,12 +31,6 @@
   });
}
// const baseUrl = 'http://192.168.3.159:9999'
// const baseUrl = 'https://mx.jzeg.cn:443/app';
// let baseUrl = 'http://192.168.0.114:9999';
const baseUrl = "https://mx.jzeg.cn:9998"; // 正式服务
// POST请求
function apiLogin({
   username,
@@ -44,7 +42,7 @@
   return new Promise((resolve, reject) => {
      uni.request({
         url: baseUrl + "/auth/oauth/token?grant_type=password&scope=server",
         url: BaseUrl + "/auth/oauth/token?grant_type=password&scope=server",
         method: "POST",
         data: {
            username,
@@ -79,7 +77,7 @@
   return new Promise((resolve, reject) => {
      uni.request({
         url: baseUrl + `/auth/mobile/token/social?grant_type=mobile&mobile=MINI@${code}`,
         url: BaseUrl + `/auth/mobile/token/social?grant_type=mobile&mobile=MINI@${code}`,
         method: "POST",
         header: {
            "TENANT-ID": "5",
@@ -103,6 +101,52 @@
   })
}
function logout() {
   uni.request({
         url: `${BaseUrl}/auth/token/logout`,
         method: 'DELETE',
         header: {
            'TENANT-ID': 5,
            Authorization: 'Bearer ' + uni.getStorageSync('access_token'),
            VERSION: 'zzl'
         }
      })
      .then(res => {
         console.log('缓存清理成功');
         uni.showToast({
            title: '到达登录页!'
         });
      })
      .catch(err => {
         uni.showToast({
            title: '缓存清理失败!'
         });
      });
}
// 删除撤回申请接口
function deleteWithDrawApplicationGlobal(id) {
   return new Promise((resolve, reject) => {
      uni.request({
         url: `${BaseUrl}/yunxiao/xswaybill/${id}`,
         method: 'DELETE',
         header: {
            'TENANT-ID': 5,
            Authorization: 'Bearer ' + uni.getStorageSync('access_token'),
            VERSION: 'zzl'
         },
         success: (res) => {
            resolve(res.data);
         },
         fail:(err) => {
            uni.showToast({
               title: '删除出错',
               icon: 'none'
            });
         }
      })
   })
}
@@ -114,5 +158,7 @@
export default {
   apiLogin,
   wxSmallLogin
   wxSmallLogin,
   logout,
   deleteWithDrawApplicationGlobal
}