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,10 +31,6 @@
   });
}
// const baseUrl = 'http://192.168.3.159:9999'
// const baseUrl = 'https://mx.jzeg.cn:443/app';
const baseUrl = "https://mx.jzeg.cn:9998";
// POST请求
function apiLogin({
   username,
@@ -42,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,
@@ -59,7 +59,7 @@
            resolve(res);
         },
         fail: (err) => {
            console.log('错误',err);
            console.log('错误', err);
            uni.hideLoading();
            uni.showToast({
               icon: 'none',
@@ -70,6 +70,85 @@
   })
}
function wxSmallLogin(code) {
   uni.showLoading({
      title: '登录中...',
   })
   return new Promise((resolve, reject) => {
      uni.request({
         url: BaseUrl + `/auth/mobile/token/social?grant_type=mobile&mobile=MINI@${code}`,
         method: "POST",
         header: {
            "TENANT-ID": "5",
            "Authorization": "Basic cGlnOnBpZw==",
            'Content-Type': 'application/x-www-form-urlencoded'
         },
         success: (res) => {
            uni.hideLoading();
            // console.log(res)
            resolve(res);
         },
         fail: (err) => {
            console.log('错误', err);
            uni.hideLoading();
            uni.showToast({
               icon: 'none',
               title: '服务器错误'
            })
         }
      })
   })
}
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'
            });
         }
      })
   })
}
// 获取流程数据
// export const getProcessDataList = (params) => {
@@ -78,5 +157,8 @@
export default {
   apiLogin
   apiLogin,
   wxSmallLogin,
   logout,
   deleteWithDrawApplicationGlobal
}