baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
Executable
+118
@@ -0,0 +1,118 @@
|
||||
//王者地带
|
||||
//http://ask.dcloud.net.cn/people/%E7%8E%8B%E8%80%85%E5%9C%B0%E5%B8%A6
|
||||
//5+APP Android 获取手机本机MAC 地址,支持所有安卓版本
|
||||
//2018-12-12
|
||||
|
||||
module.exports = {
|
||||
address: function() {
|
||||
// #ifdef APP-PLUS
|
||||
var Build = plus.android.importClass('android.os.Build');
|
||||
if (Build.VERSION.SDK_INT < 23) //android 6.0以下版本
|
||||
{
|
||||
return this.WifiInfoMac();
|
||||
} else if (Build.VERSION.SDK_INT == 23) //android 6.0
|
||||
{
|
||||
return this.ReaderMac();
|
||||
} else {
|
||||
return this.NetworkMac();
|
||||
}
|
||||
// #endif
|
||||
return "20:a6:0c:5f:37:bc";
|
||||
},
|
||||
|
||||
WifiInfoMac: function() {
|
||||
// #ifdef APP-PLUS
|
||||
var Context = plus.android.importClass("android.content.Context");
|
||||
var WifiManager = plus.android.importClass("android.net.wifi.WifiManager");
|
||||
var wifiManager = plus.android.runtimeMainActivity().getSystemService(Context.WIFI_SERVICE);
|
||||
var WifiInfo = plus.android.importClass("android.net.wifi.WifiInfo");
|
||||
var wifiInfo = wifiManager.getConnectionInfo();
|
||||
return wifiInfo.getMacAddress();
|
||||
// #endif
|
||||
},
|
||||
|
||||
ReaderMac: function() {
|
||||
// #ifdef APP-PLUS
|
||||
try {
|
||||
var BufferedReader = plus.android.importClass("java.io.BufferedReader");
|
||||
var FileReader = plus.android.importClass("java.io.FileReader");
|
||||
var file = new FileReader("/sys/class/net/wlan0/address");
|
||||
var reader = new BufferedReader(file, 256);
|
||||
var address = reader.readLine();
|
||||
reader.close();
|
||||
return address;
|
||||
} catch (error) {
|
||||
this.NetworkMac();
|
||||
return "02:00:00:00:00:00";
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
|
||||
NetworkMac: function() {
|
||||
// #ifdef APP-PLUS
|
||||
var NetworkInterface = plus.android.importClass("java.net.NetworkInterface");
|
||||
var networkInterface = NetworkInterface.getByName("eth1");
|
||||
if (networkInterface == null) {
|
||||
networkInterface = NetworkInterface.getByName("wlan0");
|
||||
}
|
||||
if (networkInterface == null) {
|
||||
this.isWifi();
|
||||
return "02:00:00:00:00:00";
|
||||
}
|
||||
var mac = networkInterface.getHardwareAddress();
|
||||
var macArr = [];
|
||||
for (var i in mac) {
|
||||
macArr.push(this.format(mac[i]));
|
||||
}
|
||||
return macArr.join(":");
|
||||
// #endif
|
||||
},
|
||||
|
||||
format: function(mac) {
|
||||
if (parseInt(mac) >= 0) {
|
||||
var numbder = parseInt(mac).toString(16);
|
||||
var num = numbder.length == 1 ? "0" + numbder : numbder;
|
||||
return num;
|
||||
} else {
|
||||
var numbder = parseInt(256 - Math.abs(mac)).toString(16);
|
||||
var num = numbder.length == 1 ? "0" + numbder : numbder;
|
||||
return num;
|
||||
}
|
||||
},
|
||||
|
||||
isWifi: function() {
|
||||
// #ifdef APP-PLUS
|
||||
if (plus.networkinfo.getCurrentType() == plus.networkinfo.CONNECTION_WIFI) {
|
||||
return "02:00:00:00:00:00";
|
||||
} else {
|
||||
plus.nativeUI.confirm("需要打开WiFi才能获取到MAC地址,是否去打开WiFi", function(event) {
|
||||
if (event.index == 0) {
|
||||
var main = plus.android.runtimeMainActivity();
|
||||
var Intent = plus.android.importClass('android.content.Intent');
|
||||
var intent = new Intent();
|
||||
intent.setClassName("com.android.settings", "com.android.settings.wifi.WifiSettings");
|
||||
main.startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
|
||||
getDeviceIp: function() {
|
||||
let deviceIp = '127.0.0.1';
|
||||
// #ifdef APP-PLUS
|
||||
if(plus.os.name=="Android") {
|
||||
let Context = plus.android.importClass("android.content.Context");
|
||||
let wifiManager =plus.android.runtimeMainActivity().getSystemService(Context.WIFI_SERVICE);
|
||||
let wifiInfo = plus.android.invoke(wifiManager, "getConnectionInfo");
|
||||
let ipAddress = plus.android.invoke(wifiInfo, "getIpAddress");
|
||||
deviceIp = '';
|
||||
if (ipAddress != 0) {
|
||||
deviceIp = ((ipAddress & 0xff) + "." + (ipAddress >> 8 & 0xff) + "."
|
||||
+ (ipAddress >> 16 & 0xff) + "." + (ipAddress >> 24 & 0xff));
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
return deviceIp;
|
||||
},
|
||||
};
|
||||
Executable
+93
@@ -0,0 +1,93 @@
|
||||
export default {
|
||||
checkVersionUrl:function(){
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
const platform = systemInfo.platform;
|
||||
//appName 宿主APP名称 字节跳动小程序
|
||||
//AppPlatform App平台 QQ小程序
|
||||
//host 宿主平台 百度小程序
|
||||
//app 当前运行的客户端 支付宝小程序
|
||||
console.log("systemInfo.appName" + systemInfo.appName)
|
||||
console.log("systemInfo.AppPlatform" + systemInfo.AppPlatform)
|
||||
console.log("systemInfo.host" + systemInfo.host)
|
||||
console.log("systemInfo.app" + systemInfo.app)
|
||||
console.log("systemInfo.SDKVersion" + systemInfo.SDKVersion)
|
||||
console.log("systemInfo.swanNativeVersion" + systemInfo.swanNativeVersion)
|
||||
|
||||
let versionCode = plus.runtime.app.versionCode
|
||||
console.log("plus.runtime.app.versionCode" + plus.runtime.app.versionCode)
|
||||
console.log("plus.runtime.app.versionCode" + plus.runtime.app.versionCode)
|
||||
|
||||
let checkVersionurl = "" // 检测更新地址
|
||||
|
||||
let runAppFlag = true
|
||||
//运行平台判断
|
||||
if(systemInfo.appName == "微信小程序") {
|
||||
runAppFlag = false
|
||||
}
|
||||
|
||||
if(runAppFlag) {
|
||||
uni.request({
|
||||
url: checkVersionurl, //仅为示例,并非真实接口地址。
|
||||
data: {
|
||||
versionCode: versionCode,
|
||||
platform: platform
|
||||
},
|
||||
header: {
|
||||
//'custom-header': 'hello' //自定义请求头信息
|
||||
},
|
||||
success: (res) => {
|
||||
console.log(res.data);
|
||||
let downloadUrl = res.data;
|
||||
|
||||
if (platform == "android") {
|
||||
// 安装下载的apk文件
|
||||
let dtask = plus.downloader.createDownload(downloadUrl, {}, function(d, status) {
|
||||
if (status == 200) { // 下载成功
|
||||
let path = d.filename
|
||||
plus.runtime.install(path)
|
||||
console.log(d.filename)
|
||||
} else { //下载失败
|
||||
alert("Download failed: " + status)
|
||||
}
|
||||
})
|
||||
|
||||
dtask.start()
|
||||
// dtask.addEventListener("statechanged", function(task, status) {
|
||||
// switch (task.state) {
|
||||
// case 1: // 开始
|
||||
// res.change({
|
||||
// progressValue:0,
|
||||
// progressTip:"准备下载...",
|
||||
// progress: true
|
||||
// });
|
||||
// break;
|
||||
// case 2: // 已连接到服务器
|
||||
// res.change({
|
||||
// progressValue:0,
|
||||
// progressTip:"开始下载...",
|
||||
// progress: true
|
||||
// });
|
||||
// break;
|
||||
// case 3:
|
||||
// const progress = parseInt(task.downloadedSize / task.totalSize * 100);
|
||||
// if(progress - lastProgressValue >= 2){
|
||||
// lastProgressValue = progress;
|
||||
// res.change({
|
||||
// progressValue:progress,
|
||||
// progressTip: "已下载" + progress + "%",
|
||||
// progress: true
|
||||
// });
|
||||
// }
|
||||
|
||||
// break;
|
||||
// }
|
||||
// });
|
||||
} else {
|
||||
//url在appstore的地址
|
||||
plus.runtime.openURL(url)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+317
@@ -0,0 +1,317 @@
|
||||
|
||||
|
||||
//
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED! DO NOT EDIT BY HAND!
|
||||
//
|
||||
;(function(global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined'
|
||||
? module.exports = factory()
|
||||
: typeof define === 'function' && define.amd
|
||||
? define(factory) :
|
||||
// cf. https://github.com/dankogai/js-base64/issues/119
|
||||
(function() {
|
||||
// existing version for noConflict()
|
||||
const _Base64 = global.Base64;
|
||||
const gBase64 = factory();
|
||||
gBase64.noConflict = () => {
|
||||
global.Base64 = _Base64;
|
||||
return gBase64;
|
||||
};
|
||||
if (global.Meteor) { // Meteor.js
|
||||
Base64 = gBase64;
|
||||
}
|
||||
global.Base64 = gBase64;
|
||||
})();
|
||||
}((typeof self !== 'undefined' ? self
|
||||
: typeof window !== 'undefined' ? window
|
||||
: typeof global !== 'undefined' ? global
|
||||
: this
|
||||
), function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* base64.ts
|
||||
*
|
||||
* Licensed under the BSD 3-Clause License.
|
||||
* http://opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
* References:
|
||||
* http://en.wikipedia.org/wiki/Base64
|
||||
*
|
||||
* @author Dan Kogai (https://github.com/dankogai)
|
||||
*/
|
||||
const version = '3.6.0';
|
||||
/**
|
||||
* @deprecated use lowercase `version`.
|
||||
*/
|
||||
const VERSION = version;
|
||||
const _hasatob = typeof atob === 'function';
|
||||
const _hasbtoa = typeof btoa === 'function';
|
||||
const _hasBuffer = typeof Buffer === 'function';
|
||||
const _TD = typeof TextDecoder === 'function' ? new TextDecoder() : undefined;
|
||||
const _TE = typeof TextEncoder === 'function' ? new TextEncoder() : undefined;
|
||||
const b64ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||
const b64chs = [...b64ch];
|
||||
const b64tab = ((a) => {
|
||||
let tab = {};
|
||||
a.forEach((c, i) => tab[c] = i);
|
||||
return tab;
|
||||
})(b64chs);
|
||||
const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
||||
const _fromCC = String.fromCharCode.bind(String);
|
||||
const _U8Afrom = typeof Uint8Array.from === 'function'
|
||||
? Uint8Array.from.bind(Uint8Array)
|
||||
: (it, fn = (x) => x) => new Uint8Array(Array.prototype.slice.call(it, 0).map(fn));
|
||||
const _mkUriSafe = (src) => src
|
||||
.replace(/[+\/]/g, (m0) => m0 == '+' ? '-' : '_')
|
||||
.replace(/=+$/m, '');
|
||||
const _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, '');
|
||||
/**
|
||||
* polyfill version of `btoa`
|
||||
*/
|
||||
const btoaPolyfill = (bin) => {
|
||||
// console.log('polyfilled');
|
||||
let u32, c0, c1, c2, asc = '';
|
||||
const pad = bin.length % 3;
|
||||
for (let i = 0; i < bin.length;) {
|
||||
if ((c0 = bin.charCodeAt(i++)) > 255 ||
|
||||
(c1 = bin.charCodeAt(i++)) > 255 ||
|
||||
(c2 = bin.charCodeAt(i++)) > 255)
|
||||
throw new TypeError('invalid character found');
|
||||
u32 = (c0 << 16) | (c1 << 8) | c2;
|
||||
asc += b64chs[u32 >> 18 & 63]
|
||||
+ b64chs[u32 >> 12 & 63]
|
||||
+ b64chs[u32 >> 6 & 63]
|
||||
+ b64chs[u32 & 63];
|
||||
}
|
||||
return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
|
||||
};
|
||||
/**
|
||||
* does what `window.btoa` of web browsers do.
|
||||
* @param {String} bin binary string
|
||||
* @returns {string} Base64-encoded string
|
||||
*/
|
||||
const _btoa = _hasbtoa ? (bin) => btoa(bin)
|
||||
: _hasBuffer ? (bin) => Buffer.from(bin, 'binary').toString('base64')
|
||||
: btoaPolyfill;
|
||||
const _fromUint8Array = _hasBuffer
|
||||
? (u8a) => Buffer.from(u8a).toString('base64')
|
||||
: (u8a) => {
|
||||
// cf. https://stackoverflow.com/questions/12710001/how-to-convert-uint8-array-to-base64-encoded-string/12713326#12713326
|
||||
const maxargs = 0x1000;
|
||||
let strs = [];
|
||||
for (let i = 0, l = u8a.length; i < l; i += maxargs) {
|
||||
strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
|
||||
}
|
||||
return _btoa(strs.join(''));
|
||||
};
|
||||
/**
|
||||
* converts a Uint8Array to a Base64 string.
|
||||
* @param {boolean} [urlsafe] URL-and-filename-safe a la RFC4648 §5
|
||||
* @returns {string} Base64 string
|
||||
*/
|
||||
const fromUint8Array = (u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a);
|
||||
// This trick is found broken https://github.com/dankogai/js-base64/issues/130
|
||||
// const utob = (src: string) => unescape(encodeURIComponent(src));
|
||||
// reverting good old fationed regexp
|
||||
const cb_utob = (c) => {
|
||||
if (c.length < 2) {
|
||||
var cc = c.charCodeAt(0);
|
||||
return cc < 0x80 ? c
|
||||
: cc < 0x800 ? (_fromCC(0xc0 | (cc >>> 6))
|
||||
+ _fromCC(0x80 | (cc & 0x3f)))
|
||||
: (_fromCC(0xe0 | ((cc >>> 12) & 0x0f))
|
||||
+ _fromCC(0x80 | ((cc >>> 6) & 0x3f))
|
||||
+ _fromCC(0x80 | (cc & 0x3f)));
|
||||
}
|
||||
else {
|
||||
var cc = 0x10000
|
||||
+ (c.charCodeAt(0) - 0xD800) * 0x400
|
||||
+ (c.charCodeAt(1) - 0xDC00);
|
||||
return (_fromCC(0xf0 | ((cc >>> 18) & 0x07))
|
||||
+ _fromCC(0x80 | ((cc >>> 12) & 0x3f))
|
||||
+ _fromCC(0x80 | ((cc >>> 6) & 0x3f))
|
||||
+ _fromCC(0x80 | (cc & 0x3f)));
|
||||
}
|
||||
};
|
||||
const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
||||
/**
|
||||
* @deprecated should have been internal use only.
|
||||
* @param {string} src UTF-8 string
|
||||
* @returns {string} UTF-16 string
|
||||
*/
|
||||
const utob = (u) => u.replace(re_utob, cb_utob);
|
||||
//
|
||||
const _encode = _hasBuffer
|
||||
? (s) => Buffer.from(s, 'utf8').toString('base64')
|
||||
: _TE
|
||||
? (s) => _fromUint8Array(_TE.encode(s))
|
||||
: (s) => _btoa(utob(s));
|
||||
/**
|
||||
* converts a UTF-8-encoded string to a Base64 string.
|
||||
* @param {boolean} [urlsafe] if `true` make the result URL-safe
|
||||
* @returns {string} Base64 string
|
||||
*/
|
||||
const encode = (src, urlsafe = false) => urlsafe
|
||||
? _mkUriSafe(_encode(src))
|
||||
: _encode(src);
|
||||
/**
|
||||
* converts a UTF-8-encoded string to URL-safe Base64 RFC4648 §5.
|
||||
* @returns {string} Base64 string
|
||||
*/
|
||||
const encodeURI = (src) => encode(src, true);
|
||||
// This trick is found broken https://github.com/dankogai/js-base64/issues/130
|
||||
// const btou = (src: string) => decodeURIComponent(escape(src));
|
||||
// reverting good old fationed regexp
|
||||
const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
||||
const cb_btou = (cccc) => {
|
||||
switch (cccc.length) {
|
||||
case 4:
|
||||
var cp = ((0x07 & cccc.charCodeAt(0)) << 18)
|
||||
| ((0x3f & cccc.charCodeAt(1)) << 12)
|
||||
| ((0x3f & cccc.charCodeAt(2)) << 6)
|
||||
| (0x3f & cccc.charCodeAt(3)), offset = cp - 0x10000;
|
||||
return (_fromCC((offset >>> 10) + 0xD800)
|
||||
+ _fromCC((offset & 0x3FF) + 0xDC00));
|
||||
case 3:
|
||||
return _fromCC(((0x0f & cccc.charCodeAt(0)) << 12)
|
||||
| ((0x3f & cccc.charCodeAt(1)) << 6)
|
||||
| (0x3f & cccc.charCodeAt(2)));
|
||||
default:
|
||||
return _fromCC(((0x1f & cccc.charCodeAt(0)) << 6)
|
||||
| (0x3f & cccc.charCodeAt(1)));
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @deprecated should have been internal use only.
|
||||
* @param {string} src UTF-16 string
|
||||
* @returns {string} UTF-8 string
|
||||
*/
|
||||
const btou = (b) => b.replace(re_btou, cb_btou);
|
||||
/**
|
||||
* polyfill version of `atob`
|
||||
*/
|
||||
const atobPolyfill = (asc) => {
|
||||
// console.log('polyfilled');
|
||||
asc = asc.replace(/\s+/g, '');
|
||||
if (!b64re.test(asc))
|
||||
throw new TypeError('malformed base64.');
|
||||
asc += '=='.slice(2 - (asc.length & 3));
|
||||
let u24, bin = '', r1, r2;
|
||||
for (let i = 0; i < asc.length;) {
|
||||
u24 = b64tab[asc.charAt(i++)] << 18
|
||||
| b64tab[asc.charAt(i++)] << 12
|
||||
| (r1 = b64tab[asc.charAt(i++)]) << 6
|
||||
| (r2 = b64tab[asc.charAt(i++)]);
|
||||
bin += r1 === 64 ? _fromCC(u24 >> 16 & 255)
|
||||
: r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255)
|
||||
: _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
|
||||
}
|
||||
return bin;
|
||||
};
|
||||
/**
|
||||
* does what `window.atob` of web browsers do.
|
||||
* @param {String} asc Base64-encoded string
|
||||
* @returns {string} binary string
|
||||
*/
|
||||
const _atob = _hasatob ? (asc) => atob(_tidyB64(asc))
|
||||
: _hasBuffer ? (asc) => Buffer.from(asc, 'base64').toString('binary')
|
||||
: atobPolyfill;
|
||||
//
|
||||
const _toUint8Array = _hasBuffer
|
||||
? (a) => _U8Afrom(Buffer.from(a, 'base64'))
|
||||
: (a) => _U8Afrom(_atob(a), c => c.charCodeAt(0));
|
||||
/**
|
||||
* converts a Base64 string to a Uint8Array.
|
||||
*/
|
||||
const toUint8Array = (a) => _toUint8Array(_unURI(a));
|
||||
//
|
||||
const _decode = _hasBuffer
|
||||
? (a) => Buffer.from(a, 'base64').toString('utf8')
|
||||
: _TD
|
||||
? (a) => _TD.decode(_toUint8Array(a))
|
||||
: (a) => btou(_atob(a));
|
||||
const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == '-' ? '+' : '/'));
|
||||
/**
|
||||
* converts a Base64 string to a UTF-8 string.
|
||||
* @param {String} src Base64 string. Both normal and URL-safe are supported
|
||||
* @returns {string} UTF-8 string
|
||||
*/
|
||||
const decode = (src) => _decode(_unURI(src));
|
||||
/**
|
||||
* check if a value is a valid Base64 string
|
||||
* @param {String} src a value to check
|
||||
*/
|
||||
const isValid = (src) => {
|
||||
if (typeof src !== 'string')
|
||||
return false;
|
||||
const s = src.replace(/\s+/g, '').replace(/=+$/, '');
|
||||
return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s);
|
||||
};
|
||||
//
|
||||
const _noEnum = (v) => {
|
||||
return {
|
||||
value: v, enumerable: false, writable: true, configurable: true
|
||||
};
|
||||
};
|
||||
/**
|
||||
* extend String.prototype with relevant methods
|
||||
*/
|
||||
const extendString = function () {
|
||||
const _add = (name, body) => Object.defineProperty(String.prototype, name, _noEnum(body));
|
||||
_add('fromBase64', function () { return decode(this); });
|
||||
_add('toBase64', function (urlsafe) { return encode(this, urlsafe); });
|
||||
_add('toBase64URI', function () { return encode(this, true); });
|
||||
_add('toBase64URL', function () { return encode(this, true); });
|
||||
_add('toUint8Array', function () { return toUint8Array(this); });
|
||||
};
|
||||
/**
|
||||
* extend Uint8Array.prototype with relevant methods
|
||||
*/
|
||||
const extendUint8Array = function () {
|
||||
const _add = (name, body) => Object.defineProperty(Uint8Array.prototype, name, _noEnum(body));
|
||||
_add('toBase64', function (urlsafe) { return fromUint8Array(this, urlsafe); });
|
||||
_add('toBase64URI', function () { return fromUint8Array(this, true); });
|
||||
_add('toBase64URL', function () { return fromUint8Array(this, true); });
|
||||
};
|
||||
/**
|
||||
* extend Builtin prototypes with relevant methods
|
||||
*/
|
||||
const extendBuiltins = () => {
|
||||
extendString();
|
||||
extendUint8Array();
|
||||
};
|
||||
const gBase64 = {
|
||||
version: version,
|
||||
VERSION: VERSION,
|
||||
atob: _atob,
|
||||
atobPolyfill: atobPolyfill,
|
||||
btoa: _btoa,
|
||||
btoaPolyfill: btoaPolyfill,
|
||||
fromBase64: decode,
|
||||
toBase64: encode,
|
||||
encode: encode,
|
||||
encodeURI: encodeURI,
|
||||
encodeURL: encodeURI,
|
||||
utob: utob,
|
||||
btou: btou,
|
||||
decode: decode,
|
||||
isValid: isValid,
|
||||
fromUint8Array: fromUint8Array,
|
||||
toUint8Array: toUint8Array,
|
||||
extendString: extendString,
|
||||
extendUint8Array: extendUint8Array,
|
||||
extendBuiltins: extendBuiltins,
|
||||
};
|
||||
|
||||
//
|
||||
// export Base64 to the namespace
|
||||
//
|
||||
// ES5 is yet to have Object.assign() that may make transpilers unhappy.
|
||||
// gBase64.Base64 = Object.assign({}, gBase64);
|
||||
gBase64.Base64 = {};
|
||||
Object.keys(gBase64).forEach(k => gBase64.Base64[k] = gBase64[k]);
|
||||
return gBase64;
|
||||
}));
|
||||
|
||||
|
||||
Executable
+229
@@ -0,0 +1,229 @@
|
||||
// import request from './j-request/request.js'
|
||||
import store from '../store/index.js'
|
||||
|
||||
export default {
|
||||
GetSourceTypeList(type) {
|
||||
var souceList = new Array();
|
||||
var userId = store.state.userInfo.token
|
||||
request.post({
|
||||
data: {
|
||||
//id: this.userInfo.ID,
|
||||
action: 'QuerySelBill',
|
||||
params: {
|
||||
"id": userId,
|
||||
"tranType": type
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
var datalist = JSON.parse(res)
|
||||
for (let i = 0; i < datalist.length; i++) {
|
||||
|
||||
souceList.push({
|
||||
'FIsOpenSource': datalist[i].FIsOpenSource,
|
||||
'FSourceTranType': datalist[i].FSourceTranType,
|
||||
'FDestTranType': datalist[i].FDestTranType,
|
||||
'ViewName': datalist[i].ViewName,
|
||||
'value': datalist[i].FSourceBillName
|
||||
})
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log(err, '获取源单类型错误')
|
||||
});
|
||||
|
||||
console.log(souceList, '源单数据')
|
||||
return souceList;
|
||||
},
|
||||
//获取部门,客户,供应商
|
||||
GetComInfoList(type, number) {
|
||||
//type: 1,客户 2,部门 3,供应商
|
||||
var customList = new Array();
|
||||
let datalist
|
||||
if (number == "") {
|
||||
switch (type) {
|
||||
case 1:
|
||||
uni.getStorage({
|
||||
key: "customerInfos",
|
||||
success: (res) => {
|
||||
datalist = res.data;
|
||||
}
|
||||
})
|
||||
break;
|
||||
case 2:
|
||||
uni.getStorage({
|
||||
key: "deptInfos",
|
||||
success: (res) => {
|
||||
datalist = res.data;
|
||||
}
|
||||
})
|
||||
break;
|
||||
case 3:
|
||||
uni.getStorage({
|
||||
key: "supplierInfos",
|
||||
success: (res) => {
|
||||
datalist = res.data;
|
||||
}
|
||||
})
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!datalist || datalist.length == 0)
|
||||
{
|
||||
var userId = store.state.userInfo.UserID
|
||||
var dbs=store.state.userInfo.dbAlise
|
||||
request.post({
|
||||
data: {
|
||||
action: 'getInfo',
|
||||
params: {
|
||||
"wUserID": userId,
|
||||
"DBAias": dbs,
|
||||
"FNumber": number,
|
||||
"type": type
|
||||
}
|
||||
},
|
||||
}).then(res => {
|
||||
var data = JSON.parse(res)
|
||||
datalist=data.data;
|
||||
}).catch(err => {
|
||||
console.log(err, '获取客户/部门/供应商错误')
|
||||
});
|
||||
}
|
||||
|
||||
for (let i = 0; i < datalist.length; i++) {
|
||||
customList.push({
|
||||
FItemID: datalist[i].FItemID,
|
||||
FNumber: datalist[i].FNumber,
|
||||
value: datalist[i].FName,
|
||||
})
|
||||
}
|
||||
// if (number == "" && customList.length > 0) {
|
||||
// this.SetComStorage(type, customList);
|
||||
// }
|
||||
return customList;
|
||||
},
|
||||
SetComStorage(type, data) {
|
||||
console.log(data, '------进入缓存-------=')
|
||||
switch (type) {
|
||||
case 1:
|
||||
store.saveCustomerInfos(data);
|
||||
break;
|
||||
case 2:
|
||||
store.saveDeptInfos(data);
|
||||
break;
|
||||
case 3:
|
||||
store.saveSupplierInfos(data);
|
||||
break;
|
||||
}
|
||||
},
|
||||
CheckBarcodeNumber(barcodeNumber) {
|
||||
if (!barcodeNumber) {
|
||||
return true;
|
||||
}
|
||||
let barcodeRule
|
||||
if(store.state.sysParameters) {
|
||||
if(store.state.sysParameters.hasOwnProperty("BarcodeRuleForVerification")) {
|
||||
let rule = store.state.sysParameters["BarcodeRuleForVerification"];
|
||||
console.log(typeof(rule),'rule属性')
|
||||
barcodeRule=rule//.FValue
|
||||
}
|
||||
}
|
||||
console.log(barcodeRule)
|
||||
if(!barcodeRule)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
let ruleNoSpace = barcodeRule.replace(/\s*/g, "");
|
||||
|
||||
if (!ruleNoSpace) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ruleNoSpace.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let rules = ruleNoSpace.split("|");
|
||||
//最小长度|最大长度|起始字符|结束字符|包含字符(字符之间可以已逗号隔开)
|
||||
if (rules[0]) {
|
||||
if (barcodeNumber.length < Number.parseInt(rules[0])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (rules[1]) {
|
||||
if (barcodeNumber.length > Number.parseInt(rules[1])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (rules[2]) {
|
||||
let header = barcodeNumber.substr(0, 1);
|
||||
let ruleChart2 = rules[2].split(",")
|
||||
if (ruleChart2) {
|
||||
if (ruleChart2.length > 0) {
|
||||
let filterChart2 = ruleChart2.filter(
|
||||
function(myChar) {
|
||||
return myChar == header;
|
||||
}
|
||||
)
|
||||
if (!filterChart2) {
|
||||
return false;
|
||||
}
|
||||
if (filterChart2.length === 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rules[3]) {
|
||||
let end = barcodeNumber.substr(-1, 1);
|
||||
let ruleChart3 = rules[3].split(",");
|
||||
if (ruleChart3) {
|
||||
if (ruleChart3.length > 0) {
|
||||
let filterChart3 = ruleChart3.filter(
|
||||
function(myChar) {
|
||||
return myChar == end;
|
||||
}
|
||||
)
|
||||
if (!filterChart3) {
|
||||
return false;
|
||||
}
|
||||
if (filterChart3.length === 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rules[4]) {
|
||||
let myBarcodeNumber = barcodeNumber;
|
||||
if (rules[2]) {
|
||||
myBarcodeNumber = myBarcodeNumber.substr(1, myBarcodeNumber.length - 1);
|
||||
}
|
||||
if (rules[3]) {
|
||||
myBarcodeNumber = myBarcodeNumber.substr(0, myBarcodeNumber.length - 1);
|
||||
}
|
||||
|
||||
let ruleChart4 = rules[4].split(",");
|
||||
if (ruleChart4) {
|
||||
if (ruleChart4.length > 0) {
|
||||
ruleChart4.forEach(
|
||||
function(myChar) {
|
||||
myBarcodeNumber = myBarcodeNumber.replace(new RegExp(myChar, "gm"), "");
|
||||
}
|
||||
);
|
||||
|
||||
if (myBarcodeNumber) {
|
||||
if (myBarcodeNumber.length > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
}
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
.sub-btn {
|
||||
width: 20%;
|
||||
color: #FFFFFF;
|
||||
background-color: #007BFF;
|
||||
height: 58upx;
|
||||
line-height: 58upx;
|
||||
font-size: 24upx;
|
||||
}
|
||||
.bg-darkblue{
|
||||
background-color: #55aa7f !important;
|
||||
}
|
||||
|
||||
.bg-blue{
|
||||
background-color: #55aaff !important;
|
||||
}
|
||||
.bg-darkred{
|
||||
background-color: #ff0000 !important;
|
||||
}
|
||||
.bg-light-orange{
|
||||
background-color: #ffaa7f !important;
|
||||
}
|
||||
|
||||
.bg-light-green{
|
||||
background-color: #84AF9B;
|
||||
}
|
||||
|
||||
.bg-dark-gray{
|
||||
background-color: #767d78;
|
||||
}
|
||||
.bg-light-gray{
|
||||
background-color: #C8C7A8;
|
||||
}
|
||||
.bg-light-yellow{
|
||||
background-color: #FACDAE;
|
||||
}
|
||||
.bg-light-red{
|
||||
background-color:#FC9C9D;
|
||||
}
|
||||
Executable
+392
@@ -0,0 +1,392 @@
|
||||
|
||||
.container{height: 100%;width: 100%;}
|
||||
.gray-layer{
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #333333;
|
||||
opacity: 0.7;
|
||||
z-index: 99;
|
||||
}
|
||||
.search{
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
margin: 10rpx 32rpx;
|
||||
padding: 10rpx 10rpx;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.search-title{
|
||||
width: 150rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
text-align: end;
|
||||
font-size: 30rpx;
|
||||
font-style: auto;
|
||||
color: #666666;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
}
|
||||
.search-input{
|
||||
/* position: relative; */
|
||||
width: 100%;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
font-size: 30rpx;
|
||||
color: #6B6B6B;
|
||||
padding-left: 15rpx;
|
||||
padding-right: 15rpx;
|
||||
border-radius: 10rpx;
|
||||
/* border: 1px solid #D8D8D8; */
|
||||
}
|
||||
.search-img{
|
||||
height: 40rpx;
|
||||
width: 40rpx;
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
top: 10rpx;
|
||||
}
|
||||
.card-list{
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction:row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
margin: 0rpx 32rpx 32rpx 32rpx;
|
||||
padding: 10rpx 24rpx;
|
||||
background-color: #FFFFFF;
|
||||
border-radius:10rpx;
|
||||
}
|
||||
.card-img{height: 80rpx;width: 80rpx}
|
||||
.img-left-large{width: 88rpx;height: 88rpx;flex-shrink: 0;margin-right: 32rpx;}
|
||||
.img-left-middle{width: 64rpx;height: 64rpx;flex-shrink: 0;margin-right: 32rpx;}
|
||||
.img-left-small{width: 34rpx;height: 34rpx;flex-shrink: 0;margin-right: 24rpx;}
|
||||
.card-info{margin-left: 10rpx;width: 100%;}
|
||||
.card-info-title{
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
font-size: 30rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-bottom: 2rpx solid #ececec;
|
||||
padding: 16rpx 0;
|
||||
}
|
||||
.card-info-title-text-left{
|
||||
height: 34rpx;
|
||||
line-height: 34rpx;
|
||||
width: 160rpx;
|
||||
font-size: 28rpx;
|
||||
font-family: MicrosoftYaHei;
|
||||
color: #8c8c8c;
|
||||
text-align: end;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
font-family: PingFangSC, PingFangSC-Regular;
|
||||
font-weight: 400;
|
||||
}
|
||||
.card-info-title-text-detail-left{
|
||||
height: 34rpx;
|
||||
line-height: 34rpx;
|
||||
font-size: 28rpx;
|
||||
font-family: MicrosoftYaHei;
|
||||
color: #3d3d3d;
|
||||
}
|
||||
.card-info-title-text-right{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 108rpx;
|
||||
}
|
||||
.status-red-text{
|
||||
width: 100%;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
opacity: 1;
|
||||
background: #fffaf0;
|
||||
border: 1px solid #FF2E2E;
|
||||
border-radius: 20rpx;
|
||||
font-size: 24rpx;
|
||||
font-family: PingFangSC, PingFangSC-Regular;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
color: #FF2E2E;
|
||||
}
|
||||
.status-red{
|
||||
width: 2px;
|
||||
height: 15px;
|
||||
background: #FF2E2E;
|
||||
border-radius: 2px;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.status-green-text{
|
||||
width: 100%;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
opacity: 1;
|
||||
background: #fffaf0;
|
||||
border: 1px solid #13a62a;
|
||||
border-radius: 20rpx;
|
||||
font-size: 24rpx;
|
||||
font-family: PingFangSC, PingFangSC-Regular;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
color: #13a62a;
|
||||
}
|
||||
.status-green{
|
||||
width: 2px;
|
||||
height: 15px;
|
||||
background: #5EC02D;
|
||||
border-radius: 2px;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.status-yellow-text{
|
||||
width: 100%;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
opacity: 1;
|
||||
background: #fffaf0;
|
||||
border: 1px solid #f7b400;
|
||||
border-radius: 20rpx;
|
||||
font-size: 24rpx;
|
||||
font-family: PingFangSC, PingFangSC-Regular;
|
||||
font-weight: 400;
|
||||
text-align: center;
|
||||
color: #f7b400;
|
||||
}
|
||||
.status-yellow{
|
||||
width: 2px;
|
||||
height: 15px;
|
||||
background: #FAAE12;
|
||||
border-radius: 2px;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.card-info-item{
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
font-size: 26rpx;
|
||||
font-family: MicrosoftYaHei;
|
||||
color: #505050;
|
||||
margin: 8rpx 0 0 8rpx
|
||||
}
|
||||
.card-info-item-text{
|
||||
width: 160rpx;
|
||||
text-align: end;
|
||||
color: #8c8c8c;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
}
|
||||
.card-info-item-text-detail{
|
||||
color: #3d3d3d;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
}
|
||||
.card-info-item-text-none{
|
||||
height: 34rpx;
|
||||
line-height: 34rpx;
|
||||
font-size: 28rpx;
|
||||
width: 160rpx;
|
||||
text-align: end;
|
||||
color: #8c8c8c;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
}
|
||||
|
||||
/* 提示弹窗 */
|
||||
.alter-window-center{
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
position: fixed;
|
||||
top: 35%;
|
||||
left: 10%;
|
||||
height: 30%;
|
||||
width: 80%;
|
||||
border: #DCDCDC solid 1px;
|
||||
border-radius: 10rpx;
|
||||
background-color: #FFFFFF;
|
||||
z-index: 100;
|
||||
}
|
||||
.alter-title{height: 80rpx;width: 100%;line-height: 80rpx;text-align: center;font-size: 32rpx;color: #3D3D3D;border-bottom: #DCDCDC solid 1px;}
|
||||
.alter-content{width: 100%;}
|
||||
.alter-content-detail{width: 100%;text-align: center;margin-top: 20rpx;}
|
||||
.alter-content-note{margin: 20rpx 10%;border: #DCDCDC solid 1px;border-radius: 10rpx;}
|
||||
.alter-content-input{width: 100%;padding: 0 10rpx;}
|
||||
.alter-btn{display: flex;flex-direction: row;height: 80rpx;width: 100%;line-height: 80rpx;font-size: 32rpx;border-top: #DCDCDC solid 1px;position: absolute;bottom: 0;}
|
||||
.alter-btn-cancel{width: 100%;height: 80rpx;line-height: 80rpx;text-align: center;font-size: 32rpx;color: #DCDCDC;border-right: #DCDCDC solid 1px;}
|
||||
.alter-btn-cnfirm{width: 100%;height: 80rpx;line-height: 80rpx;text-align: center;font-size: 32rpx;color: #2560C9;}
|
||||
/* 提示弹窗 */
|
||||
.btn-confirm{
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
width: 100%;
|
||||
font-size: 32rpx;
|
||||
color: #FFFFFF;
|
||||
text-align: center;
|
||||
background-color: #2560C9;
|
||||
}
|
||||
/* title */
|
||||
.order-title{opacity: 1;font-size: 32rpx;font-family: PingFangSC, PingFangSC-Semibold;font-weight: 600;text-align: left;
|
||||
color: #000000;padding: 32rpx 32rpx 24rpx 32rpx;}
|
||||
.info-title{padding: 20rpx 32rpx;font-size: 28rpx;font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;color: #59595f;}
|
||||
.head{margin: 0rpx 32rpx;background-color: #FFFFFF;padding: 32rpx 32rpx;border-radius: 10rpx;}
|
||||
/* textarea */
|
||||
.info-body{margin: 0 32rpx;padding: 0rpx 0rpx;background-color: #FFFFFF;}
|
||||
.text-area{
|
||||
font-size: 28rpx;
|
||||
font-family: PingFangSC, PingFangSC-Regular;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
color: #666666;
|
||||
height: 200rpx;
|
||||
width: 100%;
|
||||
border-radius: 10rpx;
|
||||
padding: 20rpx 32rpx;
|
||||
}
|
||||
.text-area-holder{
|
||||
font-size: 28rpx;
|
||||
font-family: PingFangSC, PingFangSC-Regular;
|
||||
font-weight: 400;
|
||||
color: #cacaca;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
/* lable-change */
|
||||
.lable-change{
|
||||
height: 70rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
margin:20rpx 32rpx 32rpx 32rpx;
|
||||
}
|
||||
.lable-change-item{
|
||||
display: flex;
|
||||
flex-direction:column;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-shrink: 1;
|
||||
flex-grow: 1;
|
||||
}
|
||||
.lable-change-text-gray{
|
||||
flex-shrink: 1;
|
||||
flex-grow: 1;
|
||||
font-size: 28rpx;
|
||||
font-family: PingFangSC, PingFangSC-Regular;
|
||||
font-weight: 400;
|
||||
color: #626262;
|
||||
}
|
||||
.lable-change-text{
|
||||
flex-shrink: 1;
|
||||
flex-grow: 1;
|
||||
font-size: 32rpx;
|
||||
font-family: PingFangSC, PingFangSC-Semibold;
|
||||
font-weight: 600;
|
||||
color: #262626;
|
||||
}
|
||||
.lable-change-vertical-line{
|
||||
width: 2rpx;
|
||||
height: 30rpx;
|
||||
background-color: #D0D0D0;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
}
|
||||
.lable-change-line{
|
||||
width: 60rpx;
|
||||
height:4rpx;
|
||||
background-color:#3860F3;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
}
|
||||
/* workerSelected */
|
||||
.worker-alter{position: fixed;left: 0rpx;right: 0rpx;top: 300rpx;bottom: 0;
|
||||
background-color: #F9F9F9;opacity: 1;z-index: 5;border-top-left-radius: 20rpx;border-top-right-radius: 20rpx;}
|
||||
.worker-alter-head{display: flex;flex-direction: row;border-bottom: solid #F5F5F5 1px;}
|
||||
.worker-alter-title{height: 100rpx;line-height: 100rpx;text-align: center;font-size: 32rpx;width: 100%;}
|
||||
.worker-alter-list{display: flex;justify-content: space-between;align-items: center;padding: 20rpx 0;border-bottom: solid #F5F5F5 1px;}
|
||||
.worker-alter-details{font-size: 26rpx;}
|
||||
.worker-alter-time{font-size: 26rpx;display: flex;flex-direction: row;}
|
||||
.worker-alter-time-input{border: solid #979797 2rpx;border-radius: 10rpx;width: 100rpx;margin-right: 20rpx;text-align: center;}
|
||||
.worker-alter-time-input-select{border: solid #0184FF 2rpx;border-radius: 10rpx;width: 100rpx;margin-right: 20rpx;text-align: center;color: #0184FF;}
|
||||
.worker-alter-confirm{height: 80rpx;line-height: 80rpx;width: 100%;position: fixed;bottom: 0;
|
||||
font-size: 32rpx;text-align: center;color: #FFFFFF;background-color: #007AFF;}
|
||||
/* partSelect */
|
||||
.sparePart{position: fixed;left: 0rpx;right: 0rpx;top: 300rpx;bottom: 0;
|
||||
background-color: #F9F9F9;opacity: 1;z-index: 5;border-top-left-radius: 20rpx;border-top-right-radius: 20rpx;}
|
||||
.sparePart-title{font-size: 28rpx;font-family: PingFangSC, PingFangSC-Semibold;font-weight: 600;color: rgba(60,60,67,0.85);}
|
||||
.sparePart-count{display: flex;position: absolute;right: 0;}
|
||||
.sparePart-count-img{height: 28rpx;width: 28rpx;}
|
||||
.sparePart-count-input{height: 28rpx;line-height: 28rpx;width: 100rpx;text-align: center;}
|
||||
|
||||
/* 出入库页面表头组织|日期样式 */
|
||||
.header-top {
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
margin-top: 8rpx;
|
||||
align-items: center;
|
||||
margin-left: 32rpx;
|
||||
margin-right: 32rpx;
|
||||
}
|
||||
.header-top-organzie{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
width: 70%;
|
||||
}
|
||||
.header-top-organzie-select{
|
||||
width: 100%;
|
||||
border-radius: 10rpx;
|
||||
border: 2rpx solid #D8D8D8;
|
||||
flex: 1 1;
|
||||
font-size: 32rpx;
|
||||
font-family: MicrosoftYaHei;
|
||||
color: #5F7EF8;
|
||||
margin-left: 24rpx;
|
||||
|
||||
display: flex;align-items: center;height: 40rpx;line-height: 40rpx;
|
||||
white-space: nowrap;overflow: hidden;text-overflow: ellipsis;
|
||||
margin-left: 10rpx;
|
||||
box-shadow: 1px 1px 5px 1px #e6e6e6 inset;margin-left: 20rpx;
|
||||
}
|
||||
.header-top-organzie-content{
|
||||
font-size: 32rpx;
|
||||
font-family: MicrosoftYaHei;
|
||||
color: #5F7EF8;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
.header-top-organzie-img{height: 32rpx;width: 32rpx;padding-left: 10rpx;position: absolute;right: 0;}
|
||||
.header-top-date{display: flex;flex-direction: row;align-items: center;position: relative;width: 30%;}
|
||||
.header-top-data-select{
|
||||
width: 100%;
|
||||
border-radius: 10rpx;
|
||||
border: 2rpx solid #D8D8D8;
|
||||
flex: 1 1;
|
||||
font-size: 32rpx;
|
||||
font-family: MicrosoftYaHei;
|
||||
color: #5F7EF8;
|
||||
margin-left: 24rpx;
|
||||
|
||||
padding-left: 10rpx;height: 40rpx;line-height: 40rpx;white-space: nowrap;overflow: hidden;
|
||||
box-shadow: 1px 1px 5px 1px #e6e6e6 inset;
|
||||
}
|
||||
Executable
+81
@@ -0,0 +1,81 @@
|
||||
function handle(err) {
|
||||
let errorMsg = "";
|
||||
if (err && err.name && err.name == "show") {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//非服务器返回
|
||||
if(err && err.name) {
|
||||
errorMsg = err.message.substr(0,100);
|
||||
if(err.name == 400) {
|
||||
errorMsg = err.name+":请求失败";
|
||||
}
|
||||
if(err.name == 401) {
|
||||
errorMsg = err.name+":token异常,请求没有进行身份验证或验证未通过";
|
||||
}
|
||||
if(err.name == 404) {
|
||||
errorMsg = err.name+":找不到请求的网页";
|
||||
}
|
||||
if(err.name == 405) {
|
||||
errorMsg = err.name+":服务器禁用当前请求中指定的方法";
|
||||
}
|
||||
if(err.name == 500) {
|
||||
errorMsg = err.name+":服务器内部错误";
|
||||
}
|
||||
if (errorMsg == "网络错误") {
|
||||
errorMsg = "当前网络质量不好请稍后再试";
|
||||
}
|
||||
|
||||
if (errorMsg) {
|
||||
let reg = /request:fail/;
|
||||
let regTimeout = /request:fail timeout/;
|
||||
let regAbort = /request:fail abort/;
|
||||
if (regTimeout.test(errorMsg)) {
|
||||
errorMsg = "当前网络质量不好请稍后再试";
|
||||
}
|
||||
if (regAbort.test(errorMsg)) {
|
||||
errorMsg = "当前网络质量不好请稍后再试";
|
||||
}
|
||||
if (reg.test(errorMsg)) {
|
||||
errorMsg = "请确认当前网络是否连接";
|
||||
}
|
||||
|
||||
// uni.showModal({
|
||||
// content: errorMsg,
|
||||
// showCancel:false,
|
||||
// success: function (res) {
|
||||
// if (res.confirm) {
|
||||
// console.log('用户点击确定');
|
||||
// } else if (res.cancel) {
|
||||
// console.log('用户点击取消');
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
else if(err) {
|
||||
if (err.toString()) {
|
||||
errorMsg = err.toString().substr(0,100);
|
||||
// uni.showModal({
|
||||
// content: errorMsg,
|
||||
// showCancel:false,
|
||||
// success: function (res) {
|
||||
// }
|
||||
// });
|
||||
}
|
||||
else {
|
||||
errorMsg = '提交资料有问题,请先确认' + err + err.toString().substr(0,100);
|
||||
// uni.showModal({
|
||||
// content: errorMsg,
|
||||
// showCancel:false,
|
||||
// success: function (res) {
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return errorMsg
|
||||
}
|
||||
|
||||
export default {handle}
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
function handle(err) {
|
||||
if (err && err.name && err.name == "show") {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//非服务器返回
|
||||
if(err && err.name) {
|
||||
let errorMsg = "";
|
||||
errorMsg = err.message.substr(0,100);
|
||||
if(err.name == 404) {
|
||||
errorMsg = "请确认服务器地址是否正确";
|
||||
}
|
||||
if (errorMsg == "网络错误") {
|
||||
errorMsg = "当前网络质量不好请稍后再试";
|
||||
}
|
||||
|
||||
if (errorMsg) {
|
||||
let reg = /request:fail/;
|
||||
let regTimeout = /request:fail timeout/;
|
||||
let regAbort = /request:fail abort/;
|
||||
if (regTimeout.test(errorMsg)) {
|
||||
errorMsg = "当前网络质量不好请稍后再试";
|
||||
}
|
||||
if (regAbort.test(errorMsg)) {
|
||||
errorMsg = "当前网络质量不好请稍后再试";
|
||||
}
|
||||
if (reg.test(errorMsg)) {
|
||||
errorMsg = "请确认当前网络是否连接";
|
||||
}
|
||||
|
||||
uni.showModal({
|
||||
content: errorMsg,
|
||||
showCancel:false,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else if(err) {
|
||||
if (err.toString()) {
|
||||
errorMsg = err.toString().substr(0,100);
|
||||
uni.showModal({
|
||||
content: errorMsg,
|
||||
showCancel:false,
|
||||
success: function (res) {
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
let errorMsg = '提交资料有问题,请先确认' + err + err.toString().substr(0,100);
|
||||
uni.showModal({
|
||||
content: errorMsg,
|
||||
showCancel:false,
|
||||
success: function (res) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default {handle}
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
.s-main
|
||||
{
|
||||
font-size: 50upx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.s-content{
|
||||
background: #FFFFFF;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100upx;
|
||||
border-bottom: 1upx solid #F2F2F2;
|
||||
}
|
||||
.s-title{
|
||||
display: flex;
|
||||
flex: 1;
|
||||
justify-content: center;
|
||||
}
|
||||
.s-part{
|
||||
display: flex;
|
||||
flex: 3;
|
||||
justify-content: center;
|
||||
|
||||
}
|
||||
|
||||
.s-btn{
|
||||
margin: 0 auto;
|
||||
padding-top: 10%;
|
||||
width: 60%;;
|
||||
}
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
export default {
|
||||
globalReturnType:new Map(),
|
||||
|
||||
globalData: {
|
||||
requestUrl: '', //http://localhost:8300
|
||||
printUrl: '' //打印服务器地址
|
||||
},
|
||||
|
||||
setGlobalObj(data) {
|
||||
//设置服务器变量
|
||||
this.globalData = Object.assign({}, this.globalData, data);
|
||||
//缓存数据
|
||||
uni.setStorage({
|
||||
key: 'RequestUrl',
|
||||
data: data.requestUrl
|
||||
});
|
||||
uni.setStorage({
|
||||
key: 'PrintUrl',
|
||||
data: data.printUrl
|
||||
});
|
||||
},
|
||||
|
||||
getReturnType(url){
|
||||
if (url) {
|
||||
return this.globalReturnType.get(url);
|
||||
}
|
||||
},
|
||||
|
||||
setReturnType(url, returnType) {
|
||||
if (url && returnType) {
|
||||
this.globalReturnType.set(url, returnType);
|
||||
}
|
||||
},
|
||||
|
||||
deleteReturnType(url) {
|
||||
if (url) {
|
||||
this.globalReturnType.delete(url);
|
||||
}
|
||||
},
|
||||
}
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
@font-face {
|
||||
font-family: 'iconfont'; /* project id 1912602 */
|
||||
src: url('https://at.alicdn.com/t/font_1912602_bd2r66xw9t.eot');
|
||||
src: url('https://at.alicdn.com/t/font_1912602_bd2r66xw9t.eot?#iefix') format('embedded-opentype'),
|
||||
url('https://at.alicdn.com/t/font_1912602_bd2r66xw9t.woff2') format('woff2'),
|
||||
url('https://at.alicdn.com/t/font_1912602_bd2r66xw9t.woff') format('woff'),
|
||||
url('https://at.alicdn.com/t/font_1912602_bd2r66xw9t.ttf') format('truetype'),
|
||||
url('https://at.alicdn.com/t/font_1912602_bd2r66xw9t.svg#iconfont') format('svg');
|
||||
}
|
||||
.iconfont {
|
||||
font-family: "iconfont" !important;
|
||||
font-size: 20px;
|
||||
color: #CCCCCC;
|
||||
font-style: normal;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.icon-qingchuhuancun:before {
|
||||
content: "\e610";
|
||||
}
|
||||
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
page{
|
||||
background: #F2F2F2;
|
||||
}
|
||||
.main{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #FFFFFF;
|
||||
margin-bottom: 2%;
|
||||
}
|
||||
.m-title{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
margin-left: 2%;
|
||||
height: 70upx;
|
||||
font-size: 35upx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.mt-center{
|
||||
padding-top: 2%;
|
||||
justify-content: center;
|
||||
font-size: 37upx;
|
||||
}
|
||||
|
||||
.m-contain
|
||||
{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;//换行
|
||||
padding-bottom: 5%;
|
||||
}
|
||||
.m-contain view{
|
||||
height: 200upx;
|
||||
width: 75px;
|
||||
display: inline-flex;
|
||||
flex-direction:column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.m-contain view view{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items:center;
|
||||
|
||||
}
|
||||
image{
|
||||
height: 38px;
|
||||
width: 38px;
|
||||
}
|
||||
.m-sign{
|
||||
color: #007AFF;
|
||||
font-weight: bold;
|
||||
margin-right: 4px;
|
||||
}
|
||||
Executable
+103
@@ -0,0 +1,103 @@
|
||||
import {
|
||||
Base64
|
||||
} from './base64.js'
|
||||
/**
|
||||
* js 日期格式化
|
||||
* 传时间戳参数进行时间戳转换,不传时返回当前时间(返回年月日时分秒格式)
|
||||
* @param {Object} timeStamp 时间戳参数 非必传
|
||||
* @param {Object} format 格式化样式 非必传
|
||||
*/
|
||||
function getTimeStampDatetime(format = 'yyyy-MM-dd HH:mm:ss', timeStamp) {
|
||||
let nowDatetime = new Date()
|
||||
timeStamp ? nowDatetime = new Date(timeStamp) : nowDatetime = new Date()
|
||||
return nowDatetime.Format(format)
|
||||
}
|
||||
Date.prototype.Format = function(fmt) {
|
||||
var o = {
|
||||
"M+": this.getMonth() + 1, //月份
|
||||
"d+": this.getDate(), //日
|
||||
"H+": this.getHours(), //小时
|
||||
"m+": this.getMinutes(), //分
|
||||
"s+": this.getSeconds(), //秒
|
||||
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
|
||||
"S": this.getMilliseconds() //毫秒
|
||||
};
|
||||
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||
for (var k in o)
|
||||
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[
|
||||
k]).substr(("" + o[k]).length)));
|
||||
return fmt;
|
||||
}
|
||||
|
||||
// 获取日志文件名称
|
||||
function getLogFileName() {
|
||||
// 今日日期
|
||||
let nowDate = getTimeStampDatetime("yyyy-MM-dd")
|
||||
// 当前时间精确到秒
|
||||
let nowTime = getTimeStampDatetime("HH:mm:ss")
|
||||
// 文件名称
|
||||
let fileName = 'app-log.text'
|
||||
fileName = nowDate + 'log.text'
|
||||
// 内容换行符(自定义)
|
||||
let newLine = "\r\n" + "======================================" + "\r\n" + nowTime + " =>>>" + "\r\n"
|
||||
|
||||
return {
|
||||
newLine: newLine,
|
||||
fileName: fileName
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志内容写入
|
||||
* 文件写入手机地址,华为Android/data/应用包名/documents/app-log/2021-01-17log.text
|
||||
* @param {Object} params 写入内容
|
||||
* @param {Object} encryption 是否加密
|
||||
*/
|
||||
function writeLog(params, encryption) {
|
||||
let text = JSON.stringify(params)
|
||||
// #ifdef APP-PLUS
|
||||
|
||||
plus.io.requestFileSystem(plus.io.PUBLIC_DOCUMENTS, function(fs) {
|
||||
// 可通过fs操作PUBLIC_DOCUMENTS文件系统
|
||||
// 创建日志文件夹
|
||||
fs.root.getDirectory("app-log", {
|
||||
create: true,
|
||||
exclusive: false
|
||||
}, function(dir) {
|
||||
// 创建或写入文件
|
||||
console.log("Directory Entry Name: " + dir.fullPath + getLogFileName().fileName);
|
||||
dir.getFile(getLogFileName().fileName, {
|
||||
create: true
|
||||
}, function(fileEntry) {
|
||||
// 找到文件准备写入操作
|
||||
fileEntry.file(function(file) {
|
||||
// create a FileWriter to write to the file
|
||||
fileEntry.createWriter(function(writer) {
|
||||
// Write data to file.
|
||||
writer.seek(file.size - 1)
|
||||
// 换行插入日志文件
|
||||
if (encryption) {
|
||||
writer.write(getLogFileName().newLine + " " + Base64.encode(text));
|
||||
} else {
|
||||
writer.write(getLogFileName().newLine + text);
|
||||
}
|
||||
}, function(e) {
|
||||
console.error("日志写入错误", error)
|
||||
});
|
||||
});
|
||||
});
|
||||
}, function(err) {
|
||||
console.error("文件夹创建失败", err)
|
||||
});
|
||||
|
||||
}, function(error) {
|
||||
console.error("文件系统进入错误", error)
|
||||
});
|
||||
|
||||
// #endif
|
||||
|
||||
}
|
||||
|
||||
export default {
|
||||
writeLog
|
||||
}
|
||||
Executable
+274
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
* JavaScript MD5 1.0.1
|
||||
* https://github.com/blueimp/JavaScript-MD5
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*
|
||||
* Based on
|
||||
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
|
||||
* Digest Algorithm, as defined in RFC 1321.
|
||||
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
|
||||
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
||||
* Distributed under the BSD License
|
||||
* See http://pajhome.org.uk/crypt/md5 for more info.
|
||||
*/
|
||||
|
||||
/*jslint bitwise: true */
|
||||
/*global unescape, define */
|
||||
'use strict';
|
||||
/*
|
||||
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
|
||||
* to work around bugs in some JS interpreters.
|
||||
*/
|
||||
function safe_add(x, y) {
|
||||
var lsw = (x & 0xFFFF) + (y & 0xFFFF),
|
||||
msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
||||
return (msw << 16) | (lsw & 0xFFFF);
|
||||
}
|
||||
|
||||
/*
|
||||
* Bitwise rotate a 32-bit number to the left.
|
||||
*/
|
||||
function bit_rol(num, cnt) {
|
||||
return (num << cnt) | (num >>> (32 - cnt));
|
||||
}
|
||||
|
||||
/*
|
||||
* These functions implement the four basic operations the algorithm uses.
|
||||
*/
|
||||
function md5_cmn(q, a, b, x, s, t) {
|
||||
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
|
||||
}
|
||||
|
||||
function md5_ff(a, b, c, d, x, s, t) {
|
||||
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
|
||||
}
|
||||
|
||||
function md5_gg(a, b, c, d, x, s, t) {
|
||||
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
|
||||
}
|
||||
|
||||
function md5_hh(a, b, c, d, x, s, t) {
|
||||
return md5_cmn(b ^ c ^ d, a, b, x, s, t);
|
||||
}
|
||||
|
||||
function md5_ii(a, b, c, d, x, s, t) {
|
||||
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the MD5 of an array of little-endian words, and a bit length.
|
||||
*/
|
||||
function binl_md5(x, len) {
|
||||
/* append padding */
|
||||
x[len >> 5] |= 0x80 << (len % 32);
|
||||
x[(((len + 64) >>> 9) << 4) + 14] = len;
|
||||
|
||||
var i, olda, oldb, oldc, oldd,
|
||||
a = 1732584193,
|
||||
b = -271733879,
|
||||
c = -1732584194,
|
||||
d = 271733878;
|
||||
|
||||
for (i = 0; i < x.length; i += 16) {
|
||||
olda = a;
|
||||
oldb = b;
|
||||
oldc = c;
|
||||
oldd = d;
|
||||
|
||||
a = md5_ff(a, b, c, d, x[i], 7, -680876936);
|
||||
d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
|
||||
c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
|
||||
b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
||||
a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
|
||||
d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
||||
c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
||||
b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
|
||||
a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
||||
d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
||||
c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
|
||||
b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
||||
a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
||||
d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
|
||||
c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
||||
b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
||||
|
||||
a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
|
||||
d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
||||
c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
|
||||
b = md5_gg(b, c, d, a, x[i], 20, -373897302);
|
||||
a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
|
||||
d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
|
||||
c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
|
||||
b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
|
||||
a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
|
||||
d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
||||
c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
|
||||
b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
||||
a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
||||
d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
|
||||
c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
||||
b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
||||
|
||||
a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
|
||||
d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
||||
c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
||||
b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
|
||||
a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
||||
d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
||||
c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
|
||||
b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
||||
a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
|
||||
d = md5_hh(d, a, b, c, x[i], 11, -358537222);
|
||||
c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
|
||||
b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
|
||||
a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
|
||||
d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
|
||||
c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
|
||||
b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
|
||||
|
||||
a = md5_ii(a, b, c, d, x[i], 6, -198630844);
|
||||
d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
||||
c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
||||
b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
|
||||
a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
||||
d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
||||
c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
|
||||
b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
||||
a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
||||
d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
|
||||
c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
||||
b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
||||
a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
|
||||
d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
||||
c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
|
||||
b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
|
||||
|
||||
a = safe_add(a, olda);
|
||||
b = safe_add(b, oldb);
|
||||
c = safe_add(c, oldc);
|
||||
d = safe_add(d, oldd);
|
||||
}
|
||||
return [a, b, c, d];
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert an array of little-endian words to a string
|
||||
*/
|
||||
function binl2rstr(input) {
|
||||
var i,
|
||||
output = '';
|
||||
for (i = 0; i < input.length * 32; i += 8) {
|
||||
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a raw string to an array of little-endian words
|
||||
* Characters >255 have their high-byte silently ignored.
|
||||
*/
|
||||
function rstr2binl(input) {
|
||||
var i,
|
||||
output = [];
|
||||
output[(input.length >> 2) - 1] = undefined;
|
||||
for (i = 0; i < output.length; i += 1) {
|
||||
output[i] = 0;
|
||||
}
|
||||
for (i = 0; i < input.length * 8; i += 8) {
|
||||
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the MD5 of a raw string
|
||||
*/
|
||||
function rstr_md5(s) {
|
||||
return binl2rstr(binl_md5(rstr2binl(s), s.length * 8));
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the HMAC-MD5, of a key and some data (raw strings)
|
||||
*/
|
||||
function rstr_hmac_md5(key, data) {
|
||||
var i,
|
||||
bkey = rstr2binl(key),
|
||||
ipad = [],
|
||||
opad = [],
|
||||
hash;
|
||||
ipad[15] = opad[15] = undefined;
|
||||
if (bkey.length > 16) {
|
||||
bkey = binl_md5(bkey, key.length * 8);
|
||||
}
|
||||
for (i = 0; i < 16; i += 1) {
|
||||
ipad[i] = bkey[i] ^ 0x36363636;
|
||||
opad[i] = bkey[i] ^ 0x5C5C5C5C;
|
||||
}
|
||||
hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
|
||||
return binl2rstr(binl_md5(opad.concat(hash), 512 + 128));
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a raw string to a hex string
|
||||
*/
|
||||
function rstr2hex(input) {
|
||||
//r16TD&*~12{]?[+3
|
||||
//0123456789abcdef
|
||||
var hex_tab = 'r16TD&*~12{]?[+3',
|
||||
output = '',
|
||||
x,
|
||||
i;
|
||||
for (i = 0; i < input.length; i += 1) {
|
||||
x = input.charCodeAt(i);
|
||||
output += hex_tab.charAt((x >>> 4) & 0x0F) +
|
||||
hex_tab.charAt(x & 0x0F);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Encode a string as utf-8
|
||||
*/
|
||||
function str2rstr_utf8(input) {
|
||||
return unescape(encodeURIComponent(input));
|
||||
}
|
||||
|
||||
/*
|
||||
* Take string arguments and return either raw or hex encoded strings
|
||||
*/
|
||||
function raw_md5(s) {
|
||||
return rstr_md5(str2rstr_utf8(s));
|
||||
}
|
||||
|
||||
function hex_md5(s) {
|
||||
return rstr2hex(raw_md5(s));
|
||||
}
|
||||
|
||||
function raw_hmac_md5(k, d) {
|
||||
return rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d));
|
||||
}
|
||||
|
||||
function hex_hmac_md5(k, d) {
|
||||
return rstr2hex(raw_hmac_md5(k, d));
|
||||
}
|
||||
|
||||
function md5(string, key, raw) {
|
||||
if (!key) {
|
||||
if (!raw) {
|
||||
return hex_md5(string);
|
||||
}
|
||||
return raw_md5(string);
|
||||
}
|
||||
if (!raw) {
|
||||
return hex_hmac_md5(key, string);
|
||||
}
|
||||
return raw_hmac_md5(key, string);
|
||||
}
|
||||
|
||||
export default { md5 }
|
||||
//module.exports.default = module.exports;
|
||||
Executable
+170
@@ -0,0 +1,170 @@
|
||||
module.exports = {
|
||||
groupFieldArray: ["FSRCBILLNO", "FSRCDETAILID", "FMATERIALID", "FITEMNAME", "FLOT","FITEMNUMBER"],
|
||||
barcodeQtyField: "FBASEQTY",
|
||||
billQtyField: "FBASEREMINANQTY",
|
||||
groupBy: function(datas, keys, callBack) {
|
||||
const list = datas || [];
|
||||
const groups = [];
|
||||
list.forEach(v => {
|
||||
const key = {};
|
||||
const data = {};
|
||||
keys.forEach(k => {
|
||||
key[k] = v[k];
|
||||
});
|
||||
let group = groups.find(v => {
|
||||
return v._key === JSON.stringify(key);
|
||||
});
|
||||
if (!group) {
|
||||
group = {
|
||||
_key: JSON.stringify(key),
|
||||
key: key,
|
||||
};
|
||||
groups.push(group);
|
||||
}
|
||||
if (callBack) {
|
||||
group.data = callBack(group.data, v);
|
||||
group.total = group.total || 0;
|
||||
group.total++;
|
||||
} else {
|
||||
group.data = group.data || [];
|
||||
group.data.push(v);
|
||||
}
|
||||
});
|
||||
return groups;
|
||||
},
|
||||
|
||||
checkQty: function(sourceBillArray, scannedArray, barcodeInfo, callback, batchControl, splitFlag) {
|
||||
let FBASEQTY = barcodeInfo.FBASEQTY ? barcodeInfo.FBASEQTY : 0;
|
||||
if (splitFlag) {
|
||||
FBASEQTY = barcodeInfo.FSplitBaseQty ? barcodeInfo.FSplitBaseQty : 0;
|
||||
}
|
||||
let FSRCBILLNO = barcodeInfo.FSRCBILLNO ? barcodeInfo.FSRCBILLNO : "";
|
||||
let FSRCDETAILID = barcodeInfo.FSRCDETAILID ? barcodeInfo.FSRCDETAILID : 0;
|
||||
let FMATERIALID = barcodeInfo.FMATERIALID ? barcodeInfo.FMATERIALID : 0;
|
||||
let FITEMNUMBER = barcodeInfo.FItemNumber ? barcodeInfo.FItemNumber : '';
|
||||
let FLOT = "";
|
||||
if (batchControl) {
|
||||
FLOT = barcodeInfo.FLOT ? barcodeInfo.FLOT : "";
|
||||
}
|
||||
|
||||
//--------源单------------//
|
||||
let billData = new Array();
|
||||
if (batchControl) {
|
||||
billData = sourceBillArray.filter(
|
||||
function(item) {
|
||||
return item.FSRCBILLNO == FSRCBILLNO &&
|
||||
// item.FSRCDETAILID == FSRCDETAILID &&
|
||||
item.FITEMNUMBER == FITEMNUMBER &&
|
||||
(item.FLOT == FLOT || item.FLOT=="");
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
billData = sourceBillArray.filter(
|
||||
function(item) {
|
||||
return item.FSRCBILLNO == FSRCBILLNO &&
|
||||
// item.FSRCDETAILID == FSRCDETAILID &&
|
||||
item.FITEMNUMBER == FITEMNUMBER;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
let sourceFLOT = "";
|
||||
billData.forEach(
|
||||
function(item){
|
||||
if (item.FLOT && item.FLOT.length > 0) {
|
||||
sourceFLOT = item.FLOT;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
billData = this.groupBy(
|
||||
billData,
|
||||
this.groupFieldArray,
|
||||
(d, v) => {
|
||||
d = d || 0
|
||||
let qtyNumber = parseFloat(v[this.billQtyField])
|
||||
return d += qtyNumber;
|
||||
});
|
||||
|
||||
let sumBillQty = 0;
|
||||
if (billData && billData[0] && (billData[0].data == 0 || billData[0].data > 0)) {
|
||||
billData.forEach(
|
||||
function(item){
|
||||
if (batchControl) {
|
||||
if (FSRCDETAILID) {
|
||||
if (FSRCBILLNO == item.key.FSRCBILLNO && FITEMNUMBER == item.key.FITEMNUMBER
|
||||
&& (FLOT == item.key.FLOT || !item.key.FLOT)) {
|
||||
sumBillQty += item.data;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (FSRCBILLNO == item.key.FSRCBILLNO && FITEMNUMBER == item.key.FITEMNUMBER
|
||||
&& (FLOT == item.key.FLOT || !item.key.FLOT)) {
|
||||
sumBillQty += item.data;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (FSRCDETAILID) {
|
||||
if (FSRCBILLNO == item.key.FSRCBILLNO && FITEMNUMBER == item.key.FITEMNUMBER) {
|
||||
sumBillQty += item.data;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (FSRCBILLNO == item.key.FSRCBILLNO && FITEMNUMBER == item.key.FITEMNUMBER) {
|
||||
sumBillQty += item.data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
//--------扫码------------//
|
||||
let scannedData = scannedArray.filter(
|
||||
function(item) {
|
||||
if (FSRCDETAILID) {
|
||||
return item.FSRCBILLNO == FSRCBILLNO &&
|
||||
item.FSRCDETAILID == FSRCDETAILID &&
|
||||
item.FITEMNUMBER == FITEMNUMBER &&
|
||||
((sourceFLOT && sourceFLOT.length > 0)? (batchControl?item.FLOT == FLOT:true): true );
|
||||
}
|
||||
else {
|
||||
return item.FSRCBILLNO == FSRCBILLNO &&
|
||||
item.FITEMNUMBER == FITEMNUMBER &&
|
||||
((sourceFLOT && sourceFLOT.length > 0)? (batchControl?item.FLOT == FLOT:true): true );
|
||||
}
|
||||
}
|
||||
);
|
||||
scannedData = this.groupBy(
|
||||
scannedData,
|
||||
this.groupFieldArray,
|
||||
(d, v) => {
|
||||
d = d || 0
|
||||
let qtyNumber = parseFloat(v[this.barcodeQtyField])
|
||||
return d += qtyNumber;
|
||||
});
|
||||
|
||||
let sumScannedQty = 0;
|
||||
if (scannedData && scannedData[0]) {
|
||||
scannedData.forEach(
|
||||
function(item){
|
||||
sumScannedQty += item.data;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (!FBASEQTY) {
|
||||
FBASEQTY = 0;
|
||||
}
|
||||
let sumQty = sumBillQty - sumScannedQty - FBASEQTY;
|
||||
if (sumQty >= 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
callback(sumBillQty, sumScannedQty, FBASEQTY);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Executable
+403
@@ -0,0 +1,403 @@
|
||||
import axios from '@/js_sdk/gangdiedao-uni-axios'
|
||||
import global from '@/common/global.js'
|
||||
import uuid from '@/common/uuid.js';
|
||||
import errorStrUntil from '@/common/errorStrUntil.js';
|
||||
import log from '@/common/log.js';
|
||||
|
||||
//外部操作对象
|
||||
const request = new Object();
|
||||
|
||||
//axios.default.baseURL = '/api'
|
||||
// 创建自定义接口服务实例
|
||||
const service = axios.create({
|
||||
//baseURL: '',
|
||||
timeout: 300000, // 不可超过 manifest.json 中配置 networkTimeout的超时时间
|
||||
withCredentials: true,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
//'X-Requested-With': 'XMLHttpRequest',
|
||||
},
|
||||
});
|
||||
|
||||
// 拦截器 在请求之前拦截
|
||||
service.interceptors.request.use((config) => {
|
||||
let isOpenLog = uni.getStorageSync('isOpenLog');
|
||||
let logObj = new Object;
|
||||
config.baseURL = global.globalData.requestUrl;
|
||||
|
||||
if(isOpenLog){
|
||||
logObj.url = config.url;
|
||||
logObj.params = config.data ? config.data : '';
|
||||
log.writeLog(logObj,false);
|
||||
}
|
||||
let token = uni.getStorageSync("token")
|
||||
if (token) {
|
||||
config.headers.Authorization = "Bearer " + token
|
||||
}
|
||||
|
||||
let addIpFlag = false
|
||||
let addUUIDFlag = false
|
||||
let requestUrl = config.url
|
||||
let arrayData = []
|
||||
if (
|
||||
requestUrl.search("STKInStock/STKInStockSubmit") != -1 ||
|
||||
requestUrl.search("InStock/InStockSubmit") != -1 ||
|
||||
requestUrl.search("InStock/RetStockSubmit") != -1 ||
|
||||
requestUrl.search("STKInStock/PURRetStockSubmit") != -1 ||
|
||||
requestUrl.search("OutStock/SaleOutStockSubmit") != -1 ||
|
||||
requestUrl.search("SUBInStkPickmtl/SUBInStkPickmtl") != -1 ||
|
||||
requestUrl.search("MisInStock/MisInStockSubmit") != -1 ||
|
||||
requestUrl.search("PickMtrl/PickMtrlSubmit") != -1 ||
|
||||
requestUrl.search("SUBPICKMTRL/SUBPICKMTRL") != -1 ||
|
||||
requestUrl.search("MisInStock/MisRetStockSubmit") != -1 ||
|
||||
requestUrl.search("OutStock/SaleInStockSubmit") != -1 ||
|
||||
requestUrl.search("SUBInStkPickmtl/SUBOutStkPickmtl") != -1 ||
|
||||
requestUrl.search("PickMtrl/ReturnMtrlSubmit") != -1 ||
|
||||
requestUrl.search("SUBPICKMTRL/SUBRETURNMTRL") != -1 ||
|
||||
requestUrl.search("OEMInStock/InStockSubmit") != -1 ||
|
||||
requestUrl.search("OEMInStock/RetStockSubmit") != -1 ||
|
||||
requestUrl.search("SimpleProduction/SimplePickMtrl") != -1 ||
|
||||
requestUrl.search("STKTransfer/STKTransferSubmit") != -1 ||
|
||||
requestUrl.search("SimpleProduction/SimpleInStock") != -1 ||
|
||||
requestUrl.search("SimpleProduction/SimpleReturnMtrl") != -1 ||
|
||||
requestUrl.search("SimpleProduction/SimpleOutStock") != -1 ||
|
||||
requestUrl.search("OutStock/SaleOutStockSuitSubmit") != -1 ||
|
||||
requestUrl.search("OutStock/SaleInStockSuitSubmit") != -1
|
||||
) {
|
||||
try {
|
||||
addIpFlag = true
|
||||
addUUIDFlag = true
|
||||
|
||||
arrayData.push(config.data.orgID ? config.data.orgID : "")
|
||||
arrayData.push(config.data.FDate ? config.data.FDate : "")
|
||||
arrayData.push(config.data.TranType ? config.data.TranType : "")
|
||||
config.data.barcodeList.forEach(function (item) {
|
||||
let obj = new Object()
|
||||
obj.FBARCODE = item.FBARCODE
|
||||
obj.FQTY = item.FQTY
|
||||
obj.FLOCATION = item.FLOCATION
|
||||
arrayData.push(obj)
|
||||
})
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if (requestUrl.search("Barcode/InBox") != -1) {
|
||||
try {
|
||||
addIpFlag = true
|
||||
addUUIDFlag = true
|
||||
|
||||
arrayData.push(config.data.BoxCode)
|
||||
arrayData.push(config.data.IsMix)
|
||||
arrayData.push(config.data.IsAdd)
|
||||
arrayData.push(config.data.TranType)
|
||||
arrayData.push(config.data.OrgId)
|
||||
config.data.InBoxInfo.forEach(function (item) {
|
||||
let obj = new Object()
|
||||
obj.Barcode = item.Barcode
|
||||
obj.Qty = item.Qty
|
||||
arrayData.push(obj)
|
||||
})
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if (requestUrl.search("Barcode/OutBox") != -1) {
|
||||
try {
|
||||
addIpFlag = true
|
||||
addUUIDFlag = true
|
||||
|
||||
arrayData.push(config.data.OrgId)
|
||||
arrayData.push(config.data.TranType)
|
||||
arrayData.push(config.data.BoxCode)
|
||||
config.data.OutBoxInfo.forEach(function (item) {
|
||||
let obj = new Object()
|
||||
obj.Barcode = item.Barcode
|
||||
obj.Qty = item.Qty
|
||||
arrayData.push(obj)
|
||||
})
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if (requestUrl.search("Barcode/MergeBarcode") != -1) {
|
||||
try {
|
||||
addIpFlag = true
|
||||
addUUIDFlag = true
|
||||
|
||||
arrayData.push(config.data.OrgId)
|
||||
arrayData.push(config.data.TranType)
|
||||
config.data.MergeInfo.forEach(function (item) {
|
||||
let obj = new Object()
|
||||
obj.Barcode = item.Barcode
|
||||
obj.Qty = item.Qty
|
||||
arrayData.push(obj)
|
||||
})
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if (requestUrl.search("Barcode/SplitBarcode") != -1) {
|
||||
try {
|
||||
addIpFlag = true
|
||||
addUUIDFlag = true
|
||||
|
||||
arrayData.push(config.data.RemainQty)
|
||||
arrayData.push(config.data.TranType)
|
||||
arrayData.push(config.data.OrgId)
|
||||
arrayData.push(config.data.Barcode)
|
||||
config.data.SplitInfo.forEach(function (item) {
|
||||
let obj = new Object()
|
||||
obj.Barcode = item.Barcode
|
||||
obj.Qty = item.Qty
|
||||
arrayData.push(obj)
|
||||
})
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if (requestUrl.search("STKAPPINSPECT/SubmitSTKAPPInspect") != -1) {
|
||||
try {
|
||||
arrayData.push(config.data.DepId)
|
||||
arrayData.push(config.data.Reason)
|
||||
arrayData.push(config.data.OrgId)
|
||||
config.data.BarcodeList.forEach(function (item) {
|
||||
let obj = new Object()
|
||||
obj.FBARCODE = item.FBARCODE
|
||||
arrayData.push(obj)
|
||||
})
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if (requestUrl.search("STKAPPINSPECT/SubmitSTKAPPInspect") != -1) {
|
||||
try {
|
||||
arrayData.push(config.data.DepId)
|
||||
arrayData.push(config.data.Reason)
|
||||
arrayData.push(config.data.OrgId)
|
||||
config.data.BarcodeList.forEach(function (item) {
|
||||
let obj = new Object()
|
||||
obj.FBARCODE = item.FBARCODE
|
||||
arrayData.push(obj)
|
||||
})
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if (addUUIDFlag && (uuid || uuid.generateUUID)) {
|
||||
console.log("generateUUID arrayData", JSON.stringify(arrayData))
|
||||
try {
|
||||
let key = uuid.generateUUID(arrayData)
|
||||
if (key) {
|
||||
config.headers.IdempotencyKey_ID = key
|
||||
console.log("generateUUID IdempotencyKey_ID", key)
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if (addIpFlag) {
|
||||
let ip = uni.getStorageSync("ip")
|
||||
try {
|
||||
let key = uuid.generateUUID(arrayData)
|
||||
if (ip) {
|
||||
config.headers.IdempotencyKey_IP = ip
|
||||
console.log("ip", ip)
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
return config
|
||||
})
|
||||
|
||||
// 响应后的拦截
|
||||
service.interceptors.response.use(
|
||||
(response) => {
|
||||
return response
|
||||
},
|
||||
(error) => {
|
||||
if (error.config && error.config.url) {
|
||||
global.deleteReturnType(error.config.url)
|
||||
}
|
||||
|
||||
if (error && error.response && error.response.status) {
|
||||
let msg = error.message.toString().substr(0, 100)
|
||||
let promiseError = new Error(msg)
|
||||
promiseError.name = error.response.status
|
||||
return Promise.reject(promiseError)
|
||||
}
|
||||
|
||||
let msg = error.message.toString().substr(0, 100)
|
||||
let promiseError = new Error(msg)
|
||||
promiseError.name = "server"
|
||||
return Promise.reject(promiseError)
|
||||
}
|
||||
)
|
||||
|
||||
request.service = service
|
||||
//指定外部请求操作方法
|
||||
request.localPost = function (url, parmas, returnType, tokenError) {
|
||||
let defaultType = "Data"
|
||||
|
||||
if (url) {
|
||||
let fullUrl = global.globalData.requestUrl + url
|
||||
if (returnType) {
|
||||
defaultType = returnType
|
||||
}
|
||||
global.setReturnType(fullUrl, defaultType)
|
||||
|
||||
let promise = new Promise(function (resolve, reject) {
|
||||
//做一些异步操作
|
||||
service
|
||||
.post(fullUrl, parmas)
|
||||
.then((response) => {
|
||||
let dataType
|
||||
if (response.config.url) {
|
||||
dataType = global.getReturnType(response.config.url)
|
||||
global.deleteReturnType(response.config.url)
|
||||
}
|
||||
|
||||
if (!dataType) {
|
||||
dataType = "Data"
|
||||
}
|
||||
|
||||
let data = response.data
|
||||
if (
|
||||
data.ErrCode == 0 ||
|
||||
data.StatusCode == 200 ||
|
||||
data.Success
|
||||
) {
|
||||
if (dataType) {
|
||||
if (dataType == "all") {
|
||||
resolve(data)
|
||||
} else {
|
||||
resolve(data[dataType])
|
||||
}
|
||||
} else {
|
||||
resolve(data.Data)
|
||||
}
|
||||
} else {
|
||||
//后台反馈错误
|
||||
let msg = response.message || data.Data || data.Message
|
||||
msg = msg.toString().substr(0, 100)
|
||||
let promiseError = new Error(msg)
|
||||
promiseError.name = "api"
|
||||
reject(promiseError)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
let ifLogin = uni.getStorageSync("ifLogin")
|
||||
if (err.name == "401" && !tokenError && ifLogin) {
|
||||
resolve(
|
||||
request.login(
|
||||
request.localPost,
|
||||
url,
|
||||
parmas,
|
||||
returnType,
|
||||
true
|
||||
)
|
||||
)
|
||||
} else if (err.name == "401" && !tokenError) {
|
||||
uni.hideLoading()
|
||||
console.log("relaunch")
|
||||
uni.navigateTo({ url: "/pages/myinfo/login/login" })
|
||||
} else {
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
promise.catch((err) => {
|
||||
errorStrUntil.handle(err)
|
||||
uni.hideLoading()
|
||||
})
|
||||
return promise
|
||||
}
|
||||
}
|
||||
|
||||
request.localGet = function (url, parmas, returnType, tokenError) {
|
||||
let defaultType = "data"
|
||||
if (url) {
|
||||
let fullUrl = global.globalData.requestUrl + url
|
||||
if (returnType) {
|
||||
defaultType = returnType
|
||||
}
|
||||
|
||||
global.setReturnType(fullUrl, defaultType)
|
||||
let promise = new Promise(function (resolve, reject) {
|
||||
//做一些异步操作
|
||||
service
|
||||
.get(fullUrl, parmas)
|
||||
.then((response) => {
|
||||
let dataType
|
||||
if (response.config.url) {
|
||||
dataType = global.getReturnType(response.config.url)
|
||||
global.deleteReturnType(response.config.url)
|
||||
}
|
||||
|
||||
if (!dataType) {
|
||||
dataType = "Data"
|
||||
}
|
||||
|
||||
let data = response.data
|
||||
if (
|
||||
data.ErrCode == 0 ||
|
||||
data.StatusCode == 200 ||
|
||||
data.Success
|
||||
) {
|
||||
if (dataType) {
|
||||
if (dataType == "all") {
|
||||
resolve(data)
|
||||
} else {
|
||||
resolve(data[dataType])
|
||||
}
|
||||
} else {
|
||||
resolve(data.Data)
|
||||
}
|
||||
} else {
|
||||
//后台反馈错误
|
||||
let msg = response.message || data.Data || data.Message
|
||||
msg = msg.toString().substr(0, 100)
|
||||
let promiseError = new Error(msg)
|
||||
promiseError.name = "api"
|
||||
reject(promiseError)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
let ifLogin = uni.getStorageSync("ifLogin")
|
||||
if (err.name == "401" && !tokenError && ifLogin) {
|
||||
resolve(
|
||||
request.login(
|
||||
request.localPost,
|
||||
url,
|
||||
parmas,
|
||||
returnType,
|
||||
true
|
||||
)
|
||||
)
|
||||
} else if (err.name == "401" && !tokenError) {
|
||||
uni.hideLoading()
|
||||
uni.navigateTo({ url: "/pages/myinfo/login/login" })
|
||||
} else {
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
promise.catch((err) => {
|
||||
errorStrUntil.handle(err)
|
||||
uni.hideLoading()
|
||||
})
|
||||
return promise
|
||||
}
|
||||
}
|
||||
|
||||
request.post = function(url, parmas, tokenError) {
|
||||
return request.localPost(url, parmas, "Data", tokenError);
|
||||
}
|
||||
|
||||
request.get = function(url, parmas, tokenError) {
|
||||
return request.localGet(url, parmas, "Data", tokenError);
|
||||
}
|
||||
|
||||
request.login = function(callback, url, parmas, returnType) {
|
||||
let tokenParams = uni.getStorageSync('RequestToken');
|
||||
return service.post('/Authentication/RequestToken', tokenParams)
|
||||
.then(res => {
|
||||
uni.setStorageSync('token',res.data.Data.token);
|
||||
return callback(url, parmas, returnType, true);
|
||||
});
|
||||
}
|
||||
|
||||
export default request;
|
||||
Executable
+1447
File diff suppressed because it is too large.
Load diff
Executable
+95
@@ -0,0 +1,95 @@
|
||||
module.exports = {
|
||||
removeLetter:function(str){
|
||||
let result;
|
||||
let reg = /[a-zA-Z]+/; //[a-zA-Z]表示匹配字母,g表示全局匹配
|
||||
|
||||
while (result = str.match(reg)) { //判断str.match(reg)是否没有字母了
|
||||
str = str.replace(result[0], ''); //替换掉字母 result[0] 是 str.match(reg)匹配到的字母
|
||||
}
|
||||
|
||||
return str;
|
||||
},
|
||||
|
||||
judgeFloat:function(qty){
|
||||
let checkQtyErrorFlag = true;
|
||||
let reg = /\D/;
|
||||
checkQtyErrorFlag = reg.test(qty);
|
||||
if(checkQtyErrorFlag) {
|
||||
let firstQty = qty.toString().substr(0,1);
|
||||
checkQtyErrorFlag = reg.test(firstQty);
|
||||
|
||||
//防止非数字开头
|
||||
if(!checkQtyErrorFlag) {
|
||||
let replaceQty = qty.toString().replace(".", "");
|
||||
checkQtyErrorFlag = reg.test(replaceQty);
|
||||
}
|
||||
}
|
||||
|
||||
//排除0000.1
|
||||
if(!checkQtyErrorFlag) {
|
||||
if (qty.toString().substr(0,1) == "0" && qty.toString().substr(1,1) != "."){
|
||||
checkQtyErrorFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
//排除0...1
|
||||
if(!checkQtyErrorFlag) {
|
||||
if ((qty.toString().split('.')).length > 2){
|
||||
checkQtyErrorFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(checkQtyErrorFlag) {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "请输入正确的数量值",
|
||||
duration: 3500,
|
||||
})
|
||||
return false;
|
||||
}
|
||||
|
||||
//排除0...1
|
||||
if(!checkQtyErrorFlag) {
|
||||
if ((qty.toString().split('.')).length > 1){
|
||||
if (qty.toString().split('.')[1].length > 6){
|
||||
checkQtyErrorFlag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(checkQtyErrorFlag) {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "小数位最多只能输入6位",
|
||||
duration: 3500,
|
||||
})
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
judgeInt:function(qty){
|
||||
let checkQtyErrorFlag = true;
|
||||
let reg = /\./;
|
||||
checkQtyErrorFlag = reg.test(qty);
|
||||
if(checkQtyErrorFlag) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
round: function(num, decimal = 2) {
|
||||
num = num.toString();
|
||||
const index = num.indexOf('.')
|
||||
if (index !== -1) {
|
||||
num = num.substring(0, decimal + index + 1)
|
||||
} else {
|
||||
num = num.substring(0)
|
||||
}
|
||||
|
||||
//截取后保留两位小数
|
||||
return parseFloat(num).toFixed(decimal)
|
||||
}
|
||||
}
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
import SparkMD5 from 'spark-md5';
|
||||
|
||||
module.exports = {
|
||||
generateUUID:function(data) {
|
||||
let formatData = "";
|
||||
let date = new Date();
|
||||
let time = date.getFullYear()+""+date.getMonth()+""+date.getDay();
|
||||
if ('string' == (typeof data)) {
|
||||
formatData = time + data;
|
||||
}
|
||||
if ('object' == (typeof data) && data instanceof Array) {
|
||||
formatData = time + JSON.stringify(data);
|
||||
}
|
||||
console.log("formatData", formatData);
|
||||
console.log("SparkMD5.hash(data)", SparkMD5.hash(formatData));
|
||||
return SparkMD5.hash(formatData);
|
||||
}
|
||||
}
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
export default { versionName: '6.3.0.43', versionCode:63043 }
|
||||
Reference in new issue
Block a user