baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)

This commit is contained in:
Gaussian committed 2026-11-06 18:38:38 +08:00
commit c2b0e7be0d
6522 files changed
+3530643

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
import {
isObject,
isString
} from 'axios/lib/utils'
import createError from 'axios/lib/core/createError'
import buildUrl from 'axios/lib/helpers/buildURL'
import settle from 'axios/lib/core/settle'
import Timeout from './await-timeout'
const timer = new Timeout()
export const adapter = config => {
return new Promise((resolve, reject) => {
const requestMethod = (isString(config.method) ? config.method : 'GET').toUpperCase()
const requestUrl = buildUrl(config.url, config.params, config.paramsSerializer)
const requestHeaders = isObject(config.headers) ? config.headers : {}
// 请求数据
let requestData = config.data
//console.log(requestUrl);
const request = uni.request({
method: requestMethod,
url: requestUrl,
header: requestHeaders,
sslVerify: false,
data: requestMethod === 'POST' || requestMethod === 'PUT' || requestMethod === 'PATCH' ? requestData : '',
responseType: config.responseType === 'arraybuffer' ? 'arraybuffer' : 'text',
dataType: config.responseType === 'json' ? 'json' : config.responseType,
success: (res) => {
settle(resolve, reject, {
data: res.data,
status: res.statusCode,
statusText: '',
headers: res.header,
config: config,
request: request
})
},
fail: () => {
const error = createError('网络错误', config, undefined, request)
reject(error)
},
complete: () => {
timer.clear()
}
})
// 支持超时处理
if (request && config.timeout) {
timer.set(config.timeout).then(() => {
reject(new Error('请求超时'))
request.abort()
})
}
})
}
@@ -0,0 +1,80 @@
// await-timeout v0.5.0 by Vitaliy Potapov
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.Timeout = factory());
}(this, function () { 'use strict';
function promiseFinally(promise, fn) {
const success = result => {
fn();
return result;
};
const error = e => {
fn();
return Promise.reject(e);
};
return Promise.resolve(promise).then(success, error);
}
/**
* Converts any value to Error.
* @param {*} value
* @returns {Error}
*/
function toError(value) {
value = typeof value === 'function' ? value() : value;
return typeof value === 'string' ? new Error(value) : value;
}
/**
* Promise-based replacement for setTimeout / clearTimeout.
*/
class Timeout {
constructor() {
this._id = null;
this._delay = null;
}
get id() {
return this._id;
}
get delay() {
return this._delay;
}
set(delay, rejectReason = '') {
return new Promise((resolve, reject) => {
this.clear();
const fn = rejectReason ? () => reject(toError(rejectReason)) : resolve;
this._id = setTimeout(fn, delay);
this._delay = delay;
});
}
wrap(promise, delay, rejectReason = '') {
const wrappedPromise = promiseFinally(promise, () => this.clear());
const timer = this.set(delay, rejectReason);
return Promise.race([wrappedPromise, timer]);
}
clear() {
if (this._id) {
clearTimeout(this._id);
}
}
}
Timeout.set = function (delay, rejectReason) {
return new Timeout().set(delay, rejectReason);
};
Timeout.wrap = function (promise, delay, rejectReason) {
return new Timeout().wrap(promise, delay, rejectReason);
};
return Timeout;
}));
+2
View File
@@ -0,0 +1,2 @@
import { axios } from './uni-axios'
export default axios
+109
View File
@@ -0,0 +1,109 @@
### uni-axios
使用axios封装request 网络请求库
**安装**
1. 使用 HBuilderX 导入插件或者下载压缩包把文件解压到js_sdk目录下
2. 安装axios
```
npm install --save axios@0.19.0
```
**使用方式:**
使用方法同 axios。
**Example**
在utils文件夹下创建http.js
```javascript
import axios from '@/js_sdk/gangdiedao-uni-axios'
/**
* 请求接口日志记录
*/
function _reqlog(req) {
if (process.env.NODE_ENV === 'development') {
console.log("请求地址:" + req.url, req.data || req.params)
}
//TODO 调接口异步写入日志数据库
}
/**
* 响应接口日志记录
*/
function _reslog(res) {
if (process.env.NODE_ENV === 'development') {
console.log(`${res.config.url}响应结果:`, res)
}
}
// 创建自定义接口服务实例
const http = axios.create({
// baseURL: [baseURL],
timeout: 6000, // 不可超过 manifest.json 中配置 networkTimeout的超时时间
// #ifdef H5
withCredentials: true,
// #endif
headers: {
'Content-Type': 'application/json',
//'X-Requested-With': 'XMLHttpRequest',
},
})
// 拦截器 在请求之前拦截
http.interceptors.request.use(config => {
// code...
// 获取本地存储的Cookie
// const cookie = uni.getStorageSync('cookie')
// 设置Cookie
// config.headers.Cookie = cookie
_reqlog(config)
return config
})
// 拦截器 在请求之后拦截
http.interceptors.response.use(response => {
_reslog(response)
// code...
// 获取cookie
// let headerStr = JSON.stringify(response.headers)
// let cookie = (/(?:Set-Cookie).+;/.exec(headerStr)[0]).replace(/Set-Cookie|:|"/g, "")
// if (cookie) {
// uni.setStorage({
// key: 'cookie',
// data: cookie.split(';')[0]
// })
// }
return response
}, error => {
return Promise.reject(error.message)
})
export default http
```
执行GET请求
```javascript
import http from '@/utils/http.js'
// get 请求
http.get(URL, [params]).then((res) => {
**
}).catch(error => {
**
}).finally(() => {
**
})
// post 请求
http.post(URL, [data]).then(res => {
}).catch(error => {
}).finally(() => {
})
```
+45
View File
@@ -0,0 +1,45 @@
import axios from 'axios'
import utils from 'axios/lib/utils'
import { adapter } from './adapter'
import normalizeHeaderName from 'axios/lib/helpers/normalizeHeaderName'
function setContentTypeIfUnset(headers, value) {
if(!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
headers['Content-Type'] = value
}
}
axios.defaults.transformRequest = [
function transformRequest(data, headers) {
normalizeHeaderName(headers, 'Accept')
normalizeHeaderName(headers, 'Content-Type')
if(
utils.isFormData(data)
|| utils.isArrayBuffer(data)
|| utils.isBuffer(data)
|| utils.isStream(data)
|| utils.isFile(data)
|| utils.isBlob(data)
) {
return data
}
if(utils.isArrayBufferView(data)) {
return data.buffer
}
if (utils.isURLSearchParams(data)) {
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8')
return data.toString()
}
if (utils.isObject(data)) {
setContentTypeIfUnset(headers, 'application/json;charset=utf-8')
return JSON.stringify(data)
}
return data
}
]
axios.defaults.adapter = adapter
export * from 'axios'
export { axios }