if (typeof Promise !== "undefined" && !Promise.prototype.finally) {
|
Promise.prototype.finally = function(callback) {
|
const promise = this.constructor;
|
return this.then(
|
(value) => promise.resolve(callback()).then(() => value),
|
(reason) => promise.resolve(callback()).then(() => {
|
throw reason;
|
})
|
);
|
};
|
}
|
;
|
if (typeof uni !== "undefined" && uni && uni.requireGlobal) {
|
const global2 = uni.requireGlobal();
|
ArrayBuffer = global2.ArrayBuffer;
|
Int8Array = global2.Int8Array;
|
Uint8Array = global2.Uint8Array;
|
Uint8ClampedArray = global2.Uint8ClampedArray;
|
Int16Array = global2.Int16Array;
|
Uint16Array = global2.Uint16Array;
|
Int32Array = global2.Int32Array;
|
Uint32Array = global2.Uint32Array;
|
Float32Array = global2.Float32Array;
|
Float64Array = global2.Float64Array;
|
BigInt64Array = global2.BigInt64Array;
|
BigUint64Array = global2.BigUint64Array;
|
}
|
;
|
if (uni.restoreGlobal) {
|
uni.restoreGlobal(Vue, weex, plus, setTimeout, clearTimeout, setInterval, clearInterval);
|
}
|
(function(vue) {
|
"use strict";
|
const ON_LOAD = "onLoad";
|
function requireNativePlugin(name) {
|
return weex.requireModule(name);
|
}
|
function formatAppLog(type, filename, ...args) {
|
if (uni.__log__) {
|
uni.__log__(type, filename, ...args);
|
} else {
|
console[type].apply(console, [...args, filename]);
|
}
|
}
|
function resolveEasycom(component, easycom2) {
|
return typeof component === "string" ? easycom2 : component;
|
}
|
const createLifeCycleHook = (lifecycle, flag = 0) => (hook, target = vue.getCurrentInstance()) => {
|
!vue.isInSSRComponentSetup && vue.injectHook(lifecycle, hook, target);
|
};
|
const onLoad = /* @__PURE__ */ createLifeCycleHook(
|
ON_LOAD,
|
2
|
/* HookFlags.PAGE */
|
);
|
const easycom = {
|
autoscan: true,
|
custom: {
|
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
|
}
|
};
|
const pages = [
|
{
|
path: "pages/index/index",
|
style: {
|
navigationBarTitleText: "NorthGlass Scaner"
|
}
|
},
|
{
|
path: "pages/mainView/mainView",
|
style: {
|
navigationBarTitleText: ""
|
}
|
},
|
{
|
path: "pages/reportingWork/reportingWork",
|
style: {
|
navigationBarTitleText: "Report for work"
|
}
|
},
|
{
|
path: "pages/glassInfo/glassInfo",
|
style: {
|
navigationBarTitleText: ""
|
}
|
},
|
{
|
path: "pages/QuantityCompletion/QuantityCompletion",
|
style: {
|
navigationBarTitleText: ""
|
}
|
},
|
{
|
path: "pages/ReviewReporitingWork/ReviewReporitingWork",
|
style: {
|
navigationBarTitleText: ""
|
}
|
},
|
{
|
path: "pages/ReportingWorkList/ReportingWorkList",
|
style: {
|
navigationBarTitleText: ""
|
}
|
},
|
{
|
path: "pages/login/login",
|
style: {
|
navigationBarTitleText: ""
|
}
|
},
|
{
|
path: "pages/statement/orderList",
|
style: {
|
navigationBarTitleText: ""
|
}
|
},
|
{
|
path: "pages/statement/deliveryList",
|
style: {
|
navigationBarTitleText: ""
|
}
|
},
|
{
|
path: "pages/statement/originalGlassList",
|
style: {
|
navigationBarTitleText: ""
|
}
|
},
|
{
|
path: "pages/glassFinishToStore/glassFinishToStore",
|
style: {
|
navigationBarTitleText: ""
|
}
|
}
|
];
|
const globalStyle = {
|
navigationBarTextStyle: "black",
|
navigationBarTitleText: "uni-app",
|
navigationBarBackgroundColor: "#F8F8F8",
|
backgroundColor: "#F8F8F8"
|
};
|
const uniIdRouter = {};
|
const e = {
|
easycom,
|
pages,
|
globalStyle,
|
uniIdRouter
|
};
|
var define_process_env_UNI_SECURE_NETWORK_CONFIG_default = [];
|
function t$4(e2) {
|
return e2 && e2.__esModule && Object.prototype.hasOwnProperty.call(e2, "default") ? e2.default : e2;
|
}
|
function n(e2, t2, n2) {
|
return e2(n2 = { path: t2, exports: {}, require: function(e3, t3) {
|
return function() {
|
throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
|
}(null == t3 && n2.path);
|
} }, n2.exports), n2.exports;
|
}
|
var s = n(function(e2, t2) {
|
var n2;
|
e2.exports = (n2 = n2 || function(e3, t3) {
|
var n3 = Object.create || /* @__PURE__ */ function() {
|
function e4() {
|
}
|
return function(t4) {
|
var n4;
|
return e4.prototype = t4, n4 = new e4(), e4.prototype = null, n4;
|
};
|
}(), s2 = {}, r2 = s2.lib = {}, i2 = r2.Base = { extend: function(e4) {
|
var t4 = n3(this);
|
return e4 && t4.mixIn(e4), t4.hasOwnProperty("init") && this.init !== t4.init || (t4.init = function() {
|
t4.$super.init.apply(this, arguments);
|
}), t4.init.prototype = t4, t4.$super = this, t4;
|
}, create: function() {
|
var e4 = this.extend();
|
return e4.init.apply(e4, arguments), e4;
|
}, init: function() {
|
}, mixIn: function(e4) {
|
for (var t4 in e4)
|
e4.hasOwnProperty(t4) && (this[t4] = e4[t4]);
|
e4.hasOwnProperty("toString") && (this.toString = e4.toString);
|
}, clone: function() {
|
return this.init.prototype.extend(this);
|
} }, o2 = r2.WordArray = i2.extend({ init: function(e4, n4) {
|
e4 = this.words = e4 || [], this.sigBytes = n4 != t3 ? n4 : 4 * e4.length;
|
}, toString: function(e4) {
|
return (e4 || c2).stringify(this);
|
}, concat: function(e4) {
|
var t4 = this.words, n4 = e4.words, s3 = this.sigBytes, r3 = e4.sigBytes;
|
if (this.clamp(), s3 % 4)
|
for (var i3 = 0; i3 < r3; i3++) {
|
var o3 = n4[i3 >>> 2] >>> 24 - i3 % 4 * 8 & 255;
|
t4[s3 + i3 >>> 2] |= o3 << 24 - (s3 + i3) % 4 * 8;
|
}
|
else
|
for (i3 = 0; i3 < r3; i3 += 4)
|
t4[s3 + i3 >>> 2] = n4[i3 >>> 2];
|
return this.sigBytes += r3, this;
|
}, clamp: function() {
|
var t4 = this.words, n4 = this.sigBytes;
|
t4[n4 >>> 2] &= 4294967295 << 32 - n4 % 4 * 8, t4.length = e3.ceil(n4 / 4);
|
}, clone: function() {
|
var e4 = i2.clone.call(this);
|
return e4.words = this.words.slice(0), e4;
|
}, random: function(t4) {
|
for (var n4, s3 = [], r3 = function(t5) {
|
var n5 = 987654321, s4 = 4294967295;
|
return function() {
|
var r4 = ((n5 = 36969 * (65535 & n5) + (n5 >> 16) & s4) << 16) + (t5 = 18e3 * (65535 & t5) + (t5 >> 16) & s4) & s4;
|
return r4 /= 4294967296, (r4 += 0.5) * (e3.random() > 0.5 ? 1 : -1);
|
};
|
}, i3 = 0; i3 < t4; i3 += 4) {
|
var a3 = r3(4294967296 * (n4 || e3.random()));
|
n4 = 987654071 * a3(), s3.push(4294967296 * a3() | 0);
|
}
|
return new o2.init(s3, t4);
|
} }), a2 = s2.enc = {}, c2 = a2.Hex = { stringify: function(e4) {
|
for (var t4 = e4.words, n4 = e4.sigBytes, s3 = [], r3 = 0; r3 < n4; r3++) {
|
var i3 = t4[r3 >>> 2] >>> 24 - r3 % 4 * 8 & 255;
|
s3.push((i3 >>> 4).toString(16)), s3.push((15 & i3).toString(16));
|
}
|
return s3.join("");
|
}, parse: function(e4) {
|
for (var t4 = e4.length, n4 = [], s3 = 0; s3 < t4; s3 += 2)
|
n4[s3 >>> 3] |= parseInt(e4.substr(s3, 2), 16) << 24 - s3 % 8 * 4;
|
return new o2.init(n4, t4 / 2);
|
} }, u2 = a2.Latin1 = { stringify: function(e4) {
|
for (var t4 = e4.words, n4 = e4.sigBytes, s3 = [], r3 = 0; r3 < n4; r3++) {
|
var i3 = t4[r3 >>> 2] >>> 24 - r3 % 4 * 8 & 255;
|
s3.push(String.fromCharCode(i3));
|
}
|
return s3.join("");
|
}, parse: function(e4) {
|
for (var t4 = e4.length, n4 = [], s3 = 0; s3 < t4; s3++)
|
n4[s3 >>> 2] |= (255 & e4.charCodeAt(s3)) << 24 - s3 % 4 * 8;
|
return new o2.init(n4, t4);
|
} }, h2 = a2.Utf8 = { stringify: function(e4) {
|
try {
|
return decodeURIComponent(escape(u2.stringify(e4)));
|
} catch (e5) {
|
throw new Error("Malformed UTF-8 data");
|
}
|
}, parse: function(e4) {
|
return u2.parse(unescape(encodeURIComponent(e4)));
|
} }, l2 = r2.BufferedBlockAlgorithm = i2.extend({ reset: function() {
|
this._data = new o2.init(), this._nDataBytes = 0;
|
}, _append: function(e4) {
|
"string" == typeof e4 && (e4 = h2.parse(e4)), this._data.concat(e4), this._nDataBytes += e4.sigBytes;
|
}, _process: function(t4) {
|
var n4 = this._data, s3 = n4.words, r3 = n4.sigBytes, i3 = this.blockSize, a3 = r3 / (4 * i3), c3 = (a3 = t4 ? e3.ceil(a3) : e3.max((0 | a3) - this._minBufferSize, 0)) * i3, u3 = e3.min(4 * c3, r3);
|
if (c3) {
|
for (var h3 = 0; h3 < c3; h3 += i3)
|
this._doProcessBlock(s3, h3);
|
var l3 = s3.splice(0, c3);
|
n4.sigBytes -= u3;
|
}
|
return new o2.init(l3, u3);
|
}, clone: function() {
|
var e4 = i2.clone.call(this);
|
return e4._data = this._data.clone(), e4;
|
}, _minBufferSize: 0 });
|
r2.Hasher = l2.extend({ cfg: i2.extend(), init: function(e4) {
|
this.cfg = this.cfg.extend(e4), this.reset();
|
}, reset: function() {
|
l2.reset.call(this), this._doReset();
|
}, update: function(e4) {
|
return this._append(e4), this._process(), this;
|
}, finalize: function(e4) {
|
return e4 && this._append(e4), this._doFinalize();
|
}, blockSize: 16, _createHelper: function(e4) {
|
return function(t4, n4) {
|
return new e4.init(n4).finalize(t4);
|
};
|
}, _createHmacHelper: function(e4) {
|
return function(t4, n4) {
|
return new d2.HMAC.init(e4, n4).finalize(t4);
|
};
|
} });
|
var d2 = s2.algo = {};
|
return s2;
|
}(Math), n2);
|
}), r = s, i = (n(function(e2, t2) {
|
var n2;
|
e2.exports = (n2 = r, function(e3) {
|
var t3 = n2, s2 = t3.lib, r2 = s2.WordArray, i2 = s2.Hasher, o2 = t3.algo, a2 = [];
|
!function() {
|
for (var t4 = 0; t4 < 64; t4++)
|
a2[t4] = 4294967296 * e3.abs(e3.sin(t4 + 1)) | 0;
|
}();
|
var c2 = o2.MD5 = i2.extend({ _doReset: function() {
|
this._hash = new r2.init([1732584193, 4023233417, 2562383102, 271733878]);
|
}, _doProcessBlock: function(e4, t4) {
|
for (var n3 = 0; n3 < 16; n3++) {
|
var s3 = t4 + n3, r3 = e4[s3];
|
e4[s3] = 16711935 & (r3 << 8 | r3 >>> 24) | 4278255360 & (r3 << 24 | r3 >>> 8);
|
}
|
var i3 = this._hash.words, o3 = e4[t4 + 0], c3 = e4[t4 + 1], p2 = e4[t4 + 2], f2 = e4[t4 + 3], g2 = e4[t4 + 4], m2 = e4[t4 + 5], y2 = e4[t4 + 6], _2 = e4[t4 + 7], w2 = e4[t4 + 8], I2 = e4[t4 + 9], v2 = e4[t4 + 10], S2 = e4[t4 + 11], T2 = e4[t4 + 12], b2 = e4[t4 + 13], E2 = e4[t4 + 14], k2 = e4[t4 + 15], A2 = i3[0], P2 = i3[1], C2 = i3[2], O2 = i3[3];
|
A2 = u2(A2, P2, C2, O2, o3, 7, a2[0]), O2 = u2(O2, A2, P2, C2, c3, 12, a2[1]), C2 = u2(C2, O2, A2, P2, p2, 17, a2[2]), P2 = u2(P2, C2, O2, A2, f2, 22, a2[3]), A2 = u2(A2, P2, C2, O2, g2, 7, a2[4]), O2 = u2(O2, A2, P2, C2, m2, 12, a2[5]), C2 = u2(C2, O2, A2, P2, y2, 17, a2[6]), P2 = u2(P2, C2, O2, A2, _2, 22, a2[7]), A2 = u2(A2, P2, C2, O2, w2, 7, a2[8]), O2 = u2(O2, A2, P2, C2, I2, 12, a2[9]), C2 = u2(C2, O2, A2, P2, v2, 17, a2[10]), P2 = u2(P2, C2, O2, A2, S2, 22, a2[11]), A2 = u2(A2, P2, C2, O2, T2, 7, a2[12]), O2 = u2(O2, A2, P2, C2, b2, 12, a2[13]), C2 = u2(C2, O2, A2, P2, E2, 17, a2[14]), A2 = h2(A2, P2 = u2(P2, C2, O2, A2, k2, 22, a2[15]), C2, O2, c3, 5, a2[16]), O2 = h2(O2, A2, P2, C2, y2, 9, a2[17]), C2 = h2(C2, O2, A2, P2, S2, 14, a2[18]), P2 = h2(P2, C2, O2, A2, o3, 20, a2[19]), A2 = h2(A2, P2, C2, O2, m2, 5, a2[20]), O2 = h2(O2, A2, P2, C2, v2, 9, a2[21]), C2 = h2(C2, O2, A2, P2, k2, 14, a2[22]), P2 = h2(P2, C2, O2, A2, g2, 20, a2[23]), A2 = h2(A2, P2, C2, O2, I2, 5, a2[24]), O2 = h2(O2, A2, P2, C2, E2, 9, a2[25]), C2 = h2(C2, O2, A2, P2, f2, 14, a2[26]), P2 = h2(P2, C2, O2, A2, w2, 20, a2[27]), A2 = h2(A2, P2, C2, O2, b2, 5, a2[28]), O2 = h2(O2, A2, P2, C2, p2, 9, a2[29]), C2 = h2(C2, O2, A2, P2, _2, 14, a2[30]), A2 = l2(A2, P2 = h2(P2, C2, O2, A2, T2, 20, a2[31]), C2, O2, m2, 4, a2[32]), O2 = l2(O2, A2, P2, C2, w2, 11, a2[33]), C2 = l2(C2, O2, A2, P2, S2, 16, a2[34]), P2 = l2(P2, C2, O2, A2, E2, 23, a2[35]), A2 = l2(A2, P2, C2, O2, c3, 4, a2[36]), O2 = l2(O2, A2, P2, C2, g2, 11, a2[37]), C2 = l2(C2, O2, A2, P2, _2, 16, a2[38]), P2 = l2(P2, C2, O2, A2, v2, 23, a2[39]), A2 = l2(A2, P2, C2, O2, b2, 4, a2[40]), O2 = l2(O2, A2, P2, C2, o3, 11, a2[41]), C2 = l2(C2, O2, A2, P2, f2, 16, a2[42]), P2 = l2(P2, C2, O2, A2, y2, 23, a2[43]), A2 = l2(A2, P2, C2, O2, I2, 4, a2[44]), O2 = l2(O2, A2, P2, C2, T2, 11, a2[45]), C2 = l2(C2, O2, A2, P2, k2, 16, a2[46]), A2 = d2(A2, P2 = l2(P2, C2, O2, A2, p2, 23, a2[47]), C2, O2, o3, 6, a2[48]), O2 = d2(O2, A2, P2, C2, _2, 10, a2[49]), C2 = d2(C2, O2, A2, P2, E2, 15, a2[50]), P2 = d2(P2, C2, O2, A2, m2, 21, a2[51]), A2 = d2(A2, P2, C2, O2, T2, 6, a2[52]), O2 = d2(O2, A2, P2, C2, f2, 10, a2[53]), C2 = d2(C2, O2, A2, P2, v2, 15, a2[54]), P2 = d2(P2, C2, O2, A2, c3, 21, a2[55]), A2 = d2(A2, P2, C2, O2, w2, 6, a2[56]), O2 = d2(O2, A2, P2, C2, k2, 10, a2[57]), C2 = d2(C2, O2, A2, P2, y2, 15, a2[58]), P2 = d2(P2, C2, O2, A2, b2, 21, a2[59]), A2 = d2(A2, P2, C2, O2, g2, 6, a2[60]), O2 = d2(O2, A2, P2, C2, S2, 10, a2[61]), C2 = d2(C2, O2, A2, P2, p2, 15, a2[62]), P2 = d2(P2, C2, O2, A2, I2, 21, a2[63]), i3[0] = i3[0] + A2 | 0, i3[1] = i3[1] + P2 | 0, i3[2] = i3[2] + C2 | 0, i3[3] = i3[3] + O2 | 0;
|
}, _doFinalize: function() {
|
var t4 = this._data, n3 = t4.words, s3 = 8 * this._nDataBytes, r3 = 8 * t4.sigBytes;
|
n3[r3 >>> 5] |= 128 << 24 - r3 % 32;
|
var i3 = e3.floor(s3 / 4294967296), o3 = s3;
|
n3[15 + (r3 + 64 >>> 9 << 4)] = 16711935 & (i3 << 8 | i3 >>> 24) | 4278255360 & (i3 << 24 | i3 >>> 8), n3[14 + (r3 + 64 >>> 9 << 4)] = 16711935 & (o3 << 8 | o3 >>> 24) | 4278255360 & (o3 << 24 | o3 >>> 8), t4.sigBytes = 4 * (n3.length + 1), this._process();
|
for (var a3 = this._hash, c3 = a3.words, u3 = 0; u3 < 4; u3++) {
|
var h3 = c3[u3];
|
c3[u3] = 16711935 & (h3 << 8 | h3 >>> 24) | 4278255360 & (h3 << 24 | h3 >>> 8);
|
}
|
return a3;
|
}, clone: function() {
|
var e4 = i2.clone.call(this);
|
return e4._hash = this._hash.clone(), e4;
|
} });
|
function u2(e4, t4, n3, s3, r3, i3, o3) {
|
var a3 = e4 + (t4 & n3 | ~t4 & s3) + r3 + o3;
|
return (a3 << i3 | a3 >>> 32 - i3) + t4;
|
}
|
function h2(e4, t4, n3, s3, r3, i3, o3) {
|
var a3 = e4 + (t4 & s3 | n3 & ~s3) + r3 + o3;
|
return (a3 << i3 | a3 >>> 32 - i3) + t4;
|
}
|
function l2(e4, t4, n3, s3, r3, i3, o3) {
|
var a3 = e4 + (t4 ^ n3 ^ s3) + r3 + o3;
|
return (a3 << i3 | a3 >>> 32 - i3) + t4;
|
}
|
function d2(e4, t4, n3, s3, r3, i3, o3) {
|
var a3 = e4 + (n3 ^ (t4 | ~s3)) + r3 + o3;
|
return (a3 << i3 | a3 >>> 32 - i3) + t4;
|
}
|
t3.MD5 = i2._createHelper(c2), t3.HmacMD5 = i2._createHmacHelper(c2);
|
}(Math), n2.MD5);
|
}), n(function(e2, t2) {
|
var n2;
|
e2.exports = (n2 = r, void function() {
|
var e3 = n2, t3 = e3.lib.Base, s2 = e3.enc.Utf8;
|
e3.algo.HMAC = t3.extend({ init: function(e4, t4) {
|
e4 = this._hasher = new e4.init(), "string" == typeof t4 && (t4 = s2.parse(t4));
|
var n3 = e4.blockSize, r2 = 4 * n3;
|
t4.sigBytes > r2 && (t4 = e4.finalize(t4)), t4.clamp();
|
for (var i2 = this._oKey = t4.clone(), o2 = this._iKey = t4.clone(), a2 = i2.words, c2 = o2.words, u2 = 0; u2 < n3; u2++)
|
a2[u2] ^= 1549556828, c2[u2] ^= 909522486;
|
i2.sigBytes = o2.sigBytes = r2, this.reset();
|
}, reset: function() {
|
var e4 = this._hasher;
|
e4.reset(), e4.update(this._iKey);
|
}, update: function(e4) {
|
return this._hasher.update(e4), this;
|
}, finalize: function(e4) {
|
var t4 = this._hasher, n3 = t4.finalize(e4);
|
return t4.reset(), t4.finalize(this._oKey.clone().concat(n3));
|
} });
|
}());
|
}), n(function(e2, t2) {
|
e2.exports = r.HmacMD5;
|
})), o = n(function(e2, t2) {
|
e2.exports = r.enc.Utf8;
|
}), a = n(function(e2, t2) {
|
var n2;
|
e2.exports = (n2 = r, function() {
|
var e3 = n2, t3 = e3.lib.WordArray;
|
function s2(e4, n3, s3) {
|
for (var r2 = [], i2 = 0, o2 = 0; o2 < n3; o2++)
|
if (o2 % 4) {
|
var a2 = s3[e4.charCodeAt(o2 - 1)] << o2 % 4 * 2, c2 = s3[e4.charCodeAt(o2)] >>> 6 - o2 % 4 * 2;
|
r2[i2 >>> 2] |= (a2 | c2) << 24 - i2 % 4 * 8, i2++;
|
}
|
return t3.create(r2, i2);
|
}
|
e3.enc.Base64 = { stringify: function(e4) {
|
var t4 = e4.words, n3 = e4.sigBytes, s3 = this._map;
|
e4.clamp();
|
for (var r2 = [], i2 = 0; i2 < n3; i2 += 3)
|
for (var o2 = (t4[i2 >>> 2] >>> 24 - i2 % 4 * 8 & 255) << 16 | (t4[i2 + 1 >>> 2] >>> 24 - (i2 + 1) % 4 * 8 & 255) << 8 | t4[i2 + 2 >>> 2] >>> 24 - (i2 + 2) % 4 * 8 & 255, a2 = 0; a2 < 4 && i2 + 0.75 * a2 < n3; a2++)
|
r2.push(s3.charAt(o2 >>> 6 * (3 - a2) & 63));
|
var c2 = s3.charAt(64);
|
if (c2)
|
for (; r2.length % 4; )
|
r2.push(c2);
|
return r2.join("");
|
}, parse: function(e4) {
|
var t4 = e4.length, n3 = this._map, r2 = this._reverseMap;
|
if (!r2) {
|
r2 = this._reverseMap = [];
|
for (var i2 = 0; i2 < n3.length; i2++)
|
r2[n3.charCodeAt(i2)] = i2;
|
}
|
var o2 = n3.charAt(64);
|
if (o2) {
|
var a2 = e4.indexOf(o2);
|
-1 !== a2 && (t4 = a2);
|
}
|
return s2(e4, t4, r2);
|
}, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" };
|
}(), n2.enc.Base64);
|
});
|
const c = "uni_id_token", u = "uni_id_token_expired", h = "uniIdToken", l = { DEFAULT: "FUNCTION", FUNCTION: "FUNCTION", OBJECT: "OBJECT", CLIENT_DB: "CLIENT_DB" }, d = "pending", p = "fulfilled", f = "rejected";
|
function g(e2) {
|
return Object.prototype.toString.call(e2).slice(8, -1).toLowerCase();
|
}
|
function m(e2) {
|
return "object" === g(e2);
|
}
|
function y(e2) {
|
return "function" == typeof e2;
|
}
|
function _(e2) {
|
return function() {
|
try {
|
return e2.apply(e2, arguments);
|
} catch (e3) {
|
console.error(e3);
|
}
|
};
|
}
|
const w = "REJECTED", I = "NOT_PENDING";
|
class v {
|
constructor({ createPromise: e2, retryRule: t2 = w } = {}) {
|
this.createPromise = e2, this.status = null, this.promise = null, this.retryRule = t2;
|
}
|
get needRetry() {
|
if (!this.status)
|
return true;
|
switch (this.retryRule) {
|
case w:
|
return this.status === f;
|
case I:
|
return this.status !== d;
|
}
|
}
|
exec() {
|
return this.needRetry ? (this.status = d, this.promise = this.createPromise().then((e2) => (this.status = p, Promise.resolve(e2)), (e2) => (this.status = f, Promise.reject(e2))), this.promise) : this.promise;
|
}
|
}
|
class S {
|
constructor() {
|
this._callback = {};
|
}
|
addListener(e2, t2) {
|
this._callback[e2] || (this._callback[e2] = []), this._callback[e2].push(t2);
|
}
|
on(e2, t2) {
|
return this.addListener(e2, t2);
|
}
|
removeListener(e2, t2) {
|
if (!t2)
|
throw new Error('The "listener" argument must be of type function. Received undefined');
|
const n2 = this._callback[e2];
|
if (!n2)
|
return;
|
const s2 = function(e3, t3) {
|
for (let n3 = e3.length - 1; n3 >= 0; n3--)
|
if (e3[n3] === t3)
|
return n3;
|
return -1;
|
}(n2, t2);
|
n2.splice(s2, 1);
|
}
|
off(e2, t2) {
|
return this.removeListener(e2, t2);
|
}
|
removeAllListener(e2) {
|
delete this._callback[e2];
|
}
|
emit(e2, ...t2) {
|
const n2 = this._callback[e2];
|
if (n2)
|
for (let e3 = 0; e3 < n2.length; e3++)
|
n2[e3](...t2);
|
}
|
}
|
function T(e2) {
|
return e2 && "string" == typeof e2 ? JSON.parse(e2) : e2;
|
}
|
const b = true, E = "app", A = T(define_process_env_UNI_SECURE_NETWORK_CONFIG_default), P = E, C = T(""), O = T("[]") || [];
|
let N = "";
|
try {
|
N = "__UNI__C4E0C89";
|
} catch (e2) {
|
}
|
let R, L = {};
|
function U(e2, t2 = {}) {
|
var n2, s2;
|
return n2 = L, s2 = e2, Object.prototype.hasOwnProperty.call(n2, s2) || (L[e2] = t2), L[e2];
|
}
|
function D() {
|
return R || (R = function() {
|
if ("undefined" != typeof globalThis)
|
return globalThis;
|
if ("undefined" != typeof self)
|
return self;
|
if ("undefined" != typeof window)
|
return window;
|
function e2() {
|
return this;
|
}
|
return void 0 !== e2() ? e2() : new Function("return this")();
|
}(), R);
|
}
|
L = uni._globalUniCloudObj ? uni._globalUniCloudObj : uni._globalUniCloudObj = {};
|
const M = ["invoke", "success", "fail", "complete"], q = U("_globalUniCloudInterceptor");
|
function F(e2, t2) {
|
q[e2] || (q[e2] = {}), m(t2) && Object.keys(t2).forEach((n2) => {
|
M.indexOf(n2) > -1 && function(e3, t3, n3) {
|
let s2 = q[e3][t3];
|
s2 || (s2 = q[e3][t3] = []), -1 === s2.indexOf(n3) && y(n3) && s2.push(n3);
|
}(e2, n2, t2[n2]);
|
});
|
}
|
function K(e2, t2) {
|
q[e2] || (q[e2] = {}), m(t2) ? Object.keys(t2).forEach((n2) => {
|
M.indexOf(n2) > -1 && function(e3, t3, n3) {
|
const s2 = q[e3][t3];
|
if (!s2)
|
return;
|
const r2 = s2.indexOf(n3);
|
r2 > -1 && s2.splice(r2, 1);
|
}(e2, n2, t2[n2]);
|
}) : delete q[e2];
|
}
|
function j(e2, t2) {
|
return e2 && 0 !== e2.length ? e2.reduce((e3, n2) => e3.then(() => n2(t2)), Promise.resolve()) : Promise.resolve();
|
}
|
function $(e2, t2) {
|
return q[e2] && q[e2][t2] || [];
|
}
|
function B(e2) {
|
F("callObject", e2);
|
}
|
const W = U("_globalUniCloudListener"), H = { RESPONSE: "response", NEED_LOGIN: "needLogin", REFRESH_TOKEN: "refreshToken" }, J = { CLIENT_DB: "clientdb", CLOUD_FUNCTION: "cloudfunction", CLOUD_OBJECT: "cloudobject" };
|
function z(e2) {
|
return W[e2] || (W[e2] = []), W[e2];
|
}
|
function V(e2, t2) {
|
const n2 = z(e2);
|
n2.includes(t2) || n2.push(t2);
|
}
|
function G(e2, t2) {
|
const n2 = z(e2), s2 = n2.indexOf(t2);
|
-1 !== s2 && n2.splice(s2, 1);
|
}
|
function Y(e2, t2) {
|
const n2 = z(e2);
|
for (let e3 = 0; e3 < n2.length; e3++) {
|
(0, n2[e3])(t2);
|
}
|
}
|
let Q, X = false;
|
function Z() {
|
return Q || (Q = new Promise((e2) => {
|
X && e2(), function t2() {
|
if ("function" == typeof getCurrentPages) {
|
const t3 = getCurrentPages();
|
t3 && t3[0] && (X = true, e2());
|
}
|
X || setTimeout(() => {
|
t2();
|
}, 30);
|
}();
|
}), Q);
|
}
|
function ee(e2) {
|
const t2 = {};
|
for (const n2 in e2) {
|
const s2 = e2[n2];
|
y(s2) && (t2[n2] = _(s2));
|
}
|
return t2;
|
}
|
class te extends Error {
|
constructor(e2) {
|
const t2 = e2.message || e2.errMsg || "unknown system error";
|
super(t2), this.errMsg = t2, this.code = this.errCode = e2.code || e2.errCode || "SYSTEM_ERROR", this.errSubject = this.subject = e2.subject || e2.errSubject, this.cause = e2.cause, this.requestId = e2.requestId;
|
}
|
toJson(e2 = 0) {
|
if (!(e2 >= 10))
|
return e2++, { errCode: this.errCode, errMsg: this.errMsg, errSubject: this.errSubject, cause: this.cause && this.cause.toJson ? this.cause.toJson(e2) : this.cause };
|
}
|
}
|
var ne = { request: (e2) => uni.request(e2), uploadFile: (e2) => uni.uploadFile(e2), setStorageSync: (e2, t2) => uni.setStorageSync(e2, t2), getStorageSync: (e2) => uni.getStorageSync(e2), removeStorageSync: (e2) => uni.removeStorageSync(e2), clearStorageSync: () => uni.clearStorageSync(), connectSocket: (e2) => uni.connectSocket(e2) };
|
function se(e2) {
|
return e2 && se(e2.__v_raw) || e2;
|
}
|
function re() {
|
return { token: ne.getStorageSync(c) || ne.getStorageSync(h), tokenExpired: ne.getStorageSync(u) };
|
}
|
function ie({ token: e2, tokenExpired: t2 } = {}) {
|
e2 && ne.setStorageSync(c, e2), t2 && ne.setStorageSync(u, t2);
|
}
|
let oe, ae;
|
function ce() {
|
return oe || (oe = uni.getSystemInfoSync()), oe;
|
}
|
function ue() {
|
let e2, t2;
|
try {
|
if (uni.getLaunchOptionsSync) {
|
if (uni.getLaunchOptionsSync.toString().indexOf("not yet implemented") > -1)
|
return;
|
const { scene: n2, channel: s2 } = uni.getLaunchOptionsSync();
|
e2 = s2, t2 = n2;
|
}
|
} catch (e3) {
|
}
|
return { channel: e2, scene: t2 };
|
}
|
let he = {};
|
function le() {
|
const e2 = uni.getLocale && uni.getLocale() || "en";
|
if (ae)
|
return { ...he, ...ae, locale: e2, LOCALE: e2 };
|
const t2 = ce(), { deviceId: n2, osName: s2, uniPlatform: r2, appId: i2 } = t2, o2 = ["appId", "appLanguage", "appName", "appVersion", "appVersionCode", "appWgtVersion", "browserName", "browserVersion", "deviceBrand", "deviceId", "deviceModel", "deviceType", "osName", "osVersion", "romName", "romVersion", "ua", "hostName", "hostVersion", "uniPlatform", "uniRuntimeVersion", "uniRuntimeVersionCode", "uniCompilerVersion", "uniCompilerVersionCode"];
|
for (const e3 in t2)
|
Object.hasOwnProperty.call(t2, e3) && -1 === o2.indexOf(e3) && delete t2[e3];
|
return ae = { PLATFORM: r2, OS: s2, APPID: i2, DEVICEID: n2, ...ue(), ...t2 }, { ...he, ...ae, locale: e2, LOCALE: e2 };
|
}
|
var de = { sign: function(e2, t2) {
|
let n2 = "";
|
return Object.keys(e2).sort().forEach(function(t3) {
|
e2[t3] && (n2 = n2 + "&" + t3 + "=" + e2[t3]);
|
}), n2 = n2.slice(1), i(n2, t2).toString();
|
}, wrappedRequest: function(e2, t2) {
|
return new Promise((n2, s2) => {
|
t2(Object.assign(e2, { complete(e3) {
|
e3 || (e3 = {});
|
const t3 = e3.data && e3.data.header && e3.data.header["x-serverless-request-id"] || e3.header && e3.header["request-id"];
|
if (!e3.statusCode || e3.statusCode >= 400) {
|
const n3 = e3.data && e3.data.error && e3.data.error.code || "SYS_ERR", r3 = e3.data && e3.data.error && e3.data.error.message || e3.errMsg || "request:fail";
|
return s2(new te({ code: n3, message: r3, requestId: t3 }));
|
}
|
const r2 = e3.data;
|
if (r2.error)
|
return s2(new te({ code: r2.error.code, message: r2.error.message, requestId: t3 }));
|
r2.result = r2.data, r2.requestId = t3, delete r2.data, n2(r2);
|
} }));
|
});
|
}, toBase64: function(e2) {
|
return a.stringify(o.parse(e2));
|
} };
|
var pe = class {
|
constructor(e2) {
|
["spaceId", "clientSecret"].forEach((t2) => {
|
if (!Object.prototype.hasOwnProperty.call(e2, t2))
|
throw new Error(`${t2} required`);
|
}), this.config = Object.assign({}, { endpoint: 0 === e2.spaceId.indexOf("mp-") ? "https://api.next.bspapp.com" : "https://api.bspapp.com" }, e2), this.config.provider = "aliyun", this.config.requestUrl = this.config.endpoint + "/client", this.config.envType = this.config.envType || "public", this.config.accessTokenKey = "access_token_" + this.config.spaceId, this.adapter = ne, this._getAccessTokenPromiseHub = new v({ createPromise: () => this.requestAuth(this.setupRequest({ method: "serverless.auth.user.anonymousAuthorize", params: "{}" }, "auth")).then((e3) => {
|
if (!e3.result || !e3.result.accessToken)
|
throw new te({ code: "AUTH_FAILED", message: "获取accessToken失败" });
|
this.setAccessToken(e3.result.accessToken);
|
}), retryRule: I });
|
}
|
get hasAccessToken() {
|
return !!this.accessToken;
|
}
|
setAccessToken(e2) {
|
this.accessToken = e2;
|
}
|
requestWrapped(e2) {
|
return de.wrappedRequest(e2, this.adapter.request);
|
}
|
requestAuth(e2) {
|
return this.requestWrapped(e2);
|
}
|
request(e2, t2) {
|
return Promise.resolve().then(() => this.hasAccessToken ? t2 ? this.requestWrapped(e2) : this.requestWrapped(e2).catch((t3) => new Promise((e3, n2) => {
|
!t3 || "GATEWAY_INVALID_TOKEN" !== t3.code && "InvalidParameter.InvalidToken" !== t3.code ? n2(t3) : e3();
|
}).then(() => this.getAccessToken()).then(() => {
|
const t4 = this.rebuildRequest(e2);
|
return this.request(t4, true);
|
})) : this.getAccessToken().then(() => {
|
const t3 = this.rebuildRequest(e2);
|
return this.request(t3, true);
|
}));
|
}
|
rebuildRequest(e2) {
|
const t2 = Object.assign({}, e2);
|
return t2.data.token = this.accessToken, t2.header["x-basement-token"] = this.accessToken, t2.header["x-serverless-sign"] = de.sign(t2.data, this.config.clientSecret), t2;
|
}
|
setupRequest(e2, t2) {
|
const n2 = Object.assign({}, e2, { spaceId: this.config.spaceId, timestamp: Date.now() }), s2 = { "Content-Type": "application/json" };
|
return "auth" !== t2 && (n2.token = this.accessToken, s2["x-basement-token"] = this.accessToken), s2["x-serverless-sign"] = de.sign(n2, this.config.clientSecret), { url: this.config.requestUrl, method: "POST", data: n2, dataType: "json", header: s2 };
|
}
|
getAccessToken() {
|
return this._getAccessTokenPromiseHub.exec();
|
}
|
async authorize() {
|
await this.getAccessToken();
|
}
|
callFunction(e2) {
|
const t2 = { method: "serverless.function.runtime.invoke", params: JSON.stringify({ functionTarget: e2.name, functionArgs: e2.data || {} }) };
|
return this.request({ ...this.setupRequest(t2), timeout: e2.timeout });
|
}
|
getOSSUploadOptionsFromPath(e2) {
|
const t2 = { method: "serverless.file.resource.generateProximalSign", params: JSON.stringify(e2) };
|
return this.request(this.setupRequest(t2));
|
}
|
uploadFileToOSS({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, onUploadProgress: i2 }) {
|
return new Promise((o2, a2) => {
|
const c2 = this.adapter.uploadFile({ url: e2, formData: t2, name: n2, filePath: s2, fileType: r2, header: { "X-OSS-server-side-encrpytion": "AES256" }, success(e3) {
|
e3 && e3.statusCode < 400 ? o2(e3) : a2(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
|
}, fail(e3) {
|
a2(new te({ code: e3.code || "UPLOAD_FAILED", message: e3.message || e3.errMsg || "文件上传失败" }));
|
} });
|
"function" == typeof i2 && c2 && "function" == typeof c2.onProgressUpdate && c2.onProgressUpdate((e3) => {
|
i2({ loaded: e3.totalBytesSent, total: e3.totalBytesExpectedToSend });
|
});
|
});
|
}
|
reportOSSUpload(e2) {
|
const t2 = { method: "serverless.file.resource.report", params: JSON.stringify(e2) };
|
return this.request(this.setupRequest(t2));
|
}
|
async uploadFile({ filePath: e2, cloudPath: t2, fileType: n2 = "image", cloudPathAsRealPath: s2 = false, onUploadProgress: r2, config: i2 }) {
|
if ("string" !== g(t2))
|
throw new te({ code: "INVALID_PARAM", message: "cloudPath必须为字符串类型" });
|
if (!(t2 = t2.trim()))
|
throw new te({ code: "INVALID_PARAM", message: "cloudPath不可为空" });
|
if (/:\/\//.test(t2))
|
throw new te({ code: "INVALID_PARAM", message: "cloudPath不合法" });
|
const o2 = i2 && i2.envType || this.config.envType;
|
if (s2 && ("/" !== t2[0] && (t2 = "/" + t2), t2.indexOf("\\") > -1))
|
throw new te({ code: "INVALID_PARAM", message: "使用cloudPath作为路径时,cloudPath不可包含“\\”" });
|
const a2 = (await this.getOSSUploadOptionsFromPath({ env: o2, filename: s2 ? t2.split("/").pop() : t2, fileId: s2 ? t2 : void 0 })).result, c2 = "https://" + a2.cdnDomain + "/" + a2.ossPath, { securityToken: u2, accessKeyId: h2, signature: l2, host: d2, ossPath: p2, id: f2, policy: m2, ossCallbackUrl: y2 } = a2, _2 = { "Cache-Control": "max-age=2592000", "Content-Disposition": "attachment", OSSAccessKeyId: h2, Signature: l2, host: d2, id: f2, key: p2, policy: m2, success_action_status: 200 };
|
if (u2 && (_2["x-oss-security-token"] = u2), y2) {
|
const e3 = JSON.stringify({ callbackUrl: y2, callbackBody: JSON.stringify({ fileId: f2, spaceId: this.config.spaceId }), callbackBodyType: "application/json" });
|
_2.callback = de.toBase64(e3);
|
}
|
const w2 = { url: "https://" + a2.host, formData: _2, fileName: "file", name: "file", filePath: e2, fileType: n2 };
|
if (await this.uploadFileToOSS(Object.assign({}, w2, { onUploadProgress: r2 })), y2)
|
return { success: true, filePath: e2, fileID: c2 };
|
if ((await this.reportOSSUpload({ id: f2 })).success)
|
return { success: true, filePath: e2, fileID: c2 };
|
throw new te({ code: "UPLOAD_FAILED", message: "文件上传失败" });
|
}
|
getTempFileURL({ fileList: e2 } = {}) {
|
return new Promise((t2, n2) => {
|
Array.isArray(e2) && 0 !== e2.length || n2(new te({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" })), this.getFileInfo({ fileList: e2 }).then((n3) => {
|
t2({ fileList: e2.map((e3, t3) => {
|
const s2 = n3.fileList[t3];
|
return { fileID: e3, tempFileURL: s2 && s2.url || e3 };
|
}) });
|
});
|
});
|
}
|
async getFileInfo({ fileList: e2 } = {}) {
|
if (!Array.isArray(e2) || 0 === e2.length)
|
throw new te({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" });
|
const t2 = { method: "serverless.file.resource.info", params: JSON.stringify({ id: e2.map((e3) => e3.split("?")[0]).join(",") }) };
|
return { fileList: (await this.request(this.setupRequest(t2))).result };
|
}
|
};
|
var fe = { init(e2) {
|
const t2 = new pe(e2), n2 = { signInAnonymously: function() {
|
return t2.authorize();
|
}, getLoginState: function() {
|
return Promise.resolve(false);
|
} };
|
return t2.auth = function() {
|
return n2;
|
}, t2.customAuth = t2.auth, t2;
|
} };
|
const ge = "undefined" != typeof location && "http:" === location.protocol ? "http:" : "https:";
|
var me;
|
!function(e2) {
|
e2.local = "local", e2.none = "none", e2.session = "session";
|
}(me || (me = {}));
|
var ye = function() {
|
}, _e = n(function(e2, t2) {
|
var n2;
|
e2.exports = (n2 = r, function(e3) {
|
var t3 = n2, s2 = t3.lib, r2 = s2.WordArray, i2 = s2.Hasher, o2 = t3.algo, a2 = [], c2 = [];
|
!function() {
|
function t4(t5) {
|
for (var n4 = e3.sqrt(t5), s4 = 2; s4 <= n4; s4++)
|
if (!(t5 % s4))
|
return false;
|
return true;
|
}
|
function n3(e4) {
|
return 4294967296 * (e4 - (0 | e4)) | 0;
|
}
|
for (var s3 = 2, r3 = 0; r3 < 64; )
|
t4(s3) && (r3 < 8 && (a2[r3] = n3(e3.pow(s3, 0.5))), c2[r3] = n3(e3.pow(s3, 1 / 3)), r3++), s3++;
|
}();
|
var u2 = [], h2 = o2.SHA256 = i2.extend({ _doReset: function() {
|
this._hash = new r2.init(a2.slice(0));
|
}, _doProcessBlock: function(e4, t4) {
|
for (var n3 = this._hash.words, s3 = n3[0], r3 = n3[1], i3 = n3[2], o3 = n3[3], a3 = n3[4], h3 = n3[5], l2 = n3[6], d2 = n3[7], p2 = 0; p2 < 64; p2++) {
|
if (p2 < 16)
|
u2[p2] = 0 | e4[t4 + p2];
|
else {
|
var f2 = u2[p2 - 15], g2 = (f2 << 25 | f2 >>> 7) ^ (f2 << 14 | f2 >>> 18) ^ f2 >>> 3, m2 = u2[p2 - 2], y2 = (m2 << 15 | m2 >>> 17) ^ (m2 << 13 | m2 >>> 19) ^ m2 >>> 10;
|
u2[p2] = g2 + u2[p2 - 7] + y2 + u2[p2 - 16];
|
}
|
var _2 = s3 & r3 ^ s3 & i3 ^ r3 & i3, w2 = (s3 << 30 | s3 >>> 2) ^ (s3 << 19 | s3 >>> 13) ^ (s3 << 10 | s3 >>> 22), I2 = d2 + ((a3 << 26 | a3 >>> 6) ^ (a3 << 21 | a3 >>> 11) ^ (a3 << 7 | a3 >>> 25)) + (a3 & h3 ^ ~a3 & l2) + c2[p2] + u2[p2];
|
d2 = l2, l2 = h3, h3 = a3, a3 = o3 + I2 | 0, o3 = i3, i3 = r3, r3 = s3, s3 = I2 + (w2 + _2) | 0;
|
}
|
n3[0] = n3[0] + s3 | 0, n3[1] = n3[1] + r3 | 0, n3[2] = n3[2] + i3 | 0, n3[3] = n3[3] + o3 | 0, n3[4] = n3[4] + a3 | 0, n3[5] = n3[5] + h3 | 0, n3[6] = n3[6] + l2 | 0, n3[7] = n3[7] + d2 | 0;
|
}, _doFinalize: function() {
|
var t4 = this._data, n3 = t4.words, s3 = 8 * this._nDataBytes, r3 = 8 * t4.sigBytes;
|
return n3[r3 >>> 5] |= 128 << 24 - r3 % 32, n3[14 + (r3 + 64 >>> 9 << 4)] = e3.floor(s3 / 4294967296), n3[15 + (r3 + 64 >>> 9 << 4)] = s3, t4.sigBytes = 4 * n3.length, this._process(), this._hash;
|
}, clone: function() {
|
var e4 = i2.clone.call(this);
|
return e4._hash = this._hash.clone(), e4;
|
} });
|
t3.SHA256 = i2._createHelper(h2), t3.HmacSHA256 = i2._createHmacHelper(h2);
|
}(Math), n2.SHA256);
|
}), we = _e, Ie = n(function(e2, t2) {
|
e2.exports = r.HmacSHA256;
|
});
|
const ve = () => {
|
let e2;
|
if (!Promise) {
|
e2 = () => {
|
}, e2.promise = {};
|
const t3 = () => {
|
throw new te({ message: 'Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.' });
|
};
|
return Object.defineProperty(e2.promise, "then", { get: t3 }), Object.defineProperty(e2.promise, "catch", { get: t3 }), e2;
|
}
|
const t2 = new Promise((t3, n2) => {
|
e2 = (e3, s2) => e3 ? n2(e3) : t3(s2);
|
});
|
return e2.promise = t2, e2;
|
};
|
function Se(e2) {
|
return void 0 === e2;
|
}
|
function Te(e2) {
|
return "[object Null]" === Object.prototype.toString.call(e2);
|
}
|
function be(e2 = "") {
|
return e2.replace(/([\s\S]+)\s+(请前往云开发AI小助手查看问题:.*)/, "$1");
|
}
|
function Ee(e2 = 32) {
|
const t2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
let n2 = "";
|
for (let s2 = 0; s2 < e2; s2++)
|
n2 += t2.charAt(Math.floor(62 * Math.random()));
|
return n2;
|
}
|
var ke;
|
function Ae(e2) {
|
const t2 = (n2 = e2, "[object Array]" === Object.prototype.toString.call(n2) ? e2 : [e2]);
|
var n2;
|
for (const e3 of t2) {
|
const { isMatch: t3, genAdapter: n3, runtime: s2 } = e3;
|
if (t3())
|
return { adapter: n3(), runtime: s2 };
|
}
|
}
|
!function(e2) {
|
e2.WEB = "web", e2.WX_MP = "wx_mp";
|
}(ke || (ke = {}));
|
const Pe = { adapter: null, runtime: void 0 }, Ce = ["anonymousUuidKey"];
|
class Oe extends ye {
|
constructor() {
|
super(), Pe.adapter.root.tcbObject || (Pe.adapter.root.tcbObject = {});
|
}
|
setItem(e2, t2) {
|
Pe.adapter.root.tcbObject[e2] = t2;
|
}
|
getItem(e2) {
|
return Pe.adapter.root.tcbObject[e2];
|
}
|
removeItem(e2) {
|
delete Pe.adapter.root.tcbObject[e2];
|
}
|
clear() {
|
delete Pe.adapter.root.tcbObject;
|
}
|
}
|
function xe(e2, t2) {
|
switch (e2) {
|
case "local":
|
return t2.localStorage || new Oe();
|
case "none":
|
return new Oe();
|
default:
|
return t2.sessionStorage || new Oe();
|
}
|
}
|
class Ne {
|
constructor(e2) {
|
if (!this._storage) {
|
this._persistence = Pe.adapter.primaryStorage || e2.persistence, this._storage = xe(this._persistence, Pe.adapter);
|
const t2 = `access_token_${e2.env}`, n2 = `access_token_expire_${e2.env}`, s2 = `refresh_token_${e2.env}`, r2 = `anonymous_uuid_${e2.env}`, i2 = `login_type_${e2.env}`, o2 = "device_id", a2 = `token_type_${e2.env}`, c2 = `user_info_${e2.env}`;
|
this.keys = { accessTokenKey: t2, accessTokenExpireKey: n2, refreshTokenKey: s2, anonymousUuidKey: r2, loginTypeKey: i2, userInfoKey: c2, deviceIdKey: o2, tokenTypeKey: a2 };
|
}
|
}
|
updatePersistence(e2) {
|
if (e2 === this._persistence)
|
return;
|
const t2 = "local" === this._persistence;
|
this._persistence = e2;
|
const n2 = xe(e2, Pe.adapter);
|
for (const e3 in this.keys) {
|
const s2 = this.keys[e3];
|
if (t2 && Ce.includes(e3))
|
continue;
|
const r2 = this._storage.getItem(s2);
|
Se(r2) || Te(r2) || (n2.setItem(s2, r2), this._storage.removeItem(s2));
|
}
|
this._storage = n2;
|
}
|
setStore(e2, t2, n2) {
|
if (!this._storage)
|
return;
|
const s2 = { version: n2 || "localCachev1", content: t2 }, r2 = JSON.stringify(s2);
|
try {
|
this._storage.setItem(e2, r2);
|
} catch (e3) {
|
throw e3;
|
}
|
}
|
getStore(e2, t2) {
|
try {
|
if (!this._storage)
|
return;
|
} catch (e3) {
|
return "";
|
}
|
t2 = t2 || "localCachev1";
|
const n2 = this._storage.getItem(e2);
|
if (!n2)
|
return "";
|
if (n2.indexOf(t2) >= 0) {
|
return JSON.parse(n2).content;
|
}
|
return "";
|
}
|
removeStore(e2) {
|
this._storage.removeItem(e2);
|
}
|
}
|
const Re = {}, Le = {};
|
function Ue(e2) {
|
return Re[e2];
|
}
|
class De {
|
constructor(e2, t2) {
|
this.data = t2 || null, this.name = e2;
|
}
|
}
|
class Me extends De {
|
constructor(e2, t2) {
|
super("error", { error: e2, data: t2 }), this.error = e2;
|
}
|
}
|
const qe = new class {
|
constructor() {
|
this._listeners = {};
|
}
|
on(e2, t2) {
|
return function(e3, t3, n2) {
|
n2[e3] = n2[e3] || [], n2[e3].push(t3);
|
}(e2, t2, this._listeners), this;
|
}
|
off(e2, t2) {
|
return function(e3, t3, n2) {
|
if (n2 && n2[e3]) {
|
const s2 = n2[e3].indexOf(t3);
|
-1 !== s2 && n2[e3].splice(s2, 1);
|
}
|
}(e2, t2, this._listeners), this;
|
}
|
fire(e2, t2) {
|
if (e2 instanceof Me)
|
return console.error(e2.error), this;
|
const n2 = "string" == typeof e2 ? new De(e2, t2 || {}) : e2;
|
const s2 = n2.name;
|
if (this._listens(s2)) {
|
n2.target = this;
|
const e3 = this._listeners[s2] ? [...this._listeners[s2]] : [];
|
for (const t3 of e3)
|
t3.call(this, n2);
|
}
|
return this;
|
}
|
_listens(e2) {
|
return this._listeners[e2] && this._listeners[e2].length > 0;
|
}
|
}();
|
function Fe(e2, t2) {
|
qe.on(e2, t2);
|
}
|
function Ke(e2, t2 = {}) {
|
qe.fire(e2, t2);
|
}
|
function je(e2, t2) {
|
qe.off(e2, t2);
|
}
|
const $e = "loginStateChanged", Be = "loginStateExpire", We = "loginTypeChanged", He = "anonymousConverted", Je = "refreshAccessToken";
|
var ze;
|
!function(e2) {
|
e2.ANONYMOUS = "ANONYMOUS", e2.WECHAT = "WECHAT", e2.WECHAT_PUBLIC = "WECHAT-PUBLIC", e2.WECHAT_OPEN = "WECHAT-OPEN", e2.CUSTOM = "CUSTOM", e2.EMAIL = "EMAIL", e2.USERNAME = "USERNAME", e2.NULL = "NULL";
|
}(ze || (ze = {}));
|
class Ve {
|
constructor() {
|
this._fnPromiseMap = /* @__PURE__ */ new Map();
|
}
|
async run(e2, t2) {
|
let n2 = this._fnPromiseMap.get(e2);
|
return n2 || (n2 = new Promise(async (n3, s2) => {
|
try {
|
await this._runIdlePromise();
|
const e3 = t2();
|
n3(await e3);
|
} catch (e3) {
|
s2(e3);
|
} finally {
|
this._fnPromiseMap.delete(e2);
|
}
|
}), this._fnPromiseMap.set(e2, n2)), n2;
|
}
|
_runIdlePromise() {
|
return Promise.resolve();
|
}
|
}
|
class Ge {
|
constructor(e2) {
|
this._singlePromise = new Ve(), this._cache = Ue(e2.env), this._baseURL = `https://${e2.env}.ap-shanghai.tcb-api.tencentcloudapi.com`, this._reqClass = new Pe.adapter.reqClass({ timeout: e2.timeout, timeoutMsg: `请求在${e2.timeout / 1e3}s内未完成,已中断`, restrictedMethods: ["post"] });
|
}
|
_getDeviceId() {
|
if (this._deviceID)
|
return this._deviceID;
|
const { deviceIdKey: e2 } = this._cache.keys;
|
let t2 = this._cache.getStore(e2);
|
return "string" == typeof t2 && t2.length >= 16 && t2.length <= 48 || (t2 = Ee(), this._cache.setStore(e2, t2)), this._deviceID = t2, t2;
|
}
|
async _request(e2, t2, n2 = {}) {
|
const s2 = { "x-request-id": Ee(), "x-device-id": this._getDeviceId() };
|
if (n2.withAccessToken) {
|
const { tokenTypeKey: e3 } = this._cache.keys, t3 = await this.getAccessToken(), n3 = this._cache.getStore(e3);
|
s2.authorization = `${n3} ${t3}`;
|
}
|
return this._reqClass["get" === n2.method ? "get" : "post"]({ url: `${this._baseURL}${e2}`, data: t2, headers: s2 });
|
}
|
async _fetchAccessToken() {
|
const { loginTypeKey: e2, accessTokenKey: t2, accessTokenExpireKey: n2, tokenTypeKey: s2 } = this._cache.keys, r2 = this._cache.getStore(e2);
|
if (r2 && r2 !== ze.ANONYMOUS)
|
throw new te({ code: "INVALID_OPERATION", message: "非匿名登录不支持刷新 access token" });
|
const i2 = await this._singlePromise.run("fetchAccessToken", async () => (await this._request("/auth/v1/signin/anonymously", {}, { method: "post" })).data), { access_token: o2, expires_in: a2, token_type: c2 } = i2;
|
return this._cache.setStore(s2, c2), this._cache.setStore(t2, o2), this._cache.setStore(n2, Date.now() + 1e3 * a2), o2;
|
}
|
isAccessTokenExpired(e2, t2) {
|
let n2 = true;
|
return e2 && t2 && (n2 = t2 < Date.now()), n2;
|
}
|
async getAccessToken() {
|
const { accessTokenKey: e2, accessTokenExpireKey: t2 } = this._cache.keys, n2 = this._cache.getStore(e2), s2 = this._cache.getStore(t2);
|
return this.isAccessTokenExpired(n2, s2) ? this._fetchAccessToken() : n2;
|
}
|
async refreshAccessToken() {
|
const { accessTokenKey: e2, accessTokenExpireKey: t2, loginTypeKey: n2 } = this._cache.keys;
|
return this._cache.removeStore(e2), this._cache.removeStore(t2), this._cache.setStore(n2, ze.ANONYMOUS), this.getAccessToken();
|
}
|
async getUserInfo() {
|
return this._singlePromise.run("getUserInfo", async () => (await this._request("/auth/v1/user/me", {}, { withAccessToken: true, method: "get" })).data);
|
}
|
}
|
const Ye = ["auth.getJwt", "auth.logout", "auth.signInWithTicket", "auth.signInAnonymously", "auth.signIn", "auth.fetchAccessTokenWithRefreshToken", "auth.signUpWithEmailAndPassword", "auth.activateEndUserMail", "auth.sendPasswordResetEmail", "auth.resetPasswordWithToken", "auth.isUsernameRegistered"], Qe = { "X-SDK-Version": "1.3.5" };
|
function Xe(e2, t2, n2) {
|
const s2 = e2[t2];
|
e2[t2] = function(t3) {
|
const r2 = {}, i2 = {};
|
n2.forEach((n3) => {
|
const { data: s3, headers: o3 } = n3.call(e2, t3);
|
Object.assign(r2, s3), Object.assign(i2, o3);
|
});
|
const o2 = t3.data;
|
return o2 && (() => {
|
var e3;
|
if (e3 = o2, "[object FormData]" !== Object.prototype.toString.call(e3))
|
t3.data = { ...o2, ...r2 };
|
else
|
for (const e4 in r2)
|
o2.append(e4, r2[e4]);
|
})(), t3.headers = { ...t3.headers || {}, ...i2 }, s2.call(e2, t3);
|
};
|
}
|
function Ze() {
|
const e2 = Math.random().toString(16).slice(2);
|
return { data: { seqId: e2 }, headers: { ...Qe, "x-seqid": e2 } };
|
}
|
class et {
|
constructor(e2 = {}) {
|
var t2;
|
this.config = e2, this._reqClass = new Pe.adapter.reqClass({ timeout: this.config.timeout, timeoutMsg: `请求在${this.config.timeout / 1e3}s内未完成,已中断`, restrictedMethods: ["post"] }), this._cache = Ue(this.config.env), this._localCache = (t2 = this.config.env, Le[t2]), this.oauth = new Ge(this.config), Xe(this._reqClass, "post", [Ze]), Xe(this._reqClass, "upload", [Ze]), Xe(this._reqClass, "download", [Ze]);
|
}
|
async post(e2) {
|
return await this._reqClass.post(e2);
|
}
|
async upload(e2) {
|
return await this._reqClass.upload(e2);
|
}
|
async download(e2) {
|
return await this._reqClass.download(e2);
|
}
|
async refreshAccessToken() {
|
let e2, t2;
|
this._refreshAccessTokenPromise || (this._refreshAccessTokenPromise = this._refreshAccessToken());
|
try {
|
e2 = await this._refreshAccessTokenPromise;
|
} catch (e3) {
|
t2 = e3;
|
}
|
if (this._refreshAccessTokenPromise = null, this._shouldRefreshAccessTokenHook = null, t2)
|
throw t2;
|
return e2;
|
}
|
async _refreshAccessToken() {
|
const { accessTokenKey: e2, accessTokenExpireKey: t2, refreshTokenKey: n2, loginTypeKey: s2, anonymousUuidKey: r2 } = this._cache.keys;
|
this._cache.removeStore(e2), this._cache.removeStore(t2);
|
let i2 = this._cache.getStore(n2);
|
if (!i2)
|
throw new te({ message: "未登录CloudBase" });
|
const o2 = { refresh_token: i2 }, a2 = await this.request("auth.fetchAccessTokenWithRefreshToken", o2);
|
if (a2.data.code) {
|
const { code: e3 } = a2.data;
|
if ("SIGN_PARAM_INVALID" === e3 || "REFRESH_TOKEN_EXPIRED" === e3 || "INVALID_REFRESH_TOKEN" === e3) {
|
if (this._cache.getStore(s2) === ze.ANONYMOUS && "INVALID_REFRESH_TOKEN" === e3) {
|
const e4 = this._cache.getStore(r2), t3 = this._cache.getStore(n2), s3 = await this.send("auth.signInAnonymously", { anonymous_uuid: e4, refresh_token: t3 });
|
return this.setRefreshToken(s3.refresh_token), this._refreshAccessToken();
|
}
|
Ke(Be), this._cache.removeStore(n2);
|
}
|
throw new te({ code: a2.data.code, message: `刷新access token失败:${a2.data.code}` });
|
}
|
if (a2.data.access_token)
|
return Ke(Je), this._cache.setStore(e2, a2.data.access_token), this._cache.setStore(t2, a2.data.access_token_expire + Date.now()), { accessToken: a2.data.access_token, accessTokenExpire: a2.data.access_token_expire };
|
a2.data.refresh_token && (this._cache.removeStore(n2), this._cache.setStore(n2, a2.data.refresh_token), this._refreshAccessToken());
|
}
|
async getAccessToken() {
|
const { accessTokenKey: e2, accessTokenExpireKey: t2, refreshTokenKey: n2 } = this._cache.keys;
|
if (!this._cache.getStore(n2))
|
throw new te({ message: "refresh token不存在,登录状态异常" });
|
let s2 = this._cache.getStore(e2), r2 = this._cache.getStore(t2), i2 = true;
|
return this._shouldRefreshAccessTokenHook && !await this._shouldRefreshAccessTokenHook(s2, r2) && (i2 = false), (!s2 || !r2 || r2 < Date.now()) && i2 ? this.refreshAccessToken() : { accessToken: s2, accessTokenExpire: r2 };
|
}
|
async request(e2, t2, n2) {
|
const s2 = `x-tcb-trace_${this.config.env}`;
|
let r2 = "application/x-www-form-urlencoded";
|
const i2 = { action: e2, env: this.config.env, dataVersion: "2019-08-16", ...t2 };
|
let o2;
|
if (-1 === Ye.indexOf(e2) && (this._cache.keys, i2.access_token = await this.oauth.getAccessToken()), "storage.uploadFile" === e2) {
|
o2 = new FormData();
|
for (let e3 in o2)
|
o2.hasOwnProperty(e3) && void 0 !== o2[e3] && o2.append(e3, i2[e3]);
|
r2 = "multipart/form-data";
|
} else {
|
r2 = "application/json", o2 = {};
|
for (let e3 in i2)
|
void 0 !== i2[e3] && (o2[e3] = i2[e3]);
|
}
|
let a2 = { headers: { "content-type": r2 } };
|
n2 && n2.timeout && (a2.timeout = n2.timeout), n2 && n2.onUploadProgress && (a2.onUploadProgress = n2.onUploadProgress);
|
const c2 = this._localCache.getStore(s2);
|
c2 && (a2.headers["X-TCB-Trace"] = c2);
|
const { parse: u2, inQuery: h2, search: l2 } = t2;
|
let d2 = { env: this.config.env };
|
u2 && (d2.parse = true), h2 && (d2 = { ...h2, ...d2 });
|
let p2 = function(e3, t3, n3 = {}) {
|
const s3 = /\?/.test(t3);
|
let r3 = "";
|
for (let e4 in n3)
|
"" === r3 ? !s3 && (t3 += "?") : r3 += "&", r3 += `${e4}=${encodeURIComponent(n3[e4])}`;
|
return /^http(s)?\:\/\//.test(t3 += r3) ? t3 : `${e3}${t3}`;
|
}(ge, "//tcb-api.tencentcloudapi.com/web", d2);
|
l2 && (p2 += l2);
|
const f2 = await this.post({ url: p2, data: o2, ...a2 }), g2 = f2.header && f2.header["x-tcb-trace"];
|
if (g2 && this._localCache.setStore(s2, g2), 200 !== Number(f2.status) && 200 !== Number(f2.statusCode) || !f2.data)
|
throw new te({ code: "NETWORK_ERROR", message: "network request error" });
|
return f2;
|
}
|
async send(e2, t2 = {}, n2 = {}) {
|
const s2 = await this.request(e2, t2, { ...n2, onUploadProgress: t2.onUploadProgress });
|
if (("ACCESS_TOKEN_DISABLED" === s2.data.code || "ACCESS_TOKEN_EXPIRED" === s2.data.code) && -1 === Ye.indexOf(e2)) {
|
await this.oauth.refreshAccessToken();
|
const s3 = await this.request(e2, t2, { ...n2, onUploadProgress: t2.onUploadProgress });
|
if (s3.data.code)
|
throw new te({ code: s3.data.code, message: be(s3.data.message) });
|
return s3.data;
|
}
|
if (s2.data.code)
|
throw new te({ code: s2.data.code, message: be(s2.data.message) });
|
return s2.data;
|
}
|
setRefreshToken(e2) {
|
const { accessTokenKey: t2, accessTokenExpireKey: n2, refreshTokenKey: s2 } = this._cache.keys;
|
this._cache.removeStore(t2), this._cache.removeStore(n2), this._cache.setStore(s2, e2);
|
}
|
}
|
const tt = {};
|
function nt(e2) {
|
return tt[e2];
|
}
|
class st {
|
constructor(e2) {
|
this.config = e2, this._cache = Ue(e2.env), this._request = nt(e2.env);
|
}
|
setRefreshToken(e2) {
|
const { accessTokenKey: t2, accessTokenExpireKey: n2, refreshTokenKey: s2 } = this._cache.keys;
|
this._cache.removeStore(t2), this._cache.removeStore(n2), this._cache.setStore(s2, e2);
|
}
|
setAccessToken(e2, t2) {
|
const { accessTokenKey: n2, accessTokenExpireKey: s2 } = this._cache.keys;
|
this._cache.setStore(n2, e2), this._cache.setStore(s2, t2);
|
}
|
async refreshUserInfo() {
|
const { data: e2 } = await this._request.send("auth.getUserInfo", {});
|
return this.setLocalUserInfo(e2), e2;
|
}
|
setLocalUserInfo(e2) {
|
const { userInfoKey: t2 } = this._cache.keys;
|
this._cache.setStore(t2, e2);
|
}
|
}
|
class rt {
|
constructor(e2) {
|
if (!e2)
|
throw new te({ code: "PARAM_ERROR", message: "envId is not defined" });
|
this._envId = e2, this._cache = Ue(this._envId), this._request = nt(this._envId), this.setUserInfo();
|
}
|
linkWithTicket(e2) {
|
if ("string" != typeof e2)
|
throw new te({ code: "PARAM_ERROR", message: "ticket must be string" });
|
return this._request.send("auth.linkWithTicket", { ticket: e2 });
|
}
|
linkWithRedirect(e2) {
|
e2.signInWithRedirect();
|
}
|
updatePassword(e2, t2) {
|
return this._request.send("auth.updatePassword", { oldPassword: t2, newPassword: e2 });
|
}
|
updateEmail(e2) {
|
return this._request.send("auth.updateEmail", { newEmail: e2 });
|
}
|
updateUsername(e2) {
|
if ("string" != typeof e2)
|
throw new te({ code: "PARAM_ERROR", message: "username must be a string" });
|
return this._request.send("auth.updateUsername", { username: e2 });
|
}
|
async getLinkedUidList() {
|
const { data: e2 } = await this._request.send("auth.getLinkedUidList", {});
|
let t2 = false;
|
const { users: n2 } = e2;
|
return n2.forEach((e3) => {
|
e3.wxOpenId && e3.wxPublicId && (t2 = true);
|
}), { users: n2, hasPrimaryUid: t2 };
|
}
|
setPrimaryUid(e2) {
|
return this._request.send("auth.setPrimaryUid", { uid: e2 });
|
}
|
unlink(e2) {
|
return this._request.send("auth.unlink", { platform: e2 });
|
}
|
async update(e2) {
|
const { nickName: t2, gender: n2, avatarUrl: s2, province: r2, country: i2, city: o2 } = e2, { data: a2 } = await this._request.send("auth.updateUserInfo", { nickName: t2, gender: n2, avatarUrl: s2, province: r2, country: i2, city: o2 });
|
this.setLocalUserInfo(a2);
|
}
|
async refresh() {
|
const e2 = await this._request.oauth.getUserInfo();
|
return this.setLocalUserInfo(e2), e2;
|
}
|
setUserInfo() {
|
const { userInfoKey: e2 } = this._cache.keys, t2 = this._cache.getStore(e2);
|
["uid", "loginType", "openid", "wxOpenId", "wxPublicId", "unionId", "qqMiniOpenId", "email", "hasPassword", "customUserId", "nickName", "gender", "avatarUrl"].forEach((e3) => {
|
this[e3] = t2[e3];
|
}), this.location = { country: t2.country, province: t2.province, city: t2.city };
|
}
|
setLocalUserInfo(e2) {
|
const { userInfoKey: t2 } = this._cache.keys;
|
this._cache.setStore(t2, e2), this.setUserInfo();
|
}
|
}
|
class it {
|
constructor(e2) {
|
if (!e2)
|
throw new te({ code: "PARAM_ERROR", message: "envId is not defined" });
|
this._cache = Ue(e2);
|
const { refreshTokenKey: t2, accessTokenKey: n2, accessTokenExpireKey: s2 } = this._cache.keys, r2 = this._cache.getStore(t2), i2 = this._cache.getStore(n2), o2 = this._cache.getStore(s2);
|
this.credential = { refreshToken: r2, accessToken: i2, accessTokenExpire: o2 }, this.user = new rt(e2);
|
}
|
get isAnonymousAuth() {
|
return this.loginType === ze.ANONYMOUS;
|
}
|
get isCustomAuth() {
|
return this.loginType === ze.CUSTOM;
|
}
|
get isWeixinAuth() {
|
return this.loginType === ze.WECHAT || this.loginType === ze.WECHAT_OPEN || this.loginType === ze.WECHAT_PUBLIC;
|
}
|
get loginType() {
|
return this._cache.getStore(this._cache.keys.loginTypeKey);
|
}
|
}
|
class ot extends st {
|
async signIn() {
|
this._cache.updatePersistence("local"), await this._request.oauth.getAccessToken(), Ke($e), Ke(We, { env: this.config.env, loginType: ze.ANONYMOUS, persistence: "local" });
|
const e2 = new it(this.config.env);
|
return await e2.user.refresh(), e2;
|
}
|
async linkAndRetrieveDataWithTicket(e2) {
|
const { anonymousUuidKey: t2, refreshTokenKey: n2 } = this._cache.keys, s2 = this._cache.getStore(t2), r2 = this._cache.getStore(n2), i2 = await this._request.send("auth.linkAndRetrieveDataWithTicket", { anonymous_uuid: s2, refresh_token: r2, ticket: e2 });
|
if (i2.refresh_token)
|
return this._clearAnonymousUUID(), this.setRefreshToken(i2.refresh_token), await this._request.refreshAccessToken(), Ke(He, { env: this.config.env }), Ke(We, { loginType: ze.CUSTOM, persistence: "local" }), { credential: { refreshToken: i2.refresh_token } };
|
throw new te({ message: "匿名转化失败" });
|
}
|
_setAnonymousUUID(e2) {
|
const { anonymousUuidKey: t2, loginTypeKey: n2 } = this._cache.keys;
|
this._cache.removeStore(t2), this._cache.setStore(t2, e2), this._cache.setStore(n2, ze.ANONYMOUS);
|
}
|
_clearAnonymousUUID() {
|
this._cache.removeStore(this._cache.keys.anonymousUuidKey);
|
}
|
}
|
class at extends st {
|
async signIn(e2) {
|
if ("string" != typeof e2)
|
throw new te({ code: "PARAM_ERROR", message: "ticket must be a string" });
|
const { refreshTokenKey: t2 } = this._cache.keys, n2 = await this._request.send("auth.signInWithTicket", { ticket: e2, refresh_token: this._cache.getStore(t2) || "" });
|
if (n2.refresh_token)
|
return this.setRefreshToken(n2.refresh_token), await this._request.refreshAccessToken(), Ke($e), Ke(We, { env: this.config.env, loginType: ze.CUSTOM, persistence: this.config.persistence }), await this.refreshUserInfo(), new it(this.config.env);
|
throw new te({ message: "自定义登录失败" });
|
}
|
}
|
class ct extends st {
|
async signIn(e2, t2) {
|
if ("string" != typeof e2)
|
throw new te({ code: "PARAM_ERROR", message: "email must be a string" });
|
const { refreshTokenKey: n2 } = this._cache.keys, s2 = await this._request.send("auth.signIn", { loginType: "EMAIL", email: e2, password: t2, refresh_token: this._cache.getStore(n2) || "" }), { refresh_token: r2, access_token: i2, access_token_expire: o2 } = s2;
|
if (r2)
|
return this.setRefreshToken(r2), i2 && o2 ? this.setAccessToken(i2, o2) : await this._request.refreshAccessToken(), await this.refreshUserInfo(), Ke($e), Ke(We, { env: this.config.env, loginType: ze.EMAIL, persistence: this.config.persistence }), new it(this.config.env);
|
throw s2.code ? new te({ code: s2.code, message: `邮箱登录失败: ${s2.message}` }) : new te({ message: "邮箱登录失败" });
|
}
|
async activate(e2) {
|
return this._request.send("auth.activateEndUserMail", { token: e2 });
|
}
|
async resetPasswordWithToken(e2, t2) {
|
return this._request.send("auth.resetPasswordWithToken", { token: e2, newPassword: t2 });
|
}
|
}
|
class ut extends st {
|
async signIn(e2, t2) {
|
if ("string" != typeof e2)
|
throw new te({ code: "PARAM_ERROR", message: "username must be a string" });
|
"string" != typeof t2 && (t2 = "", console.warn("password is empty"));
|
const { refreshTokenKey: n2 } = this._cache.keys, s2 = await this._request.send("auth.signIn", { loginType: ze.USERNAME, username: e2, password: t2, refresh_token: this._cache.getStore(n2) || "" }), { refresh_token: r2, access_token_expire: i2, access_token: o2 } = s2;
|
if (r2)
|
return this.setRefreshToken(r2), o2 && i2 ? this.setAccessToken(o2, i2) : await this._request.refreshAccessToken(), await this.refreshUserInfo(), Ke($e), Ke(We, { env: this.config.env, loginType: ze.USERNAME, persistence: this.config.persistence }), new it(this.config.env);
|
throw s2.code ? new te({ code: s2.code, message: `用户名密码登录失败: ${s2.message}` }) : new te({ message: "用户名密码登录失败" });
|
}
|
}
|
class ht {
|
constructor(e2) {
|
this.config = e2, this._cache = Ue(e2.env), this._request = nt(e2.env), this._onAnonymousConverted = this._onAnonymousConverted.bind(this), this._onLoginTypeChanged = this._onLoginTypeChanged.bind(this), Fe(We, this._onLoginTypeChanged);
|
}
|
get currentUser() {
|
const e2 = this.hasLoginState();
|
return e2 && e2.user || null;
|
}
|
get loginType() {
|
return this._cache.getStore(this._cache.keys.loginTypeKey);
|
}
|
anonymousAuthProvider() {
|
return new ot(this.config);
|
}
|
customAuthProvider() {
|
return new at(this.config);
|
}
|
emailAuthProvider() {
|
return new ct(this.config);
|
}
|
usernameAuthProvider() {
|
return new ut(this.config);
|
}
|
async signInAnonymously() {
|
return new ot(this.config).signIn();
|
}
|
async signInWithEmailAndPassword(e2, t2) {
|
return new ct(this.config).signIn(e2, t2);
|
}
|
signInWithUsernameAndPassword(e2, t2) {
|
return new ut(this.config).signIn(e2, t2);
|
}
|
async linkAndRetrieveDataWithTicket(e2) {
|
this._anonymousAuthProvider || (this._anonymousAuthProvider = new ot(this.config)), Fe(He, this._onAnonymousConverted);
|
return await this._anonymousAuthProvider.linkAndRetrieveDataWithTicket(e2);
|
}
|
async signOut() {
|
if (this.loginType === ze.ANONYMOUS)
|
throw new te({ message: "匿名用户不支持登出操作" });
|
const { refreshTokenKey: e2, accessTokenKey: t2, accessTokenExpireKey: n2 } = this._cache.keys, s2 = this._cache.getStore(e2);
|
if (!s2)
|
return;
|
const r2 = await this._request.send("auth.logout", { refresh_token: s2 });
|
return this._cache.removeStore(e2), this._cache.removeStore(t2), this._cache.removeStore(n2), Ke($e), Ke(We, { env: this.config.env, loginType: ze.NULL, persistence: this.config.persistence }), r2;
|
}
|
async signUpWithEmailAndPassword(e2, t2) {
|
return this._request.send("auth.signUpWithEmailAndPassword", { email: e2, password: t2 });
|
}
|
async sendPasswordResetEmail(e2) {
|
return this._request.send("auth.sendPasswordResetEmail", { email: e2 });
|
}
|
onLoginStateChanged(e2) {
|
Fe($e, () => {
|
const t3 = this.hasLoginState();
|
e2.call(this, t3);
|
});
|
const t2 = this.hasLoginState();
|
e2.call(this, t2);
|
}
|
onLoginStateExpired(e2) {
|
Fe(Be, e2.bind(this));
|
}
|
onAccessTokenRefreshed(e2) {
|
Fe(Je, e2.bind(this));
|
}
|
onAnonymousConverted(e2) {
|
Fe(He, e2.bind(this));
|
}
|
onLoginTypeChanged(e2) {
|
Fe(We, () => {
|
const t2 = this.hasLoginState();
|
e2.call(this, t2);
|
});
|
}
|
async getAccessToken() {
|
return { accessToken: (await this._request.getAccessToken()).accessToken, env: this.config.env };
|
}
|
hasLoginState() {
|
const { accessTokenKey: e2, accessTokenExpireKey: t2 } = this._cache.keys, n2 = this._cache.getStore(e2), s2 = this._cache.getStore(t2);
|
return this._request.oauth.isAccessTokenExpired(n2, s2) ? null : new it(this.config.env);
|
}
|
async isUsernameRegistered(e2) {
|
if ("string" != typeof e2)
|
throw new te({ code: "PARAM_ERROR", message: "username must be a string" });
|
const { data: t2 } = await this._request.send("auth.isUsernameRegistered", { username: e2 });
|
return t2 && t2.isRegistered;
|
}
|
getLoginState() {
|
return Promise.resolve(this.hasLoginState());
|
}
|
async signInWithTicket(e2) {
|
return new at(this.config).signIn(e2);
|
}
|
shouldRefreshAccessToken(e2) {
|
this._request._shouldRefreshAccessTokenHook = e2.bind(this);
|
}
|
getUserInfo() {
|
return this._request.send("auth.getUserInfo", {}).then((e2) => e2.code ? e2 : { ...e2.data, requestId: e2.seqId });
|
}
|
getAuthHeader() {
|
const { refreshTokenKey: e2, accessTokenKey: t2 } = this._cache.keys, n2 = this._cache.getStore(e2);
|
return { "x-cloudbase-credentials": this._cache.getStore(t2) + "/@@/" + n2 };
|
}
|
_onAnonymousConverted(e2) {
|
const { env: t2 } = e2.data;
|
t2 === this.config.env && this._cache.updatePersistence(this.config.persistence);
|
}
|
_onLoginTypeChanged(e2) {
|
const { loginType: t2, persistence: n2, env: s2 } = e2.data;
|
s2 === this.config.env && (this._cache.updatePersistence(n2), this._cache.setStore(this._cache.keys.loginTypeKey, t2));
|
}
|
}
|
const lt = function(e2, t2) {
|
t2 = t2 || ve();
|
const n2 = nt(this.config.env), { cloudPath: s2, filePath: r2, onUploadProgress: i2, fileType: o2 = "image" } = e2;
|
return n2.send("storage.getUploadMetadata", { path: s2 }).then((e3) => {
|
const { data: { url: a2, authorization: c2, token: u2, fileId: h2, cosFileId: l2 }, requestId: d2 } = e3, p2 = { key: s2, signature: c2, "x-cos-meta-fileid": l2, success_action_status: "201", "x-cos-security-token": u2 };
|
n2.upload({ url: a2, data: p2, file: r2, name: s2, fileType: o2, onUploadProgress: i2 }).then((e4) => {
|
201 === e4.statusCode ? t2(null, { fileID: h2, requestId: d2 }) : t2(new te({ code: "STORAGE_REQUEST_FAIL", message: `STORAGE_REQUEST_FAIL: ${e4.data}` }));
|
}).catch((e4) => {
|
t2(e4);
|
});
|
}).catch((e3) => {
|
t2(e3);
|
}), t2.promise;
|
}, dt = function(e2, t2) {
|
t2 = t2 || ve();
|
const n2 = nt(this.config.env), { cloudPath: s2 } = e2;
|
return n2.send("storage.getUploadMetadata", { path: s2 }).then((e3) => {
|
t2(null, e3);
|
}).catch((e3) => {
|
t2(e3);
|
}), t2.promise;
|
}, pt = function({ fileList: e2 }, t2) {
|
if (t2 = t2 || ve(), !e2 || !Array.isArray(e2))
|
return { code: "INVALID_PARAM", message: "fileList必须是非空的数组" };
|
for (let t3 of e2)
|
if (!t3 || "string" != typeof t3)
|
return { code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" };
|
const n2 = { fileid_list: e2 };
|
return nt(this.config.env).send("storage.batchDeleteFile", n2).then((e3) => {
|
e3.code ? t2(null, e3) : t2(null, { fileList: e3.data.delete_list, requestId: e3.requestId });
|
}).catch((e3) => {
|
t2(e3);
|
}), t2.promise;
|
}, ft = function({ fileList: e2 }, t2) {
|
t2 = t2 || ve(), e2 && Array.isArray(e2) || t2(null, { code: "INVALID_PARAM", message: "fileList必须是非空的数组" });
|
let n2 = [];
|
for (let s3 of e2)
|
"object" == typeof s3 ? (s3.hasOwnProperty("fileID") && s3.hasOwnProperty("maxAge") || t2(null, { code: "INVALID_PARAM", message: "fileList的元素必须是包含fileID和maxAge的对象" }), n2.push({ fileid: s3.fileID, max_age: s3.maxAge })) : "string" == typeof s3 ? n2.push({ fileid: s3 }) : t2(null, { code: "INVALID_PARAM", message: "fileList的元素必须是字符串" });
|
const s2 = { file_list: n2 };
|
return nt(this.config.env).send("storage.batchGetDownloadUrl", s2).then((e3) => {
|
e3.code ? t2(null, e3) : t2(null, { fileList: e3.data.download_list, requestId: e3.requestId });
|
}).catch((e3) => {
|
t2(e3);
|
}), t2.promise;
|
}, gt = async function({ fileID: e2 }, t2) {
|
const n2 = (await ft.call(this, { fileList: [{ fileID: e2, maxAge: 600 }] })).fileList[0];
|
if ("SUCCESS" !== n2.code)
|
return t2 ? t2(n2) : new Promise((e3) => {
|
e3(n2);
|
});
|
const s2 = nt(this.config.env);
|
let r2 = n2.download_url;
|
if (r2 = encodeURI(r2), !t2)
|
return s2.download({ url: r2 });
|
t2(await s2.download({ url: r2 }));
|
}, mt = function({ name: e2, data: t2, query: n2, parse: s2, search: r2, timeout: i2 }, o2) {
|
const a2 = o2 || ve();
|
let c2;
|
try {
|
c2 = t2 ? JSON.stringify(t2) : "";
|
} catch (e3) {
|
return Promise.reject(e3);
|
}
|
if (!e2)
|
return Promise.reject(new te({ code: "PARAM_ERROR", message: "函数名不能为空" }));
|
const u2 = { inQuery: n2, parse: s2, search: r2, function_name: e2, request_data: c2 };
|
return nt(this.config.env).send("functions.invokeFunction", u2, { timeout: i2 }).then((e3) => {
|
if (e3.code)
|
a2(null, e3);
|
else {
|
let t3 = e3.data.response_data;
|
if (s2)
|
a2(null, { result: t3, requestId: e3.requestId });
|
else
|
try {
|
t3 = JSON.parse(e3.data.response_data), a2(null, { result: t3, requestId: e3.requestId });
|
} catch (e4) {
|
a2(new te({ message: "response data must be json" }));
|
}
|
}
|
return a2.promise;
|
}).catch((e3) => {
|
a2(e3);
|
}), a2.promise;
|
}, yt = { timeout: 15e3, persistence: "session" }, _t = 6e5, wt = {};
|
class It {
|
constructor(e2) {
|
this.config = e2 || this.config, this.authObj = void 0;
|
}
|
init(e2) {
|
switch (Pe.adapter || (this.requestClient = new Pe.adapter.reqClass({ timeout: e2.timeout || 5e3, timeoutMsg: `请求在${(e2.timeout || 5e3) / 1e3}s内未完成,已中断` })), this.config = { ...yt, ...e2 }, true) {
|
case this.config.timeout > _t:
|
console.warn("timeout大于可配置上限[10分钟],已重置为上限数值"), this.config.timeout = _t;
|
break;
|
case this.config.timeout < 100:
|
console.warn("timeout小于可配置下限[100ms],已重置为下限数值"), this.config.timeout = 100;
|
}
|
return new It(this.config);
|
}
|
auth({ persistence: e2 } = {}) {
|
if (this.authObj)
|
return this.authObj;
|
const t2 = e2 || Pe.adapter.primaryStorage || yt.persistence;
|
var n2;
|
return t2 !== this.config.persistence && (this.config.persistence = t2), function(e3) {
|
const { env: t3 } = e3;
|
Re[t3] = new Ne(e3), Le[t3] = new Ne({ ...e3, persistence: "local" });
|
}(this.config), n2 = this.config, tt[n2.env] = new et(n2), this.authObj = new ht(this.config), this.authObj;
|
}
|
on(e2, t2) {
|
return Fe.apply(this, [e2, t2]);
|
}
|
off(e2, t2) {
|
return je.apply(this, [e2, t2]);
|
}
|
callFunction(e2, t2) {
|
return mt.apply(this, [e2, t2]);
|
}
|
deleteFile(e2, t2) {
|
return pt.apply(this, [e2, t2]);
|
}
|
getTempFileURL(e2, t2) {
|
return ft.apply(this, [e2, t2]);
|
}
|
downloadFile(e2, t2) {
|
return gt.apply(this, [e2, t2]);
|
}
|
uploadFile(e2, t2) {
|
return lt.apply(this, [e2, t2]);
|
}
|
getUploadMetadata(e2, t2) {
|
return dt.apply(this, [e2, t2]);
|
}
|
registerExtension(e2) {
|
wt[e2.name] = e2;
|
}
|
async invokeExtension(e2, t2) {
|
const n2 = wt[e2];
|
if (!n2)
|
throw new te({ message: `扩展${e2} 必须先注册` });
|
return await n2.invoke(t2, this);
|
}
|
useAdapters(e2) {
|
const { adapter: t2, runtime: n2 } = Ae(e2) || {};
|
t2 && (Pe.adapter = t2), n2 && (Pe.runtime = n2);
|
}
|
}
|
var vt = new It();
|
function St(e2, t2, n2) {
|
void 0 === n2 && (n2 = {});
|
var s2 = /\?/.test(t2), r2 = "";
|
for (var i2 in n2)
|
"" === r2 ? !s2 && (t2 += "?") : r2 += "&", r2 += i2 + "=" + encodeURIComponent(n2[i2]);
|
return /^http(s)?:\/\//.test(t2 += r2) ? t2 : "" + e2 + t2;
|
}
|
class Tt {
|
get(e2) {
|
const { url: t2, data: n2, headers: s2, timeout: r2 } = e2;
|
return new Promise((e3, i2) => {
|
ne.request({ url: St("https:", t2), data: n2, method: "GET", header: s2, timeout: r2, success(t3) {
|
e3(t3);
|
}, fail(e4) {
|
i2(e4);
|
} });
|
});
|
}
|
post(e2) {
|
const { url: t2, data: n2, headers: s2, timeout: r2 } = e2;
|
return new Promise((e3, i2) => {
|
ne.request({ url: St("https:", t2), data: n2, method: "POST", header: s2, timeout: r2, success(t3) {
|
e3(t3);
|
}, fail(e4) {
|
i2(e4);
|
} });
|
});
|
}
|
upload(e2) {
|
return new Promise((t2, n2) => {
|
const { url: s2, file: r2, data: i2, headers: o2, fileType: a2 } = e2, c2 = ne.uploadFile({ url: St("https:", s2), name: "file", formData: Object.assign({}, i2), filePath: r2, fileType: a2, header: o2, success(e3) {
|
const n3 = { statusCode: e3.statusCode, data: e3.data || {} };
|
200 === e3.statusCode && i2.success_action_status && (n3.statusCode = parseInt(i2.success_action_status, 10)), t2(n3);
|
}, fail(e3) {
|
n2(new Error(e3.errMsg || "uploadFile:fail"));
|
} });
|
"function" == typeof e2.onUploadProgress && c2 && "function" == typeof c2.onProgressUpdate && c2.onProgressUpdate((t3) => {
|
e2.onUploadProgress({ loaded: t3.totalBytesSent, total: t3.totalBytesExpectedToSend });
|
});
|
});
|
}
|
}
|
const bt = { setItem(e2, t2) {
|
ne.setStorageSync(e2, t2);
|
}, getItem: (e2) => ne.getStorageSync(e2), removeItem(e2) {
|
ne.removeStorageSync(e2);
|
}, clear() {
|
ne.clearStorageSync();
|
} };
|
var Et = { genAdapter: function() {
|
return { root: {}, reqClass: Tt, localStorage: bt, primaryStorage: "local" };
|
}, isMatch: function() {
|
return true;
|
}, runtime: "uni_app" };
|
vt.useAdapters(Et);
|
const kt = vt, At = kt.init;
|
kt.init = function(e2) {
|
e2.env = e2.spaceId;
|
const t2 = At.call(this, e2);
|
t2.config.provider = "tencent", t2.config.spaceId = e2.spaceId;
|
const n2 = t2.auth;
|
return t2.auth = function(e3) {
|
const t3 = n2.call(this, e3);
|
return ["linkAndRetrieveDataWithTicket", "signInAnonymously", "signOut", "getAccessToken", "getLoginState", "signInWithTicket", "getUserInfo"].forEach((e4) => {
|
var n3;
|
t3[e4] = (n3 = t3[e4], function(e5) {
|
e5 = e5 || {};
|
const { success: t4, fail: s2, complete: r2 } = ee(e5);
|
if (!(t4 || s2 || r2))
|
return n3.call(this, e5);
|
n3.call(this, e5).then((e6) => {
|
t4 && t4(e6), r2 && r2(e6);
|
}, (e6) => {
|
s2 && s2(e6), r2 && r2(e6);
|
});
|
}).bind(t3);
|
}), t3;
|
}, t2.customAuth = t2.auth, t2;
|
};
|
var Pt = kt;
|
async function Ct(e2, t2) {
|
const n2 = `http://${e2}:${t2}/system/ping`;
|
try {
|
const e3 = await (s2 = { url: n2, timeout: 500 }, new Promise((e4, t3) => {
|
ne.request({ ...s2, success(t4) {
|
e4(t4);
|
}, fail(e5) {
|
t3(e5);
|
} });
|
}));
|
return !(!e3.data || 0 !== e3.data.code);
|
} catch (e3) {
|
return false;
|
}
|
var s2;
|
}
|
async function Ot(e2, t2) {
|
let n2;
|
for (let s2 = 0; s2 < e2.length; s2++) {
|
const r2 = e2[s2];
|
if (await Ct(r2, t2)) {
|
n2 = r2;
|
break;
|
}
|
}
|
return { address: n2, port: t2 };
|
}
|
const xt = { "serverless.file.resource.generateProximalSign": "storage/generate-proximal-sign", "serverless.file.resource.report": "storage/report", "serverless.file.resource.delete": "storage/delete", "serverless.file.resource.getTempFileURL": "storage/get-temp-file-url" };
|
var Nt = class {
|
constructor(e2) {
|
if (["spaceId", "clientSecret"].forEach((t2) => {
|
if (!Object.prototype.hasOwnProperty.call(e2, t2))
|
throw new Error(`${t2} required`);
|
}), !e2.endpoint)
|
throw new Error("集群空间未配置ApiEndpoint,配置后需要重新关联服务空间后生效");
|
this.config = Object.assign({}, e2), this.config.provider = "dcloud", this.config.requestUrl = this.config.endpoint + "/client", this.config.envType = this.config.envType || "public", this.adapter = ne;
|
}
|
async request(e2, t2 = true) {
|
const n2 = t2;
|
return e2 = n2 ? await this.setupLocalRequest(e2) : this.setupRequest(e2), Promise.resolve().then(() => n2 ? this.requestLocal(e2) : de.wrappedRequest(e2, this.adapter.request));
|
}
|
requestLocal(e2) {
|
return new Promise((t2, n2) => {
|
this.adapter.request(Object.assign(e2, { complete(e3) {
|
if (e3 || (e3 = {}), !e3.statusCode || e3.statusCode >= 400) {
|
const t3 = e3.data && e3.data.code || "SYS_ERR", s2 = e3.data && e3.data.message || "request:fail";
|
return n2(new te({ code: t3, message: s2 }));
|
}
|
t2({ success: true, result: e3.data });
|
} }));
|
});
|
}
|
setupRequest(e2) {
|
const t2 = Object.assign({}, e2, { spaceId: this.config.spaceId, timestamp: Date.now() }), n2 = { "Content-Type": "application/json" };
|
n2["x-serverless-sign"] = de.sign(t2, this.config.clientSecret);
|
const s2 = le();
|
n2["x-client-info"] = encodeURIComponent(JSON.stringify(s2));
|
const { token: r2 } = re();
|
return n2["x-client-token"] = r2, { url: this.config.requestUrl, method: "POST", data: t2, dataType: "json", header: JSON.parse(JSON.stringify(n2)) };
|
}
|
async setupLocalRequest(e2) {
|
const t2 = le(), { token: n2 } = re(), s2 = Object.assign({}, e2, { spaceId: this.config.spaceId, timestamp: Date.now(), clientInfo: t2, token: n2 }), { address: r2, servePort: i2 } = this.__dev__ && this.__dev__.debugInfo || {}, { address: o2 } = await Ot(r2, i2);
|
return { url: `http://${o2}:${i2}/${xt[e2.method]}`, method: "POST", data: s2, dataType: "json", header: JSON.parse(JSON.stringify({ "Content-Type": "application/json" })) };
|
}
|
callFunction(e2) {
|
const t2 = { method: "serverless.function.runtime.invoke", params: JSON.stringify({ functionTarget: e2.name, functionArgs: e2.data || {} }) };
|
return this.request(t2, false);
|
}
|
getUploadFileOptions(e2) {
|
const t2 = { method: "serverless.file.resource.generateProximalSign", params: JSON.stringify(e2) };
|
return this.request(t2);
|
}
|
reportUploadFile(e2) {
|
const t2 = { method: "serverless.file.resource.report", params: JSON.stringify(e2) };
|
return this.request(t2);
|
}
|
uploadFile({ filePath: e2, cloudPath: t2, fileType: n2 = "image", onUploadProgress: s2 }) {
|
if (!t2)
|
throw new te({ code: "CLOUDPATH_REQUIRED", message: "cloudPath不可为空" });
|
let r2;
|
return this.getUploadFileOptions({ cloudPath: t2 }).then((t3) => {
|
const { url: i2, formData: o2, name: a2 } = t3.result;
|
return r2 = t3.result.fileUrl, new Promise((t4, r3) => {
|
const c2 = this.adapter.uploadFile({ url: i2, formData: o2, name: a2, filePath: e2, fileType: n2, success(e3) {
|
e3 && e3.statusCode < 400 ? t4(e3) : r3(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
|
}, fail(e3) {
|
r3(new te({ code: e3.code || "UPLOAD_FAILED", message: e3.message || e3.errMsg || "文件上传失败" }));
|
} });
|
"function" == typeof s2 && c2 && "function" == typeof c2.onProgressUpdate && c2.onProgressUpdate((e3) => {
|
s2({ loaded: e3.totalBytesSent, total: e3.totalBytesExpectedToSend });
|
});
|
});
|
}).then(() => this.reportUploadFile({ cloudPath: t2 })).then((t3) => new Promise((n3, s3) => {
|
t3.success ? n3({ success: true, filePath: e2, fileID: r2 }) : s3(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
|
}));
|
}
|
deleteFile({ fileList: e2 }) {
|
const t2 = { method: "serverless.file.resource.delete", params: JSON.stringify({ fileList: e2 }) };
|
return this.request(t2).then((e3) => {
|
if (e3.success)
|
return e3.result;
|
throw new te({ code: "DELETE_FILE_FAILED", message: "删除文件失败" });
|
});
|
}
|
getTempFileURL({ fileList: e2, maxAge: t2 } = {}) {
|
if (!Array.isArray(e2) || 0 === e2.length)
|
throw new te({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" });
|
const n2 = { method: "serverless.file.resource.getTempFileURL", params: JSON.stringify({ fileList: e2, maxAge: t2 }) };
|
return this.request(n2).then((e3) => {
|
if (e3.success)
|
return { fileList: e3.result.fileList.map((e4) => ({ fileID: e4.fileID, tempFileURL: e4.tempFileURL })) };
|
throw new te({ code: "GET_TEMP_FILE_URL_FAILED", message: "获取临时文件链接失败" });
|
});
|
}
|
};
|
var Rt = { init(e2) {
|
const t2 = new Nt(e2), n2 = { signInAnonymously: function() {
|
return Promise.resolve();
|
}, getLoginState: function() {
|
return Promise.resolve(false);
|
} };
|
return t2.auth = function() {
|
return n2;
|
}, t2.customAuth = t2.auth, t2;
|
} }, Lt = n(function(e2, t2) {
|
e2.exports = r.enc.Hex;
|
});
|
function Ut() {
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e2) {
|
var t2 = 16 * Math.random() | 0;
|
return ("x" === e2 ? t2 : 3 & t2 | 8).toString(16);
|
});
|
}
|
function Dt(e2 = "", t2 = {}) {
|
const { data: n2, functionName: s2, method: r2, headers: i2, signHeaderKeys: o2 = [], config: a2 } = t2, c2 = String(Date.now()), u2 = Ut(), h2 = Object.assign({}, i2, { "x-from-app-id": a2.spaceAppId, "x-from-env-id": a2.spaceId, "x-to-env-id": a2.spaceId, "x-from-instance-id": c2, "x-from-function-name": s2, "x-client-timestamp": c2, "x-alipay-source": "client", "x-request-id": u2, "x-alipay-callid": u2, "x-trace-id": u2 }), l2 = ["x-from-app-id", "x-from-env-id", "x-to-env-id", "x-from-instance-id", "x-from-function-name", "x-client-timestamp"].concat(o2), [d2 = "", p2 = ""] = e2.split("?") || [], f2 = function(e3) {
|
const t3 = "HMAC-SHA256", n3 = e3.signedHeaders.join(";"), s3 = e3.signedHeaders.map((t4) => `${t4.toLowerCase()}:${e3.headers[t4]}
|
`).join(""), r3 = we(e3.body).toString(Lt), i3 = `${e3.method.toUpperCase()}
|
${e3.path}
|
${e3.query}
|
${s3}
|
${n3}
|
${r3}
|
`, o3 = we(i3).toString(Lt), a3 = `${t3}
|
${e3.timestamp}
|
${o3}
|
`, c3 = Ie(a3, e3.secretKey).toString(Lt);
|
return `${t3} Credential=${e3.secretId}, SignedHeaders=${n3}, Signature=${c3}`;
|
}({ path: d2, query: p2, method: r2, headers: h2, timestamp: c2, body: JSON.stringify(n2), secretId: a2.accessKey, secretKey: a2.secretKey, signedHeaders: l2.sort() });
|
return { url: `${a2.endpoint}${e2}`, headers: Object.assign({}, h2, { Authorization: f2 }) };
|
}
|
function Mt({ url: e2, data: t2, method: n2 = "POST", headers: s2 = {}, timeout: r2 }) {
|
return new Promise((i2, o2) => {
|
ne.request({ url: e2, method: n2, data: "object" == typeof t2 ? JSON.stringify(t2) : t2, header: s2, dataType: "json", timeout: r2, complete: (e3 = {}) => {
|
const t3 = s2["x-trace-id"] || "";
|
if (!e3.statusCode || e3.statusCode >= 400) {
|
const { message: n3, errMsg: s3, trace_id: r3 } = e3.data || {};
|
return o2(new te({ code: "SYS_ERR", message: n3 || s3 || "request:fail", requestId: r3 || t3 }));
|
}
|
i2({ status: e3.statusCode, data: e3.data, headers: e3.header, requestId: t3 });
|
} });
|
});
|
}
|
function qt(e2, t2) {
|
const { path: n2, data: s2, method: r2 = "GET" } = e2, { url: i2, headers: o2 } = Dt(n2, { functionName: "", data: s2, method: r2, headers: { "x-alipay-cloud-mode": "oss", "x-data-api-type": "oss", "x-expire-timestamp": Date.now() + 6e4 }, signHeaderKeys: ["x-data-api-type", "x-expire-timestamp"], config: t2 });
|
return Mt({ url: i2, data: s2, method: r2, headers: o2 }).then((e3) => {
|
const t3 = e3.data || {};
|
if (!t3.success)
|
throw new te({ code: e3.errCode, message: e3.errMsg, requestId: e3.requestId });
|
return t3.data || {};
|
}).catch((e3) => {
|
throw new te({ code: e3.errCode, message: e3.errMsg, requestId: e3.requestId });
|
});
|
}
|
function Ft(e2 = "") {
|
const t2 = e2.trim().replace(/^cloud:\/\//, ""), n2 = t2.indexOf("/");
|
if (n2 <= 0)
|
throw new te({ code: "INVALID_PARAM", message: "fileID不合法" });
|
const s2 = t2.substring(0, n2), r2 = t2.substring(n2 + 1);
|
return s2 !== this.config.spaceId && console.warn("file ".concat(e2, " does not belong to env ").concat(this.config.spaceId)), r2;
|
}
|
function Kt(e2 = "") {
|
return "cloud://".concat(this.config.spaceId, "/").concat(e2.replace(/^\/+/, ""));
|
}
|
class jt {
|
constructor(e2) {
|
this.config = e2;
|
}
|
signedURL(e2, t2 = {}) {
|
const n2 = `/ws/function/${e2}`, s2 = this.config.wsEndpoint.replace(/^ws(s)?:\/\//, ""), r2 = Object.assign({}, t2, { accessKeyId: this.config.accessKey, signatureNonce: Ut(), timestamp: "" + Date.now() }), i2 = [n2, ["accessKeyId", "authorization", "signatureNonce", "timestamp"].sort().map(function(e3) {
|
return r2[e3] ? "".concat(e3, "=").concat(r2[e3]) : null;
|
}).filter(Boolean).join("&"), `host:${s2}`].join("\n"), o2 = ["HMAC-SHA256", we(i2).toString(Lt)].join("\n"), a2 = Ie(o2, this.config.secretKey).toString(Lt), c2 = Object.keys(r2).map((e3) => `${e3}=${encodeURIComponent(r2[e3])}`).join("&");
|
return `${this.config.wsEndpoint}${n2}?${c2}&signature=${a2}`;
|
}
|
}
|
var $t = class {
|
constructor(e2) {
|
if (["spaceId", "spaceAppId", "accessKey", "secretKey"].forEach((t2) => {
|
if (!Object.prototype.hasOwnProperty.call(e2, t2))
|
throw new Error(`${t2} required`);
|
}), e2.endpoint) {
|
if ("string" != typeof e2.endpoint)
|
throw new Error("endpoint must be string");
|
if (!/^https:\/\//.test(e2.endpoint))
|
throw new Error("endpoint must start with https://");
|
e2.endpoint = e2.endpoint.replace(/\/$/, "");
|
}
|
this.config = Object.assign({}, e2, { endpoint: e2.endpoint || `https://${e2.spaceId}.api-hz.cloudbasefunction.cn`, wsEndpoint: e2.wsEndpoint || `wss://${e2.spaceId}.api-hz.cloudbasefunction.cn` }), this._websocket = new jt(this.config);
|
}
|
callFunction(e2) {
|
return function(e3, t2) {
|
const { name: n2, data: s2, async: r2 = false, timeout: i2 } = e3, o2 = "POST", a2 = { "x-to-function-name": n2 };
|
r2 && (a2["x-function-invoke-type"] = "async");
|
const { url: c2, headers: u2 } = Dt("/functions/invokeFunction", { functionName: n2, data: s2, method: o2, headers: a2, signHeaderKeys: ["x-to-function-name"], config: t2 });
|
return Mt({ url: c2, data: s2, method: o2, headers: u2, timeout: i2 }).then((e4) => {
|
let t3 = 0;
|
if (r2) {
|
const n3 = e4.data || {};
|
t3 = "200" === n3.errCode ? 0 : n3.errCode, e4.data = n3.data || {}, e4.errMsg = n3.errMsg;
|
}
|
if (0 !== t3)
|
throw new te({ code: t3, message: e4.errMsg, requestId: e4.requestId });
|
return { errCode: t3, success: 0 === t3, requestId: e4.requestId, result: e4.data };
|
}).catch((e4) => {
|
throw new te({ code: e4.errCode, message: e4.errMsg, requestId: e4.requestId });
|
});
|
}(e2, this.config);
|
}
|
uploadFileToOSS({ url: e2, filePath: t2, fileType: n2, formData: s2, onUploadProgress: r2 }) {
|
return new Promise((i2, o2) => {
|
const a2 = ne.uploadFile({ url: e2, filePath: t2, fileType: n2, formData: s2, name: "file", success(e3) {
|
e3 && e3.statusCode < 400 ? i2(e3) : o2(new te({ code: "UPLOAD_FAILED", message: "文件上传失败" }));
|
}, fail(e3) {
|
o2(new te({ code: e3.code || "UPLOAD_FAILED", message: e3.message || e3.errMsg || "文件上传失败" }));
|
} });
|
"function" == typeof r2 && a2 && "function" == typeof a2.onProgressUpdate && a2.onProgressUpdate((e3) => {
|
r2({ loaded: e3.totalBytesSent, total: e3.totalBytesExpectedToSend });
|
});
|
});
|
}
|
async uploadFile({ filePath: e2, cloudPath: t2 = "", fileType: n2 = "image", onUploadProgress: s2 }) {
|
if ("string" !== g(t2))
|
throw new te({ code: "INVALID_PARAM", message: "cloudPath必须为字符串类型" });
|
if (!(t2 = t2.trim()))
|
throw new te({ code: "INVALID_PARAM", message: "cloudPath不可为空" });
|
if (/:\/\//.test(t2))
|
throw new te({ code: "INVALID_PARAM", message: "cloudPath不合法" });
|
const r2 = await qt({ path: "/".concat(t2.replace(/^\//, ""), "?post_url") }, this.config), { file_id: i2, upload_url: o2, form_data: a2 } = r2, c2 = a2 && a2.reduce((e3, t3) => (e3[t3.key] = t3.value, e3), {});
|
return this.uploadFileToOSS({ url: o2, filePath: e2, fileType: n2, formData: c2, onUploadProgress: s2 }).then(() => ({ fileID: i2 }));
|
}
|
async getTempFileURL({ fileList: e2 }) {
|
return new Promise((t2, n2) => {
|
(!e2 || e2.length < 0) && t2({ code: "INVALID_PARAM", message: "fileList不能为空数组" }), e2.length > 50 && t2({ code: "INVALID_PARAM", message: "fileList数组长度不能超过50" });
|
const s2 = [];
|
for (const n3 of e2) {
|
let e3;
|
"string" !== g(n3) && t2({ code: "INVALID_PARAM", message: "fileList的元素必须是非空的字符串" });
|
try {
|
e3 = Ft.call(this, n3);
|
} catch (t3) {
|
console.warn(t3.errCode, t3.errMsg), e3 = n3;
|
}
|
s2.push({ file_id: e3, expire: 600 });
|
}
|
qt({ path: "/?download_url", data: { file_list: s2 }, method: "POST" }, this.config).then((e3) => {
|
const { file_list: n3 = [] } = e3;
|
t2({ fileList: n3.map((e4) => ({ fileID: Kt.call(this, e4.file_id), tempFileURL: e4.download_url })) });
|
}).catch((e3) => n2(e3));
|
});
|
}
|
async connectWebSocket(e2) {
|
const { name: t2, query: n2 } = e2;
|
return ne.connectSocket({ url: this._websocket.signedURL(t2, n2), complete: () => {
|
} });
|
}
|
};
|
var Bt = { init: (e2) => {
|
e2.provider = "alipay";
|
const t2 = new $t(e2);
|
return t2.auth = function() {
|
return { signInAnonymously: function() {
|
return Promise.resolve();
|
}, getLoginState: function() {
|
return Promise.resolve(true);
|
} };
|
}, t2;
|
} };
|
function Wt({ data: e2 }) {
|
let t2;
|
t2 = le();
|
const n2 = JSON.parse(JSON.stringify(e2 || {}));
|
if (Object.assign(n2, { clientInfo: t2 }), !n2.uniIdToken) {
|
const { token: e3 } = re();
|
e3 && (n2.uniIdToken = e3);
|
}
|
return n2;
|
}
|
async function Ht(e2 = {}) {
|
await this.__dev__.initLocalNetwork();
|
const { localAddress: t2, localPort: n2 } = this.__dev__, s2 = { aliyun: "aliyun", tencent: "tcb", alipay: "alipay", dcloud: "dcloud" }[this.config.provider], r2 = this.config.spaceId, i2 = `http://${t2}:${n2}/system/check-function`, o2 = `http://${t2}:${n2}/cloudfunctions/${e2.name}`;
|
return new Promise((t3, n3) => {
|
ne.request({ method: "POST", url: i2, data: { name: e2.name, platform: P, provider: s2, spaceId: r2 }, timeout: 3e3, success(e3) {
|
t3(e3);
|
}, fail() {
|
t3({ data: { code: "NETWORK_ERROR", message: "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下,自动切换为已部署的云函数。" } });
|
} });
|
}).then(({ data: e3 } = {}) => {
|
const { code: t3, message: n3 } = e3 || {};
|
return { code: 0 === t3 ? 0 : t3 || "SYS_ERR", message: n3 || "SYS_ERR" };
|
}).then(({ code: t3, message: n3 }) => {
|
if (0 !== t3) {
|
switch (t3) {
|
case "MODULE_ENCRYPTED":
|
console.error(`此云函数(${e2.name})依赖加密公共模块不可本地调试,自动切换为云端已部署的云函数`);
|
break;
|
case "FUNCTION_ENCRYPTED":
|
console.error(`此云函数(${e2.name})已加密不可本地调试,自动切换为云端已部署的云函数`);
|
break;
|
case "ACTION_ENCRYPTED":
|
console.error(n3 || "需要访问加密的uni-clientDB-action,自动切换为云端环境");
|
break;
|
case "NETWORK_ERROR":
|
console.error(n3 || "连接本地调试服务失败,请检查客户端是否和主机在同一局域网下");
|
break;
|
case "SWITCH_TO_CLOUD":
|
break;
|
default: {
|
const e3 = `检测本地调试服务出现错误:${n3},请检查网络环境或重启客户端再试`;
|
throw console.error(e3), new Error(e3);
|
}
|
}
|
return this._callCloudFunction(e2);
|
}
|
return new Promise((t4, n4) => {
|
const r3 = Wt.call(this, { data: e2.data });
|
ne.request({ method: "POST", url: o2, data: { provider: s2, platform: P, param: r3 }, timeout: e2.timeout, success: ({ statusCode: e3, data: s3 } = {}) => !e3 || e3 >= 400 ? n4(new te({ code: s3.code || "SYS_ERR", message: s3.message || "request:fail" })) : t4({ result: s3 }), fail(e3) {
|
n4(new te({ code: e3.code || e3.errCode || "SYS_ERR", message: e3.message || e3.errMsg || "request:fail" }));
|
} });
|
});
|
});
|
}
|
const Jt = [{ rule: /fc_function_not_found|FUNCTION_NOT_FOUND/, content: ",云函数[{functionName}]在云端不存在,请检查此云函数名称是否正确以及该云函数是否已上传到服务空间", mode: "append" }];
|
var zt = /[\\^$.*+?()[\]{}|]/g, Vt = RegExp(zt.source);
|
function Gt(e2, t2, n2) {
|
return e2.replace(new RegExp((s2 = t2) && Vt.test(s2) ? s2.replace(zt, "\\$&") : s2, "g"), n2);
|
var s2;
|
}
|
const Yt = { NONE: "none", REQUEST: "request", RESPONSE: "response", BOTH: "both" }, Qt = "_globalUniCloudStatus", Xt = "_globalUniCloudSecureNetworkCache__{spaceId}", Zt = "uni-secure-network", en$2 = { SYSTEM_ERROR: { code: 2e4, message: "System error" }, APP_INFO_INVALID: { code: 20101, message: "Invalid client" }, GET_ENCRYPT_KEY_FAILED: { code: 20102, message: "Get encrypt key failed" } };
|
function nn(e2) {
|
const { errSubject: t2, subject: n2, errCode: s2, errMsg: r2, code: i2, message: o2, cause: a2 } = e2 || {};
|
return new te({ subject: t2 || n2 || Zt, code: s2 || i2 || en$2.SYSTEM_ERROR.code, message: r2 || o2, cause: a2 });
|
}
|
let Kn;
|
function Hn({ secretType: e2 } = {}) {
|
return e2 === Yt.REQUEST || e2 === Yt.RESPONSE || e2 === Yt.BOTH;
|
}
|
function Jn({ name: e2, data: t2 = {} } = {}) {
|
return "DCloud-clientDB" === e2 && "encryption" === t2.redirectTo && "getAppClientKey" === t2.action;
|
}
|
function zn({ provider: e2, spaceId: t2, functionName: n2 } = {}) {
|
const { appId: s2, uniPlatform: r2, osName: i2 } = ce();
|
let o2 = r2;
|
"app" === r2 && (o2 = i2);
|
const a2 = function({ provider: e3, spaceId: t3 } = {}) {
|
const n3 = A;
|
if (!n3)
|
return {};
|
e3 = /* @__PURE__ */ function(e4) {
|
return "tencent" === e4 ? "tcb" : e4;
|
}(e3);
|
const s3 = n3.find((n4) => n4.provider === e3 && n4.spaceId === t3);
|
return s3 && s3.config;
|
}({ provider: e2, spaceId: t2 });
|
if (!a2 || !a2.accessControl || !a2.accessControl.enable)
|
return false;
|
const c2 = a2.accessControl.function || {}, u2 = Object.keys(c2);
|
if (0 === u2.length)
|
return true;
|
const h2 = function(e3, t3) {
|
let n3, s3, r3;
|
for (let i3 = 0; i3 < e3.length; i3++) {
|
const o3 = e3[i3];
|
o3 !== t3 ? "*" !== o3 ? o3.split(",").map((e4) => e4.trim()).indexOf(t3) > -1 && (s3 = o3) : r3 = o3 : n3 = o3;
|
}
|
return n3 || s3 || r3;
|
}(u2, n2);
|
if (!h2)
|
return false;
|
if ((c2[h2] || []).find((e3 = {}) => e3.appId === s2 && (e3.platform || "").toLowerCase() === o2.toLowerCase()))
|
return true;
|
throw console.error(`此应用[appId: ${s2}, platform: ${o2}]不在云端配置的允许访问的应用列表内,参考:https://uniapp.dcloud.net.cn/uniCloud/secure-network.html#verify-client`), nn(en$2.APP_INFO_INVALID);
|
}
|
function Vn({ functionName: e2, result: t2, logPvd: n2 }) {
|
if (this.__dev__.debugLog && t2 && t2.requestId) {
|
const s2 = JSON.stringify({ spaceId: this.config.spaceId, functionName: e2, requestId: t2.requestId });
|
console.log(`[${n2}-request]${s2}[/${n2}-request]`);
|
}
|
}
|
function Gn(e2) {
|
const t2 = e2.callFunction, n2 = function(n3) {
|
const s2 = n3.name;
|
n3.data = Wt.call(e2, { data: n3.data });
|
const r2 = { aliyun: "aliyun", tencent: "tcb", tcb: "tcb", alipay: "alipay", dcloud: "dcloud" }[this.config.provider], i2 = Hn(n3), o2 = Jn(n3), a2 = i2 || o2;
|
return t2.call(this, n3).then((e3) => (e3.errCode = 0, !a2 && Vn.call(this, { functionName: s2, result: e3, logPvd: r2 }), Promise.resolve(e3)), (e3) => (!a2 && Vn.call(this, { functionName: s2, result: e3, logPvd: r2 }), e3 && e3.message && (e3.message = function({ message: e4 = "", extraInfo: t3 = {}, formatter: n4 = [] } = {}) {
|
for (let s3 = 0; s3 < n4.length; s3++) {
|
const { rule: r3, content: i3, mode: o3 } = n4[s3], a3 = e4.match(r3);
|
if (!a3)
|
continue;
|
let c2 = i3;
|
for (let e5 = 1; e5 < a3.length; e5++)
|
c2 = Gt(c2, `{$${e5}}`, a3[e5]);
|
for (const e5 in t3)
|
c2 = Gt(c2, `{${e5}}`, t3[e5]);
|
return "replace" === o3 ? c2 : e4 + c2;
|
}
|
return e4;
|
}({ message: `[${n3.name}]: ${e3.message}`, formatter: Jt, extraInfo: { functionName: s2 } })), Promise.reject(e3)));
|
};
|
e2.callFunction = function(t3) {
|
const { provider: s2, spaceId: r2 } = e2.config, i2 = t3.name;
|
let o2, a2;
|
if (t3.data = t3.data || {}, e2.__dev__.debugInfo && !e2.__dev__.debugInfo.forceRemote && O ? (e2._callCloudFunction || (e2._callCloudFunction = n2, e2._callLocalFunction = Ht), o2 = Ht) : o2 = n2, o2 = o2.bind(e2), Jn(t3))
|
a2 = n2.call(e2, t3);
|
else if (Hn(t3)) {
|
a2 = new Kn({ secretType: t3.secretType, uniCloudIns: e2 }).wrapEncryptDataCallFunction(n2.bind(e2))(t3);
|
} else if (zn({ provider: s2, spaceId: r2, functionName: i2 })) {
|
a2 = new Kn({ secretType: t3.secretType, uniCloudIns: e2 }).wrapVerifyClientCallFunction(n2.bind(e2))(t3);
|
} else
|
a2 = o2(t3);
|
return Object.defineProperty(a2, "result", { get: () => (console.warn("当前返回结果为Promise类型,不可直接访问其result属性,详情请参考:https://uniapp.dcloud.net.cn/uniCloud/faq?id=promise"), {}) }), a2.then((e3) => e3);
|
};
|
}
|
Kn = class {
|
constructor() {
|
throw nn({ message: `Platform ${P} is not enabled, please check whether secure network module is enabled in your manifest.json` });
|
}
|
};
|
const Yn = Symbol("CLIENT_DB_INTERNAL");
|
function Qn(e2, t2) {
|
return e2.then = "DoNotReturnProxyWithAFunctionNamedThen", e2._internalType = Yn, e2.inspect = null, e2.__v_raw = void 0, new Proxy(e2, { get(e3, n2, s2) {
|
if ("_uniClient" === n2)
|
return null;
|
if ("symbol" == typeof n2)
|
return e3[n2];
|
if (n2 in e3 || "string" != typeof n2) {
|
const t3 = e3[n2];
|
return "function" == typeof t3 ? t3.bind(e3) : t3;
|
}
|
return t2.get(e3, n2, s2);
|
} });
|
}
|
function Xn(e2) {
|
return { on: (t2, n2) => {
|
e2[t2] = e2[t2] || [], e2[t2].indexOf(n2) > -1 || e2[t2].push(n2);
|
}, off: (t2, n2) => {
|
e2[t2] = e2[t2] || [];
|
const s2 = e2[t2].indexOf(n2);
|
-1 !== s2 && e2[t2].splice(s2, 1);
|
} };
|
}
|
const Zn = ["db.Geo", "db.command", "command.aggregate"];
|
function es(e2, t2) {
|
return Zn.indexOf(`${e2}.${t2}`) > -1;
|
}
|
function ts(e2) {
|
switch (g(e2 = se(e2))) {
|
case "array":
|
return e2.map((e3) => ts(e3));
|
case "object":
|
return e2._internalType === Yn || Object.keys(e2).forEach((t2) => {
|
e2[t2] = ts(e2[t2]);
|
}), e2;
|
case "regexp":
|
return { $regexp: { source: e2.source, flags: e2.flags } };
|
case "date":
|
return { $date: e2.toISOString() };
|
default:
|
return e2;
|
}
|
}
|
function ns(e2) {
|
return e2 && e2.content && e2.content.$method;
|
}
|
class ss {
|
constructor(e2, t2, n2) {
|
this.content = e2, this.prevStage = t2 || null, this.udb = null, this._database = n2;
|
}
|
toJSON() {
|
let e2 = this;
|
const t2 = [e2.content];
|
for (; e2.prevStage; )
|
e2 = e2.prevStage, t2.push(e2.content);
|
return { $db: t2.reverse().map((e3) => ({ $method: e3.$method, $param: ts(e3.$param) })) };
|
}
|
toString() {
|
return JSON.stringify(this.toJSON());
|
}
|
getAction() {
|
const e2 = this.toJSON().$db.find((e3) => "action" === e3.$method);
|
return e2 && e2.$param && e2.$param[0];
|
}
|
getCommand() {
|
return { $db: this.toJSON().$db.filter((e2) => "action" !== e2.$method) };
|
}
|
get isAggregate() {
|
let e2 = this;
|
for (; e2; ) {
|
const t2 = ns(e2), n2 = ns(e2.prevStage);
|
if ("aggregate" === t2 && "collection" === n2 || "pipeline" === t2)
|
return true;
|
e2 = e2.prevStage;
|
}
|
return false;
|
}
|
get isCommand() {
|
let e2 = this;
|
for (; e2; ) {
|
if ("command" === ns(e2))
|
return true;
|
e2 = e2.prevStage;
|
}
|
return false;
|
}
|
get isAggregateCommand() {
|
let e2 = this;
|
for (; e2; ) {
|
const t2 = ns(e2), n2 = ns(e2.prevStage);
|
if ("aggregate" === t2 && "command" === n2)
|
return true;
|
e2 = e2.prevStage;
|
}
|
return false;
|
}
|
getNextStageFn(e2) {
|
const t2 = this;
|
return function() {
|
return rs({ $method: e2, $param: ts(Array.from(arguments)) }, t2, t2._database);
|
};
|
}
|
get count() {
|
return this.isAggregate ? this.getNextStageFn("count") : function() {
|
return this._send("count", Array.from(arguments));
|
};
|
}
|
get remove() {
|
return this.isCommand ? this.getNextStageFn("remove") : function() {
|
return this._send("remove", Array.from(arguments));
|
};
|
}
|
get() {
|
return this._send("get", Array.from(arguments));
|
}
|
get add() {
|
return this.isCommand ? this.getNextStageFn("add") : function() {
|
return this._send("add", Array.from(arguments));
|
};
|
}
|
update() {
|
return this._send("update", Array.from(arguments));
|
}
|
end() {
|
return this._send("end", Array.from(arguments));
|
}
|
get set() {
|
return this.isCommand ? this.getNextStageFn("set") : function() {
|
throw new Error("JQL禁止使用set方法");
|
};
|
}
|
_send(e2, t2) {
|
const n2 = this.getAction(), s2 = this.getCommand();
|
if (s2.$db.push({ $method: e2, $param: ts(t2) }), b) {
|
const e3 = s2.$db.find((e4) => "collection" === e4.$method), t3 = e3 && e3.$param;
|
t3 && 1 === t3.length && "string" == typeof e3.$param[0] && e3.$param[0].indexOf(",") > -1 && console.warn("检测到使用JQL语法联表查询时,未使用getTemp先过滤主表数据,在主表数据量大的情况下可能会查询缓慢。\n- 如何优化请参考此文档:https://uniapp.dcloud.net.cn/uniCloud/jql?id=lookup-with-temp \n- 如果主表数据量很小请忽略此信息,项目发行时不会出现此提示。");
|
}
|
return this._database._callCloudFunction({ action: n2, command: s2 });
|
}
|
}
|
function rs(e2, t2, n2) {
|
return Qn(new ss(e2, t2, n2), { get(e3, t3) {
|
let s2 = "db";
|
return e3 && e3.content && (s2 = e3.content.$method), es(s2, t3) ? rs({ $method: t3 }, e3, n2) : function() {
|
return rs({ $method: t3, $param: ts(Array.from(arguments)) }, e3, n2);
|
};
|
} });
|
}
|
function is({ path: e2, method: t2 }) {
|
return class {
|
constructor() {
|
this.param = Array.from(arguments);
|
}
|
toJSON() {
|
return { $newDb: [...e2.map((e3) => ({ $method: e3 })), { $method: t2, $param: this.param }] };
|
}
|
toString() {
|
return JSON.stringify(this.toJSON());
|
}
|
};
|
}
|
class os {
|
constructor({ uniClient: e2 = {}, isJQL: t2 = false } = {}) {
|
this._uniClient = e2, this._authCallBacks = {}, this._dbCallBacks = {}, e2._isDefault && (this._dbCallBacks = U("_globalUniCloudDatabaseCallback")), t2 || (this.auth = Xn(this._authCallBacks)), this._isJQL = t2, Object.assign(this, Xn(this._dbCallBacks)), this.env = Qn({}, { get: (e3, t3) => ({ $env: t3 }) }), this.Geo = Qn({}, { get: (e3, t3) => is({ path: ["Geo"], method: t3 }) }), this.serverDate = is({ path: [], method: "serverDate" }), this.RegExp = is({ path: [], method: "RegExp" });
|
}
|
getCloudEnv(e2) {
|
if ("string" != typeof e2 || !e2.trim())
|
throw new Error("getCloudEnv参数错误");
|
return { $env: e2.replace("$cloudEnv_", "") };
|
}
|
_callback(e2, t2) {
|
const n2 = this._dbCallBacks;
|
n2[e2] && n2[e2].forEach((e3) => {
|
e3(...t2);
|
});
|
}
|
_callbackAuth(e2, t2) {
|
const n2 = this._authCallBacks;
|
n2[e2] && n2[e2].forEach((e3) => {
|
e3(...t2);
|
});
|
}
|
multiSend() {
|
const e2 = Array.from(arguments), t2 = e2.map((e3) => {
|
const t3 = e3.getAction(), n2 = e3.getCommand();
|
if ("getTemp" !== n2.$db[n2.$db.length - 1].$method)
|
throw new Error("multiSend只支持子命令内使用getTemp");
|
return { action: t3, command: n2 };
|
});
|
return this._callCloudFunction({ multiCommand: t2, queryList: e2 });
|
}
|
}
|
function as(e2, t2 = {}) {
|
return Qn(new e2(t2), { get: (e3, t3) => es("db", t3) ? rs({ $method: t3 }, null, e3) : function() {
|
return rs({ $method: t3, $param: ts(Array.from(arguments)) }, null, e3);
|
} });
|
}
|
class cs extends os {
|
_parseResult(e2) {
|
return this._isJQL ? e2.result : e2;
|
}
|
_callCloudFunction({ action: e2, command: t2, multiCommand: n2, queryList: s2 }) {
|
function r2(e3, t3) {
|
if (n2 && s2)
|
for (let n3 = 0; n3 < s2.length; n3++) {
|
const r3 = s2[n3];
|
r3.udb && "function" == typeof r3.udb.setResult && (t3 ? r3.udb.setResult(t3) : r3.udb.setResult(e3.result.dataList[n3]));
|
}
|
}
|
const i2 = this, o2 = this._isJQL ? "databaseForJQL" : "database";
|
function a2(e3) {
|
return i2._callback("error", [e3]), j($(o2, "fail"), e3).then(() => j($(o2, "complete"), e3)).then(() => (r2(null, e3), Y(H.RESPONSE, { type: J.CLIENT_DB, content: e3 }), Promise.reject(e3)));
|
}
|
const c2 = j($(o2, "invoke")), u2 = this._uniClient;
|
return c2.then(() => u2.callFunction({ name: "DCloud-clientDB", type: l.CLIENT_DB, data: { action: e2, command: t2, multiCommand: n2 } })).then((e3) => {
|
const { code: t3, message: n3, token: s3, tokenExpired: c3, systemInfo: u3 = [] } = e3.result;
|
if (u3)
|
for (let e4 = 0; e4 < u3.length; e4++) {
|
const { level: t4, message: n4, detail: s4 } = u3[e4];
|
let r3 = "[System Info]" + n4;
|
s4 && (r3 = `${r3}
|
详细信息:${s4}`), (console["warn" === t4 ? "error" : t4] || console.log)(r3);
|
}
|
if (t3) {
|
return a2(new te({ code: t3, message: n3, requestId: e3.requestId }));
|
}
|
e3.result.errCode = e3.result.errCode || e3.result.code, e3.result.errMsg = e3.result.errMsg || e3.result.message, s3 && c3 && (ie({ token: s3, tokenExpired: c3 }), this._callbackAuth("refreshToken", [{ token: s3, tokenExpired: c3 }]), this._callback("refreshToken", [{ token: s3, tokenExpired: c3 }]), Y(H.REFRESH_TOKEN, { token: s3, tokenExpired: c3 }));
|
const h2 = [{ prop: "affectedDocs", tips: "affectedDocs不再推荐使用,请使用inserted/deleted/updated/data.length替代" }, { prop: "code", tips: "code不再推荐使用,请使用errCode替代" }, { prop: "message", tips: "message不再推荐使用,请使用errMsg替代" }];
|
for (let t4 = 0; t4 < h2.length; t4++) {
|
const { prop: n4, tips: s4 } = h2[t4];
|
if (n4 in e3.result) {
|
const t5 = e3.result[n4];
|
Object.defineProperty(e3.result, n4, { get: () => (console.warn(s4), t5) });
|
}
|
}
|
return function(e4) {
|
return j($(o2, "success"), e4).then(() => j($(o2, "complete"), e4)).then(() => {
|
r2(e4, null);
|
const t4 = i2._parseResult(e4);
|
return Y(H.RESPONSE, { type: J.CLIENT_DB, content: t4 }), Promise.resolve(t4);
|
});
|
}(e3);
|
}, (e3) => {
|
/fc_function_not_found|FUNCTION_NOT_FOUND/g.test(e3.message) && console.warn("clientDB未初始化,请在web控制台保存一次schema以开启clientDB");
|
return a2(new te({ code: e3.code || "SYSTEM_ERROR", message: e3.message, requestId: e3.requestId }));
|
});
|
}
|
}
|
const us = "token无效,跳转登录页面", hs = "token过期,跳转登录页面", ls = { TOKEN_INVALID_TOKEN_EXPIRED: hs, TOKEN_INVALID_INVALID_CLIENTID: us, TOKEN_INVALID: us, TOKEN_INVALID_WRONG_TOKEN: us, TOKEN_INVALID_ANONYMOUS_USER: us }, ds = { "uni-id-token-expired": hs, "uni-id-check-token-failed": us, "uni-id-token-not-exist": us, "uni-id-check-device-feature-failed": us }, ps = { ...ls, ...ds, default: "用户未登录或登录状态过期,自动跳转登录页面" };
|
function fs(e2, t2) {
|
let n2 = "";
|
return n2 = e2 ? `${e2}/${t2}` : t2, n2.replace(/^\//, "");
|
}
|
function gs(e2 = [], t2 = "") {
|
const n2 = [], s2 = [];
|
return e2.forEach((e3) => {
|
true === e3.needLogin ? n2.push(fs(t2, e3.path)) : false === e3.needLogin && s2.push(fs(t2, e3.path));
|
}), { needLoginPage: n2, notNeedLoginPage: s2 };
|
}
|
function ms(e2) {
|
return e2.split("?")[0].replace(/^\//, "");
|
}
|
function ys() {
|
return function(e2) {
|
let t2 = e2 && e2.$page && e2.$page.fullPath;
|
return t2 ? ("/" !== t2.charAt(0) && (t2 = "/" + t2), t2) : "";
|
}(function() {
|
const e2 = getCurrentPages();
|
return e2[e2.length - 1];
|
}());
|
}
|
function _s() {
|
return ms(ys());
|
}
|
function ws(e2 = "", t2 = {}) {
|
if (!e2)
|
return false;
|
if (!(t2 && t2.list && t2.list.length))
|
return false;
|
const n2 = t2.list, s2 = ms(e2);
|
return n2.some((e3) => e3.pagePath === s2);
|
}
|
const Is = !!e.uniIdRouter;
|
const { loginPage: vs, routerNeedLogin: Ss, resToLogin: Ts, needLoginPage: bs, notNeedLoginPage: Es, loginPageInTabBar: ks } = function({ pages: t2 = [], subPackages: n2 = [], uniIdRouter: s2 = {}, tabBar: r2 = {} } = e) {
|
const { loginPage: i2, needLogin: o2 = [], resToLogin: a2 = true } = s2, { needLoginPage: c2, notNeedLoginPage: u2 } = gs(t2), { needLoginPage: h2, notNeedLoginPage: l2 } = function(e2 = []) {
|
const t3 = [], n3 = [];
|
return e2.forEach((e3) => {
|
const { root: s3, pages: r3 = [] } = e3, { needLoginPage: i3, notNeedLoginPage: o3 } = gs(r3, s3);
|
t3.push(...i3), n3.push(...o3);
|
}), { needLoginPage: t3, notNeedLoginPage: n3 };
|
}(n2);
|
return { loginPage: i2, routerNeedLogin: o2, resToLogin: a2, needLoginPage: [...c2, ...h2], notNeedLoginPage: [...u2, ...l2], loginPageInTabBar: ws(i2, r2) };
|
}();
|
if (bs.indexOf(vs) > -1)
|
throw new Error(`Login page [${vs}] should not be "needLogin", please check your pages.json`);
|
function As(e2) {
|
const t2 = _s();
|
if ("/" === e2.charAt(0))
|
return e2;
|
const [n2, s2] = e2.split("?"), r2 = n2.replace(/^\//, "").split("/"), i2 = t2.split("/");
|
i2.pop();
|
for (let e3 = 0; e3 < r2.length; e3++) {
|
const t3 = r2[e3];
|
".." === t3 ? i2.pop() : "." !== t3 && i2.push(t3);
|
}
|
return "" === i2[0] && i2.shift(), "/" + i2.join("/") + (s2 ? "?" + s2 : "");
|
}
|
function Ps(e2) {
|
const t2 = ms(As(e2));
|
return !(Es.indexOf(t2) > -1) && (bs.indexOf(t2) > -1 || Ss.some((t3) => function(e3, t4) {
|
return new RegExp(t4).test(e3);
|
}(e2, t3)));
|
}
|
function Cs({ redirect: e2 }) {
|
const t2 = ms(e2), n2 = ms(vs);
|
return _s() !== n2 && t2 !== n2;
|
}
|
function Os({ api: e2, redirect: t2 } = {}) {
|
if (!t2 || !Cs({ redirect: t2 }))
|
return;
|
const n2 = function(e3, t3) {
|
return "/" !== e3.charAt(0) && (e3 = "/" + e3), t3 ? e3.indexOf("?") > -1 ? e3 + `&uniIdRedirectUrl=${encodeURIComponent(t3)}` : e3 + `?uniIdRedirectUrl=${encodeURIComponent(t3)}` : e3;
|
}(vs, t2);
|
ks ? "navigateTo" !== e2 && "redirectTo" !== e2 || (e2 = "switchTab") : "switchTab" === e2 && (e2 = "navigateTo");
|
const s2 = { navigateTo: uni.navigateTo, redirectTo: uni.redirectTo, switchTab: uni.switchTab, reLaunch: uni.reLaunch };
|
setTimeout(() => {
|
s2[e2]({ url: n2 });
|
}, 0);
|
}
|
function xs({ url: e2 } = {}) {
|
const t2 = { abortLoginPageJump: false, autoToLoginPage: false }, n2 = function() {
|
const { token: e3, tokenExpired: t3 } = re();
|
let n3;
|
if (e3) {
|
if (t3 < Date.now()) {
|
const e4 = "uni-id-token-expired";
|
n3 = { errCode: e4, errMsg: ps[e4] };
|
}
|
} else {
|
const e4 = "uni-id-check-token-failed";
|
n3 = { errCode: e4, errMsg: ps[e4] };
|
}
|
return n3;
|
}();
|
if (Ps(e2) && n2) {
|
n2.uniIdRedirectUrl = e2;
|
if (z(H.NEED_LOGIN).length > 0)
|
return setTimeout(() => {
|
Y(H.NEED_LOGIN, n2);
|
}, 0), t2.abortLoginPageJump = true, t2;
|
t2.autoToLoginPage = true;
|
}
|
return t2;
|
}
|
function Ns() {
|
!function() {
|
const e3 = ys(), { abortLoginPageJump: t2, autoToLoginPage: n2 } = xs({ url: e3 });
|
t2 || n2 && Os({ api: "redirectTo", redirect: e3 });
|
}();
|
const e2 = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];
|
for (let t2 = 0; t2 < e2.length; t2++) {
|
const n2 = e2[t2];
|
uni.addInterceptor(n2, { invoke(e3) {
|
const { abortLoginPageJump: t3, autoToLoginPage: s2 } = xs({ url: e3.url });
|
return t3 ? e3 : s2 ? (Os({ api: n2, redirect: As(e3.url) }), false) : e3;
|
} });
|
}
|
}
|
function Rs() {
|
this.onResponse((e2) => {
|
const { type: t2, content: n2 } = e2;
|
let s2 = false;
|
switch (t2) {
|
case "cloudobject":
|
s2 = function(e3) {
|
if ("object" != typeof e3)
|
return false;
|
const { errCode: t3 } = e3 || {};
|
return t3 in ps;
|
}(n2);
|
break;
|
case "clientdb":
|
s2 = function(e3) {
|
if ("object" != typeof e3)
|
return false;
|
const { errCode: t3 } = e3 || {};
|
return t3 in ls;
|
}(n2);
|
}
|
s2 && function(e3 = {}) {
|
const t3 = z(H.NEED_LOGIN);
|
Z().then(() => {
|
const n3 = ys();
|
if (n3 && Cs({ redirect: n3 }))
|
return t3.length > 0 ? Y(H.NEED_LOGIN, Object.assign({ uniIdRedirectUrl: n3 }, e3)) : void (vs && Os({ api: "navigateTo", redirect: n3 }));
|
});
|
}(n2);
|
});
|
}
|
function Ls(e2) {
|
!function(e3) {
|
e3.onResponse = function(e4) {
|
V(H.RESPONSE, e4);
|
}, e3.offResponse = function(e4) {
|
G(H.RESPONSE, e4);
|
};
|
}(e2), function(e3) {
|
e3.onNeedLogin = function(e4) {
|
V(H.NEED_LOGIN, e4);
|
}, e3.offNeedLogin = function(e4) {
|
G(H.NEED_LOGIN, e4);
|
}, Is && (U(Qt).needLoginInit || (U(Qt).needLoginInit = true, Z().then(() => {
|
Ns.call(e3);
|
}), Ts && Rs.call(e3)));
|
}(e2), function(e3) {
|
e3.onRefreshToken = function(e4) {
|
V(H.REFRESH_TOKEN, e4);
|
}, e3.offRefreshToken = function(e4) {
|
G(H.REFRESH_TOKEN, e4);
|
};
|
}(e2);
|
}
|
let Us;
|
const Ds = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", Ms = /^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;
|
function qs() {
|
const e2 = re().token || "", t2 = e2.split(".");
|
if (!e2 || 3 !== t2.length)
|
return { uid: null, role: [], permission: [], tokenExpired: 0 };
|
let n2;
|
try {
|
n2 = JSON.parse((s2 = t2[1], decodeURIComponent(Us(s2).split("").map(function(e3) {
|
return "%" + ("00" + e3.charCodeAt(0).toString(16)).slice(-2);
|
}).join(""))));
|
} catch (e3) {
|
throw new Error("获取当前用户信息出错,详细错误信息为:" + e3.message);
|
}
|
var s2;
|
return n2.tokenExpired = 1e3 * n2.exp, delete n2.exp, delete n2.iat, n2;
|
}
|
Us = "function" != typeof atob ? function(e2) {
|
if (e2 = String(e2).replace(/[\t\n\f\r ]+/g, ""), !Ms.test(e2))
|
throw new Error("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
|
var t2;
|
e2 += "==".slice(2 - (3 & e2.length));
|
for (var n2, s2, r2 = "", i2 = 0; i2 < e2.length; )
|
t2 = Ds.indexOf(e2.charAt(i2++)) << 18 | Ds.indexOf(e2.charAt(i2++)) << 12 | (n2 = Ds.indexOf(e2.charAt(i2++))) << 6 | (s2 = Ds.indexOf(e2.charAt(i2++))), r2 += 64 === n2 ? String.fromCharCode(t2 >> 16 & 255) : 64 === s2 ? String.fromCharCode(t2 >> 16 & 255, t2 >> 8 & 255) : String.fromCharCode(t2 >> 16 & 255, t2 >> 8 & 255, 255 & t2);
|
return r2;
|
} : atob;
|
var Fs = n(function(e2, t2) {
|
Object.defineProperty(t2, "__esModule", { value: true });
|
const n2 = "chooseAndUploadFile:ok", s2 = "chooseAndUploadFile:fail";
|
function r2(e3, t3) {
|
return e3.tempFiles.forEach((e4, n3) => {
|
e4.name || (e4.name = e4.path.substring(e4.path.lastIndexOf("/") + 1)), t3 && (e4.fileType = t3), e4.cloudPath = Date.now() + "_" + n3 + e4.name.substring(e4.name.lastIndexOf("."));
|
}), e3.tempFilePaths || (e3.tempFilePaths = e3.tempFiles.map((e4) => e4.path)), e3;
|
}
|
function i2(e3, t3, { onChooseFile: s3, onUploadProgress: r3 }) {
|
return t3.then((e4) => {
|
if (s3) {
|
const t4 = s3(e4);
|
if (void 0 !== t4)
|
return Promise.resolve(t4).then((t5) => void 0 === t5 ? e4 : t5);
|
}
|
return e4;
|
}).then((t4) => false === t4 ? { errMsg: n2, tempFilePaths: [], tempFiles: [] } : function(e4, t5, s4 = 5, r4) {
|
(t5 = Object.assign({}, t5)).errMsg = n2;
|
const i3 = t5.tempFiles, o2 = i3.length;
|
let a2 = 0;
|
return new Promise((n3) => {
|
for (; a2 < s4; )
|
c2();
|
function c2() {
|
const s5 = a2++;
|
if (s5 >= o2)
|
return void (!i3.find((e5) => !e5.url && !e5.errMsg) && n3(t5));
|
const u2 = i3[s5];
|
e4.uploadFile({ provider: u2.provider, filePath: u2.path, cloudPath: u2.cloudPath, fileType: u2.fileType, cloudPathAsRealPath: u2.cloudPathAsRealPath, onUploadProgress(e5) {
|
e5.index = s5, e5.tempFile = u2, e5.tempFilePath = u2.path, r4 && r4(e5);
|
} }).then((e5) => {
|
u2.url = e5.fileID, s5 < o2 && c2();
|
}).catch((e5) => {
|
u2.errMsg = e5.errMsg || e5.message, s5 < o2 && c2();
|
});
|
}
|
});
|
}(e3, t4, 5, r3));
|
}
|
t2.initChooseAndUploadFile = function(e3) {
|
return function(t3 = { type: "all" }) {
|
return "image" === t3.type ? i2(e3, function(e4) {
|
const { count: t4, sizeType: n3, sourceType: i3 = ["album", "camera"], extension: o2 } = e4;
|
return new Promise((e5, a2) => {
|
uni.chooseImage({ count: t4, sizeType: n3, sourceType: i3, extension: o2, success(t5) {
|
e5(r2(t5, "image"));
|
}, fail(e6) {
|
a2({ errMsg: e6.errMsg.replace("chooseImage:fail", s2) });
|
} });
|
});
|
}(t3), t3) : "video" === t3.type ? i2(e3, function(e4) {
|
const { camera: t4, compressed: n3, maxDuration: i3, sourceType: o2 = ["album", "camera"], extension: a2 } = e4;
|
return new Promise((e5, c2) => {
|
uni.chooseVideo({ camera: t4, compressed: n3, maxDuration: i3, sourceType: o2, extension: a2, success(t5) {
|
const { tempFilePath: n4, duration: s3, size: i4, height: o3, width: a3 } = t5;
|
e5(r2({ errMsg: "chooseVideo:ok", tempFilePaths: [n4], tempFiles: [{ name: t5.tempFile && t5.tempFile.name || "", path: n4, size: i4, type: t5.tempFile && t5.tempFile.type || "", width: a3, height: o3, duration: s3, fileType: "video", cloudPath: "" }] }, "video"));
|
}, fail(e6) {
|
c2({ errMsg: e6.errMsg.replace("chooseVideo:fail", s2) });
|
} });
|
});
|
}(t3), t3) : i2(e3, function(e4) {
|
const { count: t4, extension: n3 } = e4;
|
return new Promise((e5, i3) => {
|
let o2 = uni.chooseFile;
|
if ("undefined" != typeof wx && "function" == typeof wx.chooseMessageFile && (o2 = wx.chooseMessageFile), "function" != typeof o2)
|
return i3({ errMsg: s2 + " 请指定 type 类型,该平台仅支持选择 image 或 video。" });
|
o2({ type: "all", count: t4, extension: n3, success(t5) {
|
e5(r2(t5));
|
}, fail(e6) {
|
i3({ errMsg: e6.errMsg.replace("chooseFile:fail", s2) });
|
} });
|
});
|
}(t3), t3);
|
};
|
};
|
}), Ks = t$4(Fs);
|
const js = { auto: "auto", onready: "onready", manual: "manual" };
|
function $s(e2) {
|
return { props: { localdata: { type: Array, default: () => [] }, options: { type: [Object, Array], default: () => ({}) }, spaceInfo: { type: Object, default: () => ({}) }, collection: { type: [String, Array], default: "" }, action: { type: String, default: "" }, field: { type: String, default: "" }, orderby: { type: String, default: "" }, where: { type: [String, Object], default: "" }, pageData: { type: String, default: "add" }, pageCurrent: { type: Number, default: 1 }, pageSize: { type: Number, default: 20 }, getcount: { type: [Boolean, String], default: false }, gettree: { type: [Boolean, String], default: false }, gettreepath: { type: [Boolean, String], default: false }, startwith: { type: String, default: "" }, limitlevel: { type: Number, default: 10 }, groupby: { type: String, default: "" }, groupField: { type: String, default: "" }, distinct: { type: [Boolean, String], default: false }, foreignKey: { type: String, default: "" }, loadtime: { type: String, default: "auto" }, manual: { type: Boolean, default: false } }, data: () => ({ mixinDatacomLoading: false, mixinDatacomHasMore: false, mixinDatacomResData: [], mixinDatacomErrorMessage: "", mixinDatacomPage: {}, mixinDatacomError: null }), created() {
|
this.mixinDatacomPage = { current: this.pageCurrent, size: this.pageSize, count: 0 }, this.$watch(() => {
|
var e3 = [];
|
return ["pageCurrent", "pageSize", "localdata", "collection", "action", "field", "orderby", "where", "getont", "getcount", "gettree", "groupby", "groupField", "distinct"].forEach((t2) => {
|
e3.push(this[t2]);
|
}), e3;
|
}, (e3, t2) => {
|
if (this.loadtime === js.manual)
|
return;
|
let n2 = false;
|
const s2 = [];
|
for (let r2 = 2; r2 < e3.length; r2++)
|
e3[r2] !== t2[r2] && (s2.push(e3[r2]), n2 = true);
|
e3[0] !== t2[0] && (this.mixinDatacomPage.current = this.pageCurrent), this.mixinDatacomPage.size = this.pageSize, this.onMixinDatacomPropsChange(n2, s2);
|
});
|
}, methods: { onMixinDatacomPropsChange(e3, t2) {
|
}, mixinDatacomEasyGet({ getone: e3 = false, success: t2, fail: n2 } = {}) {
|
this.mixinDatacomLoading || (this.mixinDatacomLoading = true, this.mixinDatacomErrorMessage = "", this.mixinDatacomError = null, this.mixinDatacomGet().then((n3) => {
|
this.mixinDatacomLoading = false;
|
const { data: s2, count: r2 } = n3.result;
|
this.getcount && (this.mixinDatacomPage.count = r2), this.mixinDatacomHasMore = s2.length < this.pageSize;
|
const i2 = e3 ? s2.length ? s2[0] : void 0 : s2;
|
this.mixinDatacomResData = i2, t2 && t2(i2);
|
}).catch((e4) => {
|
this.mixinDatacomLoading = false, this.mixinDatacomErrorMessage = e4, this.mixinDatacomError = e4, n2 && n2(e4);
|
}));
|
}, mixinDatacomGet(t2 = {}) {
|
let n2;
|
t2 = t2 || {}, n2 = "undefined" != typeof __uniX && __uniX ? e2.databaseForJQL(this.spaceInfo) : e2.database(this.spaceInfo);
|
const s2 = t2.action || this.action;
|
s2 && (n2 = n2.action(s2));
|
const r2 = t2.collection || this.collection;
|
n2 = Array.isArray(r2) ? n2.collection(...r2) : n2.collection(r2);
|
const i2 = t2.where || this.where;
|
i2 && Object.keys(i2).length && (n2 = n2.where(i2));
|
const o2 = t2.field || this.field;
|
o2 && (n2 = n2.field(o2));
|
const a2 = t2.foreignKey || this.foreignKey;
|
a2 && (n2 = n2.foreignKey(a2));
|
const c2 = t2.groupby || this.groupby;
|
c2 && (n2 = n2.groupBy(c2));
|
const u2 = t2.groupField || this.groupField;
|
u2 && (n2 = n2.groupField(u2));
|
true === (void 0 !== t2.distinct ? t2.distinct : this.distinct) && (n2 = n2.distinct());
|
const h2 = t2.orderby || this.orderby;
|
h2 && (n2 = n2.orderBy(h2));
|
const l2 = void 0 !== t2.pageCurrent ? t2.pageCurrent : this.mixinDatacomPage.current, d2 = void 0 !== t2.pageSize ? t2.pageSize : this.mixinDatacomPage.size, p2 = void 0 !== t2.getcount ? t2.getcount : this.getcount, f2 = void 0 !== t2.gettree ? t2.gettree : this.gettree, g2 = void 0 !== t2.gettreepath ? t2.gettreepath : this.gettreepath, m2 = { getCount: p2 }, y2 = { limitLevel: void 0 !== t2.limitlevel ? t2.limitlevel : this.limitlevel, startWith: void 0 !== t2.startwith ? t2.startwith : this.startwith };
|
return f2 && (m2.getTree = y2), g2 && (m2.getTreePath = y2), n2 = n2.skip(d2 * (l2 - 1)).limit(d2).get(m2), n2;
|
} } };
|
}
|
function Bs(e2) {
|
return function(t2, n2 = {}) {
|
n2 = function(e3, t3 = {}) {
|
return e3.customUI = t3.customUI || e3.customUI, e3.parseSystemError = t3.parseSystemError || e3.parseSystemError, Object.assign(e3.loadingOptions, t3.loadingOptions), Object.assign(e3.errorOptions, t3.errorOptions), "object" == typeof t3.secretMethods && (e3.secretMethods = t3.secretMethods), e3;
|
}({ customUI: false, loadingOptions: { title: "加载中...", mask: true }, errorOptions: { type: "modal", retry: false } }, n2);
|
const { customUI: s2, loadingOptions: r2, errorOptions: i2, parseSystemError: o2 } = n2, a2 = !s2;
|
return new Proxy({}, { get(s3, c2) {
|
switch (c2) {
|
case "toString":
|
return "[object UniCloudObject]";
|
case "toJSON":
|
return {};
|
}
|
return function({ fn: e3, interceptorName: t3, getCallbackArgs: n3 } = {}) {
|
return async function(...s4) {
|
const r3 = n3 ? n3({ params: s4 }) : {};
|
let i3, o3;
|
try {
|
return await j($(t3, "invoke"), { ...r3 }), i3 = await e3(...s4), await j($(t3, "success"), { ...r3, result: i3 }), i3;
|
} catch (e4) {
|
throw o3 = e4, await j($(t3, "fail"), { ...r3, error: o3 }), o3;
|
} finally {
|
await j($(t3, "complete"), o3 ? { ...r3, error: o3 } : { ...r3, result: i3 });
|
}
|
};
|
}({ fn: async function s4(...u2) {
|
let h2;
|
a2 && uni.showLoading({ title: r2.title, mask: r2.mask });
|
const d2 = { name: t2, type: l.OBJECT, data: { method: c2, params: u2 } };
|
"object" == typeof n2.secretMethods && function(e3, t3) {
|
const n3 = t3.data.method, s5 = e3.secretMethods || {}, r3 = s5[n3] || s5["*"];
|
r3 && (t3.secretType = r3);
|
}(n2, d2);
|
let p2 = false;
|
try {
|
h2 = await e2.callFunction(d2);
|
} catch (e3) {
|
p2 = true, h2 = { result: new te(e3) };
|
}
|
const { errSubject: f2, errCode: g2, errMsg: m2, newToken: y2 } = h2.result || {};
|
if (a2 && uni.hideLoading(), y2 && y2.token && y2.tokenExpired && (ie(y2), Y(H.REFRESH_TOKEN, { ...y2 })), g2) {
|
let e3 = m2;
|
if (p2 && o2) {
|
e3 = (await o2({ objectName: t2, methodName: c2, params: u2, errSubject: f2, errCode: g2, errMsg: m2 })).errMsg || m2;
|
}
|
if (a2)
|
if ("toast" === i2.type)
|
uni.showToast({ title: e3, icon: "none" });
|
else {
|
if ("modal" !== i2.type)
|
throw new Error(`Invalid errorOptions.type: ${i2.type}`);
|
{
|
const { confirm: t3 } = await async function({ title: e4, content: t4, showCancel: n4, cancelText: s5, confirmText: r3 } = {}) {
|
return new Promise((i3, o3) => {
|
uni.showModal({ title: e4, content: t4, showCancel: n4, cancelText: s5, confirmText: r3, success(e5) {
|
i3(e5);
|
}, fail() {
|
i3({ confirm: false, cancel: true });
|
} });
|
});
|
}({ title: "提示", content: e3, showCancel: i2.retry, cancelText: "取消", confirmText: i2.retry ? "重试" : "确定" });
|
if (i2.retry && t3)
|
return s4(...u2);
|
}
|
}
|
const n3 = new te({ subject: f2, code: g2, message: m2, requestId: h2.requestId });
|
throw n3.detail = h2.result, Y(H.RESPONSE, { type: J.CLOUD_OBJECT, content: n3 }), n3;
|
}
|
return Y(H.RESPONSE, { type: J.CLOUD_OBJECT, content: h2.result }), h2.result;
|
}, interceptorName: "callObject", getCallbackArgs: function({ params: e3 } = {}) {
|
return { objectName: t2, methodName: c2, params: e3 };
|
} });
|
} });
|
};
|
}
|
function Ws(e2) {
|
return U(Xt.replace("{spaceId}", e2.config.spaceId));
|
}
|
async function Hs({ openid: e2, callLoginByWeixin: t2 = false } = {}) {
|
Ws(this);
|
throw new Error(`[SecureNetwork] API \`initSecureNetworkByWeixin\` is not supported on platform \`${P}\``);
|
}
|
async function Js(e2) {
|
const t2 = Ws(this);
|
return t2.initPromise || (t2.initPromise = Hs.call(this, e2).then((e3) => e3).catch((e3) => {
|
throw delete t2.initPromise, e3;
|
})), t2.initPromise;
|
}
|
function zs(e2) {
|
return function({ openid: t2, callLoginByWeixin: n2 = false } = {}) {
|
return Js.call(e2, { openid: t2, callLoginByWeixin: n2 });
|
};
|
}
|
function Vs(e2) {
|
!function(e3) {
|
he = e3;
|
}(e2);
|
}
|
function Gs(e2) {
|
const n2 = { getAppBaseInfo: uni.getSystemInfo, getPushClientId: uni.getPushClientId };
|
return function(s2) {
|
return new Promise((r2, i2) => {
|
n2[e2]({ ...s2, success(e3) {
|
r2(e3);
|
}, fail(e3) {
|
i2(e3);
|
} });
|
});
|
};
|
}
|
class Ys extends S {
|
constructor() {
|
super(), this._uniPushMessageCallback = this._receivePushMessage.bind(this), this._currentMessageId = -1, this._payloadQueue = [];
|
}
|
init() {
|
return Promise.all([Gs("getAppBaseInfo")(), Gs("getPushClientId")()]).then(([{ appId: e2 } = {}, { cid: t2 } = {}] = []) => {
|
if (!e2)
|
throw new Error("Invalid appId, please check the manifest.json file");
|
if (!t2)
|
throw new Error("Invalid push client id");
|
this._appId = e2, this._pushClientId = t2, this._seqId = Date.now() + "-" + Math.floor(9e5 * Math.random() + 1e5), this.emit("open"), this._initMessageListener();
|
}, (e2) => {
|
throw this.emit("error", e2), this.close(), e2;
|
});
|
}
|
async open() {
|
return this.init();
|
}
|
_isUniCloudSSE(e2) {
|
if ("receive" !== e2.type)
|
return false;
|
const t2 = e2 && e2.data && e2.data.payload;
|
return !(!t2 || "UNI_CLOUD_SSE" !== t2.channel || t2.seqId !== this._seqId);
|
}
|
_receivePushMessage(e2) {
|
if (!this._isUniCloudSSE(e2))
|
return;
|
const t2 = e2 && e2.data && e2.data.payload, { action: n2, messageId: s2, message: r2 } = t2;
|
this._payloadQueue.push({ action: n2, messageId: s2, message: r2 }), this._consumMessage();
|
}
|
_consumMessage() {
|
for (; ; ) {
|
const e2 = this._payloadQueue.find((e3) => e3.messageId === this._currentMessageId + 1);
|
if (!e2)
|
break;
|
this._currentMessageId++, this._parseMessagePayload(e2);
|
}
|
}
|
_parseMessagePayload(e2) {
|
const { action: t2, messageId: n2, message: s2 } = e2;
|
"end" === t2 ? this._end({ messageId: n2, message: s2 }) : "message" === t2 && this._appendMessage({ messageId: n2, message: s2 });
|
}
|
_appendMessage({ messageId: e2, message: t2 } = {}) {
|
this.emit("message", t2);
|
}
|
_end({ messageId: e2, message: t2 } = {}) {
|
this.emit("end", t2), this.close();
|
}
|
_initMessageListener() {
|
uni.onPushMessage(this._uniPushMessageCallback);
|
}
|
_destroy() {
|
uni.offPushMessage(this._uniPushMessageCallback);
|
}
|
toJSON() {
|
return { appId: this._appId, pushClientId: this._pushClientId, seqId: this._seqId };
|
}
|
close() {
|
this._destroy(), this.emit("close");
|
}
|
}
|
async function Qs(e2) {
|
{
|
const { osName: e3, osVersion: t3 } = ce();
|
"ios" === e3 && function(e4) {
|
if (!e4 || "string" != typeof e4)
|
return 0;
|
const t4 = e4.match(/^(\d+)./);
|
return t4 && t4[1] ? parseInt(t4[1]) : 0;
|
}(t3) >= 14 && console.warn("iOS 14及以上版本连接uniCloud本地调试服务需要允许客户端查找并连接到本地网络上的设备(仅开发期间需要,发行后不需要)");
|
}
|
const t2 = e2.__dev__;
|
if (!t2.debugInfo)
|
return;
|
const { address: n2, servePort: s2 } = t2.debugInfo, { address: r2 } = await Ot(n2, s2);
|
if (r2)
|
return t2.localAddress = r2, void (t2.localPort = s2);
|
const i2 = console["error"];
|
let o2 = "";
|
if ("remote" === t2.debugInfo.initialLaunchType ? (t2.debugInfo.forceRemote = true, o2 = "当前客户端和HBuilderX不在同一局域网下(或其他网络原因无法连接HBuilderX),uniCloud本地调试服务不对当前客户端生效。\n- 如果不使用uniCloud本地调试服务,请直接忽略此信息。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。") : o2 = "无法连接uniCloud本地调试服务,请检查当前客户端是否与主机在同一局域网下。\n- 如需使用uniCloud本地调试服务,请将客户端与主机连接到同一局域网下并重新运行到客户端。", o2 += "\n- 如果在HBuilderX开启的状态下切换过网络环境,请重启HBuilderX后再试\n- 检查系统防火墙是否拦截了HBuilderX自带的nodejs\n- 检查是否错误的使用拦截器修改uni.request方法的参数", 0 === P.indexOf("mp-") && (o2 += "\n- 小程序中如何使用uniCloud,请参考:https://uniapp.dcloud.net.cn/uniCloud/publish.html#useinmp"), !t2.debugInfo.forceRemote)
|
throw new Error(o2);
|
i2(o2);
|
}
|
function Xs(e2) {
|
e2._initPromiseHub || (e2._initPromiseHub = new v({ createPromise: function() {
|
let t2 = Promise.resolve();
|
var n2;
|
n2 = 1, t2 = new Promise((e3) => {
|
setTimeout(() => {
|
e3();
|
}, n2);
|
});
|
const s2 = e2.auth();
|
return t2.then(() => s2.getLoginState()).then((e3) => e3 ? Promise.resolve() : s2.signInAnonymously());
|
} }));
|
}
|
const Zs = { tcb: Pt, tencent: Pt, aliyun: fe, private: Rt, dcloud: Rt, alipay: Bt };
|
let er = new class {
|
init(e2) {
|
let t2 = {};
|
const n2 = Zs[e2.provider];
|
if (!n2)
|
throw new Error("未提供正确的provider参数");
|
t2 = n2.init(e2), function(e3) {
|
const t3 = {};
|
e3.__dev__ = t3, t3.debugLog = "app" === P;
|
const n3 = C;
|
n3 && !n3.code && (t3.debugInfo = n3);
|
const s2 = new v({ createPromise: function() {
|
return Qs(e3);
|
} });
|
t3.initLocalNetwork = function() {
|
return s2.exec();
|
};
|
}(t2), Xs(t2), Gn(t2), function(e3) {
|
const t3 = e3.uploadFile;
|
e3.uploadFile = function(e4) {
|
return t3.call(this, e4);
|
};
|
}(t2), function(e3) {
|
e3.database = function(t3) {
|
if (t3 && Object.keys(t3).length > 0)
|
return e3.init(t3).database();
|
if (this._database)
|
return this._database;
|
const n3 = as(cs, { uniClient: e3 });
|
return this._database = n3, n3;
|
}, e3.databaseForJQL = function(t3) {
|
if (t3 && Object.keys(t3).length > 0)
|
return e3.init(t3).databaseForJQL();
|
if (this._databaseForJQL)
|
return this._databaseForJQL;
|
const n3 = as(cs, { uniClient: e3, isJQL: true });
|
return this._databaseForJQL = n3, n3;
|
};
|
}(t2), function(e3) {
|
e3.getCurrentUserInfo = qs, e3.chooseAndUploadFile = Ks.initChooseAndUploadFile(e3), Object.assign(e3, { get mixinDatacom() {
|
return $s(e3);
|
} }), e3.SSEChannel = Ys, e3.initSecureNetworkByWeixin = zs(e3), e3.setCustomClientInfo = Vs, e3.importObject = Bs(e3);
|
}(t2);
|
return ["callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile", "chooseAndUploadFile"].forEach((e3) => {
|
if (!t2[e3])
|
return;
|
const n3 = t2[e3];
|
t2[e3] = function() {
|
return n3.apply(t2, Array.from(arguments));
|
}, t2[e3] = (/* @__PURE__ */ function(e4, t3) {
|
return function(n4) {
|
let s2 = false;
|
if ("callFunction" === t3) {
|
const e5 = n4 && n4.type || l.DEFAULT;
|
s2 = e5 !== l.DEFAULT;
|
}
|
const r2 = "callFunction" === t3 && !s2, i2 = this._initPromiseHub.exec();
|
n4 = n4 || {};
|
const { success: o2, fail: a2, complete: c2 } = ee(n4), u2 = i2.then(() => s2 ? Promise.resolve() : j($(t3, "invoke"), n4)).then(() => e4.call(this, n4)).then((e5) => s2 ? Promise.resolve(e5) : j($(t3, "success"), e5).then(() => j($(t3, "complete"), e5)).then(() => (r2 && Y(H.RESPONSE, { type: J.CLOUD_FUNCTION, content: e5 }), Promise.resolve(e5))), (e5) => s2 ? Promise.reject(e5) : j($(t3, "fail"), e5).then(() => j($(t3, "complete"), e5)).then(() => (Y(H.RESPONSE, { type: J.CLOUD_FUNCTION, content: e5 }), Promise.reject(e5))));
|
if (!(o2 || a2 || c2))
|
return u2;
|
u2.then((e5) => {
|
o2 && o2(e5), c2 && c2(e5), r2 && Y(H.RESPONSE, { type: J.CLOUD_FUNCTION, content: e5 });
|
}, (e5) => {
|
a2 && a2(e5), c2 && c2(e5), r2 && Y(H.RESPONSE, { type: J.CLOUD_FUNCTION, content: e5 });
|
});
|
};
|
}(t2[e3], e3)).bind(t2);
|
}), t2.init = this.init, t2;
|
}
|
}();
|
(() => {
|
const e2 = O;
|
let t2 = {};
|
if (e2 && 1 === e2.length)
|
t2 = e2[0], er = er.init(t2), er._isDefault = true;
|
else {
|
const t3 = ["auth", "callFunction", "uploadFile", "deleteFile", "getTempFileURL", "downloadFile"], n2 = ["database", "getCurrentUserInfo", "importObject"];
|
let s2;
|
s2 = e2 && e2.length > 0 ? "应用有多个服务空间,请通过uniCloud.init方法指定要使用的服务空间" : "应用未关联服务空间,请在uniCloud目录右键关联服务空间", [...t3, ...n2].forEach((e3) => {
|
er[e3] = function() {
|
if (console.error(s2), -1 === n2.indexOf(e3))
|
return Promise.reject(new te({ code: "SYS_ERR", message: s2 }));
|
console.error(s2);
|
};
|
});
|
}
|
if (Object.assign(er, { get mixinDatacom() {
|
return $s(er);
|
} }), Ls(er), er.addInterceptor = F, er.removeInterceptor = K, er.interceptObject = B, uni.__uniCloud = er, "app" === P) {
|
const e3 = D();
|
e3.uniCloud = er, e3.UniCloudError = te;
|
}
|
})();
|
var tr = er;
|
const fontData = [
|
{
|
"font_class": "arrow-down",
|
"unicode": ""
|
},
|
{
|
"font_class": "arrow-left",
|
"unicode": ""
|
},
|
{
|
"font_class": "arrow-right",
|
"unicode": ""
|
},
|
{
|
"font_class": "arrow-up",
|
"unicode": ""
|
},
|
{
|
"font_class": "auth",
|
"unicode": ""
|
},
|
{
|
"font_class": "auth-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "back",
|
"unicode": ""
|
},
|
{
|
"font_class": "bars",
|
"unicode": ""
|
},
|
{
|
"font_class": "calendar",
|
"unicode": ""
|
},
|
{
|
"font_class": "calendar-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "camera",
|
"unicode": ""
|
},
|
{
|
"font_class": "camera-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "cart",
|
"unicode": ""
|
},
|
{
|
"font_class": "cart-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "chat",
|
"unicode": ""
|
},
|
{
|
"font_class": "chat-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "chatboxes",
|
"unicode": ""
|
},
|
{
|
"font_class": "chatboxes-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "chatbubble",
|
"unicode": ""
|
},
|
{
|
"font_class": "chatbubble-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "checkbox",
|
"unicode": ""
|
},
|
{
|
"font_class": "checkbox-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "checkmarkempty",
|
"unicode": ""
|
},
|
{
|
"font_class": "circle",
|
"unicode": ""
|
},
|
{
|
"font_class": "circle-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "clear",
|
"unicode": ""
|
},
|
{
|
"font_class": "close",
|
"unicode": ""
|
},
|
{
|
"font_class": "closeempty",
|
"unicode": ""
|
},
|
{
|
"font_class": "cloud-download",
|
"unicode": ""
|
},
|
{
|
"font_class": "cloud-download-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "cloud-upload",
|
"unicode": ""
|
},
|
{
|
"font_class": "cloud-upload-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "color",
|
"unicode": ""
|
},
|
{
|
"font_class": "color-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "compose",
|
"unicode": ""
|
},
|
{
|
"font_class": "contact",
|
"unicode": ""
|
},
|
{
|
"font_class": "contact-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "down",
|
"unicode": ""
|
},
|
{
|
"font_class": "bottom",
|
"unicode": ""
|
},
|
{
|
"font_class": "download",
|
"unicode": ""
|
},
|
{
|
"font_class": "download-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "email",
|
"unicode": ""
|
},
|
{
|
"font_class": "email-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "eye",
|
"unicode": ""
|
},
|
{
|
"font_class": "eye-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "eye-slash",
|
"unicode": ""
|
},
|
{
|
"font_class": "eye-slash-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "fire",
|
"unicode": ""
|
},
|
{
|
"font_class": "fire-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "flag",
|
"unicode": ""
|
},
|
{
|
"font_class": "flag-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "folder-add",
|
"unicode": ""
|
},
|
{
|
"font_class": "folder-add-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "font",
|
"unicode": ""
|
},
|
{
|
"font_class": "forward",
|
"unicode": ""
|
},
|
{
|
"font_class": "gear",
|
"unicode": ""
|
},
|
{
|
"font_class": "gear-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "gift",
|
"unicode": ""
|
},
|
{
|
"font_class": "gift-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "hand-down",
|
"unicode": ""
|
},
|
{
|
"font_class": "hand-down-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "hand-up",
|
"unicode": ""
|
},
|
{
|
"font_class": "hand-up-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "headphones",
|
"unicode": ""
|
},
|
{
|
"font_class": "heart",
|
"unicode": ""
|
},
|
{
|
"font_class": "heart-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "help",
|
"unicode": ""
|
},
|
{
|
"font_class": "help-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "home",
|
"unicode": ""
|
},
|
{
|
"font_class": "home-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "image",
|
"unicode": ""
|
},
|
{
|
"font_class": "image-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "images",
|
"unicode": ""
|
},
|
{
|
"font_class": "images-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "info",
|
"unicode": ""
|
},
|
{
|
"font_class": "info-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "left",
|
"unicode": ""
|
},
|
{
|
"font_class": "link",
|
"unicode": ""
|
},
|
{
|
"font_class": "list",
|
"unicode": ""
|
},
|
{
|
"font_class": "location",
|
"unicode": ""
|
},
|
{
|
"font_class": "location-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "locked",
|
"unicode": ""
|
},
|
{
|
"font_class": "locked-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "loop",
|
"unicode": ""
|
},
|
{
|
"font_class": "mail-open",
|
"unicode": ""
|
},
|
{
|
"font_class": "mail-open-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "map",
|
"unicode": ""
|
},
|
{
|
"font_class": "map-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "map-pin",
|
"unicode": ""
|
},
|
{
|
"font_class": "map-pin-ellipse",
|
"unicode": ""
|
},
|
{
|
"font_class": "medal",
|
"unicode": ""
|
},
|
{
|
"font_class": "medal-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "mic",
|
"unicode": ""
|
},
|
{
|
"font_class": "mic-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "micoff",
|
"unicode": ""
|
},
|
{
|
"font_class": "micoff-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "minus",
|
"unicode": ""
|
},
|
{
|
"font_class": "minus-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "more",
|
"unicode": ""
|
},
|
{
|
"font_class": "more-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "navigate",
|
"unicode": ""
|
},
|
{
|
"font_class": "navigate-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "notification",
|
"unicode": ""
|
},
|
{
|
"font_class": "notification-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "paperclip",
|
"unicode": ""
|
},
|
{
|
"font_class": "paperplane",
|
"unicode": ""
|
},
|
{
|
"font_class": "paperplane-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "person",
|
"unicode": ""
|
},
|
{
|
"font_class": "person-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "personadd",
|
"unicode": ""
|
},
|
{
|
"font_class": "personadd-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "personadd-filled-copy",
|
"unicode": ""
|
},
|
{
|
"font_class": "phone",
|
"unicode": ""
|
},
|
{
|
"font_class": "phone-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "plus",
|
"unicode": ""
|
},
|
{
|
"font_class": "plus-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "plusempty",
|
"unicode": ""
|
},
|
{
|
"font_class": "pulldown",
|
"unicode": ""
|
},
|
{
|
"font_class": "pyq",
|
"unicode": ""
|
},
|
{
|
"font_class": "qq",
|
"unicode": ""
|
},
|
{
|
"font_class": "redo",
|
"unicode": ""
|
},
|
{
|
"font_class": "redo-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "refresh",
|
"unicode": ""
|
},
|
{
|
"font_class": "refresh-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "refreshempty",
|
"unicode": ""
|
},
|
{
|
"font_class": "reload",
|
"unicode": ""
|
},
|
{
|
"font_class": "right",
|
"unicode": ""
|
},
|
{
|
"font_class": "scan",
|
"unicode": ""
|
},
|
{
|
"font_class": "search",
|
"unicode": ""
|
},
|
{
|
"font_class": "settings",
|
"unicode": ""
|
},
|
{
|
"font_class": "settings-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "shop",
|
"unicode": ""
|
},
|
{
|
"font_class": "shop-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "smallcircle",
|
"unicode": ""
|
},
|
{
|
"font_class": "smallcircle-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "sound",
|
"unicode": ""
|
},
|
{
|
"font_class": "sound-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "spinner-cycle",
|
"unicode": ""
|
},
|
{
|
"font_class": "staff",
|
"unicode": ""
|
},
|
{
|
"font_class": "staff-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "star",
|
"unicode": ""
|
},
|
{
|
"font_class": "star-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "starhalf",
|
"unicode": ""
|
},
|
{
|
"font_class": "trash",
|
"unicode": ""
|
},
|
{
|
"font_class": "trash-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "tune",
|
"unicode": ""
|
},
|
{
|
"font_class": "tune-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "undo",
|
"unicode": ""
|
},
|
{
|
"font_class": "undo-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "up",
|
"unicode": ""
|
},
|
{
|
"font_class": "top",
|
"unicode": ""
|
},
|
{
|
"font_class": "upload",
|
"unicode": ""
|
},
|
{
|
"font_class": "upload-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "videocam",
|
"unicode": ""
|
},
|
{
|
"font_class": "videocam-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "vip",
|
"unicode": ""
|
},
|
{
|
"font_class": "vip-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "wallet",
|
"unicode": ""
|
},
|
{
|
"font_class": "wallet-filled",
|
"unicode": ""
|
},
|
{
|
"font_class": "weibo",
|
"unicode": ""
|
},
|
{
|
"font_class": "weixin",
|
"unicode": ""
|
}
|
];
|
const _export_sfc = (sfc, props) => {
|
const target = sfc.__vccOpts || sfc;
|
for (const [key, val] of props) {
|
target[key] = val;
|
}
|
return target;
|
};
|
const getVal = (val) => {
|
const reg = /^[0-9]*$/g;
|
return typeof val === "number" || reg.test(val) ? val + "px" : val;
|
};
|
const _sfc_main$G = {
|
name: "UniIcons",
|
emits: ["click"],
|
props: {
|
type: {
|
type: String,
|
default: ""
|
},
|
color: {
|
type: String,
|
default: "#333333"
|
},
|
size: {
|
type: [Number, String],
|
default: 16
|
},
|
customPrefix: {
|
type: String,
|
default: ""
|
},
|
fontFamily: {
|
type: String,
|
default: ""
|
}
|
},
|
data() {
|
return {
|
icons: fontData
|
};
|
},
|
computed: {
|
unicode() {
|
let code = this.icons.find((v2) => v2.font_class === this.type);
|
if (code) {
|
return code.unicode;
|
}
|
return "";
|
},
|
iconSize() {
|
return getVal(this.size);
|
},
|
styleObj() {
|
if (this.fontFamily !== "") {
|
return `color: ${this.color}; font-size: ${this.iconSize}; font-family: ${this.fontFamily};`;
|
}
|
return `color: ${this.color}; font-size: ${this.iconSize};`;
|
}
|
},
|
methods: {
|
_onClick() {
|
this.$emit("click");
|
}
|
}
|
};
|
function _sfc_render$F(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock(
|
"text",
|
{
|
style: vue.normalizeStyle($options.styleObj),
|
class: vue.normalizeClass(["uni-icons", ["uniui-" + $props.type, $props.customPrefix, $props.customPrefix ? $props.type : ""]]),
|
onClick: _cache[0] || (_cache[0] = (...args) => $options._onClick && $options._onClick(...args))
|
},
|
[
|
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
],
|
6
|
/* CLASS, STYLE */
|
);
|
}
|
const __easycom_0$6 = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["render", _sfc_render$F], ["__scopeId", "data-v-946bce22"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-icons/uni-icons.vue"]]);
|
const _sfc_main$F = {
|
name: "uni-data-select",
|
mixins: [tr.mixinDatacom || {}],
|
props: {
|
localdata: {
|
type: Array,
|
default() {
|
return [];
|
}
|
},
|
value: {
|
type: [String, Number],
|
default: ""
|
},
|
modelValue: {
|
type: [String, Number],
|
default: ""
|
},
|
label: {
|
type: String,
|
default: ""
|
},
|
placeholder: {
|
type: String,
|
default: "请选择"
|
},
|
emptyTips: {
|
type: String,
|
default: "无选项"
|
},
|
clear: {
|
type: Boolean,
|
default: true
|
},
|
defItem: {
|
type: Number,
|
default: 0
|
},
|
disabled: {
|
type: Boolean,
|
default: false
|
},
|
// 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}"
|
format: {
|
type: String,
|
default: ""
|
},
|
placement: {
|
type: String,
|
default: "bottom"
|
}
|
},
|
data() {
|
return {
|
showSelector: false,
|
current: "",
|
mixinDatacomResData: [],
|
apps: [],
|
channels: [],
|
cacheKey: "uni-data-select-lastSelectedValue"
|
};
|
},
|
created() {
|
this.debounceGet = this.debounce(() => {
|
this.query();
|
}, 300);
|
if (this.collection && !this.localdata.length) {
|
this.debounceGet();
|
}
|
},
|
computed: {
|
typePlaceholder() {
|
const text = {
|
"opendb-stat-app-versions": "版本",
|
"opendb-app-channels": "渠道",
|
"opendb-app-list": "应用"
|
};
|
const common = this.placeholder;
|
const placeholder = text[this.collection];
|
return placeholder ? common + placeholder : common;
|
},
|
valueCom() {
|
return this.modelValue;
|
},
|
textShow() {
|
let text = this.current;
|
return text;
|
},
|
getOffsetByPlacement() {
|
switch (this.placement) {
|
case "top":
|
return "bottom:calc(100% + 12px);";
|
case "bottom":
|
return "top:calc(100% + 12px);";
|
}
|
}
|
},
|
watch: {
|
localdata: {
|
immediate: true,
|
handler(val, old) {
|
if (Array.isArray(val) && old !== val) {
|
this.mixinDatacomResData = val;
|
}
|
}
|
},
|
valueCom(val, old) {
|
this.initDefVal();
|
},
|
mixinDatacomResData: {
|
immediate: true,
|
handler(val) {
|
if (val.length) {
|
this.initDefVal();
|
}
|
}
|
}
|
},
|
methods: {
|
debounce(fn, time = 100) {
|
let timer = null;
|
return function(...args) {
|
if (timer)
|
clearTimeout(timer);
|
timer = setTimeout(() => {
|
fn.apply(this, args);
|
}, time);
|
};
|
},
|
// 执行数据库查询
|
query() {
|
this.mixinDatacomEasyGet();
|
},
|
// 监听查询条件变更事件
|
onMixinDatacomPropsChange() {
|
if (this.collection) {
|
this.debounceGet();
|
}
|
},
|
initDefVal() {
|
let defValue = "";
|
if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) {
|
defValue = this.valueCom;
|
} else {
|
let strogeValue;
|
if (this.collection) {
|
strogeValue = this.getCache();
|
}
|
if (strogeValue || strogeValue === 0) {
|
defValue = strogeValue;
|
} else {
|
let defItem = "";
|
if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) {
|
defItem = this.mixinDatacomResData[this.defItem - 1].value;
|
}
|
defValue = defItem;
|
}
|
if (defValue || defValue === 0) {
|
this.emit(defValue);
|
}
|
}
|
const def = this.mixinDatacomResData.find((item) => item.value === defValue);
|
this.current = def ? this.formatItemName(def) : "";
|
},
|
/**
|
* @param {[String, Number]} value
|
* 判断用户给的 value 是否同时为禁用状态
|
*/
|
isDisabled(value) {
|
let isDisabled = false;
|
this.mixinDatacomResData.forEach((item) => {
|
if (item.value === value) {
|
isDisabled = item.disable;
|
}
|
});
|
return isDisabled;
|
},
|
clearVal() {
|
this.emit("");
|
if (this.collection) {
|
this.removeCache();
|
}
|
},
|
change(item) {
|
if (!item.disable) {
|
this.showSelector = false;
|
this.current = this.formatItemName(item);
|
this.emit(item.value);
|
}
|
},
|
emit(val) {
|
this.$emit("input", val);
|
this.$emit("update:modelValue", val);
|
this.$emit("change", val);
|
if (this.collection) {
|
this.setCache(val);
|
}
|
},
|
toggleSelector() {
|
if (this.disabled) {
|
return;
|
}
|
this.showSelector = !this.showSelector;
|
},
|
formatItemName(item) {
|
let {
|
text,
|
value,
|
channel_code
|
} = item;
|
channel_code = channel_code ? `(${channel_code})` : "";
|
if (this.format) {
|
let str = "";
|
str = this.format;
|
for (let key in item) {
|
str = str.replace(new RegExp(`{${key}}`, "g"), item[key]);
|
}
|
return str;
|
} else {
|
return this.collection.indexOf("app-list") > 0 ? `${text}(${value})` : text ? text : `未命名${channel_code}`;
|
}
|
},
|
// 获取当前加载的数据
|
getLoadData() {
|
return this.mixinDatacomResData;
|
},
|
// 获取当前缓存key
|
getCurrentCacheKey() {
|
return this.collection;
|
},
|
// 获取缓存
|
getCache(name = this.getCurrentCacheKey()) {
|
let cacheData = uni.getStorageSync(this.cacheKey) || {};
|
return cacheData[name];
|
},
|
// 设置缓存
|
setCache(value, name = this.getCurrentCacheKey()) {
|
let cacheData = uni.getStorageSync(this.cacheKey) || {};
|
cacheData[name] = value;
|
uni.setStorageSync(this.cacheKey, cacheData);
|
},
|
// 删除缓存
|
removeCache(name = this.getCurrentCacheKey()) {
|
let cacheData = uni.getStorageSync(this.cacheKey) || {};
|
delete cacheData[name];
|
uni.setStorageSync(this.cacheKey, cacheData);
|
}
|
}
|
};
|
function _sfc_render$E(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$6);
|
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-stat__select" }, [
|
$props.label ? (vue.openBlock(), vue.createElementBlock(
|
"span",
|
{
|
key: 0,
|
class: "uni-label-text hide-on-phone"
|
},
|
vue.toDisplayString($props.label + ":"),
|
1
|
/* TEXT */
|
)) : vue.createCommentVNode("v-if", true),
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-stat-box", { "uni-stat__actived": $data.current }])
|
},
|
[
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-select", { "uni-select--disabled": $props.disabled }])
|
},
|
[
|
vue.createElementVNode("view", {
|
class: "uni-select__input-box",
|
onClick: _cache[1] || (_cache[1] = (...args) => $options.toggleSelector && $options.toggleSelector(...args))
|
}, [
|
$data.current ? (vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 0,
|
class: "uni-select__input-text"
|
},
|
vue.toDisplayString($options.textShow),
|
1
|
/* TEXT */
|
)) : (vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 1,
|
class: "uni-select__input-text uni-select__input-placeholder"
|
},
|
vue.toDisplayString($options.typePlaceholder),
|
1
|
/* TEXT */
|
)),
|
$data.current && $props.clear && !$props.disabled ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 2,
|
onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => $options.clearVal && $options.clearVal(...args), ["stop"]))
|
}, [
|
vue.createVNode(_component_uni_icons, {
|
type: "clear",
|
color: "#c0c4cc",
|
size: "24"
|
})
|
])) : (vue.openBlock(), vue.createElementBlock("view", { key: 3 }, [
|
vue.createVNode(_component_uni_icons, {
|
type: $data.showSelector ? "top" : "bottom",
|
size: "14",
|
color: "#999"
|
}, null, 8, ["type"])
|
]))
|
]),
|
$data.showSelector ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
class: "uni-select--mask",
|
onClick: _cache[2] || (_cache[2] = (...args) => $options.toggleSelector && $options.toggleSelector(...args))
|
})) : vue.createCommentVNode("v-if", true),
|
$data.showSelector ? (vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 1,
|
class: "uni-select__selector",
|
style: vue.normalizeStyle($options.getOffsetByPlacement)
|
},
|
[
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass($props.placement == "bottom" ? "uni-popper__arrow_bottom" : "uni-popper__arrow_top")
|
},
|
null,
|
2
|
/* CLASS */
|
),
|
vue.createElementVNode("scroll-view", {
|
"scroll-y": "true",
|
class: "uni-select__selector-scroll"
|
}, [
|
$data.mixinDatacomResData.length === 0 ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
class: "uni-select__selector-empty"
|
}, [
|
vue.createElementVNode(
|
"text",
|
null,
|
vue.toDisplayString($props.emptyTips),
|
1
|
/* TEXT */
|
)
|
])) : (vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
{ key: 1 },
|
vue.renderList($data.mixinDatacomResData, (item, index) => {
|
return vue.openBlock(), vue.createElementBlock("view", {
|
class: "uni-select__selector-item",
|
key: index,
|
onClick: ($event) => $options.change(item)
|
}, [
|
vue.createElementVNode(
|
"text",
|
{
|
class: vue.normalizeClass({ "uni-select__selector__disabled": item.disable })
|
},
|
vue.toDisplayString($options.formatItemName(item)),
|
3
|
/* TEXT, CLASS */
|
)
|
], 8, ["onClick"]);
|
}),
|
128
|
/* KEYED_FRAGMENT */
|
))
|
])
|
],
|
4
|
/* STYLE */
|
)) : vue.createCommentVNode("v-if", true)
|
],
|
2
|
/* CLASS */
|
)
|
],
|
2
|
/* CLASS */
|
)
|
]);
|
}
|
const __easycom_7$2 = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["render", _sfc_render$E], ["__scopeId", "data-v-123e8af9"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-data-select/uni-data-select.vue"]]);
|
function obj2strClass(obj) {
|
let classess = "";
|
for (let key in obj) {
|
const val = obj[key];
|
if (val) {
|
classess += `${key} `;
|
}
|
}
|
return classess;
|
}
|
function obj2strStyle(obj) {
|
let style = "";
|
for (let key in obj) {
|
const val = obj[key];
|
style += `${key}:${val};`;
|
}
|
return style;
|
}
|
const _sfc_main$E = {
|
name: "uni-easyinput",
|
emits: [
|
"click",
|
"iconClick",
|
"update:modelValue",
|
"input",
|
"focus",
|
"blur",
|
"confirm",
|
"clear",
|
"eyes",
|
"change",
|
"keyboardheightchange"
|
],
|
model: {
|
prop: "modelValue",
|
event: "update:modelValue"
|
},
|
options: {
|
virtualHost: true
|
},
|
inject: {
|
form: {
|
from: "uniForm",
|
default: null
|
},
|
formItem: {
|
from: "uniFormItem",
|
default: null
|
}
|
},
|
props: {
|
name: String,
|
value: [Number, String],
|
modelValue: [Number, String],
|
type: {
|
type: String,
|
default: "text"
|
},
|
clearable: {
|
type: Boolean,
|
default: true
|
},
|
autoHeight: {
|
type: Boolean,
|
default: false
|
},
|
placeholder: {
|
type: String,
|
default: " "
|
},
|
placeholderStyle: String,
|
focus: {
|
type: Boolean,
|
default: false
|
},
|
disabled: {
|
type: Boolean,
|
default: false
|
},
|
maxlength: {
|
type: [Number, String],
|
default: 140
|
},
|
confirmType: {
|
type: String,
|
default: "done"
|
},
|
clearSize: {
|
type: [Number, String],
|
default: 24
|
},
|
inputBorder: {
|
type: Boolean,
|
default: true
|
},
|
prefixIcon: {
|
type: String,
|
default: ""
|
},
|
suffixIcon: {
|
type: String,
|
default: ""
|
},
|
trim: {
|
type: [Boolean, String],
|
default: false
|
},
|
cursorSpacing: {
|
type: Number,
|
default: 0
|
},
|
passwordIcon: {
|
type: Boolean,
|
default: true
|
},
|
adjustPosition: {
|
type: Boolean,
|
default: true
|
},
|
primaryColor: {
|
type: String,
|
default: "#2979ff"
|
},
|
styles: {
|
type: Object,
|
default() {
|
return {
|
color: "#333",
|
backgroundColor: "#fff",
|
disableColor: "#F7F6F6",
|
borderColor: "#e5e5e5"
|
};
|
}
|
},
|
errorMessage: {
|
type: [String, Boolean],
|
default: ""
|
}
|
},
|
data() {
|
return {
|
focused: false,
|
val: "",
|
showMsg: "",
|
border: false,
|
isFirstBorder: false,
|
showClearIcon: false,
|
showPassword: false,
|
focusShow: false,
|
localMsg: "",
|
isEnter: false
|
// 用于判断当前是否是使用回车操作
|
};
|
},
|
computed: {
|
// 输入框内是否有值
|
isVal() {
|
const val = this.val;
|
if (val || val === 0) {
|
return true;
|
}
|
return false;
|
},
|
msg() {
|
return this.localMsg || this.errorMessage;
|
},
|
// 因为uniapp的input组件的maxlength组件必须要数值,这里转为数值,用户可以传入字符串数值
|
inputMaxlength() {
|
return Number(this.maxlength);
|
},
|
// 处理外层样式的style
|
boxStyle() {
|
return `color:${this.inputBorder && this.msg ? "#e43d33" : this.styles.color};`;
|
},
|
// input 内容的类和样式处理
|
inputContentClass() {
|
return obj2strClass({
|
"is-input-border": this.inputBorder,
|
"is-input-error-border": this.inputBorder && this.msg,
|
"is-textarea": this.type === "textarea",
|
"is-disabled": this.disabled,
|
"is-focused": this.focusShow
|
});
|
},
|
inputContentStyle() {
|
const focusColor = this.focusShow ? this.primaryColor : this.styles.borderColor;
|
const borderColor = this.inputBorder && this.msg ? "#dd524d" : focusColor;
|
return obj2strStyle({
|
"border-color": borderColor || "#e5e5e5",
|
"background-color": this.disabled ? this.styles.disableColor : this.styles.backgroundColor
|
});
|
},
|
// input右侧样式
|
inputStyle() {
|
const paddingRight = this.type === "password" || this.clearable || this.prefixIcon ? "" : "10px";
|
return obj2strStyle({
|
"padding-right": paddingRight,
|
"padding-left": this.prefixIcon ? "" : "10px"
|
});
|
}
|
},
|
watch: {
|
value(newVal) {
|
if (newVal === null) {
|
this.val = "";
|
return;
|
}
|
this.val = newVal;
|
},
|
modelValue(newVal) {
|
if (newVal === null) {
|
this.val = "";
|
return;
|
}
|
this.val = newVal;
|
},
|
focus(newVal) {
|
this.$nextTick(() => {
|
this.focused = this.focus;
|
this.focusShow = this.focus;
|
});
|
}
|
},
|
created() {
|
this.init();
|
if (this.form && this.formItem) {
|
this.$watch("formItem.errMsg", (newVal) => {
|
this.localMsg = newVal;
|
});
|
}
|
},
|
mounted() {
|
this.$nextTick(() => {
|
this.focused = this.focus;
|
this.focusShow = this.focus;
|
});
|
},
|
methods: {
|
/**
|
* 初始化变量值
|
*/
|
init() {
|
if (this.value || this.value === 0) {
|
this.val = this.value;
|
} else if (this.modelValue || this.modelValue === 0 || this.modelValue === "") {
|
this.val = this.modelValue;
|
} else {
|
this.val = "";
|
}
|
},
|
/**
|
* 点击图标时触发
|
* @param {Object} type
|
*/
|
onClickIcon(type) {
|
this.$emit("iconClick", type);
|
},
|
/**
|
* 显示隐藏内容,密码框时生效
|
*/
|
onEyes() {
|
this.showPassword = !this.showPassword;
|
this.$emit("eyes", this.showPassword);
|
},
|
/**
|
* 输入时触发
|
* @param {Object} event
|
*/
|
onInput(event) {
|
let value = event.detail.value;
|
if (this.trim) {
|
if (typeof this.trim === "boolean" && this.trim) {
|
value = this.trimStr(value);
|
}
|
if (typeof this.trim === "string") {
|
value = this.trimStr(value, this.trim);
|
}
|
}
|
if (this.errMsg)
|
this.errMsg = "";
|
this.val = value;
|
this.$emit("input", value);
|
this.$emit("update:modelValue", value);
|
},
|
/**
|
* 外部调用方法
|
* 获取焦点时触发
|
* @param {Object} event
|
*/
|
onFocus() {
|
this.$nextTick(() => {
|
this.focused = true;
|
});
|
this.$emit("focus", null);
|
},
|
_Focus(event) {
|
this.focusShow = true;
|
this.$emit("focus", event);
|
},
|
/**
|
* 外部调用方法
|
* 失去焦点时触发
|
* @param {Object} event
|
*/
|
onBlur() {
|
this.focused = false;
|
this.$emit("blur", null);
|
},
|
_Blur(event) {
|
event.detail.value;
|
this.focusShow = false;
|
this.$emit("blur", event);
|
if (this.isEnter === false) {
|
this.$emit("change", this.val);
|
}
|
if (this.form && this.formItem) {
|
const { validateTrigger } = this.form;
|
if (validateTrigger === "blur") {
|
this.formItem.onFieldChange();
|
}
|
}
|
},
|
/**
|
* 按下键盘的发送键
|
* @param {Object} e
|
*/
|
onConfirm(e2) {
|
this.$emit("confirm", this.val);
|
this.isEnter = true;
|
this.$emit("change", this.val);
|
this.$nextTick(() => {
|
this.isEnter = false;
|
});
|
},
|
/**
|
* 清理内容
|
* @param {Object} event
|
*/
|
onClear(event) {
|
this.val = "";
|
this.$emit("input", "");
|
this.$emit("update:modelValue", "");
|
this.$emit("clear");
|
},
|
/**
|
* 键盘高度发生变化的时候触发此事件
|
* 兼容性:微信小程序2.7.0+、App 3.1.0+
|
* @param {Object} event
|
*/
|
onkeyboardheightchange(event) {
|
this.$emit("keyboardheightchange", event);
|
},
|
/**
|
* 去除空格
|
*/
|
trimStr(str, pos = "both") {
|
if (pos === "both") {
|
return str.trim();
|
} else if (pos === "left") {
|
return str.trimLeft();
|
} else if (pos === "right") {
|
return str.trimRight();
|
} else if (pos === "start") {
|
return str.trimStart();
|
} else if (pos === "end") {
|
return str.trimEnd();
|
} else if (pos === "all") {
|
return str.replace(/\s+/g, "");
|
} else if (pos === "none") {
|
return str;
|
}
|
return str;
|
}
|
}
|
};
|
function _sfc_render$D(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$6);
|
return vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-easyinput", { "uni-easyinput-error": $options.msg }]),
|
style: vue.normalizeStyle($options.boxStyle)
|
},
|
[
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-easyinput__content", $options.inputContentClass]),
|
style: vue.normalizeStyle($options.inputContentStyle)
|
},
|
[
|
$props.prefixIcon ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
|
key: 0,
|
class: "content-clear-icon",
|
type: $props.prefixIcon,
|
color: "#c0c4cc",
|
onClick: _cache[0] || (_cache[0] = ($event) => $options.onClickIcon("prefix")),
|
size: "22"
|
}, null, 8, ["type"])) : vue.createCommentVNode("v-if", true),
|
vue.renderSlot(_ctx.$slots, "left", {}, void 0, true),
|
$props.type === "textarea" ? (vue.openBlock(), vue.createElementBlock("textarea", {
|
key: 1,
|
class: vue.normalizeClass(["uni-easyinput__content-textarea", { "input-padding": $props.inputBorder }]),
|
name: $props.name,
|
value: $data.val,
|
placeholder: $props.placeholder,
|
placeholderStyle: $props.placeholderStyle,
|
disabled: $props.disabled,
|
"placeholder-class": "uni-easyinput__placeholder-class",
|
maxlength: $options.inputMaxlength,
|
focus: $data.focused,
|
autoHeight: $props.autoHeight,
|
"cursor-spacing": $props.cursorSpacing,
|
"adjust-position": $props.adjustPosition,
|
onInput: _cache[1] || (_cache[1] = (...args) => $options.onInput && $options.onInput(...args)),
|
onBlur: _cache[2] || (_cache[2] = (...args) => $options._Blur && $options._Blur(...args)),
|
onFocus: _cache[3] || (_cache[3] = (...args) => $options._Focus && $options._Focus(...args)),
|
onConfirm: _cache[4] || (_cache[4] = (...args) => $options.onConfirm && $options.onConfirm(...args)),
|
onKeyboardheightchange: _cache[5] || (_cache[5] = (...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args))
|
}, null, 42, ["name", "value", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "autoHeight", "cursor-spacing", "adjust-position"])) : (vue.openBlock(), vue.createElementBlock("input", {
|
key: 2,
|
type: $props.type === "password" ? "text" : $props.type,
|
class: "uni-easyinput__content-input",
|
style: vue.normalizeStyle($options.inputStyle),
|
name: $props.name,
|
value: $data.val,
|
password: !$data.showPassword && $props.type === "password",
|
placeholder: $props.placeholder,
|
placeholderStyle: $props.placeholderStyle,
|
"placeholder-class": "uni-easyinput__placeholder-class",
|
disabled: $props.disabled,
|
maxlength: $options.inputMaxlength,
|
focus: $data.focused,
|
confirmType: $props.confirmType,
|
"cursor-spacing": $props.cursorSpacing,
|
"adjust-position": $props.adjustPosition,
|
onFocus: _cache[6] || (_cache[6] = (...args) => $options._Focus && $options._Focus(...args)),
|
onBlur: _cache[7] || (_cache[7] = (...args) => $options._Blur && $options._Blur(...args)),
|
onInput: _cache[8] || (_cache[8] = (...args) => $options.onInput && $options.onInput(...args)),
|
onConfirm: _cache[9] || (_cache[9] = (...args) => $options.onConfirm && $options.onConfirm(...args)),
|
onKeyboardheightchange: _cache[10] || (_cache[10] = (...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args))
|
}, null, 44, ["type", "name", "value", "password", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "confirmType", "cursor-spacing", "adjust-position"])),
|
$props.type === "password" && $props.passwordIcon ? (vue.openBlock(), vue.createElementBlock(
|
vue.Fragment,
|
{ key: 3 },
|
[
|
vue.createCommentVNode(" 开启密码时显示小眼睛 "),
|
$options.isVal ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
|
key: 0,
|
class: vue.normalizeClass(["content-clear-icon", { "is-textarea-icon": $props.type === "textarea" }]),
|
type: $data.showPassword ? "eye-slash-filled" : "eye-filled",
|
size: 22,
|
color: $data.focusShow ? $props.primaryColor : "#c0c4cc",
|
onClick: $options.onEyes
|
}, null, 8, ["class", "type", "color", "onClick"])) : vue.createCommentVNode("v-if", true)
|
],
|
64
|
/* STABLE_FRAGMENT */
|
)) : vue.createCommentVNode("v-if", true),
|
$props.suffixIcon ? (vue.openBlock(), vue.createElementBlock(
|
vue.Fragment,
|
{ key: 4 },
|
[
|
$props.suffixIcon ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
|
key: 0,
|
class: "content-clear-icon",
|
type: $props.suffixIcon,
|
color: "#c0c4cc",
|
onClick: _cache[11] || (_cache[11] = ($event) => $options.onClickIcon("suffix")),
|
size: "22"
|
}, null, 8, ["type"])) : vue.createCommentVNode("v-if", true)
|
],
|
64
|
/* STABLE_FRAGMENT */
|
)) : (vue.openBlock(), vue.createElementBlock(
|
vue.Fragment,
|
{ key: 5 },
|
[
|
$props.clearable && $options.isVal && !$props.disabled && $props.type !== "textarea" ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
|
key: 0,
|
class: vue.normalizeClass(["content-clear-icon", { "is-textarea-icon": $props.type === "textarea" }]),
|
type: "clear",
|
size: $props.clearSize,
|
color: $options.msg ? "#dd524d" : $data.focusShow ? $props.primaryColor : "#c0c4cc",
|
onClick: $options.onClear
|
}, null, 8, ["class", "size", "color", "onClick"])) : vue.createCommentVNode("v-if", true)
|
],
|
64
|
/* STABLE_FRAGMENT */
|
)),
|
vue.renderSlot(_ctx.$slots, "right", {}, void 0, true)
|
],
|
6
|
/* CLASS, STYLE */
|
)
|
],
|
6
|
/* CLASS, STYLE */
|
);
|
}
|
const __easycom_3 = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["render", _sfc_render$D], ["__scopeId", "data-v-f7a14e66"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-easyinput/uni-easyinput.vue"]]);
|
const popup = {
|
data() {
|
return {};
|
},
|
created() {
|
this.popup = this.getParent();
|
},
|
methods: {
|
/**
|
* 获取父元素实例
|
*/
|
getParent(name = "uniPopup") {
|
let parent = this.$parent;
|
let parentName = parent.$options.name;
|
while (parentName !== name) {
|
parent = parent.$parent;
|
if (!parent)
|
return false;
|
parentName = parent.$options.name;
|
}
|
return parent;
|
}
|
}
|
};
|
const _sfc_main$D = {
|
name: "uniPopupMessage",
|
mixins: [popup],
|
props: {
|
/**
|
* 主题 success/warning/info/error 默认 success
|
*/
|
type: {
|
type: String,
|
default: "success"
|
},
|
/**
|
* 消息文字
|
*/
|
message: {
|
type: String,
|
default: ""
|
},
|
/**
|
* 显示时间,设置为 0 则不会自动关闭
|
*/
|
duration: {
|
type: Number,
|
default: 3e3
|
},
|
maskShow: {
|
type: Boolean,
|
default: false
|
}
|
},
|
data() {
|
return {};
|
},
|
created() {
|
this.popup.maskShow = this.maskShow;
|
this.popup.messageChild = this;
|
},
|
methods: {
|
timerClose() {
|
if (this.duration === 0)
|
return;
|
clearTimeout(this.timer);
|
this.timer = setTimeout(() => {
|
this.popup.close();
|
}, this.duration);
|
}
|
}
|
};
|
function _sfc_render$C(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-popup-message" }, [
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-popup-message__box fixforpc-width", "uni-popup__" + $props.type])
|
},
|
[
|
vue.renderSlot(_ctx.$slots, "default", {}, () => [
|
vue.createElementVNode(
|
"text",
|
{
|
class: vue.normalizeClass(["uni-popup-message-text", "uni-popup__" + $props.type + "-text"])
|
},
|
vue.toDisplayString($props.message),
|
3
|
/* TEXT, CLASS */
|
)
|
], true)
|
],
|
2
|
/* CLASS */
|
)
|
]);
|
}
|
const __easycom_6 = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["render", _sfc_render$C], ["__scopeId", "data-v-515d10d7"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-popup-message/uni-popup-message.vue"]]);
|
class MPAnimation {
|
constructor(options, _this) {
|
this.options = options;
|
this.animation = uni.createAnimation({
|
...options
|
});
|
this.currentStepAnimates = {};
|
this.next = 0;
|
this.$ = _this;
|
}
|
_nvuePushAnimates(type, args) {
|
let aniObj = this.currentStepAnimates[this.next];
|
let styles = {};
|
if (!aniObj) {
|
styles = {
|
styles: {},
|
config: {}
|
};
|
} else {
|
styles = aniObj;
|
}
|
if (animateTypes1.includes(type)) {
|
if (!styles.styles.transform) {
|
styles.styles.transform = "";
|
}
|
let unit = "";
|
if (type === "rotate") {
|
unit = "deg";
|
}
|
styles.styles.transform += `${type}(${args + unit}) `;
|
} else {
|
styles.styles[type] = `${args}`;
|
}
|
this.currentStepAnimates[this.next] = styles;
|
}
|
_animateRun(styles = {}, config = {}) {
|
let ref = this.$.$refs["ani"].ref;
|
if (!ref)
|
return;
|
return new Promise((resolve, reject) => {
|
nvueAnimation.transition(ref, {
|
styles,
|
...config
|
}, (res) => {
|
resolve();
|
});
|
});
|
}
|
_nvueNextAnimate(animates, step = 0, fn) {
|
let obj = animates[step];
|
if (obj) {
|
let {
|
styles,
|
config
|
} = obj;
|
this._animateRun(styles, config).then(() => {
|
step += 1;
|
this._nvueNextAnimate(animates, step, fn);
|
});
|
} else {
|
this.currentStepAnimates = {};
|
typeof fn === "function" && fn();
|
this.isEnd = true;
|
}
|
}
|
step(config = {}) {
|
this.animation.step(config);
|
return this;
|
}
|
run(fn) {
|
this.$.animationData = this.animation.export();
|
this.$.timer = setTimeout(() => {
|
typeof fn === "function" && fn();
|
}, this.$.durationTime);
|
}
|
}
|
const animateTypes1 = [
|
"matrix",
|
"matrix3d",
|
"rotate",
|
"rotate3d",
|
"rotateX",
|
"rotateY",
|
"rotateZ",
|
"scale",
|
"scale3d",
|
"scaleX",
|
"scaleY",
|
"scaleZ",
|
"skew",
|
"skewX",
|
"skewY",
|
"translate",
|
"translate3d",
|
"translateX",
|
"translateY",
|
"translateZ"
|
];
|
const animateTypes2 = ["opacity", "backgroundColor"];
|
const animateTypes3 = ["width", "height", "left", "right", "top", "bottom"];
|
animateTypes1.concat(animateTypes2, animateTypes3).forEach((type) => {
|
MPAnimation.prototype[type] = function(...args) {
|
this.animation[type](...args);
|
return this;
|
};
|
});
|
function createAnimation(option, _this) {
|
if (!_this)
|
return;
|
clearTimeout(_this.timer);
|
return new MPAnimation(option, _this);
|
}
|
const _sfc_main$C = {
|
name: "uniTransition",
|
emits: ["click", "change"],
|
props: {
|
show: {
|
type: Boolean,
|
default: false
|
},
|
modeClass: {
|
type: [Array, String],
|
default() {
|
return "fade";
|
}
|
},
|
duration: {
|
type: Number,
|
default: 300
|
},
|
styles: {
|
type: Object,
|
default() {
|
return {};
|
}
|
},
|
customClass: {
|
type: String,
|
default: ""
|
},
|
onceRender: {
|
type: Boolean,
|
default: false
|
}
|
},
|
data() {
|
return {
|
isShow: false,
|
transform: "",
|
opacity: 1,
|
animationData: {},
|
durationTime: 300,
|
config: {}
|
};
|
},
|
watch: {
|
show: {
|
handler(newVal) {
|
if (newVal) {
|
this.open();
|
} else {
|
if (this.isShow) {
|
this.close();
|
}
|
}
|
},
|
immediate: true
|
}
|
},
|
computed: {
|
// 生成样式数据
|
stylesObject() {
|
let styles = {
|
...this.styles,
|
"transition-duration": this.duration / 1e3 + "s"
|
};
|
let transform = "";
|
for (let i2 in styles) {
|
let line = this.toLine(i2);
|
transform += line + ":" + styles[i2] + ";";
|
}
|
return transform;
|
},
|
// 初始化动画条件
|
transformStyles() {
|
return "transform:" + this.transform + ";opacity:" + this.opacity + ";" + this.stylesObject;
|
}
|
},
|
created() {
|
this.config = {
|
duration: this.duration,
|
timingFunction: "ease",
|
transformOrigin: "50% 50%",
|
delay: 0
|
};
|
this.durationTime = this.duration;
|
},
|
methods: {
|
/**
|
* ref 触发 初始化动画
|
*/
|
init(obj = {}) {
|
if (obj.duration) {
|
this.durationTime = obj.duration;
|
}
|
this.animation = createAnimation(Object.assign(this.config, obj), this);
|
},
|
/**
|
* 点击组件触发回调
|
*/
|
onClick() {
|
this.$emit("click", {
|
detail: this.isShow
|
});
|
},
|
/**
|
* ref 触发 动画分组
|
* @param {Object} obj
|
*/
|
step(obj, config = {}) {
|
if (!this.animation)
|
return;
|
for (let i2 in obj) {
|
try {
|
if (typeof obj[i2] === "object") {
|
this.animation[i2](...obj[i2]);
|
} else {
|
this.animation[i2](obj[i2]);
|
}
|
} catch (e2) {
|
formatAppLog("error", "at node_modules/@dcloudio/uni-ui/lib/uni-transition/uni-transition.vue:148", `方法 ${i2} 不存在`);
|
}
|
}
|
this.animation.step(config);
|
return this;
|
},
|
/**
|
* ref 触发 执行动画
|
*/
|
run(fn) {
|
if (!this.animation)
|
return;
|
this.animation.run(fn);
|
},
|
// 开始过度动画
|
open() {
|
clearTimeout(this.timer);
|
this.transform = "";
|
this.isShow = true;
|
let { opacity, transform } = this.styleInit(false);
|
if (typeof opacity !== "undefined") {
|
this.opacity = opacity;
|
}
|
this.transform = transform;
|
this.$nextTick(() => {
|
this.timer = setTimeout(() => {
|
this.animation = createAnimation(this.config, this);
|
this.tranfromInit(false).step();
|
this.animation.run();
|
this.$emit("change", {
|
detail: this.isShow
|
});
|
}, 20);
|
});
|
},
|
// 关闭过度动画
|
close(type) {
|
if (!this.animation)
|
return;
|
this.tranfromInit(true).step().run(() => {
|
this.isShow = false;
|
this.animationData = null;
|
this.animation = null;
|
let { opacity, transform } = this.styleInit(false);
|
this.opacity = opacity || 1;
|
this.transform = transform;
|
this.$emit("change", {
|
detail: this.isShow
|
});
|
});
|
},
|
// 处理动画开始前的默认样式
|
styleInit(type) {
|
let styles = {
|
transform: ""
|
};
|
let buildStyle = (type2, mode) => {
|
if (mode === "fade") {
|
styles.opacity = this.animationType(type2)[mode];
|
} else {
|
styles.transform += this.animationType(type2)[mode] + " ";
|
}
|
};
|
if (typeof this.modeClass === "string") {
|
buildStyle(type, this.modeClass);
|
} else {
|
this.modeClass.forEach((mode) => {
|
buildStyle(type, mode);
|
});
|
}
|
return styles;
|
},
|
// 处理内置组合动画
|
tranfromInit(type) {
|
let buildTranfrom = (type2, mode) => {
|
let aniNum = null;
|
if (mode === "fade") {
|
aniNum = type2 ? 0 : 1;
|
} else {
|
aniNum = type2 ? "-100%" : "0";
|
if (mode === "zoom-in") {
|
aniNum = type2 ? 0.8 : 1;
|
}
|
if (mode === "zoom-out") {
|
aniNum = type2 ? 1.2 : 1;
|
}
|
if (mode === "slide-right") {
|
aniNum = type2 ? "100%" : "0";
|
}
|
if (mode === "slide-bottom") {
|
aniNum = type2 ? "100%" : "0";
|
}
|
}
|
this.animation[this.animationMode()[mode]](aniNum);
|
};
|
if (typeof this.modeClass === "string") {
|
buildTranfrom(type, this.modeClass);
|
} else {
|
this.modeClass.forEach((mode) => {
|
buildTranfrom(type, mode);
|
});
|
}
|
return this.animation;
|
},
|
animationType(type) {
|
return {
|
fade: type ? 0 : 1,
|
"slide-top": `translateY(${type ? "0" : "-100%"})`,
|
"slide-right": `translateX(${type ? "0" : "100%"})`,
|
"slide-bottom": `translateY(${type ? "0" : "100%"})`,
|
"slide-left": `translateX(${type ? "0" : "-100%"})`,
|
"zoom-in": `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`,
|
"zoom-out": `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})`
|
};
|
},
|
// 内置动画类型与实际动画对应字典
|
animationMode() {
|
return {
|
fade: "opacity",
|
"slide-top": "translateY",
|
"slide-right": "translateX",
|
"slide-bottom": "translateY",
|
"slide-left": "translateX",
|
"zoom-in": "scale",
|
"zoom-out": "scale"
|
};
|
},
|
// 驼峰转中横线
|
toLine(name) {
|
return name.replace(/([A-Z])/g, "-$1").toLowerCase();
|
}
|
}
|
};
|
function _sfc_render$B(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("view", {
|
ref: "ani",
|
animation: $data.animationData,
|
class: vue.normalizeClass($props.customClass),
|
style: vue.normalizeStyle($options.transformStyles),
|
onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args))
|
}, [
|
vue.renderSlot(_ctx.$slots, "default")
|
], 14, ["animation"])), [
|
[vue.vShow, $data.isShow]
|
]);
|
}
|
const __easycom_0$5 = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$B], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-transition/uni-transition.vue"]]);
|
const _sfc_main$B = {
|
name: "uniPopup",
|
components: {},
|
emits: ["change", "maskClick"],
|
props: {
|
// 开启动画
|
animation: {
|
type: Boolean,
|
default: true
|
},
|
// 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层
|
// message: 消息提示 ; dialog : 对话框
|
type: {
|
type: String,
|
default: "center"
|
},
|
// maskClick
|
isMaskClick: {
|
type: Boolean,
|
default: null
|
},
|
// TODO 2 个版本后废弃属性 ,使用 isMaskClick
|
maskClick: {
|
type: Boolean,
|
default: null
|
},
|
backgroundColor: {
|
type: String,
|
default: "none"
|
},
|
safeArea: {
|
type: Boolean,
|
default: true
|
},
|
maskBackgroundColor: {
|
type: String,
|
default: "rgba(0, 0, 0, 0.4)"
|
},
|
borderRadius: {
|
type: String
|
}
|
},
|
watch: {
|
/**
|
* 监听type类型
|
*/
|
type: {
|
handler: function(type) {
|
if (!this.config[type])
|
return;
|
this[this.config[type]](true);
|
},
|
immediate: true
|
},
|
isDesktop: {
|
handler: function(newVal) {
|
if (!this.config[newVal])
|
return;
|
this[this.config[this.type]](true);
|
},
|
immediate: true
|
},
|
/**
|
* 监听遮罩是否可点击
|
* @param {Object} val
|
*/
|
maskClick: {
|
handler: function(val) {
|
this.mkclick = val;
|
},
|
immediate: true
|
},
|
isMaskClick: {
|
handler: function(val) {
|
this.mkclick = val;
|
},
|
immediate: true
|
},
|
// H5 下禁止底部滚动
|
showPopup(show) {
|
}
|
},
|
data() {
|
return {
|
duration: 300,
|
ani: [],
|
showPopup: false,
|
showTrans: false,
|
popupWidth: 0,
|
popupHeight: 0,
|
config: {
|
top: "top",
|
bottom: "bottom",
|
center: "center",
|
left: "left",
|
right: "right",
|
message: "top",
|
dialog: "center",
|
share: "bottom"
|
},
|
maskClass: {
|
position: "fixed",
|
bottom: 0,
|
top: 0,
|
left: 0,
|
right: 0,
|
backgroundColor: "rgba(0, 0, 0, 0.4)"
|
},
|
transClass: {
|
backgroundColor: "transparent",
|
borderRadius: this.borderRadius || "0",
|
position: "fixed",
|
left: 0,
|
right: 0
|
},
|
maskShow: true,
|
mkclick: true,
|
popupstyle: "top"
|
};
|
},
|
computed: {
|
getStyles() {
|
let res = { backgroundColor: this.bg };
|
if (this.borderRadius || "0") {
|
res = Object.assign(res, { borderRadius: this.borderRadius });
|
}
|
return res;
|
},
|
isDesktop() {
|
return this.popupWidth >= 500 && this.popupHeight >= 500;
|
},
|
bg() {
|
if (this.backgroundColor === "" || this.backgroundColor === "none") {
|
return "transparent";
|
}
|
return this.backgroundColor;
|
}
|
},
|
mounted() {
|
const fixSize = () => {
|
const {
|
windowWidth,
|
windowHeight,
|
windowTop,
|
safeArea,
|
screenHeight,
|
safeAreaInsets
|
} = uni.getSystemInfoSync();
|
this.popupWidth = windowWidth;
|
this.popupHeight = windowHeight + (windowTop || 0);
|
if (safeArea && this.safeArea) {
|
this.safeAreaInsets = safeAreaInsets.bottom;
|
} else {
|
this.safeAreaInsets = 0;
|
}
|
};
|
fixSize();
|
},
|
// TODO vue3
|
unmounted() {
|
this.setH5Visible();
|
},
|
activated() {
|
this.setH5Visible(!this.showPopup);
|
},
|
deactivated() {
|
this.setH5Visible(true);
|
},
|
created() {
|
if (this.isMaskClick === null && this.maskClick === null) {
|
this.mkclick = true;
|
} else {
|
this.mkclick = this.isMaskClick !== null ? this.isMaskClick : this.maskClick;
|
}
|
if (this.animation) {
|
this.duration = 300;
|
} else {
|
this.duration = 0;
|
}
|
this.messageChild = null;
|
this.clearPropagation = false;
|
this.maskClass.backgroundColor = this.maskBackgroundColor;
|
},
|
methods: {
|
setH5Visible(visible = true) {
|
},
|
/**
|
* 公用方法,不显示遮罩层
|
*/
|
closeMask() {
|
this.maskShow = false;
|
},
|
/**
|
* 公用方法,遮罩层禁止点击
|
*/
|
disableMask() {
|
this.mkclick = false;
|
},
|
// TODO nvue 取消冒泡
|
clear(e2) {
|
e2.stopPropagation();
|
this.clearPropagation = true;
|
},
|
open(direction) {
|
if (this.showPopup) {
|
return;
|
}
|
let innerType = ["top", "center", "bottom", "left", "right", "message", "dialog", "share"];
|
if (!(direction && innerType.indexOf(direction) !== -1)) {
|
direction = this.type;
|
}
|
if (!this.config[direction]) {
|
formatAppLog("error", "at node_modules/@dcloudio/uni-ui/lib/uni-popup/uni-popup.vue:310", "缺少类型:", direction);
|
return;
|
}
|
this[this.config[direction]]();
|
this.$emit("change", {
|
show: true,
|
type: direction
|
});
|
},
|
close(type) {
|
this.showTrans = false;
|
this.$emit("change", {
|
show: false,
|
type: this.type
|
});
|
clearTimeout(this.timer);
|
this.timer = setTimeout(() => {
|
this.showPopup = false;
|
}, 300);
|
},
|
// TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
|
touchstart() {
|
this.clearPropagation = false;
|
},
|
onTap() {
|
if (this.clearPropagation) {
|
this.clearPropagation = false;
|
return;
|
}
|
this.$emit("maskClick");
|
if (!this.mkclick)
|
return;
|
this.close();
|
},
|
/**
|
* 顶部弹出样式处理
|
*/
|
top(type) {
|
this.popupstyle = this.isDesktop ? "fixforpc-top" : "top";
|
this.ani = ["slide-top"];
|
this.transClass = {
|
position: "fixed",
|
left: 0,
|
right: 0,
|
backgroundColor: this.bg,
|
borderRadius: this.borderRadius || "0"
|
};
|
if (type)
|
return;
|
this.showPopup = true;
|
this.showTrans = true;
|
this.$nextTick(() => {
|
this.showPoptrans();
|
if (this.messageChild && this.type === "message") {
|
this.messageChild.timerClose();
|
}
|
});
|
},
|
/**
|
* 底部弹出样式处理
|
*/
|
bottom(type) {
|
this.popupstyle = "bottom";
|
this.ani = ["slide-bottom"];
|
this.transClass = {
|
position: "fixed",
|
left: 0,
|
right: 0,
|
bottom: 0,
|
paddingBottom: this.safeAreaInsets + "px",
|
backgroundColor: this.bg,
|
borderRadius: this.borderRadius || "0"
|
};
|
if (type)
|
return;
|
this.showPoptrans();
|
},
|
/**
|
* 中间弹出样式处理
|
*/
|
center(type) {
|
this.popupstyle = "center";
|
this.ani = ["zoom-out", "fade"];
|
this.transClass = {
|
position: "fixed",
|
display: "flex",
|
flexDirection: "column",
|
bottom: 0,
|
left: 0,
|
right: 0,
|
top: 0,
|
justifyContent: "center",
|
alignItems: "center",
|
borderRadius: this.borderRadius || "0"
|
};
|
if (type)
|
return;
|
this.showPoptrans();
|
},
|
left(type) {
|
this.popupstyle = "left";
|
this.ani = ["slide-left"];
|
this.transClass = {
|
position: "fixed",
|
left: 0,
|
bottom: 0,
|
top: 0,
|
backgroundColor: this.bg,
|
borderRadius: this.borderRadius || "0",
|
display: "flex",
|
flexDirection: "column"
|
};
|
if (type)
|
return;
|
this.showPoptrans();
|
},
|
right(type) {
|
this.popupstyle = "right";
|
this.ani = ["slide-right"];
|
this.transClass = {
|
position: "fixed",
|
bottom: 0,
|
right: 0,
|
top: 0,
|
backgroundColor: this.bg,
|
borderRadius: this.borderRadius || "0",
|
display: "flex",
|
flexDirection: "column"
|
};
|
if (type)
|
return;
|
this.showPoptrans();
|
},
|
showPoptrans() {
|
this.$nextTick(() => {
|
this.showPopup = true;
|
this.showTrans = true;
|
});
|
}
|
}
|
};
|
function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_uni_transition = resolveEasycom(vue.resolveDynamicComponent("uni-transition"), __easycom_0$5);
|
return $data.showPopup ? (vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 0,
|
class: vue.normalizeClass(["uni-popup", [$data.popupstyle, $options.isDesktop ? "fixforpc-z-index" : ""]])
|
},
|
[
|
vue.createElementVNode(
|
"view",
|
{
|
onTouchstart: _cache[1] || (_cache[1] = (...args) => $options.touchstart && $options.touchstart(...args))
|
},
|
[
|
$data.maskShow ? (vue.openBlock(), vue.createBlock(_component_uni_transition, {
|
key: "1",
|
name: "mask",
|
"mode-class": "fade",
|
styles: $data.maskClass,
|
duration: $data.duration,
|
show: $data.showTrans,
|
onClick: $options.onTap
|
}, null, 8, ["styles", "duration", "show", "onClick"])) : vue.createCommentVNode("v-if", true),
|
vue.createVNode(_component_uni_transition, {
|
key: "2",
|
"mode-class": $data.ani,
|
name: "content",
|
styles: $data.transClass,
|
duration: $data.duration,
|
show: $data.showTrans,
|
onClick: $options.onTap
|
}, {
|
default: vue.withCtx(() => [
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-popup__wrapper", [$data.popupstyle]]),
|
style: vue.normalizeStyle($options.getStyles),
|
onClick: _cache[0] || (_cache[0] = (...args) => $options.clear && $options.clear(...args))
|
},
|
[
|
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
],
|
6
|
/* CLASS, STYLE */
|
)
|
]),
|
_: 3
|
/* FORWARDED */
|
}, 8, ["mode-class", "styles", "duration", "show", "onClick"])
|
],
|
32
|
/* NEED_HYDRATION */
|
)
|
],
|
2
|
/* CLASS */
|
)) : vue.createCommentVNode("v-if", true);
|
}
|
const __easycom_7$1 = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["render", _sfc_render$A], ["__scopeId", "data-v-7db519c7"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-popup/uni-popup.vue"]]);
|
var isVue2 = false;
|
function set(target, key, val) {
|
if (Array.isArray(target)) {
|
target.length = Math.max(target.length, key);
|
target.splice(key, 1, val);
|
return val;
|
}
|
target[key] = val;
|
return val;
|
}
|
function del(target, key) {
|
if (Array.isArray(target)) {
|
target.splice(key, 1);
|
return;
|
}
|
delete target[key];
|
}
|
function getDevtoolsGlobalHook() {
|
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
}
|
function getTarget() {
|
return typeof navigator !== "undefined" && typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
}
|
const isProxyAvailable = typeof Proxy === "function";
|
const HOOK_SETUP = "devtools-plugin:setup";
|
const HOOK_PLUGIN_SETTINGS_SET = "plugin:settings:set";
|
let supported;
|
let perf;
|
function isPerformanceSupported() {
|
var _a;
|
if (supported !== void 0) {
|
return supported;
|
}
|
if (typeof window !== "undefined" && window.performance) {
|
supported = true;
|
perf = window.performance;
|
} else if (typeof global !== "undefined" && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
|
supported = true;
|
perf = global.perf_hooks.performance;
|
} else {
|
supported = false;
|
}
|
return supported;
|
}
|
function now() {
|
return isPerformanceSupported() ? perf.now() : Date.now();
|
}
|
class ApiProxy {
|
constructor(plugin, hook) {
|
this.target = null;
|
this.targetQueue = [];
|
this.onQueue = [];
|
this.plugin = plugin;
|
this.hook = hook;
|
const defaultSettings = {};
|
if (plugin.settings) {
|
for (const id in plugin.settings) {
|
const item = plugin.settings[id];
|
defaultSettings[id] = item.defaultValue;
|
}
|
}
|
const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
|
let currentSettings = Object.assign({}, defaultSettings);
|
try {
|
const raw = localStorage.getItem(localSettingsSaveId);
|
const data = JSON.parse(raw);
|
Object.assign(currentSettings, data);
|
} catch (e2) {
|
}
|
this.fallbacks = {
|
getSettings() {
|
return currentSettings;
|
},
|
setSettings(value) {
|
try {
|
localStorage.setItem(localSettingsSaveId, JSON.stringify(value));
|
} catch (e2) {
|
}
|
currentSettings = value;
|
},
|
now() {
|
return now();
|
}
|
};
|
if (hook) {
|
hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
|
if (pluginId === this.plugin.id) {
|
this.fallbacks.setSettings(value);
|
}
|
});
|
}
|
this.proxiedOn = new Proxy({}, {
|
get: (_target, prop) => {
|
if (this.target) {
|
return this.target.on[prop];
|
} else {
|
return (...args) => {
|
this.onQueue.push({
|
method: prop,
|
args
|
});
|
};
|
}
|
}
|
});
|
this.proxiedTarget = new Proxy({}, {
|
get: (_target, prop) => {
|
if (this.target) {
|
return this.target[prop];
|
} else if (prop === "on") {
|
return this.proxiedOn;
|
} else if (Object.keys(this.fallbacks).includes(prop)) {
|
return (...args) => {
|
this.targetQueue.push({
|
method: prop,
|
args,
|
resolve: () => {
|
}
|
});
|
return this.fallbacks[prop](...args);
|
};
|
} else {
|
return (...args) => {
|
return new Promise((resolve) => {
|
this.targetQueue.push({
|
method: prop,
|
args,
|
resolve
|
});
|
});
|
};
|
}
|
}
|
});
|
}
|
async setRealTarget(target) {
|
this.target = target;
|
for (const item of this.onQueue) {
|
this.target.on[item.method](...item.args);
|
}
|
for (const item of this.targetQueue) {
|
item.resolve(await this.target[item.method](...item.args));
|
}
|
}
|
}
|
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
|
const descriptor = pluginDescriptor;
|
const target = getTarget();
|
const hook = getDevtoolsGlobalHook();
|
const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy;
|
if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
|
hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
|
} else {
|
const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null;
|
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
|
list.push({
|
pluginDescriptor: descriptor,
|
setupFn,
|
proxy
|
});
|
if (proxy)
|
setupFn(proxy.proxiedTarget);
|
}
|
}
|
/*!
|
* pinia v2.1.7
|
* (c) 2023 Eduardo San Martin Morote
|
* @license MIT
|
*/
|
let activePinia;
|
const setActivePinia = (pinia) => activePinia = pinia;
|
const piniaSymbol = Symbol("pinia");
|
function isPlainObject$2(o2) {
|
return o2 && typeof o2 === "object" && Object.prototype.toString.call(o2) === "[object Object]" && typeof o2.toJSON !== "function";
|
}
|
var MutationType;
|
(function(MutationType2) {
|
MutationType2["direct"] = "direct";
|
MutationType2["patchObject"] = "patch object";
|
MutationType2["patchFunction"] = "patch function";
|
})(MutationType || (MutationType = {}));
|
const IS_CLIENT = typeof window !== "undefined";
|
const USE_DEVTOOLS = IS_CLIENT;
|
const _global$1 = /* @__PURE__ */ (() => typeof window === "object" && window.window === window ? window : typeof self === "object" && self.self === self ? self : typeof global === "object" && global.global === global ? global : typeof globalThis === "object" ? globalThis : { HTMLElement: null })();
|
function bom(blob, { autoBom = false } = {}) {
|
if (autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
|
return new Blob([String.fromCharCode(65279), blob], { type: blob.type });
|
}
|
return blob;
|
}
|
function download(url, name, opts) {
|
const xhr = new XMLHttpRequest();
|
xhr.open("GET", url);
|
xhr.responseType = "blob";
|
xhr.onload = function() {
|
saveAs(xhr.response, name, opts);
|
};
|
xhr.onerror = function() {
|
console.error("could not download file");
|
};
|
xhr.send();
|
}
|
function corsEnabled(url) {
|
const xhr = new XMLHttpRequest();
|
xhr.open("HEAD", url, false);
|
try {
|
xhr.send();
|
} catch (e2) {
|
}
|
return xhr.status >= 200 && xhr.status <= 299;
|
}
|
function click(node) {
|
try {
|
node.dispatchEvent(new MouseEvent("click"));
|
} catch (e2) {
|
const evt = document.createEvent("MouseEvents");
|
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);
|
node.dispatchEvent(evt);
|
}
|
}
|
const _navigator = typeof navigator === "object" ? navigator : { userAgent: "" };
|
const isMacOSWebView = /* @__PURE__ */ (() => /Macintosh/.test(_navigator.userAgent) && /AppleWebKit/.test(_navigator.userAgent) && !/Safari/.test(_navigator.userAgent))();
|
const saveAs = !IS_CLIENT ? () => {
|
} : (
|
// Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView or mini program
|
typeof HTMLAnchorElement !== "undefined" && "download" in HTMLAnchorElement.prototype && !isMacOSWebView ? downloadSaveAs : (
|
// Use msSaveOrOpenBlob as a second approach
|
"msSaveOrOpenBlob" in _navigator ? msSaveAs : (
|
// Fallback to using FileReader and a popup
|
fileSaverSaveAs
|
)
|
)
|
);
|
function downloadSaveAs(blob, name = "download", opts) {
|
const a2 = document.createElement("a");
|
a2.download = name;
|
a2.rel = "noopener";
|
if (typeof blob === "string") {
|
a2.href = blob;
|
if (a2.origin !== location.origin) {
|
if (corsEnabled(a2.href)) {
|
download(blob, name, opts);
|
} else {
|
a2.target = "_blank";
|
click(a2);
|
}
|
} else {
|
click(a2);
|
}
|
} else {
|
a2.href = URL.createObjectURL(blob);
|
setTimeout(function() {
|
URL.revokeObjectURL(a2.href);
|
}, 4e4);
|
setTimeout(function() {
|
click(a2);
|
}, 0);
|
}
|
}
|
function msSaveAs(blob, name = "download", opts) {
|
if (typeof blob === "string") {
|
if (corsEnabled(blob)) {
|
download(blob, name, opts);
|
} else {
|
const a2 = document.createElement("a");
|
a2.href = blob;
|
a2.target = "_blank";
|
setTimeout(function() {
|
click(a2);
|
});
|
}
|
} else {
|
navigator.msSaveOrOpenBlob(bom(blob, opts), name);
|
}
|
}
|
function fileSaverSaveAs(blob, name, opts, popup2) {
|
popup2 = popup2 || open("", "_blank");
|
if (popup2) {
|
popup2.document.title = popup2.document.body.innerText = "downloading...";
|
}
|
if (typeof blob === "string")
|
return download(blob, name, opts);
|
const force = blob.type === "application/octet-stream";
|
const isSafari = /constructor/i.test(String(_global$1.HTMLElement)) || "safari" in _global$1;
|
const isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent);
|
if ((isChromeIOS || force && isSafari || isMacOSWebView) && typeof FileReader !== "undefined") {
|
const reader = new FileReader();
|
reader.onloadend = function() {
|
let url = reader.result;
|
if (typeof url !== "string") {
|
popup2 = null;
|
throw new Error("Wrong reader.result type");
|
}
|
url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, "data:attachment/file;");
|
if (popup2) {
|
popup2.location.href = url;
|
} else {
|
location.assign(url);
|
}
|
popup2 = null;
|
};
|
reader.readAsDataURL(blob);
|
} else {
|
const url = URL.createObjectURL(blob);
|
if (popup2)
|
popup2.location.assign(url);
|
else
|
location.href = url;
|
popup2 = null;
|
setTimeout(function() {
|
URL.revokeObjectURL(url);
|
}, 4e4);
|
}
|
}
|
function toastMessage(message, type) {
|
const piniaMessage = "🍍 " + message;
|
if (typeof __VUE_DEVTOOLS_TOAST__ === "function") {
|
__VUE_DEVTOOLS_TOAST__(piniaMessage, type);
|
} else if (type === "error") {
|
console.error(piniaMessage);
|
} else if (type === "warn") {
|
console.warn(piniaMessage);
|
} else {
|
console.log(piniaMessage);
|
}
|
}
|
function isPinia(o2) {
|
return "_a" in o2 && "install" in o2;
|
}
|
function checkClipboardAccess() {
|
if (!("clipboard" in navigator)) {
|
toastMessage(`Your browser doesn't support the Clipboard API`, "error");
|
return true;
|
}
|
}
|
function checkNotFocusedError(error) {
|
if (error instanceof Error && error.message.toLowerCase().includes("document is not focused")) {
|
toastMessage('You need to activate the "Emulate a focused page" setting in the "Rendering" panel of devtools.', "warn");
|
return true;
|
}
|
return false;
|
}
|
async function actionGlobalCopyState(pinia) {
|
if (checkClipboardAccess())
|
return;
|
try {
|
await navigator.clipboard.writeText(JSON.stringify(pinia.state.value));
|
toastMessage("Global state copied to clipboard.");
|
} catch (error) {
|
if (checkNotFocusedError(error))
|
return;
|
toastMessage(`Failed to serialize the state. Check the console for more details.`, "error");
|
console.error(error);
|
}
|
}
|
async function actionGlobalPasteState(pinia) {
|
if (checkClipboardAccess())
|
return;
|
try {
|
loadStoresState(pinia, JSON.parse(await navigator.clipboard.readText()));
|
toastMessage("Global state pasted from clipboard.");
|
} catch (error) {
|
if (checkNotFocusedError(error))
|
return;
|
toastMessage(`Failed to deserialize the state from clipboard. Check the console for more details.`, "error");
|
console.error(error);
|
}
|
}
|
async function actionGlobalSaveState(pinia) {
|
try {
|
saveAs(new Blob([JSON.stringify(pinia.state.value)], {
|
type: "text/plain;charset=utf-8"
|
}), "pinia-state.json");
|
} catch (error) {
|
toastMessage(`Failed to export the state as JSON. Check the console for more details.`, "error");
|
console.error(error);
|
}
|
}
|
let fileInput;
|
function getFileOpener() {
|
if (!fileInput) {
|
fileInput = document.createElement("input");
|
fileInput.type = "file";
|
fileInput.accept = ".json";
|
}
|
function openFile() {
|
return new Promise((resolve, reject) => {
|
fileInput.onchange = async () => {
|
const files = fileInput.files;
|
if (!files)
|
return resolve(null);
|
const file = files.item(0);
|
if (!file)
|
return resolve(null);
|
return resolve({ text: await file.text(), file });
|
};
|
fileInput.oncancel = () => resolve(null);
|
fileInput.onerror = reject;
|
fileInput.click();
|
});
|
}
|
return openFile;
|
}
|
async function actionGlobalOpenStateFile(pinia) {
|
try {
|
const open2 = getFileOpener();
|
const result = await open2();
|
if (!result)
|
return;
|
const { text, file } = result;
|
loadStoresState(pinia, JSON.parse(text));
|
toastMessage(`Global state imported from "${file.name}".`);
|
} catch (error) {
|
toastMessage(`Failed to import the state from JSON. Check the console for more details.`, "error");
|
console.error(error);
|
}
|
}
|
function loadStoresState(pinia, state) {
|
for (const key in state) {
|
const storeState = pinia.state.value[key];
|
if (storeState) {
|
Object.assign(storeState, state[key]);
|
} else {
|
pinia.state.value[key] = state[key];
|
}
|
}
|
}
|
function formatDisplay(display) {
|
return {
|
_custom: {
|
display
|
}
|
};
|
}
|
const PINIA_ROOT_LABEL = "🍍 Pinia (root)";
|
const PINIA_ROOT_ID = "_root";
|
function formatStoreForInspectorTree(store) {
|
return isPinia(store) ? {
|
id: PINIA_ROOT_ID,
|
label: PINIA_ROOT_LABEL
|
} : {
|
id: store.$id,
|
label: store.$id
|
};
|
}
|
function formatStoreForInspectorState(store) {
|
if (isPinia(store)) {
|
const storeNames = Array.from(store._s.keys());
|
const storeMap = store._s;
|
const state2 = {
|
state: storeNames.map((storeId) => ({
|
editable: true,
|
key: storeId,
|
value: store.state.value[storeId]
|
})),
|
getters: storeNames.filter((id) => storeMap.get(id)._getters).map((id) => {
|
const store2 = storeMap.get(id);
|
return {
|
editable: false,
|
key: id,
|
value: store2._getters.reduce((getters, key) => {
|
getters[key] = store2[key];
|
return getters;
|
}, {})
|
};
|
})
|
};
|
return state2;
|
}
|
const state = {
|
state: Object.keys(store.$state).map((key) => ({
|
editable: true,
|
key,
|
value: store.$state[key]
|
}))
|
};
|
if (store._getters && store._getters.length) {
|
state.getters = store._getters.map((getterName) => ({
|
editable: false,
|
key: getterName,
|
value: store[getterName]
|
}));
|
}
|
if (store._customProperties.size) {
|
state.customProperties = Array.from(store._customProperties).map((key) => ({
|
editable: true,
|
key,
|
value: store[key]
|
}));
|
}
|
return state;
|
}
|
function formatEventData(events) {
|
if (!events)
|
return {};
|
if (Array.isArray(events)) {
|
return events.reduce((data, event) => {
|
data.keys.push(event.key);
|
data.operations.push(event.type);
|
data.oldValue[event.key] = event.oldValue;
|
data.newValue[event.key] = event.newValue;
|
return data;
|
}, {
|
oldValue: {},
|
keys: [],
|
operations: [],
|
newValue: {}
|
});
|
} else {
|
return {
|
operation: formatDisplay(events.type),
|
key: formatDisplay(events.key),
|
oldValue: events.oldValue,
|
newValue: events.newValue
|
};
|
}
|
}
|
function formatMutationType(type) {
|
switch (type) {
|
case MutationType.direct:
|
return "mutation";
|
case MutationType.patchFunction:
|
return "$patch";
|
case MutationType.patchObject:
|
return "$patch";
|
default:
|
return "unknown";
|
}
|
}
|
let isTimelineActive = true;
|
const componentStateTypes = [];
|
const MUTATIONS_LAYER_ID = "pinia:mutations";
|
const INSPECTOR_ID = "pinia";
|
const { assign: assign$1 } = Object;
|
const getStoreType = (id) => "🍍 " + id;
|
function registerPiniaDevtools(app, pinia) {
|
setupDevtoolsPlugin({
|
id: "dev.esm.pinia",
|
label: "Pinia 🍍",
|
logo: "https://pinia.vuejs.org/logo.svg",
|
packageName: "pinia",
|
homepage: "https://pinia.vuejs.org",
|
componentStateTypes,
|
app
|
}, (api) => {
|
if (typeof api.now !== "function") {
|
toastMessage("You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.");
|
}
|
api.addTimelineLayer({
|
id: MUTATIONS_LAYER_ID,
|
label: `Pinia 🍍`,
|
color: 15064968
|
});
|
api.addInspector({
|
id: INSPECTOR_ID,
|
label: "Pinia 🍍",
|
icon: "storage",
|
treeFilterPlaceholder: "Search stores",
|
actions: [
|
{
|
icon: "content_copy",
|
action: () => {
|
actionGlobalCopyState(pinia);
|
},
|
tooltip: "Serialize and copy the state"
|
},
|
{
|
icon: "content_paste",
|
action: async () => {
|
await actionGlobalPasteState(pinia);
|
api.sendInspectorTree(INSPECTOR_ID);
|
api.sendInspectorState(INSPECTOR_ID);
|
},
|
tooltip: "Replace the state with the content of your clipboard"
|
},
|
{
|
icon: "save",
|
action: () => {
|
actionGlobalSaveState(pinia);
|
},
|
tooltip: "Save the state as a JSON file"
|
},
|
{
|
icon: "folder_open",
|
action: async () => {
|
await actionGlobalOpenStateFile(pinia);
|
api.sendInspectorTree(INSPECTOR_ID);
|
api.sendInspectorState(INSPECTOR_ID);
|
},
|
tooltip: "Import the state from a JSON file"
|
}
|
],
|
nodeActions: [
|
{
|
icon: "restore",
|
tooltip: 'Reset the state (with "$reset")',
|
action: (nodeId) => {
|
const store = pinia._s.get(nodeId);
|
if (!store) {
|
toastMessage(`Cannot reset "${nodeId}" store because it wasn't found.`, "warn");
|
} else if (typeof store.$reset !== "function") {
|
toastMessage(`Cannot reset "${nodeId}" store because it doesn't have a "$reset" method implemented.`, "warn");
|
} else {
|
store.$reset();
|
toastMessage(`Store "${nodeId}" reset.`);
|
}
|
}
|
}
|
]
|
});
|
api.on.inspectComponent((payload, ctx) => {
|
const proxy = payload.componentInstance && payload.componentInstance.proxy;
|
if (proxy && proxy._pStores) {
|
const piniaStores = payload.componentInstance.proxy._pStores;
|
Object.values(piniaStores).forEach((store) => {
|
payload.instanceData.state.push({
|
type: getStoreType(store.$id),
|
key: "state",
|
editable: true,
|
value: store._isOptionsAPI ? {
|
_custom: {
|
value: vue.toRaw(store.$state),
|
actions: [
|
{
|
icon: "restore",
|
tooltip: "Reset the state of this store",
|
action: () => store.$reset()
|
}
|
]
|
}
|
} : (
|
// NOTE: workaround to unwrap transferred refs
|
Object.keys(store.$state).reduce((state, key) => {
|
state[key] = store.$state[key];
|
return state;
|
}, {})
|
)
|
});
|
if (store._getters && store._getters.length) {
|
payload.instanceData.state.push({
|
type: getStoreType(store.$id),
|
key: "getters",
|
editable: false,
|
value: store._getters.reduce((getters, key) => {
|
try {
|
getters[key] = store[key];
|
} catch (error) {
|
getters[key] = error;
|
}
|
return getters;
|
}, {})
|
});
|
}
|
});
|
}
|
});
|
api.on.getInspectorTree((payload) => {
|
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
|
let stores = [pinia];
|
stores = stores.concat(Array.from(pinia._s.values()));
|
payload.rootNodes = (payload.filter ? stores.filter((store) => "$id" in store ? store.$id.toLowerCase().includes(payload.filter.toLowerCase()) : PINIA_ROOT_LABEL.toLowerCase().includes(payload.filter.toLowerCase())) : stores).map(formatStoreForInspectorTree);
|
}
|
});
|
api.on.getInspectorState((payload) => {
|
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
|
const inspectedStore = payload.nodeId === PINIA_ROOT_ID ? pinia : pinia._s.get(payload.nodeId);
|
if (!inspectedStore) {
|
return;
|
}
|
if (inspectedStore) {
|
payload.state = formatStoreForInspectorState(inspectedStore);
|
}
|
}
|
});
|
api.on.editInspectorState((payload, ctx) => {
|
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
|
const inspectedStore = payload.nodeId === PINIA_ROOT_ID ? pinia : pinia._s.get(payload.nodeId);
|
if (!inspectedStore) {
|
return toastMessage(`store "${payload.nodeId}" not found`, "error");
|
}
|
const { path } = payload;
|
if (!isPinia(inspectedStore)) {
|
if (path.length !== 1 || !inspectedStore._customProperties.has(path[0]) || path[0] in inspectedStore.$state) {
|
path.unshift("$state");
|
}
|
} else {
|
path.unshift("state");
|
}
|
isTimelineActive = false;
|
payload.set(inspectedStore, path, payload.state.value);
|
isTimelineActive = true;
|
}
|
});
|
api.on.editComponentState((payload) => {
|
if (payload.type.startsWith("🍍")) {
|
const storeId = payload.type.replace(/^🍍\s*/, "");
|
const store = pinia._s.get(storeId);
|
if (!store) {
|
return toastMessage(`store "${storeId}" not found`, "error");
|
}
|
const { path } = payload;
|
if (path[0] !== "state") {
|
return toastMessage(`Invalid path for store "${storeId}":
|
${path}
|
Only state can be modified.`);
|
}
|
path[0] = "$state";
|
isTimelineActive = false;
|
payload.set(store, path, payload.state.value);
|
isTimelineActive = true;
|
}
|
});
|
});
|
}
|
function addStoreToDevtools(app, store) {
|
if (!componentStateTypes.includes(getStoreType(store.$id))) {
|
componentStateTypes.push(getStoreType(store.$id));
|
}
|
setupDevtoolsPlugin({
|
id: "dev.esm.pinia",
|
label: "Pinia 🍍",
|
logo: "https://pinia.vuejs.org/logo.svg",
|
packageName: "pinia",
|
homepage: "https://pinia.vuejs.org",
|
componentStateTypes,
|
app,
|
settings: {
|
logStoreChanges: {
|
label: "Notify about new/deleted stores",
|
type: "boolean",
|
defaultValue: true
|
}
|
// useEmojis: {
|
// label: 'Use emojis in messages ⚡️',
|
// type: 'boolean',
|
// defaultValue: true,
|
// },
|
}
|
}, (api) => {
|
const now2 = typeof api.now === "function" ? api.now.bind(api) : Date.now;
|
store.$onAction(({ after, onError, name, args }) => {
|
const groupId = runningActionId++;
|
api.addTimelineEvent({
|
layerId: MUTATIONS_LAYER_ID,
|
event: {
|
time: now2(),
|
title: "🛫 " + name,
|
subtitle: "start",
|
data: {
|
store: formatDisplay(store.$id),
|
action: formatDisplay(name),
|
args
|
},
|
groupId
|
}
|
});
|
after((result) => {
|
activeAction = void 0;
|
api.addTimelineEvent({
|
layerId: MUTATIONS_LAYER_ID,
|
event: {
|
time: now2(),
|
title: "🛬 " + name,
|
subtitle: "end",
|
data: {
|
store: formatDisplay(store.$id),
|
action: formatDisplay(name),
|
args,
|
result
|
},
|
groupId
|
}
|
});
|
});
|
onError((error) => {
|
activeAction = void 0;
|
api.addTimelineEvent({
|
layerId: MUTATIONS_LAYER_ID,
|
event: {
|
time: now2(),
|
logType: "error",
|
title: "💥 " + name,
|
subtitle: "end",
|
data: {
|
store: formatDisplay(store.$id),
|
action: formatDisplay(name),
|
args,
|
error
|
},
|
groupId
|
}
|
});
|
});
|
}, true);
|
store._customProperties.forEach((name) => {
|
vue.watch(() => vue.unref(store[name]), (newValue, oldValue) => {
|
api.notifyComponentUpdate();
|
api.sendInspectorState(INSPECTOR_ID);
|
if (isTimelineActive) {
|
api.addTimelineEvent({
|
layerId: MUTATIONS_LAYER_ID,
|
event: {
|
time: now2(),
|
title: "Change",
|
subtitle: name,
|
data: {
|
newValue,
|
oldValue
|
},
|
groupId: activeAction
|
}
|
});
|
}
|
}, { deep: true });
|
});
|
store.$subscribe(({ events, type }, state) => {
|
api.notifyComponentUpdate();
|
api.sendInspectorState(INSPECTOR_ID);
|
if (!isTimelineActive)
|
return;
|
const eventData = {
|
time: now2(),
|
title: formatMutationType(type),
|
data: assign$1({ store: formatDisplay(store.$id) }, formatEventData(events)),
|
groupId: activeAction
|
};
|
if (type === MutationType.patchFunction) {
|
eventData.subtitle = "⤵️";
|
} else if (type === MutationType.patchObject) {
|
eventData.subtitle = "🧩";
|
} else if (events && !Array.isArray(events)) {
|
eventData.subtitle = events.type;
|
}
|
if (events) {
|
eventData.data["rawEvent(s)"] = {
|
_custom: {
|
display: "DebuggerEvent",
|
type: "object",
|
tooltip: "raw DebuggerEvent[]",
|
value: events
|
}
|
};
|
}
|
api.addTimelineEvent({
|
layerId: MUTATIONS_LAYER_ID,
|
event: eventData
|
});
|
}, { detached: true, flush: "sync" });
|
const hotUpdate = store._hotUpdate;
|
store._hotUpdate = vue.markRaw((newStore) => {
|
hotUpdate(newStore);
|
api.addTimelineEvent({
|
layerId: MUTATIONS_LAYER_ID,
|
event: {
|
time: now2(),
|
title: "🔥 " + store.$id,
|
subtitle: "HMR update",
|
data: {
|
store: formatDisplay(store.$id),
|
info: formatDisplay(`HMR update`)
|
}
|
}
|
});
|
api.notifyComponentUpdate();
|
api.sendInspectorTree(INSPECTOR_ID);
|
api.sendInspectorState(INSPECTOR_ID);
|
});
|
const { $dispose } = store;
|
store.$dispose = () => {
|
$dispose();
|
api.notifyComponentUpdate();
|
api.sendInspectorTree(INSPECTOR_ID);
|
api.sendInspectorState(INSPECTOR_ID);
|
api.getSettings().logStoreChanges && toastMessage(`Disposed "${store.$id}" store 🗑`);
|
};
|
api.notifyComponentUpdate();
|
api.sendInspectorTree(INSPECTOR_ID);
|
api.sendInspectorState(INSPECTOR_ID);
|
api.getSettings().logStoreChanges && toastMessage(`"${store.$id}" store installed 🆕`);
|
});
|
}
|
let runningActionId = 0;
|
let activeAction;
|
function patchActionForGrouping(store, actionNames, wrapWithProxy) {
|
const actions = actionNames.reduce((storeActions, actionName) => {
|
storeActions[actionName] = vue.toRaw(store)[actionName];
|
return storeActions;
|
}, {});
|
for (const actionName in actions) {
|
store[actionName] = function() {
|
const _actionId = runningActionId;
|
const trackedStore = wrapWithProxy ? new Proxy(store, {
|
get(...args) {
|
activeAction = _actionId;
|
return Reflect.get(...args);
|
},
|
set(...args) {
|
activeAction = _actionId;
|
return Reflect.set(...args);
|
}
|
}) : store;
|
activeAction = _actionId;
|
const retValue = actions[actionName].apply(trackedStore, arguments);
|
activeAction = void 0;
|
return retValue;
|
};
|
}
|
}
|
function devtoolsPlugin({ app, store, options }) {
|
if (store.$id.startsWith("__hot:")) {
|
return;
|
}
|
store._isOptionsAPI = !!options.state;
|
patchActionForGrouping(store, Object.keys(options.actions), store._isOptionsAPI);
|
const originalHotUpdate = store._hotUpdate;
|
vue.toRaw(store)._hotUpdate = function(newStore) {
|
originalHotUpdate.apply(this, arguments);
|
patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions), !!store._isOptionsAPI);
|
};
|
addStoreToDevtools(
|
app,
|
// FIXME: is there a way to allow the assignment from Store<Id, S, G, A> to StoreGeneric?
|
store
|
);
|
}
|
function createPinia() {
|
const scope = vue.effectScope(true);
|
const state = scope.run(() => vue.ref({}));
|
let _p = [];
|
let toBeInstalled = [];
|
const pinia = vue.markRaw({
|
install(app) {
|
setActivePinia(pinia);
|
{
|
pinia._a = app;
|
app.provide(piniaSymbol, pinia);
|
app.config.globalProperties.$pinia = pinia;
|
if (USE_DEVTOOLS) {
|
registerPiniaDevtools(app, pinia);
|
}
|
toBeInstalled.forEach((plugin) => _p.push(plugin));
|
toBeInstalled = [];
|
}
|
},
|
use(plugin) {
|
if (!this._a && !isVue2) {
|
toBeInstalled.push(plugin);
|
} else {
|
_p.push(plugin);
|
}
|
return this;
|
},
|
_p,
|
// it's actually undefined here
|
// @ts-expect-error
|
_a: null,
|
_e: scope,
|
_s: /* @__PURE__ */ new Map(),
|
state
|
});
|
if (USE_DEVTOOLS && typeof Proxy !== "undefined") {
|
pinia.use(devtoolsPlugin);
|
}
|
return pinia;
|
}
|
function patchObject(newState, oldState) {
|
for (const key in oldState) {
|
const subPatch = oldState[key];
|
if (!(key in newState)) {
|
continue;
|
}
|
const targetValue = newState[key];
|
if (isPlainObject$2(targetValue) && isPlainObject$2(subPatch) && !vue.isRef(subPatch) && !vue.isReactive(subPatch)) {
|
newState[key] = patchObject(targetValue, subPatch);
|
} else {
|
{
|
newState[key] = subPatch;
|
}
|
}
|
}
|
return newState;
|
}
|
const noop$1 = () => {
|
};
|
function addSubscription(subscriptions, callback, detached, onCleanup = noop$1) {
|
subscriptions.push(callback);
|
const removeSubscription = () => {
|
const idx = subscriptions.indexOf(callback);
|
if (idx > -1) {
|
subscriptions.splice(idx, 1);
|
onCleanup();
|
}
|
};
|
if (!detached && vue.getCurrentScope()) {
|
vue.onScopeDispose(removeSubscription);
|
}
|
return removeSubscription;
|
}
|
function triggerSubscriptions(subscriptions, ...args) {
|
subscriptions.slice().forEach((callback) => {
|
callback(...args);
|
});
|
}
|
const fallbackRunWithContext = (fn) => fn();
|
function mergeReactiveObjects(target, patchToApply) {
|
if (target instanceof Map && patchToApply instanceof Map) {
|
patchToApply.forEach((value, key) => target.set(key, value));
|
}
|
if (target instanceof Set && patchToApply instanceof Set) {
|
patchToApply.forEach(target.add, target);
|
}
|
for (const key in patchToApply) {
|
if (!patchToApply.hasOwnProperty(key))
|
continue;
|
const subPatch = patchToApply[key];
|
const targetValue = target[key];
|
if (isPlainObject$2(targetValue) && isPlainObject$2(subPatch) && target.hasOwnProperty(key) && !vue.isRef(subPatch) && !vue.isReactive(subPatch)) {
|
target[key] = mergeReactiveObjects(targetValue, subPatch);
|
} else {
|
target[key] = subPatch;
|
}
|
}
|
return target;
|
}
|
const skipHydrateSymbol = Symbol("pinia:skipHydration");
|
function shouldHydrate(obj) {
|
return !isPlainObject$2(obj) || !obj.hasOwnProperty(skipHydrateSymbol);
|
}
|
const { assign } = Object;
|
function isComputed(o2) {
|
return !!(vue.isRef(o2) && o2.effect);
|
}
|
function createOptionsStore(id, options, pinia, hot) {
|
const { state, actions, getters } = options;
|
const initialState = pinia.state.value[id];
|
let store;
|
function setup() {
|
if (!initialState && !hot) {
|
{
|
pinia.state.value[id] = state ? state() : {};
|
}
|
}
|
const localState = hot ? (
|
// use ref() to unwrap refs inside state TODO: check if this is still necessary
|
vue.toRefs(vue.ref(state ? state() : {}).value)
|
) : vue.toRefs(pinia.state.value[id]);
|
return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => {
|
if (name in localState) {
|
console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${name}" in store "${id}".`);
|
}
|
computedGetters[name] = vue.markRaw(vue.computed(() => {
|
setActivePinia(pinia);
|
const store2 = pinia._s.get(id);
|
return getters[name].call(store2, store2);
|
}));
|
return computedGetters;
|
}, {}));
|
}
|
store = createSetupStore(id, setup, options, pinia, hot, true);
|
return store;
|
}
|
function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {
|
let scope;
|
const optionsForPlugin = assign({ actions: {} }, options);
|
if (!pinia._e.active) {
|
throw new Error("Pinia destroyed");
|
}
|
const $subscribeOptions = {
|
deep: true
|
// flush: 'post',
|
};
|
{
|
$subscribeOptions.onTrigger = (event) => {
|
if (isListening) {
|
debuggerEvents = event;
|
} else if (isListening == false && !store._hotUpdating) {
|
if (Array.isArray(debuggerEvents)) {
|
debuggerEvents.push(event);
|
} else {
|
console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug.");
|
}
|
}
|
};
|
}
|
let isListening;
|
let isSyncListening;
|
let subscriptions = [];
|
let actionSubscriptions = [];
|
let debuggerEvents;
|
const initialState = pinia.state.value[$id];
|
if (!isOptionsStore && !initialState && !hot) {
|
{
|
pinia.state.value[$id] = {};
|
}
|
}
|
const hotState = vue.ref({});
|
let activeListener;
|
function $patch(partialStateOrMutator) {
|
let subscriptionMutation;
|
isListening = isSyncListening = false;
|
{
|
debuggerEvents = [];
|
}
|
if (typeof partialStateOrMutator === "function") {
|
partialStateOrMutator(pinia.state.value[$id]);
|
subscriptionMutation = {
|
type: MutationType.patchFunction,
|
storeId: $id,
|
events: debuggerEvents
|
};
|
} else {
|
mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);
|
subscriptionMutation = {
|
type: MutationType.patchObject,
|
payload: partialStateOrMutator,
|
storeId: $id,
|
events: debuggerEvents
|
};
|
}
|
const myListenerId = activeListener = Symbol();
|
vue.nextTick().then(() => {
|
if (activeListener === myListenerId) {
|
isListening = true;
|
}
|
});
|
isSyncListening = true;
|
triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);
|
}
|
const $reset = isOptionsStore ? function $reset2() {
|
const { state } = options;
|
const newState = state ? state() : {};
|
this.$patch(($state) => {
|
assign($state, newState);
|
});
|
} : (
|
/* istanbul ignore next */
|
() => {
|
throw new Error(`🍍: Store "${$id}" is built using the setup syntax and does not implement $reset().`);
|
}
|
);
|
function $dispose() {
|
scope.stop();
|
subscriptions = [];
|
actionSubscriptions = [];
|
pinia._s.delete($id);
|
}
|
function wrapAction(name, action) {
|
return function() {
|
setActivePinia(pinia);
|
const args = Array.from(arguments);
|
const afterCallbackList = [];
|
const onErrorCallbackList = [];
|
function after(callback) {
|
afterCallbackList.push(callback);
|
}
|
function onError(callback) {
|
onErrorCallbackList.push(callback);
|
}
|
triggerSubscriptions(actionSubscriptions, {
|
args,
|
name,
|
store,
|
after,
|
onError
|
});
|
let ret;
|
try {
|
ret = action.apply(this && this.$id === $id ? this : store, args);
|
} catch (error) {
|
triggerSubscriptions(onErrorCallbackList, error);
|
throw error;
|
}
|
if (ret instanceof Promise) {
|
return ret.then((value) => {
|
triggerSubscriptions(afterCallbackList, value);
|
return value;
|
}).catch((error) => {
|
triggerSubscriptions(onErrorCallbackList, error);
|
return Promise.reject(error);
|
});
|
}
|
triggerSubscriptions(afterCallbackList, ret);
|
return ret;
|
};
|
}
|
const _hmrPayload = /* @__PURE__ */ vue.markRaw({
|
actions: {},
|
getters: {},
|
state: [],
|
hotState
|
});
|
const partialStore = {
|
_p: pinia,
|
// _s: scope,
|
$id,
|
$onAction: addSubscription.bind(null, actionSubscriptions),
|
$patch,
|
$reset,
|
$subscribe(callback, options2 = {}) {
|
const removeSubscription = addSubscription(subscriptions, callback, options2.detached, () => stopWatcher());
|
const stopWatcher = scope.run(() => vue.watch(() => pinia.state.value[$id], (state) => {
|
if (options2.flush === "sync" ? isSyncListening : isListening) {
|
callback({
|
storeId: $id,
|
type: MutationType.direct,
|
events: debuggerEvents
|
}, state);
|
}
|
}, assign({}, $subscribeOptions, options2)));
|
return removeSubscription;
|
},
|
$dispose
|
};
|
const store = vue.reactive(assign(
|
{
|
_hmrPayload,
|
_customProperties: vue.markRaw(/* @__PURE__ */ new Set())
|
// devtools custom properties
|
},
|
partialStore
|
// must be added later
|
// setupStore
|
));
|
pinia._s.set($id, store);
|
const runWithContext = pinia._a && pinia._a.runWithContext || fallbackRunWithContext;
|
const setupStore = runWithContext(() => pinia._e.run(() => (scope = vue.effectScope()).run(setup)));
|
for (const key in setupStore) {
|
const prop = setupStore[key];
|
if (vue.isRef(prop) && !isComputed(prop) || vue.isReactive(prop)) {
|
if (hot) {
|
set(hotState.value, key, vue.toRef(setupStore, key));
|
} else if (!isOptionsStore) {
|
if (initialState && shouldHydrate(prop)) {
|
if (vue.isRef(prop)) {
|
prop.value = initialState[key];
|
} else {
|
mergeReactiveObjects(prop, initialState[key]);
|
}
|
}
|
{
|
pinia.state.value[$id][key] = prop;
|
}
|
}
|
{
|
_hmrPayload.state.push(key);
|
}
|
} else if (typeof prop === "function") {
|
const actionValue = hot ? prop : wrapAction(key, prop);
|
{
|
setupStore[key] = actionValue;
|
}
|
{
|
_hmrPayload.actions[key] = prop;
|
}
|
optionsForPlugin.actions[key] = prop;
|
} else {
|
if (isComputed(prop)) {
|
_hmrPayload.getters[key] = isOptionsStore ? (
|
// @ts-expect-error
|
options.getters[key]
|
) : prop;
|
if (IS_CLIENT) {
|
const getters = setupStore._getters || // @ts-expect-error: same
|
(setupStore._getters = vue.markRaw([]));
|
getters.push(key);
|
}
|
}
|
}
|
}
|
{
|
assign(store, setupStore);
|
assign(vue.toRaw(store), setupStore);
|
}
|
Object.defineProperty(store, "$state", {
|
get: () => hot ? hotState.value : pinia.state.value[$id],
|
set: (state) => {
|
if (hot) {
|
throw new Error("cannot set hotState");
|
}
|
$patch(($state) => {
|
assign($state, state);
|
});
|
}
|
});
|
{
|
store._hotUpdate = vue.markRaw((newStore) => {
|
store._hotUpdating = true;
|
newStore._hmrPayload.state.forEach((stateKey) => {
|
if (stateKey in store.$state) {
|
const newStateTarget = newStore.$state[stateKey];
|
const oldStateSource = store.$state[stateKey];
|
if (typeof newStateTarget === "object" && isPlainObject$2(newStateTarget) && isPlainObject$2(oldStateSource)) {
|
patchObject(newStateTarget, oldStateSource);
|
} else {
|
newStore.$state[stateKey] = oldStateSource;
|
}
|
}
|
set(store, stateKey, vue.toRef(newStore.$state, stateKey));
|
});
|
Object.keys(store.$state).forEach((stateKey) => {
|
if (!(stateKey in newStore.$state)) {
|
del(store, stateKey);
|
}
|
});
|
isListening = false;
|
isSyncListening = false;
|
pinia.state.value[$id] = vue.toRef(newStore._hmrPayload, "hotState");
|
isSyncListening = true;
|
vue.nextTick().then(() => {
|
isListening = true;
|
});
|
for (const actionName in newStore._hmrPayload.actions) {
|
const action = newStore[actionName];
|
set(store, actionName, wrapAction(actionName, action));
|
}
|
for (const getterName in newStore._hmrPayload.getters) {
|
const getter = newStore._hmrPayload.getters[getterName];
|
const getterValue = isOptionsStore ? (
|
// special handling of options api
|
vue.computed(() => {
|
setActivePinia(pinia);
|
return getter.call(store, store);
|
})
|
) : getter;
|
set(store, getterName, getterValue);
|
}
|
Object.keys(store._hmrPayload.getters).forEach((key) => {
|
if (!(key in newStore._hmrPayload.getters)) {
|
del(store, key);
|
}
|
});
|
Object.keys(store._hmrPayload.actions).forEach((key) => {
|
if (!(key in newStore._hmrPayload.actions)) {
|
del(store, key);
|
}
|
});
|
store._hmrPayload = newStore._hmrPayload;
|
store._getters = newStore._getters;
|
store._hotUpdating = false;
|
});
|
}
|
if (USE_DEVTOOLS) {
|
const nonEnumerable = {
|
writable: true,
|
configurable: true,
|
// avoid warning on devtools trying to display this property
|
enumerable: false
|
};
|
["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((p2) => {
|
Object.defineProperty(store, p2, assign({ value: store[p2] }, nonEnumerable));
|
});
|
}
|
pinia._p.forEach((extender) => {
|
if (USE_DEVTOOLS) {
|
const extensions = scope.run(() => extender({
|
store,
|
app: pinia._a,
|
pinia,
|
options: optionsForPlugin
|
}));
|
Object.keys(extensions || {}).forEach((key) => store._customProperties.add(key));
|
assign(store, extensions);
|
} else {
|
assign(store, scope.run(() => extender({
|
store,
|
app: pinia._a,
|
pinia,
|
options: optionsForPlugin
|
})));
|
}
|
});
|
if (store.$state && typeof store.$state === "object" && typeof store.$state.constructor === "function" && !store.$state.constructor.toString().includes("[native code]")) {
|
console.warn(`[🍍]: The "state" must be a plain object. It cannot be
|
state: () => new MyClass()
|
Found in store "${store.$id}".`);
|
}
|
if (initialState && isOptionsStore && options.hydrate) {
|
options.hydrate(store.$state, initialState);
|
}
|
isListening = true;
|
isSyncListening = true;
|
return store;
|
}
|
function defineStore(idOrOptions, setup, setupOptions) {
|
let id;
|
let options;
|
const isSetupStore = typeof setup === "function";
|
if (typeof idOrOptions === "string") {
|
id = idOrOptions;
|
options = isSetupStore ? setupOptions : setup;
|
} else {
|
options = idOrOptions;
|
id = idOrOptions.id;
|
if (typeof id !== "string") {
|
throw new Error(`[🍍]: "defineStore()" must be passed a store id as its first argument.`);
|
}
|
}
|
function useStore(pinia, hot) {
|
const hasContext = vue.hasInjectionContext();
|
pinia = // in test mode, ignore the argument provided as we can always retrieve a
|
// pinia instance with getActivePinia()
|
pinia || (hasContext ? vue.inject(piniaSymbol, null) : null);
|
if (pinia)
|
setActivePinia(pinia);
|
if (!activePinia) {
|
throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"?
|
See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.
|
This will fail in production.`);
|
}
|
pinia = activePinia;
|
if (!pinia._s.has(id)) {
|
if (isSetupStore) {
|
createSetupStore(id, setup, options, pinia);
|
} else {
|
createOptionsStore(id, options, pinia);
|
}
|
{
|
useStore._pinia = pinia;
|
}
|
}
|
const store = pinia._s.get(id);
|
if (hot) {
|
const hotId = "__hot:" + id;
|
const newStore = isSetupStore ? createSetupStore(hotId, setup, options, pinia, true) : createOptionsStore(hotId, assign({}, options), pinia, true);
|
hot._hotUpdate(newStore);
|
delete pinia.state.value[hotId];
|
pinia._s.delete(hotId);
|
}
|
if (IS_CLIENT) {
|
const currentInstance = vue.getCurrentInstance();
|
if (currentInstance && currentInstance.proxy && // avoid adding stores that are just built for hot module replacement
|
!hot) {
|
const vm = currentInstance.proxy;
|
const cache = "_pStores" in vm ? vm._pStores : vm._pStores = {};
|
cache[id] = store;
|
}
|
}
|
return store;
|
}
|
useStore.$id = id;
|
return useStore;
|
}
|
const userInfo = defineStore("userInfo", {
|
state: () => ({
|
user: vue.ref({
|
userName: null,
|
userId: null,
|
address: null,
|
class: "早班",
|
permissions: []
|
}),
|
deviceList: [],
|
choiceDevice: { value: null, text: null },
|
responseCode: null,
|
msg: null,
|
version: "1.0.6"
|
}),
|
actions: {
|
createWebSocket() {
|
createWebSocket(global_callback1);
|
},
|
setResponseCode(cede, msg) {
|
this.responseCode = cede;
|
this.msg = msg;
|
},
|
cleanInfo() {
|
this.deviceList = [];
|
this.choiceDevice = { value: null, text: null };
|
}
|
},
|
persist: true
|
//数据持久化,防止刷新数据消失
|
});
|
function bind$2(fn, thisArg) {
|
return function wrap() {
|
return fn.apply(thisArg, arguments);
|
};
|
}
|
const { toString: toString$1 } = Object.prototype;
|
const { getPrototypeOf } = Object;
|
const kindOf$1 = /* @__PURE__ */ ((cache) => (thing) => {
|
const str = toString$1.call(thing);
|
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
})(/* @__PURE__ */ Object.create(null));
|
const kindOfTest$1 = (type) => {
|
type = type.toLowerCase();
|
return (thing) => kindOf$1(thing) === type;
|
};
|
const typeOfTest = (type) => (thing) => typeof thing === type;
|
const { isArray: isArray$1 } = Array;
|
const isUndefined$1 = typeOfTest("undefined");
|
function isBuffer$1(val) {
|
return val !== null && !isUndefined$1(val) && val.constructor !== null && !isUndefined$1(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
}
|
const isArrayBuffer$1 = kindOfTest$1("ArrayBuffer");
|
function isArrayBufferView$1(val) {
|
let result;
|
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
result = ArrayBuffer.isView(val);
|
} else {
|
result = val && val.buffer && isArrayBuffer$1(val.buffer);
|
}
|
return result;
|
}
|
const isString$1 = typeOfTest("string");
|
const isFunction$1 = typeOfTest("function");
|
const isNumber$1 = typeOfTest("number");
|
const isObject$2 = (thing) => thing !== null && typeof thing === "object";
|
const isBoolean = (thing) => thing === true || thing === false;
|
const isPlainObject$1 = (val) => {
|
if (kindOf$1(val) !== "object") {
|
return false;
|
}
|
const prototype2 = getPrototypeOf(val);
|
return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
|
};
|
const isDate$1 = kindOfTest$1("Date");
|
const isFile$1 = kindOfTest$1("File");
|
const isBlob$1 = kindOfTest$1("Blob");
|
const isFileList$1 = kindOfTest$1("FileList");
|
const isStream$1 = (val) => isObject$2(val) && isFunction$1(val.pipe);
|
const isFormData$1 = (thing) => {
|
let kind;
|
return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf$1(thing)) === "formdata" || // detect form-data instance
|
kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
|
};
|
const isURLSearchParams$1 = kindOfTest$1("URLSearchParams");
|
const trim$1 = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
function forEach$1(obj, fn, { allOwnKeys = false } = {}) {
|
if (obj === null || typeof obj === "undefined") {
|
return;
|
}
|
let i2;
|
let l2;
|
if (typeof obj !== "object") {
|
obj = [obj];
|
}
|
if (isArray$1(obj)) {
|
for (i2 = 0, l2 = obj.length; i2 < l2; i2++) {
|
fn.call(null, obj[i2], i2, obj);
|
}
|
} else {
|
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
const len = keys.length;
|
let key;
|
for (i2 = 0; i2 < len; i2++) {
|
key = keys[i2];
|
fn.call(null, obj[key], key, obj);
|
}
|
}
|
}
|
function findKey(obj, key) {
|
key = key.toLowerCase();
|
const keys = Object.keys(obj);
|
let i2 = keys.length;
|
let _key;
|
while (i2-- > 0) {
|
_key = keys[i2];
|
if (key === _key.toLowerCase()) {
|
return _key;
|
}
|
}
|
return null;
|
}
|
const _global = (() => {
|
if (typeof globalThis !== "undefined")
|
return globalThis;
|
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
|
})();
|
const isContextDefined = (context) => !isUndefined$1(context) && context !== _global;
|
function merge$1() {
|
const { caseless } = isContextDefined(this) && this || {};
|
const result = {};
|
const assignValue = (val, key) => {
|
const targetKey = caseless && findKey(result, key) || key;
|
if (isPlainObject$1(result[targetKey]) && isPlainObject$1(val)) {
|
result[targetKey] = merge$1(result[targetKey], val);
|
} else if (isPlainObject$1(val)) {
|
result[targetKey] = merge$1({}, val);
|
} else if (isArray$1(val)) {
|
result[targetKey] = val.slice();
|
} else {
|
result[targetKey] = val;
|
}
|
};
|
for (let i2 = 0, l2 = arguments.length; i2 < l2; i2++) {
|
arguments[i2] && forEach$1(arguments[i2], assignValue);
|
}
|
return result;
|
}
|
const extend$1 = (a2, b2, thisArg, { allOwnKeys } = {}) => {
|
forEach$1(b2, (val, key) => {
|
if (thisArg && isFunction$1(val)) {
|
a2[key] = bind$2(val, thisArg);
|
} else {
|
a2[key] = val;
|
}
|
}, { allOwnKeys });
|
return a2;
|
};
|
const stripBOM$1 = (content) => {
|
if (content.charCodeAt(0) === 65279) {
|
content = content.slice(1);
|
}
|
return content;
|
};
|
const inherits$1 = (constructor, superConstructor, props, descriptors2) => {
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
|
constructor.prototype.constructor = constructor;
|
Object.defineProperty(constructor, "super", {
|
value: superConstructor.prototype
|
});
|
props && Object.assign(constructor.prototype, props);
|
};
|
const toFlatObject$1 = (sourceObj, destObj, filter, propFilter) => {
|
let props;
|
let i2;
|
let prop;
|
const merged = {};
|
destObj = destObj || {};
|
if (sourceObj == null)
|
return destObj;
|
do {
|
props = Object.getOwnPropertyNames(sourceObj);
|
i2 = props.length;
|
while (i2-- > 0) {
|
prop = props[i2];
|
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
destObj[prop] = sourceObj[prop];
|
merged[prop] = true;
|
}
|
}
|
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
return destObj;
|
};
|
const endsWith$1 = (str, searchString, position) => {
|
str = String(str);
|
if (position === void 0 || position > str.length) {
|
position = str.length;
|
}
|
position -= searchString.length;
|
const lastIndex = str.indexOf(searchString, position);
|
return lastIndex !== -1 && lastIndex === position;
|
};
|
const toArray$1 = (thing) => {
|
if (!thing)
|
return null;
|
if (isArray$1(thing))
|
return thing;
|
let i2 = thing.length;
|
if (!isNumber$1(i2))
|
return null;
|
const arr = new Array(i2);
|
while (i2-- > 0) {
|
arr[i2] = thing[i2];
|
}
|
return arr;
|
};
|
const isTypedArray$1 = /* @__PURE__ */ ((TypedArray) => {
|
return (thing) => {
|
return TypedArray && thing instanceof TypedArray;
|
};
|
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
const forEachEntry = (obj, fn) => {
|
const generator = obj && obj[Symbol.iterator];
|
const iterator = generator.call(obj);
|
let result;
|
while ((result = iterator.next()) && !result.done) {
|
const pair = result.value;
|
fn.call(obj, pair[0], pair[1]);
|
}
|
};
|
const matchAll = (regExp, str) => {
|
let matches;
|
const arr = [];
|
while ((matches = regExp.exec(str)) !== null) {
|
arr.push(matches);
|
}
|
return arr;
|
};
|
const isHTMLForm = kindOfTest$1("HTMLFormElement");
|
const toCamelCase = (str) => {
|
return str.toLowerCase().replace(
|
/[-_\s]([a-z\d])(\w*)/g,
|
function replacer(m2, p1, p2) {
|
return p1.toUpperCase() + p2;
|
}
|
);
|
};
|
const hasOwnProperty$1 = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
|
const isRegExp = kindOfTest$1("RegExp");
|
const reduceDescriptors = (obj, reducer) => {
|
const descriptors2 = Object.getOwnPropertyDescriptors(obj);
|
const reducedDescriptors = {};
|
forEach$1(descriptors2, (descriptor, name) => {
|
let ret;
|
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
reducedDescriptors[name] = ret || descriptor;
|
}
|
});
|
Object.defineProperties(obj, reducedDescriptors);
|
};
|
const freezeMethods = (obj) => {
|
reduceDescriptors(obj, (descriptor, name) => {
|
if (isFunction$1(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
|
return false;
|
}
|
const value = obj[name];
|
if (!isFunction$1(value))
|
return;
|
descriptor.enumerable = false;
|
if ("writable" in descriptor) {
|
descriptor.writable = false;
|
return;
|
}
|
if (!descriptor.set) {
|
descriptor.set = () => {
|
throw Error("Can not rewrite read-only method '" + name + "'");
|
};
|
}
|
});
|
};
|
const toObjectSet = (arrayOrString, delimiter) => {
|
const obj = {};
|
const define = (arr) => {
|
arr.forEach((value) => {
|
obj[value] = true;
|
});
|
};
|
isArray$1(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
return obj;
|
};
|
const noop = () => {
|
};
|
const toFiniteNumber = (value, defaultValue) => {
|
value = +value;
|
return Number.isFinite(value) ? value : defaultValue;
|
};
|
const ALPHA = "abcdefghijklmnopqrstuvwxyz";
|
const DIGIT = "0123456789";
|
const ALPHABET = {
|
DIGIT,
|
ALPHA,
|
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
};
|
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
let str = "";
|
const { length } = alphabet;
|
while (size--) {
|
str += alphabet[Math.random() * length | 0];
|
}
|
return str;
|
};
|
function isSpecCompliantForm(thing) {
|
return !!(thing && isFunction$1(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]);
|
}
|
const toJSONObject = (obj) => {
|
const stack = new Array(10);
|
const visit = (source, i2) => {
|
if (isObject$2(source)) {
|
if (stack.indexOf(source) >= 0) {
|
return;
|
}
|
if (!("toJSON" in source)) {
|
stack[i2] = source;
|
const target = isArray$1(source) ? [] : {};
|
forEach$1(source, (value, key) => {
|
const reducedValue = visit(value, i2 + 1);
|
!isUndefined$1(reducedValue) && (target[key] = reducedValue);
|
});
|
stack[i2] = void 0;
|
return target;
|
}
|
}
|
return source;
|
};
|
return visit(obj, 0);
|
};
|
const isAsyncFn = kindOfTest$1("AsyncFunction");
|
const isThenable = (thing) => thing && (isObject$2(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
const utils$3 = {
|
isArray: isArray$1,
|
isArrayBuffer: isArrayBuffer$1,
|
isBuffer: isBuffer$1,
|
isFormData: isFormData$1,
|
isArrayBufferView: isArrayBufferView$1,
|
isString: isString$1,
|
isNumber: isNumber$1,
|
isBoolean,
|
isObject: isObject$2,
|
isPlainObject: isPlainObject$1,
|
isUndefined: isUndefined$1,
|
isDate: isDate$1,
|
isFile: isFile$1,
|
isBlob: isBlob$1,
|
isRegExp,
|
isFunction: isFunction$1,
|
isStream: isStream$1,
|
isURLSearchParams: isURLSearchParams$1,
|
isTypedArray: isTypedArray$1,
|
isFileList: isFileList$1,
|
forEach: forEach$1,
|
merge: merge$1,
|
extend: extend$1,
|
trim: trim$1,
|
stripBOM: stripBOM$1,
|
inherits: inherits$1,
|
toFlatObject: toFlatObject$1,
|
kindOf: kindOf$1,
|
kindOfTest: kindOfTest$1,
|
endsWith: endsWith$1,
|
toArray: toArray$1,
|
forEachEntry,
|
matchAll,
|
isHTMLForm,
|
hasOwnProperty: hasOwnProperty$1,
|
hasOwnProp: hasOwnProperty$1,
|
// an alias to avoid ESLint no-prototype-builtins detection
|
reduceDescriptors,
|
freezeMethods,
|
toObjectSet,
|
toCamelCase,
|
noop,
|
toFiniteNumber,
|
findKey,
|
global: _global,
|
isContextDefined,
|
ALPHABET,
|
generateString,
|
isSpecCompliantForm,
|
toJSONObject,
|
isAsyncFn,
|
isThenable
|
};
|
function AxiosError$2(message, code, config, request2, response) {
|
Error.call(this);
|
if (Error.captureStackTrace) {
|
Error.captureStackTrace(this, this.constructor);
|
} else {
|
this.stack = new Error().stack;
|
}
|
this.message = message;
|
this.name = "AxiosError";
|
code && (this.code = code);
|
config && (this.config = config);
|
request2 && (this.request = request2);
|
response && (this.response = response);
|
}
|
utils$3.inherits(AxiosError$2, Error, {
|
toJSON: function toJSON() {
|
return {
|
// Standard
|
message: this.message,
|
name: this.name,
|
// Microsoft
|
description: this.description,
|
number: this.number,
|
// Mozilla
|
fileName: this.fileName,
|
lineNumber: this.lineNumber,
|
columnNumber: this.columnNumber,
|
stack: this.stack,
|
// Axios
|
config: utils$3.toJSONObject(this.config),
|
code: this.code,
|
status: this.response && this.response.status ? this.response.status : null
|
};
|
}
|
});
|
const prototype$2 = AxiosError$2.prototype;
|
const descriptors$1 = {};
|
[
|
"ERR_BAD_OPTION_VALUE",
|
"ERR_BAD_OPTION",
|
"ECONNABORTED",
|
"ETIMEDOUT",
|
"ERR_NETWORK",
|
"ERR_FR_TOO_MANY_REDIRECTS",
|
"ERR_DEPRECATED",
|
"ERR_BAD_RESPONSE",
|
"ERR_BAD_REQUEST",
|
"ERR_CANCELED",
|
"ERR_NOT_SUPPORT",
|
"ERR_INVALID_URL"
|
// eslint-disable-next-line func-names
|
].forEach((code) => {
|
descriptors$1[code] = { value: code };
|
});
|
Object.defineProperties(AxiosError$2, descriptors$1);
|
Object.defineProperty(prototype$2, "isAxiosError", { value: true });
|
AxiosError$2.from = (error, code, config, request2, response, customProps) => {
|
const axiosError = Object.create(prototype$2);
|
utils$3.toFlatObject(error, axiosError, function filter(obj) {
|
return obj !== Error.prototype;
|
}, (prop) => {
|
return prop !== "isAxiosError";
|
});
|
AxiosError$2.call(axiosError, error.message, code, config, request2, response);
|
axiosError.cause = error;
|
axiosError.name = error.name;
|
customProps && Object.assign(axiosError, customProps);
|
return axiosError;
|
};
|
const httpAdapter = null;
|
function isVisitable(thing) {
|
return utils$3.isPlainObject(thing) || utils$3.isArray(thing);
|
}
|
function removeBrackets(key) {
|
return utils$3.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
}
|
function renderKey(path, key, dots) {
|
if (!path)
|
return key;
|
return path.concat(key).map(function each(token, i2) {
|
token = removeBrackets(token);
|
return !dots && i2 ? "[" + token + "]" : token;
|
}).join(dots ? "." : "");
|
}
|
function isFlatArray(arr) {
|
return utils$3.isArray(arr) && !arr.some(isVisitable);
|
}
|
const predicates = utils$3.toFlatObject(utils$3, {}, null, function filter(prop) {
|
return /^is[A-Z]/.test(prop);
|
});
|
function toFormData(obj, formData, options) {
|
if (!utils$3.isObject(obj)) {
|
throw new TypeError("target must be an object");
|
}
|
formData = formData || new FormData();
|
options = utils$3.toFlatObject(options, {
|
metaTokens: true,
|
dots: false,
|
indexes: false
|
}, false, function defined(option, source) {
|
return !utils$3.isUndefined(source[option]);
|
});
|
const metaTokens = options.metaTokens;
|
const visitor = options.visitor || defaultVisitor;
|
const dots = options.dots;
|
const indexes = options.indexes;
|
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
|
const useBlob = _Blob && utils$3.isSpecCompliantForm(formData);
|
if (!utils$3.isFunction(visitor)) {
|
throw new TypeError("visitor must be a function");
|
}
|
function convertValue(value) {
|
if (value === null)
|
return "";
|
if (utils$3.isDate(value)) {
|
return value.toISOString();
|
}
|
if (!useBlob && utils$3.isBlob(value)) {
|
throw new AxiosError$2("Blob is not supported. Use a Buffer instead.");
|
}
|
if (utils$3.isArrayBuffer(value) || utils$3.isTypedArray(value)) {
|
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
|
}
|
return value;
|
}
|
function defaultVisitor(value, key, path) {
|
let arr = value;
|
if (value && !path && typeof value === "object") {
|
if (utils$3.endsWith(key, "{}")) {
|
key = metaTokens ? key : key.slice(0, -2);
|
value = JSON.stringify(value);
|
} else if (utils$3.isArray(value) && isFlatArray(value) || (utils$3.isFileList(value) || utils$3.endsWith(key, "[]")) && (arr = utils$3.toArray(value))) {
|
key = removeBrackets(key);
|
arr.forEach(function each(el, index) {
|
!(utils$3.isUndefined(el) || el === null) && formData.append(
|
// eslint-disable-next-line no-nested-ternary
|
indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
|
convertValue(el)
|
);
|
});
|
return false;
|
}
|
}
|
if (isVisitable(value)) {
|
return true;
|
}
|
formData.append(renderKey(path, key, dots), convertValue(value));
|
return false;
|
}
|
const stack = [];
|
const exposedHelpers = Object.assign(predicates, {
|
defaultVisitor,
|
convertValue,
|
isVisitable
|
});
|
function build(value, path) {
|
if (utils$3.isUndefined(value))
|
return;
|
if (stack.indexOf(value) !== -1) {
|
throw Error("Circular reference detected in " + path.join("."));
|
}
|
stack.push(value);
|
utils$3.forEach(value, function each(el, key) {
|
const result = !(utils$3.isUndefined(el) || el === null) && visitor.call(
|
formData,
|
el,
|
utils$3.isString(key) ? key.trim() : key,
|
path,
|
exposedHelpers
|
);
|
if (result === true) {
|
build(el, path ? path.concat(key) : [key]);
|
}
|
});
|
stack.pop();
|
}
|
if (!utils$3.isObject(obj)) {
|
throw new TypeError("data must be an object");
|
}
|
build(obj);
|
return formData;
|
}
|
function encode$2(str) {
|
const charMap = {
|
"!": "%21",
|
"'": "%27",
|
"(": "%28",
|
")": "%29",
|
"~": "%7E",
|
"%20": "+",
|
"%00": "\0"
|
};
|
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
return charMap[match];
|
});
|
}
|
function AxiosURLSearchParams(params, options) {
|
this._pairs = [];
|
params && toFormData(params, this, options);
|
}
|
const prototype$1 = AxiosURLSearchParams.prototype;
|
prototype$1.append = function append(name, value) {
|
this._pairs.push([name, value]);
|
};
|
prototype$1.toString = function toString2(encoder) {
|
const _encode = encoder ? function(value) {
|
return encoder.call(this, value, encode$2);
|
} : encode$2;
|
return this._pairs.map(function each(pair) {
|
return _encode(pair[0]) + "=" + _encode(pair[1]);
|
}, "").join("&");
|
};
|
function encode$1(val) {
|
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
}
|
function buildURL$2(url, params, options) {
|
if (!params) {
|
return url;
|
}
|
const _encode = options && options.encode || encode$1;
|
const serializeFn = options && options.serialize;
|
let serializedParams;
|
if (serializeFn) {
|
serializedParams = serializeFn(params, options);
|
} else {
|
serializedParams = utils$3.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
|
}
|
if (serializedParams) {
|
const hashmarkIndex = url.indexOf("#");
|
if (hashmarkIndex !== -1) {
|
url = url.slice(0, hashmarkIndex);
|
}
|
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
}
|
return url;
|
}
|
class InterceptorManager {
|
constructor() {
|
this.handlers = [];
|
}
|
/**
|
* Add a new interceptor to the stack
|
*
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
*
|
* @return {Number} An ID used to remove interceptor later
|
*/
|
use(fulfilled, rejected, options) {
|
this.handlers.push({
|
fulfilled,
|
rejected,
|
synchronous: options ? options.synchronous : false,
|
runWhen: options ? options.runWhen : null
|
});
|
return this.handlers.length - 1;
|
}
|
/**
|
* Remove an interceptor from the stack
|
*
|
* @param {Number} id The ID that was returned by `use`
|
*
|
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
*/
|
eject(id) {
|
if (this.handlers[id]) {
|
this.handlers[id] = null;
|
}
|
}
|
/**
|
* Clear all interceptors from the stack
|
*
|
* @returns {void}
|
*/
|
clear() {
|
if (this.handlers) {
|
this.handlers = [];
|
}
|
}
|
/**
|
* Iterate over all the registered interceptors
|
*
|
* This method is particularly useful for skipping over any
|
* interceptors that may have become `null` calling `eject`.
|
*
|
* @param {Function} fn The function to call for each interceptor
|
*
|
* @returns {void}
|
*/
|
forEach(fn) {
|
utils$3.forEach(this.handlers, function forEachHandler(h2) {
|
if (h2 !== null) {
|
fn(h2);
|
}
|
});
|
}
|
}
|
const transitionalDefaults = {
|
silentJSONParsing: true,
|
forcedJSONParsing: true,
|
clarifyTimeoutError: false
|
};
|
const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
|
const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
|
const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
|
const isStandardBrowserEnv$1 = (() => {
|
let product;
|
if (typeof navigator !== "undefined" && ((product = navigator.product) === "ReactNative" || product === "NativeScript" || product === "NS")) {
|
return false;
|
}
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
})();
|
const isStandardBrowserWebWorkerEnv = (() => {
|
return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
|
self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
|
})();
|
const platform = {
|
isBrowser: true,
|
classes: {
|
URLSearchParams: URLSearchParams$1,
|
FormData: FormData$1,
|
Blob: Blob$1
|
},
|
isStandardBrowserEnv: isStandardBrowserEnv$1,
|
isStandardBrowserWebWorkerEnv,
|
protocols: ["http", "https", "file", "blob", "url", "data"]
|
};
|
function toURLEncodedForm(data, options) {
|
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
visitor: function(value, key, path, helpers) {
|
if (platform.isNode && utils$3.isBuffer(value)) {
|
this.append(key, value.toString("base64"));
|
return false;
|
}
|
return helpers.defaultVisitor.apply(this, arguments);
|
}
|
}, options));
|
}
|
function parsePropPath(name) {
|
return utils$3.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
return match[0] === "[]" ? "" : match[1] || match[0];
|
});
|
}
|
function arrayToObject(arr) {
|
const obj = {};
|
const keys = Object.keys(arr);
|
let i2;
|
const len = keys.length;
|
let key;
|
for (i2 = 0; i2 < len; i2++) {
|
key = keys[i2];
|
obj[key] = arr[key];
|
}
|
return obj;
|
}
|
function formDataToJSON(formData) {
|
function buildPath(path, value, target, index) {
|
let name = path[index++];
|
const isNumericKey = Number.isFinite(+name);
|
const isLast = index >= path.length;
|
name = !name && utils$3.isArray(target) ? target.length : name;
|
if (isLast) {
|
if (utils$3.hasOwnProp(target, name)) {
|
target[name] = [target[name], value];
|
} else {
|
target[name] = value;
|
}
|
return !isNumericKey;
|
}
|
if (!target[name] || !utils$3.isObject(target[name])) {
|
target[name] = [];
|
}
|
const result = buildPath(path, value, target[name], index);
|
if (result && utils$3.isArray(target[name])) {
|
target[name] = arrayToObject(target[name]);
|
}
|
return !isNumericKey;
|
}
|
if (utils$3.isFormData(formData) && utils$3.isFunction(formData.entries)) {
|
const obj = {};
|
utils$3.forEachEntry(formData, (name, value) => {
|
buildPath(parsePropPath(name), value, obj, 0);
|
});
|
return obj;
|
}
|
return null;
|
}
|
function stringifySafely(rawValue, parser, encoder) {
|
if (utils$3.isString(rawValue)) {
|
try {
|
(parser || JSON.parse)(rawValue);
|
return utils$3.trim(rawValue);
|
} catch (e2) {
|
if (e2.name !== "SyntaxError") {
|
throw e2;
|
}
|
}
|
}
|
return (encoder || JSON.stringify)(rawValue);
|
}
|
const defaults = {
|
transitional: transitionalDefaults,
|
adapter: ["xhr", "http"],
|
transformRequest: [function transformRequest(data, headers) {
|
const contentType = headers.getContentType() || "";
|
const hasJSONContentType = contentType.indexOf("application/json") > -1;
|
const isObjectPayload = utils$3.isObject(data);
|
if (isObjectPayload && utils$3.isHTMLForm(data)) {
|
data = new FormData(data);
|
}
|
const isFormData2 = utils$3.isFormData(data);
|
if (isFormData2) {
|
if (!hasJSONContentType) {
|
return data;
|
}
|
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
}
|
if (utils$3.isArrayBuffer(data) || utils$3.isBuffer(data) || utils$3.isStream(data) || utils$3.isFile(data) || utils$3.isBlob(data)) {
|
return data;
|
}
|
if (utils$3.isArrayBufferView(data)) {
|
return data.buffer;
|
}
|
if (utils$3.isURLSearchParams(data)) {
|
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
return data.toString();
|
}
|
let isFileList2;
|
if (isObjectPayload) {
|
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
return toURLEncodedForm(data, this.formSerializer).toString();
|
}
|
if ((isFileList2 = utils$3.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
const _FormData = this.env && this.env.FormData;
|
return toFormData(
|
isFileList2 ? { "files[]": data } : data,
|
_FormData && new _FormData(),
|
this.formSerializer
|
);
|
}
|
}
|
if (isObjectPayload || hasJSONContentType) {
|
headers.setContentType("application/json", false);
|
return stringifySafely(data);
|
}
|
return data;
|
}],
|
transformResponse: [function transformResponse(data) {
|
const transitional = this.transitional || defaults.transitional;
|
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
const JSONRequested = this.responseType === "json";
|
if (data && utils$3.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
try {
|
return JSON.parse(data);
|
} catch (e2) {
|
if (strictJSONParsing) {
|
if (e2.name === "SyntaxError") {
|
throw AxiosError$2.from(e2, AxiosError$2.ERR_BAD_RESPONSE, this, null, this.response);
|
}
|
throw e2;
|
}
|
}
|
}
|
return data;
|
}],
|
/**
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
* timeout is not created.
|
*/
|
timeout: 0,
|
xsrfCookieName: "XSRF-TOKEN",
|
xsrfHeaderName: "X-XSRF-TOKEN",
|
maxContentLength: -1,
|
maxBodyLength: -1,
|
env: {
|
FormData: platform.classes.FormData,
|
Blob: platform.classes.Blob
|
},
|
validateStatus: function validateStatus(status) {
|
return status >= 200 && status < 300;
|
},
|
headers: {
|
common: {
|
"Accept": "application/json, text/plain, */*",
|
"Content-Type": void 0
|
}
|
}
|
};
|
utils$3.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
|
defaults.headers[method] = {};
|
});
|
const defaults$1 = defaults;
|
const ignoreDuplicateOf = utils$3.toObjectSet([
|
"age",
|
"authorization",
|
"content-length",
|
"content-type",
|
"etag",
|
"expires",
|
"from",
|
"host",
|
"if-modified-since",
|
"if-unmodified-since",
|
"last-modified",
|
"location",
|
"max-forwards",
|
"proxy-authorization",
|
"referer",
|
"retry-after",
|
"user-agent"
|
]);
|
const parseHeaders = (rawHeaders) => {
|
const parsed = {};
|
let key;
|
let val;
|
let i2;
|
rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
|
i2 = line.indexOf(":");
|
key = line.substring(0, i2).trim().toLowerCase();
|
val = line.substring(i2 + 1).trim();
|
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
return;
|
}
|
if (key === "set-cookie") {
|
if (parsed[key]) {
|
parsed[key].push(val);
|
} else {
|
parsed[key] = [val];
|
}
|
} else {
|
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
}
|
});
|
return parsed;
|
};
|
const $internals = Symbol("internals");
|
function normalizeHeader(header) {
|
return header && String(header).trim().toLowerCase();
|
}
|
function normalizeValue(value) {
|
if (value === false || value == null) {
|
return value;
|
}
|
return utils$3.isArray(value) ? value.map(normalizeValue) : String(value);
|
}
|
function parseTokens(str) {
|
const tokens = /* @__PURE__ */ Object.create(null);
|
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
let match;
|
while (match = tokensRE.exec(str)) {
|
tokens[match[1]] = match[2];
|
}
|
return tokens;
|
}
|
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
if (utils$3.isFunction(filter)) {
|
return filter.call(this, value, header);
|
}
|
if (isHeaderNameFilter) {
|
value = header;
|
}
|
if (!utils$3.isString(value))
|
return;
|
if (utils$3.isString(filter)) {
|
return value.indexOf(filter) !== -1;
|
}
|
if (utils$3.isRegExp(filter)) {
|
return filter.test(value);
|
}
|
}
|
function formatHeader(header) {
|
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w2, char, str) => {
|
return char.toUpperCase() + str;
|
});
|
}
|
function buildAccessors(obj, header) {
|
const accessorName = utils$3.toCamelCase(" " + header);
|
["get", "set", "has"].forEach((methodName) => {
|
Object.defineProperty(obj, methodName + accessorName, {
|
value: function(arg1, arg2, arg3) {
|
return this[methodName].call(this, header, arg1, arg2, arg3);
|
},
|
configurable: true
|
});
|
});
|
}
|
class AxiosHeaders {
|
constructor(headers) {
|
headers && this.set(headers);
|
}
|
set(header, valueOrRewrite, rewrite) {
|
const self2 = this;
|
function setHeader(_value, _header, _rewrite) {
|
const lHeader = normalizeHeader(_header);
|
if (!lHeader) {
|
throw new Error("header name must be a non-empty string");
|
}
|
const key = utils$3.findKey(self2, lHeader);
|
if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
|
self2[key || _header] = normalizeValue(_value);
|
}
|
}
|
const setHeaders = (headers, _rewrite) => utils$3.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
if (utils$3.isPlainObject(header) || header instanceof this.constructor) {
|
setHeaders(header, valueOrRewrite);
|
} else if (utils$3.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
} else {
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
}
|
return this;
|
}
|
get(header, parser) {
|
header = normalizeHeader(header);
|
if (header) {
|
const key = utils$3.findKey(this, header);
|
if (key) {
|
const value = this[key];
|
if (!parser) {
|
return value;
|
}
|
if (parser === true) {
|
return parseTokens(value);
|
}
|
if (utils$3.isFunction(parser)) {
|
return parser.call(this, value, key);
|
}
|
if (utils$3.isRegExp(parser)) {
|
return parser.exec(value);
|
}
|
throw new TypeError("parser must be boolean|regexp|function");
|
}
|
}
|
}
|
has(header, matcher) {
|
header = normalizeHeader(header);
|
if (header) {
|
const key = utils$3.findKey(this, header);
|
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
}
|
return false;
|
}
|
delete(header, matcher) {
|
const self2 = this;
|
let deleted = false;
|
function deleteHeader(_header) {
|
_header = normalizeHeader(_header);
|
if (_header) {
|
const key = utils$3.findKey(self2, _header);
|
if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
|
delete self2[key];
|
deleted = true;
|
}
|
}
|
}
|
if (utils$3.isArray(header)) {
|
header.forEach(deleteHeader);
|
} else {
|
deleteHeader(header);
|
}
|
return deleted;
|
}
|
clear(matcher) {
|
const keys = Object.keys(this);
|
let i2 = keys.length;
|
let deleted = false;
|
while (i2--) {
|
const key = keys[i2];
|
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
delete this[key];
|
deleted = true;
|
}
|
}
|
return deleted;
|
}
|
normalize(format2) {
|
const self2 = this;
|
const headers = {};
|
utils$3.forEach(this, (value, header) => {
|
const key = utils$3.findKey(headers, header);
|
if (key) {
|
self2[key] = normalizeValue(value);
|
delete self2[header];
|
return;
|
}
|
const normalized = format2 ? formatHeader(header) : String(header).trim();
|
if (normalized !== header) {
|
delete self2[header];
|
}
|
self2[normalized] = normalizeValue(value);
|
headers[normalized] = true;
|
});
|
return this;
|
}
|
concat(...targets) {
|
return this.constructor.concat(this, ...targets);
|
}
|
toJSON(asStrings) {
|
const obj = /* @__PURE__ */ Object.create(null);
|
utils$3.forEach(this, (value, header) => {
|
value != null && value !== false && (obj[header] = asStrings && utils$3.isArray(value) ? value.join(", ") : value);
|
});
|
return obj;
|
}
|
[Symbol.iterator]() {
|
return Object.entries(this.toJSON())[Symbol.iterator]();
|
}
|
toString() {
|
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
|
}
|
get [Symbol.toStringTag]() {
|
return "AxiosHeaders";
|
}
|
static from(thing) {
|
return thing instanceof this ? thing : new this(thing);
|
}
|
static concat(first, ...targets) {
|
const computed = new this(first);
|
targets.forEach((target) => computed.set(target));
|
return computed;
|
}
|
static accessor(header) {
|
const internals = this[$internals] = this[$internals] = {
|
accessors: {}
|
};
|
const accessors = internals.accessors;
|
const prototype2 = this.prototype;
|
function defineAccessor(_header) {
|
const lHeader = normalizeHeader(_header);
|
if (!accessors[lHeader]) {
|
buildAccessors(prototype2, _header);
|
accessors[lHeader] = true;
|
}
|
}
|
utils$3.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
return this;
|
}
|
}
|
AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
utils$3.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
let mapped = key[0].toUpperCase() + key.slice(1);
|
return {
|
get: () => value,
|
set(headerValue) {
|
this[mapped] = headerValue;
|
}
|
};
|
});
|
utils$3.freezeMethods(AxiosHeaders);
|
const AxiosHeaders$1 = AxiosHeaders;
|
function transformData(fns, response) {
|
const config = this || defaults$1;
|
const context = response || config;
|
const headers = AxiosHeaders$1.from(context.headers);
|
let data = context.data;
|
utils$3.forEach(fns, function transform(fn) {
|
data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
|
});
|
headers.normalize();
|
return data;
|
}
|
function isCancel(value) {
|
return !!(value && value.__CANCEL__);
|
}
|
function CanceledError(message, config, request2) {
|
AxiosError$2.call(this, message == null ? "canceled" : message, AxiosError$2.ERR_CANCELED, config, request2);
|
this.name = "CanceledError";
|
}
|
utils$3.inherits(CanceledError, AxiosError$2, {
|
__CANCEL__: true
|
});
|
function settle$2(resolve, reject, response) {
|
const validateStatus = response.config.validateStatus;
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
resolve(response);
|
} else {
|
reject(new AxiosError$2(
|
"Request failed with status code " + response.status,
|
[AxiosError$2.ERR_BAD_REQUEST, AxiosError$2.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
response.config,
|
response.request,
|
response
|
));
|
}
|
}
|
const cookies = platform.isStandardBrowserEnv ? (
|
// Standard browser envs support document.cookie
|
/* @__PURE__ */ function standardBrowserEnv() {
|
return {
|
write: function write(name, value, expires, path, domain, secure) {
|
const cookie = [];
|
cookie.push(name + "=" + encodeURIComponent(value));
|
if (utils$3.isNumber(expires)) {
|
cookie.push("expires=" + new Date(expires).toGMTString());
|
}
|
if (utils$3.isString(path)) {
|
cookie.push("path=" + path);
|
}
|
if (utils$3.isString(domain)) {
|
cookie.push("domain=" + domain);
|
}
|
if (secure === true) {
|
cookie.push("secure");
|
}
|
document.cookie = cookie.join("; ");
|
},
|
read: function read(name) {
|
const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
|
return match ? decodeURIComponent(match[3]) : null;
|
},
|
remove: function remove(name) {
|
this.write(name, "", Date.now() - 864e5);
|
}
|
};
|
}()
|
) : (
|
// Non standard browser env (web workers, react-native) lack needed support.
|
/* @__PURE__ */ function nonStandardBrowserEnv() {
|
return {
|
write: function write() {
|
},
|
read: function read() {
|
return null;
|
},
|
remove: function remove() {
|
}
|
};
|
}()
|
);
|
function isAbsoluteURL$2(url) {
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
}
|
function combineURLs$2(baseURL, relativeURL) {
|
return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
}
|
function buildFullPath$2(baseURL, requestedURL) {
|
if (baseURL && !isAbsoluteURL$2(requestedURL)) {
|
return combineURLs$2(baseURL, requestedURL);
|
}
|
return requestedURL;
|
}
|
const isURLSameOrigin = platform.isStandardBrowserEnv ? (
|
// Standard browser envs have full support of the APIs needed to test
|
// whether the request URL is of the same origin as current location.
|
function standardBrowserEnv() {
|
const msie = /(msie|trident)/i.test(navigator.userAgent);
|
const urlParsingNode = document.createElement("a");
|
let originURL;
|
function resolveURL(url) {
|
let href = url;
|
if (msie) {
|
urlParsingNode.setAttribute("href", href);
|
href = urlParsingNode.href;
|
}
|
urlParsingNode.setAttribute("href", href);
|
return {
|
href: urlParsingNode.href,
|
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
|
host: urlParsingNode.host,
|
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
|
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
|
hostname: urlParsingNode.hostname,
|
port: urlParsingNode.port,
|
pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
|
};
|
}
|
originURL = resolveURL(window.location.href);
|
return function isURLSameOrigin2(requestURL) {
|
const parsed = utils$3.isString(requestURL) ? resolveURL(requestURL) : requestURL;
|
return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
|
};
|
}()
|
) : (
|
// Non standard browser envs (web workers, react-native) lack needed support.
|
/* @__PURE__ */ function nonStandardBrowserEnv() {
|
return function isURLSameOrigin2() {
|
return true;
|
};
|
}()
|
);
|
function parseProtocol(url) {
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
return match && match[1] || "";
|
}
|
function speedometer(samplesCount, min) {
|
samplesCount = samplesCount || 10;
|
const bytes = new Array(samplesCount);
|
const timestamps = new Array(samplesCount);
|
let head = 0;
|
let tail = 0;
|
let firstSampleTS;
|
min = min !== void 0 ? min : 1e3;
|
return function push(chunkLength) {
|
const now2 = Date.now();
|
const startedAt = timestamps[tail];
|
if (!firstSampleTS) {
|
firstSampleTS = now2;
|
}
|
bytes[head] = chunkLength;
|
timestamps[head] = now2;
|
let i2 = tail;
|
let bytesCount = 0;
|
while (i2 !== head) {
|
bytesCount += bytes[i2++];
|
i2 = i2 % samplesCount;
|
}
|
head = (head + 1) % samplesCount;
|
if (head === tail) {
|
tail = (tail + 1) % samplesCount;
|
}
|
if (now2 - firstSampleTS < min) {
|
return;
|
}
|
const passed = startedAt && now2 - startedAt;
|
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
};
|
}
|
function progressEventReducer(listener, isDownloadStream) {
|
let bytesNotified = 0;
|
const _speedometer = speedometer(50, 250);
|
return (e2) => {
|
const loaded = e2.loaded;
|
const total = e2.lengthComputable ? e2.total : void 0;
|
const progressBytes = loaded - bytesNotified;
|
const rate = _speedometer(progressBytes);
|
const inRange = loaded <= total;
|
bytesNotified = loaded;
|
const data = {
|
loaded,
|
total,
|
progress: total ? loaded / total : void 0,
|
bytes: progressBytes,
|
rate: rate ? rate : void 0,
|
estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
|
event: e2
|
};
|
data[isDownloadStream ? "download" : "upload"] = true;
|
listener(data);
|
};
|
}
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
|
const xhrAdapter = isXHRAdapterSupported && function(config) {
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
let requestData = config.data;
|
const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
|
const responseType = config.responseType;
|
let onCanceled;
|
function done() {
|
if (config.cancelToken) {
|
config.cancelToken.unsubscribe(onCanceled);
|
}
|
if (config.signal) {
|
config.signal.removeEventListener("abort", onCanceled);
|
}
|
}
|
let contentType;
|
if (utils$3.isFormData(requestData)) {
|
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
requestHeaders.setContentType(false);
|
} else if (!requestHeaders.getContentType(/^\s*multipart\/form-data/)) {
|
requestHeaders.setContentType("multipart/form-data");
|
} else if (utils$3.isString(contentType = requestHeaders.getContentType())) {
|
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, "$1"));
|
}
|
}
|
let request2 = new XMLHttpRequest();
|
if (config.auth) {
|
const username = config.auth.username || "";
|
const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : "";
|
requestHeaders.set("Authorization", "Basic " + btoa(username + ":" + password));
|
}
|
const fullPath = buildFullPath$2(config.baseURL, config.url);
|
request2.open(config.method.toUpperCase(), buildURL$2(fullPath, config.params, config.paramsSerializer), true);
|
request2.timeout = config.timeout;
|
function onloadend() {
|
if (!request2) {
|
return;
|
}
|
const responseHeaders = AxiosHeaders$1.from(
|
"getAllResponseHeaders" in request2 && request2.getAllResponseHeaders()
|
);
|
const responseData = !responseType || responseType === "text" || responseType === "json" ? request2.responseText : request2.response;
|
const response = {
|
data: responseData,
|
status: request2.status,
|
statusText: request2.statusText,
|
headers: responseHeaders,
|
config,
|
request: request2
|
};
|
settle$2(function _resolve(value) {
|
resolve(value);
|
done();
|
}, function _reject(err) {
|
reject(err);
|
done();
|
}, response);
|
request2 = null;
|
}
|
if ("onloadend" in request2) {
|
request2.onloadend = onloadend;
|
} else {
|
request2.onreadystatechange = function handleLoad() {
|
if (!request2 || request2.readyState !== 4) {
|
return;
|
}
|
if (request2.status === 0 && !(request2.responseURL && request2.responseURL.indexOf("file:") === 0)) {
|
return;
|
}
|
setTimeout(onloadend);
|
};
|
}
|
request2.onabort = function handleAbort() {
|
if (!request2) {
|
return;
|
}
|
reject(new AxiosError$2("Request aborted", AxiosError$2.ECONNABORTED, config, request2));
|
request2 = null;
|
};
|
request2.onerror = function handleError() {
|
reject(new AxiosError$2("Network Error", AxiosError$2.ERR_NETWORK, config, request2));
|
request2 = null;
|
};
|
request2.ontimeout = function handleTimeout() {
|
let timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded";
|
const transitional = config.transitional || transitionalDefaults;
|
if (config.timeoutErrorMessage) {
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
}
|
reject(new AxiosError$2(
|
timeoutErrorMessage,
|
transitional.clarifyTimeoutError ? AxiosError$2.ETIMEDOUT : AxiosError$2.ECONNABORTED,
|
config,
|
request2
|
));
|
request2 = null;
|
};
|
if (platform.isStandardBrowserEnv) {
|
const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
if (xsrfValue) {
|
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
}
|
}
|
requestData === void 0 && requestHeaders.setContentType(null);
|
if ("setRequestHeader" in request2) {
|
utils$3.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
request2.setRequestHeader(key, val);
|
});
|
}
|
if (!utils$3.isUndefined(config.withCredentials)) {
|
request2.withCredentials = !!config.withCredentials;
|
}
|
if (responseType && responseType !== "json") {
|
request2.responseType = config.responseType;
|
}
|
if (typeof config.onDownloadProgress === "function") {
|
request2.addEventListener("progress", progressEventReducer(config.onDownloadProgress, true));
|
}
|
if (typeof config.onUploadProgress === "function" && request2.upload) {
|
request2.upload.addEventListener("progress", progressEventReducer(config.onUploadProgress));
|
}
|
if (config.cancelToken || config.signal) {
|
onCanceled = (cancel) => {
|
if (!request2) {
|
return;
|
}
|
reject(!cancel || cancel.type ? new CanceledError(null, config, request2) : cancel);
|
request2.abort();
|
request2 = null;
|
};
|
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
if (config.signal) {
|
config.signal.aborted ? onCanceled() : config.signal.addEventListener("abort", onCanceled);
|
}
|
}
|
const protocol = parseProtocol(fullPath);
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
reject(new AxiosError$2("Unsupported protocol " + protocol + ":", AxiosError$2.ERR_BAD_REQUEST, config));
|
return;
|
}
|
request2.send(requestData || null);
|
});
|
};
|
const knownAdapters = {
|
http: httpAdapter,
|
xhr: xhrAdapter
|
};
|
utils$3.forEach(knownAdapters, (fn, value) => {
|
if (fn) {
|
try {
|
Object.defineProperty(fn, "name", { value });
|
} catch (e2) {
|
}
|
Object.defineProperty(fn, "adapterName", { value });
|
}
|
});
|
const renderReason = (reason) => `- ${reason}`;
|
const isResolvedHandle = (adapter) => utils$3.isFunction(adapter) || adapter === null || adapter === false;
|
const adapters = {
|
getAdapter: (adapters2) => {
|
adapters2 = utils$3.isArray(adapters2) ? adapters2 : [adapters2];
|
const { length } = adapters2;
|
let nameOrAdapter;
|
let adapter;
|
const rejectedReasons = {};
|
for (let i2 = 0; i2 < length; i2++) {
|
nameOrAdapter = adapters2[i2];
|
let id;
|
adapter = nameOrAdapter;
|
if (!isResolvedHandle(nameOrAdapter)) {
|
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
if (adapter === void 0) {
|
throw new AxiosError$2(`Unknown adapter '${id}'`);
|
}
|
}
|
if (adapter) {
|
break;
|
}
|
rejectedReasons[id || "#" + i2] = adapter;
|
}
|
if (!adapter) {
|
const reasons = Object.entries(rejectedReasons).map(
|
([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
|
);
|
let s2 = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
|
throw new AxiosError$2(
|
`There is no suitable adapter to dispatch the request ` + s2,
|
"ERR_NOT_SUPPORT"
|
);
|
}
|
return adapter;
|
},
|
adapters: knownAdapters
|
};
|
function throwIfCancellationRequested(config) {
|
if (config.cancelToken) {
|
config.cancelToken.throwIfRequested();
|
}
|
if (config.signal && config.signal.aborted) {
|
throw new CanceledError(null, config);
|
}
|
}
|
function dispatchRequest(config) {
|
throwIfCancellationRequested(config);
|
config.headers = AxiosHeaders$1.from(config.headers);
|
config.data = transformData.call(
|
config,
|
config.transformRequest
|
);
|
if (["post", "put", "patch"].indexOf(config.method) !== -1) {
|
config.headers.setContentType("application/x-www-form-urlencoded", false);
|
}
|
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
|
return adapter(config).then(function onAdapterResolution(response) {
|
throwIfCancellationRequested(config);
|
response.data = transformData.call(
|
config,
|
config.transformResponse,
|
response
|
);
|
response.headers = AxiosHeaders$1.from(response.headers);
|
return response;
|
}, function onAdapterRejection(reason) {
|
if (!isCancel(reason)) {
|
throwIfCancellationRequested(config);
|
if (reason && reason.response) {
|
reason.response.data = transformData.call(
|
config,
|
config.transformResponse,
|
reason.response
|
);
|
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
}
|
}
|
return Promise.reject(reason);
|
});
|
}
|
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
|
function mergeConfig(config1, config2) {
|
config2 = config2 || {};
|
const config = {};
|
function getMergedValue(target, source, caseless) {
|
if (utils$3.isPlainObject(target) && utils$3.isPlainObject(source)) {
|
return utils$3.merge.call({ caseless }, target, source);
|
} else if (utils$3.isPlainObject(source)) {
|
return utils$3.merge({}, source);
|
} else if (utils$3.isArray(source)) {
|
return source.slice();
|
}
|
return source;
|
}
|
function mergeDeepProperties(a2, b2, caseless) {
|
if (!utils$3.isUndefined(b2)) {
|
return getMergedValue(a2, b2, caseless);
|
} else if (!utils$3.isUndefined(a2)) {
|
return getMergedValue(void 0, a2, caseless);
|
}
|
}
|
function valueFromConfig2(a2, b2) {
|
if (!utils$3.isUndefined(b2)) {
|
return getMergedValue(void 0, b2);
|
}
|
}
|
function defaultToConfig2(a2, b2) {
|
if (!utils$3.isUndefined(b2)) {
|
return getMergedValue(void 0, b2);
|
} else if (!utils$3.isUndefined(a2)) {
|
return getMergedValue(void 0, a2);
|
}
|
}
|
function mergeDirectKeys(a2, b2, prop) {
|
if (prop in config2) {
|
return getMergedValue(a2, b2);
|
} else if (prop in config1) {
|
return getMergedValue(void 0, a2);
|
}
|
}
|
const mergeMap = {
|
url: valueFromConfig2,
|
method: valueFromConfig2,
|
data: valueFromConfig2,
|
baseURL: defaultToConfig2,
|
transformRequest: defaultToConfig2,
|
transformResponse: defaultToConfig2,
|
paramsSerializer: defaultToConfig2,
|
timeout: defaultToConfig2,
|
timeoutMessage: defaultToConfig2,
|
withCredentials: defaultToConfig2,
|
adapter: defaultToConfig2,
|
responseType: defaultToConfig2,
|
xsrfCookieName: defaultToConfig2,
|
xsrfHeaderName: defaultToConfig2,
|
onUploadProgress: defaultToConfig2,
|
onDownloadProgress: defaultToConfig2,
|
decompress: defaultToConfig2,
|
maxContentLength: defaultToConfig2,
|
maxBodyLength: defaultToConfig2,
|
beforeRedirect: defaultToConfig2,
|
transport: defaultToConfig2,
|
httpAgent: defaultToConfig2,
|
httpsAgent: defaultToConfig2,
|
cancelToken: defaultToConfig2,
|
socketPath: defaultToConfig2,
|
responseEncoding: defaultToConfig2,
|
validateStatus: mergeDirectKeys,
|
headers: (a2, b2) => mergeDeepProperties(headersToObject(a2), headersToObject(b2), true)
|
};
|
utils$3.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
const merge2 = mergeMap[prop] || mergeDeepProperties;
|
const configValue = merge2(config1[prop], config2[prop], prop);
|
utils$3.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
|
});
|
return config;
|
}
|
const VERSION = "1.5.1";
|
const validators$1 = {};
|
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i2) => {
|
validators$1[type] = function validator2(thing) {
|
return typeof thing === type || "a" + (i2 < 1 ? "n " : " ") + type;
|
};
|
});
|
const deprecatedWarnings = {};
|
validators$1.transitional = function transitional(validator2, version, message) {
|
function formatMessage(opt, desc) {
|
return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
}
|
return (value, opt, opts) => {
|
if (validator2 === false) {
|
throw new AxiosError$2(
|
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
|
AxiosError$2.ERR_DEPRECATED
|
);
|
}
|
if (version && !deprecatedWarnings[opt]) {
|
deprecatedWarnings[opt] = true;
|
formatAppLog(
|
"warn",
|
"at node_modules/axios/lib/helpers/validator.js:43",
|
formatMessage(
|
opt,
|
" has been deprecated since v" + version + " and will be removed in the near future"
|
)
|
);
|
}
|
return validator2 ? validator2(value, opt, opts) : true;
|
};
|
};
|
function assertOptions(options, schema, allowUnknown) {
|
if (typeof options !== "object") {
|
throw new AxiosError$2("options must be an object", AxiosError$2.ERR_BAD_OPTION_VALUE);
|
}
|
const keys = Object.keys(options);
|
let i2 = keys.length;
|
while (i2-- > 0) {
|
const opt = keys[i2];
|
const validator2 = schema[opt];
|
if (validator2) {
|
const value = options[opt];
|
const result = value === void 0 || validator2(value, opt, options);
|
if (result !== true) {
|
throw new AxiosError$2("option " + opt + " must be " + result, AxiosError$2.ERR_BAD_OPTION_VALUE);
|
}
|
continue;
|
}
|
if (allowUnknown !== true) {
|
throw new AxiosError$2("Unknown option " + opt, AxiosError$2.ERR_BAD_OPTION);
|
}
|
}
|
}
|
const validator = {
|
assertOptions,
|
validators: validators$1
|
};
|
const validators = validator.validators;
|
class Axios {
|
constructor(instanceConfig) {
|
this.defaults = instanceConfig;
|
this.interceptors = {
|
request: new InterceptorManager(),
|
response: new InterceptorManager()
|
};
|
}
|
/**
|
* Dispatch a request
|
*
|
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
* @param {?Object} config
|
*
|
* @returns {Promise} The Promise to be fulfilled
|
*/
|
request(configOrUrl, config) {
|
if (typeof configOrUrl === "string") {
|
config = config || {};
|
config.url = configOrUrl;
|
} else {
|
config = configOrUrl || {};
|
}
|
config = mergeConfig(this.defaults, config);
|
const { transitional, paramsSerializer, headers } = config;
|
if (transitional !== void 0) {
|
validator.assertOptions(transitional, {
|
silentJSONParsing: validators.transitional(validators.boolean),
|
forcedJSONParsing: validators.transitional(validators.boolean),
|
clarifyTimeoutError: validators.transitional(validators.boolean)
|
}, false);
|
}
|
if (paramsSerializer != null) {
|
if (utils$3.isFunction(paramsSerializer)) {
|
config.paramsSerializer = {
|
serialize: paramsSerializer
|
};
|
} else {
|
validator.assertOptions(paramsSerializer, {
|
encode: validators.function,
|
serialize: validators.function
|
}, true);
|
}
|
}
|
config.method = (config.method || this.defaults.method || "get").toLowerCase();
|
let contextHeaders = headers && utils$3.merge(
|
headers.common,
|
headers[config.method]
|
);
|
headers && utils$3.forEach(
|
["delete", "get", "head", "post", "put", "patch", "common"],
|
(method) => {
|
delete headers[method];
|
}
|
);
|
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
const requestInterceptorChain = [];
|
let synchronousRequestInterceptors = true;
|
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
|
return;
|
}
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
});
|
const responseInterceptorChain = [];
|
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
});
|
let promise;
|
let i2 = 0;
|
let len;
|
if (!synchronousRequestInterceptors) {
|
const chain = [dispatchRequest.bind(this), void 0];
|
chain.unshift.apply(chain, requestInterceptorChain);
|
chain.push.apply(chain, responseInterceptorChain);
|
len = chain.length;
|
promise = Promise.resolve(config);
|
while (i2 < len) {
|
promise = promise.then(chain[i2++], chain[i2++]);
|
}
|
return promise;
|
}
|
len = requestInterceptorChain.length;
|
let newConfig = config;
|
i2 = 0;
|
while (i2 < len) {
|
const onFulfilled = requestInterceptorChain[i2++];
|
const onRejected = requestInterceptorChain[i2++];
|
try {
|
newConfig = onFulfilled(newConfig);
|
} catch (error) {
|
onRejected.call(this, error);
|
break;
|
}
|
}
|
try {
|
promise = dispatchRequest.call(this, newConfig);
|
} catch (error) {
|
return Promise.reject(error);
|
}
|
i2 = 0;
|
len = responseInterceptorChain.length;
|
while (i2 < len) {
|
promise = promise.then(responseInterceptorChain[i2++], responseInterceptorChain[i2++]);
|
}
|
return promise;
|
}
|
getUri(config) {
|
config = mergeConfig(this.defaults, config);
|
const fullPath = buildFullPath$2(config.baseURL, config.url);
|
return buildURL$2(fullPath, config.params, config.paramsSerializer);
|
}
|
}
|
utils$3.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
|
Axios.prototype[method] = function(url, config) {
|
return this.request(mergeConfig(config || {}, {
|
method,
|
url,
|
data: (config || {}).data
|
}));
|
};
|
});
|
utils$3.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
function generateHTTPMethod(isForm) {
|
return function httpMethod(url, data, config) {
|
return this.request(mergeConfig(config || {}, {
|
method,
|
headers: isForm ? {
|
"Content-Type": "multipart/form-data"
|
} : {},
|
url,
|
data
|
}));
|
};
|
}
|
Axios.prototype[method] = generateHTTPMethod();
|
Axios.prototype[method + "Form"] = generateHTTPMethod(true);
|
});
|
const Axios$1 = Axios;
|
class CancelToken {
|
constructor(executor) {
|
if (typeof executor !== "function") {
|
throw new TypeError("executor must be a function.");
|
}
|
let resolvePromise;
|
this.promise = new Promise(function promiseExecutor(resolve) {
|
resolvePromise = resolve;
|
});
|
const token = this;
|
this.promise.then((cancel) => {
|
if (!token._listeners)
|
return;
|
let i2 = token._listeners.length;
|
while (i2-- > 0) {
|
token._listeners[i2](cancel);
|
}
|
token._listeners = null;
|
});
|
this.promise.then = (onfulfilled) => {
|
let _resolve;
|
const promise = new Promise((resolve) => {
|
token.subscribe(resolve);
|
_resolve = resolve;
|
}).then(onfulfilled);
|
promise.cancel = function reject() {
|
token.unsubscribe(_resolve);
|
};
|
return promise;
|
};
|
executor(function cancel(message, config, request2) {
|
if (token.reason) {
|
return;
|
}
|
token.reason = new CanceledError(message, config, request2);
|
resolvePromise(token.reason);
|
});
|
}
|
/**
|
* Throws a `CanceledError` if cancellation has been requested.
|
*/
|
throwIfRequested() {
|
if (this.reason) {
|
throw this.reason;
|
}
|
}
|
/**
|
* Subscribe to the cancel signal
|
*/
|
subscribe(listener) {
|
if (this.reason) {
|
listener(this.reason);
|
return;
|
}
|
if (this._listeners) {
|
this._listeners.push(listener);
|
} else {
|
this._listeners = [listener];
|
}
|
}
|
/**
|
* Unsubscribe from the cancel signal
|
*/
|
unsubscribe(listener) {
|
if (!this._listeners) {
|
return;
|
}
|
const index = this._listeners.indexOf(listener);
|
if (index !== -1) {
|
this._listeners.splice(index, 1);
|
}
|
}
|
/**
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
* cancels the `CancelToken`.
|
*/
|
static source() {
|
let cancel;
|
const token = new CancelToken(function executor(c2) {
|
cancel = c2;
|
});
|
return {
|
token,
|
cancel
|
};
|
}
|
}
|
const CancelToken$1 = CancelToken;
|
function spread(callback) {
|
return function wrap(arr) {
|
return callback.apply(null, arr);
|
};
|
}
|
function isAxiosError(payload) {
|
return utils$3.isObject(payload) && payload.isAxiosError === true;
|
}
|
const HttpStatusCode = {
|
Continue: 100,
|
SwitchingProtocols: 101,
|
Processing: 102,
|
EarlyHints: 103,
|
Ok: 200,
|
Created: 201,
|
Accepted: 202,
|
NonAuthoritativeInformation: 203,
|
NoContent: 204,
|
ResetContent: 205,
|
PartialContent: 206,
|
MultiStatus: 207,
|
AlreadyReported: 208,
|
ImUsed: 226,
|
MultipleChoices: 300,
|
MovedPermanently: 301,
|
Found: 302,
|
SeeOther: 303,
|
NotModified: 304,
|
UseProxy: 305,
|
Unused: 306,
|
TemporaryRedirect: 307,
|
PermanentRedirect: 308,
|
BadRequest: 400,
|
Unauthorized: 401,
|
PaymentRequired: 402,
|
Forbidden: 403,
|
NotFound: 404,
|
MethodNotAllowed: 405,
|
NotAcceptable: 406,
|
ProxyAuthenticationRequired: 407,
|
RequestTimeout: 408,
|
Conflict: 409,
|
Gone: 410,
|
LengthRequired: 411,
|
PreconditionFailed: 412,
|
PayloadTooLarge: 413,
|
UriTooLong: 414,
|
UnsupportedMediaType: 415,
|
RangeNotSatisfiable: 416,
|
ExpectationFailed: 417,
|
ImATeapot: 418,
|
MisdirectedRequest: 421,
|
UnprocessableEntity: 422,
|
Locked: 423,
|
FailedDependency: 424,
|
TooEarly: 425,
|
UpgradeRequired: 426,
|
PreconditionRequired: 428,
|
TooManyRequests: 429,
|
RequestHeaderFieldsTooLarge: 431,
|
UnavailableForLegalReasons: 451,
|
InternalServerError: 500,
|
NotImplemented: 501,
|
BadGateway: 502,
|
ServiceUnavailable: 503,
|
GatewayTimeout: 504,
|
HttpVersionNotSupported: 505,
|
VariantAlsoNegotiates: 506,
|
InsufficientStorage: 507,
|
LoopDetected: 508,
|
NotExtended: 510,
|
NetworkAuthenticationRequired: 511
|
};
|
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
HttpStatusCode[value] = key;
|
});
|
const HttpStatusCode$1 = HttpStatusCode;
|
function createInstance(defaultConfig) {
|
const context = new Axios$1(defaultConfig);
|
const instance = bind$2(Axios$1.prototype.request, context);
|
utils$3.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
|
utils$3.extend(instance, context, null, { allOwnKeys: true });
|
instance.create = function create(instanceConfig) {
|
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
};
|
return instance;
|
}
|
const axios = createInstance(defaults$1);
|
axios.Axios = Axios$1;
|
axios.CanceledError = CanceledError;
|
axios.CancelToken = CancelToken$1;
|
axios.isCancel = isCancel;
|
axios.VERSION = VERSION;
|
axios.toFormData = toFormData;
|
axios.AxiosError = AxiosError$2;
|
axios.Cancel = axios.CanceledError;
|
axios.all = function all(promises) {
|
return Promise.all(promises);
|
};
|
axios.spread = spread;
|
axios.isAxiosError = isAxiosError;
|
axios.mergeConfig = mergeConfig;
|
axios.AxiosHeaders = AxiosHeaders$1;
|
axios.formToJSON = (thing) => formDataToJSON(utils$3.isHTMLForm(thing) ? new FormData(thing) : thing);
|
axios.getAdapter = adapters.getAdapter;
|
axios.HttpStatusCode = HttpStatusCode$1;
|
axios.default = axios;
|
function getDefaultExportFromCjs(x) {
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
}
|
var axiosAdapterUniapp$1 = { exports: {} };
|
var isMultiUpload$1 = function isMultiUpload2(config) {
|
return Array.isArray(config.files) && config.files.length > 0;
|
};
|
const isMultiUpload = isMultiUpload$1;
|
var isUploadFile$2 = function isUploadFile2(config) {
|
if (config.method === "post") {
|
if (config.filePath && config.name)
|
return true;
|
if (isMultiUpload(config))
|
return true;
|
}
|
return false;
|
};
|
var bind$1 = function bind2(fn, thisArg) {
|
return function wrap() {
|
var args = new Array(arguments.length);
|
for (var i2 = 0; i2 < args.length; i2++) {
|
args[i2] = arguments[i2];
|
}
|
return fn.apply(thisArg, args);
|
};
|
};
|
var bind = bind$1;
|
var toString = Object.prototype.toString;
|
var kindOf = /* @__PURE__ */ function(cache) {
|
return function(thing) {
|
var str = toString.call(thing);
|
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
};
|
}(/* @__PURE__ */ Object.create(null));
|
function kindOfTest(type) {
|
type = type.toLowerCase();
|
return function isKindOf(thing) {
|
return kindOf(thing) === type;
|
};
|
}
|
function isArray(val) {
|
return Array.isArray(val);
|
}
|
function isUndefined(val) {
|
return typeof val === "undefined";
|
}
|
function isBuffer(val) {
|
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === "function" && val.constructor.isBuffer(val);
|
}
|
var isArrayBuffer = kindOfTest("ArrayBuffer");
|
function isArrayBufferView(val) {
|
var result;
|
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
result = ArrayBuffer.isView(val);
|
} else {
|
result = val && val.buffer && isArrayBuffer(val.buffer);
|
}
|
return result;
|
}
|
function isString(val) {
|
return typeof val === "string";
|
}
|
function isNumber(val) {
|
return typeof val === "number";
|
}
|
function isObject$1(val) {
|
return val !== null && typeof val === "object";
|
}
|
function isPlainObject(val) {
|
if (kindOf(val) !== "object") {
|
return false;
|
}
|
var prototype2 = Object.getPrototypeOf(val);
|
return prototype2 === null || prototype2 === Object.prototype;
|
}
|
var isDate = kindOfTest("Date");
|
var isFile = kindOfTest("File");
|
var isBlob = kindOfTest("Blob");
|
var isFileList = kindOfTest("FileList");
|
function isFunction(val) {
|
return toString.call(val) === "[object Function]";
|
}
|
function isStream(val) {
|
return isObject$1(val) && isFunction(val.pipe);
|
}
|
function isFormData(thing) {
|
var pattern = "[object FormData]";
|
return thing && (typeof FormData === "function" && thing instanceof FormData || toString.call(thing) === pattern || isFunction(thing.toString) && thing.toString() === pattern);
|
}
|
var isURLSearchParams = kindOfTest("URLSearchParams");
|
function trim(str) {
|
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
|
}
|
function isStandardBrowserEnv() {
|
if (typeof navigator !== "undefined" && (navigator.product === "ReactNative" || navigator.product === "NativeScript" || navigator.product === "NS")) {
|
return false;
|
}
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
}
|
function forEach(obj, fn) {
|
if (obj === null || typeof obj === "undefined") {
|
return;
|
}
|
if (typeof obj !== "object") {
|
obj = [obj];
|
}
|
if (isArray(obj)) {
|
for (var i2 = 0, l2 = obj.length; i2 < l2; i2++) {
|
fn.call(null, obj[i2], i2, obj);
|
}
|
} else {
|
for (var key in obj) {
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
fn.call(null, obj[key], key, obj);
|
}
|
}
|
}
|
}
|
function merge() {
|
var result = {};
|
function assignValue(val, key) {
|
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
result[key] = merge(result[key], val);
|
} else if (isPlainObject(val)) {
|
result[key] = merge({}, val);
|
} else if (isArray(val)) {
|
result[key] = val.slice();
|
} else {
|
result[key] = val;
|
}
|
}
|
for (var i2 = 0, l2 = arguments.length; i2 < l2; i2++) {
|
forEach(arguments[i2], assignValue);
|
}
|
return result;
|
}
|
function extend(a2, b2, thisArg) {
|
forEach(b2, function assignValue(val, key) {
|
if (thisArg && typeof val === "function") {
|
a2[key] = bind(val, thisArg);
|
} else {
|
a2[key] = val;
|
}
|
});
|
return a2;
|
}
|
function stripBOM(content) {
|
if (content.charCodeAt(0) === 65279) {
|
content = content.slice(1);
|
}
|
return content;
|
}
|
function inherits(constructor, superConstructor, props, descriptors2) {
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
|
constructor.prototype.constructor = constructor;
|
props && Object.assign(constructor.prototype, props);
|
}
|
function toFlatObject(sourceObj, destObj, filter) {
|
var props;
|
var i2;
|
var prop;
|
var merged = {};
|
destObj = destObj || {};
|
do {
|
props = Object.getOwnPropertyNames(sourceObj);
|
i2 = props.length;
|
while (i2-- > 0) {
|
prop = props[i2];
|
if (!merged[prop]) {
|
destObj[prop] = sourceObj[prop];
|
merged[prop] = true;
|
}
|
}
|
sourceObj = Object.getPrototypeOf(sourceObj);
|
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
return destObj;
|
}
|
function endsWith(str, searchString, position) {
|
str = String(str);
|
if (position === void 0 || position > str.length) {
|
position = str.length;
|
}
|
position -= searchString.length;
|
var lastIndex = str.indexOf(searchString, position);
|
return lastIndex !== -1 && lastIndex === position;
|
}
|
function toArray(thing) {
|
if (!thing)
|
return null;
|
var i2 = thing.length;
|
if (isUndefined(i2))
|
return null;
|
var arr = new Array(i2);
|
while (i2-- > 0) {
|
arr[i2] = thing[i2];
|
}
|
return arr;
|
}
|
var isTypedArray = /* @__PURE__ */ function(TypedArray) {
|
return function(thing) {
|
return TypedArray && thing instanceof TypedArray;
|
};
|
}(typeof Uint8Array !== "undefined" && Object.getPrototypeOf(Uint8Array));
|
var utils$2 = {
|
isArray,
|
isArrayBuffer,
|
isBuffer,
|
isFormData,
|
isArrayBufferView,
|
isString,
|
isNumber,
|
isObject: isObject$1,
|
isPlainObject,
|
isUndefined,
|
isDate,
|
isFile,
|
isBlob,
|
isFunction,
|
isStream,
|
isURLSearchParams,
|
isStandardBrowserEnv,
|
forEach,
|
merge,
|
extend,
|
trim,
|
stripBOM,
|
inherits,
|
toFlatObject,
|
kindOf,
|
kindOfTest,
|
endsWith,
|
toArray,
|
isTypedArray,
|
isFileList
|
};
|
var utils$1 = utils$2;
|
function AxiosError$1(message, code, config, request2, response) {
|
Error.call(this);
|
this.message = message;
|
this.name = "AxiosError";
|
code && (this.code = code);
|
config && (this.config = config);
|
request2 && (this.request = request2);
|
response && (this.response = response);
|
}
|
utils$1.inherits(AxiosError$1, Error, {
|
toJSON: function toJSON() {
|
return {
|
// Standard
|
message: this.message,
|
name: this.name,
|
// Microsoft
|
description: this.description,
|
number: this.number,
|
// Mozilla
|
fileName: this.fileName,
|
lineNumber: this.lineNumber,
|
columnNumber: this.columnNumber,
|
stack: this.stack,
|
// Axios
|
config: this.config,
|
code: this.code,
|
status: this.response && this.response.status ? this.response.status : null
|
};
|
}
|
});
|
var prototype = AxiosError$1.prototype;
|
var descriptors = {};
|
[
|
"ERR_BAD_OPTION_VALUE",
|
"ERR_BAD_OPTION",
|
"ECONNABORTED",
|
"ETIMEDOUT",
|
"ERR_NETWORK",
|
"ERR_FR_TOO_MANY_REDIRECTS",
|
"ERR_DEPRECATED",
|
"ERR_BAD_RESPONSE",
|
"ERR_BAD_REQUEST",
|
"ERR_CANCELED"
|
// eslint-disable-next-line func-names
|
].forEach(function(code) {
|
descriptors[code] = { value: code };
|
});
|
Object.defineProperties(AxiosError$1, descriptors);
|
Object.defineProperty(prototype, "isAxiosError", { value: true });
|
AxiosError$1.from = function(error, code, config, request2, response, customProps) {
|
var axiosError = Object.create(prototype);
|
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
return obj !== Error.prototype;
|
});
|
AxiosError$1.call(axiosError, error.message, code, config, request2, response);
|
axiosError.name = error.name;
|
customProps && Object.assign(axiosError, customProps);
|
return axiosError;
|
};
|
var AxiosError_1 = AxiosError$1;
|
var AxiosError = AxiosError_1;
|
var settle$1 = function settle2(resolve, reject, response) {
|
var validateStatus = response.config.validateStatus;
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
resolve(response);
|
} else {
|
reject(new AxiosError(
|
"Request failed with status code " + response.status,
|
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
response.config,
|
response.request,
|
response
|
));
|
}
|
};
|
var utils = utils$2;
|
function encode(val) {
|
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
}
|
var buildURL$1 = function buildURL2(url, params, paramsSerializer) {
|
if (!params) {
|
return url;
|
}
|
var serializedParams;
|
if (paramsSerializer) {
|
serializedParams = paramsSerializer(params);
|
} else if (utils.isURLSearchParams(params)) {
|
serializedParams = params.toString();
|
} else {
|
var parts = [];
|
utils.forEach(params, function serialize(val, key) {
|
if (val === null || typeof val === "undefined") {
|
return;
|
}
|
if (utils.isArray(val)) {
|
key = key + "[]";
|
} else {
|
val = [val];
|
}
|
utils.forEach(val, function parseValue(v2) {
|
if (utils.isDate(v2)) {
|
v2 = v2.toISOString();
|
} else if (utils.isObject(v2)) {
|
v2 = JSON.stringify(v2);
|
}
|
parts.push(encode(key) + "=" + encode(v2));
|
});
|
});
|
serializedParams = parts.join("&");
|
}
|
if (serializedParams) {
|
var hashmarkIndex = url.indexOf("#");
|
if (hashmarkIndex !== -1) {
|
url = url.slice(0, hashmarkIndex);
|
}
|
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
}
|
return url;
|
};
|
var isAbsoluteURL$1 = function isAbsoluteURL2(url) {
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
};
|
var combineURLs$1 = function combineURLs2(baseURL, relativeURL) {
|
return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
};
|
var isAbsoluteURL = isAbsoluteURL$1;
|
var combineURLs = combineURLs$1;
|
var buildFullPath$1 = function buildFullPath2(baseURL, requestedURL) {
|
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
return combineURLs(baseURL, requestedURL);
|
}
|
return requestedURL;
|
};
|
var settle = settle$1;
|
var buildURL = buildURL$1;
|
var buildFullPath = buildFullPath$1;
|
const isUploadFile$1 = isUploadFile$2;
|
var format$1 = function format2(config, resolve, reject) {
|
const fullPath = buildFullPath(config.baseURL, config.url);
|
const requestHeaders = config.headers;
|
const uniConfig = {
|
...config,
|
url: buildURL(fullPath, config.params, config.paramsSerializer),
|
// uniapp 用的是 header
|
header: requestHeaders
|
};
|
if (isUploadFile$1(config)) {
|
delete requestHeaders["Content-Type"];
|
if (config.formData) {
|
uniConfig.formData = config.formData;
|
} else {
|
if (typeof config.data === "string") {
|
uniConfig.formData = JSON.parse(config.data);
|
} else {
|
uniConfig.formData = config.data;
|
}
|
}
|
} else if (config.method === "get") {
|
uniConfig.data = config.data ? config.data : config.params;
|
} else {
|
uniConfig.data = config.data;
|
}
|
if (config.auth) {
|
var username = config.auth.username || "";
|
var password = unescape(encodeURIComponent(config.auth.password)) || "";
|
requestHeaders.Authorization = "Basic " + btoa(username + ":" + password);
|
}
|
uniConfig.complete = function(response) {
|
var result = {
|
data: response.data,
|
status: response.statusCode,
|
statusText: response.errMsg,
|
header: response.header,
|
config
|
// request: request
|
};
|
settle(resolve, reject, result);
|
};
|
return uniConfig;
|
};
|
const isUploadFile = isUploadFile$2;
|
const format = format$1;
|
function uniappAdapter(config = {}) {
|
return new Promise(function dispatchUniApp(resolve, reject) {
|
const uniConfig = format(config, resolve, reject);
|
let requestTask = null;
|
if (config.cancelToken) {
|
config.cancelToken.promise.then(function onCanceled(cancel) {
|
if (!requestTask) {
|
return;
|
}
|
requestTask.abort();
|
reject(cancel);
|
requestTask = null;
|
});
|
}
|
if (isUploadFile(config)) {
|
requestTask = uni.uploadFile(uniConfig);
|
} else {
|
requestTask = uni.request(uniConfig);
|
}
|
});
|
}
|
axiosAdapterUniapp$1.exports = uniappAdapter;
|
axiosAdapterUniapp$1.exports.default = uniappAdapter;
|
var axiosAdapterUniappExports = axiosAdapterUniapp$1.exports;
|
const axiosAdapterUniapp = /* @__PURE__ */ getDefaultExportFromCjs(axiosAdapterUniappExports);
|
let ip = uni.getStorageSync("ip") || null;
|
const webPort = 5173;
|
const port = 8086;
|
const request = axios.create({
|
baseURL: `http://${ip}:${port}`,
|
// 注意!! 这里是全局统一加上了 后端接口前缀 前缀,后端必须进行跨域配置!
|
adapter: axiosAdapterUniapp,
|
timeout: 15e3
|
});
|
request.interceptors.request.use((config) => {
|
const userStore = userInfo();
|
config.headers["Content-Type"] = "application/json;charset=utf-8";
|
if (userStore.user) {
|
config.headers["satoken"] = userStore.user.token;
|
}
|
return config;
|
}, (error) => {
|
return Promise.reject(error);
|
});
|
request.interceptors.response.use(
|
(response) => {
|
const userStore = userInfo();
|
let res = response.data;
|
if (res === void 0) {
|
return Promise.reject("服务器响应超时,请检查");
|
}
|
userStore.setResponseCode(parseInt(res.code), res.msg);
|
if (res.code !== "200") {
|
switch (res.code) {
|
case "402":
|
uni.reLaunch({
|
url: `/pages/index/index`
|
});
|
break;
|
}
|
if (response.config.responseType !== "blob") {
|
return Promise.reject(res.code);
|
}
|
}
|
if (response.config.responseType === "blob") {
|
return res;
|
}
|
if (typeof res === "string") {
|
res = res ? JSON.parse(res) : res;
|
}
|
return res;
|
},
|
(error) => {
|
formatAppLog("log", "at utils/request.js:65", "err" + error);
|
return Promise.reject(error);
|
}
|
);
|
const _imports_0 = "/static/favicon.ico";
|
const _sfc_main$A = {
|
__name: "index",
|
setup(__props, { expose: __expose }) {
|
__expose();
|
const store = userInfo();
|
let searchUserList = vue.ref({
|
userName: null
|
});
|
const userForm = vue.reactive({
|
userId: uni.getStorageSync("userId") || null,
|
pass: uni.getStorageSync("pass") || null
|
});
|
let users = vue.ref([]);
|
const message = vue.ref(null);
|
const type = vue.ref("center");
|
const msgType = vue.ref("success");
|
const messageText = vue.ref("");
|
const viewShow = vue.ref(false);
|
const downloadPage = vue.ref(`http://${ip}:${webPort}/#/app`);
|
let ipVal = vue.ref(null);
|
const classList = vue.ref([
|
{ text: "早班", value: "早班" },
|
{ text: "晚班", value: "晚班" }
|
]);
|
vue.onMounted(async () => {
|
if (ip === null) {
|
uni.reLaunch({
|
url: `/pages/login/login`
|
});
|
return;
|
}
|
await getAppVersion();
|
});
|
const searchUser = () => {
|
getUserList();
|
};
|
const getAppVersion = async () => {
|
await request.post(`/appVersion/searchVersion`).then((res) => {
|
if (res.code === "200") {
|
if (res.data.version !== store.version) {
|
if (uni.getSystemInfoSync().platform === "android") {
|
plus.runtime.openURL(downloadPage.value);
|
plus.runtime.quit();
|
return false;
|
} else {
|
viewShow.value = !viewShow.value;
|
}
|
}
|
}
|
}).catch((error) => {
|
messageToggle("error", error);
|
});
|
};
|
const getUserList = async () => {
|
await request.post(`/userInfo/findByAddress`, searchUserList.value).then((res) => {
|
if (res.code === "200") {
|
users.value = res.data.users[0];
|
}
|
});
|
};
|
const messageToggle = (type2, msg) => {
|
msgType.value = type2;
|
messageText.value = msg;
|
message.value.open();
|
};
|
const login = async () => {
|
await getAppVersion();
|
userForm.pass = btoa(userForm.pass);
|
store.cleanInfo();
|
if (store.user.class === null || store.user.class === "") {
|
messageToggle("error", "请输入班次信息");
|
return false;
|
}
|
request.post("/userInfo/login", userForm).then((res) => {
|
if (res["code"] == 200 && res["data"]) {
|
store.$patch({ user: res.data });
|
uni.reLaunch({
|
url: `/pages/mainView/mainView`
|
});
|
uni.setStorageSync("userId", userForm.userId);
|
uni.setStorageSync("pass", atob(userForm.pass));
|
} else {
|
messageToggle("error", "请输入正确的账号密码");
|
return false;
|
}
|
}).catch((error) => {
|
messageToggle("error", error);
|
return false;
|
}).then(() => {
|
userForm.pass = atob(userForm.pass);
|
});
|
};
|
const initApp = () => {
|
uni.removeStorage({
|
key: "ip"
|
});
|
plus.runtime.restart();
|
};
|
const __returned__ = { store, get searchUserList() {
|
return searchUserList;
|
}, set searchUserList(v2) {
|
searchUserList = v2;
|
}, userForm, get users() {
|
return users;
|
}, set users(v2) {
|
users = v2;
|
}, message, type, msgType, messageText, viewShow, downloadPage, get ipVal() {
|
return ipVal;
|
}, set ipVal(v2) {
|
ipVal = v2;
|
}, classList, searchUser, getAppVersion, getUserList, messageToggle, login, initApp, onMounted: vue.onMounted, reactive: vue.reactive, ref: vue.ref, get userInfo() {
|
return userInfo;
|
}, get request() {
|
return request;
|
}, get ip() {
|
return ip;
|
}, get webPort() {
|
return webPort;
|
} };
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
return __returned__;
|
}
|
};
|
function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_uni_data_select = resolveEasycom(vue.resolveDynamicComponent("uni-data-select"), __easycom_7$2);
|
const _component_uni_easyinput = resolveEasycom(vue.resolveDynamicComponent("uni-easyinput"), __easycom_3);
|
const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_6);
|
const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_7$1);
|
return $setup.viewShow ? (vue.openBlock(), vue.createElementBlock("web-view", {
|
key: 0,
|
src: $setup.downloadPage,
|
style: { "width": "100%", "height": "90%" }
|
}, null, 8, ["src"])) : (vue.openBlock(), vue.createElementBlock("view", {
|
key: 1,
|
class: "content"
|
}, [
|
vue.createElementVNode("image", {
|
class: "logo",
|
src: _imports_0
|
}),
|
vue.createElementVNode("view", { class: "text-area" }, [
|
vue.createElementVNode("text", { class: "title" }, "NorthGlass")
|
]),
|
vue.createElementVNode("view", { class: "text-area" }, [
|
vue.createElementVNode(
|
"text",
|
{ class: "title" },
|
vue.toDisplayString($setup.ip) + "(" + vue.toDisplayString($setup.store.version) + ")",
|
1
|
/* TEXT */
|
)
|
]),
|
vue.createElementVNode("view", { class: "text-area" }, [
|
vue.createVNode(_component_uni_data_select, {
|
style: { "width": "40vw", "text-align": "center" },
|
placeholder: "请选择班次",
|
modelValue: $setup.store.user.class,
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.store.user.class = $event),
|
localdata: $setup.classList
|
}, null, 8, ["modelValue", "localdata"])
|
]),
|
vue.createElementVNode("view", { class: "text-area" }, [
|
vue.createElementVNode("view", null, [
|
vue.createCommentVNode(' <uni-easyinput @blur="searchUser" v-model="searchUserList.userName"/> '),
|
vue.createVNode(_component_uni_easyinput, {
|
class: "input_1",
|
placeholder: "请输入账号",
|
style: { "text-align": "center" },
|
modelValue: $setup.userForm.userId,
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $setup.userForm.userId = $event)
|
}, null, 8, ["modelValue"])
|
])
|
]),
|
vue.createCommentVNode(' <view class="text-area">\r\n <view>\r\n <uni-data-select style="width:50vw"\r\n v-model="userForm.userId"\r\n :localdata="users"\r\n ></uni-data-select>\r\n </view> \r\n </view> '),
|
vue.createElementVNode("view", { class: "text-area" }, [
|
vue.createVNode(_component_uni_easyinput, {
|
class: "input_1",
|
style: { "text-align": "center" },
|
placeholder: "请输入密码",
|
passwordIcon: false,
|
modelValue: $setup.userForm.pass,
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $setup.userForm.pass = $event),
|
type: "password"
|
}, null, 8, ["modelValue"])
|
]),
|
vue.createElementVNode("view", { class: "text-area" }, [
|
vue.createElementVNode("button", {
|
onClick: $setup.login,
|
class: "login",
|
type: "primary",
|
size: "mini"
|
}, "登陆")
|
]),
|
vue.createElementVNode("text", {
|
onClick: $setup.initApp,
|
style: { "color": "#007aff", "text-decoration": "underline", "margin-top": "8rem" }
|
}, "初始化"),
|
vue.createElementVNode("view", null, [
|
vue.createCommentVNode(" 提示信息弹窗 "),
|
vue.createVNode(
|
_component_uni_popup,
|
{
|
ref: "message",
|
type: "message"
|
},
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_popup_message, {
|
type: $setup.msgType,
|
message: $setup.messageText,
|
duration: 2e3
|
}, null, 8, ["type", "message"])
|
]),
|
_: 1
|
/* STABLE */
|
},
|
512
|
/* NEED_PATCH */
|
)
|
])
|
]));
|
}
|
const PagesIndexIndex = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$z], ["__file", "D:/Documents/app/qrcodeScaner/pages/index/index.vue"]]);
|
const _sfc_main$z = {
|
name: "UniSection",
|
emits: ["click"],
|
props: {
|
type: {
|
type: String,
|
default: ""
|
},
|
title: {
|
type: String,
|
required: true,
|
default: ""
|
},
|
titleFontSize: {
|
type: String,
|
default: "14px"
|
},
|
titleColor: {
|
type: String,
|
default: "#333"
|
},
|
subTitle: {
|
type: String,
|
default: ""
|
},
|
subTitleFontSize: {
|
type: String,
|
default: "12px"
|
},
|
subTitleColor: {
|
type: String,
|
default: "#999"
|
},
|
padding: {
|
type: [Boolean, String],
|
default: false
|
}
|
},
|
computed: {
|
_padding() {
|
if (typeof this.padding === "string") {
|
return this.padding;
|
}
|
return this.padding ? "10px" : "";
|
}
|
},
|
watch: {
|
title(newVal) {
|
if (uni.report && newVal !== "") {
|
uni.report("title", newVal);
|
}
|
}
|
},
|
methods: {
|
onClick() {
|
this.$emit("click");
|
}
|
}
|
};
|
function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-section" }, [
|
vue.createElementVNode("view", {
|
class: "uni-section-header",
|
onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args))
|
}, [
|
$props.type ? (vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 0,
|
class: vue.normalizeClass(["uni-section-header__decoration", $props.type])
|
},
|
null,
|
2
|
/* CLASS */
|
)) : vue.renderSlot(_ctx.$slots, "decoration", { key: 1 }, void 0, true),
|
vue.createElementVNode("view", { class: "uni-section-header__content" }, [
|
vue.createElementVNode(
|
"text",
|
{
|
style: vue.normalizeStyle({ "font-size": $props.titleFontSize, "color": $props.titleColor }),
|
class: vue.normalizeClass(["uni-section__content-title", { "distraction": !$props.subTitle }])
|
},
|
vue.toDisplayString($props.title),
|
7
|
/* TEXT, CLASS, STYLE */
|
),
|
$props.subTitle ? (vue.openBlock(), vue.createElementBlock(
|
"text",
|
{
|
key: 0,
|
style: vue.normalizeStyle({ "font-size": $props.subTitleFontSize, "color": $props.subTitleColor }),
|
class: "uni-section-header__content-sub"
|
},
|
vue.toDisplayString($props.subTitle),
|
5
|
/* TEXT, STYLE */
|
)) : vue.createCommentVNode("v-if", true)
|
]),
|
vue.createElementVNode("view", { class: "uni-section-header__slot-right" }, [
|
vue.renderSlot(_ctx.$slots, "right", {}, void 0, true)
|
])
|
]),
|
vue.createElementVNode(
|
"view",
|
{
|
class: "uni-section-content",
|
style: vue.normalizeStyle({ padding: $options._padding })
|
},
|
[
|
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
],
|
4
|
/* STYLE */
|
)
|
]);
|
}
|
const __easycom_0$4 = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$y], ["__scopeId", "data-v-17c33c2a"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-section/uni-section.vue"]]);
|
const ComponentClass$1 = "uni-col";
|
const _sfc_main$y = {
|
name: "uniCol",
|
props: {
|
span: {
|
type: Number,
|
default: 24
|
},
|
offset: {
|
type: Number,
|
default: -1
|
},
|
pull: {
|
type: Number,
|
default: -1
|
},
|
push: {
|
type: Number,
|
default: -1
|
},
|
xs: [Number, Object],
|
sm: [Number, Object],
|
md: [Number, Object],
|
lg: [Number, Object],
|
xl: [Number, Object]
|
},
|
data() {
|
return {
|
gutter: 0,
|
sizeClass: "",
|
parentWidth: 0,
|
nvueWidth: 0,
|
marginLeft: 0,
|
right: 0,
|
left: 0
|
};
|
},
|
created() {
|
let parent = this.$parent;
|
while (parent && parent.$options.componentName !== "uniRow") {
|
parent = parent.$parent;
|
}
|
this.updateGutter(parent.gutter);
|
parent.$watch("gutter", (gutter) => {
|
this.updateGutter(gutter);
|
});
|
},
|
computed: {
|
sizeList() {
|
let {
|
span,
|
offset,
|
pull,
|
push
|
} = this;
|
return {
|
span,
|
offset,
|
pull,
|
push
|
};
|
},
|
pointClassList() {
|
let classList = [];
|
["xs", "sm", "md", "lg", "xl"].forEach((point) => {
|
const props = this[point];
|
if (typeof props === "number") {
|
classList.push(`${ComponentClass$1}-${point}-${props}`);
|
} else if (typeof props === "object" && props) {
|
Object.keys(props).forEach((pointProp) => {
|
classList.push(
|
pointProp === "span" ? `${ComponentClass$1}-${point}-${props[pointProp]}` : `${ComponentClass$1}-${point}-${pointProp}-${props[pointProp]}`
|
);
|
});
|
}
|
});
|
return classList.join(" ");
|
}
|
},
|
methods: {
|
updateGutter(parentGutter) {
|
parentGutter = Number(parentGutter);
|
if (!isNaN(parentGutter)) {
|
this.gutter = parentGutter / 2;
|
}
|
}
|
},
|
watch: {
|
sizeList: {
|
immediate: true,
|
handler(newVal) {
|
let classList = [];
|
for (let size in newVal) {
|
const curSize = newVal[size];
|
if ((curSize || curSize === 0) && curSize !== -1) {
|
classList.push(
|
size === "span" ? `${ComponentClass$1}-${curSize}` : `${ComponentClass$1}-${size}-${curSize}`
|
);
|
}
|
}
|
this.sizeClass = classList.join(" ");
|
}
|
}
|
}
|
};
|
function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-col", $data.sizeClass, $options.pointClassList]),
|
style: vue.normalizeStyle({
|
paddingLeft: `${Number($data.gutter)}rpx`,
|
paddingRight: `${Number($data.gutter)}rpx`
|
})
|
},
|
[
|
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
],
|
6
|
/* CLASS, STYLE */
|
);
|
}
|
const __easycom_8 = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["render", _sfc_render$x], ["__scopeId", "data-v-6ad5e460"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-col/uni-col.vue"]]);
|
const ComponentClass = "uni-row";
|
const modifierSeparator = "--";
|
const _sfc_main$x = {
|
name: "uniRow",
|
componentName: "uniRow",
|
props: {
|
type: String,
|
gutter: Number,
|
justify: {
|
type: String,
|
default: "start"
|
},
|
align: {
|
type: String,
|
default: "top"
|
},
|
// nvue如果使用span等属性,需要配置宽度
|
width: {
|
type: [String, Number],
|
default: 750
|
}
|
},
|
created() {
|
},
|
computed: {
|
marginValue() {
|
if (this.gutter) {
|
return -(this.gutter / 2);
|
}
|
return 0;
|
},
|
typeClass() {
|
return this.type === "flex" ? `${ComponentClass + modifierSeparator}flex` : "";
|
},
|
justifyClass() {
|
return this.justify !== "start" ? `${ComponentClass + modifierSeparator}flex-justify-${this.justify}` : "";
|
},
|
alignClass() {
|
return this.align !== "top" ? `${ComponentClass + modifierSeparator}flex-align-${this.align}` : "";
|
}
|
}
|
};
|
function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-row", $options.typeClass, $options.justifyClass, $options.alignClass]),
|
style: vue.normalizeStyle({
|
marginLeft: `${Number($options.marginValue)}rpx`,
|
marginRight: `${Number($options.marginValue)}rpx`
|
})
|
},
|
[
|
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
],
|
6
|
/* CLASS, STYLE */
|
);
|
}
|
const __easycom_9 = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["render", _sfc_render$w], ["__scopeId", "data-v-86edfd37"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-row/uni-row.vue"]]);
|
const mpaasScanModule = requireNativePlugin("Mpaas-Scan-Module");
|
const mpaasScan = () => {
|
return new Promise((resolve, reject) => {
|
mpaasScanModule.mpaasScan(
|
{
|
// 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
|
//'scanType': ['qrCode','barCode'],
|
// 是否隐藏相册,默认false不隐藏
|
"hideAlbum": true,
|
//ios需要设置这个参数,只支持中英文 zh-Hans、en,默认中文
|
"language": "zh-Hans",
|
//相册选择照片识别错误提示(ios)
|
"failedMsg": "未识别到二维码,请重试",
|
//Android支持全屏需要设置此参数
|
"screenType": "full",
|
"timeoutInterval": "15",
|
//设置超时时间
|
"timeoutText": "未识别到二维码?"
|
//超时提醒文本
|
},
|
(ret) => {
|
if (ret.resp_code === 1e3) {
|
resolve(ret.resp_result);
|
} else {
|
reject(new Error(ret.resp_message));
|
}
|
}
|
);
|
});
|
};
|
const SCANACTION = "android.intent.ACTION_SCAN_OUTPUT";
|
const _sfc_main$w = {
|
__name: "mainView",
|
setup(__props, { expose: __expose }) {
|
__expose();
|
const store = userInfo();
|
const message = vue.ref(null);
|
const type = vue.ref("center");
|
const msgType = vue.ref(null);
|
const messageText = vue.ref("");
|
let device = vue.ref(null);
|
let report = vue.ref(null);
|
const reports = vue.ref([
|
{ value: "orderList", text: "订单报表" },
|
{ value: "deliveryList", text: "发货报表" },
|
{ value: "originalGlassList", text: "原片库存" }
|
]);
|
let process = vue.ref(null);
|
let processList = vue.ref([]);
|
let flag = vue.ref(false);
|
const Intent = plus.android.importClass("android.content.Intent");
|
const IntentFilter = plus.android.importClass("android.content.IntentFilter");
|
const main = plus.android.runtimeMainActivity();
|
var filter = new IntentFilter();
|
filter.addAction(SCANACTION);
|
var receiver = plus.android.implements("io.dcloud.feature.internal.reflect.BroadcastReceiver", {
|
onReceive
|
});
|
function onReceive(context, intent) {
|
const page = getCurrentPages()[getCurrentPages().length - 1];
|
if (page.route !== "pages/mainView/mainView") {
|
return;
|
}
|
if (intent.getAction() === SCANACTION) {
|
const code = intent.getStringExtra("barcode");
|
uni.navigateTo({
|
url: `/pages/glassInfo/glassInfo?projectNo=${code}`
|
});
|
}
|
}
|
const getDeviceList = async () => {
|
if (store.choiceDevice.value != null) {
|
device.value = store.choiceDevice.value;
|
return;
|
}
|
await request.post(`/reportingWork/selectEquipmentByProcess/${process.value}`).then((res) => {
|
if (res.code === "200") {
|
let deviceList = [];
|
res.data.forEach((item, index) => {
|
deviceList.push({
|
value: item["id"],
|
text: item["basicName"]
|
});
|
});
|
store.deviceList = deviceList;
|
}
|
});
|
};
|
const getProcessList = async () => {
|
const regex = /^\s*$/;
|
if (!(store.user.address == null || regex.test(store.user.address))) {
|
return;
|
}
|
request.get(`/basicData/BasicDataByType/product/process`).then((res) => {
|
let processArr = [];
|
res.data.forEach((item, index) => {
|
processArr.push({
|
value: item["basicName"],
|
text: item["basicName"]
|
});
|
});
|
processList.value = processArr;
|
});
|
};
|
const changeProcess = () => {
|
store.deviceList = [];
|
device.value = null;
|
if (process.value == null || process.value == "")
|
return;
|
getDeviceList();
|
};
|
const change = (e2) => {
|
store.deviceList.forEach((item, index) => {
|
if (item.value === e2) {
|
store.choiceDevice = item;
|
}
|
});
|
};
|
onLoad(async (option) => {
|
if (store.user.userName === null) {
|
uni.reLaunch({
|
url: `/pages/index/index`
|
});
|
return;
|
}
|
if (store.user.address == null || store.user.address == "") {
|
await getProcessList();
|
} else {
|
flag.value = true;
|
process.value = store.user.address;
|
await getDeviceList();
|
}
|
main.registerReceiver(receiver, filter);
|
});
|
vue.onUnmounted(() => {
|
main.unregisterReceiver(receiver);
|
});
|
const mpaasScanModule2 = requireNativePlugin("Mpaas-Scan-Module");
|
const scannerGetGlassInfo = () => {
|
if (uni.getSystemInfoSync().platform === "android") {
|
mpaasScan().then((val) => {
|
uni.navigateTo({
|
url: `/pages/glassInfo/glassInfo?projectNo=${val}`
|
});
|
});
|
} else {
|
uni.navigateTo({
|
url: `/pages/glassInfo/glassInfo?projectNo=25031302009005`
|
});
|
}
|
};
|
const scanerCode = () => {
|
if (device.value === null) {
|
messageToggle("warn", "未选择设备,请选择报工设备!");
|
return;
|
}
|
if (uni.getSystemInfoSync().platform === "android") {
|
mpaasScan().then((val) => {
|
uni.navigateTo({
|
url: `/pages/reportingWork/reportingWork?processId=${val}&process=${process.value}`
|
});
|
});
|
} else {
|
uni.navigateTo({
|
url: `/pages/reportingWork/reportingWork?processId=NG24111542A012/1`
|
});
|
}
|
};
|
const glassFinishToStore = () => {
|
mpaasScan().then((val) => {
|
uni.navigateTo({
|
url: `/pages/glassFinishToStore/glassFinishToStore?processId=${val}`
|
});
|
});
|
};
|
const messageToggle = (type2, msg) => {
|
msgType.value = type2;
|
messageText.value = msg;
|
message.value.open();
|
};
|
const quantityCompletion1 = () => {
|
uni.navigateTo({
|
url: `/pages/QuantityCompletion/QuantityCompletion`
|
});
|
};
|
const changePage = () => {
|
uni.navigateTo({
|
url: `/pages/statement/${report.value}`
|
});
|
};
|
const __returned__ = { store, message, type, msgType, messageText, get device() {
|
return device;
|
}, set device(v2) {
|
device = v2;
|
}, get report() {
|
return report;
|
}, set report(v2) {
|
report = v2;
|
}, reports, get process() {
|
return process;
|
}, set process(v2) {
|
process = v2;
|
}, get processList() {
|
return processList;
|
}, set processList(v2) {
|
processList = v2;
|
}, get flag() {
|
return flag;
|
}, set flag(v2) {
|
flag = v2;
|
}, Intent, IntentFilter, main, SCANACTION, get filter() {
|
return filter;
|
}, set filter(v2) {
|
filter = v2;
|
}, get receiver() {
|
return receiver;
|
}, set receiver(v2) {
|
receiver = v2;
|
}, onReceive, getDeviceList, getProcessList, changeProcess, change, mpaasScanModule: mpaasScanModule2, scannerGetGlassInfo, scanerCode, glassFinishToStore, messageToggle, quantityCompletion1, changePage, get userInfo() {
|
return userInfo;
|
}, get onLoad() {
|
return onLoad;
|
}, get request() {
|
return request;
|
}, get mpaasScan() {
|
return mpaasScan;
|
}, ref: vue.ref, watch: vue.watch, onUnmounted: vue.onUnmounted, warn: vue.warn };
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
return __returned__;
|
}
|
};
|
function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_uni_section = resolveEasycom(vue.resolveDynamicComponent("uni-section"), __easycom_0$4);
|
const _component_uni_col = resolveEasycom(vue.resolveDynamicComponent("uni-col"), __easycom_8);
|
const _component_uni_data_select = resolveEasycom(vue.resolveDynamicComponent("uni-data-select"), __easycom_7$2);
|
const _component_uni_row = resolveEasycom(vue.resolveDynamicComponent("uni-row"), __easycom_9);
|
const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_6);
|
const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_7$1);
|
return vue.openBlock(), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
[
|
vue.createElementVNode("view", null, [
|
vue.createVNode(_component_uni_section, {
|
class: "mb-10",
|
title: "用户名称:" + $setup.store.user.userName
|
}, {
|
right: vue.withCtx(() => [
|
vue.createTextVNode(
|
" 班组:" + vue.toDisplayString($setup.store.user.address || ""),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 1
|
/* STABLE */
|
}, 8, ["title"])
|
]),
|
vue.createElementVNode("view", { class: "content" }, [
|
vue.createVNode(_component_uni_row, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_col, { span: 12 }, {
|
default: vue.withCtx(() => [
|
vue.createElementVNode("button", {
|
onClick: $setup.scannerGetGlassInfo,
|
type: "primary",
|
size: "mini"
|
}, "玻璃信息")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, { span: 12 }, {
|
default: vue.withCtx(() => [
|
vue.createElementVNode("button", {
|
onClick: $setup.scanerCode,
|
type: "primary",
|
size: "mini"
|
}, "扫码报工")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, { span: 12 }, {
|
default: vue.withCtx(() => [
|
vue.createElementVNode("button", {
|
type: "primary",
|
size: "mini",
|
onClick: $setup.quantityCompletion1
|
}, "当班产量")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, { span: 12 }, {
|
default: vue.withCtx(() => [
|
vue.createElementVNode("navigator", {
|
url: "/pages/ReportingWorkList/ReportingWorkList",
|
"open-type": "navigate"
|
}, [
|
vue.createElementVNode("button", {
|
type: "primary",
|
size: "mini"
|
}, "报工记录")
|
])
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, { span: 12 }, {
|
default: vue.withCtx(() => [
|
vue.createElementVNode("button", {
|
onClick: $setup.glassFinishToStore,
|
type: "primary",
|
size: "mini"
|
}, "成品入库")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, { span: 12 }, {
|
default: vue.withCtx(() => [
|
vue.createElementVNode("button", {
|
type: "primary",
|
size: "mini"
|
}, "成品出库")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createCommentVNode(` <uni-col :span="24" v-if="store.user.permissions.includes('qualityInspectionReview.edit')">\r
|
<navigator url="/pages/ReviewReporitingWork/ReviewReporitingWork" open-type="navigate">\r
|
<button type="primary" size="mini">质检审核</button>\r
|
</navigator>\r
|
</uni-col> `),
|
vue.createCommentVNode(' <uni-col :span="24">\r\n <uni-data-select\r\n placeholder="报表"\r\n v-model="report"\r\n :localdata="reports"\r\n @change="changePage"\r\n ></uni-data-select>\r\n </uni-col> '),
|
vue.createVNode(_component_uni_col, { span: 12 }, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_data_select, {
|
placeholder: "工序",
|
modelValue: $setup.process,
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.process = $event),
|
disabled: $setup.flag,
|
localdata: $setup.processList,
|
onChange: $setup.changeProcess
|
}, null, 8, ["modelValue", "disabled", "localdata"])
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, { span: 12 }, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_data_select, {
|
placeholder: "请选择设备",
|
modelValue: $setup.device,
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $setup.device = $event),
|
localdata: $setup.store.deviceList,
|
onChange: $setup.change
|
}, null, 8, ["modelValue", "localdata"])
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, { span: 24 }, {
|
default: vue.withCtx(() => [
|
vue.createElementVNode("navigator", {
|
url: "/pages/index/index",
|
"open-type": "reLaunch"
|
}, [
|
vue.createElementVNode("button", {
|
type: "warn",
|
size: "mini"
|
}, "退出")
|
])
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createCommentVNode(' <view class="text-area">\r\n \r\n </view> '),
|
vue.createElementVNode("view", null, [
|
vue.createCommentVNode(" 提示信息弹窗 "),
|
vue.createVNode(
|
_component_uni_popup,
|
{
|
ref: "message",
|
type: "message"
|
},
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_popup_message, {
|
type: $setup.msgType,
|
message: $setup.messageText,
|
duration: 2e3
|
}, null, 8, ["type", "message"])
|
]),
|
_: 1
|
/* STABLE */
|
},
|
512
|
/* NEED_PATCH */
|
)
|
])
|
])
|
],
|
64
|
/* STABLE_FRAGMENT */
|
);
|
}
|
const PagesMainViewMainView = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["render", _sfc_render$v], ["__file", "D:/Documents/app/qrcodeScaner/pages/mainView/mainView.vue"]]);
|
const _sfc_main$v = {
|
name: "uniTh",
|
options: {
|
virtualHost: true
|
},
|
components: {},
|
emits: ["sort-change", "filter-change"],
|
props: {
|
width: {
|
type: [String, Number],
|
default: ""
|
},
|
align: {
|
type: String,
|
default: "left"
|
},
|
rowspan: {
|
type: [Number, String],
|
default: 1
|
},
|
colspan: {
|
type: [Number, String],
|
default: 1
|
},
|
sortable: {
|
type: Boolean,
|
default: false
|
},
|
filterType: {
|
type: String,
|
default: ""
|
},
|
filterData: {
|
type: Array,
|
default() {
|
return [];
|
}
|
},
|
filterDefaultValue: {
|
type: [Array, String],
|
default() {
|
return "";
|
}
|
}
|
},
|
data() {
|
return {
|
border: false,
|
ascending: false,
|
descending: false
|
};
|
},
|
computed: {
|
// 根据props中的width属性 自动匹配当前th的宽度(px)
|
customWidth() {
|
if (typeof this.width === "number") {
|
return this.width;
|
} else if (typeof this.width === "string") {
|
let regexHaveUnitPx = new RegExp(/^[1-9][0-9]*px$/g);
|
let regexHaveUnitRpx = new RegExp(/^[1-9][0-9]*rpx$/g);
|
let regexHaveNotUnit = new RegExp(/^[1-9][0-9]*$/g);
|
if (this.width.match(regexHaveUnitPx) !== null) {
|
return this.width.replace("px", "");
|
} else if (this.width.match(regexHaveUnitRpx) !== null) {
|
let numberRpx = Number(this.width.replace("rpx", ""));
|
let widthCoe = uni.getSystemInfoSync().screenWidth / 750;
|
return Math.round(numberRpx * widthCoe);
|
} else if (this.width.match(regexHaveNotUnit) !== null) {
|
return this.width;
|
} else {
|
return "";
|
}
|
} else {
|
return "";
|
}
|
},
|
contentAlign() {
|
let align = "left";
|
switch (this.align) {
|
case "left":
|
align = "flex-start";
|
break;
|
case "center":
|
align = "center";
|
break;
|
case "right":
|
align = "flex-end";
|
break;
|
}
|
return align;
|
}
|
},
|
created() {
|
this.root = this.getTable("uniTable");
|
this.rootTr = this.getTable("uniTr");
|
this.rootTr.minWidthUpdate(this.customWidth ? this.customWidth : 140);
|
this.border = this.root.border;
|
this.root.thChildren.push(this);
|
},
|
methods: {
|
sort() {
|
if (!this.sortable)
|
return;
|
this.clearOther();
|
if (!this.ascending && !this.descending) {
|
this.ascending = true;
|
this.$emit("sort-change", { order: "ascending" });
|
return;
|
}
|
if (this.ascending && !this.descending) {
|
this.ascending = false;
|
this.descending = true;
|
this.$emit("sort-change", { order: "descending" });
|
return;
|
}
|
if (!this.ascending && this.descending) {
|
this.ascending = false;
|
this.descending = false;
|
this.$emit("sort-change", { order: null });
|
}
|
},
|
ascendingFn() {
|
this.clearOther();
|
this.ascending = !this.ascending;
|
this.descending = false;
|
this.$emit("sort-change", { order: this.ascending ? "ascending" : null });
|
},
|
descendingFn() {
|
this.clearOther();
|
this.descending = !this.descending;
|
this.ascending = false;
|
this.$emit("sort-change", { order: this.descending ? "descending" : null });
|
},
|
clearOther() {
|
this.root.thChildren.map((item) => {
|
if (item !== this) {
|
item.ascending = false;
|
item.descending = false;
|
}
|
return item;
|
});
|
},
|
ondropdown(e2) {
|
this.$emit("filter-change", e2);
|
},
|
/**
|
* 获取父元素实例
|
*/
|
getTable(name) {
|
let parent = this.$parent;
|
let parentName = parent.$options.name;
|
while (parentName !== name) {
|
parent = parent.$parent;
|
if (!parent)
|
return false;
|
parentName = parent.$options.name;
|
}
|
return parent;
|
}
|
}
|
};
|
function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-table-th", { "table--border": $data.border }]),
|
style: vue.normalizeStyle({ width: $options.customWidth + "px", "text-align": $props.align })
|
},
|
[
|
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
],
|
6
|
/* CLASS, STYLE */
|
);
|
}
|
const __easycom_1$3 = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["render", _sfc_render$u], ["__scopeId", "data-v-cf557ba0"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-th/uni-th.vue"]]);
|
const _sfc_main$u = {
|
name: "TableCheckbox",
|
emits: ["checkboxSelected"],
|
props: {
|
indeterminate: {
|
type: Boolean,
|
default: false
|
},
|
checked: {
|
type: [Boolean, String],
|
default: false
|
},
|
disabled: {
|
type: Boolean,
|
default: false
|
},
|
index: {
|
type: Number,
|
default: -1
|
},
|
cellData: {
|
type: Object,
|
default() {
|
return {};
|
}
|
}
|
},
|
watch: {
|
checked(newVal) {
|
if (typeof this.checked === "boolean") {
|
this.isChecked = newVal;
|
} else {
|
this.isChecked = true;
|
}
|
},
|
indeterminate(newVal) {
|
this.isIndeterminate = newVal;
|
}
|
},
|
data() {
|
return {
|
isChecked: false,
|
isDisabled: false,
|
isIndeterminate: false
|
};
|
},
|
created() {
|
if (typeof this.checked === "boolean") {
|
this.isChecked = this.checked;
|
}
|
this.isDisabled = this.disabled;
|
},
|
methods: {
|
selected() {
|
if (this.isDisabled)
|
return;
|
this.isIndeterminate = false;
|
this.isChecked = !this.isChecked;
|
this.$emit("checkboxSelected", {
|
checked: this.isChecked,
|
data: this.cellData
|
});
|
}
|
}
|
};
|
function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock("view", {
|
class: "uni-table-checkbox",
|
onClick: _cache[0] || (_cache[0] = (...args) => $options.selected && $options.selected(...args))
|
}, [
|
!$props.indeterminate ? (vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 0,
|
class: vue.normalizeClass(["checkbox__inner", { "is-checked": $data.isChecked, "is-disable": $data.isDisabled }])
|
},
|
[
|
vue.createElementVNode("view", { class: "checkbox__inner-icon" })
|
],
|
2
|
/* CLASS */
|
)) : (vue.openBlock(), vue.createElementBlock("view", {
|
key: 1,
|
class: "checkbox__inner checkbox--indeterminate"
|
}, [
|
vue.createElementVNode("view", { class: "checkbox__inner-icon" })
|
]))
|
]);
|
}
|
const tableCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["render", _sfc_render$t], ["__scopeId", "data-v-1e57686e"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-tr/table-checkbox.vue"]]);
|
const _sfc_main$t = {
|
name: "uniTr",
|
components: {
|
tableCheckbox
|
},
|
props: {
|
disabled: {
|
type: Boolean,
|
default: false
|
},
|
keyValue: {
|
type: [String, Number],
|
default: ""
|
}
|
},
|
options: {
|
virtualHost: true
|
},
|
data() {
|
return {
|
value: false,
|
border: false,
|
selection: false,
|
widthThArr: [],
|
ishead: true,
|
checked: false,
|
indeterminate: false
|
};
|
},
|
created() {
|
this.root = this.getTable();
|
this.head = this.getTable("uniThead");
|
if (this.head) {
|
this.ishead = false;
|
this.head.init(this);
|
}
|
this.border = this.root.border;
|
this.selection = this.root.type;
|
this.root.trChildren.push(this);
|
const rowData = this.root.data.find((v2) => v2[this.root.rowKey] === this.keyValue);
|
if (rowData) {
|
this.rowData = rowData;
|
}
|
this.root.isNodata();
|
},
|
mounted() {
|
if (this.widthThArr.length > 0) {
|
const selectionWidth = this.selection === "selection" ? 50 : 0;
|
this.root.minWidth = Number(this.widthThArr.reduce((a2, b2) => Number(a2) + Number(b2))) + selectionWidth;
|
}
|
},
|
unmounted() {
|
const index = this.root.trChildren.findIndex((i2) => i2 === this);
|
this.root.trChildren.splice(index, 1);
|
this.root.isNodata();
|
},
|
methods: {
|
minWidthUpdate(width) {
|
this.widthThArr.push(width);
|
if (this.widthThArr.length > 0) {
|
const selectionWidth = this.selection === "selection" ? 50 : 0;
|
this.root.minWidth = Number(this.widthThArr.reduce((a2, b2) => Number(a2) + Number(b2))) + selectionWidth;
|
}
|
},
|
// 选中
|
checkboxSelected(e2) {
|
let rootData = this.root.data.find((v2) => v2[this.root.rowKey] === this.keyValue);
|
this.checked = e2.checked;
|
this.root.check(rootData || this, e2.checked, rootData ? this.keyValue : null);
|
},
|
change(e2) {
|
this.root.trChildren.forEach((item) => {
|
if (item === this) {
|
this.root.check(this, e2.detail.value.length > 0 ? true : false);
|
}
|
});
|
},
|
/**
|
* 获取父元素实例
|
*/
|
getTable(name = "uniTable") {
|
let parent = this.$parent;
|
let parentName = parent.$options.name;
|
while (parentName !== name) {
|
parent = parent.$parent;
|
if (!parent)
|
return false;
|
parentName = parent.$options.name;
|
}
|
return parent;
|
}
|
}
|
};
|
function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_table_checkbox = vue.resolveComponent("table-checkbox");
|
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-table-tr" }, [
|
$data.selection === "selection" ? (vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 0,
|
class: vue.normalizeClass(["checkbox", { "tr-table--border": $data.border }])
|
},
|
[
|
vue.createVNode(_component_table_checkbox, {
|
checked: $data.checked,
|
indeterminate: $data.indeterminate,
|
disabled: $props.disabled,
|
onCheckboxSelected: $options.checkboxSelected
|
}, null, 8, ["checked", "indeterminate", "disabled", "onCheckboxSelected"])
|
],
|
2
|
/* CLASS */
|
)) : vue.createCommentVNode("v-if", true),
|
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
]);
|
}
|
const __easycom_2 = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["render", _sfc_render$s], ["__scopeId", "data-v-caa8fbf1"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-tr/uni-tr.vue"]]);
|
const _sfc_main$s = {
|
name: "uniTd",
|
options: {
|
virtualHost: true
|
},
|
props: {
|
width: {
|
type: [String, Number],
|
default: ""
|
},
|
align: {
|
type: String,
|
default: "left"
|
},
|
rowspan: {
|
type: [Number, String],
|
default: 1
|
},
|
colspan: {
|
type: [Number, String],
|
default: 1
|
}
|
},
|
data() {
|
return {
|
border: false
|
};
|
},
|
created() {
|
this.root = this.getTable();
|
this.border = this.root.border;
|
},
|
methods: {
|
/**
|
* 获取父元素实例
|
*/
|
getTable() {
|
let parent = this.$parent;
|
let parentName = parent.$options.name;
|
while (parentName !== "uniTable") {
|
parent = parent.$parent;
|
if (!parent)
|
return false;
|
parentName = parent.$options.name;
|
}
|
return parent;
|
}
|
}
|
};
|
function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
[
|
vue.createCommentVNode(` :class="{'table--border':border}" `),
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-table-td", { "table--border": $data.border }]),
|
style: vue.normalizeStyle({ width: $props.width + "px", "text-align": $props.align })
|
},
|
[
|
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
],
|
6
|
/* CLASS, STYLE */
|
)
|
],
|
2112
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
);
|
}
|
const __easycom_4 = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["render", _sfc_render$r], ["__scopeId", "data-v-f4532f33"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-td/uni-td.vue"]]);
|
const _sfc_main$r = {
|
name: "uniTable",
|
options: {
|
virtualHost: true
|
},
|
emits: ["selection-change"],
|
props: {
|
data: {
|
type: Array,
|
default() {
|
return [];
|
}
|
},
|
// 是否有竖线
|
border: {
|
type: Boolean,
|
default: false
|
},
|
// 是否显示斑马线
|
stripe: {
|
type: Boolean,
|
default: false
|
},
|
// 多选
|
type: {
|
type: String,
|
default: ""
|
},
|
// 没有更多数据
|
emptyText: {
|
type: String,
|
default: "没有更多数据"
|
},
|
loading: {
|
type: Boolean,
|
default: false
|
},
|
rowKey: {
|
type: String,
|
default: ""
|
}
|
},
|
data() {
|
return {
|
noData: true,
|
minWidth: 0,
|
multiTableHeads: []
|
};
|
},
|
watch: {
|
loading(val) {
|
},
|
data(newVal) {
|
this.theadChildren;
|
if (this.theadChildren) {
|
this.theadChildren.rowspan;
|
}
|
this.noData = false;
|
}
|
},
|
created() {
|
this.trChildren = [];
|
this.thChildren = [];
|
this.theadChildren = null;
|
this.backData = [];
|
this.backIndexData = [];
|
},
|
methods: {
|
isNodata() {
|
this.theadChildren;
|
let rowspan = 1;
|
if (this.theadChildren) {
|
rowspan = this.theadChildren.rowspan;
|
}
|
this.noData = this.trChildren.length - rowspan <= 0;
|
},
|
/**
|
* 选中所有
|
*/
|
selectionAll() {
|
let startIndex = 1;
|
let theadChildren = this.theadChildren;
|
if (!this.theadChildren) {
|
theadChildren = this.trChildren[0];
|
} else {
|
startIndex = theadChildren.rowspan - 1;
|
}
|
let isHaveData = this.data && this.data.length > 0;
|
theadChildren.checked = true;
|
theadChildren.indeterminate = false;
|
this.trChildren.forEach((item, index) => {
|
if (!item.disabled) {
|
item.checked = true;
|
if (isHaveData && item.keyValue) {
|
const row = this.data.find((v2) => v2[this.rowKey] === item.keyValue);
|
if (!this.backData.find((v2) => v2[this.rowKey] === row[this.rowKey])) {
|
this.backData.push(row);
|
}
|
}
|
if (index > startIndex - 1 && this.backIndexData.indexOf(index - startIndex) === -1) {
|
this.backIndexData.push(index - startIndex);
|
}
|
}
|
});
|
this.$emit("selection-change", {
|
detail: {
|
value: this.backData,
|
index: this.backIndexData
|
}
|
});
|
},
|
/**
|
* 用于多选表格,切换某一行的选中状态,如果使用了第二个参数,则是设置这一行选中与否(selected 为 true 则选中)
|
*/
|
toggleRowSelection(row, selected) {
|
row = [].concat(row);
|
this.trChildren.forEach((item, index) => {
|
const select = row.findIndex((v2) => {
|
if (typeof v2 === "number") {
|
return v2 === index - 1;
|
} else {
|
return v2[this.rowKey] === item.keyValue;
|
}
|
});
|
let ischeck = item.checked;
|
if (select !== -1) {
|
if (typeof selected === "boolean") {
|
item.checked = selected;
|
} else {
|
item.checked = !item.checked;
|
}
|
if (ischeck !== item.checked) {
|
this.check(item.rowData || item, item.checked, item.rowData ? item.keyValue : null, true);
|
}
|
}
|
});
|
this.$emit("selection-change", {
|
detail: {
|
value: this.backData,
|
index: this.backIndexData
|
}
|
});
|
},
|
/**
|
* 用于多选表格,清空用户的选择
|
*/
|
clearSelection() {
|
let theadChildren = this.theadChildren;
|
if (!this.theadChildren) {
|
theadChildren = this.trChildren[0];
|
}
|
theadChildren.checked = false;
|
theadChildren.indeterminate = false;
|
this.trChildren.forEach((item) => {
|
item.checked = false;
|
});
|
this.backData = [];
|
this.backIndexData = [];
|
this.$emit("selection-change", {
|
detail: {
|
value: [],
|
index: []
|
}
|
});
|
},
|
/**
|
* 用于多选表格,切换所有行的选中状态
|
*/
|
toggleAllSelection() {
|
let list = [];
|
let startIndex = 1;
|
let theadChildren = this.theadChildren;
|
if (!this.theadChildren) {
|
theadChildren = this.trChildren[0];
|
} else {
|
startIndex = theadChildren.rowspan - 1;
|
}
|
this.trChildren.forEach((item, index) => {
|
if (!item.disabled) {
|
if (index > startIndex - 1) {
|
list.push(index - startIndex);
|
}
|
}
|
});
|
this.toggleRowSelection(list);
|
},
|
/**
|
* 选中\取消选中
|
* @param {Object} child
|
* @param {Object} check
|
* @param {Object} rowValue
|
*/
|
check(child, check, keyValue, emit) {
|
let theadChildren = this.theadChildren;
|
if (!this.theadChildren) {
|
theadChildren = this.trChildren[0];
|
}
|
let childDomIndex = this.trChildren.findIndex((item, index) => child === item);
|
if (childDomIndex < 0) {
|
childDomIndex = this.data.findIndex((v2) => v2[this.rowKey] === keyValue) + 1;
|
}
|
this.trChildren.filter((v2) => !v2.disabled && v2.keyValue).length;
|
if (childDomIndex === 0) {
|
check ? this.selectionAll() : this.clearSelection();
|
return;
|
}
|
if (check) {
|
if (keyValue) {
|
this.backData.push(child);
|
}
|
this.backIndexData.push(childDomIndex - 1);
|
} else {
|
const index = this.backData.findIndex((v2) => v2[this.rowKey] === keyValue);
|
const idx = this.backIndexData.findIndex((item) => item === childDomIndex - 1);
|
if (keyValue) {
|
this.backData.splice(index, 1);
|
}
|
this.backIndexData.splice(idx, 1);
|
}
|
const domCheckAll = this.trChildren.find((item, index) => index > 0 && !item.checked && !item.disabled);
|
if (!domCheckAll) {
|
theadChildren.indeterminate = false;
|
theadChildren.checked = true;
|
} else {
|
theadChildren.indeterminate = true;
|
theadChildren.checked = false;
|
}
|
if (this.backIndexData.length === 0) {
|
theadChildren.indeterminate = false;
|
}
|
if (!emit) {
|
this.$emit("selection-change", {
|
detail: {
|
value: this.backData,
|
index: this.backIndexData
|
}
|
});
|
}
|
}
|
}
|
};
|
function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-table-scroll", { "table--border": $props.border, "border-none": !$data.noData }])
|
},
|
[
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-table", { "table--stripe": $props.stripe }]),
|
style: vue.normalizeStyle({ "min-width": $data.minWidth + "px" })
|
},
|
[
|
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true),
|
$data.noData ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
class: "uni-table-loading"
|
}, [
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-table-text", { "empty-border": $props.border }])
|
},
|
vue.toDisplayString($props.emptyText),
|
3
|
/* TEXT, CLASS */
|
)
|
])) : vue.createCommentVNode("v-if", true),
|
$props.loading ? (vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 1,
|
class: vue.normalizeClass(["uni-table-mask", { "empty-border": $props.border }])
|
},
|
[
|
vue.createElementVNode("div", { class: "uni-table--loader" })
|
],
|
2
|
/* CLASS */
|
)) : vue.createCommentVNode("v-if", true)
|
],
|
6
|
/* CLASS, STYLE */
|
)
|
],
|
2
|
/* CLASS */
|
);
|
}
|
const __easycom_5 = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_render$q], ["__scopeId", "data-v-92442abd"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-table/uni-table.vue"]]);
|
const isObject = (val) => val !== null && typeof val === "object";
|
const defaultDelimiters = ["{", "}"];
|
class BaseFormatter {
|
constructor() {
|
this._caches = /* @__PURE__ */ Object.create(null);
|
}
|
interpolate(message, values, delimiters = defaultDelimiters) {
|
if (!values) {
|
return [message];
|
}
|
let tokens = this._caches[message];
|
if (!tokens) {
|
tokens = parse(message, delimiters);
|
this._caches[message] = tokens;
|
}
|
return compile(tokens, values);
|
}
|
}
|
const RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
|
const RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
|
function parse(format2, [startDelimiter, endDelimiter]) {
|
const tokens = [];
|
let position = 0;
|
let text = "";
|
while (position < format2.length) {
|
let char = format2[position++];
|
if (char === startDelimiter) {
|
if (text) {
|
tokens.push({ type: "text", value: text });
|
}
|
text = "";
|
let sub = "";
|
char = format2[position++];
|
while (char !== void 0 && char !== endDelimiter) {
|
sub += char;
|
char = format2[position++];
|
}
|
const isClosed = char === endDelimiter;
|
const type = RE_TOKEN_LIST_VALUE.test(sub) ? "list" : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? "named" : "unknown";
|
tokens.push({ value: sub, type });
|
} else {
|
text += char;
|
}
|
}
|
text && tokens.push({ type: "text", value: text });
|
return tokens;
|
}
|
function compile(tokens, values) {
|
const compiled = [];
|
let index = 0;
|
const mode = Array.isArray(values) ? "list" : isObject(values) ? "named" : "unknown";
|
if (mode === "unknown") {
|
return compiled;
|
}
|
while (index < tokens.length) {
|
const token = tokens[index];
|
switch (token.type) {
|
case "text":
|
compiled.push(token.value);
|
break;
|
case "list":
|
compiled.push(values[parseInt(token.value, 10)]);
|
break;
|
case "named":
|
if (mode === "named") {
|
compiled.push(values[token.value]);
|
} else {
|
{
|
console.warn(`Type of token '${token.type}' and format of value '${mode}' don't match!`);
|
}
|
}
|
break;
|
case "unknown":
|
{
|
console.warn(`Detect 'unknown' type of token!`);
|
}
|
break;
|
}
|
index++;
|
}
|
return compiled;
|
}
|
const LOCALE_ZH_HANS = "zh-Hans";
|
const LOCALE_ZH_HANT = "zh-Hant";
|
const LOCALE_EN = "en";
|
const LOCALE_FR = "fr";
|
const LOCALE_ES = "es";
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
const defaultFormatter = new BaseFormatter();
|
function include(str, parts) {
|
return !!parts.find((part) => str.indexOf(part) !== -1);
|
}
|
function startsWith(str, parts) {
|
return parts.find((part) => str.indexOf(part) === 0);
|
}
|
function normalizeLocale(locale, messages2) {
|
if (!locale) {
|
return;
|
}
|
locale = locale.trim().replace(/_/g, "-");
|
if (messages2 && messages2[locale]) {
|
return locale;
|
}
|
locale = locale.toLowerCase();
|
if (locale === "chinese") {
|
return LOCALE_ZH_HANS;
|
}
|
if (locale.indexOf("zh") === 0) {
|
if (locale.indexOf("-hans") > -1) {
|
return LOCALE_ZH_HANS;
|
}
|
if (locale.indexOf("-hant") > -1) {
|
return LOCALE_ZH_HANT;
|
}
|
if (include(locale, ["-tw", "-hk", "-mo", "-cht"])) {
|
return LOCALE_ZH_HANT;
|
}
|
return LOCALE_ZH_HANS;
|
}
|
let locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
|
if (messages2 && Object.keys(messages2).length > 0) {
|
locales = Object.keys(messages2);
|
}
|
const lang = startsWith(locale, locales);
|
if (lang) {
|
return lang;
|
}
|
}
|
class I18n {
|
constructor({ locale, fallbackLocale, messages: messages2, watcher, formater: formater2 }) {
|
this.locale = LOCALE_EN;
|
this.fallbackLocale = LOCALE_EN;
|
this.message = {};
|
this.messages = {};
|
this.watchers = [];
|
if (fallbackLocale) {
|
this.fallbackLocale = fallbackLocale;
|
}
|
this.formater = formater2 || defaultFormatter;
|
this.messages = messages2 || {};
|
this.setLocale(locale || LOCALE_EN);
|
if (watcher) {
|
this.watchLocale(watcher);
|
}
|
}
|
setLocale(locale) {
|
const oldLocale = this.locale;
|
this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
|
if (!this.messages[this.locale]) {
|
this.messages[this.locale] = {};
|
}
|
this.message = this.messages[this.locale];
|
if (oldLocale !== this.locale) {
|
this.watchers.forEach((watcher) => {
|
watcher(this.locale, oldLocale);
|
});
|
}
|
}
|
getLocale() {
|
return this.locale;
|
}
|
watchLocale(fn) {
|
const index = this.watchers.push(fn) - 1;
|
return () => {
|
this.watchers.splice(index, 1);
|
};
|
}
|
add(locale, message, override = true) {
|
const curMessages = this.messages[locale];
|
if (curMessages) {
|
if (override) {
|
Object.assign(curMessages, message);
|
} else {
|
Object.keys(message).forEach((key) => {
|
if (!hasOwn(curMessages, key)) {
|
curMessages[key] = message[key];
|
}
|
});
|
}
|
} else {
|
this.messages[locale] = message;
|
}
|
}
|
f(message, values, delimiters) {
|
return this.formater.interpolate(message, values, delimiters).join("");
|
}
|
t(key, locale, values) {
|
let message = this.message;
|
if (typeof locale === "string") {
|
locale = normalizeLocale(locale, this.messages);
|
locale && (message = this.messages[locale]);
|
} else {
|
values = locale;
|
}
|
if (!hasOwn(message, key)) {
|
console.warn(`Cannot translate the value of keypath ${key}. Use the value of keypath as default.`);
|
return key;
|
}
|
return this.formater.interpolate(message[key], values).join("");
|
}
|
}
|
function watchAppLocale(appVm, i18n) {
|
if (appVm.$watchLocale) {
|
appVm.$watchLocale((newLocale) => {
|
i18n.setLocale(newLocale);
|
});
|
} else {
|
appVm.$watch(() => appVm.$locale, (newLocale) => {
|
i18n.setLocale(newLocale);
|
});
|
}
|
}
|
function getDefaultLocale() {
|
if (typeof uni !== "undefined" && uni.getLocale) {
|
return uni.getLocale();
|
}
|
if (typeof global !== "undefined" && global.getLocale) {
|
return global.getLocale();
|
}
|
return LOCALE_EN;
|
}
|
function initVueI18n(locale, messages2 = {}, fallbackLocale, watcher) {
|
if (typeof locale !== "string") {
|
const options = [
|
messages2,
|
locale
|
];
|
locale = options[0];
|
messages2 = options[1];
|
}
|
if (typeof locale !== "string") {
|
locale = getDefaultLocale();
|
}
|
if (typeof fallbackLocale !== "string") {
|
fallbackLocale = typeof __uniConfig !== "undefined" && __uniConfig.fallbackLocale || LOCALE_EN;
|
}
|
const i18n = new I18n({
|
locale,
|
fallbackLocale,
|
messages: messages2,
|
watcher
|
});
|
let t2 = (key, values) => {
|
if (typeof getApp !== "function") {
|
t2 = function(key2, values2) {
|
return i18n.t(key2, values2);
|
};
|
} else {
|
let isWatchedAppLocale = false;
|
t2 = function(key2, values2) {
|
const appVm = getApp().$vm;
|
if (appVm) {
|
appVm.$locale;
|
if (!isWatchedAppLocale) {
|
isWatchedAppLocale = true;
|
watchAppLocale(appVm, i18n);
|
}
|
}
|
return i18n.t(key2, values2);
|
};
|
}
|
return t2(key, values);
|
};
|
return {
|
i18n,
|
f(message, values, delimiters) {
|
return i18n.f(message, values, delimiters);
|
},
|
t(key, values) {
|
return t2(key, values);
|
},
|
add(locale2, message, override = true) {
|
return i18n.add(locale2, message, override);
|
},
|
watch(fn) {
|
return i18n.watchLocale(fn);
|
},
|
getLocale() {
|
return i18n.getLocale();
|
},
|
setLocale(newLocale) {
|
return i18n.setLocale(newLocale);
|
}
|
};
|
}
|
const en$1 = {
|
"uni-popup.cancel": "cancel",
|
"uni-popup.ok": "ok",
|
"uni-popup.placeholder": "pleace enter",
|
"uni-popup.title": "Hint",
|
"uni-popup.shareTitle": "Share to"
|
};
|
const zhHans$1 = {
|
"uni-popup.cancel": "取消",
|
"uni-popup.ok": "确定",
|
"uni-popup.placeholder": "请输入",
|
"uni-popup.title": "提示",
|
"uni-popup.shareTitle": "分享到"
|
};
|
const zhHant$1 = {
|
"uni-popup.cancel": "取消",
|
"uni-popup.ok": "確定",
|
"uni-popup.placeholder": "請輸入",
|
"uni-popup.title": "提示",
|
"uni-popup.shareTitle": "分享到"
|
};
|
const messages = {
|
en: en$1,
|
"zh-Hans": zhHans$1,
|
"zh-Hant": zhHant$1
|
};
|
const {
|
t: t$3
|
} = initVueI18n(messages);
|
const _sfc_main$q = {
|
name: "uniPopupDialog",
|
mixins: [popup],
|
emits: ["confirm", "close", "update:modelValue", "input"],
|
props: {
|
inputType: {
|
type: String,
|
default: "text"
|
},
|
showClose: {
|
type: Boolean,
|
default: true
|
},
|
modelValue: {
|
type: [Number, String],
|
default: ""
|
},
|
placeholder: {
|
type: [String, Number],
|
default: ""
|
},
|
type: {
|
type: String,
|
default: "error"
|
},
|
mode: {
|
type: String,
|
default: "base"
|
},
|
title: {
|
type: String,
|
default: ""
|
},
|
content: {
|
type: String,
|
default: ""
|
},
|
beforeClose: {
|
type: Boolean,
|
default: false
|
},
|
cancelText: {
|
type: String,
|
default: ""
|
},
|
confirmText: {
|
type: String,
|
default: ""
|
},
|
maxlength: {
|
type: Number,
|
default: -1
|
},
|
focus: {
|
type: Boolean,
|
default: true
|
}
|
},
|
data() {
|
return {
|
dialogType: "error",
|
val: ""
|
};
|
},
|
computed: {
|
okText() {
|
return this.confirmText || t$3("uni-popup.ok");
|
},
|
closeText() {
|
return this.cancelText || t$3("uni-popup.cancel");
|
},
|
placeholderText() {
|
return this.placeholder || t$3("uni-popup.placeholder");
|
},
|
titleText() {
|
return this.title || t$3("uni-popup.title");
|
}
|
},
|
watch: {
|
type(val) {
|
this.dialogType = val;
|
},
|
mode(val) {
|
if (val === "input") {
|
this.dialogType = "info";
|
}
|
},
|
value(val) {
|
if (this.maxlength != -1 && this.mode === "input") {
|
this.val = val.slice(0, this.maxlength);
|
} else {
|
this.val = val;
|
}
|
},
|
val(val) {
|
this.$emit("update:modelValue", val);
|
}
|
},
|
created() {
|
this.popup.disableMask();
|
if (this.mode === "input") {
|
this.dialogType = "info";
|
this.val = this.value;
|
this.val = this.modelValue;
|
} else {
|
this.dialogType = this.type;
|
}
|
},
|
methods: {
|
/**
|
* 点击确认按钮
|
*/
|
onOk() {
|
if (this.mode === "input") {
|
this.$emit("confirm", this.val);
|
} else {
|
this.$emit("confirm");
|
}
|
if (this.beforeClose)
|
return;
|
this.popup.close();
|
},
|
/**
|
* 点击取消按钮
|
*/
|
closeDialog() {
|
this.$emit("close");
|
if (this.beforeClose)
|
return;
|
this.popup.close();
|
},
|
close() {
|
this.popup.close();
|
}
|
}
|
};
|
function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-popup-dialog" }, [
|
vue.createElementVNode("view", { class: "uni-dialog-title" }, [
|
vue.createElementVNode(
|
"text",
|
{
|
class: vue.normalizeClass(["uni-dialog-title-text", ["uni-popup__" + $data.dialogType]])
|
},
|
vue.toDisplayString($options.titleText),
|
3
|
/* TEXT, CLASS */
|
)
|
]),
|
$props.mode === "base" ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
class: "uni-dialog-content"
|
}, [
|
vue.renderSlot(_ctx.$slots, "default", {}, () => [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-dialog-content-text" },
|
vue.toDisplayString($props.content),
|
1
|
/* TEXT */
|
)
|
], true)
|
])) : (vue.openBlock(), vue.createElementBlock("view", {
|
key: 1,
|
class: "uni-dialog-content"
|
}, [
|
vue.renderSlot(_ctx.$slots, "default", {}, () => [
|
vue.withDirectives(vue.createElementVNode("input", {
|
class: "uni-dialog-input",
|
maxlength: $props.maxlength,
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.val = $event),
|
type: $props.inputType,
|
placeholder: $options.placeholderText,
|
focus: $props.focus
|
}, null, 8, ["maxlength", "type", "placeholder", "focus"]), [
|
[vue.vModelDynamic, $data.val]
|
])
|
], true)
|
])),
|
vue.createElementVNode("view", { class: "uni-dialog-button-group" }, [
|
$props.showClose ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
class: "uni-dialog-button",
|
onClick: _cache[1] || (_cache[1] = (...args) => $options.closeDialog && $options.closeDialog(...args))
|
}, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-dialog-button-text" },
|
vue.toDisplayString($options.closeText),
|
1
|
/* TEXT */
|
)
|
])) : vue.createCommentVNode("v-if", true),
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-dialog-button", $props.showClose ? "uni-border-left" : ""]),
|
onClick: _cache[2] || (_cache[2] = (...args) => $options.onOk && $options.onOk(...args))
|
},
|
[
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-dialog-button-text uni-button-color" },
|
vue.toDisplayString($options.okText),
|
1
|
/* TEXT */
|
)
|
],
|
2
|
/* CLASS */
|
)
|
])
|
]);
|
}
|
const __easycom_7 = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$p], ["__scopeId", "data-v-678a307f"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue"]]);
|
const _sfc_main$p = {
|
__name: "reportingWork",
|
setup(__props, { expose: __expose }) {
|
__expose();
|
const store = userInfo();
|
let processId = vue.ref(null);
|
let process = vue.ref(null);
|
let damageShowFlag = vue.ref(false);
|
let damageShowProcessIndex = vue.ref(-1);
|
let damageShowRow = vue.ref(0);
|
let processTitle = vue.ref(null);
|
let processList = vue.ref([]);
|
let buttonLoading = vue.ref(true);
|
const alertDialog = vue.ref(null);
|
const message = vue.ref(null);
|
const popup2 = vue.ref(null);
|
const type = vue.ref("center");
|
const msgType = vue.ref("success");
|
const messageText = vue.ref("");
|
const reportworkList = vue.ref([]);
|
const titleSelectJson = vue.ref({
|
historyDevice: [],
|
historyTeams: [],
|
historyProcess: [],
|
breakageType: [],
|
breakageReason: []
|
});
|
const damageDetail = vue.ref({
|
breakageQuantity: null,
|
//破损数量
|
available: null,
|
//可利用
|
returnProcess: null,
|
//返回工序
|
breakageType: null,
|
//破损类型
|
breakageReason: null,
|
//原因
|
responsibleProcess: null,
|
//责任工序
|
responsibleEquipment: null,
|
//责任设备
|
responsibleTeam: null,
|
//责任班组
|
responsiblePersonnel: null
|
//责任信息
|
});
|
const messageToggle = (type2, msg) => {
|
msgType.value = type2;
|
messageText.value = msg;
|
message.value.open();
|
};
|
onLoad(async (option) => {
|
processId.value = option.processId;
|
process.value = option.process;
|
await getProcessCardList(option.processId, option.process);
|
buttonLoading.value = false;
|
});
|
const getProcessCardList = (processId1, process1) => {
|
if (processId1.indexOf("/") !== 14) {
|
uni.showModal({
|
title: "提示",
|
content: "请输入正确格式的流程卡",
|
showCancel: false
|
});
|
return;
|
}
|
const processIdList = processId1.split("/");
|
if (processIdList[1].length > 1) {
|
uni.showModal({
|
title: "提示",
|
content: "app不支持多层合并二维码",
|
showCancel: false
|
});
|
return;
|
}
|
const reportType = 2;
|
request.post(`/reportingWork/addSelectLastWork/${processIdList[0]}/${processIdList[1]}/${process1}/${reportType}`).then((res) => {
|
if (res.code == 200) {
|
const reportData = {};
|
reportData.processList = res.data.Detail;
|
res.data.data.processId = processId1;
|
reportData.processTitle = res.data.data;
|
reportworkList.value.push(reportData);
|
reportworkList.value.length - 1;
|
res.data.historyTeams.unshift(
|
{
|
basic_name: store.user.userName,
|
process: process.value
|
}
|
);
|
titleSelectJson.value.historyTeams = res.data.historyTeams;
|
titleSelectJson.value.historyDevice = res.data.historyDevice;
|
titleSelectJson.value.historyProcess = res.data.historyProcess;
|
titleSelectJson.value.breakageType = res.data.breakageType;
|
titleSelectJson.value.breakageReason = res.data.breakageReason;
|
}
|
}).catch((err) => {
|
uni.showModal({
|
title: "提示",
|
content: err,
|
showCancel: false
|
});
|
});
|
};
|
const saveReportForWork = () => {
|
for (let item of reportworkList.value) {
|
const finishNumVal = finishNum(item.processList);
|
if (finishNumVal === 0) {
|
messageToggle("error", `${item.processTitle.processId}完工数量或次破数量至少大于0`);
|
return;
|
}
|
let notSame = null;
|
for (let i2 in item.processList) {
|
if (item.processList[i2].breakageQuantity !== void 0 && item.processList[i2].breakageQuantity !== null && item.processList[i2].breakageQuantity !== "") {
|
if (item.processList[i2].damageDetails === void 0) {
|
messageToggle("error", `序号'${item.processList[i2].order_number}'未检测到次破数据`);
|
return;
|
} else {
|
if (item.processList[i2].damageDetails[0].breakageQuantity * 1 !== item.processList[i2].breakageQuantity * 1) {
|
messageToggle("error", `序号'${item.processList[i2].order_number}'次破数量不匹配`);
|
return;
|
}
|
}
|
} else {
|
delete item.processList[i2].breakageQuantity;
|
}
|
}
|
const hasConflict = item.processList.some((item1, index) => {
|
return item.processList.slice(index + 1).some(
|
(other) => {
|
if (other.order_number === item1.order_number && other.completedQuantity !== item1.completedQuantity || other.quantity < other.completedQuantity) {
|
notSame = other;
|
return true;
|
}
|
}
|
);
|
});
|
if (hasConflict) {
|
messageToggle("error", `流程卡${item.processTitle.processId} 序号'${notSame.order_number}'同序号完工不相同或数量超过总数`);
|
return;
|
}
|
item.processTitle.teamsGroupsName = store.user.userName;
|
item.processTitle.deviceName = store.choiceDevice.text || "phone";
|
item.processTitle.deviceId = store.choiceDevice.value || "";
|
item.processTitle.creatorId = store.user.userId;
|
item.processTitle.creator = store.user.userName;
|
item.processTitle.classes = store.user.class;
|
}
|
buttonLoading.value = true;
|
const requestData = {
|
reportingWorks: reportworkList.value,
|
type: 0,
|
//审核状态
|
userId: store.user.userId,
|
userName: store.user.userName,
|
qualityInsStatus: 2
|
//跨工序质检审核,1不需要,2需要
|
};
|
request.post(`/app/addWorkInProgress`, requestData).then((res) => {
|
if (res.code == 200) {
|
if (allQuantity(reportworkList.value[0].processList) > finishNum(reportworkList.value[0].processList) && reportworkList.value.length === 1) {
|
alertDialog.value.open();
|
} else {
|
uni.reLaunch({
|
url: `/pages/mainView/mainView?state=success`
|
});
|
}
|
} else {
|
const errorObj = JSON.parse(res.msg);
|
const msg = t("reportingWorks.pleaseNumber1") + ":" + errorObj.orderNumber + "\n" + t("reportingWorks.pleaseNumber2") + ":" + errorObj.technologyNumber + "\n" + t("reportingWorks.pleaseNumber3") + ":" + errorObj.processNum + "<" + +t("reportingWorks.pleaseNumber4") + ":" + errorObj.sumNum + "\n" + t("reportingWorks.pleaseNumber5");
|
messageToggle("error", msg);
|
}
|
}).catch((err) => {
|
uni.showModal({
|
title: "提示",
|
content: err,
|
showCancel: false
|
});
|
}).finally(() => {
|
buttonLoading.value = false;
|
});
|
};
|
const dialogConfirm = () => {
|
uni.reLaunch({
|
url: `/pages/mainView/mainView?state=success`
|
});
|
};
|
const dialogClose = () => {
|
uni.redirectTo({
|
url: `/pages/reportingWork/reportingWork?processId=${processId.value}`
|
});
|
};
|
const reviewReportForWork = () => {
|
const reportWork = {
|
process: processTitle.value.previousProcess,
|
processId: processId.value,
|
thisProcess: processTitle.value.thisProcess,
|
technologyStr: processId.value.split("/")[1],
|
userName: store.user.userName
|
};
|
request.post("/reportingWork/reviewReportingWork", reportWork).then((res) => {
|
if (res.code === "200") {
|
uni.redirectTo({
|
url: `/pages/reportingWork/reportingWork?processId=${processId.value}`
|
});
|
}
|
}).catch((err) => {
|
uni.showModal({
|
title: "提示",
|
content: err,
|
showCancel: false
|
});
|
});
|
};
|
const allQuantity = (processList2) => {
|
let sum = 0;
|
processList2.forEach((item) => {
|
let quantity = item.quantity * 1 || 0;
|
sum += quantity;
|
});
|
return sum;
|
};
|
const finishNum = (processList2) => {
|
let sum = 0;
|
processList2.forEach((item) => {
|
let finish = item.completedQuantity * 1 || 0;
|
let breakNum = item.breakageQuantity * 1 || 0;
|
sum += finish;
|
sum += breakNum;
|
});
|
return sum;
|
};
|
const backProcess = vue.ref([]);
|
const changeAvailable = (e2) => {
|
backProcess.value = [];
|
if (e2.detail.value.length) {
|
damageDetail.value.available = 1;
|
titleSelectJson.value.historyProcess.forEach((item) => {
|
backProcess.value.push({
|
value: item.basic_category,
|
text: item.basic_category
|
});
|
});
|
} else {
|
damageDetail.value.available = null;
|
damageDetail.value.returnProcess = null;
|
}
|
};
|
const responsibleProcess = vue.computed(() => {
|
let list = [];
|
titleSelectJson.value.historyProcess.forEach((item) => {
|
list.push({
|
value: item.basic_category,
|
text: item.basic_category
|
});
|
});
|
return list;
|
});
|
const breakageType = vue.computed(() => {
|
let list = [];
|
titleSelectJson.value.breakageType.forEach((item) => {
|
list.push({
|
value: item.basic_name,
|
text: item.basic_name
|
});
|
});
|
return list;
|
});
|
const breakageReason = vue.computed(() => {
|
let list = [];
|
titleSelectJson.value.breakageReason.forEach((item) => {
|
list.push({
|
value: item.basic_name,
|
text: item.basic_name
|
});
|
});
|
return list;
|
});
|
const responsibleEquipment = vue.ref([]);
|
const responsibleTeam = vue.ref([]);
|
const changeResponsibleProcess = () => {
|
responsibleEquipment.value = [];
|
responsibleTeam.value = [];
|
damageDetail.value.responsibleEquipment = null;
|
damageDetail.value.responsibleTeam = null;
|
titleSelectJson.value.historyDevice.forEach((item) => {
|
if (item.basic_category === damageDetail.value.responsibleProcess) {
|
responsibleEquipment.value.push({
|
value: item.basic_name,
|
text: item.basic_name
|
});
|
}
|
});
|
titleSelectJson.value.historyTeams.forEach((item) => {
|
if (item.process === damageDetail.value.responsibleProcess) {
|
responsibleTeam.value.push({
|
value: item.basic_name,
|
text: item.basic_name
|
});
|
}
|
});
|
};
|
const changeFinishNum = (row) => {
|
damageShowFlag.value = false;
|
const finishNum2 = row.completedQuantity * 1 || 0;
|
const breakNum = row.breakageQuantity * 1 || 0;
|
if (row.quantity - finishNum2 - breakNum < 0) {
|
row.completedQuantity = null;
|
return;
|
}
|
reportworkList.value.forEach((items) => {
|
items.processList.forEach((item) => {
|
if (item.order_number == row.order_number && finishNum2 <= item.quantity) {
|
item.completedQuantity = finishNum2;
|
}
|
});
|
});
|
};
|
const changeBreakNum = (row, index, index1) => {
|
row.completedQuantity * 1 || 0;
|
const breakNum = row.breakageQuantity * 1 || 0;
|
if (row.quantity - breakNum < 0) {
|
row.breakageQuantity = null;
|
return;
|
}
|
row.completedQuantity = row.quantity - breakNum;
|
if (reportworkList.value[index1].processList[index].damageDetails) {
|
damageDetail.value = reportworkList.value[index1].processList[index].damageDetails[0];
|
} else {
|
for (let index2 in damageDetail.value) {
|
damageDetail.value[index2] = null;
|
}
|
}
|
if (breakNum * 1 > 0) {
|
damageDetail.value.breakageQuantity = breakNum * 1;
|
damageShowRow.value = index + 1;
|
damageShowProcessIndex = index1;
|
popup2.value.open();
|
} else {
|
delete reportworkList.value[index1].processList[index].damageDetails;
|
for (let index2 in damageDetail.value) {
|
damageDetail.value[index2] = null;
|
}
|
}
|
};
|
const rules = {
|
breakageType: "请选择次破类型",
|
breakageReason: "请选择次破原因",
|
responsibleProcess: "请选择责任工序",
|
responsibleEquipment: "请选择责任设备",
|
responsibleTeam: "请选择责任班组",
|
returnProcess: "可利用已勾选,请选择返回工序"
|
};
|
const close = (type2) => {
|
if (type2 === 1) {
|
for (let item in rules) {
|
if (!damageDetail.value[item] && item !== "returnProcess") {
|
messageToggle("error", rules[item]);
|
return;
|
} else if (item === "returnProcess" && !damageDetail.value[item] && damageDetail.value["available"]) {
|
messageToggle("error", rules[item]);
|
return;
|
}
|
}
|
reportworkList.value[damageShowProcessIndex].processList[damageShowRow.value - 1].damageDetails = [
|
JSON.parse(JSON.stringify(damageDetail.value))
|
];
|
} else {
|
delete reportworkList.value[damageShowProcessIndex].processList[damageShowRow.value - 1].breakageQuantity;
|
delete reportworkList.value[damageShowProcessIndex].processList[damageShowRow.value - 1].damageDetails;
|
}
|
popup2.value.close();
|
};
|
const cleanAllFinish = (index) => {
|
try {
|
reportworkList.value[index].processList.forEach((item) => {
|
item.completedQuantity = 0;
|
});
|
} catch (e2) {
|
}
|
};
|
const scannerCode = () => {
|
if (reportworkList.length > 6) {
|
messageToggle("error", "最多支持6个流程卡同时报工");
|
}
|
mpaasScan().then((val) => {
|
for (let items of reportworkList.value) {
|
for (let item of items.processList) {
|
const prcoessCard = items.processTitle.flowCard.processId + "/" + item.technology_number;
|
if (prcoessCard === val) {
|
messageToggle("error", "此流程卡已存在列表当中");
|
return;
|
}
|
}
|
}
|
getProcessCardList(val, process.value);
|
});
|
};
|
const deleteProcess = (indexVal) => {
|
reportworkList.value.splice(indexVal, 1);
|
};
|
const __returned__ = { store, get processId() {
|
return processId;
|
}, set processId(v2) {
|
processId = v2;
|
}, get process() {
|
return process;
|
}, set process(v2) {
|
process = v2;
|
}, get damageShowFlag() {
|
return damageShowFlag;
|
}, set damageShowFlag(v2) {
|
damageShowFlag = v2;
|
}, get damageShowProcessIndex() {
|
return damageShowProcessIndex;
|
}, set damageShowProcessIndex(v2) {
|
damageShowProcessIndex = v2;
|
}, get damageShowRow() {
|
return damageShowRow;
|
}, set damageShowRow(v2) {
|
damageShowRow = v2;
|
}, get processTitle() {
|
return processTitle;
|
}, set processTitle(v2) {
|
processTitle = v2;
|
}, get processList() {
|
return processList;
|
}, set processList(v2) {
|
processList = v2;
|
}, get buttonLoading() {
|
return buttonLoading;
|
}, set buttonLoading(v2) {
|
buttonLoading = v2;
|
}, alertDialog, message, popup: popup2, type, msgType, messageText, reportworkList, titleSelectJson, damageDetail, messageToggle, getProcessCardList, saveReportForWork, dialogConfirm, dialogClose, reviewReportForWork, allQuantity, finishNum, backProcess, changeAvailable, responsibleProcess, breakageType, breakageReason, responsibleEquipment, responsibleTeam, changeResponsibleProcess, changeFinishNum, changeBreakNum, rules, close, cleanAllFinish, scannerCode, deleteProcess, computed: vue.computed, onMounted: vue.onMounted, ref: vue.ref, watch: vue.watch, get onLoad() {
|
return onLoad;
|
}, get userInfo() {
|
return userInfo;
|
}, get request() {
|
return request;
|
}, get mpaasScan() {
|
return mpaasScan;
|
} };
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
return __returned__;
|
}
|
};
|
function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_uni_section = resolveEasycom(vue.resolveDynamicComponent("uni-section"), __easycom_0$4);
|
const _component_uni_th = resolveEasycom(vue.resolveDynamicComponent("uni-th"), __easycom_1$3);
|
const _component_uni_tr = resolveEasycom(vue.resolveDynamicComponent("uni-tr"), __easycom_2);
|
const _component_uni_td = resolveEasycom(vue.resolveDynamicComponent("uni-td"), __easycom_4);
|
const _component_uni_table = resolveEasycom(vue.resolveDynamicComponent("uni-table"), __easycom_5);
|
const _component_uni_col = resolveEasycom(vue.resolveDynamicComponent("uni-col"), __easycom_8);
|
const _component_uni_row = resolveEasycom(vue.resolveDynamicComponent("uni-row"), __easycom_9);
|
const _component_uni_data_select = resolveEasycom(vue.resolveDynamicComponent("uni-data-select"), __easycom_7$2);
|
const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_7$1);
|
const _component_uni_popup_dialog = resolveEasycom(vue.resolveDynamicComponent("uni-popup-dialog"), __easycom_7);
|
const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_6);
|
return vue.openBlock(), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
[
|
vue.createElementVNode("view", { class: "main" }, [
|
vue.createElementVNode("view", { class: "flex-item title_main" }, [
|
vue.createVNode(_component_uni_section, {
|
class: "title_section",
|
title: ""
|
}, {
|
right: vue.withCtx(() => [
|
vue.createElementVNode("button", {
|
onClick: $setup.scannerCode,
|
class: "scanner_code",
|
size: "mini"
|
}, "再次扫码"),
|
$setup.reportworkList.length > 0 ? (vue.openBlock(), vue.createElementBlock("button", {
|
key: 0,
|
onClick: $setup.saveReportForWork,
|
class: "reporting_work",
|
size: "mini"
|
}, "审核报工")) : vue.createCommentVNode("v-if", true)
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
vue.createElementVNode("view", { class: "flex-item table_main" }, [
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($setup.reportworkList, (items, index1) => {
|
return vue.openBlock(), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
[
|
vue.createVNode(_component_uni_section, {
|
title: "流程卡号:" + items.processTitle.processId,
|
type: "line"
|
}, {
|
right: vue.withCtx(() => [
|
$setup.reportworkList.length > 1 ? (vue.openBlock(), vue.createElementBlock("button", {
|
key: 0,
|
onClick: ($event) => $setup.deleteProcess(index1),
|
size: "mini"
|
}, "移除", 8, ["onClick"])) : vue.createCommentVNode("v-if", true)
|
]),
|
_: 2
|
/* DYNAMIC */
|
}, 1032, ["title"]),
|
vue.createVNode(
|
_component_uni_table,
|
{
|
border: "",
|
stripe: "",
|
style: { "width": "100%", "overflow-y": "auto", "margin-bottom": "1rem" }
|
},
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(
|
_component_uni_tr,
|
null,
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_th, {
|
width: "48",
|
align: "center"
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("序号")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, {
|
width: "48",
|
align: "center"
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("小片")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, {
|
width: "50",
|
align: "center"
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("宽")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, {
|
width: "50",
|
align: "center"
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("高")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, {
|
width: "50",
|
align: "center"
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("总数")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, {
|
onClick: ($event) => $setup.cleanAllFinish(index1),
|
width: "50",
|
align: "center",
|
style: { "background-color": "#409eff", "color": "black" }
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("完工")
|
]),
|
_: 2
|
/* DYNAMIC */
|
}, 1032, ["onClick"]),
|
vue.createVNode(_component_uni_th, {
|
width: "50",
|
align: "center"
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("次破")
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList(items.processList, (item, index) => {
|
return vue.openBlock(), vue.createBlock(
|
_component_uni_tr,
|
null,
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(
|
_component_uni_td,
|
null,
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.order_number),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
null,
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.technology_number),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
null,
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.child_width),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
null,
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.child_height),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
null,
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.quantity),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
null,
|
{
|
default: vue.withCtx(() => [
|
vue.createCommentVNode(" @keyboardheightchange @blur"),
|
vue.withDirectives(vue.createElementVNode("input", {
|
type: "number",
|
"onUpdate:modelValue": ($event) => item.completedQuantity = $event,
|
onConfirm: ($event) => $setup.changeFinishNum(item),
|
onBlur: ($event) => $setup.changeFinishNum(item)
|
}, null, 40, ["onUpdate:modelValue", "onConfirm", "onBlur"]), [
|
[vue.vModelText, item.completedQuantity]
|
])
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
null,
|
{
|
default: vue.withCtx(() => [
|
vue.withDirectives(vue.createElementVNode("input", {
|
type: "number",
|
"onUpdate:modelValue": ($event) => item.breakageQuantity = $event,
|
onConfirm: ($event) => $setup.changeBreakNum(item, index, index1),
|
onBlur: ($event) => $setup.changeBreakNum(item, index, index1)
|
}, null, 40, ["onUpdate:modelValue", "onConfirm", "onBlur"]), [
|
[vue.vModelText, item.breakageQuantity]
|
])
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
);
|
}),
|
256
|
/* UNKEYED_FRAGMENT */
|
))
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
)
|
],
|
64
|
/* STABLE_FRAGMENT */
|
);
|
}),
|
256
|
/* UNKEYED_FRAGMENT */
|
))
|
]),
|
vue.createCommentVNode(' <view class="flex-item uni-bg-blue">C</view> ')
|
]),
|
vue.createCommentVNode(" 次破弹出层 "),
|
vue.createVNode(
|
_component_uni_popup,
|
{
|
class: "breakInfo",
|
ref: "popup",
|
"mask-click": false
|
},
|
{
|
default: vue.withCtx(() => [
|
vue.createElementVNode("view", { class: "flex-item foot_main" }, [
|
vue.createVNode(_component_uni_row, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 24
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
"第" + vue.toDisplayString($setup.damageShowRow) + "行",
|
1
|
/* TEXT */
|
)
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_row, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 8
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("次破类型:")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 16
|
}, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_data_select, {
|
modelValue: $setup.damageDetail.breakageType,
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.damageDetail.breakageType = $event),
|
localdata: $setup.breakageType
|
}, null, 8, ["modelValue", "localdata"])
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_row, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 8
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("次破原因:")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 16
|
}, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_data_select, {
|
modelValue: $setup.damageDetail.breakageReason,
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $setup.damageDetail.breakageReason = $event),
|
localdata: $setup.breakageReason
|
}, null, 8, ["modelValue", "localdata"])
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_row, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 8
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("责任工序:")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 16
|
}, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_data_select, {
|
modelValue: $setup.damageDetail.responsibleProcess,
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $setup.damageDetail.responsibleProcess = $event),
|
localdata: $setup.responsibleProcess,
|
onChange: $setup.changeResponsibleProcess
|
}, null, 8, ["modelValue", "localdata"])
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_row, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 8
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("责任设备:")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 16
|
}, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_data_select, {
|
modelValue: $setup.damageDetail.responsibleEquipment,
|
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $setup.damageDetail.responsibleEquipment = $event),
|
localdata: $setup.responsibleEquipment
|
}, null, 8, ["modelValue", "localdata"])
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_row, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 8
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("责任班组:")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 16
|
}, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_data_select, {
|
modelValue: $setup.damageDetail.responsibleTeam,
|
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $setup.damageDetail.responsibleTeam = $event),
|
localdata: $setup.responsibleTeam
|
}, null, 8, ["modelValue", "localdata"])
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_row, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 8
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("可利用:")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 16
|
}, {
|
default: vue.withCtx(() => [
|
vue.createElementVNode(
|
"checkbox-group",
|
{
|
onChange: _cache[5] || (_cache[5] = ($event) => $setup.changeAvailable($event))
|
},
|
[
|
vue.createElementVNode("checkbox", { value: 1 })
|
],
|
32
|
/* NEED_HYDRATION */
|
)
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_row, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 8
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("返回工序:")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 16
|
}, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_data_select, {
|
modelValue: $setup.damageDetail.returnProcess,
|
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $setup.damageDetail.returnProcess = $event),
|
localdata: $setup.backProcess
|
}, null, 8, ["modelValue", "localdata"])
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_row, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 8
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("责任信息:")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, {
|
class: "break_col",
|
span: 16
|
}, {
|
default: vue.withCtx(() => [
|
vue.withDirectives(vue.createElementVNode(
|
"input",
|
{
|
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $setup.damageDetail.responsiblePersonnel = $event)
|
},
|
null,
|
512
|
/* NEED_PATCH */
|
), [
|
[vue.vModelText, $setup.damageDetail.responsiblePersonnel]
|
])
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
vue.createElementVNode("view", null, [
|
vue.createVNode(_component_uni_row, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_col, { span: 12 }, {
|
default: vue.withCtx(() => [
|
vue.createElementVNode("button", {
|
onClick: _cache[8] || (_cache[8] = ($event) => $setup.close(0))
|
}, "取消")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, { span: 12 }, {
|
default: vue.withCtx(() => [
|
vue.createElementVNode("button", {
|
type: "primary",
|
onClick: _cache[9] || (_cache[9] = ($event) => $setup.close(1))
|
}, "确定")
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
})
|
])
|
]),
|
_: 1
|
/* STABLE */
|
},
|
512
|
/* NEED_PATCH */
|
),
|
vue.createCommentVNode(" 提示弹窗 "),
|
vue.createElementVNode("view", null, [
|
vue.createCommentVNode(" 提示窗示例 "),
|
vue.createVNode(
|
_component_uni_popup,
|
{
|
ref: "alertDialog",
|
type: "dialog"
|
},
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_popup_dialog, {
|
type: "warn",
|
cancelText: "再次报工",
|
confirmText: "确认完成",
|
title: "通知",
|
content: "流程卡数量还未全部报完!",
|
onConfirm: $setup.dialogConfirm,
|
onClose: $setup.dialogClose
|
})
|
]),
|
_: 1
|
/* STABLE */
|
},
|
512
|
/* NEED_PATCH */
|
)
|
]),
|
vue.createElementVNode("view", null, [
|
vue.createCommentVNode(" 提示信息弹窗 "),
|
vue.createVNode(
|
_component_uni_popup,
|
{
|
ref: "message",
|
type: "message"
|
},
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_popup_message, {
|
type: $setup.msgType,
|
message: $setup.messageText,
|
duration: 3e3
|
}, null, 8, ["type", "message"])
|
]),
|
_: 1
|
/* STABLE */
|
},
|
512
|
/* NEED_PATCH */
|
)
|
])
|
],
|
64
|
/* STABLE_FRAGMENT */
|
);
|
}
|
const PagesReportingWorkReportingWork = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$o], ["__file", "D:/Documents/app/qrcodeScaner/pages/reportingWork/reportingWork.vue"]]);
|
const _sfc_main$o = {
|
name: "UniBadge",
|
emits: ["click"],
|
props: {
|
type: {
|
type: String,
|
default: "error"
|
},
|
inverted: {
|
type: Boolean,
|
default: false
|
},
|
isDot: {
|
type: Boolean,
|
default: false
|
},
|
maxNum: {
|
type: Number,
|
default: 99
|
},
|
absolute: {
|
type: String,
|
default: ""
|
},
|
offset: {
|
type: Array,
|
default() {
|
return [0, 0];
|
}
|
},
|
text: {
|
type: [String, Number],
|
default: ""
|
},
|
size: {
|
type: String,
|
default: "small"
|
},
|
customStyle: {
|
type: Object,
|
default() {
|
return {};
|
}
|
}
|
},
|
data() {
|
return {};
|
},
|
computed: {
|
width() {
|
return String(this.text).length * 8 + 12;
|
},
|
classNames() {
|
const {
|
inverted,
|
type,
|
size,
|
absolute
|
} = this;
|
return [
|
inverted ? "uni-badge--" + type + "-inverted" : "",
|
"uni-badge--" + type,
|
"uni-badge--" + size,
|
absolute ? "uni-badge--absolute" : ""
|
].join(" ");
|
},
|
positionStyle() {
|
if (!this.absolute)
|
return {};
|
let w2 = this.width / 2, h2 = 10;
|
if (this.isDot) {
|
w2 = 5;
|
h2 = 5;
|
}
|
const x = `${-w2 + this.offset[0]}px`;
|
const y2 = `${-h2 + this.offset[1]}px`;
|
const whiteList = {
|
rightTop: {
|
right: x,
|
top: y2
|
},
|
rightBottom: {
|
right: x,
|
bottom: y2
|
},
|
leftBottom: {
|
left: x,
|
bottom: y2
|
},
|
leftTop: {
|
left: x,
|
top: y2
|
}
|
};
|
const match = whiteList[this.absolute];
|
return match ? match : whiteList["rightTop"];
|
},
|
dotStyle() {
|
if (!this.isDot)
|
return {};
|
return {
|
width: "10px",
|
minWidth: "0",
|
height: "10px",
|
padding: "0",
|
borderRadius: "10px"
|
};
|
},
|
displayValue() {
|
const {
|
isDot,
|
text,
|
maxNum
|
} = this;
|
return isDot ? "" : Number(text) > maxNum ? `${maxNum}+` : text;
|
}
|
},
|
methods: {
|
onClick() {
|
this.$emit("click");
|
}
|
}
|
};
|
function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-badge--x" }, [
|
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true),
|
$props.text ? (vue.openBlock(), vue.createElementBlock(
|
"text",
|
{
|
key: 0,
|
class: vue.normalizeClass([$options.classNames, "uni-badge"]),
|
style: vue.normalizeStyle([$options.positionStyle, $props.customStyle, $options.dotStyle]),
|
onClick: _cache[0] || (_cache[0] = ($event) => $options.onClick())
|
},
|
vue.toDisplayString($options.displayValue),
|
7
|
/* TEXT, CLASS, STYLE */
|
)) : vue.createCommentVNode("v-if", true)
|
]);
|
}
|
const __easycom_1$2 = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$n], ["__scopeId", "data-v-92d7b819"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-badge/uni-badge.vue"]]);
|
const _sfc_main$n = {
|
name: "UniListItem",
|
emits: ["click", "switchChange"],
|
props: {
|
direction: {
|
type: String,
|
default: "row"
|
},
|
title: {
|
type: String,
|
default: ""
|
},
|
note: {
|
type: String,
|
default: ""
|
},
|
ellipsis: {
|
type: [Number, String],
|
default: 0
|
},
|
disabled: {
|
type: [Boolean, String],
|
default: false
|
},
|
clickable: {
|
type: Boolean,
|
default: false
|
},
|
showArrow: {
|
type: [Boolean, String],
|
default: false
|
},
|
link: {
|
type: [Boolean, String],
|
default: false
|
},
|
to: {
|
type: String,
|
default: ""
|
},
|
showBadge: {
|
type: [Boolean, String],
|
default: false
|
},
|
showSwitch: {
|
type: [Boolean, String],
|
default: false
|
},
|
switchChecked: {
|
type: [Boolean, String],
|
default: false
|
},
|
badgeText: {
|
type: String,
|
default: ""
|
},
|
badgeType: {
|
type: String,
|
default: "success"
|
},
|
badgeStyle: {
|
type: Object,
|
default() {
|
return {};
|
}
|
},
|
rightText: {
|
type: String,
|
default: ""
|
},
|
thumb: {
|
type: String,
|
default: ""
|
},
|
thumbSize: {
|
type: String,
|
default: "base"
|
},
|
showExtraIcon: {
|
type: [Boolean, String],
|
default: false
|
},
|
extraIcon: {
|
type: Object,
|
default() {
|
return {
|
type: "",
|
color: "#000000",
|
size: 20,
|
customPrefix: ""
|
};
|
}
|
},
|
border: {
|
type: Boolean,
|
default: true
|
},
|
customStyle: {
|
type: Object,
|
default() {
|
return {
|
padding: "",
|
backgroundColor: "#FFFFFF"
|
};
|
}
|
},
|
keepScrollPosition: {
|
type: Boolean,
|
default: false
|
}
|
},
|
watch: {
|
"customStyle.padding": {
|
handler(padding) {
|
if (typeof padding == "number") {
|
padding += "";
|
}
|
let paddingArr = padding.split(" ");
|
if (paddingArr.length === 1) {
|
const allPadding = paddingArr[0];
|
this.padding = {
|
"top": allPadding,
|
"right": allPadding,
|
"bottom": allPadding,
|
"left": allPadding
|
};
|
} else if (paddingArr.length === 2) {
|
const [verticalPadding, horizontalPadding] = paddingArr;
|
this.padding = {
|
"top": verticalPadding,
|
"right": horizontalPadding,
|
"bottom": verticalPadding,
|
"left": horizontalPadding
|
};
|
} else if (paddingArr.length === 4) {
|
const [topPadding, rightPadding, bottomPadding, leftPadding] = paddingArr;
|
this.padding = {
|
"top": topPadding,
|
"right": rightPadding,
|
"bottom": bottomPadding,
|
"left": leftPadding
|
};
|
}
|
},
|
immediate: true
|
}
|
},
|
// inject: ['list'],
|
data() {
|
return {
|
isFirstChild: false,
|
padding: {
|
top: "",
|
right: "",
|
bottom: "",
|
left: ""
|
}
|
};
|
},
|
mounted() {
|
this.list = this.getForm();
|
if (this.list) {
|
if (!this.list.firstChildAppend) {
|
this.list.firstChildAppend = true;
|
this.isFirstChild = true;
|
}
|
}
|
},
|
methods: {
|
/**
|
* 获取父元素实例
|
*/
|
getForm(name = "uniList") {
|
let parent = this.$parent;
|
let parentName = parent.$options.name;
|
while (parentName !== name) {
|
parent = parent.$parent;
|
if (!parent)
|
return false;
|
parentName = parent.$options.name;
|
}
|
return parent;
|
},
|
onClick() {
|
if (this.to !== "") {
|
this.openPage();
|
return;
|
}
|
if (this.clickable || this.link) {
|
this.$emit("click", {
|
data: {}
|
});
|
}
|
},
|
onSwitchChange(e2) {
|
this.$emit("switchChange", e2.detail);
|
},
|
openPage() {
|
if (["navigateTo", "redirectTo", "reLaunch", "switchTab"].indexOf(this.link) !== -1) {
|
this.pageApi(this.link);
|
} else {
|
this.pageApi("navigateTo");
|
}
|
},
|
pageApi(api) {
|
let callback = {
|
url: this.to,
|
success: (res) => {
|
this.$emit("click", {
|
data: res
|
});
|
},
|
fail: (err) => {
|
this.$emit("click", {
|
data: err
|
});
|
}
|
};
|
switch (api) {
|
case "navigateTo":
|
uni.navigateTo(callback);
|
break;
|
case "redirectTo":
|
uni.redirectTo(callback);
|
break;
|
case "reLaunch":
|
uni.reLaunch(callback);
|
break;
|
case "switchTab":
|
uni.switchTab(callback);
|
break;
|
default:
|
uni.navigateTo(callback);
|
}
|
}
|
}
|
};
|
function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$6);
|
const _component_uni_badge = resolveEasycom(vue.resolveDynamicComponent("uni-badge"), __easycom_1$2);
|
return vue.openBlock(), vue.createElementBlock("view", {
|
class: vue.normalizeClass([{ "uni-list-item--disabled": $props.disabled }, "uni-list-item"]),
|
style: vue.normalizeStyle({ "background-color": $props.customStyle.backgroundColor }),
|
"hover-class": !$props.clickable && !$props.link || $props.disabled || $props.showSwitch ? "" : "uni-list-item--hover",
|
onClick: _cache[1] || (_cache[1] = (...args) => $options.onClick && $options.onClick(...args))
|
}, [
|
!$data.isFirstChild ? (vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 0,
|
class: vue.normalizeClass(["border--left", { "uni-list--border": $props.border }])
|
},
|
null,
|
2
|
/* CLASS */
|
)) : vue.createCommentVNode("v-if", true),
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-list-item__container", { "container--right": $props.showArrow || $props.link, "flex--direction": $props.direction === "column" }]),
|
style: vue.normalizeStyle({ paddingTop: $data.padding.top, paddingLeft: $data.padding.left, paddingRight: $data.padding.right, paddingBottom: $data.padding.bottom })
|
},
|
[
|
vue.renderSlot(_ctx.$slots, "header", {}, () => [
|
vue.createElementVNode("view", { class: "uni-list-item__header" }, [
|
$props.thumb ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
class: "uni-list-item__icon"
|
}, [
|
vue.createElementVNode("image", {
|
src: $props.thumb,
|
class: vue.normalizeClass(["uni-list-item__icon-img", ["uni-list--" + $props.thumbSize]])
|
}, null, 10, ["src"])
|
])) : $props.showExtraIcon ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 1,
|
class: "uni-list-item__icon"
|
}, [
|
vue.createVNode(_component_uni_icons, {
|
customPrefix: $props.extraIcon.customPrefix,
|
color: $props.extraIcon.color,
|
size: $props.extraIcon.size,
|
type: $props.extraIcon.type
|
}, null, 8, ["customPrefix", "color", "size", "type"])
|
])) : vue.createCommentVNode("v-if", true)
|
])
|
], true),
|
vue.renderSlot(_ctx.$slots, "body", {}, () => [
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-list-item__content", { "uni-list-item__content--center": $props.thumb || $props.showExtraIcon || $props.showBadge || $props.showSwitch }])
|
},
|
[
|
$props.title ? (vue.openBlock(), vue.createElementBlock(
|
"text",
|
{
|
key: 0,
|
class: vue.normalizeClass(["uni-list-item__content-title", [$props.ellipsis !== 0 && $props.ellipsis <= 2 ? "uni-ellipsis-" + $props.ellipsis : ""]])
|
},
|
vue.toDisplayString($props.title),
|
3
|
/* TEXT, CLASS */
|
)) : vue.createCommentVNode("v-if", true),
|
$props.note ? (vue.openBlock(), vue.createElementBlock(
|
"text",
|
{
|
key: 1,
|
class: "uni-list-item__content-note"
|
},
|
vue.toDisplayString($props.note),
|
1
|
/* TEXT */
|
)) : vue.createCommentVNode("v-if", true)
|
],
|
2
|
/* CLASS */
|
)
|
], true),
|
vue.renderSlot(_ctx.$slots, "footer", {}, () => [
|
$props.rightText || $props.showBadge || $props.showSwitch ? (vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 0,
|
class: vue.normalizeClass(["uni-list-item__extra", { "flex--justify": $props.direction === "column" }])
|
},
|
[
|
$props.rightText ? (vue.openBlock(), vue.createElementBlock(
|
"text",
|
{
|
key: 0,
|
class: "uni-list-item__extra-text"
|
},
|
vue.toDisplayString($props.rightText),
|
1
|
/* TEXT */
|
)) : vue.createCommentVNode("v-if", true),
|
$props.showBadge ? (vue.openBlock(), vue.createBlock(_component_uni_badge, {
|
key: 1,
|
type: $props.badgeType,
|
text: $props.badgeText,
|
"custom-style": $props.badgeStyle
|
}, null, 8, ["type", "text", "custom-style"])) : vue.createCommentVNode("v-if", true),
|
$props.showSwitch ? (vue.openBlock(), vue.createElementBlock("switch", {
|
key: 2,
|
disabled: $props.disabled,
|
checked: $props.switchChecked,
|
onChange: _cache[0] || (_cache[0] = (...args) => $options.onSwitchChange && $options.onSwitchChange(...args))
|
}, null, 40, ["disabled", "checked"])) : vue.createCommentVNode("v-if", true)
|
],
|
2
|
/* CLASS */
|
)) : vue.createCommentVNode("v-if", true)
|
], true)
|
],
|
6
|
/* CLASS, STYLE */
|
),
|
$props.showArrow || $props.link ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
|
key: 1,
|
size: 16,
|
class: "uni-icon-wrapper",
|
color: "#bbb",
|
type: "arrowright"
|
})) : vue.createCommentVNode("v-if", true)
|
], 14, ["hover-class"]);
|
}
|
const __easycom_0$3 = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$m], ["__scopeId", "data-v-d88f6cd0"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-list-item/uni-list-item.vue"]]);
|
const _sfc_main$m = {
|
name: "uniList",
|
"mp-weixin": {
|
options: {
|
multipleSlots: false
|
}
|
},
|
props: {
|
stackFromEnd: {
|
type: Boolean,
|
default: false
|
},
|
enableBackToTop: {
|
type: [Boolean, String],
|
default: false
|
},
|
scrollY: {
|
type: [Boolean, String],
|
default: false
|
},
|
border: {
|
type: Boolean,
|
default: true
|
},
|
renderReverse: {
|
type: Boolean,
|
default: false
|
}
|
},
|
// provide() {
|
// return {
|
// list: this
|
// };
|
// },
|
created() {
|
this.firstChildAppend = false;
|
},
|
methods: {
|
loadMore(e2) {
|
this.$emit("scrolltolower");
|
},
|
scroll(e2) {
|
this.$emit("scroll", e2);
|
}
|
}
|
};
|
function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-list uni-border-top-bottom" }, [
|
$props.border ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
class: "uni-list--border-top"
|
})) : vue.createCommentVNode("v-if", true),
|
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true),
|
$props.border ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 1,
|
class: "uni-list--border-bottom"
|
})) : vue.createCommentVNode("v-if", true)
|
]);
|
}
|
const __easycom_1$1 = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$l], ["__scopeId", "data-v-cc89e7d4"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-list/uni-list.vue"]]);
|
const _sfc_main$l = {
|
__name: "glassInfo",
|
setup(__props, { expose: __expose }) {
|
__expose();
|
let projectNo = vue.ref(null);
|
let glassInfo = vue.ref({});
|
let title = {
|
orderId: "订单编号",
|
customerName: "客户名称",
|
productName: "产品名称",
|
glassChild: "小片名称",
|
size: "尺寸",
|
processId: "流程卡号",
|
orderNumber: "订单序号",
|
technologyNumber: "小片序号",
|
area: "面积",
|
buildingNumber: "楼号",
|
processingNote: "加工要求"
|
//remarks:'备注'
|
};
|
const mPrinter = requireNativePlugin("HikPrinter");
|
onLoad(async (option) => {
|
projectNo.value = option.projectNo;
|
await getGlassInfo(option.projectNo);
|
});
|
const getGlassInfo = async (projectNo2) => {
|
await request.post(`/order/scannerGlassInfo/${projectNo2}`).then((res) => {
|
if (res.code == 200) {
|
glassInfo.value = res.data;
|
}
|
}).catch((err) => {
|
uni.showModal({
|
title: "提示",
|
content: err,
|
showCancel: false
|
});
|
});
|
};
|
const printInfo = () => {
|
mPrinter.openPort();
|
mPrinter.resetPrinter();
|
mPrinter.setAlignment(1);
|
mPrinter.printTextGBK("炉内编号:" + projectNo.value + "\n");
|
mPrinter.printTextGBK(`订单(序号/小片):${glassInfo.value.orderId}(${glassInfo.value.orderNumber}/${glassInfo.value.technologyNumber})
|
`);
|
mPrinter.printTextGBK(`尺寸:${glassInfo.value.size}
|
`);
|
mPrinter.printTextGBK(`客户:${glassInfo.value.customerName}
|
`);
|
mPrinter.printTextGBK(`小片名称:${glassInfo.value.glassChild}
|
`);
|
mPrinter.printTextGBK(`${glassInfo.value.productName}
|
`);
|
mPrinter.printTextGBK(`${glassInfo.value.buildingNumber}
|
`);
|
mPrinter.printTextGBK(`${glassInfo.value.processingNote}
|
`);
|
mPrinter.printTextGBK("\n");
|
mPrinter.printTextGBK("\n");
|
if (mPrinter.queryPrintResult(5e3)) {
|
mPrinter.closePort();
|
}
|
};
|
const __returned__ = { get projectNo() {
|
return projectNo;
|
}, set projectNo(v2) {
|
projectNo = v2;
|
}, get glassInfo() {
|
return glassInfo;
|
}, set glassInfo(v2) {
|
glassInfo = v2;
|
}, get title() {
|
return title;
|
}, set title(v2) {
|
title = v2;
|
}, mPrinter, getGlassInfo, printInfo, ref: vue.ref, get onLoad() {
|
return onLoad;
|
}, get request() {
|
return request;
|
} };
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
return __returned__;
|
}
|
};
|
function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_uni_list_item = resolveEasycom(vue.resolveDynamicComponent("uni-list-item"), __easycom_0$3);
|
const _component_uni_list = resolveEasycom(vue.resolveDynamicComponent("uni-list"), __easycom_1$1);
|
const _component_uni_section = resolveEasycom(vue.resolveDynamicComponent("uni-section"), __easycom_0$4);
|
return vue.openBlock(), vue.createElementBlock("view", null, [
|
vue.createVNode(_component_uni_section, {
|
title: "玻璃信息:" + $setup.projectNo,
|
type: "line"
|
}, {
|
right: vue.withCtx(() => [
|
vue.createElementVNode("button", { onClick: $setup.printInfo }, "打印")
|
]),
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_list, null, {
|
default: vue.withCtx(() => [
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($setup.title, (item, keys) => {
|
return vue.openBlock(), vue.createBlock(_component_uni_list_item, {
|
title: item + ":",
|
note: $setup.glassInfo[keys]
|
}, null, 8, ["title", "note"]);
|
}),
|
256
|
/* UNKEYED_FRAGMENT */
|
))
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
}, 8, ["title"])
|
]);
|
}
|
const PagesGlassInfoGlassInfo = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$k], ["__file", "D:/Documents/app/qrcodeScaner/pages/glassInfo/glassInfo.vue"]]);
|
let Calendar$1 = class Calendar {
|
constructor({
|
selected,
|
startDate,
|
endDate,
|
range
|
} = {}) {
|
this.date = this.getDateObj(/* @__PURE__ */ new Date());
|
this.selected = selected || [];
|
this.startDate = startDate;
|
this.endDate = endDate;
|
this.range = range;
|
this.cleanMultipleStatus();
|
this.weeks = {};
|
this.lastHover = false;
|
}
|
/**
|
* 设置日期
|
* @param {Object} date
|
*/
|
setDate(date) {
|
const selectDate = this.getDateObj(date);
|
this.getWeeks(selectDate.fullDate);
|
}
|
/**
|
* 清理多选状态
|
*/
|
cleanMultipleStatus() {
|
this.multipleStatus = {
|
before: "",
|
after: "",
|
data: []
|
};
|
}
|
setStartDate(startDate) {
|
this.startDate = startDate;
|
}
|
setEndDate(endDate) {
|
this.endDate = endDate;
|
}
|
getPreMonthObj(date) {
|
date = fixIosDateFormat(date);
|
date = new Date(date);
|
const oldMonth = date.getMonth();
|
date.setMonth(oldMonth - 1);
|
const newMonth = date.getMonth();
|
if (oldMonth !== 0 && newMonth - oldMonth === 0) {
|
date.setMonth(newMonth - 1);
|
}
|
return this.getDateObj(date);
|
}
|
getNextMonthObj(date) {
|
date = fixIosDateFormat(date);
|
date = new Date(date);
|
const oldMonth = date.getMonth();
|
date.setMonth(oldMonth + 1);
|
const newMonth = date.getMonth();
|
if (newMonth - oldMonth > 1) {
|
date.setMonth(newMonth - 1);
|
}
|
return this.getDateObj(date);
|
}
|
/**
|
* 获取指定格式Date对象
|
*/
|
getDateObj(date) {
|
date = fixIosDateFormat(date);
|
date = new Date(date);
|
return {
|
fullDate: getDate(date),
|
year: date.getFullYear(),
|
month: addZero(date.getMonth() + 1),
|
date: addZero(date.getDate()),
|
day: date.getDay()
|
};
|
}
|
/**
|
* 获取上一个月日期集合
|
*/
|
getPreMonthDays(amount, dateObj) {
|
const result = [];
|
for (let i2 = amount - 1; i2 >= 0; i2--) {
|
const month = dateObj.month - 1;
|
result.push({
|
date: new Date(dateObj.year, month, -i2).getDate(),
|
month,
|
disable: true
|
});
|
}
|
return result;
|
}
|
/**
|
* 获取本月日期集合
|
*/
|
getCurrentMonthDays(amount, dateObj) {
|
const result = [];
|
const fullDate = this.date.fullDate;
|
for (let i2 = 1; i2 <= amount; i2++) {
|
const currentDate = `${dateObj.year}-${dateObj.month}-${addZero(i2)}`;
|
const isToday = fullDate === currentDate;
|
const info = this.selected && this.selected.find((item) => {
|
if (this.dateEqual(currentDate, item.date)) {
|
return item;
|
}
|
});
|
if (this.startDate) {
|
dateCompare(this.startDate, currentDate);
|
}
|
if (this.endDate) {
|
dateCompare(currentDate, this.endDate);
|
}
|
let multiples = this.multipleStatus.data;
|
let multiplesStatus = -1;
|
if (this.range && multiples) {
|
multiplesStatus = multiples.findIndex((item) => {
|
return this.dateEqual(item, currentDate);
|
});
|
}
|
const checked = multiplesStatus !== -1;
|
result.push({
|
fullDate: currentDate,
|
year: dateObj.year,
|
date: i2,
|
multiple: this.range ? checked : false,
|
beforeMultiple: this.isLogicBefore(currentDate, this.multipleStatus.before, this.multipleStatus.after),
|
afterMultiple: this.isLogicAfter(currentDate, this.multipleStatus.before, this.multipleStatus.after),
|
month: dateObj.month,
|
disable: this.startDate && !dateCompare(this.startDate, currentDate) || this.endDate && !dateCompare(
|
currentDate,
|
this.endDate
|
),
|
isToday,
|
userChecked: false,
|
extraInfo: info
|
});
|
}
|
return result;
|
}
|
/**
|
* 获取下一个月日期集合
|
*/
|
_getNextMonthDays(amount, dateObj) {
|
const result = [];
|
const month = dateObj.month + 1;
|
for (let i2 = 1; i2 <= amount; i2++) {
|
result.push({
|
date: i2,
|
month,
|
disable: true
|
});
|
}
|
return result;
|
}
|
/**
|
* 获取当前日期详情
|
* @param {Object} date
|
*/
|
getInfo(date) {
|
if (!date) {
|
date = /* @__PURE__ */ new Date();
|
}
|
const res = this.calendar.find((item) => item.fullDate === this.getDateObj(date).fullDate);
|
return res ? res : this.getDateObj(date);
|
}
|
/**
|
* 比较时间是否相等
|
*/
|
dateEqual(before, after) {
|
before = new Date(fixIosDateFormat(before));
|
after = new Date(fixIosDateFormat(after));
|
return before.valueOf() === after.valueOf();
|
}
|
/**
|
* 比较真实起始日期
|
*/
|
isLogicBefore(currentDate, before, after) {
|
let logicBefore = before;
|
if (before && after) {
|
logicBefore = dateCompare(before, after) ? before : after;
|
}
|
return this.dateEqual(logicBefore, currentDate);
|
}
|
isLogicAfter(currentDate, before, after) {
|
let logicAfter = after;
|
if (before && after) {
|
logicAfter = dateCompare(before, after) ? after : before;
|
}
|
return this.dateEqual(logicAfter, currentDate);
|
}
|
/**
|
* 获取日期范围内所有日期
|
* @param {Object} begin
|
* @param {Object} end
|
*/
|
geDateAll(begin, end) {
|
var arr = [];
|
var ab = begin.split("-");
|
var ae2 = end.split("-");
|
var db = /* @__PURE__ */ new Date();
|
db.setFullYear(ab[0], ab[1] - 1, ab[2]);
|
var de2 = /* @__PURE__ */ new Date();
|
de2.setFullYear(ae2[0], ae2[1] - 1, ae2[2]);
|
var unixDb = db.getTime() - 24 * 60 * 60 * 1e3;
|
var unixDe = de2.getTime() - 24 * 60 * 60 * 1e3;
|
for (var k = unixDb; k <= unixDe; ) {
|
k = k + 24 * 60 * 60 * 1e3;
|
arr.push(this.getDateObj(new Date(parseInt(k))).fullDate);
|
}
|
return arr;
|
}
|
/**
|
* 获取多选状态
|
*/
|
setMultiple(fullDate) {
|
if (!this.range)
|
return;
|
let {
|
before,
|
after
|
} = this.multipleStatus;
|
if (before && after) {
|
if (!this.lastHover) {
|
this.lastHover = true;
|
return;
|
}
|
this.multipleStatus.before = fullDate;
|
this.multipleStatus.after = "";
|
this.multipleStatus.data = [];
|
this.multipleStatus.fulldate = "";
|
this.lastHover = false;
|
} else {
|
if (!before) {
|
this.multipleStatus.before = fullDate;
|
this.multipleStatus.after = void 0;
|
this.lastHover = false;
|
} else {
|
this.multipleStatus.after = fullDate;
|
if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
|
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
|
} else {
|
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
|
}
|
this.lastHover = true;
|
}
|
}
|
this.getWeeks(fullDate);
|
}
|
/**
|
* 鼠标 hover 更新多选状态
|
*/
|
setHoverMultiple(fullDate) {
|
if (!this.range || this.lastHover)
|
return;
|
const {
|
before
|
} = this.multipleStatus;
|
if (!before) {
|
this.multipleStatus.before = fullDate;
|
} else {
|
this.multipleStatus.after = fullDate;
|
if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
|
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
|
} else {
|
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
|
}
|
}
|
this.getWeeks(fullDate);
|
}
|
/**
|
* 更新默认值多选状态
|
*/
|
setDefaultMultiple(before, after) {
|
this.multipleStatus.before = before;
|
this.multipleStatus.after = after;
|
if (before && after) {
|
if (dateCompare(before, after)) {
|
this.multipleStatus.data = this.geDateAll(before, after);
|
this.getWeeks(after);
|
} else {
|
this.multipleStatus.data = this.geDateAll(after, before);
|
this.getWeeks(before);
|
}
|
}
|
}
|
/**
|
* 获取每周数据
|
* @param {Object} dateData
|
*/
|
getWeeks(dateData) {
|
const {
|
year,
|
month
|
} = this.getDateObj(dateData);
|
const preMonthDayAmount = new Date(year, month - 1, 1).getDay();
|
const preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData));
|
const currentMonthDayAmount = new Date(year, month, 0).getDate();
|
const currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData));
|
const nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount;
|
const nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData));
|
const calendarDays = [...preMonthDays, ...currentMonthDays, ...nextMonthDays];
|
const weeks = new Array(6);
|
for (let i2 = 0; i2 < calendarDays.length; i2++) {
|
const index = Math.floor(i2 / 7);
|
if (!weeks[index]) {
|
weeks[index] = new Array(7);
|
}
|
weeks[index][i2 % 7] = calendarDays[i2];
|
}
|
this.calendar = calendarDays;
|
this.weeks = weeks;
|
}
|
};
|
function getDateTime(date, hideSecond) {
|
return `${getDate(date)} ${getTime(date, hideSecond)}`;
|
}
|
function getDate(date) {
|
date = fixIosDateFormat(date);
|
date = new Date(date);
|
const year = date.getFullYear();
|
const month = date.getMonth() + 1;
|
const day = date.getDate();
|
return `${year}-${addZero(month)}-${addZero(day)}`;
|
}
|
function getTime(date, hideSecond) {
|
date = fixIosDateFormat(date);
|
date = new Date(date);
|
const hour = date.getHours();
|
const minute = date.getMinutes();
|
const second = date.getSeconds();
|
return hideSecond ? `${addZero(hour)}:${addZero(minute)}` : `${addZero(hour)}:${addZero(minute)}:${addZero(second)}`;
|
}
|
function addZero(num) {
|
if (num < 10) {
|
num = `0${num}`;
|
}
|
return num;
|
}
|
function getDefaultSecond(hideSecond) {
|
return hideSecond ? "00:00" : "00:00:00";
|
}
|
function dateCompare(startDate, endDate) {
|
startDate = new Date(fixIosDateFormat(startDate));
|
endDate = new Date(fixIosDateFormat(endDate));
|
return startDate <= endDate;
|
}
|
function checkDate(date) {
|
const dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g;
|
return date.match(dateReg);
|
}
|
const dateTimeReg = /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])( [0-5]?[0-9]:[0-5]?[0-9](:[0-5]?[0-9])?)?$/;
|
function fixIosDateFormat(value) {
|
if (typeof value === "string" && dateTimeReg.test(value)) {
|
value = value.replace(/-/g, "/");
|
}
|
return value;
|
}
|
const _sfc_main$k = {
|
props: {
|
weeks: {
|
type: Object,
|
default() {
|
return {};
|
}
|
},
|
calendar: {
|
type: Object,
|
default: () => {
|
return {};
|
}
|
},
|
selected: {
|
type: Array,
|
default: () => {
|
return [];
|
}
|
},
|
checkHover: {
|
type: Boolean,
|
default: false
|
}
|
},
|
methods: {
|
choiceDate(weeks) {
|
this.$emit("change", weeks);
|
},
|
handleMousemove(weeks) {
|
this.$emit("handleMouse", weeks);
|
}
|
}
|
};
|
function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-calendar-item__weeks-box", {
|
"uni-calendar-item--disable": $props.weeks.disable,
|
"uni-calendar-item--before-checked-x": $props.weeks.beforeMultiple,
|
"uni-calendar-item--multiple": $props.weeks.multiple,
|
"uni-calendar-item--after-checked-x": $props.weeks.afterMultiple
|
}]),
|
onClick: _cache[0] || (_cache[0] = ($event) => $options.choiceDate($props.weeks)),
|
onMouseenter: _cache[1] || (_cache[1] = ($event) => $options.handleMousemove($props.weeks))
|
},
|
[
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-calendar-item__weeks-box-item", {
|
"uni-calendar-item--checked": $props.calendar.fullDate === $props.weeks.fullDate && ($props.calendar.userChecked || !$props.checkHover),
|
"uni-calendar-item--checked-range-text": $props.checkHover,
|
"uni-calendar-item--before-checked": $props.weeks.beforeMultiple,
|
"uni-calendar-item--multiple": $props.weeks.multiple,
|
"uni-calendar-item--after-checked": $props.weeks.afterMultiple,
|
"uni-calendar-item--disable": $props.weeks.disable
|
}])
|
},
|
[
|
$props.selected && $props.weeks.extraInfo ? (vue.openBlock(), vue.createElementBlock("text", {
|
key: 0,
|
class: "uni-calendar-item__weeks-box-circle"
|
})) : vue.createCommentVNode("v-if", true),
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-calendar-item__weeks-box-text uni-calendar-item__weeks-box-text-disable uni-calendar-item--checked-text" },
|
vue.toDisplayString($props.weeks.date),
|
1
|
/* TEXT */
|
)
|
],
|
2
|
/* CLASS */
|
),
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass({ "uni-calendar-item--today": $props.weeks.isToday })
|
},
|
null,
|
2
|
/* CLASS */
|
)
|
],
|
34
|
/* CLASS, NEED_HYDRATION */
|
);
|
}
|
const calendarItem = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$j], ["__scopeId", "data-v-fe34d61e"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-datetime-picker/calendar-item.vue"]]);
|
const en = {
|
"uni-datetime-picker.selectDate": "select date",
|
"uni-datetime-picker.selectTime": "select time",
|
"uni-datetime-picker.selectDateTime": "select date and time",
|
"uni-datetime-picker.startDate": "start date",
|
"uni-datetime-picker.endDate": "end date",
|
"uni-datetime-picker.startTime": "start time",
|
"uni-datetime-picker.endTime": "end time",
|
"uni-datetime-picker.ok": "ok",
|
"uni-datetime-picker.clear": "clear",
|
"uni-datetime-picker.cancel": "cancel",
|
"uni-datetime-picker.year": "-",
|
"uni-datetime-picker.month": "",
|
"uni-calender.MON": "MON",
|
"uni-calender.TUE": "TUE",
|
"uni-calender.WED": "WED",
|
"uni-calender.THU": "THU",
|
"uni-calender.FRI": "FRI",
|
"uni-calender.SAT": "SAT",
|
"uni-calender.SUN": "SUN",
|
"uni-calender.confirm": "confirm"
|
};
|
const zhHans = {
|
"uni-datetime-picker.selectDate": "选择日期",
|
"uni-datetime-picker.selectTime": "选择时间",
|
"uni-datetime-picker.selectDateTime": "选择日期时间",
|
"uni-datetime-picker.startDate": "开始日期",
|
"uni-datetime-picker.endDate": "结束日期",
|
"uni-datetime-picker.startTime": "开始时间",
|
"uni-datetime-picker.endTime": "结束时间",
|
"uni-datetime-picker.ok": "确定",
|
"uni-datetime-picker.clear": "清除",
|
"uni-datetime-picker.cancel": "取消",
|
"uni-datetime-picker.year": "年",
|
"uni-datetime-picker.month": "月",
|
"uni-calender.SUN": "日",
|
"uni-calender.MON": "一",
|
"uni-calender.TUE": "二",
|
"uni-calender.WED": "三",
|
"uni-calender.THU": "四",
|
"uni-calender.FRI": "五",
|
"uni-calender.SAT": "六",
|
"uni-calender.confirm": "确认"
|
};
|
const zhHant = {
|
"uni-datetime-picker.selectDate": "選擇日期",
|
"uni-datetime-picker.selectTime": "選擇時間",
|
"uni-datetime-picker.selectDateTime": "選擇日期時間",
|
"uni-datetime-picker.startDate": "開始日期",
|
"uni-datetime-picker.endDate": "結束日期",
|
"uni-datetime-picker.startTime": "開始时间",
|
"uni-datetime-picker.endTime": "結束时间",
|
"uni-datetime-picker.ok": "確定",
|
"uni-datetime-picker.clear": "清除",
|
"uni-datetime-picker.cancel": "取消",
|
"uni-datetime-picker.year": "年",
|
"uni-datetime-picker.month": "月",
|
"uni-calender.SUN": "日",
|
"uni-calender.MON": "一",
|
"uni-calender.TUE": "二",
|
"uni-calender.WED": "三",
|
"uni-calender.THU": "四",
|
"uni-calender.FRI": "五",
|
"uni-calender.SAT": "六",
|
"uni-calender.confirm": "確認"
|
};
|
const i18nMessages = {
|
en,
|
"zh-Hans": zhHans,
|
"zh-Hant": zhHant
|
};
|
const {
|
t: t$2
|
} = initVueI18n(i18nMessages);
|
const _sfc_main$j = {
|
name: "UniDatetimePicker",
|
data() {
|
return {
|
indicatorStyle: `height: 50px;`,
|
visible: false,
|
fixNvueBug: {},
|
dateShow: true,
|
timeShow: true,
|
title: "日期和时间",
|
// 输入框当前时间
|
time: "",
|
// 当前的年月日时分秒
|
year: 1920,
|
month: 0,
|
day: 0,
|
hour: 0,
|
minute: 0,
|
second: 0,
|
// 起始时间
|
startYear: 1920,
|
startMonth: 1,
|
startDay: 1,
|
startHour: 0,
|
startMinute: 0,
|
startSecond: 0,
|
// 结束时间
|
endYear: 2120,
|
endMonth: 12,
|
endDay: 31,
|
endHour: 23,
|
endMinute: 59,
|
endSecond: 59
|
};
|
},
|
options: {
|
virtualHost: true
|
},
|
props: {
|
type: {
|
type: String,
|
default: "datetime"
|
},
|
value: {
|
type: [String, Number],
|
default: ""
|
},
|
modelValue: {
|
type: [String, Number],
|
default: ""
|
},
|
start: {
|
type: [Number, String],
|
default: ""
|
},
|
end: {
|
type: [Number, String],
|
default: ""
|
},
|
returnType: {
|
type: String,
|
default: "string"
|
},
|
disabled: {
|
type: [Boolean, String],
|
default: false
|
},
|
border: {
|
type: [Boolean, String],
|
default: true
|
},
|
hideSecond: {
|
type: [Boolean, String],
|
default: false
|
}
|
},
|
watch: {
|
modelValue: {
|
handler(newVal) {
|
if (newVal) {
|
this.parseValue(fixIosDateFormat(newVal));
|
this.initTime(false);
|
} else {
|
this.time = "";
|
this.parseValue(Date.now());
|
}
|
},
|
immediate: true
|
},
|
type: {
|
handler(newValue) {
|
if (newValue === "date") {
|
this.dateShow = true;
|
this.timeShow = false;
|
this.title = "日期";
|
} else if (newValue === "time") {
|
this.dateShow = false;
|
this.timeShow = true;
|
this.title = "时间";
|
} else {
|
this.dateShow = true;
|
this.timeShow = true;
|
this.title = "日期和时间";
|
}
|
},
|
immediate: true
|
},
|
start: {
|
handler(newVal) {
|
this.parseDatetimeRange(fixIosDateFormat(newVal), "start");
|
},
|
immediate: true
|
},
|
end: {
|
handler(newVal) {
|
this.parseDatetimeRange(fixIosDateFormat(newVal), "end");
|
},
|
immediate: true
|
},
|
// 月、日、时、分、秒可选范围变化后,检查当前值是否在范围内,不在则当前值重置为可选范围第一项
|
months(newVal) {
|
this.checkValue("month", this.month, newVal);
|
},
|
days(newVal) {
|
this.checkValue("day", this.day, newVal);
|
},
|
hours(newVal) {
|
this.checkValue("hour", this.hour, newVal);
|
},
|
minutes(newVal) {
|
this.checkValue("minute", this.minute, newVal);
|
},
|
seconds(newVal) {
|
this.checkValue("second", this.second, newVal);
|
}
|
},
|
computed: {
|
// 当前年、月、日、时、分、秒选择范围
|
years() {
|
return this.getCurrentRange("year");
|
},
|
months() {
|
return this.getCurrentRange("month");
|
},
|
days() {
|
return this.getCurrentRange("day");
|
},
|
hours() {
|
return this.getCurrentRange("hour");
|
},
|
minutes() {
|
return this.getCurrentRange("minute");
|
},
|
seconds() {
|
return this.getCurrentRange("second");
|
},
|
// picker 当前值数组
|
ymd() {
|
return [this.year - this.minYear, this.month - this.minMonth, this.day - this.minDay];
|
},
|
hms() {
|
return [this.hour - this.minHour, this.minute - this.minMinute, this.second - this.minSecond];
|
},
|
// 当前 date 是 start
|
currentDateIsStart() {
|
return this.year === this.startYear && this.month === this.startMonth && this.day === this.startDay;
|
},
|
// 当前 date 是 end
|
currentDateIsEnd() {
|
return this.year === this.endYear && this.month === this.endMonth && this.day === this.endDay;
|
},
|
// 当前年、月、日、时、分、秒的最小值和最大值
|
minYear() {
|
return this.startYear;
|
},
|
maxYear() {
|
return this.endYear;
|
},
|
minMonth() {
|
if (this.year === this.startYear) {
|
return this.startMonth;
|
} else {
|
return 1;
|
}
|
},
|
maxMonth() {
|
if (this.year === this.endYear) {
|
return this.endMonth;
|
} else {
|
return 12;
|
}
|
},
|
minDay() {
|
if (this.year === this.startYear && this.month === this.startMonth) {
|
return this.startDay;
|
} else {
|
return 1;
|
}
|
},
|
maxDay() {
|
if (this.year === this.endYear && this.month === this.endMonth) {
|
return this.endDay;
|
} else {
|
return this.daysInMonth(this.year, this.month);
|
}
|
},
|
minHour() {
|
if (this.type === "datetime") {
|
if (this.currentDateIsStart) {
|
return this.startHour;
|
} else {
|
return 0;
|
}
|
}
|
if (this.type === "time") {
|
return this.startHour;
|
}
|
},
|
maxHour() {
|
if (this.type === "datetime") {
|
if (this.currentDateIsEnd) {
|
return this.endHour;
|
} else {
|
return 23;
|
}
|
}
|
if (this.type === "time") {
|
return this.endHour;
|
}
|
},
|
minMinute() {
|
if (this.type === "datetime") {
|
if (this.currentDateIsStart && this.hour === this.startHour) {
|
return this.startMinute;
|
} else {
|
return 0;
|
}
|
}
|
if (this.type === "time") {
|
if (this.hour === this.startHour) {
|
return this.startMinute;
|
} else {
|
return 0;
|
}
|
}
|
},
|
maxMinute() {
|
if (this.type === "datetime") {
|
if (this.currentDateIsEnd && this.hour === this.endHour) {
|
return this.endMinute;
|
} else {
|
return 59;
|
}
|
}
|
if (this.type === "time") {
|
if (this.hour === this.endHour) {
|
return this.endMinute;
|
} else {
|
return 59;
|
}
|
}
|
},
|
minSecond() {
|
if (this.type === "datetime") {
|
if (this.currentDateIsStart && this.hour === this.startHour && this.minute === this.startMinute) {
|
return this.startSecond;
|
} else {
|
return 0;
|
}
|
}
|
if (this.type === "time") {
|
if (this.hour === this.startHour && this.minute === this.startMinute) {
|
return this.startSecond;
|
} else {
|
return 0;
|
}
|
}
|
},
|
maxSecond() {
|
if (this.type === "datetime") {
|
if (this.currentDateIsEnd && this.hour === this.endHour && this.minute === this.endMinute) {
|
return this.endSecond;
|
} else {
|
return 59;
|
}
|
}
|
if (this.type === "time") {
|
if (this.hour === this.endHour && this.minute === this.endMinute) {
|
return this.endSecond;
|
} else {
|
return 59;
|
}
|
}
|
},
|
/**
|
* for i18n
|
*/
|
selectTimeText() {
|
return t$2("uni-datetime-picker.selectTime");
|
},
|
okText() {
|
return t$2("uni-datetime-picker.ok");
|
},
|
clearText() {
|
return t$2("uni-datetime-picker.clear");
|
},
|
cancelText() {
|
return t$2("uni-datetime-picker.cancel");
|
}
|
},
|
mounted() {
|
},
|
methods: {
|
/**
|
* @param {Object} item
|
* 小于 10 在前面加个 0
|
*/
|
lessThanTen(item) {
|
return item < 10 ? "0" + item : item;
|
},
|
/**
|
* 解析时分秒字符串,例如:00:00:00
|
* @param {String} timeString
|
*/
|
parseTimeType(timeString) {
|
if (timeString) {
|
let timeArr = timeString.split(":");
|
this.hour = Number(timeArr[0]);
|
this.minute = Number(timeArr[1]);
|
this.second = Number(timeArr[2]);
|
}
|
},
|
/**
|
* 解析选择器初始值,类型可以是字符串、时间戳,例如:2000-10-02、'08:30:00'、 1610695109000
|
* @param {String | Number} datetime
|
*/
|
initPickerValue(datetime) {
|
let defaultValue = null;
|
if (datetime) {
|
defaultValue = this.compareValueWithStartAndEnd(datetime, this.start, this.end);
|
} else {
|
defaultValue = Date.now();
|
defaultValue = this.compareValueWithStartAndEnd(defaultValue, this.start, this.end);
|
}
|
this.parseValue(defaultValue);
|
},
|
/**
|
* 初始值规则:
|
* - 用户设置初始值 value
|
* - 设置了起始时间 start、终止时间 end,并 start < value < end,初始值为 value, 否则初始值为 start
|
* - 只设置了起始时间 start,并 start < value,初始值为 value,否则初始值为 start
|
* - 只设置了终止时间 end,并 value < end,初始值为 value,否则初始值为 end
|
* - 无起始终止时间,则初始值为 value
|
* - 无初始值 value,则初始值为当前本地时间 Date.now()
|
* @param {Object} value
|
* @param {Object} dateBase
|
*/
|
compareValueWithStartAndEnd(value, start, end) {
|
let winner = null;
|
value = this.superTimeStamp(value);
|
start = this.superTimeStamp(start);
|
end = this.superTimeStamp(end);
|
if (start && end) {
|
if (value < start) {
|
winner = new Date(start);
|
} else if (value > end) {
|
winner = new Date(end);
|
} else {
|
winner = new Date(value);
|
}
|
} else if (start && !end) {
|
winner = start <= value ? new Date(value) : new Date(start);
|
} else if (!start && end) {
|
winner = value <= end ? new Date(value) : new Date(end);
|
} else {
|
winner = new Date(value);
|
}
|
return winner;
|
},
|
/**
|
* 转换为可比较的时间戳,接受日期、时分秒、时间戳
|
* @param {Object} value
|
*/
|
superTimeStamp(value) {
|
let dateBase = "";
|
if (this.type === "time" && value && typeof value === "string") {
|
const now2 = /* @__PURE__ */ new Date();
|
const year = now2.getFullYear();
|
const month = now2.getMonth() + 1;
|
const day = now2.getDate();
|
dateBase = year + "/" + month + "/" + day + " ";
|
}
|
if (Number(value)) {
|
value = parseInt(value);
|
dateBase = 0;
|
}
|
return this.createTimeStamp(dateBase + value);
|
},
|
/**
|
* 解析默认值 value,字符串、时间戳
|
* @param {Object} defaultTime
|
*/
|
parseValue(value) {
|
if (!value) {
|
return;
|
}
|
if (this.type === "time" && typeof value === "string") {
|
this.parseTimeType(value);
|
} else {
|
let defaultDate = null;
|
defaultDate = new Date(value);
|
if (this.type !== "time") {
|
this.year = defaultDate.getFullYear();
|
this.month = defaultDate.getMonth() + 1;
|
this.day = defaultDate.getDate();
|
}
|
if (this.type !== "date") {
|
this.hour = defaultDate.getHours();
|
this.minute = defaultDate.getMinutes();
|
this.second = defaultDate.getSeconds();
|
}
|
}
|
if (this.hideSecond) {
|
this.second = 0;
|
}
|
},
|
/**
|
* 解析可选择时间范围 start、end,年月日字符串、时间戳
|
* @param {Object} defaultTime
|
*/
|
parseDatetimeRange(point, pointType) {
|
if (!point) {
|
if (pointType === "start") {
|
this.startYear = 1920;
|
this.startMonth = 1;
|
this.startDay = 1;
|
this.startHour = 0;
|
this.startMinute = 0;
|
this.startSecond = 0;
|
}
|
if (pointType === "end") {
|
this.endYear = 2120;
|
this.endMonth = 12;
|
this.endDay = 31;
|
this.endHour = 23;
|
this.endMinute = 59;
|
this.endSecond = 59;
|
}
|
return;
|
}
|
if (this.type === "time") {
|
const pointArr = point.split(":");
|
this[pointType + "Hour"] = Number(pointArr[0]);
|
this[pointType + "Minute"] = Number(pointArr[1]);
|
this[pointType + "Second"] = Number(pointArr[2]);
|
} else {
|
if (!point) {
|
pointType === "start" ? this.startYear = this.year - 60 : this.endYear = this.year + 60;
|
return;
|
}
|
if (Number(point)) {
|
point = parseInt(point);
|
}
|
const hasTime = /[0-9]:[0-9]/;
|
if (this.type === "datetime" && pointType === "end" && typeof point === "string" && !hasTime.test(
|
point
|
)) {
|
point = point + " 23:59:59";
|
}
|
const pointDate = new Date(point);
|
this[pointType + "Year"] = pointDate.getFullYear();
|
this[pointType + "Month"] = pointDate.getMonth() + 1;
|
this[pointType + "Day"] = pointDate.getDate();
|
if (this.type === "datetime") {
|
this[pointType + "Hour"] = pointDate.getHours();
|
this[pointType + "Minute"] = pointDate.getMinutes();
|
this[pointType + "Second"] = pointDate.getSeconds();
|
}
|
}
|
},
|
// 获取 年、月、日、时、分、秒 当前可选范围
|
getCurrentRange(value) {
|
const range = [];
|
for (let i2 = this["min" + this.capitalize(value)]; i2 <= this["max" + this.capitalize(value)]; i2++) {
|
range.push(i2);
|
}
|
return range;
|
},
|
// 字符串首字母大写
|
capitalize(str) {
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
},
|
// 检查当前值是否在范围内,不在则当前值重置为可选范围第一项
|
checkValue(name, value, values) {
|
if (values.indexOf(value) === -1) {
|
this[name] = values[0];
|
}
|
},
|
// 每个月的实际天数
|
daysInMonth(year, month) {
|
return new Date(year, month, 0).getDate();
|
},
|
/**
|
* 生成时间戳
|
* @param {Object} time
|
*/
|
createTimeStamp(time) {
|
if (!time)
|
return;
|
if (typeof time === "number") {
|
return time;
|
} else {
|
time = time.replace(/-/g, "/");
|
if (this.type === "date") {
|
time = time + " 00:00:00";
|
}
|
return Date.parse(time);
|
}
|
},
|
/**
|
* 生成日期或时间的字符串
|
*/
|
createDomSting() {
|
const yymmdd = this.year + "-" + this.lessThanTen(this.month) + "-" + this.lessThanTen(this.day);
|
let hhmmss = this.lessThanTen(this.hour) + ":" + this.lessThanTen(this.minute);
|
if (!this.hideSecond) {
|
hhmmss = hhmmss + ":" + this.lessThanTen(this.second);
|
}
|
if (this.type === "date") {
|
return yymmdd;
|
} else if (this.type === "time") {
|
return hhmmss;
|
} else {
|
return yymmdd + " " + hhmmss;
|
}
|
},
|
/**
|
* 初始化返回值,并抛出 change 事件
|
*/
|
initTime(emit = true) {
|
this.time = this.createDomSting();
|
if (!emit)
|
return;
|
if (this.returnType === "timestamp" && this.type !== "time") {
|
this.$emit("change", this.createTimeStamp(this.time));
|
this.$emit("input", this.createTimeStamp(this.time));
|
this.$emit("update:modelValue", this.createTimeStamp(this.time));
|
} else {
|
this.$emit("change", this.time);
|
this.$emit("input", this.time);
|
this.$emit("update:modelValue", this.time);
|
}
|
},
|
/**
|
* 用户选择日期或时间更新 data
|
* @param {Object} e
|
*/
|
bindDateChange(e2) {
|
const val = e2.detail.value;
|
this.year = this.years[val[0]];
|
this.month = this.months[val[1]];
|
this.day = this.days[val[2]];
|
},
|
bindTimeChange(e2) {
|
const val = e2.detail.value;
|
this.hour = this.hours[val[0]];
|
this.minute = this.minutes[val[1]];
|
this.second = this.seconds[val[2]];
|
},
|
/**
|
* 初始化弹出层
|
*/
|
initTimePicker() {
|
if (this.disabled)
|
return;
|
const value = fixIosDateFormat(this.time);
|
this.initPickerValue(value);
|
this.visible = !this.visible;
|
},
|
/**
|
* 触发或关闭弹框
|
*/
|
tiggerTimePicker(e2) {
|
this.visible = !this.visible;
|
},
|
/**
|
* 用户点击“清空”按钮,清空当前值
|
*/
|
clearTime() {
|
this.time = "";
|
this.$emit("change", this.time);
|
this.$emit("input", this.time);
|
this.$emit("update:modelValue", this.time);
|
this.tiggerTimePicker();
|
},
|
/**
|
* 用户点击“确定”按钮
|
*/
|
setTime() {
|
this.initTime();
|
this.tiggerTimePicker();
|
}
|
}
|
};
|
function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-datetime-picker" }, [
|
vue.createElementVNode("view", {
|
onClick: _cache[0] || (_cache[0] = (...args) => $options.initTimePicker && $options.initTimePicker(...args))
|
}, [
|
vue.renderSlot(_ctx.$slots, "default", {}, () => [
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-datetime-picker-timebox-pointer", { "uni-datetime-picker-disabled": $props.disabled, "uni-datetime-picker-timebox": $props.border }])
|
},
|
[
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-datetime-picker-text" },
|
vue.toDisplayString($data.time),
|
1
|
/* TEXT */
|
),
|
!$data.time ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
class: "uni-datetime-picker-time"
|
}, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-datetime-picker-text" },
|
vue.toDisplayString($options.selectTimeText),
|
1
|
/* TEXT */
|
)
|
])) : vue.createCommentVNode("v-if", true)
|
],
|
2
|
/* CLASS */
|
)
|
], true)
|
]),
|
$data.visible ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
id: "mask",
|
class: "uni-datetime-picker-mask",
|
onClick: _cache[1] || (_cache[1] = (...args) => $options.tiggerTimePicker && $options.tiggerTimePicker(...args))
|
})) : vue.createCommentVNode("v-if", true),
|
$data.visible ? (vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 1,
|
class: vue.normalizeClass(["uni-datetime-picker-popup", [$data.dateShow && $data.timeShow ? "" : "fix-nvue-height"]]),
|
style: vue.normalizeStyle($data.fixNvueBug)
|
},
|
[
|
vue.createElementVNode("view", { class: "uni-title" }, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-datetime-picker-text" },
|
vue.toDisplayString($options.selectTimeText),
|
1
|
/* TEXT */
|
)
|
]),
|
$data.dateShow ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
class: "uni-datetime-picker__container-box"
|
}, [
|
vue.createElementVNode("picker-view", {
|
class: "uni-datetime-picker-view",
|
"indicator-style": $data.indicatorStyle,
|
value: $options.ymd,
|
onChange: _cache[2] || (_cache[2] = (...args) => $options.bindDateChange && $options.bindDateChange(...args))
|
}, [
|
vue.createElementVNode("picker-view-column", null, [
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($options.years, (item, index) => {
|
return vue.openBlock(), vue.createElementBlock("view", {
|
class: "uni-datetime-picker-item",
|
key: index
|
}, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-datetime-picker-item" },
|
vue.toDisplayString($options.lessThanTen(item)),
|
1
|
/* TEXT */
|
)
|
]);
|
}),
|
128
|
/* KEYED_FRAGMENT */
|
))
|
]),
|
vue.createElementVNode("picker-view-column", null, [
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($options.months, (item, index) => {
|
return vue.openBlock(), vue.createElementBlock("view", {
|
class: "uni-datetime-picker-item",
|
key: index
|
}, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-datetime-picker-item" },
|
vue.toDisplayString($options.lessThanTen(item)),
|
1
|
/* TEXT */
|
)
|
]);
|
}),
|
128
|
/* KEYED_FRAGMENT */
|
))
|
]),
|
vue.createElementVNode("picker-view-column", null, [
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($options.days, (item, index) => {
|
return vue.openBlock(), vue.createElementBlock("view", {
|
class: "uni-datetime-picker-item",
|
key: index
|
}, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-datetime-picker-item" },
|
vue.toDisplayString($options.lessThanTen(item)),
|
1
|
/* TEXT */
|
)
|
]);
|
}),
|
128
|
/* KEYED_FRAGMENT */
|
))
|
])
|
], 40, ["indicator-style", "value"]),
|
vue.createCommentVNode(" 兼容 nvue 不支持伪类 "),
|
vue.createElementVNode("text", { class: "uni-datetime-picker-sign sign-left" }, "-"),
|
vue.createElementVNode("text", { class: "uni-datetime-picker-sign sign-right" }, "-")
|
])) : vue.createCommentVNode("v-if", true),
|
$data.timeShow ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 1,
|
class: "uni-datetime-picker__container-box"
|
}, [
|
vue.createElementVNode("picker-view", {
|
class: vue.normalizeClass(["uni-datetime-picker-view", [$props.hideSecond ? "time-hide-second" : ""]]),
|
"indicator-style": $data.indicatorStyle,
|
value: $options.hms,
|
onChange: _cache[3] || (_cache[3] = (...args) => $options.bindTimeChange && $options.bindTimeChange(...args))
|
}, [
|
vue.createElementVNode("picker-view-column", null, [
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($options.hours, (item, index) => {
|
return vue.openBlock(), vue.createElementBlock("view", {
|
class: "uni-datetime-picker-item",
|
key: index
|
}, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-datetime-picker-item" },
|
vue.toDisplayString($options.lessThanTen(item)),
|
1
|
/* TEXT */
|
)
|
]);
|
}),
|
128
|
/* KEYED_FRAGMENT */
|
))
|
]),
|
vue.createElementVNode("picker-view-column", null, [
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($options.minutes, (item, index) => {
|
return vue.openBlock(), vue.createElementBlock("view", {
|
class: "uni-datetime-picker-item",
|
key: index
|
}, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-datetime-picker-item" },
|
vue.toDisplayString($options.lessThanTen(item)),
|
1
|
/* TEXT */
|
)
|
]);
|
}),
|
128
|
/* KEYED_FRAGMENT */
|
))
|
]),
|
!$props.hideSecond ? (vue.openBlock(), vue.createElementBlock("picker-view-column", { key: 0 }, [
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($options.seconds, (item, index) => {
|
return vue.openBlock(), vue.createElementBlock("view", {
|
class: "uni-datetime-picker-item",
|
key: index
|
}, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-datetime-picker-item" },
|
vue.toDisplayString($options.lessThanTen(item)),
|
1
|
/* TEXT */
|
)
|
]);
|
}),
|
128
|
/* KEYED_FRAGMENT */
|
))
|
])) : vue.createCommentVNode("v-if", true)
|
], 42, ["indicator-style", "value"]),
|
vue.createCommentVNode(" 兼容 nvue 不支持伪类 "),
|
vue.createElementVNode(
|
"text",
|
{
|
class: vue.normalizeClass(["uni-datetime-picker-sign", [$props.hideSecond ? "sign-center" : "sign-left"]])
|
},
|
":",
|
2
|
/* CLASS */
|
),
|
!$props.hideSecond ? (vue.openBlock(), vue.createElementBlock("text", {
|
key: 0,
|
class: "uni-datetime-picker-sign sign-right"
|
}, ":")) : vue.createCommentVNode("v-if", true)
|
])) : vue.createCommentVNode("v-if", true),
|
vue.createElementVNode("view", { class: "uni-datetime-picker-btn" }, [
|
vue.createElementVNode("view", {
|
onClick: _cache[4] || (_cache[4] = (...args) => $options.clearTime && $options.clearTime(...args))
|
}, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-datetime-picker-btn-text" },
|
vue.toDisplayString($options.clearText),
|
1
|
/* TEXT */
|
)
|
]),
|
vue.createElementVNode("view", { class: "uni-datetime-picker-btn-group" }, [
|
vue.createElementVNode("view", {
|
class: "uni-datetime-picker-cancel",
|
onClick: _cache[5] || (_cache[5] = (...args) => $options.tiggerTimePicker && $options.tiggerTimePicker(...args))
|
}, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-datetime-picker-btn-text" },
|
vue.toDisplayString($options.cancelText),
|
1
|
/* TEXT */
|
)
|
]),
|
vue.createElementVNode("view", {
|
onClick: _cache[6] || (_cache[6] = (...args) => $options.setTime && $options.setTime(...args))
|
}, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-datetime-picker-btn-text" },
|
vue.toDisplayString($options.okText),
|
1
|
/* TEXT */
|
)
|
])
|
])
|
])
|
],
|
6
|
/* CLASS, STYLE */
|
)) : vue.createCommentVNode("v-if", true)
|
]);
|
}
|
const TimePicker = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$i], ["__scopeId", "data-v-eeeb8241"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-datetime-picker/time-picker.vue"]]);
|
const {
|
t: t$1
|
} = initVueI18n(i18nMessages);
|
const _sfc_main$i = {
|
components: {
|
calendarItem,
|
timePicker: TimePicker
|
},
|
options: {
|
virtualHost: true
|
},
|
props: {
|
date: {
|
type: String,
|
default: ""
|
},
|
defTime: {
|
type: [String, Object],
|
default: ""
|
},
|
selectableTimes: {
|
type: [Object],
|
default() {
|
return {};
|
}
|
},
|
selected: {
|
type: Array,
|
default() {
|
return [];
|
}
|
},
|
startDate: {
|
type: String,
|
default: ""
|
},
|
endDate: {
|
type: String,
|
default: ""
|
},
|
startPlaceholder: {
|
type: String,
|
default: ""
|
},
|
endPlaceholder: {
|
type: String,
|
default: ""
|
},
|
range: {
|
type: Boolean,
|
default: false
|
},
|
hasTime: {
|
type: Boolean,
|
default: false
|
},
|
insert: {
|
type: Boolean,
|
default: true
|
},
|
showMonth: {
|
type: Boolean,
|
default: true
|
},
|
clearDate: {
|
type: Boolean,
|
default: true
|
},
|
checkHover: {
|
type: Boolean,
|
default: true
|
},
|
hideSecond: {
|
type: [Boolean],
|
default: false
|
},
|
pleStatus: {
|
type: Object,
|
default() {
|
return {
|
before: "",
|
after: "",
|
data: [],
|
fulldate: ""
|
};
|
}
|
},
|
defaultValue: {
|
type: [String, Object, Array],
|
default: ""
|
}
|
},
|
data() {
|
return {
|
show: false,
|
weeks: [],
|
calendar: {},
|
nowDate: {},
|
aniMaskShow: false,
|
firstEnter: true,
|
time: "",
|
timeRange: {
|
startTime: "",
|
endTime: ""
|
},
|
tempSingleDate: "",
|
tempRange: {
|
before: "",
|
after: ""
|
}
|
};
|
},
|
watch: {
|
date: {
|
immediate: true,
|
handler(newVal) {
|
if (!this.range) {
|
this.tempSingleDate = newVal;
|
setTimeout(() => {
|
this.init(newVal);
|
}, 100);
|
}
|
}
|
},
|
defTime: {
|
immediate: true,
|
handler(newVal) {
|
if (!this.range) {
|
this.time = newVal;
|
} else {
|
this.timeRange.startTime = newVal.start;
|
this.timeRange.endTime = newVal.end;
|
}
|
}
|
},
|
startDate(val) {
|
if (!this.cale) {
|
return;
|
}
|
this.cale.setStartDate(val);
|
this.cale.setDate(this.nowDate.fullDate);
|
this.weeks = this.cale.weeks;
|
},
|
endDate(val) {
|
if (!this.cale) {
|
return;
|
}
|
this.cale.setEndDate(val);
|
this.cale.setDate(this.nowDate.fullDate);
|
this.weeks = this.cale.weeks;
|
},
|
selected(newVal) {
|
if (!this.cale) {
|
return;
|
}
|
this.cale.setSelectInfo(this.nowDate.fullDate, newVal);
|
this.weeks = this.cale.weeks;
|
},
|
pleStatus: {
|
immediate: true,
|
handler(newVal) {
|
const {
|
before,
|
after,
|
fulldate,
|
which
|
} = newVal;
|
this.tempRange.before = before;
|
this.tempRange.after = after;
|
setTimeout(() => {
|
if (fulldate) {
|
this.cale.setHoverMultiple(fulldate);
|
if (before && after) {
|
this.cale.lastHover = true;
|
if (this.rangeWithinMonth(after, before))
|
return;
|
this.setDate(before);
|
} else {
|
this.cale.setMultiple(fulldate);
|
this.setDate(this.nowDate.fullDate);
|
this.calendar.fullDate = "";
|
this.cale.lastHover = false;
|
}
|
} else {
|
if (!this.cale) {
|
return;
|
}
|
this.cale.setDefaultMultiple(before, after);
|
if (which === "left" && before) {
|
this.setDate(before);
|
this.weeks = this.cale.weeks;
|
} else if (after) {
|
this.setDate(after);
|
this.weeks = this.cale.weeks;
|
}
|
this.cale.lastHover = true;
|
}
|
}, 16);
|
}
|
}
|
},
|
computed: {
|
timepickerStartTime() {
|
const activeDate = this.range ? this.tempRange.before : this.calendar.fullDate;
|
return activeDate === this.startDate ? this.selectableTimes.start : "";
|
},
|
timepickerEndTime() {
|
const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate;
|
return activeDate === this.endDate ? this.selectableTimes.end : "";
|
},
|
/**
|
* for i18n
|
*/
|
selectDateText() {
|
return t$1("uni-datetime-picker.selectDate");
|
},
|
startDateText() {
|
return this.startPlaceholder || t$1("uni-datetime-picker.startDate");
|
},
|
endDateText() {
|
return this.endPlaceholder || t$1("uni-datetime-picker.endDate");
|
},
|
okText() {
|
return t$1("uni-datetime-picker.ok");
|
},
|
yearText() {
|
return t$1("uni-datetime-picker.year");
|
},
|
monthText() {
|
return t$1("uni-datetime-picker.month");
|
},
|
MONText() {
|
return t$1("uni-calender.MON");
|
},
|
TUEText() {
|
return t$1("uni-calender.TUE");
|
},
|
WEDText() {
|
return t$1("uni-calender.WED");
|
},
|
THUText() {
|
return t$1("uni-calender.THU");
|
},
|
FRIText() {
|
return t$1("uni-calender.FRI");
|
},
|
SATText() {
|
return t$1("uni-calender.SAT");
|
},
|
SUNText() {
|
return t$1("uni-calender.SUN");
|
},
|
confirmText() {
|
return t$1("uni-calender.confirm");
|
}
|
},
|
created() {
|
this.cale = new Calendar$1({
|
selected: this.selected,
|
startDate: this.startDate,
|
endDate: this.endDate,
|
range: this.range
|
});
|
this.init(this.date);
|
},
|
methods: {
|
leaveCale() {
|
this.firstEnter = true;
|
},
|
handleMouse(weeks) {
|
if (weeks.disable)
|
return;
|
if (this.cale.lastHover)
|
return;
|
let {
|
before,
|
after
|
} = this.cale.multipleStatus;
|
if (!before)
|
return;
|
this.calendar = weeks;
|
this.cale.setHoverMultiple(this.calendar.fullDate);
|
this.weeks = this.cale.weeks;
|
if (this.firstEnter) {
|
this.$emit("firstEnterCale", this.cale.multipleStatus);
|
this.firstEnter = false;
|
}
|
},
|
rangeWithinMonth(A2, B2) {
|
const [yearA, monthA] = A2.split("-");
|
const [yearB, monthB] = B2.split("-");
|
return yearA === yearB && monthA === monthB;
|
},
|
// 蒙版点击事件
|
maskClick() {
|
this.close();
|
this.$emit("maskClose");
|
},
|
clearCalender() {
|
if (this.range) {
|
this.timeRange.startTime = "";
|
this.timeRange.endTime = "";
|
this.tempRange.before = "";
|
this.tempRange.after = "";
|
this.cale.multipleStatus.before = "";
|
this.cale.multipleStatus.after = "";
|
this.cale.multipleStatus.data = [];
|
this.cale.lastHover = false;
|
} else {
|
this.time = "";
|
this.tempSingleDate = "";
|
}
|
this.calendar.fullDate = "";
|
this.setDate(/* @__PURE__ */ new Date());
|
},
|
bindDateChange(e2) {
|
const value = e2.detail.value + "-1";
|
this.setDate(value);
|
},
|
/**
|
* 初始化日期显示
|
* @param {Object} date
|
*/
|
init(date) {
|
if (!this.cale) {
|
return;
|
}
|
this.cale.setDate(date || /* @__PURE__ */ new Date());
|
this.weeks = this.cale.weeks;
|
this.nowDate = this.cale.getInfo(date);
|
this.calendar = {
|
...this.nowDate
|
};
|
if (!date) {
|
this.calendar.fullDate = "";
|
if (this.defaultValue && !this.range) {
|
const defaultDate = new Date(this.defaultValue);
|
const fullDate = getDate(defaultDate);
|
const year = defaultDate.getFullYear();
|
const month = defaultDate.getMonth() + 1;
|
const date2 = defaultDate.getDate();
|
const day = defaultDate.getDay();
|
this.calendar = {
|
fullDate,
|
year,
|
month,
|
date: date2,
|
day
|
}, this.tempSingleDate = fullDate;
|
this.time = getTime(defaultDate, this.hideSecond);
|
}
|
}
|
},
|
/**
|
* 打开日历弹窗
|
*/
|
open() {
|
if (this.clearDate && !this.insert) {
|
this.cale.cleanMultipleStatus();
|
this.init(this.date);
|
}
|
this.show = true;
|
this.$nextTick(() => {
|
setTimeout(() => {
|
this.aniMaskShow = true;
|
}, 50);
|
});
|
},
|
/**
|
* 关闭日历弹窗
|
*/
|
close() {
|
this.aniMaskShow = false;
|
this.$nextTick(() => {
|
setTimeout(() => {
|
this.show = false;
|
this.$emit("close");
|
}, 300);
|
});
|
},
|
/**
|
* 确认按钮
|
*/
|
confirm() {
|
this.setEmit("confirm");
|
this.close();
|
},
|
/**
|
* 变化触发
|
*/
|
change(isSingleChange) {
|
if (!this.insert && !isSingleChange)
|
return;
|
this.setEmit("change");
|
},
|
/**
|
* 选择月份触发
|
*/
|
monthSwitch() {
|
let {
|
year,
|
month
|
} = this.nowDate;
|
this.$emit("monthSwitch", {
|
year,
|
month: Number(month)
|
});
|
},
|
/**
|
* 派发事件
|
* @param {Object} name
|
*/
|
setEmit(name) {
|
if (!this.range) {
|
if (!this.calendar.fullDate) {
|
this.calendar = this.cale.getInfo(/* @__PURE__ */ new Date());
|
this.tempSingleDate = this.calendar.fullDate;
|
}
|
if (this.hasTime && !this.time) {
|
this.time = getTime(/* @__PURE__ */ new Date(), this.hideSecond);
|
}
|
}
|
let {
|
year,
|
month,
|
date,
|
fullDate,
|
extraInfo
|
} = this.calendar;
|
this.$emit(name, {
|
range: this.cale.multipleStatus,
|
year,
|
month,
|
date,
|
time: this.time,
|
timeRange: this.timeRange,
|
fulldate: fullDate,
|
extraInfo: extraInfo || {}
|
});
|
},
|
/**
|
* 选择天触发
|
* @param {Object} weeks
|
*/
|
choiceDate(weeks) {
|
if (weeks.disable)
|
return;
|
this.calendar = weeks;
|
this.calendar.userChecked = true;
|
this.cale.setMultiple(this.calendar.fullDate, true);
|
this.weeks = this.cale.weeks;
|
this.tempSingleDate = this.calendar.fullDate;
|
const beforeDate = new Date(this.cale.multipleStatus.before).getTime();
|
const afterDate = new Date(this.cale.multipleStatus.after).getTime();
|
if (beforeDate > afterDate && afterDate) {
|
this.tempRange.before = this.cale.multipleStatus.after;
|
this.tempRange.after = this.cale.multipleStatus.before;
|
} else {
|
this.tempRange.before = this.cale.multipleStatus.before;
|
this.tempRange.after = this.cale.multipleStatus.after;
|
}
|
this.change(true);
|
},
|
changeMonth(type) {
|
let newDate;
|
if (type === "pre") {
|
newDate = this.cale.getPreMonthObj(this.nowDate.fullDate).fullDate;
|
} else if (type === "next") {
|
newDate = this.cale.getNextMonthObj(this.nowDate.fullDate).fullDate;
|
}
|
this.setDate(newDate);
|
this.monthSwitch();
|
},
|
/**
|
* 设置日期
|
* @param {Object} date
|
*/
|
setDate(date) {
|
this.cale.setDate(date);
|
this.weeks = this.cale.weeks;
|
this.nowDate = this.cale.getInfo(date);
|
}
|
}
|
};
|
function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_calendar_item = vue.resolveComponent("calendar-item");
|
const _component_time_picker = vue.resolveComponent("time-picker");
|
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$6);
|
return vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
class: "uni-calendar",
|
onMouseleave: _cache[9] || (_cache[9] = (...args) => $options.leaveCale && $options.leaveCale(...args))
|
},
|
[
|
!$props.insert && $data.show ? (vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 0,
|
class: vue.normalizeClass(["uni-calendar__mask", { "uni-calendar--mask-show": $data.aniMaskShow }]),
|
onClick: _cache[0] || (_cache[0] = (...args) => $options.maskClick && $options.maskClick(...args))
|
},
|
null,
|
2
|
/* CLASS */
|
)) : vue.createCommentVNode("v-if", true),
|
$props.insert || $data.show ? (vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 1,
|
class: vue.normalizeClass(["uni-calendar__content", { "uni-calendar--fixed": !$props.insert, "uni-calendar--ani-show": $data.aniMaskShow, "uni-calendar__content-mobile": $data.aniMaskShow }])
|
},
|
[
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-calendar__header", { "uni-calendar__header-mobile": !$props.insert }])
|
},
|
[
|
vue.createElementVNode("view", {
|
class: "uni-calendar__header-btn-box",
|
onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => $options.changeMonth("pre"), ["stop"]))
|
}, [
|
vue.createElementVNode("view", { class: "uni-calendar__header-btn uni-calendar--left" })
|
]),
|
vue.createElementVNode("picker", {
|
mode: "date",
|
value: $props.date,
|
fields: "month",
|
onChange: _cache[2] || (_cache[2] = (...args) => $options.bindDateChange && $options.bindDateChange(...args))
|
}, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-calendar__header-text" },
|
vue.toDisplayString(($data.nowDate.year || "") + $options.yearText + ($data.nowDate.month || "") + $options.monthText),
|
1
|
/* TEXT */
|
)
|
], 40, ["value"]),
|
vue.createElementVNode("view", {
|
class: "uni-calendar__header-btn-box",
|
onClick: _cache[3] || (_cache[3] = vue.withModifiers(($event) => $options.changeMonth("next"), ["stop"]))
|
}, [
|
vue.createElementVNode("view", { class: "uni-calendar__header-btn uni-calendar--right" })
|
]),
|
!$props.insert ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
class: "dialog-close",
|
onClick: _cache[4] || (_cache[4] = (...args) => $options.maskClick && $options.maskClick(...args))
|
}, [
|
vue.createElementVNode("view", {
|
class: "dialog-close-plus",
|
"data-id": "close"
|
}),
|
vue.createElementVNode("view", {
|
class: "dialog-close-plus dialog-close-rotate",
|
"data-id": "close"
|
})
|
])) : vue.createCommentVNode("v-if", true)
|
],
|
2
|
/* CLASS */
|
),
|
vue.createElementVNode("view", { class: "uni-calendar__box" }, [
|
$props.showMonth ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
class: "uni-calendar__box-bg"
|
}, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-calendar__box-bg-text" },
|
vue.toDisplayString($data.nowDate.month),
|
1
|
/* TEXT */
|
)
|
])) : vue.createCommentVNode("v-if", true),
|
vue.createElementVNode("view", {
|
class: "uni-calendar__weeks",
|
style: { "padding-bottom": "7px" }
|
}, [
|
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-calendar__weeks-day-text" },
|
vue.toDisplayString($options.SUNText),
|
1
|
/* TEXT */
|
)
|
]),
|
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-calendar__weeks-day-text" },
|
vue.toDisplayString($options.MONText),
|
1
|
/* TEXT */
|
)
|
]),
|
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-calendar__weeks-day-text" },
|
vue.toDisplayString($options.TUEText),
|
1
|
/* TEXT */
|
)
|
]),
|
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-calendar__weeks-day-text" },
|
vue.toDisplayString($options.WEDText),
|
1
|
/* TEXT */
|
)
|
]),
|
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-calendar__weeks-day-text" },
|
vue.toDisplayString($options.THUText),
|
1
|
/* TEXT */
|
)
|
]),
|
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-calendar__weeks-day-text" },
|
vue.toDisplayString($options.FRIText),
|
1
|
/* TEXT */
|
)
|
]),
|
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
|
vue.createElementVNode(
|
"text",
|
{ class: "uni-calendar__weeks-day-text" },
|
vue.toDisplayString($options.SATText),
|
1
|
/* TEXT */
|
)
|
])
|
]),
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($data.weeks, (item, weekIndex) => {
|
return vue.openBlock(), vue.createElementBlock("view", {
|
class: "uni-calendar__weeks",
|
key: weekIndex
|
}, [
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList(item, (weeks, weeksIndex) => {
|
return vue.openBlock(), vue.createElementBlock("view", {
|
class: "uni-calendar__weeks-item",
|
key: weeksIndex
|
}, [
|
vue.createVNode(_component_calendar_item, {
|
class: "uni-calendar-item--hook",
|
weeks,
|
calendar: $data.calendar,
|
selected: $props.selected,
|
checkHover: $props.range,
|
onChange: $options.choiceDate,
|
onHandleMouse: $options.handleMouse
|
}, null, 8, ["weeks", "calendar", "selected", "checkHover", "onChange", "onHandleMouse"])
|
]);
|
}),
|
128
|
/* KEYED_FRAGMENT */
|
))
|
]);
|
}),
|
128
|
/* KEYED_FRAGMENT */
|
))
|
]),
|
!$props.insert && !$props.range && $props.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
class: "uni-date-changed uni-calendar--fixed-top",
|
style: { "padding": "0 80px" }
|
}, [
|
vue.createElementVNode(
|
"view",
|
{ class: "uni-date-changed--time-date" },
|
vue.toDisplayString($data.tempSingleDate ? $data.tempSingleDate : $options.selectDateText),
|
1
|
/* TEXT */
|
),
|
vue.createVNode(_component_time_picker, {
|
type: "time",
|
start: $options.timepickerStartTime,
|
end: $options.timepickerEndTime,
|
modelValue: $data.time,
|
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.time = $event),
|
disabled: !$data.tempSingleDate,
|
border: false,
|
"hide-second": $props.hideSecond,
|
class: "time-picker-style"
|
}, null, 8, ["start", "end", "modelValue", "disabled", "hide-second"])
|
])) : vue.createCommentVNode("v-if", true),
|
!$props.insert && $props.range && $props.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 1,
|
class: "uni-date-changed uni-calendar--fixed-top"
|
}, [
|
vue.createElementVNode("view", { class: "uni-date-changed--time-start" }, [
|
vue.createElementVNode(
|
"view",
|
{ class: "uni-date-changed--time-date" },
|
vue.toDisplayString($data.tempRange.before ? $data.tempRange.before : $options.startDateText),
|
1
|
/* TEXT */
|
),
|
vue.createVNode(_component_time_picker, {
|
type: "time",
|
start: $options.timepickerStartTime,
|
modelValue: $data.timeRange.startTime,
|
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.timeRange.startTime = $event),
|
border: false,
|
"hide-second": $props.hideSecond,
|
disabled: !$data.tempRange.before,
|
class: "time-picker-style"
|
}, null, 8, ["start", "modelValue", "hide-second", "disabled"])
|
]),
|
vue.createElementVNode("view", { style: { "line-height": "50px" } }, [
|
vue.createVNode(_component_uni_icons, {
|
type: "arrowthinright",
|
color: "#999"
|
})
|
]),
|
vue.createElementVNode("view", { class: "uni-date-changed--time-end" }, [
|
vue.createElementVNode(
|
"view",
|
{ class: "uni-date-changed--time-date" },
|
vue.toDisplayString($data.tempRange.after ? $data.tempRange.after : $options.endDateText),
|
1
|
/* TEXT */
|
),
|
vue.createVNode(_component_time_picker, {
|
type: "time",
|
end: $options.timepickerEndTime,
|
modelValue: $data.timeRange.endTime,
|
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $data.timeRange.endTime = $event),
|
border: false,
|
"hide-second": $props.hideSecond,
|
disabled: !$data.tempRange.after,
|
class: "time-picker-style"
|
}, null, 8, ["end", "modelValue", "hide-second", "disabled"])
|
])
|
])) : vue.createCommentVNode("v-if", true),
|
!$props.insert ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 2,
|
class: "uni-date-changed uni-date-btn--ok"
|
}, [
|
vue.createElementVNode(
|
"view",
|
{
|
class: "uni-datetime-picker--btn",
|
onClick: _cache[8] || (_cache[8] = (...args) => $options.confirm && $options.confirm(...args))
|
},
|
vue.toDisplayString($options.confirmText),
|
1
|
/* TEXT */
|
)
|
])) : vue.createCommentVNode("v-if", true)
|
],
|
2
|
/* CLASS */
|
)) : vue.createCommentVNode("v-if", true)
|
],
|
32
|
/* NEED_HYDRATION */
|
);
|
}
|
const Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$h], ["__scopeId", "data-v-bbebfd0f"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-datetime-picker/calendar.vue"]]);
|
const _sfc_main$h = {
|
name: "UniDatetimePicker",
|
options: {
|
virtualHost: true
|
},
|
components: {
|
Calendar,
|
TimePicker
|
},
|
data() {
|
return {
|
isRange: false,
|
hasTime: false,
|
displayValue: "",
|
inputDate: "",
|
calendarDate: "",
|
pickerTime: "",
|
calendarRange: {
|
startDate: "",
|
startTime: "",
|
endDate: "",
|
endTime: ""
|
},
|
displayRangeValue: {
|
startDate: "",
|
endDate: ""
|
},
|
tempRange: {
|
startDate: "",
|
startTime: "",
|
endDate: "",
|
endTime: ""
|
},
|
// 左右日历同步数据
|
startMultipleStatus: {
|
before: "",
|
after: "",
|
data: [],
|
fulldate: ""
|
},
|
endMultipleStatus: {
|
before: "",
|
after: "",
|
data: [],
|
fulldate: ""
|
},
|
pickerVisible: false,
|
pickerPositionStyle: null,
|
isEmitValue: false,
|
isPhone: false,
|
isFirstShow: true,
|
i18nT: () => {
|
}
|
};
|
},
|
props: {
|
type: {
|
type: String,
|
default: "datetime"
|
},
|
value: {
|
type: [String, Number, Array, Date],
|
default: ""
|
},
|
modelValue: {
|
type: [String, Number, Array, Date],
|
default: ""
|
},
|
start: {
|
type: [Number, String],
|
default: ""
|
},
|
end: {
|
type: [Number, String],
|
default: ""
|
},
|
returnType: {
|
type: String,
|
default: "string"
|
},
|
placeholder: {
|
type: String,
|
default: ""
|
},
|
startPlaceholder: {
|
type: String,
|
default: ""
|
},
|
endPlaceholder: {
|
type: String,
|
default: ""
|
},
|
rangeSeparator: {
|
type: String,
|
default: "-"
|
},
|
border: {
|
type: [Boolean],
|
default: true
|
},
|
disabled: {
|
type: [Boolean],
|
default: false
|
},
|
clearIcon: {
|
type: [Boolean],
|
default: true
|
},
|
hideSecond: {
|
type: [Boolean],
|
default: false
|
},
|
defaultValue: {
|
type: [String, Object, Array],
|
default: ""
|
}
|
},
|
watch: {
|
type: {
|
immediate: true,
|
handler(newVal) {
|
this.hasTime = newVal.indexOf("time") !== -1;
|
this.isRange = newVal.indexOf("range") !== -1;
|
}
|
},
|
modelValue: {
|
immediate: true,
|
handler(newVal) {
|
if (this.isEmitValue) {
|
this.isEmitValue = false;
|
return;
|
}
|
this.initPicker(newVal);
|
}
|
},
|
start: {
|
immediate: true,
|
handler(newVal) {
|
if (!newVal)
|
return;
|
this.calendarRange.startDate = getDate(newVal);
|
if (this.hasTime) {
|
this.calendarRange.startTime = getTime(newVal);
|
}
|
}
|
},
|
end: {
|
immediate: true,
|
handler(newVal) {
|
if (!newVal)
|
return;
|
this.calendarRange.endDate = getDate(newVal);
|
if (this.hasTime) {
|
this.calendarRange.endTime = getTime(newVal, this.hideSecond);
|
}
|
}
|
}
|
},
|
computed: {
|
timepickerStartTime() {
|
const activeDate = this.isRange ? this.tempRange.startDate : this.inputDate;
|
return activeDate === this.calendarRange.startDate ? this.calendarRange.startTime : "";
|
},
|
timepickerEndTime() {
|
const activeDate = this.isRange ? this.tempRange.endDate : this.inputDate;
|
return activeDate === this.calendarRange.endDate ? this.calendarRange.endTime : "";
|
},
|
mobileCalendarTime() {
|
const timeRange = {
|
start: this.tempRange.startTime,
|
end: this.tempRange.endTime
|
};
|
return this.isRange ? timeRange : this.pickerTime;
|
},
|
mobSelectableTime() {
|
return {
|
start: this.calendarRange.startTime,
|
end: this.calendarRange.endTime
|
};
|
},
|
datePopupWidth() {
|
return this.isRange ? 653 : 301;
|
},
|
/**
|
* for i18n
|
*/
|
singlePlaceholderText() {
|
return this.placeholder || (this.type === "date" ? this.selectDateText : this.selectDateTimeText);
|
},
|
startPlaceholderText() {
|
return this.startPlaceholder || this.startDateText;
|
},
|
endPlaceholderText() {
|
return this.endPlaceholder || this.endDateText;
|
},
|
selectDateText() {
|
return this.i18nT("uni-datetime-picker.selectDate");
|
},
|
selectDateTimeText() {
|
return this.i18nT("uni-datetime-picker.selectDateTime");
|
},
|
selectTimeText() {
|
return this.i18nT("uni-datetime-picker.selectTime");
|
},
|
startDateText() {
|
return this.startPlaceholder || this.i18nT("uni-datetime-picker.startDate");
|
},
|
startTimeText() {
|
return this.i18nT("uni-datetime-picker.startTime");
|
},
|
endDateText() {
|
return this.endPlaceholder || this.i18nT("uni-datetime-picker.endDate");
|
},
|
endTimeText() {
|
return this.i18nT("uni-datetime-picker.endTime");
|
},
|
okText() {
|
return this.i18nT("uni-datetime-picker.ok");
|
},
|
clearText() {
|
return this.i18nT("uni-datetime-picker.clear");
|
},
|
showClearIcon() {
|
return this.clearIcon && !this.disabled && (this.displayValue || this.displayRangeValue.startDate && this.displayRangeValue.endDate);
|
}
|
},
|
created() {
|
this.initI18nT();
|
this.platform();
|
},
|
methods: {
|
initI18nT() {
|
const vueI18n = initVueI18n(i18nMessages);
|
this.i18nT = vueI18n.t;
|
},
|
initPicker(newVal) {
|
if (!newVal && !this.defaultValue || Array.isArray(newVal) && !newVal.length) {
|
this.$nextTick(() => {
|
this.clear(false);
|
});
|
return;
|
}
|
if (!Array.isArray(newVal) && !this.isRange) {
|
if (newVal) {
|
this.displayValue = this.inputDate = this.calendarDate = getDate(newVal);
|
if (this.hasTime) {
|
this.pickerTime = getTime(newVal, this.hideSecond);
|
this.displayValue = `${this.displayValue} ${this.pickerTime}`;
|
}
|
} else if (this.defaultValue) {
|
this.inputDate = this.calendarDate = getDate(this.defaultValue);
|
if (this.hasTime) {
|
this.pickerTime = getTime(this.defaultValue, this.hideSecond);
|
}
|
}
|
} else {
|
const [before, after] = newVal;
|
if (!before && !after)
|
return;
|
const beforeDate = getDate(before);
|
const beforeTime = getTime(before, this.hideSecond);
|
const afterDate = getDate(after);
|
const afterTime = getTime(after, this.hideSecond);
|
const startDate = beforeDate;
|
const endDate = afterDate;
|
this.displayRangeValue.startDate = this.tempRange.startDate = startDate;
|
this.displayRangeValue.endDate = this.tempRange.endDate = endDate;
|
if (this.hasTime) {
|
this.displayRangeValue.startDate = `${beforeDate} ${beforeTime}`;
|
this.displayRangeValue.endDate = `${afterDate} ${afterTime}`;
|
this.tempRange.startTime = beforeTime;
|
this.tempRange.endTime = afterTime;
|
}
|
const defaultRange = {
|
before: beforeDate,
|
after: afterDate
|
};
|
this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, defaultRange, {
|
which: "right"
|
});
|
this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, defaultRange, {
|
which: "left"
|
});
|
}
|
},
|
updateLeftCale(e2) {
|
const left = this.$refs.left;
|
left.cale.setHoverMultiple(e2.after);
|
left.setDate(this.$refs.left.nowDate.fullDate);
|
},
|
updateRightCale(e2) {
|
const right = this.$refs.right;
|
right.cale.setHoverMultiple(e2.after);
|
right.setDate(this.$refs.right.nowDate.fullDate);
|
},
|
platform() {
|
if (typeof navigator !== "undefined") {
|
this.isPhone = navigator.userAgent.toLowerCase().indexOf("mobile") !== -1;
|
return;
|
}
|
const {
|
windowWidth
|
} = uni.getSystemInfoSync();
|
this.isPhone = windowWidth <= 500;
|
this.windowWidth = windowWidth;
|
},
|
show() {
|
this.$emit("show");
|
if (this.disabled) {
|
return;
|
}
|
this.platform();
|
if (this.isPhone) {
|
setTimeout(() => {
|
this.$refs.mobile.open();
|
}, 0);
|
return;
|
}
|
this.pickerPositionStyle = {
|
top: "10px"
|
};
|
const dateEditor = uni.createSelectorQuery().in(this).select(".uni-date-editor");
|
dateEditor.boundingClientRect((rect) => {
|
if (this.windowWidth - rect.left < this.datePopupWidth) {
|
this.pickerPositionStyle.right = 0;
|
}
|
}).exec();
|
setTimeout(() => {
|
this.pickerVisible = !this.pickerVisible;
|
if (!this.isPhone && this.isRange && this.isFirstShow) {
|
this.isFirstShow = false;
|
const {
|
startDate,
|
endDate
|
} = this.calendarRange;
|
if (startDate && endDate) {
|
if (this.diffDate(startDate, endDate) < 30) {
|
this.$refs.right.changeMonth("pre");
|
}
|
} else {
|
if (this.isPhone) {
|
this.$refs.right.cale.lastHover = false;
|
}
|
}
|
}
|
}, 50);
|
},
|
close() {
|
setTimeout(() => {
|
this.pickerVisible = false;
|
this.$emit("maskClick", this.value);
|
this.$refs.mobile && this.$refs.mobile.close();
|
}, 20);
|
},
|
setEmit(value) {
|
if (this.returnType === "timestamp" || this.returnType === "date") {
|
if (!Array.isArray(value)) {
|
if (!this.hasTime) {
|
value = value + " 00:00:00";
|
}
|
value = this.createTimestamp(value);
|
if (this.returnType === "date") {
|
value = new Date(value);
|
}
|
} else {
|
if (!this.hasTime) {
|
value[0] = value[0] + " 00:00:00";
|
value[1] = value[1] + " 00:00:00";
|
}
|
value[0] = this.createTimestamp(value[0]);
|
value[1] = this.createTimestamp(value[1]);
|
if (this.returnType === "date") {
|
value[0] = new Date(value[0]);
|
value[1] = new Date(value[1]);
|
}
|
}
|
}
|
this.$emit("update:modelValue", value);
|
this.$emit("input", value);
|
this.$emit("change", value);
|
this.isEmitValue = true;
|
},
|
createTimestamp(date) {
|
date = fixIosDateFormat(date);
|
return Date.parse(new Date(date));
|
},
|
singleChange(e2) {
|
this.calendarDate = this.inputDate = e2.fulldate;
|
if (this.hasTime)
|
return;
|
this.confirmSingleChange();
|
},
|
confirmSingleChange() {
|
if (!checkDate(this.inputDate)) {
|
const now2 = /* @__PURE__ */ new Date();
|
this.calendarDate = this.inputDate = getDate(now2);
|
this.pickerTime = getTime(now2, this.hideSecond);
|
}
|
let startLaterInputDate = false;
|
let startDate, startTime;
|
if (this.start) {
|
let startString = this.start;
|
if (typeof this.start === "number") {
|
startString = getDateTime(this.start, this.hideSecond);
|
}
|
[startDate, startTime] = startString.split(" ");
|
if (this.start && !dateCompare(startDate, this.inputDate)) {
|
startLaterInputDate = true;
|
this.inputDate = startDate;
|
}
|
}
|
let endEarlierInputDate = false;
|
let endDate, endTime;
|
if (this.end) {
|
let endString = this.end;
|
if (typeof this.end === "number") {
|
endString = getDateTime(this.end, this.hideSecond);
|
}
|
[endDate, endTime] = endString.split(" ");
|
if (this.end && !dateCompare(this.inputDate, endDate)) {
|
endEarlierInputDate = true;
|
this.inputDate = endDate;
|
}
|
}
|
if (this.hasTime) {
|
if (startLaterInputDate) {
|
this.pickerTime = startTime || getDefaultSecond(this.hideSecond);
|
}
|
if (endEarlierInputDate) {
|
this.pickerTime = endTime || getDefaultSecond(this.hideSecond);
|
}
|
if (!this.pickerTime) {
|
this.pickerTime = getTime(Date.now(), this.hideSecond);
|
}
|
this.displayValue = `${this.inputDate} ${this.pickerTime}`;
|
} else {
|
this.displayValue = this.inputDate;
|
}
|
this.setEmit(this.displayValue);
|
this.pickerVisible = false;
|
},
|
leftChange(e2) {
|
const {
|
before,
|
after
|
} = e2.range;
|
this.rangeChange(before, after);
|
const obj = {
|
before: e2.range.before,
|
after: e2.range.after,
|
data: e2.range.data,
|
fulldate: e2.fulldate
|
};
|
this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, obj);
|
this.$emit("calendarClick", e2);
|
},
|
rightChange(e2) {
|
const {
|
before,
|
after
|
} = e2.range;
|
this.rangeChange(before, after);
|
const obj = {
|
before: e2.range.before,
|
after: e2.range.after,
|
data: e2.range.data,
|
fulldate: e2.fulldate
|
};
|
this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, obj);
|
this.$emit("calendarClick", e2);
|
},
|
mobileChange(e2) {
|
if (this.isRange) {
|
const {
|
before,
|
after
|
} = e2.range;
|
if (!before) {
|
return;
|
}
|
this.handleStartAndEnd(before, after, true);
|
if (this.hasTime) {
|
const {
|
startTime,
|
endTime
|
} = e2.timeRange;
|
this.tempRange.startTime = startTime;
|
this.tempRange.endTime = endTime;
|
}
|
this.confirmRangeChange();
|
} else {
|
if (this.hasTime) {
|
this.displayValue = e2.fulldate + " " + e2.time;
|
} else {
|
this.displayValue = e2.fulldate;
|
}
|
this.setEmit(this.displayValue);
|
}
|
this.$refs.mobile.close();
|
},
|
rangeChange(before, after) {
|
if (!(before && after))
|
return;
|
this.handleStartAndEnd(before, after, true);
|
if (this.hasTime)
|
return;
|
this.confirmRangeChange();
|
},
|
confirmRangeChange() {
|
if (!this.tempRange.startDate || !this.tempRange.endDate) {
|
this.pickerVisible = false;
|
return;
|
}
|
if (!checkDate(this.tempRange.startDate)) {
|
this.tempRange.startDate = getDate(Date.now());
|
}
|
if (!checkDate(this.tempRange.endDate)) {
|
this.tempRange.endDate = getDate(Date.now());
|
}
|
let start, end;
|
let startDateLaterRangeStartDate = false;
|
let startDateLaterRangeEndDate = false;
|
let startDate, startTime;
|
if (this.start) {
|
let startString = this.start;
|
if (typeof this.start === "number") {
|
startString = getDateTime(this.start, this.hideSecond);
|
}
|
[startDate, startTime] = startString.split(" ");
|
if (this.start && !dateCompare(this.start, `${this.tempRange.startDate} ${this.tempRange.startTime}`)) {
|
startDateLaterRangeStartDate = true;
|
this.tempRange.startDate = startDate;
|
}
|
if (this.start && !dateCompare(this.start, `${this.tempRange.endDate} ${this.tempRange.endTime}`)) {
|
startDateLaterRangeEndDate = true;
|
this.tempRange.endDate = startDate;
|
}
|
}
|
let endDateEarlierRangeStartDate = false;
|
let endDateEarlierRangeEndDate = false;
|
let endDate, endTime;
|
if (this.end) {
|
let endString = this.end;
|
if (typeof this.end === "number") {
|
endString = getDateTime(this.end, this.hideSecond);
|
}
|
[endDate, endTime] = endString.split(" ");
|
if (this.end && !dateCompare(`${this.tempRange.startDate} ${this.tempRange.startTime}`, this.end)) {
|
endDateEarlierRangeStartDate = true;
|
this.tempRange.startDate = endDate;
|
}
|
if (this.end && !dateCompare(`${this.tempRange.endDate} ${this.tempRange.endTime}`, this.end)) {
|
endDateEarlierRangeEndDate = true;
|
this.tempRange.endDate = endDate;
|
}
|
}
|
if (!this.hasTime) {
|
start = this.displayRangeValue.startDate = this.tempRange.startDate;
|
end = this.displayRangeValue.endDate = this.tempRange.endDate;
|
} else {
|
if (startDateLaterRangeStartDate) {
|
this.tempRange.startTime = startTime || getDefaultSecond(this.hideSecond);
|
} else if (endDateEarlierRangeStartDate) {
|
this.tempRange.startTime = endTime || getDefaultSecond(this.hideSecond);
|
}
|
if (!this.tempRange.startTime) {
|
this.tempRange.startTime = getTime(Date.now(), this.hideSecond);
|
}
|
if (startDateLaterRangeEndDate) {
|
this.tempRange.endTime = startTime || getDefaultSecond(this.hideSecond);
|
} else if (endDateEarlierRangeEndDate) {
|
this.tempRange.endTime = endTime || getDefaultSecond(this.hideSecond);
|
}
|
if (!this.tempRange.endTime) {
|
this.tempRange.endTime = getTime(Date.now(), this.hideSecond);
|
}
|
start = this.displayRangeValue.startDate = `${this.tempRange.startDate} ${this.tempRange.startTime}`;
|
end = this.displayRangeValue.endDate = `${this.tempRange.endDate} ${this.tempRange.endTime}`;
|
}
|
if (!dateCompare(start, end)) {
|
[start, end] = [end, start];
|
}
|
this.displayRangeValue.startDate = start;
|
this.displayRangeValue.endDate = end;
|
const displayRange = [start, end];
|
this.setEmit(displayRange);
|
this.pickerVisible = false;
|
},
|
handleStartAndEnd(before, after, temp = false) {
|
if (!before)
|
return;
|
if (!after)
|
after = before;
|
const type = temp ? "tempRange" : "range";
|
const isStartEarlierEnd = dateCompare(before, after);
|
this[type].startDate = isStartEarlierEnd ? before : after;
|
this[type].endDate = isStartEarlierEnd ? after : before;
|
},
|
/**
|
* 比较时间大小
|
*/
|
dateCompare(startDate, endDate) {
|
startDate = new Date(startDate.replace("-", "/").replace("-", "/"));
|
endDate = new Date(endDate.replace("-", "/").replace("-", "/"));
|
return startDate <= endDate;
|
},
|
/**
|
* 比较时间差
|
*/
|
diffDate(startDate, endDate) {
|
startDate = new Date(startDate.replace("-", "/").replace("-", "/"));
|
endDate = new Date(endDate.replace("-", "/").replace("-", "/"));
|
const diff = (endDate - startDate) / (24 * 60 * 60 * 1e3);
|
return Math.abs(diff);
|
},
|
clear(needEmit = true) {
|
if (!this.isRange) {
|
this.displayValue = "";
|
this.inputDate = "";
|
this.pickerTime = "";
|
if (this.isPhone) {
|
this.$refs.mobile && this.$refs.mobile.clearCalender();
|
} else {
|
this.$refs.pcSingle && this.$refs.pcSingle.clearCalender();
|
}
|
if (needEmit) {
|
this.$emit("change", "");
|
this.$emit("input", "");
|
this.$emit("update:modelValue", "");
|
}
|
} else {
|
this.displayRangeValue.startDate = "";
|
this.displayRangeValue.endDate = "";
|
this.tempRange.startDate = "";
|
this.tempRange.startTime = "";
|
this.tempRange.endDate = "";
|
this.tempRange.endTime = "";
|
if (this.isPhone) {
|
this.$refs.mobile && this.$refs.mobile.clearCalender();
|
} else {
|
this.$refs.left && this.$refs.left.clearCalender();
|
this.$refs.right && this.$refs.right.clearCalender();
|
this.$refs.right && this.$refs.right.changeMonth("next");
|
}
|
if (needEmit) {
|
this.$emit("change", []);
|
this.$emit("input", []);
|
this.$emit("update:modelValue", []);
|
}
|
}
|
},
|
calendarClick(e2) {
|
this.$emit("calendarClick", e2);
|
}
|
}
|
};
|
function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$6);
|
const _component_time_picker = vue.resolveComponent("time-picker");
|
const _component_Calendar = vue.resolveComponent("Calendar");
|
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-date" }, [
|
vue.createElementVNode("view", {
|
class: "uni-date-editor",
|
onClick: _cache[1] || (_cache[1] = (...args) => $options.show && $options.show(...args))
|
}, [
|
vue.renderSlot(_ctx.$slots, "default", {}, () => [
|
vue.createElementVNode(
|
"view",
|
{
|
class: vue.normalizeClass(["uni-date-editor--x", { "uni-date-editor--x__disabled": $props.disabled, "uni-date-x--border": $props.border }])
|
},
|
[
|
!$data.isRange ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
class: "uni-date-x uni-date-single"
|
}, [
|
vue.createVNode(_component_uni_icons, {
|
class: "icon-calendar",
|
type: "calendar",
|
color: "#c0c4cc",
|
size: "22"
|
}),
|
vue.createElementVNode(
|
"view",
|
{ class: "uni-date__x-input" },
|
vue.toDisplayString($data.displayValue || $options.singlePlaceholderText),
|
1
|
/* TEXT */
|
)
|
])) : (vue.openBlock(), vue.createElementBlock("view", {
|
key: 1,
|
class: "uni-date-x uni-date-range"
|
}, [
|
vue.createVNode(_component_uni_icons, {
|
class: "icon-calendar",
|
type: "calendar",
|
color: "#c0c4cc",
|
size: "22"
|
}),
|
vue.createElementVNode(
|
"view",
|
{ class: "uni-date__x-input text-center" },
|
vue.toDisplayString($data.displayRangeValue.startDate || $options.startPlaceholderText),
|
1
|
/* TEXT */
|
),
|
vue.createElementVNode(
|
"view",
|
{ class: "range-separator" },
|
vue.toDisplayString($props.rangeSeparator),
|
1
|
/* TEXT */
|
),
|
vue.createElementVNode(
|
"view",
|
{ class: "uni-date__x-input text-center" },
|
vue.toDisplayString($data.displayRangeValue.endDate || $options.endPlaceholderText),
|
1
|
/* TEXT */
|
)
|
])),
|
$options.showClearIcon ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 2,
|
class: "uni-date__icon-clear",
|
onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => $options.clear && $options.clear(...args), ["stop"]))
|
}, [
|
vue.createVNode(_component_uni_icons, {
|
type: "clear",
|
color: "#c0c4cc",
|
size: "22"
|
})
|
])) : vue.createCommentVNode("v-if", true)
|
],
|
2
|
/* CLASS */
|
)
|
], true)
|
]),
|
vue.withDirectives(vue.createElementVNode(
|
"view",
|
{
|
class: "uni-date-mask--pc",
|
onClick: _cache[2] || (_cache[2] = (...args) => $options.close && $options.close(...args))
|
},
|
null,
|
512
|
/* NEED_PATCH */
|
), [
|
[vue.vShow, $data.pickerVisible]
|
]),
|
!$data.isPhone ? vue.withDirectives((vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 0,
|
ref: "datePicker",
|
class: "uni-date-picker__container"
|
},
|
[
|
!$data.isRange ? (vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 0,
|
class: "uni-date-single--x",
|
style: vue.normalizeStyle($data.pickerPositionStyle)
|
},
|
[
|
vue.createElementVNode("view", { class: "uni-popper__arrow" }),
|
$data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
class: "uni-date-changed popup-x-header"
|
}, [
|
vue.withDirectives(vue.createElementVNode("input", {
|
class: "uni-date__input text-center",
|
type: "text",
|
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.inputDate = $event),
|
placeholder: $options.selectDateText
|
}, null, 8, ["placeholder"]), [
|
[vue.vModelText, $data.inputDate]
|
]),
|
vue.createVNode(_component_time_picker, {
|
type: "time",
|
modelValue: $data.pickerTime,
|
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.pickerTime = $event),
|
border: false,
|
disabled: !$data.inputDate,
|
start: $options.timepickerStartTime,
|
end: $options.timepickerEndTime,
|
hideSecond: $props.hideSecond,
|
style: { "width": "100%" }
|
}, {
|
default: vue.withCtx(() => [
|
vue.withDirectives(vue.createElementVNode("input", {
|
class: "uni-date__input text-center",
|
type: "text",
|
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.pickerTime = $event),
|
placeholder: $options.selectTimeText,
|
disabled: !$data.inputDate
|
}, null, 8, ["placeholder", "disabled"]), [
|
[vue.vModelText, $data.pickerTime]
|
])
|
]),
|
_: 1
|
/* STABLE */
|
}, 8, ["modelValue", "disabled", "start", "end", "hideSecond"])
|
])) : vue.createCommentVNode("v-if", true),
|
vue.createVNode(_component_Calendar, {
|
ref: "pcSingle",
|
showMonth: false,
|
"start-date": $data.calendarRange.startDate,
|
"end-date": $data.calendarRange.endDate,
|
date: $data.calendarDate,
|
onChange: $options.singleChange,
|
"default-value": $props.defaultValue,
|
style: { "padding": "0 8px" }
|
}, null, 8, ["start-date", "end-date", "date", "onChange", "default-value"]),
|
$data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 1,
|
class: "popup-x-footer"
|
}, [
|
vue.createElementVNode(
|
"text",
|
{
|
class: "confirm-text",
|
onClick: _cache[6] || (_cache[6] = (...args) => $options.confirmSingleChange && $options.confirmSingleChange(...args))
|
},
|
vue.toDisplayString($options.okText),
|
1
|
/* TEXT */
|
)
|
])) : vue.createCommentVNode("v-if", true)
|
],
|
4
|
/* STYLE */
|
)) : (vue.openBlock(), vue.createElementBlock(
|
"view",
|
{
|
key: 1,
|
class: "uni-date-range--x",
|
style: vue.normalizeStyle($data.pickerPositionStyle)
|
},
|
[
|
vue.createElementVNode("view", { class: "uni-popper__arrow" }),
|
$data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 0,
|
class: "popup-x-header uni-date-changed"
|
}, [
|
vue.createElementVNode("view", { class: "popup-x-header--datetime" }, [
|
vue.withDirectives(vue.createElementVNode("input", {
|
class: "uni-date__input uni-date-range__input",
|
type: "text",
|
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $data.tempRange.startDate = $event),
|
placeholder: $options.startDateText
|
}, null, 8, ["placeholder"]), [
|
[vue.vModelText, $data.tempRange.startDate]
|
]),
|
vue.createVNode(_component_time_picker, {
|
type: "time",
|
modelValue: $data.tempRange.startTime,
|
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => $data.tempRange.startTime = $event),
|
start: $options.timepickerStartTime,
|
border: false,
|
disabled: !$data.tempRange.startDate,
|
hideSecond: $props.hideSecond
|
}, {
|
default: vue.withCtx(() => [
|
vue.withDirectives(vue.createElementVNode("input", {
|
class: "uni-date__input uni-date-range__input",
|
type: "text",
|
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $data.tempRange.startTime = $event),
|
placeholder: $options.startTimeText,
|
disabled: !$data.tempRange.startDate
|
}, null, 8, ["placeholder", "disabled"]), [
|
[vue.vModelText, $data.tempRange.startTime]
|
])
|
]),
|
_: 1
|
/* STABLE */
|
}, 8, ["modelValue", "start", "disabled", "hideSecond"])
|
]),
|
vue.createVNode(_component_uni_icons, {
|
type: "arrowthinright",
|
color: "#999",
|
style: { "line-height": "40px" }
|
}),
|
vue.createElementVNode("view", { class: "popup-x-header--datetime" }, [
|
vue.withDirectives(vue.createElementVNode("input", {
|
class: "uni-date__input uni-date-range__input",
|
type: "text",
|
"onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => $data.tempRange.endDate = $event),
|
placeholder: $options.endDateText
|
}, null, 8, ["placeholder"]), [
|
[vue.vModelText, $data.tempRange.endDate]
|
]),
|
vue.createVNode(_component_time_picker, {
|
type: "time",
|
modelValue: $data.tempRange.endTime,
|
"onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => $data.tempRange.endTime = $event),
|
end: $options.timepickerEndTime,
|
border: false,
|
disabled: !$data.tempRange.endDate,
|
hideSecond: $props.hideSecond
|
}, {
|
default: vue.withCtx(() => [
|
vue.withDirectives(vue.createElementVNode("input", {
|
class: "uni-date__input uni-date-range__input",
|
type: "text",
|
"onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => $data.tempRange.endTime = $event),
|
placeholder: $options.endTimeText,
|
disabled: !$data.tempRange.endDate
|
}, null, 8, ["placeholder", "disabled"]), [
|
[vue.vModelText, $data.tempRange.endTime]
|
])
|
]),
|
_: 1
|
/* STABLE */
|
}, 8, ["modelValue", "end", "disabled", "hideSecond"])
|
])
|
])) : vue.createCommentVNode("v-if", true),
|
vue.createElementVNode("view", { class: "popup-x-body" }, [
|
vue.createVNode(_component_Calendar, {
|
ref: "left",
|
showMonth: false,
|
"start-date": $data.calendarRange.startDate,
|
"end-date": $data.calendarRange.endDate,
|
range: true,
|
pleStatus: $data.endMultipleStatus,
|
onChange: $options.leftChange,
|
onFirstEnterCale: $options.updateRightCale,
|
style: { "padding": "0 8px" }
|
}, null, 8, ["start-date", "end-date", "pleStatus", "onChange", "onFirstEnterCale"]),
|
vue.createVNode(_component_Calendar, {
|
ref: "right",
|
showMonth: false,
|
"start-date": $data.calendarRange.startDate,
|
"end-date": $data.calendarRange.endDate,
|
range: true,
|
onChange: $options.rightChange,
|
pleStatus: $data.startMultipleStatus,
|
onFirstEnterCale: $options.updateLeftCale,
|
style: { "padding": "0 8px", "border-left": "1px solid #F1F1F1" }
|
}, null, 8, ["start-date", "end-date", "onChange", "pleStatus", "onFirstEnterCale"])
|
]),
|
$data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 1,
|
class: "popup-x-footer"
|
}, [
|
vue.createElementVNode(
|
"text",
|
{
|
onClick: _cache[13] || (_cache[13] = (...args) => $options.clear && $options.clear(...args))
|
},
|
vue.toDisplayString($options.clearText),
|
1
|
/* TEXT */
|
),
|
vue.createElementVNode(
|
"text",
|
{
|
class: "confirm-text",
|
onClick: _cache[14] || (_cache[14] = (...args) => $options.confirmRangeChange && $options.confirmRangeChange(...args))
|
},
|
vue.toDisplayString($options.okText),
|
1
|
/* TEXT */
|
)
|
])) : vue.createCommentVNode("v-if", true)
|
],
|
4
|
/* STYLE */
|
))
|
],
|
512
|
/* NEED_PATCH */
|
)), [
|
[vue.vShow, $data.pickerVisible]
|
]) : vue.createCommentVNode("v-if", true),
|
$data.isPhone ? (vue.openBlock(), vue.createBlock(_component_Calendar, {
|
key: 1,
|
ref: "mobile",
|
clearDate: false,
|
date: $data.calendarDate,
|
defTime: $options.mobileCalendarTime,
|
"start-date": $data.calendarRange.startDate,
|
"end-date": $data.calendarRange.endDate,
|
selectableTimes: $options.mobSelectableTime,
|
startPlaceholder: $props.startPlaceholder,
|
endPlaceholder: $props.endPlaceholder,
|
"default-value": $props.defaultValue,
|
pleStatus: $data.endMultipleStatus,
|
showMonth: false,
|
range: $data.isRange,
|
hasTime: $data.hasTime,
|
insert: false,
|
hideSecond: $props.hideSecond,
|
onConfirm: $options.mobileChange,
|
onMaskClose: $options.close,
|
onChange: $options.calendarClick
|
}, null, 8, ["date", "defTime", "start-date", "end-date", "selectableTimes", "startPlaceholder", "endPlaceholder", "default-value", "pleStatus", "range", "hasTime", "hideSecond", "onConfirm", "onMaskClose", "onChange"])) : vue.createCommentVNode("v-if", true)
|
]);
|
}
|
const __easycom_0$2 = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$g], ["__scopeId", "data-v-9a209c07"], ["__file", "D:/Documents/app/qrcodeScaner/node_modules/@dcloudio/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue"]]);
|
const _sfc_main$g = {
|
__name: "QuantityCompletion",
|
setup(__props, { expose: __expose }) {
|
__expose();
|
const store = userInfo();
|
const list = vue.ref({
|
"order_id": "订/序/片",
|
"child_width": "宽",
|
"child_height": "高",
|
"completed_quantity": "完工",
|
"breakage_quantity": "破损",
|
"finish_area": "完工面积",
|
"breakage_area": "次破面积"
|
});
|
const filterList = vue.ref({
|
"order_id": null,
|
"child_width": null,
|
"child_height": null,
|
"completed_quantity": null,
|
"breakage_quantity": null
|
});
|
const datetimerange = vue.ref([null, null]);
|
const reportingWorkList = vue.ref([]);
|
const reportingWorkListAll = vue.ref([]);
|
const getReportingWorkList = async () => {
|
const obj = {
|
userId: store.user.userId,
|
process: store.user.address,
|
searchDate: datetimerange.value
|
};
|
await request.post(`/reportingWork/selectShiftQuantity`, obj).then((res) => {
|
if (res.code === "200") {
|
reportingWorkList.value = res.data.data;
|
reportingWorkListAll.value = res.data.data;
|
datetimerange.value = res.data.date;
|
}
|
}).catch((err) => {
|
uni.showModal({
|
title: "提示",
|
content: err,
|
showCancel: false
|
});
|
});
|
};
|
vue.onMounted(async () => {
|
await getReportingWorkList();
|
});
|
const changeTime = () => {
|
getReportingWorkList();
|
};
|
const sum = (val, index) => {
|
if (index === 0) {
|
return "合计:";
|
}
|
const arr = ["completed_quantity", "breakage_quantity", "finish_area", "breakage_area"];
|
if (arr.includes(val)) {
|
let sum2 = 0;
|
reportingWorkList.value.forEach((item) => {
|
sum2 = Number(item[val]) + Number(sum2);
|
});
|
return sum2.toFixed(2).toString().replace(/\.?0+$/, "");
|
} else {
|
return null;
|
}
|
};
|
const filterInfo = () => {
|
let filter = Object.fromEntries(
|
Object.entries(filterList.value).filter(([_2, value]) => value !== null && value !== "")
|
);
|
if (JSON.stringify(filter) === "{}") {
|
reportingWorkList.value = reportingWorkListAll.value;
|
} else {
|
reportingWorkList.value = reportingWorkListAll.value.filter((item) => {
|
return Object.keys(filter).every((key) => {
|
return item[key].toString().includes(filter[key]);
|
});
|
});
|
}
|
};
|
const __returned__ = { store, list, filterList, datetimerange, reportingWorkList, reportingWorkListAll, getReportingWorkList, changeTime, sum, filterInfo, computed: vue.computed, onMounted: vue.onMounted, ref: vue.ref, watch: vue.watch, get userInfo() {
|
return userInfo;
|
}, get request() {
|
return request;
|
} };
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
return __returned__;
|
}
|
};
|
function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_uni_datetime_picker = resolveEasycom(vue.resolveDynamicComponent("uni-datetime-picker"), __easycom_0$2);
|
const _component_uni_th = resolveEasycom(vue.resolveDynamicComponent("uni-th"), __easycom_1$3);
|
const _component_uni_tr = resolveEasycom(vue.resolveDynamicComponent("uni-tr"), __easycom_2);
|
const _component_uni_td = resolveEasycom(vue.resolveDynamicComponent("uni-td"), __easycom_4);
|
const _component_uni_table = resolveEasycom(vue.resolveDynamicComponent("uni-table"), __easycom_5);
|
return vue.openBlock(), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
[
|
vue.createElementVNode("view", null, [
|
vue.createVNode(_component_uni_datetime_picker, {
|
onChange: $setup.changeTime,
|
modelValue: $setup.datetimerange,
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.datetimerange = $event),
|
type: "datetimerange",
|
rangeSeparator: "/"
|
}, null, 8, ["modelValue"])
|
]),
|
vue.createElementVNode("view", null, [
|
vue.createVNode(_component_uni_table, {
|
border: "",
|
stripe: "",
|
style: { "width": "100%", "max-height": "100%", "overflow-y": "auto" }
|
}, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_tr, null, {
|
default: vue.withCtx(() => [
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($setup.list, (item, keys, index) => {
|
return vue.openBlock(), vue.createBlock(_component_uni_th, {
|
width: index == 0 ? 70 : 45,
|
align: "center"
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
}, 1032, ["width"]);
|
}),
|
256
|
/* UNKEYED_FRAGMENT */
|
))
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_tr, null, {
|
default: vue.withCtx(() => [
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($setup.filterList, (item, keys, index) => {
|
return vue.openBlock(), vue.createBlock(_component_uni_th, {
|
width: index == 0 ? 70 : 45,
|
align: "center"
|
}, {
|
default: vue.withCtx(() => [
|
vue.withDirectives(vue.createElementVNode("input", {
|
onBlur: $setup.filterInfo,
|
type: "text",
|
size: "mini",
|
"onUpdate:modelValue": ($event) => $setup.filterList[keys] = $event
|
}, null, 40, ["onUpdate:modelValue"]), [
|
[
|
vue.vModelText,
|
$setup.filterList[keys],
|
void 0,
|
{ trim: true }
|
]
|
])
|
]),
|
_: 2
|
/* DYNAMIC */
|
}, 1032, ["width"]);
|
}),
|
256
|
/* UNKEYED_FRAGMENT */
|
))
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($setup.reportingWorkList, (items) => {
|
return vue.openBlock(), vue.createBlock(
|
_component_uni_tr,
|
null,
|
{
|
default: vue.withCtx(() => [
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($setup.list, (item, keys) => {
|
return vue.openBlock(), vue.createBlock(
|
_component_uni_td,
|
{ style: { "text-align": "center" } },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(items[keys]),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
);
|
}),
|
256
|
/* UNKEYED_FRAGMENT */
|
))
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
);
|
}),
|
256
|
/* UNKEYED_FRAGMENT */
|
)),
|
vue.createVNode(_component_uni_tr, null, {
|
default: vue.withCtx(() => [
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($setup.list, (item, keys, index) => {
|
return vue.openBlock(), vue.createBlock(
|
_component_uni_td,
|
{ style: { "text-align": "center" } },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString($setup.sum(keys, index)),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
);
|
}),
|
256
|
/* UNKEYED_FRAGMENT */
|
))
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
})
|
])
|
],
|
64
|
/* STABLE_FRAGMENT */
|
);
|
}
|
const PagesQuantityCompletionQuantityCompletion = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$f], ["__file", "D:/Documents/app/qrcodeScaner/pages/QuantityCompletion/QuantityCompletion.vue"]]);
|
const _sfc_main$f = {
|
__name: "ReviewReporitingWork",
|
setup(__props, { expose: __expose }) {
|
__expose();
|
const store = userInfo();
|
const reviewTitle = vue.ref({
|
reportingWorkId: "报工编号",
|
processId: "流程卡号",
|
thisProcess: "工序",
|
teamsGroupsName: "班组",
|
thisCompletedQuantity: "完工",
|
thisWornQuantity: "次破",
|
reportingWorkTime: "报工时间"
|
});
|
const quanlityReviewList = vue.ref([]);
|
vue.onMounted(() => {
|
getQuanlityReviewList();
|
});
|
const getQuanlityReviewList = async () => {
|
await request.post("/reportingWork/qualityReviewSearch").then((res) => {
|
if (res.code === "200") {
|
quanlityReviewList.value = res.data.data;
|
}
|
}).catch((err) => {
|
uni.showModal({
|
title: "提示",
|
content: err,
|
showCancel: false
|
});
|
});
|
};
|
const confirmOpen = (row) => {
|
uni.showModal({
|
title: "提示",
|
content: "确认审核",
|
success: async (res) => {
|
if (res.confirm) {
|
await reviewDamage(row);
|
}
|
}
|
});
|
};
|
const reviewDamage = async (row) => {
|
await request.post(`/reportingWork/updateQualityStatus/${row.reportingWorkId}/${store.user.userName}`).then(async (res) => {
|
if (res.code === "200") {
|
await getQuanlityReviewList();
|
uni.showModal({
|
title: "提示",
|
content: "审核成功",
|
showCancel: false
|
});
|
}
|
}).catch((err) => {
|
uni.showModal({
|
title: "提示",
|
content: err,
|
showCancel: false
|
});
|
});
|
};
|
const __returned__ = { store, reviewTitle, quanlityReviewList, getQuanlityReviewList, confirmOpen, reviewDamage, ref: vue.ref, onMounted: vue.onMounted, get request() {
|
return request;
|
}, get userInfo() {
|
return userInfo;
|
} };
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
return __returned__;
|
}
|
};
|
function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_uni_th = resolveEasycom(vue.resolveDynamicComponent("uni-th"), __easycom_1$3);
|
const _component_uni_tr = resolveEasycom(vue.resolveDynamicComponent("uni-tr"), __easycom_2);
|
const _component_uni_td = resolveEasycom(vue.resolveDynamicComponent("uni-td"), __easycom_4);
|
const _component_uni_table = resolveEasycom(vue.resolveDynamicComponent("uni-table"), __easycom_5);
|
return vue.openBlock(), vue.createElementBlock("view", null, [
|
vue.createVNode(_component_uni_table, {
|
border: "",
|
stripe: "",
|
style: { "width": "100%", "height": "100%", "overflow": "auto" }
|
}, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_tr, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_th, { align: "center" }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode(" 操作 ")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($setup.reviewTitle, (item, keys, index) => {
|
return vue.openBlock(), vue.createBlock(
|
_component_uni_th,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
);
|
}),
|
256
|
/* UNKEYED_FRAGMENT */
|
))
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($setup.quanlityReviewList, (items) => {
|
return vue.openBlock(), vue.createBlock(
|
_component_uni_tr,
|
null,
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createElementVNode("button", {
|
onClick: ($event) => $setup.confirmOpen(items),
|
class: "uni-button",
|
size: "mini",
|
type: "primary"
|
}, "审核", 8, ["onClick"])
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($setup.reviewTitle, (item, keys) => {
|
return vue.openBlock(), vue.createBlock(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(items[keys]),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
);
|
}),
|
256
|
/* UNKEYED_FRAGMENT */
|
))
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
);
|
}),
|
256
|
/* UNKEYED_FRAGMENT */
|
))
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]);
|
}
|
const PagesReviewReporitingWorkReviewReporitingWork = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$e], ["__file", "D:/Documents/app/qrcodeScaner/pages/ReviewReporitingWork/ReviewReporitingWork.vue"]]);
|
const _sfc_main$e = {
|
__name: "ReportingWorkList",
|
setup(__props, { expose: __expose }) {
|
__expose();
|
const message = vue.ref(null);
|
const msgType = vue.ref("success");
|
const messageText = vue.ref("");
|
const popup2 = vue.ref(null);
|
const store = userInfo();
|
const reportingWorkList = vue.ref([]);
|
const reportingWorkTitle = vue.ref({
|
reportingWorkId: "报工编号",
|
processId: "流程卡",
|
thisProcess: "工序",
|
thisCompletedQuantity: "完工",
|
thisWornQuantity: "次破",
|
creator: "班组"
|
});
|
let reportingWorkId = vue.ref(null);
|
let processId = vue.ref(null);
|
const datetimerange = vue.ref([null, null]);
|
vue.onMounted(async () => {
|
await getReportingWorkList();
|
});
|
const changeTime = () => {
|
getReportingWorkList();
|
};
|
const getReportingWorkList = async () => {
|
const obj = {
|
userId: store.user.userId,
|
//store.user.userId
|
process: store.user.address,
|
//
|
searchDate: datetimerange.value
|
};
|
await request.post("/reportingWork/selectReportingWorkRecordByPhone", obj).then((res) => {
|
datetimerange.value = res.data.date;
|
reportingWorkList.value = res.data.data;
|
}).catch((err) => {
|
uni.showModal({
|
title: "提示",
|
content: err,
|
showCancel: false
|
});
|
});
|
};
|
const deleteReportingWorkClick = (reportingWorkId1, processId1) => {
|
reportingWorkId.value = reportingWorkId1;
|
processId.value = processId1;
|
popup2.value.open();
|
};
|
const deleteReportingWork = (reportingWorkId2, processId2) => {
|
processId2 = processId2.split("/")[0];
|
request.post(`/reportingWork/deleteWork/${reportingWorkId2}/${processId2}/${store.user.address}/${store.user.userId}/${store.user.userName}`).then(async (res) => {
|
if (res.code === "200" && res.data === true) {
|
await getReportingWorkList();
|
messageToggle("success", "删除成功");
|
} else {
|
messageToggle("error", "删除失败,请检查下工序是否已报工或者已补片返工");
|
}
|
}).catch((err) => {
|
uni.showModal({
|
title: "提示",
|
content: err,
|
showCancel: false
|
});
|
});
|
};
|
const messageToggle = (type, msg) => {
|
msgType.value = type;
|
messageText.value = msg;
|
message.value.open();
|
};
|
const close = async () => {
|
await popup2.value.close();
|
reportingWorkId.value = null;
|
processId.value = null;
|
};
|
const confirm = async () => {
|
await popup2.value.close();
|
await deleteReportingWork(reportingWorkId.value, processId.value);
|
reportingWorkId.value = null;
|
processId.value = null;
|
};
|
const __returned__ = { message, msgType, messageText, popup: popup2, store, reportingWorkList, reportingWorkTitle, get reportingWorkId() {
|
return reportingWorkId;
|
}, set reportingWorkId(v2) {
|
reportingWorkId = v2;
|
}, get processId() {
|
return processId;
|
}, set processId(v2) {
|
processId = v2;
|
}, datetimerange, changeTime, getReportingWorkList, deleteReportingWorkClick, deleteReportingWork, messageToggle, close, confirm, computed: vue.computed, onMounted: vue.onMounted, ref: vue.ref, watch: vue.watch, get request() {
|
return request;
|
}, get userInfo() {
|
return userInfo;
|
} };
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
return __returned__;
|
}
|
};
|
function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_uni_datetime_picker = resolveEasycom(vue.resolveDynamicComponent("uni-datetime-picker"), __easycom_0$2);
|
const _component_uni_th = resolveEasycom(vue.resolveDynamicComponent("uni-th"), __easycom_1$3);
|
const _component_uni_tr = resolveEasycom(vue.resolveDynamicComponent("uni-tr"), __easycom_2);
|
const _component_uni_td = resolveEasycom(vue.resolveDynamicComponent("uni-td"), __easycom_4);
|
const _component_uni_table = resolveEasycom(vue.resolveDynamicComponent("uni-table"), __easycom_5);
|
const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_6);
|
const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_7$1);
|
const _component_uni_popup_dialog = resolveEasycom(vue.resolveDynamicComponent("uni-popup-dialog"), __easycom_7);
|
return vue.openBlock(), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
[
|
vue.createElementVNode("view", { style: { "width": "100%", "height": "100%" } }, [
|
vue.createElementVNode("view", null, [
|
vue.createVNode(_component_uni_datetime_picker, {
|
onChange: $setup.changeTime,
|
modelValue: $setup.datetimerange,
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.datetimerange = $event),
|
type: "daterange",
|
rangeSeparator: "/"
|
}, null, 8, ["modelValue"])
|
]),
|
vue.createVNode(_component_uni_table, {
|
border: "",
|
stripe: "",
|
style: { "width": "100%", "height": "100%", "overflow": "auto" }
|
}, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_tr, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_th, { align: "center" }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("编辑")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($setup.reportingWorkTitle, (item, keys, index) => {
|
return vue.openBlock(), vue.createBlock(
|
_component_uni_th,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
);
|
}),
|
256
|
/* UNKEYED_FRAGMENT */
|
))
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($setup.reportingWorkList, (items) => {
|
return vue.openBlock(), vue.createBlock(
|
_component_uni_tr,
|
null,
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createElementVNode("button", {
|
onClick: ($event) => $setup.deleteReportingWorkClick(items.reportingWorkId, items.processId),
|
class: "uni-button",
|
size: "mini",
|
type: "warn"
|
}, "删除", 8, ["onClick"])
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($setup.reportingWorkTitle, (item, keys) => {
|
return vue.openBlock(), vue.createBlock(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(items[keys]),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
);
|
}),
|
256
|
/* UNKEYED_FRAGMENT */
|
))
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
);
|
}),
|
256
|
/* UNKEYED_FRAGMENT */
|
))
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
vue.createElementVNode("view", null, [
|
vue.createCommentVNode(" 提示信息弹窗 "),
|
vue.createVNode(
|
_component_uni_popup,
|
{
|
ref: "message",
|
type: "message"
|
},
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_popup_message, {
|
type: $setup.msgType,
|
message: $setup.messageText,
|
duration: 2e3
|
}, null, 8, ["type", "message"])
|
]),
|
_: 1
|
/* STABLE */
|
},
|
512
|
/* NEED_PATCH */
|
)
|
]),
|
vue.createVNode(
|
_component_uni_popup,
|
{
|
ref: "popup",
|
type: "dialog"
|
},
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_popup_dialog, {
|
mode: "base",
|
title: "提示",
|
type: "warn",
|
content: "确定删除报工!",
|
"before-close": true,
|
onClose: $setup.close,
|
onConfirm: $setup.confirm
|
})
|
]),
|
_: 1
|
/* STABLE */
|
},
|
512
|
/* NEED_PATCH */
|
)
|
],
|
64
|
/* STABLE_FRAGMENT */
|
);
|
}
|
const PagesReportingWorkListReportingWorkList = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$d], ["__file", "D:/Documents/app/qrcodeScaner/pages/ReportingWorkList/ReportingWorkList.vue"]]);
|
const _sfc_main$d = {
|
__name: "login",
|
setup(__props, { expose: __expose }) {
|
__expose();
|
const store = userInfo();
|
let searchUserList = vue.ref({
|
userName: null
|
});
|
let users = vue.ref([]);
|
const message = vue.ref(null);
|
const type = vue.ref("center");
|
const msgType = vue.ref("success");
|
const messageText = vue.ref("");
|
const viewShow = vue.ref(false);
|
let ipVal = vue.ref(null);
|
vue.onMounted(async () => {
|
});
|
const messageToggle = (type2, msg) => {
|
msgType.value = type2;
|
messageText.value = msg;
|
message.value.open();
|
};
|
const changeIP = async () => {
|
const ipRegex = /^(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
if (ipRegex.test(ipVal.value)) {
|
await uni.setStorageSync("ip", ipVal.value);
|
plus.runtime.restart();
|
} else {
|
messageToggle("error", "请输入IP范围:0.0.0.0~255.255.255.255");
|
}
|
};
|
const __returned__ = { store, get searchUserList() {
|
return searchUserList;
|
}, set searchUserList(v2) {
|
searchUserList = v2;
|
}, get users() {
|
return users;
|
}, set users(v2) {
|
users = v2;
|
}, message, type, msgType, messageText, viewShow, get ipVal() {
|
return ipVal;
|
}, set ipVal(v2) {
|
ipVal = v2;
|
}, messageToggle, changeIP, onMounted: vue.onMounted, reactive: vue.reactive, ref: vue.ref, get userInfo() {
|
return userInfo;
|
}, get request() {
|
return request;
|
}, get ip() {
|
return ip;
|
}, get webPort() {
|
return webPort;
|
} };
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
return __returned__;
|
}
|
};
|
function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_uni_easyinput = resolveEasycom(vue.resolveDynamicComponent("uni-easyinput"), __easycom_3);
|
const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_6);
|
const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_7$1);
|
return vue.openBlock(), vue.createElementBlock("view", { class: "content" }, [
|
vue.createElementVNode("image", {
|
class: "logo",
|
src: _imports_0
|
}),
|
vue.createElementVNode("view", { class: "text-area" }, [
|
vue.createElementVNode("text", { class: "title" }, "NorthGlass_Scaner 初始化")
|
]),
|
vue.createElementVNode("view", { class: "text-area" }, [
|
vue.createVNode(_component_uni_easyinput, {
|
onBlur: $setup.changeIP,
|
class: "input_1",
|
style: { "text-align": "center" },
|
placeholder: "请输入服务器ip",
|
passwordIcon: false,
|
modelValue: $setup.ipVal,
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.ipVal = $event),
|
type: "input"
|
}, null, 8, ["modelValue"])
|
]),
|
vue.createElementVNode("view", null, [
|
vue.createCommentVNode(" 提示信息弹窗 "),
|
vue.createVNode(
|
_component_uni_popup,
|
{
|
ref: "message",
|
type: "message"
|
},
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_popup_message, {
|
type: $setup.msgType,
|
message: $setup.messageText,
|
duration: 2e3
|
}, null, 8, ["type", "message"])
|
]),
|
_: 1
|
/* STABLE */
|
},
|
512
|
/* NEED_PATCH */
|
)
|
])
|
]);
|
}
|
const PagesLoginLogin = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$c], ["__file", "D:/Documents/app/qrcodeScaner/pages/login/login.vue"]]);
|
const _sfc_main$c = {
|
__name: "orderList",
|
setup(__props, { expose: __expose }) {
|
__expose();
|
const dates = vue.ref([null, null]);
|
const orders = vue.ref([]);
|
vue.onMounted(() => {
|
getOrderList();
|
});
|
const getOrderList = () => {
|
request.post("/app/getOrderList", dates.value).then((res) => {
|
orders.value = res.data.data;
|
dates.value = res.data.date;
|
});
|
};
|
const maskClick = () => {
|
getOrderList();
|
};
|
const __returned__ = { dates, orders, getOrderList, maskClick, onMounted: vue.onMounted, reactive: vue.reactive, ref: vue.ref, get request() {
|
return request;
|
} };
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
return __returned__;
|
}
|
};
|
function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock("view", { style: { "width": "100%", "height": "100%" } }, [
|
vue.createCommentVNode(` <uni-datetime-picker v-model="dates" type="daterange" @change="maskClick" />\r
|
<view id='data'>\r
|
<uni-table border stripe style='width:100%;height: 100%;overflow: auto;'>\r
|
<uni-tr>\r
|
<uni-th align="center">销售单号</uni-th>\r
|
<uni-th align="center">客户名称</uni-th>\r
|
<uni-th align="center">项目名称</uni-th>\r
|
<uni-th align="center">批次</uni-th>\r
|
<uni-th align="center">数量</uni-th>\r
|
<uni-th align="center">面积</uni-th>\r
|
<uni-th align="center">周长</uni-th>\r
|
<uni-th align="center">订单类型</uni-th>\r
|
<uni-th align="center">包装方式</uni-th>\r
|
<uni-th align="center">创建时间</uni-th>\r
|
<uni-th align="center">发货时间</uni-th>\r
|
</uni-tr>\r
|
\r
|
<uni-tr v-for="item in orders">\r
|
<uni-td align="center">{{ item.orderId }}</uni-td>\r
|
<uni-td align="center">{{ item.customerName }}</uni-td>\r
|
<uni-td align="center">{{ item.project }}</uni-td>\r
|
<uni-td align="center">{{ item.batch}}</uni-td>\r
|
<uni-td align="center">{{ item.quantity }}</uni-td>\r
|
<uni-td align="center">{{ item.area }}</uni-td>\r
|
<uni-td align="center">{{ item.perimeter }}</uni-td>\r
|
<uni-td align="center">{{ item.orderType }}</uni-td>\r
|
<uni-td align="center">{{ item.packType }}</uni-td>\r
|
<uni-td align="center">{{ item.createTime }}</uni-td>\r
|
<uni-td align="center">{{ item.deliveryDate }}</uni-td>\r
|
</uni-tr>\r
|
</uni-table>\r
|
</view> `)
|
]);
|
}
|
const PagesStatementOrderList = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$b], ["__scopeId", "data-v-3b9b80bf"], ["__file", "D:/Documents/app/qrcodeScaner/pages/statement/orderList.vue"]]);
|
const _sfc_main$b = {
|
__name: "deliveryList",
|
setup(__props, { expose: __expose }) {
|
__expose();
|
const dates = vue.ref([null, null]);
|
const deliverys = vue.ref([]);
|
vue.onMounted(() => {
|
getDeliverys();
|
});
|
const getDeliverys = () => {
|
request.post("/app/getDeliveryList", dates.value).then((res) => {
|
deliverys.value = res.data.data;
|
dates.value = res.data.date;
|
});
|
};
|
const maskClick = () => {
|
getDeliverys();
|
};
|
const __returned__ = { dates, deliverys, getDeliverys, maskClick, onMounted: vue.onMounted, ref: vue.ref, get request() {
|
return request;
|
} };
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
return __returned__;
|
}
|
};
|
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_uni_datetime_picker = resolveEasycom(vue.resolveDynamicComponent("uni-datetime-picker"), __easycom_0$2);
|
const _component_uni_th = resolveEasycom(vue.resolveDynamicComponent("uni-th"), __easycom_1$3);
|
const _component_uni_tr = resolveEasycom(vue.resolveDynamicComponent("uni-tr"), __easycom_2);
|
const _component_uni_td = resolveEasycom(vue.resolveDynamicComponent("uni-td"), __easycom_4);
|
const _component_uni_table = resolveEasycom(vue.resolveDynamicComponent("uni-table"), __easycom_5);
|
return vue.openBlock(), vue.createElementBlock("view", { style: { "width": "100%", "height": "98%" } }, [
|
vue.createVNode(_component_uni_datetime_picker, {
|
modelValue: $setup.dates,
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.dates = $event),
|
type: "daterange",
|
onChange: $setup.maskClick
|
}, null, 8, ["modelValue"]),
|
vue.createElementVNode("view", { id: "data" }, [
|
vue.createVNode(_component_uni_table, {
|
border: "",
|
stripe: "",
|
style: { "width": "100%", "height": "100%", "overflow": "auto" }
|
}, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_tr, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_th, { align: "center" }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("发货单号")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, { align: "center" }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("客户名称")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, { align: "center" }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("项目名称")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, { align: "center" }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("数量")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, { align: "center" }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("面积")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, { align: "center" }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("金额")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, { align: "center" }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("创建时间")
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($setup.deliverys, (item) => {
|
return vue.openBlock(), vue.createBlock(
|
_component_uni_tr,
|
null,
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.deliveryId),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.customerName),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.project),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.quantity),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.area),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.money),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.createTime),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
);
|
}),
|
256
|
/* UNKEYED_FRAGMENT */
|
))
|
]),
|
_: 1
|
/* STABLE */
|
})
|
])
|
]);
|
}
|
const PagesStatementDeliveryList = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$a], ["__scopeId", "data-v-6901791d"], ["__file", "D:/Documents/app/qrcodeScaner/pages/statement/deliveryList.vue"]]);
|
const _sfc_main$a = {
|
name: "loading1",
|
data() {
|
return {};
|
}
|
};
|
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock("view", { class: "container loading1" }, [
|
vue.createElementVNode("view", { class: "shape shape1" }),
|
vue.createElementVNode("view", { class: "shape shape2" }),
|
vue.createElementVNode("view", { class: "shape shape3" }),
|
vue.createElementVNode("view", { class: "shape shape4" })
|
]);
|
}
|
const Loading1 = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$9], ["__scopeId", "data-v-0e645258"], ["__file", "D:/Documents/app/qrcodeScaner/uni_modules/qiun-data-charts/components/qiun-loading/loading1.vue"]]);
|
const _sfc_main$9 = {
|
name: "loading2",
|
data() {
|
return {};
|
}
|
};
|
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock("view", { class: "container loading2" }, [
|
vue.createElementVNode("view", { class: "shape shape1" }),
|
vue.createElementVNode("view", { class: "shape shape2" }),
|
vue.createElementVNode("view", { class: "shape shape3" }),
|
vue.createElementVNode("view", { class: "shape shape4" })
|
]);
|
}
|
const Loading2 = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$8], ["__scopeId", "data-v-3df48dc2"], ["__file", "D:/Documents/app/qrcodeScaner/uni_modules/qiun-data-charts/components/qiun-loading/loading2.vue"]]);
|
const _sfc_main$8 = {
|
name: "loading3",
|
data() {
|
return {};
|
}
|
};
|
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock("view", { class: "container loading3" }, [
|
vue.createElementVNode("view", { class: "shape shape1" }),
|
vue.createElementVNode("view", { class: "shape shape2" }),
|
vue.createElementVNode("view", { class: "shape shape3" }),
|
vue.createElementVNode("view", { class: "shape shape4" })
|
]);
|
}
|
const Loading3 = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$7], ["__scopeId", "data-v-27a8293c"], ["__file", "D:/Documents/app/qrcodeScaner/uni_modules/qiun-data-charts/components/qiun-loading/loading3.vue"]]);
|
const _sfc_main$7 = {
|
name: "loading5",
|
data() {
|
return {};
|
}
|
};
|
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock("view", { class: "container loading5" }, [
|
vue.createElementVNode("view", { class: "shape shape1" }),
|
vue.createElementVNode("view", { class: "shape shape2" }),
|
vue.createElementVNode("view", { class: "shape shape3" }),
|
vue.createElementVNode("view", { class: "shape shape4" })
|
]);
|
}
|
const Loading4 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$6], ["__scopeId", "data-v-2e7deb83"], ["__file", "D:/Documents/app/qrcodeScaner/uni_modules/qiun-data-charts/components/qiun-loading/loading4.vue"]]);
|
const _sfc_main$6 = {
|
name: "loading6",
|
data() {
|
return {};
|
}
|
};
|
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock("view", { class: "container loading6" }, [
|
vue.createElementVNode("view", { class: "shape shape1" }),
|
vue.createElementVNode("view", { class: "shape shape2" }),
|
vue.createElementVNode("view", { class: "shape shape3" }),
|
vue.createElementVNode("view", { class: "shape shape4" })
|
]);
|
}
|
const Loading5 = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$5], ["__scopeId", "data-v-ef674bbb"], ["__file", "D:/Documents/app/qrcodeScaner/uni_modules/qiun-data-charts/components/qiun-loading/loading5.vue"]]);
|
const _sfc_main$5 = {
|
components: { Loading1, Loading2, Loading3, Loading4, Loading5 },
|
name: "qiun-loading",
|
props: {
|
loadingType: {
|
type: Number,
|
default: 2
|
}
|
},
|
data() {
|
return {};
|
}
|
};
|
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_Loading1 = vue.resolveComponent("Loading1");
|
const _component_Loading2 = vue.resolveComponent("Loading2");
|
const _component_Loading3 = vue.resolveComponent("Loading3");
|
const _component_Loading4 = vue.resolveComponent("Loading4");
|
const _component_Loading5 = vue.resolveComponent("Loading5");
|
return vue.openBlock(), vue.createElementBlock("view", null, [
|
$props.loadingType == 1 ? (vue.openBlock(), vue.createBlock(_component_Loading1, { key: 0 })) : vue.createCommentVNode("v-if", true),
|
$props.loadingType == 2 ? (vue.openBlock(), vue.createBlock(_component_Loading2, { key: 1 })) : vue.createCommentVNode("v-if", true),
|
$props.loadingType == 3 ? (vue.openBlock(), vue.createBlock(_component_Loading3, { key: 2 })) : vue.createCommentVNode("v-if", true),
|
$props.loadingType == 4 ? (vue.openBlock(), vue.createBlock(_component_Loading4, { key: 3 })) : vue.createCommentVNode("v-if", true),
|
$props.loadingType == 5 ? (vue.openBlock(), vue.createBlock(_component_Loading5, { key: 4 })) : vue.createCommentVNode("v-if", true)
|
]);
|
}
|
const __easycom_0$1 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4], ["__file", "D:/Documents/app/qrcodeScaner/uni_modules/qiun-data-charts/components/qiun-loading/qiun-loading.vue"]]);
|
const _sfc_main$4 = {
|
name: "qiun-error",
|
props: {
|
errorMessage: {
|
type: String,
|
default: null
|
}
|
},
|
data() {
|
return {};
|
}
|
};
|
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
return vue.openBlock(), vue.createElementBlock("view", { class: "chartsview" }, [
|
vue.createElementVNode("view", { class: "charts-error" }),
|
vue.createElementVNode(
|
"view",
|
{ class: "charts-font" },
|
vue.toDisplayString($props.errorMessage == null ? "请点击重试" : $props.errorMessage),
|
1
|
/* TEXT */
|
)
|
]);
|
}
|
const __easycom_1 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3], ["__scopeId", "data-v-a99d579b"], ["__file", "D:/Documents/app/qrcodeScaner/uni_modules/qiun-data-charts/components/qiun-error/qiun-error.vue"]]);
|
const color$1 = ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", "#ea7ccc"];
|
const formatDateTime = (timeStamp, returnType) => {
|
var date = /* @__PURE__ */ new Date();
|
date.setTime(timeStamp * 1e3);
|
var y2 = date.getFullYear();
|
var m2 = date.getMonth() + 1;
|
m2 = m2 < 10 ? "0" + m2 : m2;
|
var d2 = date.getDate();
|
d2 = d2 < 10 ? "0" + d2 : d2;
|
var h2 = date.getHours();
|
h2 = h2 < 10 ? "0" + h2 : h2;
|
var minute = date.getMinutes();
|
var second = date.getSeconds();
|
minute = minute < 10 ? "0" + minute : minute;
|
second = second < 10 ? "0" + second : second;
|
if (returnType == "full") {
|
return y2 + "-" + m2 + "-" + d2 + " " + h2 + ":" + minute + ":" + second;
|
}
|
if (returnType == "y-m-d") {
|
return y2 + "-" + m2 + "-" + d2;
|
}
|
if (returnType == "h:m") {
|
return h2 + ":" + minute;
|
}
|
if (returnType == "h:m:s") {
|
return h2 + ":" + minute + ":" + second;
|
}
|
return [y2, m2, d2, h2, minute, second];
|
};
|
const cfu = {
|
//demotype为自定义图表类型,一般不需要自定义图表类型,只需要改根节点上对应的类型即可
|
"type": ["pie", "ring", "rose", "word", "funnel", "map", "arcbar", "line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "tline", "tarea", "scatter", "bubble", "demotype"],
|
"range": ["饼状图", "圆环图", "玫瑰图", "词云图", "漏斗图", "地图", "圆弧进度条", "折线图", "柱状图", "山峰图", "条状图", "区域图", "雷达图", "仪表盘", "K线图", "混合图", "时间轴折线", "时间轴区域", "散点图", "气泡图", "自定义类型"],
|
//增加自定义图表类型,如果需要categories,请在这里加入您的图表类型,例如最后的"demotype"
|
//自定义类型时需要注意"tline","tarea","scatter","bubble"等时间轴(矢量x轴)类图表,没有categories,不需要加入categories
|
"categories": ["line", "column", "mount", "bar", "area", "radar", "gauge", "candle", "mix", "demotype"],
|
//instance为实例变量承载属性,不要删除
|
"instance": {},
|
//option为opts及eopts承载属性,不要删除
|
"option": {},
|
//下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
|
"formatter": {
|
"yAxisDemo1": function(val, index, opts) {
|
return val + "元";
|
},
|
"yAxisDemo2": function(val, index, opts) {
|
return val.toFixed(2);
|
},
|
"xAxisDemo1": function(val, index, opts) {
|
return val + "年";
|
},
|
"xAxisDemo2": function(val, index, opts) {
|
return formatDateTime(val, "h:m");
|
},
|
"seriesDemo1": function(val, index, series, opts) {
|
return val + "元";
|
},
|
"tooltipDemo1": function(item, category, index, opts) {
|
if (index == 0) {
|
return "随便用" + item.data + "年";
|
} else {
|
return "其他我没改" + item.data + "天";
|
}
|
},
|
"pieDemo": function(val, index, series, opts) {
|
if (index !== void 0) {
|
return series[index].name + ":" + series[index].data + "元";
|
}
|
}
|
},
|
//这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在opts参数,会将demotype与opts中option合并后渲染图表。
|
"demotype": {
|
//我这里把曲线图当做了自定义图表类型,您可以根据需要随意指定类型或配置
|
"type": "line",
|
"color": color$1,
|
"padding": [15, 10, 0, 15],
|
"xAxis": {
|
"disableGrid": true
|
},
|
"yAxis": {
|
"gridType": "dash",
|
"dashLength": 2
|
},
|
"legend": {},
|
"extra": {
|
"line": {
|
"type": "curve",
|
"width": 2
|
}
|
}
|
},
|
//下面是自定义配置,请添加项目所需的通用配置
|
"pie": {
|
"type": "pie",
|
"color": color$1,
|
"padding": [5, 5, 5, 5],
|
"extra": {
|
"pie": {
|
"activeOpacity": 0.5,
|
"activeRadius": 10,
|
"offsetAngle": 0,
|
"labelWidth": 15,
|
"border": true,
|
"borderWidth": 3,
|
"borderColor": "#FFFFFF"
|
}
|
}
|
},
|
"ring": {
|
"type": "ring",
|
"color": color$1,
|
"padding": [5, 5, 5, 5],
|
"rotate": false,
|
"dataLabel": true,
|
"legend": {
|
"show": true,
|
"position": "right",
|
"lineHeight": 25
|
},
|
"title": {
|
"name": "收益率",
|
"fontSize": 15,
|
"color": "#666666"
|
},
|
"subtitle": {
|
"name": "70%",
|
"fontSize": 25,
|
"color": "#7cb5ec"
|
},
|
"extra": {
|
"ring": {
|
"ringWidth": 30,
|
"activeOpacity": 0.5,
|
"activeRadius": 10,
|
"offsetAngle": 0,
|
"labelWidth": 15,
|
"border": true,
|
"borderWidth": 3,
|
"borderColor": "#FFFFFF"
|
}
|
}
|
},
|
"rose": {
|
"type": "rose",
|
"color": color$1,
|
"padding": [5, 5, 5, 5],
|
"legend": {
|
"show": true,
|
"position": "left",
|
"lineHeight": 25
|
},
|
"extra": {
|
"rose": {
|
"type": "area",
|
"minRadius": 50,
|
"activeOpacity": 0.5,
|
"activeRadius": 10,
|
"offsetAngle": 0,
|
"labelWidth": 15,
|
"border": false,
|
"borderWidth": 2,
|
"borderColor": "#FFFFFF"
|
}
|
}
|
},
|
"word": {
|
"type": "word",
|
"color": color$1,
|
"extra": {
|
"word": {
|
"type": "normal",
|
"autoColors": false
|
}
|
}
|
},
|
"funnel": {
|
"type": "funnel",
|
"color": color$1,
|
"padding": [15, 15, 0, 15],
|
"extra": {
|
"funnel": {
|
"activeOpacity": 0.3,
|
"activeWidth": 10,
|
"border": true,
|
"borderWidth": 2,
|
"borderColor": "#FFFFFF",
|
"fillOpacity": 1,
|
"labelAlign": "right"
|
}
|
}
|
},
|
"map": {
|
"type": "map",
|
"color": color$1,
|
"padding": [0, 0, 0, 0],
|
"dataLabel": true,
|
"extra": {
|
"map": {
|
"border": true,
|
"borderWidth": 1,
|
"borderColor": "#666666",
|
"fillOpacity": 0.6,
|
"activeBorderColor": "#F04864",
|
"activeFillColor": "#FACC14",
|
"activeFillOpacity": 1
|
}
|
}
|
},
|
"arcbar": {
|
"type": "arcbar",
|
"color": color$1,
|
"title": {
|
"name": "百分比",
|
"fontSize": 25,
|
"color": "#00FF00"
|
},
|
"subtitle": {
|
"name": "默认标题",
|
"fontSize": 15,
|
"color": "#666666"
|
},
|
"extra": {
|
"arcbar": {
|
"type": "default",
|
"width": 12,
|
"backgroundColor": "#E9E9E9",
|
"startAngle": 0.75,
|
"endAngle": 0.25,
|
"gap": 2
|
}
|
}
|
},
|
"line": {
|
"type": "line",
|
"color": color$1,
|
"padding": [15, 10, 0, 15],
|
"xAxis": {
|
"disableGrid": true
|
},
|
"yAxis": {
|
"gridType": "dash",
|
"dashLength": 2
|
},
|
"legend": {},
|
"extra": {
|
"line": {
|
"type": "straight",
|
"width": 2,
|
"activeType": "hollow"
|
}
|
}
|
},
|
"tline": {
|
"type": "line",
|
"color": color$1,
|
"padding": [15, 10, 0, 15],
|
"xAxis": {
|
"disableGrid": false,
|
"boundaryGap": "justify"
|
},
|
"yAxis": {
|
"gridType": "dash",
|
"dashLength": 2,
|
"data": [
|
{
|
"min": 0,
|
"max": 80
|
}
|
]
|
},
|
"legend": {},
|
"extra": {
|
"line": {
|
"type": "curve",
|
"width": 2,
|
"activeType": "hollow"
|
}
|
}
|
},
|
"tarea": {
|
"type": "area",
|
"color": color$1,
|
"padding": [15, 10, 0, 15],
|
"xAxis": {
|
"disableGrid": true,
|
"boundaryGap": "justify"
|
},
|
"yAxis": {
|
"gridType": "dash",
|
"dashLength": 2,
|
"data": [
|
{
|
"min": 0,
|
"max": 80
|
}
|
]
|
},
|
"legend": {},
|
"extra": {
|
"area": {
|
"type": "curve",
|
"opacity": 0.2,
|
"addLine": true,
|
"width": 2,
|
"gradient": true,
|
"activeType": "hollow"
|
}
|
}
|
},
|
"column": {
|
"type": "column",
|
"color": color$1,
|
"padding": [15, 15, 0, 5],
|
"xAxis": {
|
"disableGrid": true
|
},
|
"yAxis": {
|
"data": [{ "min": 0 }]
|
},
|
"legend": {},
|
"extra": {
|
"column": {
|
"type": "group",
|
"width": 30,
|
"activeBgColor": "#000000",
|
"activeBgOpacity": 0.08
|
}
|
}
|
},
|
"mount": {
|
"type": "mount",
|
"color": color$1,
|
"padding": [15, 15, 0, 5],
|
"xAxis": {
|
"disableGrid": true
|
},
|
"yAxis": {
|
"data": [{ "min": 0 }]
|
},
|
"legend": {},
|
"extra": {
|
"mount": {
|
"type": "mount",
|
"widthRatio": 1.5
|
}
|
}
|
},
|
"bar": {
|
"type": "bar",
|
"color": color$1,
|
"padding": [15, 30, 0, 5],
|
"xAxis": {
|
"boundaryGap": "justify",
|
"disableGrid": false,
|
"min": 0,
|
"axisLine": false
|
},
|
"yAxis": {},
|
"legend": {},
|
"extra": {
|
"bar": {
|
"type": "group",
|
"width": 30,
|
"meterBorde": 1,
|
"meterFillColor": "#FFFFFF",
|
"activeBgColor": "#000000",
|
"activeBgOpacity": 0.08
|
}
|
}
|
},
|
"area": {
|
"type": "area",
|
"color": color$1,
|
"padding": [15, 15, 0, 15],
|
"xAxis": {
|
"disableGrid": true
|
},
|
"yAxis": {
|
"gridType": "dash",
|
"dashLength": 2
|
},
|
"legend": {},
|
"extra": {
|
"area": {
|
"type": "straight",
|
"opacity": 0.2,
|
"addLine": true,
|
"width": 2,
|
"gradient": false,
|
"activeType": "hollow"
|
}
|
}
|
},
|
"radar": {
|
"type": "radar",
|
"color": color$1,
|
"padding": [5, 5, 5, 5],
|
"dataLabel": false,
|
"legend": {
|
"show": true,
|
"position": "right",
|
"lineHeight": 25
|
},
|
"extra": {
|
"radar": {
|
"gridType": "radar",
|
"gridColor": "#CCCCCC",
|
"gridCount": 3,
|
"opacity": 0.2,
|
"max": 200,
|
"labelShow": true
|
}
|
}
|
},
|
"gauge": {
|
"type": "gauge",
|
"color": color$1,
|
"title": {
|
"name": "66Km/H",
|
"fontSize": 25,
|
"color": "#2fc25b",
|
"offsetY": 50
|
},
|
"subtitle": {
|
"name": "实时速度",
|
"fontSize": 15,
|
"color": "#1890ff",
|
"offsetY": -50
|
},
|
"extra": {
|
"gauge": {
|
"type": "default",
|
"width": 30,
|
"labelColor": "#666666",
|
"startAngle": 0.75,
|
"endAngle": 0.25,
|
"startNumber": 0,
|
"endNumber": 100,
|
"labelFormat": "",
|
"splitLine": {
|
"fixRadius": 0,
|
"splitNumber": 10,
|
"width": 30,
|
"color": "#FFFFFF",
|
"childNumber": 5,
|
"childWidth": 12
|
},
|
"pointer": {
|
"width": 24,
|
"color": "auto"
|
}
|
}
|
}
|
},
|
"candle": {
|
"type": "candle",
|
"color": color$1,
|
"padding": [15, 15, 0, 15],
|
"enableScroll": true,
|
"enableMarkLine": true,
|
"dataLabel": false,
|
"xAxis": {
|
"labelCount": 4,
|
"itemCount": 40,
|
"disableGrid": true,
|
"gridColor": "#CCCCCC",
|
"gridType": "solid",
|
"dashLength": 4,
|
"scrollShow": true,
|
"scrollAlign": "left",
|
"scrollColor": "#A6A6A6",
|
"scrollBackgroundColor": "#EFEBEF"
|
},
|
"yAxis": {},
|
"legend": {},
|
"extra": {
|
"candle": {
|
"color": {
|
"upLine": "#f04864",
|
"upFill": "#f04864",
|
"downLine": "#2fc25b",
|
"downFill": "#2fc25b"
|
},
|
"average": {
|
"show": true,
|
"name": ["MA5", "MA10", "MA30"],
|
"day": [5, 10, 20],
|
"color": ["#1890ff", "#2fc25b", "#facc14"]
|
}
|
},
|
"markLine": {
|
"type": "dash",
|
"dashLength": 5,
|
"data": [
|
{
|
"value": 2150,
|
"lineColor": "#f04864",
|
"showLabel": true
|
},
|
{
|
"value": 2350,
|
"lineColor": "#f04864",
|
"showLabel": true
|
}
|
]
|
}
|
}
|
},
|
"mix": {
|
"type": "mix",
|
"color": color$1,
|
"padding": [15, 15, 0, 15],
|
"xAxis": {
|
"disableGrid": true
|
},
|
"yAxis": {
|
"disabled": false,
|
"disableGrid": false,
|
"splitNumber": 5,
|
"gridType": "dash",
|
"dashLength": 4,
|
"gridColor": "#CCCCCC",
|
"padding": 10,
|
"showTitle": true,
|
"data": []
|
},
|
"legend": {},
|
"extra": {
|
"mix": {
|
"column": {
|
"width": 20
|
}
|
}
|
}
|
},
|
"scatter": {
|
"type": "scatter",
|
"color": color$1,
|
"padding": [15, 15, 0, 15],
|
"dataLabel": false,
|
"xAxis": {
|
"disableGrid": false,
|
"gridType": "dash",
|
"splitNumber": 5,
|
"boundaryGap": "justify",
|
"min": 0
|
},
|
"yAxis": {
|
"disableGrid": false,
|
"gridType": "dash"
|
},
|
"legend": {},
|
"extra": {
|
"scatter": {}
|
}
|
},
|
"bubble": {
|
"type": "bubble",
|
"color": color$1,
|
"padding": [15, 15, 0, 15],
|
"xAxis": {
|
"disableGrid": false,
|
"gridType": "dash",
|
"splitNumber": 5,
|
"boundaryGap": "justify",
|
"min": 0,
|
"max": 250
|
},
|
"yAxis": {
|
"disableGrid": false,
|
"gridType": "dash",
|
"data": [{
|
"min": 0,
|
"max": 150
|
}]
|
},
|
"legend": {},
|
"extra": {
|
"bubble": {
|
"border": 2,
|
"opacity": 0.5
|
}
|
}
|
}
|
};
|
const color = ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", "#ea7ccc"];
|
const cfe = {
|
//demotype为自定义图表类型
|
"type": ["pie", "ring", "rose", "funnel", "line", "column", "area", "radar", "gauge", "candle", "demotype"],
|
//增加自定义图表类型,如果需要categories,请在这里加入您的图表类型例如最后的"demotype"
|
"categories": ["line", "column", "area", "radar", "gauge", "candle", "demotype"],
|
//instance为实例变量承载属性,option为eopts承载属性,不要删除
|
"instance": {},
|
"option": {},
|
//下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
|
"formatter": {
|
"tooltipDemo1": function(res) {
|
let result = "";
|
for (let i2 in res) {
|
if (i2 == 0) {
|
result += res[i2].axisValueLabel + "年销售额";
|
}
|
let value = "--";
|
if (res[i2].data !== null) {
|
value = res[i2].data;
|
}
|
result += "<br/>" + res[i2].marker + res[i2].seriesName + ":" + value + " 万元";
|
}
|
return result;
|
},
|
legendFormat: function(name) {
|
return "自定义图例+" + name;
|
},
|
yAxisFormatDemo: function(value, index) {
|
return value + "元";
|
},
|
seriesFormatDemo: function(res) {
|
return res.name + "年" + res.value + "元";
|
}
|
},
|
//这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在eopts参数,会将demotype与eopts中option合并后渲染图表。
|
"demotype": {
|
"color": color
|
//在这里填写echarts的option即可
|
},
|
//下面是自定义配置,请添加项目所需的通用配置
|
"column": {
|
"color": color,
|
"title": {
|
"text": ""
|
},
|
"tooltip": {
|
"trigger": "axis"
|
},
|
"grid": {
|
"top": 30,
|
"bottom": 50,
|
"right": 15,
|
"left": 40
|
},
|
"legend": {
|
"bottom": "left"
|
},
|
"toolbox": {
|
"show": false
|
},
|
"xAxis": {
|
"type": "category",
|
"axisLabel": {
|
"color": "#666666"
|
},
|
"axisLine": {
|
"lineStyle": {
|
"color": "#CCCCCC"
|
}
|
},
|
"boundaryGap": true,
|
"data": []
|
},
|
"yAxis": {
|
"type": "value",
|
"axisTick": {
|
"show": false
|
},
|
"axisLabel": {
|
"color": "#666666"
|
},
|
"axisLine": {
|
"lineStyle": {
|
"color": "#CCCCCC"
|
}
|
}
|
},
|
"seriesTemplate": {
|
"name": "",
|
"type": "bar",
|
"data": [],
|
"barwidth": 20,
|
"label": {
|
"show": true,
|
"color": "#666666",
|
"position": "top"
|
}
|
}
|
},
|
"line": {
|
"color": color,
|
"title": {
|
"text": ""
|
},
|
"tooltip": {
|
"trigger": "axis"
|
},
|
"grid": {
|
"top": 30,
|
"bottom": 50,
|
"right": 15,
|
"left": 40
|
},
|
"legend": {
|
"bottom": "left"
|
},
|
"toolbox": {
|
"show": false
|
},
|
"xAxis": {
|
"type": "category",
|
"axisLabel": {
|
"color": "#666666"
|
},
|
"axisLine": {
|
"lineStyle": {
|
"color": "#CCCCCC"
|
}
|
},
|
"boundaryGap": true,
|
"data": []
|
},
|
"yAxis": {
|
"type": "value",
|
"axisTick": {
|
"show": false
|
},
|
"axisLabel": {
|
"color": "#666666"
|
},
|
"axisLine": {
|
"lineStyle": {
|
"color": "#CCCCCC"
|
}
|
}
|
},
|
"seriesTemplate": {
|
"name": "",
|
"type": "line",
|
"data": [],
|
"barwidth": 20,
|
"label": {
|
"show": true,
|
"color": "#666666",
|
"position": "top"
|
}
|
}
|
},
|
"area": {
|
"color": color,
|
"title": {
|
"text": ""
|
},
|
"tooltip": {
|
"trigger": "axis"
|
},
|
"grid": {
|
"top": 30,
|
"bottom": 50,
|
"right": 15,
|
"left": 40
|
},
|
"legend": {
|
"bottom": "left"
|
},
|
"toolbox": {
|
"show": false
|
},
|
"xAxis": {
|
"type": "category",
|
"axisLabel": {
|
"color": "#666666"
|
},
|
"axisLine": {
|
"lineStyle": {
|
"color": "#CCCCCC"
|
}
|
},
|
"boundaryGap": true,
|
"data": []
|
},
|
"yAxis": {
|
"type": "value",
|
"axisTick": {
|
"show": false
|
},
|
"axisLabel": {
|
"color": "#666666"
|
},
|
"axisLine": {
|
"lineStyle": {
|
"color": "#CCCCCC"
|
}
|
}
|
},
|
"seriesTemplate": {
|
"name": "",
|
"type": "line",
|
"data": [],
|
"areaStyle": {},
|
"label": {
|
"show": true,
|
"color": "#666666",
|
"position": "top"
|
}
|
}
|
},
|
"pie": {
|
"color": color,
|
"title": {
|
"text": ""
|
},
|
"tooltip": {
|
"trigger": "item"
|
},
|
"grid": {
|
"top": 40,
|
"bottom": 30,
|
"right": 15,
|
"left": 15
|
},
|
"legend": {
|
"bottom": "left"
|
},
|
"seriesTemplate": {
|
"name": "",
|
"type": "pie",
|
"data": [],
|
"radius": "50%",
|
"label": {
|
"show": true,
|
"color": "#666666",
|
"position": "top"
|
}
|
}
|
},
|
"ring": {
|
"color": color,
|
"title": {
|
"text": ""
|
},
|
"tooltip": {
|
"trigger": "item"
|
},
|
"grid": {
|
"top": 40,
|
"bottom": 30,
|
"right": 15,
|
"left": 15
|
},
|
"legend": {
|
"bottom": "left"
|
},
|
"seriesTemplate": {
|
"name": "",
|
"type": "pie",
|
"data": [],
|
"radius": ["40%", "70%"],
|
"avoidLabelOverlap": false,
|
"label": {
|
"show": true,
|
"color": "#666666",
|
"position": "top"
|
},
|
"labelLine": {
|
"show": true
|
}
|
}
|
},
|
"rose": {
|
"color": color,
|
"title": {
|
"text": ""
|
},
|
"tooltip": {
|
"trigger": "item"
|
},
|
"legend": {
|
"top": "bottom"
|
},
|
"seriesTemplate": {
|
"name": "",
|
"type": "pie",
|
"data": [],
|
"radius": "55%",
|
"center": ["50%", "50%"],
|
"roseType": "area"
|
}
|
},
|
"funnel": {
|
"color": color,
|
"title": {
|
"text": ""
|
},
|
"tooltip": {
|
"trigger": "item",
|
"formatter": "{b} : {c}%"
|
},
|
"legend": {
|
"top": "bottom"
|
},
|
"seriesTemplate": {
|
"name": "",
|
"type": "funnel",
|
"left": "10%",
|
"top": 60,
|
"bottom": 60,
|
"width": "80%",
|
"min": 0,
|
"max": 100,
|
"minSize": "0%",
|
"maxSize": "100%",
|
"sort": "descending",
|
"gap": 2,
|
"label": {
|
"show": true,
|
"position": "inside"
|
},
|
"labelLine": {
|
"length": 10,
|
"lineStyle": {
|
"width": 1,
|
"type": "solid"
|
}
|
},
|
"itemStyle": {
|
"bordercolor": "#fff",
|
"borderwidth": 1
|
},
|
"emphasis": {
|
"label": {
|
"fontSize": 20
|
}
|
},
|
"data": []
|
}
|
},
|
"gauge": {
|
"color": color,
|
"tooltip": {
|
"formatter": "{a} <br/>{b} : {c}%"
|
},
|
"seriesTemplate": {
|
"name": "业务指标",
|
"type": "gauge",
|
"detail": { "formatter": "{value}%" },
|
"data": [{ "value": 50, "name": "完成率" }]
|
}
|
},
|
"candle": {
|
"xAxis": {
|
"data": []
|
},
|
"yAxis": {},
|
"color": color,
|
"title": {
|
"text": ""
|
},
|
"dataZoom": [
|
{
|
"type": "inside",
|
"xAxisIndex": [0, 1],
|
"start": 10,
|
"end": 100
|
},
|
{
|
"show": true,
|
"xAxisIndex": [0, 1],
|
"type": "slider",
|
"bottom": 10,
|
"start": 10,
|
"end": 100
|
}
|
],
|
"seriesTemplate": {
|
"name": "",
|
"type": "k",
|
"data": []
|
}
|
}
|
};
|
const block0 = (Comp) => {
|
(Comp.$renderjs || (Comp.$renderjs = [])).push("rdcharts");
|
(Comp.$renderjsModules || (Comp.$renderjsModules = {}))["rdcharts"] = "f9cb76fc";
|
};
|
function deepCloneAssign(origin = {}, ...args) {
|
for (let i2 in args) {
|
for (let key in args[i2]) {
|
if (args[i2].hasOwnProperty(key)) {
|
origin[key] = args[i2][key] && typeof args[i2][key] === "object" ? deepCloneAssign(Array.isArray(args[i2][key]) ? [] : {}, origin[key], args[i2][key]) : args[i2][key];
|
}
|
}
|
}
|
return origin;
|
}
|
function formatterAssign(args, formatter) {
|
for (let key in args) {
|
if (args.hasOwnProperty(key) && args[key] !== null && typeof args[key] === "object") {
|
formatterAssign(args[key], formatter);
|
} else if (key === "format" && typeof args[key] === "string") {
|
args["formatter"] = formatter[args[key]] ? formatter[args[key]] : void 0;
|
}
|
}
|
return args;
|
}
|
function getFormatDate(date) {
|
var seperator = "-";
|
var year = date.getFullYear();
|
var month = date.getMonth() + 1;
|
var strDate = date.getDate();
|
if (month >= 1 && month <= 9) {
|
month = "0" + month;
|
}
|
if (strDate >= 0 && strDate <= 9) {
|
strDate = "0" + strDate;
|
}
|
var currentdate = year + seperator + month + seperator + strDate;
|
return currentdate;
|
}
|
const _sfc_main$3 = {
|
name: "qiun-data-charts",
|
mixins: [tr.mixinDatacom],
|
props: {
|
type: {
|
type: String,
|
default: null
|
},
|
canvasId: {
|
type: String,
|
default: "uchartsid"
|
},
|
canvas2d: {
|
type: Boolean,
|
default: false
|
},
|
background: {
|
type: String,
|
default: "rgba(0,0,0,0)"
|
},
|
animation: {
|
type: Boolean,
|
default: true
|
},
|
chartData: {
|
type: Object,
|
default() {
|
return {
|
categories: [],
|
series: []
|
};
|
}
|
},
|
opts: {
|
type: Object,
|
default() {
|
return {};
|
}
|
},
|
eopts: {
|
type: Object,
|
default() {
|
return {};
|
}
|
},
|
loadingType: {
|
type: Number,
|
default: 2
|
},
|
errorShow: {
|
type: Boolean,
|
default: true
|
},
|
errorReload: {
|
type: Boolean,
|
default: true
|
},
|
errorMessage: {
|
type: String,
|
default: null
|
},
|
inScrollView: {
|
type: Boolean,
|
default: false
|
},
|
reshow: {
|
type: Boolean,
|
default: false
|
},
|
reload: {
|
type: Boolean,
|
default: false
|
},
|
disableScroll: {
|
type: Boolean,
|
default: false
|
},
|
optsWatch: {
|
type: Boolean,
|
default: true
|
},
|
onzoom: {
|
type: Boolean,
|
default: false
|
},
|
ontap: {
|
type: Boolean,
|
default: true
|
},
|
ontouch: {
|
type: Boolean,
|
default: false
|
},
|
onmouse: {
|
type: Boolean,
|
default: true
|
},
|
onmovetip: {
|
type: Boolean,
|
default: false
|
},
|
echartsH5: {
|
type: Boolean,
|
default: false
|
},
|
echartsApp: {
|
type: Boolean,
|
default: false
|
},
|
tooltipShow: {
|
type: Boolean,
|
default: true
|
},
|
tooltipFormat: {
|
type: String,
|
default: void 0
|
},
|
tooltipCustom: {
|
type: Object,
|
default: void 0
|
},
|
startDate: {
|
type: String,
|
default: void 0
|
},
|
endDate: {
|
type: String,
|
default: void 0
|
},
|
textEnum: {
|
type: Array,
|
default() {
|
return [];
|
}
|
},
|
groupEnum: {
|
type: Array,
|
default() {
|
return [];
|
}
|
},
|
pageScrollTop: {
|
type: Number,
|
default: 0
|
},
|
directory: {
|
type: String,
|
default: "/"
|
},
|
tapLegend: {
|
type: Boolean,
|
default: true
|
},
|
menus: {
|
type: Array,
|
default() {
|
return [];
|
}
|
}
|
},
|
data() {
|
return {
|
cid: "uchartsid",
|
inWx: false,
|
inAli: false,
|
inTt: false,
|
inBd: false,
|
inH5: false,
|
inApp: false,
|
inWin: false,
|
type2d: true,
|
disScroll: false,
|
openmouse: false,
|
pixel: 1,
|
cWidth: 375,
|
cHeight: 250,
|
showchart: false,
|
echarts: false,
|
echartsResize: {
|
state: false
|
},
|
uchartsOpts: {},
|
echartsOpts: {},
|
drawData: {},
|
lastDrawTime: null
|
};
|
},
|
created() {
|
this.cid = this.canvasId;
|
if (this.canvasId == "uchartsid" || this.canvasId == "") {
|
let t2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
let len = t2.length;
|
let id = "";
|
for (let i2 = 0; i2 < 32; i2++) {
|
id += t2.charAt(Math.floor(Math.random() * len));
|
}
|
this.cid = id;
|
}
|
const systemInfo = uni.getSystemInfoSync();
|
if (systemInfo.platform === "windows" || systemInfo.platform === "mac") {
|
this.inWin = true;
|
}
|
this.type2d = false;
|
this.disScroll = this.disableScroll;
|
},
|
mounted() {
|
this.inApp = true;
|
if (this.echartsApp === true) {
|
this.echarts = true;
|
this.openmouse = false;
|
}
|
this.$nextTick(() => {
|
this.beforeInit();
|
});
|
},
|
destroyed() {
|
if (this.echarts === true) {
|
delete cfe.option[this.cid];
|
delete cfe.instance[this.cid];
|
} else {
|
delete cfu.option[this.cid];
|
delete cfu.instance[this.cid];
|
}
|
uni.offWindowResize(() => {
|
});
|
},
|
watch: {
|
chartDataProps: {
|
handler(val, oldval) {
|
if (typeof val === "object") {
|
if (JSON.stringify(val) !== JSON.stringify(oldval)) {
|
this._clearChart();
|
if (val.series && val.series.length > 0) {
|
this.beforeInit();
|
} else {
|
this.mixinDatacomLoading = true;
|
this.showchart = false;
|
this.mixinDatacomErrorMessage = null;
|
}
|
}
|
} else {
|
this.mixinDatacomLoading = false;
|
this._clearChart();
|
this.showchart = false;
|
this.mixinDatacomErrorMessage = "参数错误:chartData数据类型错误";
|
}
|
},
|
immediate: false,
|
deep: true
|
},
|
localdata: {
|
handler(val, oldval) {
|
if (JSON.stringify(val) !== JSON.stringify(oldval)) {
|
if (val.length > 0) {
|
this.beforeInit();
|
} else {
|
this.mixinDatacomLoading = true;
|
this._clearChart();
|
this.showchart = false;
|
this.mixinDatacomErrorMessage = null;
|
}
|
}
|
},
|
immediate: false,
|
deep: true
|
},
|
optsProps: {
|
handler(val, oldval) {
|
if (typeof val === "object") {
|
if (JSON.stringify(val) !== JSON.stringify(oldval) && this.echarts === false && this.optsWatch == true) {
|
this.checkData(this.drawData);
|
}
|
} else {
|
this.mixinDatacomLoading = false;
|
this._clearChart();
|
this.showchart = false;
|
this.mixinDatacomErrorMessage = "参数错误:opts数据类型错误";
|
}
|
},
|
immediate: false,
|
deep: true
|
},
|
eoptsProps: {
|
handler(val, oldval) {
|
if (typeof val === "object") {
|
if (JSON.stringify(val) !== JSON.stringify(oldval) && this.echarts === true) {
|
this.checkData(this.drawData);
|
}
|
} else {
|
this.mixinDatacomLoading = false;
|
this.showchart = false;
|
this.mixinDatacomErrorMessage = "参数错误:eopts数据类型错误";
|
}
|
},
|
immediate: false,
|
deep: true
|
},
|
reshow(val, oldval) {
|
if (val === true && this.mixinDatacomLoading === false) {
|
setTimeout(() => {
|
this.mixinDatacomErrorMessage = null;
|
this.echartsResize.state = !this.echartsResize.state;
|
this.checkData(this.drawData);
|
}, 200);
|
}
|
},
|
reload(val, oldval) {
|
if (val === true) {
|
this.showchart = false;
|
this.mixinDatacomErrorMessage = null;
|
this.reloading();
|
}
|
},
|
mixinDatacomErrorMessage(val, oldval) {
|
if (val) {
|
this.emitMsg({ name: "error", params: { type: "error", errorShow: this.errorShow, msg: val, id: this.cid } });
|
if (this.errorShow) {
|
formatAppLog("log", "at uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue:611", "[秋云图表组件]" + val);
|
}
|
}
|
},
|
errorMessage(val, oldval) {
|
if (val && this.errorShow && val !== null && val !== "null" && val !== "") {
|
this.showchart = false;
|
this.mixinDatacomLoading = false;
|
this.mixinDatacomErrorMessage = val;
|
} else {
|
this.showchart = false;
|
this.mixinDatacomErrorMessage = null;
|
this.reloading();
|
}
|
}
|
},
|
computed: {
|
optsProps() {
|
return JSON.parse(JSON.stringify(this.opts));
|
},
|
eoptsProps() {
|
return JSON.parse(JSON.stringify(this.eopts));
|
},
|
chartDataProps() {
|
return JSON.parse(JSON.stringify(this.chartData));
|
}
|
},
|
methods: {
|
beforeInit() {
|
this.mixinDatacomErrorMessage = null;
|
if (typeof this.chartData === "object" && this.chartData != null && this.chartData.series !== void 0 && this.chartData.series.length > 0) {
|
this.drawData = deepCloneAssign({}, this.chartData);
|
this.mixinDatacomLoading = false;
|
this.showchart = true;
|
this.checkData(this.chartData);
|
} else if (this.localdata.length > 0) {
|
this.mixinDatacomLoading = false;
|
this.showchart = true;
|
this.localdataInit(this.localdata);
|
} else if (this.collection !== "") {
|
this.mixinDatacomLoading = false;
|
this.getCloudData();
|
} else {
|
this.mixinDatacomLoading = true;
|
}
|
},
|
localdataInit(resdata) {
|
if (this.groupEnum.length > 0) {
|
for (let i2 = 0; i2 < resdata.length; i2++) {
|
for (let j2 = 0; j2 < this.groupEnum.length; j2++) {
|
if (resdata[i2].group === this.groupEnum[j2].value) {
|
resdata[i2].group = this.groupEnum[j2].text;
|
}
|
}
|
}
|
}
|
if (this.textEnum.length > 0) {
|
for (let i2 = 0; i2 < resdata.length; i2++) {
|
for (let j2 = 0; j2 < this.textEnum.length; j2++) {
|
if (resdata[i2].text === this.textEnum[j2].value) {
|
resdata[i2].text = this.textEnum[j2].text;
|
}
|
}
|
}
|
}
|
let needCategories = false;
|
let tmpData = { categories: [], series: [] };
|
let tmpcategories = [];
|
let tmpseries = [];
|
if (this.echarts === true) {
|
needCategories = cfe.categories.includes(this.type);
|
} else {
|
needCategories = cfu.categories.includes(this.type);
|
}
|
if (needCategories === true) {
|
if (this.chartData && this.chartData.categories && this.chartData.categories.length > 0) {
|
tmpcategories = this.chartData.categories;
|
} else {
|
if (this.startDate && this.endDate) {
|
let idate = new Date(this.startDate);
|
let edate = new Date(this.endDate);
|
while (idate <= edate) {
|
tmpcategories.push(getFormatDate(idate));
|
idate = idate.setDate(idate.getDate() + 1);
|
idate = new Date(idate);
|
}
|
} else {
|
let tempckey = {};
|
resdata.map(function(item, index) {
|
if (item.text != void 0 && !tempckey[item.text]) {
|
tmpcategories.push(item.text);
|
tempckey[item.text] = true;
|
}
|
});
|
}
|
}
|
tmpData.categories = tmpcategories;
|
}
|
let tempskey = {};
|
resdata.map(function(item, index) {
|
if (item.group != void 0 && !tempskey[item.group]) {
|
tmpseries.push({ name: item.group, data: [] });
|
tempskey[item.group] = true;
|
}
|
});
|
if (tmpseries.length == 0) {
|
tmpseries = [{ name: "默认分组", data: [] }];
|
if (needCategories === true) {
|
for (let j2 = 0; j2 < tmpcategories.length; j2++) {
|
let seriesdata = 0;
|
for (let i2 = 0; i2 < resdata.length; i2++) {
|
if (resdata[i2].text == tmpcategories[j2]) {
|
seriesdata = resdata[i2].value;
|
}
|
}
|
tmpseries[0].data.push(seriesdata);
|
}
|
} else {
|
for (let i2 = 0; i2 < resdata.length; i2++) {
|
tmpseries[0].data.push({ "name": resdata[i2].text, "value": resdata[i2].value });
|
}
|
}
|
} else {
|
for (let k = 0; k < tmpseries.length; k++) {
|
if (tmpcategories.length > 0) {
|
for (let j2 = 0; j2 < tmpcategories.length; j2++) {
|
let seriesdata = 0;
|
for (let i2 = 0; i2 < resdata.length; i2++) {
|
if (tmpseries[k].name == resdata[i2].group && resdata[i2].text == tmpcategories[j2]) {
|
seriesdata = resdata[i2].value;
|
}
|
}
|
tmpseries[k].data.push(seriesdata);
|
}
|
} else {
|
for (let i2 = 0; i2 < resdata.length; i2++) {
|
if (tmpseries[k].name == resdata[i2].group) {
|
tmpseries[k].data.push(resdata[i2].value);
|
}
|
}
|
}
|
}
|
}
|
tmpData.series = tmpseries;
|
this.drawData = deepCloneAssign({}, tmpData);
|
this.checkData(tmpData);
|
},
|
reloading() {
|
if (this.errorReload === false) {
|
return;
|
}
|
this.showchart = false;
|
this.mixinDatacomErrorMessage = null;
|
if (this.collection !== "") {
|
this.mixinDatacomLoading = false;
|
this.onMixinDatacomPropsChange(true);
|
} else {
|
this.beforeInit();
|
}
|
},
|
checkData(anyData) {
|
let cid = this.cid;
|
if (this.echarts === true) {
|
cfe.option[cid] = deepCloneAssign({}, this.eopts);
|
cfe.option[cid].id = cid;
|
cfe.option[cid].type = this.type;
|
} else {
|
if (this.type && cfu.type.includes(this.type)) {
|
cfu.option[cid] = deepCloneAssign({}, cfu[this.type], this.opts);
|
cfu.option[cid].canvasId = cid;
|
} else {
|
this.mixinDatacomLoading = false;
|
this.showchart = false;
|
this.mixinDatacomErrorMessage = "参数错误:props参数中type类型不正确";
|
}
|
}
|
let newData = deepCloneAssign({}, anyData);
|
if (newData.series !== void 0 && newData.series.length > 0) {
|
this.mixinDatacomErrorMessage = null;
|
if (this.echarts === true) {
|
cfe.option[cid].chartData = newData;
|
this.$nextTick(() => {
|
this.init();
|
});
|
} else {
|
cfu.option[cid].categories = newData.categories;
|
cfu.option[cid].series = newData.series;
|
this.$nextTick(() => {
|
this.init();
|
});
|
}
|
}
|
},
|
resizeHandler() {
|
let currTime = Date.now();
|
let lastDrawTime = this.lastDrawTime ? this.lastDrawTime : currTime - 3e3;
|
let duration = currTime - lastDrawTime;
|
if (duration < 1e3)
|
return;
|
uni.createSelectorQuery().in(this).select("#ChartBoxId" + this.cid).boundingClientRect((data) => {
|
this.showchart = true;
|
if (data.width > 0 && data.height > 0) {
|
if (data.width !== this.cWidth || data.height !== this.cHeight) {
|
this.checkData(this.drawData);
|
}
|
}
|
}).exec();
|
},
|
getCloudData() {
|
if (this.mixinDatacomLoading == true) {
|
return;
|
}
|
this.mixinDatacomLoading = true;
|
this.mixinDatacomGet().then((res) => {
|
this.mixinDatacomResData = res.result.data;
|
this.localdataInit(this.mixinDatacomResData);
|
}).catch((err) => {
|
this.mixinDatacomLoading = false;
|
this.showchart = false;
|
this.mixinDatacomErrorMessage = "请求错误:" + err;
|
});
|
},
|
onMixinDatacomPropsChange(needReset, changed) {
|
if (needReset == true && this.collection !== "") {
|
this.showchart = false;
|
this.mixinDatacomErrorMessage = null;
|
this._clearChart();
|
this.getCloudData();
|
}
|
},
|
_clearChart() {
|
let cid = this.cid;
|
if (this.echarts !== true && cfu.option[cid] && cfu.option[cid].context) {
|
const ctx = cfu.option[cid].context;
|
if (typeof ctx === "object" && !!!cfu.option[cid].update) {
|
ctx.clearRect(0, 0, this.cWidth * this.pixel, this.cHeight * this.pixel);
|
ctx.draw();
|
}
|
}
|
},
|
init() {
|
let cid = this.cid;
|
uni.createSelectorQuery().in(this).select("#ChartBoxId" + cid).boundingClientRect((data) => {
|
if (data.width > 0 && data.height > 0) {
|
this.mixinDatacomLoading = false;
|
this.showchart = true;
|
this.lastDrawTime = Date.now();
|
this.cWidth = data.width;
|
this.cHeight = data.height;
|
if (this.echarts !== true) {
|
cfu.option[cid].background = this.background == "rgba(0,0,0,0)" ? "#FFFFFF" : this.background;
|
cfu.option[cid].canvas2d = this.type2d;
|
cfu.option[cid].pixelRatio = this.pixel;
|
cfu.option[cid].animation = this.animation;
|
cfu.option[cid].width = data.width * this.pixel;
|
cfu.option[cid].height = data.height * this.pixel;
|
cfu.option[cid].onzoom = this.onzoom;
|
cfu.option[cid].ontap = this.ontap;
|
cfu.option[cid].ontouch = this.ontouch;
|
cfu.option[cid].onmouse = this.openmouse;
|
cfu.option[cid].onmovetip = this.onmovetip;
|
cfu.option[cid].tooltipShow = this.tooltipShow;
|
cfu.option[cid].tooltipFormat = this.tooltipFormat;
|
cfu.option[cid].tooltipCustom = this.tooltipCustom;
|
cfu.option[cid].inScrollView = this.inScrollView;
|
cfu.option[cid].lastDrawTime = this.lastDrawTime;
|
cfu.option[cid].tapLegend = this.tapLegend;
|
}
|
if (this.inH5 || this.inApp) {
|
if (this.echarts == true) {
|
cfe.option[cid].ontap = this.ontap;
|
cfe.option[cid].onmouse = this.openmouse;
|
cfe.option[cid].tooltipShow = this.tooltipShow;
|
cfe.option[cid].tooltipFormat = this.tooltipFormat;
|
cfe.option[cid].tooltipCustom = this.tooltipCustom;
|
cfe.option[cid].lastDrawTime = this.lastDrawTime;
|
this.echartsOpts = deepCloneAssign({}, cfe.option[cid]);
|
} else {
|
cfu.option[cid].rotateLock = cfu.option[cid].rotate;
|
this.uchartsOpts = deepCloneAssign({}, cfu.option[cid]);
|
}
|
} else {
|
cfu.option[cid] = formatterAssign(cfu.option[cid], cfu.formatter);
|
this.mixinDatacomErrorMessage = null;
|
this.mixinDatacomLoading = false;
|
this.showchart = true;
|
this.$nextTick(() => {
|
if (this.type2d === true) {
|
const query = uni.createSelectorQuery().in(this);
|
query.select("#" + cid).fields({ node: true, size: true }).exec((res) => {
|
if (res[0]) {
|
const canvas = res[0].node;
|
const ctx = canvas.getContext("2d");
|
cfu.option[cid].context = ctx;
|
cfu.option[cid].rotateLock = cfu.option[cid].rotate;
|
if (cfu.instance[cid] && cfu.option[cid] && cfu.option[cid].update === true) {
|
this._updataUChart(cid);
|
} else {
|
canvas.width = data.width * this.pixel;
|
canvas.height = data.height * this.pixel;
|
canvas._width = data.width * this.pixel;
|
canvas._height = data.height * this.pixel;
|
setTimeout(() => {
|
cfu.option[cid].context.restore();
|
cfu.option[cid].context.save();
|
this._newChart(cid);
|
}, 100);
|
}
|
} else {
|
this.showchart = false;
|
this.mixinDatacomErrorMessage = "参数错误:开启2d模式后,未获取到dom节点,canvas-id:" + cid;
|
}
|
});
|
} else {
|
if (this.inAli) {
|
cfu.option[cid].rotateLock = cfu.option[cid].rotate;
|
}
|
cfu.option[cid].context = uni.createCanvasContext(cid, this);
|
if (cfu.instance[cid] && cfu.option[cid] && cfu.option[cid].update === true) {
|
this._updataUChart(cid);
|
} else {
|
setTimeout(() => {
|
cfu.option[cid].context.restore();
|
cfu.option[cid].context.save();
|
this._newChart(cid);
|
}, 100);
|
}
|
}
|
});
|
}
|
} else {
|
this.mixinDatacomLoading = false;
|
this.showchart = false;
|
if (this.reshow == true) {
|
this.mixinDatacomErrorMessage = "布局错误:未获取到父元素宽高尺寸!canvas-id:" + cid;
|
}
|
}
|
}).exec();
|
},
|
saveImage() {
|
uni.canvasToTempFilePath({
|
canvasId: this.cid,
|
success: (res) => {
|
uni.saveImageToPhotosAlbum({
|
filePath: res.tempFilePath,
|
success: function() {
|
uni.showToast({
|
title: "保存成功",
|
duration: 2e3
|
});
|
}
|
});
|
}
|
}, this);
|
},
|
getImage() {
|
if (this.type2d == false) {
|
uni.canvasToTempFilePath({
|
canvasId: this.cid,
|
success: (res) => {
|
this.emitMsg({ name: "getImage", params: { type: "getImage", base64: res.tempFilePath } });
|
}
|
}, this);
|
} else {
|
const query = uni.createSelectorQuery().in(this);
|
query.select("#" + this.cid).fields({ node: true, size: true }).exec((res) => {
|
if (res[0]) {
|
const canvas = res[0].node;
|
this.emitMsg({ name: "getImage", params: { type: "getImage", base64: canvas.toDataURL("image/png") } });
|
}
|
});
|
}
|
},
|
_error(e2) {
|
this.mixinDatacomErrorMessage = e2.detail.errMsg;
|
},
|
emitMsg(msg) {
|
this.$emit(msg.name, msg.params);
|
},
|
getRenderType() {
|
if (this.echarts === true && this.mixinDatacomLoading === false) {
|
this.beforeInit();
|
}
|
},
|
toJSON() {
|
return this;
|
}
|
}
|
};
|
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_qiun_loading = resolveEasycom(vue.resolveDynamicComponent("qiun-loading"), __easycom_0$1);
|
const _component_qiun_error = resolveEasycom(vue.resolveDynamicComponent("qiun-error"), __easycom_1);
|
return vue.openBlock(), vue.createElementBlock("view", {
|
class: "chartsview",
|
id: "ChartBoxId" + $data.cid
|
}, [
|
_ctx.mixinDatacomLoading ? (vue.openBlock(), vue.createElementBlock("view", { key: 0 }, [
|
vue.createCommentVNode(" 自定义加载状态,请改这里 "),
|
vue.createVNode(_component_qiun_loading, { loadingType: $props.loadingType }, null, 8, ["loadingType"])
|
])) : vue.createCommentVNode("v-if", true),
|
_ctx.mixinDatacomErrorMessage && $props.errorShow ? (vue.openBlock(), vue.createElementBlock("view", {
|
key: 1,
|
onClick: _cache[0] || (_cache[0] = (...args) => $options.reloading && $options.reloading(...args))
|
}, [
|
vue.createCommentVNode(" 自定义错误提示,请改这里 "),
|
vue.createVNode(_component_qiun_error, { errorMessage: $props.errorMessage }, null, 8, ["errorMessage"])
|
])) : vue.createCommentVNode("v-if", true),
|
vue.createCommentVNode(" APP和H5采用renderjs渲染图表 "),
|
$data.echarts ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("view", {
|
key: 2,
|
style: vue.normalizeStyle([{ background: $props.background }, { "width": "100%", "height": "100%" }]),
|
"data-directory": $props.directory,
|
id: "EC" + $data.cid,
|
prop: vue.wp($data.echartsOpts),
|
"change:prop": _ctx.rdcharts.ecinit,
|
resize: vue.wp($data.echartsResize),
|
"change:resize": _ctx.rdcharts.ecresize
|
}, null, 12, ["data-directory", "id", "prop", "change:prop", "resize", "change:resize"])), [
|
[vue.vShow, $data.showchart]
|
]) : (vue.openBlock(), vue.createElementBlock("view", {
|
key: 3,
|
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.rdcharts.tap && _ctx.rdcharts.tap(...args)),
|
onMousemove: _cache[3] || (_cache[3] = (...args) => _ctx.rdcharts.mouseMove && _ctx.rdcharts.mouseMove(...args)),
|
onMousedown: _cache[4] || (_cache[4] = (...args) => _ctx.rdcharts.mouseDown && _ctx.rdcharts.mouseDown(...args)),
|
onMouseup: _cache[5] || (_cache[5] = (...args) => _ctx.rdcharts.mouseUp && _ctx.rdcharts.mouseUp(...args)),
|
onTouchstart: _cache[6] || (_cache[6] = (...args) => _ctx.rdcharts.touchStart && _ctx.rdcharts.touchStart(...args)),
|
onTouchmove: _cache[7] || (_cache[7] = (...args) => _ctx.rdcharts.touchMove && _ctx.rdcharts.touchMove(...args)),
|
onTouchend: _cache[8] || (_cache[8] = (...args) => _ctx.rdcharts.touchEnd && _ctx.rdcharts.touchEnd(...args)),
|
id: "UC" + $data.cid,
|
prop: vue.wp($data.uchartsOpts),
|
"change:prop": _ctx.rdcharts.ucinit
|
}, [
|
vue.withDirectives(vue.createElementVNode("canvas", {
|
id: $data.cid,
|
canvasId: $data.cid,
|
style: vue.normalizeStyle({ width: $data.cWidth + "px", height: $data.cHeight + "px", background: $props.background }),
|
"disable-scroll": $props.disableScroll,
|
onError: _cache[1] || (_cache[1] = (...args) => $options._error && $options._error(...args))
|
}, null, 44, ["id", "canvasId", "disable-scroll"]), [
|
[vue.vShow, $data.showchart]
|
])
|
], 40, ["id", "prop", "change:prop"])),
|
vue.createCommentVNode(" 支付宝小程序 "),
|
vue.createCommentVNode(" 其他小程序通过vue渲染图表 ")
|
], 8, ["id"]);
|
}
|
if (typeof block0 === "function")
|
block0(_sfc_main$3);
|
const __easycom_0 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2], ["__scopeId", "data-v-0ca34aee"], ["__file", "D:/Documents/app/qrcodeScaner/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue"]]);
|
const _sfc_main$2 = {
|
__name: "originalGlassList",
|
setup(__props, { expose: __expose }) {
|
__expose();
|
const totalSum = vue.ref({});
|
const datas = vue.ref([]);
|
const opts = vue.ref({
|
color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", "#ea7ccc"],
|
padding: [5, 5, 5, 5],
|
enableScroll: false,
|
extra: {
|
pie: {
|
activeOpacity: 0.5,
|
activeRadius: 10,
|
offsetAngle: 0,
|
labelWidth: 15,
|
border: false,
|
borderWidth: 3,
|
borderColor: "#FFFFFF"
|
}
|
}
|
});
|
let chartData = vue.ref();
|
onLoad(() => {
|
uni.showLoading({
|
title: "加载中...",
|
mask: true
|
});
|
getOriginalGlassList();
|
});
|
const getOriginalGlassList = () => {
|
request.post("/app/getOriginalGlassList").then((res) => {
|
res.data.glassStock.forEach((data) => {
|
data.json = JSON.parse(data.json);
|
});
|
datas.value = res.data.glassStock;
|
totalSum.value = res.data.totalSum;
|
}).finally(() => {
|
uni.hideLoading();
|
});
|
};
|
const __returned__ = { totalSum, datas, opts, get chartData() {
|
return chartData;
|
}, set chartData(v2) {
|
chartData = v2;
|
}, getOriginalGlassList, onMounted: vue.onMounted, ref: vue.ref, get request() {
|
return request;
|
}, get onLoad() {
|
return onLoad;
|
} };
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
return __returned__;
|
}
|
};
|
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_qiun_data_charts = resolveEasycom(vue.resolveDynamicComponent("qiun-data-charts"), __easycom_0);
|
return vue.openBlock(), vue.createElementBlock("view", { style: { "width": "100%", "height": "100%" } }, [
|
vue.createElementVNode("view", { class: "charts-box" }, [
|
vue.createVNode(_component_qiun_data_charts, {
|
type: "pie",
|
opts: $setup.opts,
|
chartData: $setup.chartData
|
}, null, 8, ["opts", "chartData"])
|
]),
|
vue.createCommentVNode(` <uni-table border stripe style='width:100%;height: 100%;overflow: auto;'>\r
|
<uni-tr>\r
|
<uni-th align="center">ID</uni-th>\r
|
<uni-th align="center">物料</uni-th>\r
|
<uni-th align="center">尺寸</uni-th>\r
|
<uni-th align="center">总面积</uni-th>\r
|
<uni-th align="center">库存</uni-th>\r
|
<uni-th align="center">可用</uni-th>\r
|
<uni-th align="center">计划</uni-th>\r
|
<uni-th align="center">产地</uni-th>\r
|
<uni-th align="center">备注</uni-th>\r
|
</uni-tr>\r
|
\r
|
<uni-tr v-for="item in datas">\r
|
<uni-td align="center">{{ item.id }}</uni-td>\r
|
<uni-td align="center">{{ item.json.name }}</uni-td>\r
|
<uni-td align="center">{{ item.json.thickness+"*"+item.json.width+"*"+item.json.height }}</uni-td>\r
|
<uni-td align="center">{{ item.totalArea}}</uni-td>\r
|
<uni-td align="center">{{ item.inventoryQuantity }}</uni-td>\r
|
<uni-td align="center">{{ item.availableQuantity }}</uni-td>\r
|
<uni-td align="center">{{ item.planQuantity }}</uni-td>\r
|
<uni-td align="center">{{ item.producer }}</uni-td>\r
|
<uni-td align="center">{{ item.remarks }}</uni-td>\r
|
</uni-tr>\r
|
</uni-table> `)
|
]);
|
}
|
const PagesStatementOriginalGlassList = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__scopeId", "data-v-36c84162"], ["__file", "D:/Documents/app/qrcodeScaner/pages/statement/originalGlassList.vue"]]);
|
const _sfc_main$1 = {
|
__name: "glassFinishToStore",
|
setup(__props, { expose: __expose }) {
|
__expose();
|
const user = userInfo();
|
const message = vue.ref(null);
|
const msgType = vue.ref("success");
|
const messageText = vue.ref("");
|
const checkList = vue.ref([]);
|
const alertDialog = vue.ref(null);
|
let processId = vue.ref(null);
|
let title = vue.ref({
|
project: null,
|
productName: null
|
});
|
let subLoading = vue.ref(false);
|
const table = vue.ref(null);
|
const tableData = vue.ref([]);
|
const flowData = vue.ref({
|
decValue: 2,
|
//计算保留位数
|
userId: user.user.userId,
|
userName: user.user.userName,
|
storageRegion: null,
|
remark: null,
|
container: null,
|
//库位
|
flowCard: []
|
});
|
onLoad(async (option) => {
|
processId.value = option.processId;
|
await getfinishedGlass(option.processId);
|
});
|
const getfinishedGlass = async (processIdVal) => {
|
const para = {
|
processId: processIdVal
|
};
|
await request.post(`/app/getSelectWarehousingList`, para).then((res) => {
|
if (res.data.data.length === 0) {
|
uni.showModal({
|
title: "提示",
|
content: "此流程卡无可入库数据",
|
showCancel: false,
|
success: () => {
|
uni.reLaunch({
|
url: `/pages/mainView/mainView`
|
});
|
}
|
});
|
return;
|
}
|
tableData.value = res.data.data;
|
title.value.project = `${tableData.value[0].order.project}(${tableData.value[0].order.batch})`;
|
title.value.productName = tableData.value[0].orderDetail.productName;
|
});
|
table.value.selectionAll();
|
};
|
const glassToStore = () => {
|
subLoading.value = true;
|
checkList.value.sort();
|
const arr = [];
|
checkList.value.forEach((item) => {
|
arr.push(tableData.value[item]);
|
});
|
flowData.value.flowCard = arr;
|
request.post(`/app/addSelectWarehousing`, flowData.value).then((res) => {
|
}).catch((e2) => {
|
uni.showModal({
|
title: "提示",
|
content: "此流程卡无可入库数据",
|
showCancel: false
|
});
|
}).finally(() => {
|
uni.reLaunch({
|
url: `/pages/mainView/mainView`
|
});
|
});
|
};
|
const change = (e2, item) => {
|
const quantity = item.orderDetail.quantity * 1 - item.receivedQuantity * 1;
|
if (e2 > quantity || e2 <= 0) {
|
item.inventoryQuantity = quantity;
|
messageToggle("error", `请输入大于0小于等于${quantity}`);
|
}
|
};
|
const selectionChange = (e2) => {
|
checkList.value = e2.detail.index;
|
};
|
const messageToggle = (type, msg) => {
|
msgType.value = type;
|
messageText.value = msg;
|
message.value.open();
|
};
|
const open2 = (type) => {
|
if (type === 1) {
|
alertDialog.value.open();
|
} else {
|
alertDialog.value.close();
|
}
|
};
|
const __returned__ = { user, message, msgType, messageText, checkList, alertDialog, get processId() {
|
return processId;
|
}, set processId(v2) {
|
processId = v2;
|
}, get title() {
|
return title;
|
}, set title(v2) {
|
title = v2;
|
}, get subLoading() {
|
return subLoading;
|
}, set subLoading(v2) {
|
subLoading = v2;
|
}, table, tableData, flowData, getfinishedGlass, glassToStore, change, selectionChange, messageToggle, open: open2, onMounted: vue.onMounted, ref: vue.ref, get onLoad() {
|
return onLoad;
|
}, get request() {
|
return request;
|
}, get userInfo() {
|
return userInfo;
|
} };
|
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
|
return __returned__;
|
}
|
};
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
const _component_uni_section = resolveEasycom(vue.resolveDynamicComponent("uni-section"), __easycom_0$4);
|
const _component_uni_th = resolveEasycom(vue.resolveDynamicComponent("uni-th"), __easycom_1$3);
|
const _component_uni_tr = resolveEasycom(vue.resolveDynamicComponent("uni-tr"), __easycom_2);
|
const _component_uni_easyinput = resolveEasycom(vue.resolveDynamicComponent("uni-easyinput"), __easycom_3);
|
const _component_uni_td = resolveEasycom(vue.resolveDynamicComponent("uni-td"), __easycom_4);
|
const _component_uni_table = resolveEasycom(vue.resolveDynamicComponent("uni-table"), __easycom_5);
|
const _component_uni_popup_message = resolveEasycom(vue.resolveDynamicComponent("uni-popup-message"), __easycom_6);
|
const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_7$1);
|
const _component_uni_col = resolveEasycom(vue.resolveDynamicComponent("uni-col"), __easycom_8);
|
const _component_uni_row = resolveEasycom(vue.resolveDynamicComponent("uni-row"), __easycom_9);
|
return vue.openBlock(), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
[
|
vue.createElementVNode("view", { style: { "margin-bottom": "2rem" } }, [
|
vue.createVNode(_component_uni_section, {
|
title: "流程卡号:" + $setup.processId,
|
"sub-title": "项目名称:" + $setup.title.project,
|
padding: "0 0 5px 10px"
|
}, {
|
right: vue.withCtx(() => [
|
vue.createElementVNode("button", {
|
onClick: _cache[0] || (_cache[0] = ($event) => $setup.open(1)),
|
type: "primary",
|
size: "mini"
|
}, "提交")
|
]),
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString($setup.title.productName) + " ",
|
1
|
/* TEXT */
|
)
|
]),
|
_: 1
|
/* STABLE */
|
}, 8, ["title", "sub-title"])
|
]),
|
vue.createElementVNode("view", null, [
|
vue.createVNode(
|
_component_uni_table,
|
{
|
ref: "table",
|
border: "",
|
stripe: "",
|
type: "selection",
|
emptyText: "暂无更多数据",
|
onSelectionChange: $setup.selectionChange
|
},
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_tr, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_th, {
|
align: "center",
|
width: "150"
|
}, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("可入数量")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, { align: "center" }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("总数量")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, { align: "center" }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("订序")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, { align: "center" }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("宽*高")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, { align: "center" }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("楼号")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_th, { align: "center" }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("已入数量")
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
(vue.openBlock(true), vue.createElementBlock(
|
vue.Fragment,
|
null,
|
vue.renderList($setup.tableData, (item, index) => {
|
return vue.openBlock(), vue.createBlock(
|
_component_uni_tr,
|
{ key: index },
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_easyinput, {
|
type: "number",
|
clearable: false,
|
modelValue: item.inventoryQuantity,
|
"onUpdate:modelValue": ($event) => item.inventoryQuantity = $event,
|
style: { "text-align": "center" },
|
onChange: ($event) => $setup.change($event, item)
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "onChange"])
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.orderDetail.quantity),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.orderNumber),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.orderDetail.width) + "*" + vue.toDisplayString(item.orderDetail.height),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.orderDetail.buildingNumber),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
),
|
vue.createVNode(
|
_component_uni_td,
|
{ align: "center" },
|
{
|
default: vue.withCtx(() => [
|
vue.createTextVNode(
|
vue.toDisplayString(item.receivedQuantity),
|
1
|
/* TEXT */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
)
|
]),
|
_: 2
|
/* DYNAMIC */
|
},
|
1024
|
/* DYNAMIC_SLOTS */
|
);
|
}),
|
128
|
/* KEYED_FRAGMENT */
|
))
|
]),
|
_: 1
|
/* STABLE */
|
},
|
512
|
/* NEED_PATCH */
|
),
|
vue.createVNode(
|
_component_uni_popup,
|
{
|
ref: "message",
|
type: "message"
|
},
|
{
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_popup_message, {
|
type: $setup.msgType,
|
message: $setup.messageText,
|
duration: 3e3
|
}, null, 8, ["type", "message"])
|
]),
|
_: 1
|
/* STABLE */
|
},
|
512
|
/* NEED_PATCH */
|
)
|
]),
|
vue.createCommentVNode(" 提示窗示例 "),
|
vue.createVNode(
|
_component_uni_popup,
|
{
|
ref: "alertDialog",
|
type: "dialog",
|
"mask-click": false
|
},
|
{
|
default: vue.withCtx(() => [
|
vue.createElementVNode("view", { class: "flex-item foot_main" }, [
|
vue.createVNode(_component_uni_row, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_col, { span: 6 }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("箱号:")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, { span: 18 }, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_easyinput, {
|
clearable: false,
|
modelValue: $setup.flowData.container,
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $setup.flowData.container = $event)
|
}, null, 8, ["modelValue"])
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_row, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_col, { span: 6 }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("库位:")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, { span: 18 }, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_easyinput, {
|
clearable: false,
|
modelValue: $setup.flowData.storageRegion,
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $setup.flowData.storageRegion = $event)
|
}, null, 8, ["modelValue"])
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_row, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_col, { span: 6 }, {
|
default: vue.withCtx(() => [
|
vue.createTextVNode("备注:")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, { span: 18 }, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_easyinput, {
|
clearable: false,
|
modelValue: $setup.flowData.remark,
|
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $setup.flowData.remark = $event)
|
}, null, 8, ["modelValue"])
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
vue.createElementVNode("view", null, [
|
vue.createVNode(_component_uni_row, null, {
|
default: vue.withCtx(() => [
|
vue.createVNode(_component_uni_col, { span: 12 }, {
|
default: vue.withCtx(() => [
|
vue.createElementVNode("button", {
|
onClick: _cache[4] || (_cache[4] = ($event) => $setup.open(0))
|
}, "取消")
|
]),
|
_: 1
|
/* STABLE */
|
}),
|
vue.createVNode(_component_uni_col, { span: 12 }, {
|
default: vue.withCtx(() => [
|
vue.createElementVNode("button", {
|
type: "primary",
|
loading: $setup.subLoading,
|
onClick: $setup.glassToStore
|
}, "入库", 8, ["loading"])
|
]),
|
_: 1
|
/* STABLE */
|
})
|
]),
|
_: 1
|
/* STABLE */
|
})
|
])
|
]),
|
_: 1
|
/* STABLE */
|
},
|
512
|
/* NEED_PATCH */
|
)
|
],
|
64
|
/* STABLE_FRAGMENT */
|
);
|
}
|
const PagesGlassFinishToStoreGlassFinishToStore = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "D:/Documents/app/qrcodeScaner/pages/glassFinishToStore/glassFinishToStore.vue"]]);
|
__definePage("pages/index/index", PagesIndexIndex);
|
__definePage("pages/mainView/mainView", PagesMainViewMainView);
|
__definePage("pages/reportingWork/reportingWork", PagesReportingWorkReportingWork);
|
__definePage("pages/glassInfo/glassInfo", PagesGlassInfoGlassInfo);
|
__definePage("pages/QuantityCompletion/QuantityCompletion", PagesQuantityCompletionQuantityCompletion);
|
__definePage("pages/ReviewReporitingWork/ReviewReporitingWork", PagesReviewReporitingWorkReviewReporitingWork);
|
__definePage("pages/ReportingWorkList/ReportingWorkList", PagesReportingWorkListReportingWorkList);
|
__definePage("pages/login/login", PagesLoginLogin);
|
__definePage("pages/statement/orderList", PagesStatementOrderList);
|
__definePage("pages/statement/deliveryList", PagesStatementDeliveryList);
|
__definePage("pages/statement/originalGlassList", PagesStatementOriginalGlassList);
|
__definePage("pages/glassFinishToStore/glassFinishToStore", PagesGlassFinishToStoreGlassFinishToStore);
|
const _sfc_main = {
|
onLaunch: function() {
|
formatAppLog("log", "at App.vue:4", "App Launch");
|
},
|
onShow: function() {
|
formatAppLog("log", "at App.vue:7", "App Show");
|
},
|
onHide: function() {
|
formatAppLog("log", "at App.vue:10", "App Hide");
|
}
|
};
|
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f13b4d11"], ["__file", "D:/Documents/app/qrcodeScaner/App.vue"]]);
|
function createApp() {
|
const app = vue.createVueApp(App);
|
const pinia = createPinia();
|
app.use(pinia);
|
return {
|
app
|
};
|
}
|
const { app: __app__, Vuex: __Vuex__, Pinia: __Pinia__ } = createApp();
|
uni.Vuex = __Vuex__;
|
uni.Pinia = __Pinia__;
|
__app__.provide("__globalStyles", __uniConfig.styles);
|
__app__._component.mpType = "app";
|
__app__._component.render = () => {
|
};
|
__app__.mount("#app");
|
})(Vue);
|