Commit e9599786 authored by 和慭琛's avatar 和慭琛

拍照界面 代码迁移 实现 50%

parent 32b684f2
function asyncGeneratorStep(n, e, r, t, o, a, c) {
try {
var i = n[a](c), u = i.value;
} catch (n) {
return void r(n);
}
i.done ? e(u) : Promise.resolve(u).then(t, o);
}
function _asyncToGenerator(n) {
return function() {
var e = this, r = arguments;
return new Promise(function(t, o) {
var a = n.apply(e, r);
function c(n) {
asyncGeneratorStep(a, t, o, c, i, "next", n);
}
function i(n) {
asyncGeneratorStep(a, t, o, c, i, "throw", n);
}
c(void 0);
});
};
}
module.exports = _asyncToGenerator;
\ No newline at end of file
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
module.exports = _defineProperty;
\ No newline at end of file
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
module.exports = _interopRequireDefault;
\ No newline at end of file
function _typeof2(o) {
return (_typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
return typeof o;
} : function(o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
})(o);
}
function _typeof(o) {
return "function" == typeof Symbol && "symbol" === _typeof2(Symbol.iterator) ? module.exports = _typeof = function(o) {
return _typeof2(o);
} : module.exports = _typeof = function(o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : _typeof2(o);
}, _typeof(o);
}
module.exports = _typeof;
\ No newline at end of file
!function(t) {
"use strict";
var r, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", c = o.toStringTag || "@@toStringTag", u = "object" == typeof module, h = t.regeneratorRuntime;
if (h) u && (module.exports = h); else {
(h = t.regeneratorRuntime = u ? module.exports : {}).wrap = w;
var f = "suspendedStart", s = "suspendedYield", l = "executing", p = "completed", y = {}, v = {};
v[i] = function() {
return this;
};
var d = Object.getPrototypeOf, g = d && d(d(P([])));
g && g !== e && n.call(g, i) && (v = g);
var m = b.prototype = x.prototype = Object.create(v);
E.prototype = m.constructor = b, b.constructor = E, b[c] = E.displayName = "GeneratorFunction",
h.isGeneratorFunction = function(t) {
var r = "function" == typeof t && t.constructor;
return !!r && (r === E || "GeneratorFunction" === (r.displayName || r.name));
}, h.mark = function(t) {
return Object.setPrototypeOf ? Object.setPrototypeOf(t, b) : (t.__proto__ = b, c in t || (t[c] = "GeneratorFunction")),
t.prototype = Object.create(m), t;
}, h.awrap = function(t) {
return {
__await: t
};
}, _(j.prototype), j.prototype[a] = function() {
return this;
}, h.AsyncIterator = j, h.async = function(t, r, e, n) {
var o = new j(w(t, r, e, n));
return h.isGeneratorFunction(r) ? o : o.next().then(function(t) {
return t.done ? t.value : o.next();
});
}, _(m), m[c] = "Generator", m[i] = function() {
return this;
}, m.toString = function() {
return "[object Generator]";
}, h.keys = function(t) {
var r = [];
for (var e in t) r.push(e);
return r.reverse(), function e() {
for (;r.length; ) {
var n = r.pop();
if (n in t) return e.value = n, e.done = !1, e;
}
return e.done = !0, e;
};
}, h.values = P, N.prototype = {
constructor: N,
reset: function(t) {
if (this.prev = 0, this.next = 0, this.sent = this._sent = r, this.done = !1, this.delegate = null,
this.method = "next", this.arg = r, this.tryEntries.forEach(G), !t) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = r);
},
stop: function() {
this.done = !0;
var t = this.tryEntries[0].completion;
if ("throw" === t.type) throw t.arg;
return this.rval;
},
dispatchException: function(t) {
if (this.done) throw t;
var e = this;
function o(n, o) {
return c.type = "throw", c.arg = t, e.next = n, o && (e.method = "next", e.arg = r),
!!o;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var a = this.tryEntries[i], c = a.completion;
if ("root" === a.tryLoc) return o("end");
if (a.tryLoc <= this.prev) {
var u = n.call(a, "catchLoc"), h = n.call(a, "finallyLoc");
if (u && h) {
if (this.prev < a.catchLoc) return o(a.catchLoc, !0);
if (this.prev < a.finallyLoc) return o(a.finallyLoc);
} else if (u) {
if (this.prev < a.catchLoc) return o(a.catchLoc, !0);
} else {
if (!h) throw new Error("try statement without catch or finally");
if (this.prev < a.finallyLoc) return o(a.finallyLoc);
}
}
}
},
abrupt: function(t, r) {
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
var o = this.tryEntries[e];
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
var i = o;
break;
}
}
i && ("break" === t || "continue" === t) && i.tryLoc <= r && r <= i.finallyLoc && (i = null);
var a = i ? i.completion : {};
return a.type = t, a.arg = r, i ? (this.method = "next", this.next = i.finallyLoc,
y) : this.complete(a);
},
complete: function(t, r) {
if ("throw" === t.type) throw t.arg;
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg,
this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r),
y;
},
finish: function(t) {
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
var e = this.tryEntries[r];
if (e.finallyLoc === t) return this.complete(e.completion, e.afterLoc), G(e), y;
}
},
catch: function(t) {
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
var e = this.tryEntries[r];
if (e.tryLoc === t) {
var n = e.completion;
if ("throw" === n.type) {
var o = n.arg;
G(e);
}
return o;
}
}
throw new Error("illegal catch attempt");
},
delegateYield: function(t, e, n) {
return this.delegate = {
iterator: P(t),
resultName: e,
nextLoc: n
}, "next" === this.method && (this.arg = r), y;
}
};
}
function w(t, r, e, n) {
var o = r && r.prototype instanceof x ? r : x, i = Object.create(o.prototype), a = new N(n || []);
return i._invoke = function(t, r, e) {
var n = f;
return function(o, i) {
if (n === l) throw new Error("Generator is already running");
if (n === p) {
if ("throw" === o) throw i;
return F();
}
for (e.method = o, e.arg = i; ;) {
var a = e.delegate;
if (a) {
var c = O(a, e);
if (c) {
if (c === y) continue;
return c;
}
}
if ("next" === e.method) e.sent = e._sent = e.arg; else if ("throw" === e.method) {
if (n === f) throw n = p, e.arg;
e.dispatchException(e.arg);
} else "return" === e.method && e.abrupt("return", e.arg);
n = l;
var u = L(t, r, e);
if ("normal" === u.type) {
if (n = e.done ? p : s, u.arg === y) continue;
return {
value: u.arg,
done: e.done
};
}
"throw" === u.type && (n = p, e.method = "throw", e.arg = u.arg);
}
};
}(t, e, a), i;
}
function L(t, r, e) {
try {
return {
type: "normal",
arg: t.call(r, e)
};
} catch (t) {
return {
type: "throw",
arg: t
};
}
}
function x() {}
function E() {}
function b() {}
function _(t) {
[ "next", "throw", "return" ].forEach(function(r) {
t[r] = function(t) {
return this._invoke(r, t);
};
});
}
function j(t) {
var r;
this._invoke = function(e, o) {
function i() {
return new Promise(function(r, i) {
!function r(e, o, i, a) {
var c = L(t[e], t, o);
if ("throw" !== c.type) {
var u = c.arg, h = u.value;
return h && "object" == typeof h && n.call(h, "__await") ? Promise.resolve(h.__await).then(function(t) {
r("next", t, i, a);
}, function(t) {
r("throw", t, i, a);
}) : Promise.resolve(h).then(function(t) {
u.value = t, i(u);
}, function(t) {
return r("throw", t, i, a);
});
}
a(c.arg);
}(e, o, r, i);
});
}
return r = r ? r.then(i, i) : i();
};
}
function O(t, e) {
var n = t.iterator[e.method];
if (n === r) {
if (e.delegate = null, "throw" === e.method) {
if (t.iterator.return && (e.method = "return", e.arg = r, O(t, e), "throw" === e.method)) return y;
e.method = "throw", e.arg = new TypeError("The iterator does not provide a 'throw' method");
}
return y;
}
var o = L(n, t.iterator, e.arg);
if ("throw" === o.type) return e.method = "throw", e.arg = o.arg, e.delegate = null,
y;
var i = o.arg;
return i ? i.done ? (e[t.resultName] = i.value, e.next = t.nextLoc, "return" !== e.method && (e.method = "next",
e.arg = r), e.delegate = null, y) : i : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"),
e.delegate = null, y);
}
function k(t) {
var r = {
tryLoc: t[0]
};
1 in t && (r.catchLoc = t[1]), 2 in t && (r.finallyLoc = t[2], r.afterLoc = t[3]),
this.tryEntries.push(r);
}
function G(t) {
var r = t.completion || {};
r.type = "normal", delete r.arg, t.completion = r;
}
function N(t) {
this.tryEntries = [ {
tryLoc: "root"
} ], t.forEach(k, this), this.reset(!0);
}
function P(t) {
if (t) {
var e = t[i];
if (e) return e.call(t);
if ("function" == typeof t.next) return t;
if (!isNaN(t.length)) {
var o = -1, a = function e() {
for (;++o < t.length; ) if (n.call(t, o)) return e.value = t[o], e.done = !1, e;
return e.value = r, e.done = !0, e;
};
return a.next = a;
}
}
return {
next: F
};
}
function F() {
return {
value: r,
done: !0
};
}
}(function() {
return this || "object" == typeof self && self;
}() || Function("return this")());
\ No newline at end of file
var e, r;
e = {}, r = require("./pako.min.js"), module.exports = e, function(e, r) {
e.toRGBA8 = function(r) {
var t = r.width, n = r.height;
if (null == r.tabs.acTL) return [ e.toRGBA8.decodeImage(r.data, t, n, r).buffer ];
var a = [];
null == r.frames[0].data && (r.frames[0].data = r.data);
for (var i, f = new Uint8Array(t * n * 4), o = 0; o < r.frames.length; o++) {
var s = r.frames[o], l = s.rect.x, c = s.rect.y, u = s.rect.width, d = s.rect.height, h = e.toRGBA8.decodeImage(s.data, u, d, r);
if (0 == o ? i = h : 0 == s.blend ? e._copyTile(h, u, d, i, t, n, l, c, 0) : 1 == s.blend && e._copyTile(h, u, d, i, t, n, l, c, 1),
a.push(i.buffer), i = i.slice(0), 0 == s.dispose) ; else if (1 == s.dispose) e._copyTile(f, u, d, i, t, n, l, c, 0); else if (2 == s.dispose) {
for (var v = o - 1; 2 == r.frames[v].dispose; ) v--;
i = new Uint8Array(a[v]).slice(0);
}
}
return a;
}, e.toRGBA8.decodeImage = function(r, t, n, a) {
var i = t * n, f = e.decode._getBPP(a), o = Math.ceil(t * f / 8), s = new Uint8Array(4 * i), l = new Uint32Array(s.buffer), c = a.ctype, u = a.depth, d = e._bin.readUshort;
if (6 == c) {
var h = i << 2;
if (8 == u) for (var v = 0; v < h; v++) s[v] = r[v];
if (16 == u) for (v = 0; v < h; v++) s[v] = r[v << 1];
} else if (2 == c) {
var b = a.tabs.tRNS, p = -1, g = -1, y = -1;
if (b && (p = b[0], g = b[1], y = b[2]), 8 == u) for (v = 0; v < i; v++) {
var m = 3 * v;
s[M = v << 2] = r[m], s[M + 1] = r[m + 1], s[M + 2] = r[m + 2], s[M + 3] = 255,
-1 != p && r[m] == p && r[m + 1] == g && r[m + 2] == y && (s[M + 3] = 0);
}
if (16 == u) for (v = 0; v < i; v++) m = 6 * v, s[M = v << 2] = r[m], s[M + 1] = r[m + 2],
s[M + 2] = r[m + 4], s[M + 3] = 255, -1 != p && d(r, m) == p && d(r, m + 2) == g && d(r, m + 4) == y && (s[M + 3] = 0);
} else if (3 == c) {
var A = a.tabs.PLTE, U = a.tabs.tRNS, w = U ? U.length : 0;
if (1 == u) for (var _ = 0; _ < n; _++) {
var I = _ * o, q = _ * t;
for (v = 0; v < t; v++) {
var M = q + v << 2, T = 3 * (R = r[I + (v >> 3)] >> 7 - ((7 & v) << 0) & 1);
s[M] = A[T], s[M + 1] = A[T + 1], s[M + 2] = A[T + 2], s[M + 3] = R < w ? U[R] : 255;
}
}
if (2 == u) for (_ = 0; _ < n; _++) for (I = _ * o, q = _ * t, v = 0; v < t; v++) M = q + v << 2,
T = 3 * (R = r[I + (v >> 2)] >> 6 - ((3 & v) << 1) & 3), s[M] = A[T], s[M + 1] = A[T + 1],
s[M + 2] = A[T + 2], s[M + 3] = R < w ? U[R] : 255;
if (4 == u) for (_ = 0; _ < n; _++) for (I = _ * o, q = _ * t, v = 0; v < t; v++) M = q + v << 2,
T = 3 * (R = r[I + (v >> 1)] >> 4 - ((1 & v) << 2) & 15), s[M] = A[T], s[M + 1] = A[T + 1],
s[M + 2] = A[T + 2], s[M + 3] = R < w ? U[R] : 255;
if (8 == u) for (v = 0; v < i; v++) {
var R;
M = v << 2, T = 3 * (R = r[v]), s[M] = A[T], s[M + 1] = A[T + 1], s[M + 2] = A[T + 2],
s[M + 3] = R < w ? U[R] : 255;
}
} else if (4 == c) {
if (8 == u) for (v = 0; v < i; v++) {
M = v << 2;
var z = r[N = v << 1];
s[M] = z, s[M + 1] = z, s[M + 2] = z, s[M + 3] = r[N + 1];
}
if (16 == u) for (v = 0; v < i; v++) {
var N;
M = v << 2, z = r[N = v << 2], s[M] = z, s[M + 1] = z, s[M + 2] = z, s[M + 3] = r[N + 2];
}
} else if (0 == c) {
if (p = a.tabs.tRNS ? a.tabs.tRNS : -1, 1 == u) for (v = 0; v < i; v++) {
var S = (z = 255 * (r[v >> 3] >> 7 - (7 & v) & 1)) == 255 * p ? 0 : 255;
l[v] = S << 24 | z << 16 | z << 8 | z;
}
if (2 == u) for (v = 0; v < i; v++) S = (z = 85 * (r[v >> 2] >> 6 - ((3 & v) << 1) & 3)) == 85 * p ? 0 : 255,
l[v] = S << 24 | z << 16 | z << 8 | z;
if (4 == u) for (v = 0; v < i; v++) S = (z = 17 * (r[v >> 1] >> 4 - ((1 & v) << 2) & 15)) == 17 * p ? 0 : 255,
l[v] = S << 24 | z << 16 | z << 8 | z;
if (8 == u) for (v = 0; v < i; v++) S = (z = r[v]) == p ? 0 : 255, l[v] = S << 24 | z << 16 | z << 8 | z;
if (16 == u) for (v = 0; v < i; v++) z = r[v << 1], S = d(r, v << 1) == p ? 0 : 255,
l[v] = S << 24 | z << 16 | z << 8 | z;
}
return s;
}, e.decode = function(r) {
for (var t, n = new Uint8Array(r), a = 8, i = e._bin, f = i.readUshort, o = i.readUint, s = {
tabs: {},
frames: []
}, l = new Uint8Array(n.length), c = 0, u = 0, d = [ 137, 80, 78, 71, 13, 10, 26, 10 ], h = 0; h < 8; h++) if (n[h] != d[h]) throw "The input is not a PNG file!";
for (;a < n.length; ) {
var v = i.readUint(n, a);
a += 4;
var b = i.readASCII(n, a, 4);
if (a += 4, "IHDR" == b) e.decode._IHDR(n, a, s); else if ("IDAT" == b) {
for (h = 0; h < v; h++) l[c + h] = n[a + h];
c += v;
} else if ("acTL" == b) s.tabs[b] = {
num_frames: o(n, a),
num_plays: o(n, a + 4)
}, t = new Uint8Array(n.length); else if ("fcTL" == b) {
0 != u && ((I = s.frames[s.frames.length - 1]).data = e.decode._decompress(s, t.slice(0, u), I.rect.width, I.rect.height),
u = 0);
var p = {
x: o(n, a + 12),
y: o(n, a + 16),
width: o(n, a + 4),
height: o(n, a + 8)
}, g = f(n, a + 22);
g = f(n, a + 20) / (0 == g ? 100 : g);
var y = {
rect: p,
delay: Math.round(1e3 * g),
dispose: n[a + 24],
blend: n[a + 25]
};
s.frames.push(y);
} else if ("fdAT" == b) {
for (h = 0; h < v - 4; h++) t[u + h] = n[a + h + 4];
u += v - 4;
} else if ("pHYs" == b) s.tabs[b] = [ i.readUint(n, a), i.readUint(n, a + 4), n[a + 8] ]; else if ("cHRM" == b) for (s.tabs[b] = [],
h = 0; h < 8; h++) s.tabs[b].push(i.readUint(n, a + 4 * h)); else if ("tEXt" == b) {
null == s.tabs[b] && (s.tabs[b] = {});
var m = i.nextZero(n, a), A = i.readASCII(n, a, m - a), U = i.readASCII(n, m + 1, a + v - m - 1);
s.tabs[b][A] = U;
} else if ("iTXt" == b) {
null == s.tabs[b] && (s.tabs[b] = {}), m = 0;
var w = a;
m = i.nextZero(n, w), A = i.readASCII(n, w, m - w), n[w = m + 1], n[w + 1], w += 2,
m = i.nextZero(n, w), i.readASCII(n, w, m - w), w = m + 1, m = i.nextZero(n, w),
i.readUTF8(n, w, m - w), w = m + 1, U = i.readUTF8(n, w, v - (w - a)), s.tabs[b][A] = U;
} else if ("PLTE" == b) s.tabs[b] = i.readBytes(n, a, v); else if ("hIST" == b) {
var _ = s.tabs.PLTE.length / 3;
for (s.tabs[b] = [], h = 0; h < _; h++) s.tabs[b].push(f(n, a + 2 * h));
} else if ("tRNS" == b) 3 == s.ctype ? s.tabs[b] = i.readBytes(n, a, v) : 0 == s.ctype ? s.tabs[b] = f(n, a) : 2 == s.ctype && (s.tabs[b] = [ f(n, a), f(n, a + 2), f(n, a + 4) ]); else if ("gAMA" == b) s.tabs[b] = i.readUint(n, a) / 1e5; else if ("sRGB" == b) s.tabs[b] = n[a]; else if ("bKGD" == b) 0 == s.ctype || 4 == s.ctype ? s.tabs[b] = [ f(n, a) ] : 2 == s.ctype || 6 == s.ctype ? s.tabs[b] = [ f(n, a), f(n, a + 2), f(n, a + 4) ] : 3 == s.ctype && (s.tabs[b] = n[a]); else if ("IEND" == b) {
var I;
0 != u && ((I = s.frames[s.frames.length - 1]).data = e.decode._decompress(s, t.slice(0, u), I.rect.width, I.rect.height),
u = 0), s.data = e.decode._decompress(s, l, s.width, s.height);
break;
}
a += v, i.readUint(n, a), a += 4;
}
return delete s.compress, delete s.interlace, delete s.filter, s;
}, e.decode._decompress = function(r, t, n, a) {
return 0 == r.compress && (t = e.decode._inflate(t)), 0 == r.interlace ? t = e.decode._filterZero(t, r, 0, n, a) : 1 == r.interlace && (t = e.decode._readInterlace(t, r)),
t;
}, e.decode._inflate = function(e) {
return r.inflate(e);
}, e.decode._readInterlace = function(r, t) {
for (var n = t.width, a = t.height, i = e.decode._getBPP(t), f = i >> 3, o = Math.ceil(n * i / 8), s = new Uint8Array(a * o), l = 0, c = [ 0, 0, 4, 0, 2, 0, 1 ], u = [ 0, 4, 0, 2, 0, 1, 0 ], d = [ 8, 8, 8, 4, 4, 2, 2 ], h = [ 8, 8, 4, 4, 2, 2, 1 ], v = 0; v < 7; ) {
for (var b = d[v], p = h[v], g = 0, y = 0, m = c[v]; m < a; ) m += b, y++;
for (var A = u[v]; A < n; ) A += p, g++;
var U = Math.ceil(g * i / 8);
e.decode._filterZero(r, t, l, g, y);
for (var w = 0, _ = c[v]; _ < a; ) {
for (var I = u[v], q = l + w * U << 3; I < n; ) {
var M;
if (1 == i && (M = (M = r[q >> 3]) >> 7 - (7 & q) & 1, s[_ * o + (I >> 3)] |= M << 7 - ((3 & I) << 0)),
2 == i && (M = (M = r[q >> 3]) >> 6 - (7 & q) & 3, s[_ * o + (I >> 2)] |= M << 6 - ((3 & I) << 1)),
4 == i && (M = (M = r[q >> 3]) >> 4 - (7 & q) & 15, s[_ * o + (I >> 1)] |= M << 4 - ((1 & I) << 2)),
i >= 8) for (var T = _ * o + I * f, R = 0; R < f; R++) s[T + R] = r[(q >> 3) + R];
q += i, I += p;
}
w++, _ += b;
}
g * y != 0 && (l += y * (1 + U)), v += 1;
}
return s;
}, e.decode._getBPP = function(e) {
return [ 1, null, 3, 1, 2, null, 4 ][e.ctype] * e.depth;
}, e.decode._filterZero = function(r, t, n, a, i) {
var f = e.decode._getBPP(t), o = Math.ceil(a * f / 8), s = e.decode._paeth;
f = Math.ceil(f / 8);
for (var l = 0; l < i; l++) {
var c = n + l * o, u = c + l + 1, d = r[u - 1];
if (0 == d) for (var h = 0; h < o; h++) r[c + h] = r[u + h]; else if (1 == d) {
for (h = 0; h < f; h++) r[c + h] = r[u + h];
for (h = f; h < o; h++) r[c + h] = r[u + h] + r[c + h - f] & 255;
} else if (0 == l) {
for (h = 0; h < f; h++) r[c + h] = r[u + h];
if (2 == d) for (h = f; h < o; h++) r[c + h] = 255 & r[u + h];
if (3 == d) for (h = f; h < o; h++) r[c + h] = r[u + h] + (r[c + h - f] >> 1) & 255;
if (4 == d) for (h = f; h < o; h++) r[c + h] = r[u + h] + s(r[c + h - f], 0, 0) & 255;
} else {
if (2 == d) for (h = 0; h < o; h++) r[c + h] = r[u + h] + r[c + h - o] & 255;
if (3 == d) {
for (h = 0; h < f; h++) r[c + h] = r[u + h] + (r[c + h - o] >> 1) & 255;
for (h = f; h < o; h++) r[c + h] = r[u + h] + (r[c + h - o] + r[c + h - f] >> 1) & 255;
}
if (4 == d) {
for (h = 0; h < f; h++) r[c + h] = r[u + h] + s(0, r[c + h - o], 0) & 255;
for (h = f; h < o; h++) r[c + h] = r[u + h] + s(r[c + h - f], r[c + h - o], r[c + h - f - o]) & 255;
}
}
}
return r;
}, e.decode._paeth = function(e, r, t) {
var n = e + r - t, a = Math.abs(n - e), i = Math.abs(n - r), f = Math.abs(n - t);
return a <= i && a <= f ? e : i <= f ? r : t;
}, e.decode._IHDR = function(r, t, n) {
var a = e._bin;
n.width = a.readUint(r, t), t += 4, n.height = a.readUint(r, t), t += 4, n.depth = r[t],
t++, n.ctype = r[t], t++, n.compress = r[t], t++, n.filter = r[t], t++, n.interlace = r[t],
t++;
}, e._bin = {
nextZero: function(e, r) {
for (;0 != e[r]; ) r++;
return r;
},
readUshort: function(e, r) {
return e[r] << 8 | e[r + 1];
},
writeUshort: function(e, r, t) {
e[r] = t >> 8 & 255, e[r + 1] = 255 & t;
},
readUint: function(e, r) {
return 16777216 * e[r] + (e[r + 1] << 16 | e[r + 2] << 8 | e[r + 3]);
},
writeUint: function(e, r, t) {
e[r] = t >> 24 & 255, e[r + 1] = t >> 16 & 255, e[r + 2] = t >> 8 & 255, e[r + 3] = 255 & t;
},
readASCII: function(e, r, t) {
for (var n = "", a = 0; a < t; a++) n += String.fromCharCode(e[r + a]);
return n;
},
writeASCII: function(e, r, t) {
for (var n = 0; n < t.length; n++) e[r + n] = t.charCodeAt(n);
},
readBytes: function(e, r, t) {
for (var n = [], a = 0; a < t; a++) n.push(e[r + a]);
return n;
},
pad: function(e) {
return e.length < 2 ? "0" + e : e;
},
readUTF8: function(r, t, n) {
for (var a, i = "", f = 0; f < n; f++) i += "%" + e._bin.pad(r[t + f].toString(16));
try {
a = decodeURIComponent(i);
} catch (a) {
return e._bin.readASCII(r, t, n);
}
return a;
}
}, e._copyTile = function(e, r, t, n, a, i, f, o, s) {
for (var l = Math.min(r, a), c = Math.min(t, i), u = 0, d = 0, h = 0; h < c; h++) for (var v = 0; v < l; v++) if (f >= 0 && o >= 0 ? (u = h * r + v << 2,
d = (o + h) * a + f + v << 2) : (u = (-o + h) * r - f + v << 2, d = h * a + v << 2),
0 == s) n[d] = e[u], n[d + 1] = e[u + 1], n[d + 2] = e[u + 2], n[d + 3] = e[u + 3]; else if (1 == s) {
var b = e[u + 3] * (1 / 255), p = e[u] * b, g = e[u + 1] * b, y = e[u + 2] * b, m = n[d + 3] * (1 / 255), A = n[d] * m, U = n[d + 1] * m, w = n[d + 2] * m, _ = 1 - b, I = b + m * _, q = 0 == I ? 0 : 1 / I;
n[d + 3] = 255 * I, n[d + 0] = (p + A * _) * q, n[d + 1] = (g + U * _) * q, n[d + 2] = (y + w * _) * q;
} else if (2 == s) b = e[u + 3], p = e[u], g = e[u + 1], y = e[u + 2], m = n[d + 3],
A = n[d], U = n[d + 1], w = n[d + 2], b == m && p == A && g == U && y == w ? (n[d] = 0,
n[d + 1] = 0, n[d + 2] = 0, n[d + 3] = 0) : (n[d] = p, n[d + 1] = g, n[d + 2] = y,
n[d + 3] = b); else if (3 == s) {
if (b = e[u + 3], p = e[u], g = e[u + 1], y = e[u + 2], m = n[d + 3], A = n[d],
U = n[d + 1], w = n[d + 2], b == m && p == A && g == U && y == w) continue;
if (b < 220 && m > 20) return !1;
}
return !0;
}, e.encode = function(r, t, n, a, i, f) {
null == a && (a = 0), null == f && (f = !1);
for (var o = new Uint8Array(r[0].byteLength * r.length + 100), s = [ 137, 80, 78, 71, 13, 10, 26, 10 ], l = 0; l < 8; l++) o[l] = s[l];
var c = 8, u = e._bin, d = e.crc.crc, h = u.writeUint, v = u.writeUshort, b = u.writeASCII, p = e.encode.compressPNG(r, t, n, a, f);
h(o, c, 13), b(o, c += 4, "IHDR"), h(o, c += 4, t), h(o, c += 4, n), o[c += 4] = p.depth,
o[++c] = p.ctype, o[++c] = 0, o[++c] = 0, o[++c] = 0, h(o, ++c, d(o, c - 17, 17)),
h(o, c += 4, 1), b(o, c += 4, "sRGB"), o[c += 4] = 1, h(o, ++c, d(o, c - 5, 5)),
c += 4;
var g = r.length > 1;
if (g && (h(o, c, 8), b(o, c += 4, "acTL"), h(o, c += 4, r.length), h(o, c += 4, 0),
h(o, c += 4, d(o, c - 12, 12)), c += 4), 3 == p.ctype) {
for (h(o, c, 3 * (M = p.plte.length)), b(o, c += 4, "PLTE"), c += 4, l = 0; l < M; l++) {
var y = 3 * l, m = p.plte[l], A = 255 & m, U = m >> 8 & 255, w = m >> 16 & 255;
o[c + y + 0] = A, o[c + y + 1] = U, o[c + y + 2] = w;
}
if (h(o, c += 3 * M, d(o, c - 3 * M - 4, 3 * M + 4)), c += 4, p.gotAlpha) {
for (h(o, c, M), b(o, c += 4, "tRNS"), c += 4, l = 0; l < M; l++) o[c + l] = p.plte[l] >> 24 & 255;
h(o, c += M, d(o, c - M - 4, M + 4)), c += 4;
}
}
for (var _ = 0, I = 0; I < p.frames.length; I++) {
var q = p.frames[I];
g && (h(o, c, 26), b(o, c += 4, "fcTL"), h(o, c += 4, _++), h(o, c += 4, q.rect.width),
h(o, c += 4, q.rect.height), h(o, c += 4, q.rect.x), h(o, c += 4, q.rect.y), v(o, c += 4, i[I]),
v(o, c += 2, 1e3), o[c += 2] = q.dispose, o[++c] = q.blend, h(o, ++c, d(o, c - 30, 30)),
c += 4);
var M, T = q.cimg;
h(o, c, (M = T.length) + (0 == I ? 0 : 4));
var R = c += 4;
for (b(o, c, 0 == I ? "IDAT" : "fdAT"), c += 4, 0 != I && (h(o, c, _++), c += 4),
l = 0; l < M; l++) o[c + l] = T[l];
h(o, c += M, d(o, R, c - R)), c += 4;
}
return h(o, c, 0), b(o, c += 4, "IEND"), h(o, c += 4, d(o, c - 4, 4)), c += 4, o.buffer.slice(0, c);
}, e.encode.compressPNG = function(r, t, n, a, i) {
for (var f = e.encode.compress(r, t, n, a, !1, i), o = 0; o < r.length; o++) {
var s = f.frames[o], l = (s.rect.width, s.rect.height), c = s.bpl, u = s.bpp, d = new Uint8Array(l * c + l);
s.cimg = e.encode._filterZero(s.img, l, u, c, d);
}
return f;
}, e.encode.compress = function(r, t, n, a, i, f) {
null == f && (f = !1);
for (var o = 6, s = 8, l = 4, c = 255, u = 0; u < r.length; u++) for (var d = new Uint8Array(r[u]), h = d.length, v = 0; v < h; v += 4) c &= d[v + 3];
var b = 255 != c, p = {}, g = [];
if (0 != r.length && (p[0] = 0, g.push(0), 0 != a && a--), 0 != a) {
var y = e.quantize(r, a, i);
for (r = y.bufs, v = 0; v < y.plte.length; v++) null == p[A = y.plte[v].est.rgba] && (p[A] = g.length,
g.push(A));
} else for (u = 0; u < r.length; u++) {
var m = new Uint32Array(r[u]);
for (h = m.length, v = 0; v < h; v++) {
var A = m[v];
if ((v < t || A != m[v - 1] && A != m[v - t]) && null == p[A] && (p[A] = g.length,
g.push(A), g.length >= 300)) break;
}
}
var U = !!b && i, w = g.length;
w <= 256 && 0 == f && (s = w <= 2 ? 1 : w <= 4 ? 2 : w <= 16 ? 4 : 8, i && (s = 8),
b = !0);
var _ = [];
for (u = 0; u < r.length; u++) {
var I = new Uint8Array(r[u]), q = new Uint32Array(I.buffer), M = 0, T = 0, R = t, z = n, N = 0;
if (0 != u && !U) {
for (var S = i || 1 == u || 2 == _[_.length - 2].dispose ? 1 : 2, P = 0, L = 1e9, C = 0; C < S; C++) {
for (var D = new Uint8Array(r[u - 1 - C]), B = new Uint32Array(r[u - 1 - C]), x = t, G = n, Z = -1, E = -1, k = 0; k < n; k++) for (var H = 0; H < t; H++) q[v = k * t + H] != B[v] && (H < x && (x = H),
H > Z && (Z = H), k < G && (G = k), k > E && (E = k));
var F = -1 == Z ? 1 : (Z - x + 1) * (E - G + 1);
F < L && (L = F, P = C, -1 == Z ? (M = T = 0, R = z = 1) : (M = x, T = G, R = Z - x + 1,
z = E - G + 1));
}
D = new Uint8Array(r[u - 1 - P]), 1 == P && (_[_.length - 1].dispose = 2);
var V = new Uint8Array(R * z * 4);
new Uint32Array(V.buffer), e._copyTile(D, t, n, V, R, z, -M, -T, 0), e._copyTile(I, t, n, V, R, z, -M, -T, 3) ? (e._copyTile(I, t, n, V, R, z, -M, -T, 2),
N = 1) : (e._copyTile(I, t, n, V, R, z, -M, -T, 0), N = 0), I = V, q = new Uint32Array(I.buffer);
}
var X = 4 * R;
if (w <= 256 && 0 == f) {
for (X = Math.ceil(s * R / 8), V = new Uint8Array(X * z), k = 0; k < z; k++) {
v = k * X;
var j = k * R;
if (8 == s) for (H = 0; H < R; H++) V[v + H] = p[q[j + H]]; else if (4 == s) for (H = 0; H < R; H++) V[v + (H >> 1)] |= p[q[j + H]] << 4 - 4 * (1 & H); else if (2 == s) for (H = 0; H < R; H++) V[v + (H >> 2)] |= p[q[j + H]] << 6 - 2 * (3 & H); else if (1 == s) for (H = 0; H < R; H++) V[v + (H >> 3)] |= p[q[j + H]] << 7 - 1 * (7 & H);
}
I = V, o = 3, l = 1;
} else if (0 == b && 1 == r.length) {
V = new Uint8Array(R * z * 3);
var K = R * z;
for (v = 0; v < K; v++) {
var Y = 3 * v, J = 4 * v;
V[Y] = I[J], V[Y + 1] = I[J + 1], V[Y + 2] = I[J + 2];
}
I = V, o = 2, l = 3, X = 3 * R;
}
_.push({
rect: {
x: M,
y: T,
width: R,
height: z
},
img: I,
bpl: X,
bpp: l,
blend: N,
dispose: U ? 1 : 0
});
}
return {
ctype: o,
depth: s,
plte: g,
gotAlpha: b,
frames: _
};
}, e.encode._filterZero = function(t, n, a, i, f) {
for (var o = [], s = 0; s < 5; s++) if (!(n * i > 5e5) || 2 != s && 3 != s && 4 != s) {
for (var l = 0; l < n; l++) e.encode._filterLine(f, t, l, i, a, s);
if (o.push(r.deflate(f)), 1 == a) break;
}
for (var c, u = 1e9, d = 0; d < o.length; d++) o[d].length < u && (c = d, u = o[d].length);
return o[c];
}, e.encode._filterLine = function(r, t, n, a, i, f) {
var o = n * a, s = o + n, l = e.decode._paeth;
if (r[s] = f, s++, 0 == f) for (var c = 0; c < a; c++) r[s + c] = t[o + c]; else if (1 == f) {
for (c = 0; c < i; c++) r[s + c] = t[o + c];
for (c = i; c < a; c++) r[s + c] = t[o + c] - t[o + c - i] + 256 & 255;
} else if (0 == n) {
for (c = 0; c < i; c++) r[s + c] = t[o + c];
if (2 == f) for (c = i; c < a; c++) r[s + c] = t[o + c];
if (3 == f) for (c = i; c < a; c++) r[s + c] = t[o + c] - (t[o + c - i] >> 1) + 256 & 255;
if (4 == f) for (c = i; c < a; c++) r[s + c] = t[o + c] - l(t[o + c - i], 0, 0) + 256 & 255;
} else {
if (2 == f) for (c = 0; c < a; c++) r[s + c] = t[o + c] + 256 - t[o + c - a] & 255;
if (3 == f) {
for (c = 0; c < i; c++) r[s + c] = t[o + c] + 256 - (t[o + c - a] >> 1) & 255;
for (c = i; c < a; c++) r[s + c] = t[o + c] + 256 - (t[o + c - a] + t[o + c - i] >> 1) & 255;
}
if (4 == f) {
for (c = 0; c < i; c++) r[s + c] = t[o + c] + 256 - l(0, t[o + c - a], 0) & 255;
for (c = i; c < a; c++) r[s + c] = t[o + c] + 256 - l(t[o + c - i], t[o + c - a], t[o + c - i - a]) & 255;
}
}
}, e.crc = {
table: function() {
for (var e = new Uint32Array(256), r = 0; r < 256; r++) {
for (var t = r, n = 0; n < 8; n++) 1 & t ? t = 3988292384 ^ t >>> 1 : t >>>= 1;
e[r] = t;
}
return e;
}(),
update: function(r, t, n, a) {
for (var i = 0; i < a; i++) r = e.crc.table[255 & (r ^ t[n + i])] ^ r >>> 8;
return r;
},
crc: function(r, t, n) {
return 4294967295 ^ e.crc.update(4294967295, r, t, n);
}
}, e.quantize = function(r, t, n) {
for (var a = [], i = 0, f = 0; f < r.length; f++) a.push(e.encode.alphaMul(new Uint8Array(r[f]), n)),
i += r[f].byteLength;
var o = new Uint8Array(i), s = new Uint32Array(o.buffer), l = 0;
for (f = 0; f < a.length; f++) {
for (var c = a[f], u = c.length, d = 0; d < u; d++) o[l + d] = c[d];
l += u;
}
var h = {
i0: 0,
i1: o.length,
bst: null,
est: null,
tdst: 0,
left: null,
right: null
};
h.bst = e.quantize.stats(o, h.i0, h.i1), h.est = e.quantize.estats(h.bst);
for (var v = [ h ]; v.length < t; ) {
var b = 0, p = 0;
for (f = 0; f < v.length; f++) v[f].est.L > b && (b = v[f].est.L, p = f);
if (b < .001) break;
var g = v[p], y = e.quantize.splitPixels(o, s, g.i0, g.i1, g.est.e, g.est.eMq255), m = {
i0: g.i0,
i1: y,
bst: null,
est: null,
tdst: 0,
left: null,
right: null
};
m.bst = e.quantize.stats(o, m.i0, m.i1), m.est = e.quantize.estats(m.bst);
var A = {
i0: y,
i1: g.i1,
bst: null,
est: null,
tdst: 0,
left: null,
right: null
};
for (A.bst = {
R: [],
m: [],
N: g.bst.N - m.bst.N
}, f = 0; f < 16; f++) A.bst.R[f] = g.bst.R[f] - m.bst.R[f];
for (f = 0; f < 4; f++) A.bst.m[f] = g.bst.m[f] - m.bst.m[f];
A.est = e.quantize.estats(A.bst), g.left = m, g.right = A, v[p] = m, v.push(A);
}
v.sort(function(e, r) {
return r.bst.N - e.bst.N;
});
for (var U = 0; U < a.length; U++) {
var w = e.quantize.planeDst, _ = new Uint8Array(a[U].buffer), I = new Uint32Array(a[U].buffer), q = _.length;
for (f = 0; f < q; f += 4) {
for (var M = _[f] * (1 / 255), T = _[f + 1] * (1 / 255), R = _[f + 2] * (1 / 255), z = _[f + 3] * (1 / 255), N = h; N.left; ) N = w(N.est, M, T, R, z) <= 0 ? N.left : N.right;
I[f >> 2] = N.est.rgba;
}
a[U] = I.buffer;
}
return {
bufs: a,
plte: v
};
}, e.quantize.getNearest = function(r, t, n, a, i) {
if (null == r.left) return r.tdst = e.quantize.dist(r.est.q, t, n, a, i), r;
var f = e.quantize.planeDst(r.est, t, n, a, i), o = r.left, s = r.right;
f > 0 && (o = r.right, s = r.left);
var l = e.quantize.getNearest(o, t, n, a, i);
if (l.tdst <= f * f) return l;
var c = e.quantize.getNearest(s, t, n, a, i);
return c.tdst < l.tdst ? c : l;
}, e.quantize.planeDst = function(e, r, t, n, a) {
var i = e.e;
return i[0] * r + i[1] * t + i[2] * n + i[3] * a - e.eMq;
}, e.quantize.dist = function(e, r, t, n, a) {
var i = r - e[0], f = t - e[1], o = n - e[2], s = a - e[3];
return i * i + f * f + o * o + s * s;
}, e.quantize.splitPixels = function(r, t, n, a, i, f) {
var o = e.quantize.vecDot;
for (a -= 4; n < a; ) {
for (;o(r, n, i) <= f; ) n += 4;
for (;o(r, a, i) > f; ) a -= 4;
if (n >= a) break;
var s = t[n >> 2];
t[n >> 2] = t[a >> 2], t[a >> 2] = s, n += 4, a -= 4;
}
for (;o(r, n, i) > f; ) n -= 4;
return n + 4;
}, e.quantize.vecDot = function(e, r, t) {
return e[r] * t[0] + e[r + 1] * t[1] + e[r + 2] * t[2] + e[r + 3] * t[3];
}, e.quantize.stats = function(e, r, t) {
for (var n = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], a = [ 0, 0, 0, 0 ], i = t - r >> 2, f = r; f < t; f += 4) {
var o = e[f] * (1 / 255), s = e[f + 1] * (1 / 255), l = e[f + 2] * (1 / 255), c = e[f + 3] * (1 / 255);
a[0] += o, a[1] += s, a[2] += l, a[3] += c, n[0] += o * o, n[1] += o * s, n[2] += o * l,
n[3] += o * c, n[5] += s * s, n[6] += s * l, n[7] += s * c, n[10] += l * l, n[11] += l * c,
n[15] += c * c;
}
return n[4] = n[1], n[8] = n[2], n[12] = n[3], n[9] = n[6], n[13] = n[7], n[14] = n[11],
{
R: n,
m: a,
N: i
};
}, e.quantize.estats = function(r) {
var t = r.R, n = r.m, a = r.N, i = n[0], f = n[1], o = n[2], s = n[3], l = 0 == a ? 0 : 1 / a, c = [ t[0] - i * i * l, t[1] - i * f * l, t[2] - i * o * l, t[3] - i * s * l, t[4] - f * i * l, t[5] - f * f * l, t[6] - f * o * l, t[7] - f * s * l, t[8] - o * i * l, t[9] - o * f * l, t[10] - o * o * l, t[11] - o * s * l, t[12] - s * i * l, t[13] - s * f * l, t[14] - s * o * l, t[15] - s * s * l ], u = c, d = e.M4, h = [ .5, .5, .5, .5 ], v = 0, b = 0;
if (0 != a) for (var p = 0; p < 10 && (h = d.multVec(u, h), b = Math.sqrt(d.dot(h, h)),
h = d.sml(1 / b, h), !(Math.abs(b - v) < 1e-9)); p++) v = b;
var g = [ i * l, f * l, o * l, s * l ], y = d.dot(d.sml(255, g), h), m = g[3] < .001 ? 0 : 1 / g[3];
return {
Cov: c,
q: g,
e: h,
L: v,
eMq255: y,
eMq: d.dot(h, g),
rgba: (Math.round(255 * g[3]) << 24 | Math.round(255 * g[2] * m) << 16 | Math.round(255 * g[1] * m) << 8 | Math.round(255 * g[0] * m) << 0) >>> 0
};
}, e.M4 = {
multVec: function(e, r) {
return [ e[0] * r[0] + e[1] * r[1] + e[2] * r[2] + e[3] * r[3], e[4] * r[0] + e[5] * r[1] + e[6] * r[2] + e[7] * r[3], e[8] * r[0] + e[9] * r[1] + e[10] * r[2] + e[11] * r[3], e[12] * r[0] + e[13] * r[1] + e[14] * r[2] + e[15] * r[3] ];
},
dot: function(e, r) {
return e[0] * r[0] + e[1] * r[1] + e[2] * r[2] + e[3] * r[3];
},
sml: function(e, r) {
return [ e * r[0], e * r[1], e * r[2], e * r[3] ];
}
}, e.encode.alphaMul = function(e, r) {
for (var t = new Uint8Array(e.length), n = e.length >> 2, a = 0; a < n; a++) {
var i = a << 2, f = e[i + 3];
r && (f = f < 128 ? 0 : 255);
var o = f * (1 / 255);
t[i + 0] = e[i + 0] * o, t[i + 1] = e[i + 1] * o, t[i + 2] = e[i + 2] * o, t[i + 3] = f;
}
return t;
};
}(e, r);
\ No newline at end of file
var t = function() {
function t(t, a) {
for (var e = 0; e < a.length; e++) {
var i = a[e];
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0),
Object.defineProperty(t, i.key, i);
}
}
return function(a, e, i) {
return e && t(a.prototype, e), i && t(a, i), a;
};
}(), a = function() {
function a(t) {
(function(t, a) {
if (!(t instanceof a)) throw new TypeError("Cannot call a class as a function");
})(this, a), this.ak = t.ak;
}
return t(a, [ {
key: "getWXLocation",
value: function(t, a, e, i) {
t = t || "gcj02", a = a || function() {}, e = e || function() {}, i = i || function() {},
wx.getLocation({
type: t,
success: a,
fail: e,
complete: i
});
}
}, {
key: "search",
value: function(t) {
var a = {
query: (t = t || {}).query || "生活服务$美食&酒店",
scope: t.scope || 1,
filter: t.filter || "",
coord_type: t.coord_type || 2,
page_size: t.page_size || 10,
page_num: t.page_num || 0,
output: t.output || "json",
ak: this.ak,
sn: t.sn || "",
timestamp: t.timestamp || "",
radius: t.radius || 2e3,
ret_coordtype: "gcj02ll"
}, e = {
iconPath: t.iconPath,
iconTapPath: t.iconTapPath,
width: t.width,
height: t.height,
alpha: t.alpha || 1,
success: t.success || function() {},
fail: t.fail || function() {}
}, i = function(t) {
a.location = t.latitude + "," + t.longitude, wx.request({
url: "https://api.map.baidu.com/place/v2/search",
data: a,
header: {
"content-type": "application/json"
},
method: "GET",
success: function(t) {
var a = t.data;
if (0 === a.status) {
var i = a.results, n = {};
n.originalData = a, n.wxMarkerData = [];
for (var o = 0; o < i.length; o++) n.wxMarkerData[o] = {
id: o,
latitude: i[o].location.lat,
longitude: i[o].location.lng,
title: i[o].name,
iconPath: e.iconPath,
iconTapPath: e.iconTapPath,
address: i[o].address,
telephone: i[o].telephone,
alpha: e.alpha,
width: e.width,
height: e.height
};
e.success(n);
} else e.fail({
errMsg: a.message,
statusCode: a.status
});
},
fail: function(t) {
e.fail(t);
}
});
};
if (t.location) {
var n = t.location.split(",")[1];
i({
errMsg: "input location",
latitude: t.location.split(",")[0],
longitude: n
});
} else this.getWXLocation("gcj02", i, function(t) {
e.fail(t);
}, function(t) {});
}
}, {
key: "suggestion",
value: function(t) {
var a = {
query: (t = t || {}).query || "",
region: t.region || "全国",
city_limit: t.city_limit || !1,
output: t.output || "json",
ak: this.ak,
sn: t.sn || "",
timestamp: t.timestamp || "",
ret_coordtype: "gcj02ll"
}, e = {
success: t.success || function() {},
fail: t.fail || function() {}
};
wx.request({
url: "https://api.map.baidu.com/place/v2/suggestion",
data: a,
header: {
"content-type": "application/json"
},
method: "GET",
success: function(t) {
var a = t.data;
0 === a.status ? e.success(a) : e.fail({
errMsg: a.message,
statusCode: a.status
});
},
fail: function(t) {
e.fail(t);
}
});
}
}, {
key: "regeocoding",
value: function(t) {
var a = {
coordtype: (t = t || {}).coordtype || "gcj02ll",
ret_coordtype: "gcj02ll",
radius: t.radius || 1e3,
ak: this.ak,
sn: t.sn || "",
output: t.output || "json",
callback: t.callback || function() {},
extensions_poi: t.extensions_poi || 1,
extensions_road: t.extensions_road || !1,
extensions_town: t.extensions_town || !1,
language: t.language || "zh-CN",
language_auto: t.language_auto || 0
}, e = {
iconPath: t.iconPath,
iconTapPath: t.iconTapPath,
width: t.width,
height: t.height,
alpha: t.alpha || 1,
success: t.success || function() {},
fail: t.fail || function() {}
}, i = function(t) {
a.location = t.latitude + "," + t.longitude, wx.request({
url: "https://api.map.baidu.com/reverse_geocoding/v3",
data: a,
header: {
"content-type": "application/json"
},
method: "GET",
success: function(a) {
var i = a.data;
if (0 === i.status) {
var n = i.result, o = {};
o.originalData = i, o.wxMarkerData = [], o.wxMarkerData[0] = {
id: 0,
latitude: t.latitude,
longitude: t.longitude,
address: n.formatted_address,
iconPath: e.iconPath,
iconTapPath: e.iconTapPath,
desc: n.sematic_description,
business: n.business,
alpha: e.alpha,
width: e.width,
height: e.height
}, e.success(o);
} else e.fail({
errMsg: i.message,
statusCode: i.status
});
},
fail: function(t) {
e.fail(t);
}
});
};
if (t.location) {
var n = t.location.split(",")[1];
i({
errMsg: "input location",
latitude: t.location.split(",")[0],
longitude: n
});
} else this.getWXLocation("gcj02", i, function(t) {
e.fail(t);
}, function(t) {});
}
}, {
key: "geocoding",
value: function(t) {
var a = {
address: (t = t || {}).address || "",
city: t.city || "",
ret_coordtype: t.coordtype || "gcj02ll",
ak: this.ak,
sn: t.sn || "",
output: t.output || "json",
callback: t.callback || function() {}
}, e = {
iconPath: t.iconPath,
iconTapPath: t.iconTapPath,
width: t.width,
height: t.height,
alpha: t.alpha || 1,
success: t.success || function() {},
fail: t.fail || function() {}
};
if (t.address) wx.request({
url: "https://api.map.baidu.com/geocoding/v3",
data: a,
header: {
"content-type": "application/json"
},
method: "GET",
success: function(t) {
var a = t.data;
if (0 === a.status) {
var i = a.result, n = a;
n.originalData = a, n.wxMarkerData = [], n.wxMarkerData[0] = {
id: 0,
latitude: i.location.lat,
longitude: i.location.lng,
iconPath: e.iconPath,
iconTapPath: e.iconTapPath,
alpha: e.alpha,
width: e.width,
height: e.height
}, e.success(n);
} else e.fail({
errMsg: a.message,
statusCode: a.status
});
},
fail: function(t) {
e.fail(t);
}
}); else {
e.fail({
errMsg: "input address!"
});
}
}
}, {
key: "weather",
value: function(t) {
var a = {
coord_type: (t = t || {}).coord_type || "gcj02",
output: t.output || "json",
ak: this.ak,
sn: t.sn || "",
timestamp: t.timestamp || ""
}, e = {
success: t.success || function() {},
fail: t.fail || function() {}
}, i = function(t) {
a.location = t.longitude + "," + t.latitude, wx.request({
url: "https://api.map.baidu.com/telematics/v3/weather",
data: a,
header: {
"content-type": "application/json"
},
method: "GET",
success: function(t) {
var a = t.data;
if (0 === a.error && "success" === a.status) {
var i = a.results, n = {};
n.originalData = a, n.currentWeather = [], n.currentWeather[0] = {
currentCity: i[0].currentCity,
pm25: i[0].pm25,
date: i[0].weather_data[0].date,
temperature: i[0].weather_data[0].temperature,
weatherDesc: i[0].weather_data[0].weather,
wind: i[0].weather_data[0].wind
}, e.success(n);
} else e.fail({
errMsg: a.message,
statusCode: a.status
});
},
fail: function(t) {
e.fail(t);
}
});
};
if (t.location) {
var n = t.location.split(",")[0];
i({
errMsg: "input location",
latitude: t.location.split(",")[1],
longitude: n
});
} else this.getWXLocation("gcj02", i, function(t) {
e.fail(t);
}, function(t) {});
}
} ]), a;
}();
module.exports.BMapWX = a;
\ No newline at end of file
var t = require("../@babel/runtime/helpers/interopRequireDefault")(require("../@babel/runtime/helpers/typeof"));
!function(e) {
"object" == ("undefined" == typeof exports ? "undefined" : (0, t.default)(exports)) && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).pako = e();
}(function() {
return function t(e, a, i) {
function n(s, o) {
if (!a[s]) {
if (!e[s]) {
var l = "function" == typeof require && require;
if (!o && l) return l(s, !0);
if (r) return r(s, !0);
var h = new Error("Cannot find module '" + s + "'");
throw h.code = "MODULE_NOT_FOUND", h;
}
var d = a[s] = {
exports: {}
};
e[s][0].call(d.exports, function(t) {
return n(e[s][1][t] || t);
}, d, d.exports, t, e, a, i);
}
return a[s].exports;
}
for (var r = "function" == typeof require && require, s = 0; s < i.length; s++) n(i[s]);
return n;
}({
1: [ function(t, e, a) {
function i(t) {
if (!(this instanceof i)) return new i(t);
this.options = s.assign({
level: _,
method: c,
chunkSize: 16384,
windowBits: 15,
memLevel: 8,
strategy: u,
to: ""
}, t || {});
var e = this.options;
e.raw && e.windowBits > 0 ? e.windowBits = -e.windowBits : e.gzip && e.windowBits > 0 && e.windowBits < 16 && (e.windowBits += 16),
this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new h(),
this.strm.avail_out = 0;
var a = r.deflateInit2(this.strm, e.level, e.method, e.windowBits, e.memLevel, e.strategy);
if (a !== f) throw new Error(l[a]);
if (e.header && r.deflateSetHeader(this.strm, e.header), e.dictionary) {
var n;
if (n = "string" == typeof e.dictionary ? o.string2buf(e.dictionary) : "[object ArrayBuffer]" === d.call(e.dictionary) ? new Uint8Array(e.dictionary) : e.dictionary,
(a = r.deflateSetDictionary(this.strm, n)) !== f) throw new Error(l[a]);
this._dict_set = !0;
}
}
function n(t, e) {
var a = new i(e);
if (a.push(t, !0), a.err) throw a.msg || l[a.err];
return a.result;
}
var r = t("./zlib/deflate"), s = t("./utils/common"), o = t("./utils/strings"), l = t("./zlib/messages"), h = t("./zlib/zstream"), d = Object.prototype.toString, f = 0, _ = -1, u = 0, c = 8;
i.prototype.push = function(t, e) {
var a, i, n = this.strm, l = this.options.chunkSize;
if (this.ended) return !1;
i = e === ~~e ? e : !0 === e ? 4 : 0, "string" == typeof t ? n.input = o.string2buf(t) : "[object ArrayBuffer]" === d.call(t) ? n.input = new Uint8Array(t) : n.input = t,
n.next_in = 0, n.avail_in = n.input.length;
do {
if (0 === n.avail_out && (n.output = new s.Buf8(l), n.next_out = 0, n.avail_out = l),
1 !== (a = r.deflate(n, i)) && a !== f) return this.onEnd(a), this.ended = !0, !1;
0 !== n.avail_out && (0 !== n.avail_in || 4 !== i && 2 !== i) || ("string" === this.options.to ? this.onData(o.buf2binstring(s.shrinkBuf(n.output, n.next_out))) : this.onData(s.shrinkBuf(n.output, n.next_out)));
} while ((n.avail_in > 0 || 0 === n.avail_out) && 1 !== a);
return 4 === i ? (a = r.deflateEnd(this.strm), this.onEnd(a), this.ended = !0, a === f) : 2 !== i || (this.onEnd(f),
n.avail_out = 0, !0);
}, i.prototype.onData = function(t) {
this.chunks.push(t);
}, i.prototype.onEnd = function(t) {
t === f && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = s.flattenChunks(this.chunks)),
this.chunks = [], this.err = t, this.msg = this.strm.msg;
}, a.Deflate = i, a.deflate = n, a.deflateRaw = function(t, e) {
return (e = e || {}).raw = !0, n(t, e);
}, a.gzip = function(t, e) {
return (e = e || {}).gzip = !0, n(t, e);
};
}, {
"./utils/common": 3,
"./utils/strings": 4,
"./zlib/deflate": 8,
"./zlib/messages": 13,
"./zlib/zstream": 15
} ],
2: [ function(t, e, a) {
function i(t) {
if (!(this instanceof i)) return new i(t);
this.options = s.assign({
chunkSize: 16384,
windowBits: 0,
to: ""
}, t || {});
var e = this.options;
e.raw && e.windowBits >= 0 && e.windowBits < 16 && (e.windowBits = -e.windowBits,
0 === e.windowBits && (e.windowBits = -15)), !(e.windowBits >= 0 && e.windowBits < 16) || t && t.windowBits || (e.windowBits += 32),
e.windowBits > 15 && e.windowBits < 48 && 0 == (15 & e.windowBits) && (e.windowBits |= 15),
this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new d(),
this.strm.avail_out = 0;
var a = r.inflateInit2(this.strm, e.windowBits);
if (a !== l.Z_OK) throw new Error(h[a]);
this.header = new f(), r.inflateGetHeader(this.strm, this.header);
}
function n(t, e) {
var a = new i(e);
if (a.push(t, !0), a.err) throw a.msg || h[a.err];
return a.result;
}
var r = t("./zlib/inflate"), s = t("./utils/common"), o = t("./utils/strings"), l = t("./zlib/constants"), h = t("./zlib/messages"), d = t("./zlib/zstream"), f = t("./zlib/gzheader"), _ = Object.prototype.toString;
i.prototype.push = function(t, e) {
var a, i, n, h, d, f, u = this.strm, c = this.options.chunkSize, b = this.options.dictionary, g = !1;
if (this.ended) return !1;
i = e === ~~e ? e : !0 === e ? l.Z_FINISH : l.Z_NO_FLUSH, "string" == typeof t ? u.input = o.binstring2buf(t) : "[object ArrayBuffer]" === _.call(t) ? u.input = new Uint8Array(t) : u.input = t,
u.next_in = 0, u.avail_in = u.input.length;
do {
if (0 === u.avail_out && (u.output = new s.Buf8(c), u.next_out = 0, u.avail_out = c),
(a = r.inflate(u, l.Z_NO_FLUSH)) === l.Z_NEED_DICT && b && (f = "string" == typeof b ? o.string2buf(b) : "[object ArrayBuffer]" === _.call(b) ? new Uint8Array(b) : b,
a = r.inflateSetDictionary(this.strm, f)), a === l.Z_BUF_ERROR && !0 === g && (a = l.Z_OK,
g = !1), a !== l.Z_STREAM_END && a !== l.Z_OK) return this.onEnd(a), this.ended = !0,
!1;
u.next_out && (0 !== u.avail_out && a !== l.Z_STREAM_END && (0 !== u.avail_in || i !== l.Z_FINISH && i !== l.Z_SYNC_FLUSH) || ("string" === this.options.to ? (n = o.utf8border(u.output, u.next_out),
h = u.next_out - n, d = o.buf2string(u.output, n), u.next_out = h, u.avail_out = c - h,
h && s.arraySet(u.output, u.output, n, h, 0), this.onData(d)) : this.onData(s.shrinkBuf(u.output, u.next_out)))),
0 === u.avail_in && 0 === u.avail_out && (g = !0);
} while ((u.avail_in > 0 || 0 === u.avail_out) && a !== l.Z_STREAM_END);
return a === l.Z_STREAM_END && (i = l.Z_FINISH), i === l.Z_FINISH ? (a = r.inflateEnd(this.strm),
this.onEnd(a), this.ended = !0, a === l.Z_OK) : i !== l.Z_SYNC_FLUSH || (this.onEnd(l.Z_OK),
u.avail_out = 0, !0);
}, i.prototype.onData = function(t) {
this.chunks.push(t);
}, i.prototype.onEnd = function(t) {
t === l.Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = s.flattenChunks(this.chunks)),
this.chunks = [], this.err = t, this.msg = this.strm.msg;
}, a.Inflate = i, a.inflate = n, a.inflateRaw = function(t, e) {
return (e = e || {}).raw = !0, n(t, e);
}, a.ungzip = n;
}, {
"./utils/common": 3,
"./utils/strings": 4,
"./zlib/constants": 6,
"./zlib/gzheader": 9,
"./zlib/inflate": 11,
"./zlib/messages": 13,
"./zlib/zstream": 15
} ],
3: [ function(e, a, i) {
function n(t, e) {
return Object.prototype.hasOwnProperty.call(t, e);
}
var r = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Int32Array;
i.assign = function(e) {
for (var a = Array.prototype.slice.call(arguments, 1); a.length; ) {
var i = a.shift();
if (i) {
if ("object" != (0, t.default)(i)) throw new TypeError(i + "must be non-object");
for (var r in i) n(i, r) && (e[r] = i[r]);
}
}
return e;
}, i.shrinkBuf = function(t, e) {
return t.length === e ? t : t.subarray ? t.subarray(0, e) : (t.length = e, t);
};
var s = {
arraySet: function(t, e, a, i, n) {
if (e.subarray && t.subarray) t.set(e.subarray(a, a + i), n); else for (var r = 0; r < i; r++) t[n + r] = e[a + r];
},
flattenChunks: function(t) {
var e, a, i, n, r, s;
for (i = 0, e = 0, a = t.length; e < a; e++) i += t[e].length;
for (s = new Uint8Array(i), n = 0, e = 0, a = t.length; e < a; e++) r = t[e], s.set(r, n),
n += r.length;
return s;
}
}, o = {
arraySet: function(t, e, a, i, n) {
for (var r = 0; r < i; r++) t[n + r] = e[a + r];
},
flattenChunks: function(t) {
return [].concat.apply([], t);
}
};
i.setTyped = function(t) {
t ? (i.Buf8 = Uint8Array, i.Buf16 = Uint16Array, i.Buf32 = Int32Array, i.assign(i, s)) : (i.Buf8 = Array,
i.Buf16 = Array, i.Buf32 = Array, i.assign(i, o));
}, i.setTyped(r);
}, {} ],
4: [ function(t, e, a) {
function i(t, e) {
if (e < 65537 && (t.subarray && s || !t.subarray && r)) return String.fromCharCode.apply(null, n.shrinkBuf(t, e));
for (var a = "", i = 0; i < e; i++) a += String.fromCharCode(t[i]);
return a;
}
var n = t("./common"), r = !0, s = !0;
try {
String.fromCharCode.apply(null, [ 0 ]);
} catch (t) {
r = !1;
}
try {
String.fromCharCode.apply(null, new Uint8Array(1));
} catch (t) {
s = !1;
}
for (var o = new n.Buf8(256), l = 0; l < 256; l++) o[l] = l >= 252 ? 6 : l >= 248 ? 5 : l >= 240 ? 4 : l >= 224 ? 3 : l >= 192 ? 2 : 1;
o[254] = o[254] = 1, a.string2buf = function(t) {
var e, a, i, r, s, o = t.length, l = 0;
for (r = 0; r < o; r++) 55296 == (64512 & (a = t.charCodeAt(r))) && r + 1 < o && 56320 == (64512 & (i = t.charCodeAt(r + 1))) && (a = 65536 + (a - 55296 << 10) + (i - 56320),
r++), l += a < 128 ? 1 : a < 2048 ? 2 : a < 65536 ? 3 : 4;
for (e = new n.Buf8(l), s = 0, r = 0; s < l; r++) 55296 == (64512 & (a = t.charCodeAt(r))) && r + 1 < o && 56320 == (64512 & (i = t.charCodeAt(r + 1))) && (a = 65536 + (a - 55296 << 10) + (i - 56320),
r++), a < 128 ? e[s++] = a : a < 2048 ? (e[s++] = 192 | a >>> 6, e[s++] = 128 | 63 & a) : a < 65536 ? (e[s++] = 224 | a >>> 12,
e[s++] = 128 | a >>> 6 & 63, e[s++] = 128 | 63 & a) : (e[s++] = 240 | a >>> 18,
e[s++] = 128 | a >>> 12 & 63, e[s++] = 128 | a >>> 6 & 63, e[s++] = 128 | 63 & a);
return e;
}, a.buf2binstring = function(t) {
return i(t, t.length);
}, a.binstring2buf = function(t) {
for (var e = new n.Buf8(t.length), a = 0, i = e.length; a < i; a++) e[a] = t.charCodeAt(a);
return e;
}, a.buf2string = function(t, e) {
var a, n, r, s, l = e || t.length, h = new Array(2 * l);
for (n = 0, a = 0; a < l; ) if ((r = t[a++]) < 128) h[n++] = r; else if ((s = o[r]) > 4) h[n++] = 65533,
a += s - 1; else {
for (r &= 2 === s ? 31 : 3 === s ? 15 : 7; s > 1 && a < l; ) r = r << 6 | 63 & t[a++],
s--;
s > 1 ? h[n++] = 65533 : r < 65536 ? h[n++] = r : (r -= 65536, h[n++] = 55296 | r >> 10 & 1023,
h[n++] = 56320 | 1023 & r);
}
return i(h, n);
}, a.utf8border = function(t, e) {
var a;
for ((e = e || t.length) > t.length && (e = t.length), a = e - 1; a >= 0 && 128 == (192 & t[a]); ) a--;
return a < 0 || 0 === a ? e : a + o[t[a]] > e ? a : e;
};
}, {
"./common": 3
} ],
5: [ function(t, e, a) {
e.exports = function(t, e, a, i) {
for (var n = 65535 & t | 0, r = t >>> 16 & 65535 | 0, s = 0; 0 !== a; ) {
a -= s = a > 2e3 ? 2e3 : a;
do {
r = r + (n = n + e[i++] | 0) | 0;
} while (--s);
n %= 65521, r %= 65521;
}
return n | r << 16 | 0;
};
}, {} ],
6: [ function(t, e, a) {
e.exports = {
Z_NO_FLUSH: 0,
Z_PARTIAL_FLUSH: 1,
Z_SYNC_FLUSH: 2,
Z_FULL_FLUSH: 3,
Z_FINISH: 4,
Z_BLOCK: 5,
Z_TREES: 6,
Z_OK: 0,
Z_STREAM_END: 1,
Z_NEED_DICT: 2,
Z_ERRNO: -1,
Z_STREAM_ERROR: -2,
Z_DATA_ERROR: -3,
Z_BUF_ERROR: -5,
Z_NO_COMPRESSION: 0,
Z_BEST_SPEED: 1,
Z_BEST_COMPRESSION: 9,
Z_DEFAULT_COMPRESSION: -1,
Z_FILTERED: 1,
Z_HUFFMAN_ONLY: 2,
Z_RLE: 3,
Z_FIXED: 4,
Z_DEFAULT_STRATEGY: 0,
Z_BINARY: 0,
Z_TEXT: 1,
Z_UNKNOWN: 2,
Z_DEFLATED: 8
};
}, {} ],
7: [ function(t, e, a) {
var i = function() {
for (var t, e = [], a = 0; a < 256; a++) {
t = a;
for (var i = 0; i < 8; i++) t = 1 & t ? 3988292384 ^ t >>> 1 : t >>> 1;
e[a] = t;
}
return e;
}();
e.exports = function(t, e, a, n) {
var r = i, s = n + a;
t ^= -1;
for (var o = n; o < s; o++) t = t >>> 8 ^ r[255 & (t ^ e[o])];
return -1 ^ t;
};
}, {} ],
8: [ function(t, e, a) {
function i(t, e) {
return t.msg = E[e], e;
}
function n(t) {
return (t << 1) - (t > 4 ? 9 : 0);
}
function r(t) {
for (var e = t.length; --e >= 0; ) t[e] = 0;
}
function s(t) {
var e = t.state, a = e.pending;
a > t.avail_out && (a = t.avail_out), 0 !== a && (x.arraySet(t.output, e.pending_buf, e.pending_out, a, t.next_out),
t.next_out += a, e.pending_out += a, t.total_out += a, t.avail_out -= a, e.pending -= a,
0 === e.pending && (e.pending_out = 0));
}
function o(t, e) {
z._tr_flush_block(t, t.block_start >= 0 ? t.block_start : -1, t.strstart - t.block_start, e),
t.block_start = t.strstart, s(t.strm);
}
function l(t, e) {
t.pending_buf[t.pending++] = e;
}
function h(t, e) {
t.pending_buf[t.pending++] = e >>> 8 & 255, t.pending_buf[t.pending++] = 255 & e;
}
function d(t, e, a, i) {
var n = t.avail_in;
return n > i && (n = i), 0 === n ? 0 : (t.avail_in -= n, x.arraySet(e, t.input, t.next_in, n, a),
1 === t.state.wrap ? t.adler = B(t.adler, e, n, a) : 2 === t.state.wrap && (t.adler = S(t.adler, e, n, a)),
t.next_in += n, t.total_in += n, n);
}
function f(t, e) {
var a, i, n = t.max_chain_length, r = t.strstart, s = t.prev_length, o = t.nice_match, l = t.strstart > t.w_size - P ? t.strstart - (t.w_size - P) : 0, h = t.window, d = t.w_mask, f = t.prev, _ = t.strstart + q, u = h[r + s - 1], c = h[r + s];
t.prev_length >= t.good_match && (n >>= 2), o > t.lookahead && (o = t.lookahead);
do {
if (h[(a = e) + s] === c && h[a + s - 1] === u && h[a] === h[r] && h[++a] === h[r + 1]) {
r += 2, a++;
do {} while (h[++r] === h[++a] && h[++r] === h[++a] && h[++r] === h[++a] && h[++r] === h[++a] && h[++r] === h[++a] && h[++r] === h[++a] && h[++r] === h[++a] && h[++r] === h[++a] && r < _);
if (i = q - (_ - r), r = _ - q, i > s) {
if (t.match_start = e, s = i, i >= o) break;
u = h[r + s - 1], c = h[r + s];
}
}
} while ((e = f[e & d]) > l && 0 != --n);
return s <= t.lookahead ? s : t.lookahead;
}
function _(t) {
var e, a, i, n, r, s = t.w_size;
do {
if (n = t.window_size - t.lookahead - t.strstart, t.strstart >= s + (s - P)) {
x.arraySet(t.window, t.window, s, s, 0), t.match_start -= s, t.strstart -= s, t.block_start -= s,
e = a = t.hash_size;
do {
i = t.head[--e], t.head[e] = i >= s ? i - s : 0;
} while (--a);
e = a = s;
do {
i = t.prev[--e], t.prev[e] = i >= s ? i - s : 0;
} while (--a);
n += s;
}
if (0 === t.strm.avail_in) break;
if (a = d(t.strm, t.window, t.strstart + t.lookahead, n), t.lookahead += a, t.lookahead + t.insert >= M) for (r = t.strstart - t.insert,
t.ins_h = t.window[r], t.ins_h = (t.ins_h << t.hash_shift ^ t.window[r + 1]) & t.hash_mask; t.insert && (t.ins_h = (t.ins_h << t.hash_shift ^ t.window[r + M - 1]) & t.hash_mask,
t.prev[r & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = r, r++, t.insert--, !(t.lookahead + t.insert < M)); ) ;
} while (t.lookahead < P && 0 !== t.strm.avail_in);
}
function u(t, e) {
for (var a, i; ;) {
if (t.lookahead < P) {
if (_(t), t.lookahead < P && e === A) return X;
if (0 === t.lookahead) break;
}
if (a = 0, t.lookahead >= M && (t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + M - 1]) & t.hash_mask,
a = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart),
0 !== a && t.strstart - a <= t.w_size - P && (t.match_length = f(t, a)), t.match_length >= M) if (i = z._tr_tally(t, t.strstart - t.match_start, t.match_length - M),
t.lookahead -= t.match_length, t.match_length <= t.max_lazy_match && t.lookahead >= M) {
t.match_length--;
do {
t.strstart++, t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + M - 1]) & t.hash_mask,
a = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart;
} while (0 != --t.match_length);
t.strstart++;
} else t.strstart += t.match_length, t.match_length = 0, t.ins_h = t.window[t.strstart],
t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + 1]) & t.hash_mask; else i = z._tr_tally(t, 0, t.window[t.strstart]),
t.lookahead--, t.strstart++;
if (i && (o(t, !1), 0 === t.strm.avail_out)) return X;
}
return t.insert = t.strstart < M - 1 ? t.strstart : M - 1, e === Z ? (o(t, !0),
0 === t.strm.avail_out ? J : Q) : t.last_lit && (o(t, !1), 0 === t.strm.avail_out) ? X : W;
}
function c(t, e) {
for (var a, i, n; ;) {
if (t.lookahead < P) {
if (_(t), t.lookahead < P && e === A) return X;
if (0 === t.lookahead) break;
}
if (a = 0, t.lookahead >= M && (t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + M - 1]) & t.hash_mask,
a = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart),
t.prev_length = t.match_length, t.prev_match = t.match_start, t.match_length = M - 1,
0 !== a && t.prev_length < t.max_lazy_match && t.strstart - a <= t.w_size - P && (t.match_length = f(t, a),
t.match_length <= 5 && (t.strategy === O || t.match_length === M && t.strstart - t.match_start > 4096) && (t.match_length = M - 1)),
t.prev_length >= M && t.match_length <= t.prev_length) {
n = t.strstart + t.lookahead - M, i = z._tr_tally(t, t.strstart - 1 - t.prev_match, t.prev_length - M),
t.lookahead -= t.prev_length - 1, t.prev_length -= 2;
do {
++t.strstart <= n && (t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + M - 1]) & t.hash_mask,
a = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart);
} while (0 != --t.prev_length);
if (t.match_available = 0, t.match_length = M - 1, t.strstart++, i && (o(t, !1),
0 === t.strm.avail_out)) return X;
} else if (t.match_available) {
if ((i = z._tr_tally(t, 0, t.window[t.strstart - 1])) && o(t, !1), t.strstart++,
t.lookahead--, 0 === t.strm.avail_out) return X;
} else t.match_available = 1, t.strstart++, t.lookahead--;
}
return t.match_available && (i = z._tr_tally(t, 0, t.window[t.strstart - 1]), t.match_available = 0),
t.insert = t.strstart < M - 1 ? t.strstart : M - 1, e === Z ? (o(t, !0), 0 === t.strm.avail_out ? J : Q) : t.last_lit && (o(t, !1),
0 === t.strm.avail_out) ? X : W;
}
function b(t, e) {
for (var a, i, n, r, s = t.window; ;) {
if (t.lookahead <= q) {
if (_(t), t.lookahead <= q && e === A) return X;
if (0 === t.lookahead) break;
}
if (t.match_length = 0, t.lookahead >= M && t.strstart > 0 && ((i = s[n = t.strstart - 1]) === s[++n] && i === s[++n] && i === s[++n])) {
r = t.strstart + q;
do {} while (i === s[++n] && i === s[++n] && i === s[++n] && i === s[++n] && i === s[++n] && i === s[++n] && i === s[++n] && i === s[++n] && n < r);
t.match_length = q - (r - n), t.match_length > t.lookahead && (t.match_length = t.lookahead);
}
if (t.match_length >= M ? (a = z._tr_tally(t, 1, t.match_length - M), t.lookahead -= t.match_length,
t.strstart += t.match_length, t.match_length = 0) : (a = z._tr_tally(t, 0, t.window[t.strstart]),
t.lookahead--, t.strstart++), a && (o(t, !1), 0 === t.strm.avail_out)) return X;
}
return t.insert = 0, e === Z ? (o(t, !0), 0 === t.strm.avail_out ? J : Q) : t.last_lit && (o(t, !1),
0 === t.strm.avail_out) ? X : W;
}
function g(t, e) {
for (var a; ;) {
if (0 === t.lookahead && (_(t), 0 === t.lookahead)) {
if (e === A) return X;
break;
}
if (t.match_length = 0, a = z._tr_tally(t, 0, t.window[t.strstart]), t.lookahead--,
t.strstart++, a && (o(t, !1), 0 === t.strm.avail_out)) return X;
}
return t.insert = 0, e === Z ? (o(t, !0), 0 === t.strm.avail_out ? J : Q) : t.last_lit && (o(t, !1),
0 === t.strm.avail_out) ? X : W;
}
function m(t, e, a, i, n) {
this.good_length = t, this.max_lazy = e, this.nice_length = a, this.max_chain = i,
this.func = n;
}
function w() {
this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0,
this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0,
this.method = U, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0,
this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0,
this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0,
this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0,
this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0,
this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0,
this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new x.Buf16(2 * j), this.dyn_dtree = new x.Buf16(2 * (2 * L + 1)),
this.bl_tree = new x.Buf16(2 * (2 * H + 1)), r(this.dyn_ltree), r(this.dyn_dtree),
r(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new x.Buf16(K + 1),
this.heap = new x.Buf16(2 * F + 1), r(this.heap), this.heap_len = 0, this.heap_max = 0,
this.depth = new x.Buf16(2 * F + 1), r(this.depth), this.l_buf = 0, this.lit_bufsize = 0,
this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0,
this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;
}
function p(t) {
var e;
return t && t.state ? (t.total_in = t.total_out = 0, t.data_type = I, (e = t.state).pending = 0,
e.pending_out = 0, e.wrap < 0 && (e.wrap = -e.wrap), e.status = e.wrap ? Y : G,
t.adler = 2 === e.wrap ? 0 : 1, e.last_flush = A, z._tr_init(e), R) : i(t, C);
}
function v(t) {
var e = p(t);
return e === R && function(t) {
t.window_size = 2 * t.w_size, r(t.head), t.max_lazy_match = y[t.level].max_lazy,
t.good_match = y[t.level].good_length, t.nice_match = y[t.level].nice_length, t.max_chain_length = y[t.level].max_chain,
t.strstart = 0, t.block_start = 0, t.lookahead = 0, t.insert = 0, t.match_length = t.prev_length = M - 1,
t.match_available = 0, t.ins_h = 0;
}(t.state), e;
}
function k(t, e, a, n, r, s) {
if (!t) return C;
var o = 1;
if (e === N && (e = 6), n < 0 ? (o = 0, n = -n) : n > 15 && (o = 2, n -= 16), r < 1 || r > T || a !== U || n < 8 || n > 15 || e < 0 || e > 9 || s < 0 || s > D) return i(t, C);
8 === n && (n = 9);
var l = new w();
return t.state = l, l.strm = t, l.wrap = o, l.gzhead = null, l.w_bits = n, l.w_size = 1 << l.w_bits,
l.w_mask = l.w_size - 1, l.hash_bits = r + 7, l.hash_size = 1 << l.hash_bits, l.hash_mask = l.hash_size - 1,
l.hash_shift = ~~((l.hash_bits + M - 1) / M), l.window = new x.Buf8(2 * l.w_size),
l.head = new x.Buf16(l.hash_size), l.prev = new x.Buf16(l.w_size), l.lit_bufsize = 1 << r + 6,
l.pending_buf_size = 4 * l.lit_bufsize, l.pending_buf = new x.Buf8(l.pending_buf_size),
l.d_buf = 1 * l.lit_bufsize, l.l_buf = 3 * l.lit_bufsize, l.level = e, l.strategy = s,
l.method = a, v(t);
}
var y, x = t("../utils/common"), z = t("./trees"), B = t("./adler32"), S = t("./crc32"), E = t("./messages"), A = 0, Z = 4, R = 0, C = -2, N = -1, O = 1, D = 4, I = 2, U = 8, T = 9, F = 286, L = 30, H = 19, j = 2 * F + 1, K = 15, M = 3, q = 258, P = q + M + 1, Y = 42, G = 113, X = 1, W = 2, J = 3, Q = 4;
y = [ new m(0, 0, 0, 0, function(t, e) {
var a = 65535;
for (a > t.pending_buf_size - 5 && (a = t.pending_buf_size - 5); ;) {
if (t.lookahead <= 1) {
if (_(t), 0 === t.lookahead && e === A) return X;
if (0 === t.lookahead) break;
}
t.strstart += t.lookahead, t.lookahead = 0;
var i = t.block_start + a;
if ((0 === t.strstart || t.strstart >= i) && (t.lookahead = t.strstart - i, t.strstart = i,
o(t, !1), 0 === t.strm.avail_out)) return X;
if (t.strstart - t.block_start >= t.w_size - P && (o(t, !1), 0 === t.strm.avail_out)) return X;
}
return t.insert = 0, e === Z ? (o(t, !0), 0 === t.strm.avail_out ? J : Q) : (t.strstart > t.block_start && (o(t, !1),
t.strm.avail_out), X);
}), new m(4, 4, 8, 4, u), new m(4, 5, 16, 8, u), new m(4, 6, 32, 32, u), new m(4, 4, 16, 16, c), new m(8, 16, 32, 32, c), new m(8, 16, 128, 128, c), new m(8, 32, 128, 256, c), new m(32, 128, 258, 1024, c), new m(32, 258, 258, 4096, c) ],
a.deflateInit = function(t, e) {
return k(t, e, U, 15, 8, 0);
}, a.deflateInit2 = k, a.deflateReset = v, a.deflateResetKeep = p, a.deflateSetHeader = function(t, e) {
return t && t.state ? 2 !== t.state.wrap ? C : (t.state.gzhead = e, R) : C;
}, a.deflate = function(t, e) {
var a, o, d, f;
if (!t || !t.state || e > 5 || e < 0) return t ? i(t, C) : C;
if (o = t.state, !t.output || !t.input && 0 !== t.avail_in || 666 === o.status && e !== Z) return i(t, 0 === t.avail_out ? -5 : C);
if (o.strm = t, a = o.last_flush, o.last_flush = e, o.status === Y) if (2 === o.wrap) t.adler = 0,
l(o, 31), l(o, 139), l(o, 8), o.gzhead ? (l(o, (o.gzhead.text ? 1 : 0) + (o.gzhead.hcrc ? 2 : 0) + (o.gzhead.extra ? 4 : 0) + (o.gzhead.name ? 8 : 0) + (o.gzhead.comment ? 16 : 0)),
l(o, 255 & o.gzhead.time), l(o, o.gzhead.time >> 8 & 255), l(o, o.gzhead.time >> 16 & 255),
l(o, o.gzhead.time >> 24 & 255), l(o, 9 === o.level ? 2 : o.strategy >= 2 || o.level < 2 ? 4 : 0),
l(o, 255 & o.gzhead.os), o.gzhead.extra && o.gzhead.extra.length && (l(o, 255 & o.gzhead.extra.length),
l(o, o.gzhead.extra.length >> 8 & 255)), o.gzhead.hcrc && (t.adler = S(t.adler, o.pending_buf, o.pending, 0)),
o.gzindex = 0, o.status = 69) : (l(o, 0), l(o, 0), l(o, 0), l(o, 0), l(o, 0), l(o, 9 === o.level ? 2 : o.strategy >= 2 || o.level < 2 ? 4 : 0),
l(o, 3), o.status = G); else {
var _ = U + (o.w_bits - 8 << 4) << 8;
_ |= (o.strategy >= 2 || o.level < 2 ? 0 : o.level < 6 ? 1 : 6 === o.level ? 2 : 3) << 6,
0 !== o.strstart && (_ |= 32), _ += 31 - _ % 31, o.status = G, h(o, _), 0 !== o.strstart && (h(o, t.adler >>> 16),
h(o, 65535 & t.adler)), t.adler = 1;
}
if (69 === o.status) if (o.gzhead.extra) {
for (d = o.pending; o.gzindex < (65535 & o.gzhead.extra.length) && (o.pending !== o.pending_buf_size || (o.gzhead.hcrc && o.pending > d && (t.adler = S(t.adler, o.pending_buf, o.pending - d, d)),
s(t), d = o.pending, o.pending !== o.pending_buf_size)); ) l(o, 255 & o.gzhead.extra[o.gzindex]),
o.gzindex++;
o.gzhead.hcrc && o.pending > d && (t.adler = S(t.adler, o.pending_buf, o.pending - d, d)),
o.gzindex === o.gzhead.extra.length && (o.gzindex = 0, o.status = 73);
} else o.status = 73;
if (73 === o.status) if (o.gzhead.name) {
d = o.pending;
do {
if (o.pending === o.pending_buf_size && (o.gzhead.hcrc && o.pending > d && (t.adler = S(t.adler, o.pending_buf, o.pending - d, d)),
s(t), d = o.pending, o.pending === o.pending_buf_size)) {
f = 1;
break;
}
f = o.gzindex < o.gzhead.name.length ? 255 & o.gzhead.name.charCodeAt(o.gzindex++) : 0,
l(o, f);
} while (0 !== f);
o.gzhead.hcrc && o.pending > d && (t.adler = S(t.adler, o.pending_buf, o.pending - d, d)),
0 === f && (o.gzindex = 0, o.status = 91);
} else o.status = 91;
if (91 === o.status) if (o.gzhead.comment) {
d = o.pending;
do {
if (o.pending === o.pending_buf_size && (o.gzhead.hcrc && o.pending > d && (t.adler = S(t.adler, o.pending_buf, o.pending - d, d)),
s(t), d = o.pending, o.pending === o.pending_buf_size)) {
f = 1;
break;
}
f = o.gzindex < o.gzhead.comment.length ? 255 & o.gzhead.comment.charCodeAt(o.gzindex++) : 0,
l(o, f);
} while (0 !== f);
o.gzhead.hcrc && o.pending > d && (t.adler = S(t.adler, o.pending_buf, o.pending - d, d)),
0 === f && (o.status = 103);
} else o.status = 103;
if (103 === o.status && (o.gzhead.hcrc ? (o.pending + 2 > o.pending_buf_size && s(t),
o.pending + 2 <= o.pending_buf_size && (l(o, 255 & t.adler), l(o, t.adler >> 8 & 255),
t.adler = 0, o.status = G)) : o.status = G), 0 !== o.pending) {
if (s(t), 0 === t.avail_out) return o.last_flush = -1, R;
} else if (0 === t.avail_in && n(e) <= n(a) && e !== Z) return i(t, -5);
if (666 === o.status && 0 !== t.avail_in) return i(t, -5);
if (0 !== t.avail_in || 0 !== o.lookahead || e !== A && 666 !== o.status) {
var u = 2 === o.strategy ? g(o, e) : 3 === o.strategy ? b(o, e) : y[o.level].func(o, e);
if (u !== J && u !== Q || (o.status = 666), u === X || u === J) return 0 === t.avail_out && (o.last_flush = -1),
R;
if (u === W && (1 === e ? z._tr_align(o) : 5 !== e && (z._tr_stored_block(o, 0, 0, !1),
3 === e && (r(o.head), 0 === o.lookahead && (o.strstart = 0, o.block_start = 0,
o.insert = 0))), s(t), 0 === t.avail_out)) return o.last_flush = -1, R;
}
return e !== Z ? R : o.wrap <= 0 ? 1 : (2 === o.wrap ? (l(o, 255 & t.adler), l(o, t.adler >> 8 & 255),
l(o, t.adler >> 16 & 255), l(o, t.adler >> 24 & 255), l(o, 255 & t.total_in), l(o, t.total_in >> 8 & 255),
l(o, t.total_in >> 16 & 255), l(o, t.total_in >> 24 & 255)) : (h(o, t.adler >>> 16),
h(o, 65535 & t.adler)), s(t), o.wrap > 0 && (o.wrap = -o.wrap), 0 !== o.pending ? R : 1);
}, a.deflateEnd = function(t) {
var e;
return t && t.state ? (e = t.state.status) !== Y && 69 !== e && 73 !== e && 91 !== e && 103 !== e && e !== G && 666 !== e ? i(t, C) : (t.state = null,
e === G ? i(t, -3) : R) : C;
}, a.deflateSetDictionary = function(t, e) {
var a, i, n, s, o, l, h, d, f = e.length;
if (!t || !t.state) return C;
if (2 === (s = (a = t.state).wrap) || 1 === s && a.status !== Y || a.lookahead) return C;
for (1 === s && (t.adler = B(t.adler, e, f, 0)), a.wrap = 0, f >= a.w_size && (0 === s && (r(a.head),
a.strstart = 0, a.block_start = 0, a.insert = 0), d = new x.Buf8(a.w_size), x.arraySet(d, e, f - a.w_size, a.w_size, 0),
e = d, f = a.w_size), o = t.avail_in, l = t.next_in, h = t.input, t.avail_in = f,
t.next_in = 0, t.input = e, _(a); a.lookahead >= M; ) {
i = a.strstart, n = a.lookahead - (M - 1);
do {
a.ins_h = (a.ins_h << a.hash_shift ^ a.window[i + M - 1]) & a.hash_mask, a.prev[i & a.w_mask] = a.head[a.ins_h],
a.head[a.ins_h] = i, i++;
} while (--n);
a.strstart = i, a.lookahead = M - 1, _(a);
}
return a.strstart += a.lookahead, a.block_start = a.strstart, a.insert = a.lookahead,
a.lookahead = 0, a.match_length = a.prev_length = M - 1, a.match_available = 0,
t.next_in = l, t.input = h, t.avail_in = o, a.wrap = s, R;
}, a.deflateInfo = "pako deflate (from Nodeca project)";
}, {
"../utils/common": 3,
"./adler32": 5,
"./crc32": 7,
"./messages": 13,
"./trees": 14
} ],
9: [ function(t, e, a) {
e.exports = function() {
this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0,
this.name = "", this.comment = "", this.hcrc = 0, this.done = !1;
};
}, {} ],
10: [ function(t, e, a) {
e.exports = function(t, e) {
var a, i, n, r, s, o, l, h, d, f, _, u, c, b, g, m, w, p, v, k, y, x, z, B, S;
a = t.state, i = t.next_in, B = t.input, n = i + (t.avail_in - 5), r = t.next_out,
S = t.output, s = r - (e - t.avail_out), o = r + (t.avail_out - 257), l = a.dmax,
h = a.wsize, d = a.whave, f = a.wnext, _ = a.window, u = a.hold, c = a.bits, b = a.lencode,
g = a.distcode, m = (1 << a.lenbits) - 1, w = (1 << a.distbits) - 1;
t: do {
c < 15 && (u += B[i++] << c, c += 8, u += B[i++] << c, c += 8), p = b[u & m];
e: for (;;) {
if (u >>>= v = p >>> 24, c -= v, 0 == (v = p >>> 16 & 255)) S[r++] = 65535 & p; else {
if (!(16 & v)) {
if (0 == (64 & v)) {
p = b[(65535 & p) + (u & (1 << v) - 1)];
continue e;
}
if (32 & v) {
a.mode = 12;
break t;
}
t.msg = "invalid literal/length code", a.mode = 30;
break t;
}
k = 65535 & p, (v &= 15) && (c < v && (u += B[i++] << c, c += 8), k += u & (1 << v) - 1,
u >>>= v, c -= v), c < 15 && (u += B[i++] << c, c += 8, u += B[i++] << c, c += 8),
p = g[u & w];
a: for (;;) {
if (u >>>= v = p >>> 24, c -= v, !(16 & (v = p >>> 16 & 255))) {
if (0 == (64 & v)) {
p = g[(65535 & p) + (u & (1 << v) - 1)];
continue a;
}
t.msg = "invalid distance code", a.mode = 30;
break t;
}
if (y = 65535 & p, c < (v &= 15) && (u += B[i++] << c, (c += 8) < v && (u += B[i++] << c,
c += 8)), (y += u & (1 << v) - 1) > l) {
t.msg = "invalid distance too far back", a.mode = 30;
break t;
}
if (u >>>= v, c -= v, y > (v = r - s)) {
if ((v = y - v) > d && a.sane) {
t.msg = "invalid distance too far back", a.mode = 30;
break t;
}
if (x = 0, z = _, 0 === f) {
if (x += h - v, v < k) {
k -= v;
do {
S[r++] = _[x++];
} while (--v);
x = r - y, z = S;
}
} else if (f < v) {
if (x += h + f - v, (v -= f) < k) {
k -= v;
do {
S[r++] = _[x++];
} while (--v);
if (x = 0, f < k) {
k -= v = f;
do {
S[r++] = _[x++];
} while (--v);
x = r - y, z = S;
}
}
} else if (x += f - v, v < k) {
k -= v;
do {
S[r++] = _[x++];
} while (--v);
x = r - y, z = S;
}
for (;k > 2; ) S[r++] = z[x++], S[r++] = z[x++], S[r++] = z[x++], k -= 3;
k && (S[r++] = z[x++], k > 1 && (S[r++] = z[x++]));
} else {
x = r - y;
do {
S[r++] = S[x++], S[r++] = S[x++], S[r++] = S[x++], k -= 3;
} while (k > 2);
k && (S[r++] = S[x++], k > 1 && (S[r++] = S[x++]));
}
break;
}
}
break;
}
} while (i < n && r < o);
i -= k = c >> 3, u &= (1 << (c -= k << 3)) - 1, t.next_in = i, t.next_out = r, t.avail_in = i < n ? n - i + 5 : 5 - (i - n),
t.avail_out = r < o ? o - r + 257 : 257 - (r - o), a.hold = u, a.bits = c;
};
}, {} ],
11: [ function(t, e, a) {
function i(t) {
return (t >>> 24 & 255) + (t >>> 8 & 65280) + ((65280 & t) << 8) + ((255 & t) << 24);
}
function n() {
this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0,
this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0,
this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0,
this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null,
this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0,
this.ndist = 0, this.have = 0, this.next = null, this.lens = new u.Buf16(320), this.work = new u.Buf16(288),
this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
}
function r(t) {
var e;
return t && t.state ? (e = t.state, t.total_in = t.total_out = e.total = 0, t.msg = "",
e.wrap && (t.adler = 1 & e.wrap), e.mode = y, e.last = 0, e.havedict = 0, e.dmax = 32768,
e.head = null, e.hold = 0, e.bits = 0, e.lencode = e.lendyn = new u.Buf32(z), e.distcode = e.distdyn = new u.Buf32(B),
e.sane = 1, e.back = -1, v) : k;
}
function s(t) {
var e;
return t && t.state ? ((e = t.state).wsize = 0, e.whave = 0, e.wnext = 0, r(t)) : k;
}
function o(t, e) {
var a, i;
return t && t.state ? (i = t.state, e < 0 ? (a = 0, e = -e) : (a = 1 + (e >> 4),
e < 48 && (e &= 15)), e && (e < 8 || e > 15) ? k : (null !== i.window && i.wbits !== e && (i.window = null),
i.wrap = a, i.wbits = e, s(t))) : k;
}
function l(t, e) {
var a, i;
return t ? (i = new n(), t.state = i, i.window = null, (a = o(t, e)) !== v && (t.state = null),
a) : k;
}
function h(t) {
if (S) {
var e;
for (f = new u.Buf32(512), _ = new u.Buf32(32), e = 0; e < 144; ) t.lens[e++] = 8;
for (;e < 256; ) t.lens[e++] = 9;
for (;e < 280; ) t.lens[e++] = 7;
for (;e < 288; ) t.lens[e++] = 8;
for (m(w, t.lens, 0, 288, f, 0, t.work, {
bits: 9
}), e = 0; e < 32; ) t.lens[e++] = 5;
m(p, t.lens, 0, 32, _, 0, t.work, {
bits: 5
}), S = !1;
}
t.lencode = f, t.lenbits = 9, t.distcode = _, t.distbits = 5;
}
function d(t, e, a, i) {
var n, r = t.state;
return null === r.window && (r.wsize = 1 << r.wbits, r.wnext = 0, r.whave = 0, r.window = new u.Buf8(r.wsize)),
i >= r.wsize ? (u.arraySet(r.window, e, a - r.wsize, r.wsize, 0), r.wnext = 0, r.whave = r.wsize) : ((n = r.wsize - r.wnext) > i && (n = i),
u.arraySet(r.window, e, a - i, n, r.wnext), (i -= n) ? (u.arraySet(r.window, e, a - i, i, 0),
r.wnext = i, r.whave = r.wsize) : (r.wnext += n, r.wnext === r.wsize && (r.wnext = 0),
r.whave < r.wsize && (r.whave += n))), 0;
}
var f, _, u = t("../utils/common"), c = t("./adler32"), b = t("./crc32"), g = t("./inffast"), m = t("./inftrees"), w = 1, p = 2, v = 0, k = -2, y = 1, x = 12, z = 852, B = 592, S = !0;
a.inflateReset = s, a.inflateReset2 = o, a.inflateResetKeep = r, a.inflateInit = function(t) {
return l(t, 15);
}, a.inflateInit2 = l, a.inflate = function(t, e) {
var a, n, r, s, o, l, f, _, z, B, S, E, A, Z, R, C, N, O, D, I, U, T, F, L, H = 0, j = new u.Buf8(4), K = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];
if (!t || !t.state || !t.output || !t.input && 0 !== t.avail_in) return k;
(a = t.state).mode === x && (a.mode = 13), o = t.next_out, r = t.output, f = t.avail_out,
s = t.next_in, n = t.input, l = t.avail_in, _ = a.hold, z = a.bits, B = l, S = f,
T = v;
t: for (;;) switch (a.mode) {
case y:
if (0 === a.wrap) {
a.mode = 13;
break;
}
for (;z < 16; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
if (2 & a.wrap && 35615 === _) {
a.check = 0, j[0] = 255 & _, j[1] = _ >>> 8 & 255, a.check = b(a.check, j, 2, 0),
_ = 0, z = 0, a.mode = 2;
break;
}
if (a.flags = 0, a.head && (a.head.done = !1), !(1 & a.wrap) || (((255 & _) << 8) + (_ >> 8)) % 31) {
t.msg = "incorrect header check", a.mode = 30;
break;
}
if (8 != (15 & _)) {
t.msg = "unknown compression method", a.mode = 30;
break;
}
if (z -= 4, U = 8 + (15 & (_ >>>= 4)), 0 === a.wbits) a.wbits = U; else if (U > a.wbits) {
t.msg = "invalid window size", a.mode = 30;
break;
}
a.dmax = 1 << U, t.adler = a.check = 1, a.mode = 512 & _ ? 10 : x, _ = 0, z = 0;
break;
case 2:
for (;z < 16; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
if (a.flags = _, 8 != (255 & a.flags)) {
t.msg = "unknown compression method", a.mode = 30;
break;
}
if (57344 & a.flags) {
t.msg = "unknown header flags set", a.mode = 30;
break;
}
a.head && (a.head.text = _ >> 8 & 1), 512 & a.flags && (j[0] = 255 & _, j[1] = _ >>> 8 & 255,
a.check = b(a.check, j, 2, 0)), _ = 0, z = 0, a.mode = 3;
case 3:
for (;z < 32; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
a.head && (a.head.time = _), 512 & a.flags && (j[0] = 255 & _, j[1] = _ >>> 8 & 255,
j[2] = _ >>> 16 & 255, j[3] = _ >>> 24 & 255, a.check = b(a.check, j, 4, 0)), _ = 0,
z = 0, a.mode = 4;
case 4:
for (;z < 16; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
a.head && (a.head.xflags = 255 & _, a.head.os = _ >> 8), 512 & a.flags && (j[0] = 255 & _,
j[1] = _ >>> 8 & 255, a.check = b(a.check, j, 2, 0)), _ = 0, z = 0, a.mode = 5;
case 5:
if (1024 & a.flags) {
for (;z < 16; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
a.length = _, a.head && (a.head.extra_len = _), 512 & a.flags && (j[0] = 255 & _,
j[1] = _ >>> 8 & 255, a.check = b(a.check, j, 2, 0)), _ = 0, z = 0;
} else a.head && (a.head.extra = null);
a.mode = 6;
case 6:
if (1024 & a.flags && ((E = a.length) > l && (E = l), E && (a.head && (U = a.head.extra_len - a.length,
a.head.extra || (a.head.extra = new Array(a.head.extra_len)), u.arraySet(a.head.extra, n, s, E, U)),
512 & a.flags && (a.check = b(a.check, n, E, s)), l -= E, s += E, a.length -= E),
a.length)) break t;
a.length = 0, a.mode = 7;
case 7:
if (2048 & a.flags) {
if (0 === l) break t;
E = 0;
do {
U = n[s + E++], a.head && U && a.length < 65536 && (a.head.name += String.fromCharCode(U));
} while (U && E < l);
if (512 & a.flags && (a.check = b(a.check, n, E, s)), l -= E, s += E, U) break t;
} else a.head && (a.head.name = null);
a.length = 0, a.mode = 8;
case 8:
if (4096 & a.flags) {
if (0 === l) break t;
E = 0;
do {
U = n[s + E++], a.head && U && a.length < 65536 && (a.head.comment += String.fromCharCode(U));
} while (U && E < l);
if (512 & a.flags && (a.check = b(a.check, n, E, s)), l -= E, s += E, U) break t;
} else a.head && (a.head.comment = null);
a.mode = 9;
case 9:
if (512 & a.flags) {
for (;z < 16; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
if (_ !== (65535 & a.check)) {
t.msg = "header crc mismatch", a.mode = 30;
break;
}
_ = 0, z = 0;
}
a.head && (a.head.hcrc = a.flags >> 9 & 1, a.head.done = !0), t.adler = a.check = 0,
a.mode = x;
break;
case 10:
for (;z < 32; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
t.adler = a.check = i(_), _ = 0, z = 0, a.mode = 11;
case 11:
if (0 === a.havedict) return t.next_out = o, t.avail_out = f, t.next_in = s, t.avail_in = l,
a.hold = _, a.bits = z, 2;
t.adler = a.check = 1, a.mode = x;
case x:
if (5 === e || 6 === e) break t;
case 13:
if (a.last) {
_ >>>= 7 & z, z -= 7 & z, a.mode = 27;
break;
}
for (;z < 3; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
switch (a.last = 1 & _, z -= 1, 3 & (_ >>>= 1)) {
case 0:
a.mode = 14;
break;
case 1:
if (h(a), a.mode = 20, 6 === e) {
_ >>>= 2, z -= 2;
break t;
}
break;
case 2:
a.mode = 17;
break;
case 3:
t.msg = "invalid block type", a.mode = 30;
}
_ >>>= 2, z -= 2;
break;
case 14:
for (_ >>>= 7 & z, z -= 7 & z; z < 32; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
if ((65535 & _) != (_ >>> 16 ^ 65535)) {
t.msg = "invalid stored block lengths", a.mode = 30;
break;
}
if (a.length = 65535 & _, _ = 0, z = 0, a.mode = 15, 6 === e) break t;
case 15:
a.mode = 16;
case 16:
if (E = a.length) {
if (E > l && (E = l), E > f && (E = f), 0 === E) break t;
u.arraySet(r, n, s, E, o), l -= E, s += E, f -= E, o += E, a.length -= E;
break;
}
a.mode = x;
break;
case 17:
for (;z < 14; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
if (a.nlen = 257 + (31 & _), _ >>>= 5, z -= 5, a.ndist = 1 + (31 & _), _ >>>= 5,
z -= 5, a.ncode = 4 + (15 & _), _ >>>= 4, z -= 4, a.nlen > 286 || a.ndist > 30) {
t.msg = "too many length or distance symbols", a.mode = 30;
break;
}
a.have = 0, a.mode = 18;
case 18:
for (;a.have < a.ncode; ) {
for (;z < 3; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
a.lens[K[a.have++]] = 7 & _, _ >>>= 3, z -= 3;
}
for (;a.have < 19; ) a.lens[K[a.have++]] = 0;
if (a.lencode = a.lendyn, a.lenbits = 7, F = {
bits: a.lenbits
}, T = m(0, a.lens, 0, 19, a.lencode, 0, a.work, F), a.lenbits = F.bits, T) {
t.msg = "invalid code lengths set", a.mode = 30;
break;
}
a.have = 0, a.mode = 19;
case 19:
for (;a.have < a.nlen + a.ndist; ) {
for (;C = (H = a.lencode[_ & (1 << a.lenbits) - 1]) >>> 16 & 255, N = 65535 & H,
!((R = H >>> 24) <= z); ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
if (N < 16) _ >>>= R, z -= R, a.lens[a.have++] = N; else {
if (16 === N) {
for (L = R + 2; z < L; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
if (_ >>>= R, z -= R, 0 === a.have) {
t.msg = "invalid bit length repeat", a.mode = 30;
break;
}
U = a.lens[a.have - 1], E = 3 + (3 & _), _ >>>= 2, z -= 2;
} else if (17 === N) {
for (L = R + 3; z < L; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
z -= R, U = 0, E = 3 + (7 & (_ >>>= R)), _ >>>= 3, z -= 3;
} else {
for (L = R + 7; z < L; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
z -= R, U = 0, E = 11 + (127 & (_ >>>= R)), _ >>>= 7, z -= 7;
}
if (a.have + E > a.nlen + a.ndist) {
t.msg = "invalid bit length repeat", a.mode = 30;
break;
}
for (;E--; ) a.lens[a.have++] = U;
}
}
if (30 === a.mode) break;
if (0 === a.lens[256]) {
t.msg = "invalid code -- missing end-of-block", a.mode = 30;
break;
}
if (a.lenbits = 9, F = {
bits: a.lenbits
}, T = m(w, a.lens, 0, a.nlen, a.lencode, 0, a.work, F), a.lenbits = F.bits, T) {
t.msg = "invalid literal/lengths set", a.mode = 30;
break;
}
if (a.distbits = 6, a.distcode = a.distdyn, F = {
bits: a.distbits
}, T = m(p, a.lens, a.nlen, a.ndist, a.distcode, 0, a.work, F), a.distbits = F.bits,
T) {
t.msg = "invalid distances set", a.mode = 30;
break;
}
if (a.mode = 20, 6 === e) break t;
case 20:
a.mode = 21;
case 21:
if (l >= 6 && f >= 258) {
t.next_out = o, t.avail_out = f, t.next_in = s, t.avail_in = l, a.hold = _, a.bits = z,
g(t, S), o = t.next_out, r = t.output, f = t.avail_out, s = t.next_in, n = t.input,
l = t.avail_in, _ = a.hold, z = a.bits, a.mode === x && (a.back = -1);
break;
}
for (a.back = 0; C = (H = a.lencode[_ & (1 << a.lenbits) - 1]) >>> 16 & 255, N = 65535 & H,
!((R = H >>> 24) <= z); ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
if (C && 0 == (240 & C)) {
for (O = R, D = C, I = N; C = (H = a.lencode[I + ((_ & (1 << O + D) - 1) >> O)]) >>> 16 & 255,
N = 65535 & H, !(O + (R = H >>> 24) <= z); ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
_ >>>= O, z -= O, a.back += O;
}
if (_ >>>= R, z -= R, a.back += R, a.length = N, 0 === C) {
a.mode = 26;
break;
}
if (32 & C) {
a.back = -1, a.mode = x;
break;
}
if (64 & C) {
t.msg = "invalid literal/length code", a.mode = 30;
break;
}
a.extra = 15 & C, a.mode = 22;
case 22:
if (a.extra) {
for (L = a.extra; z < L; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
a.length += _ & (1 << a.extra) - 1, _ >>>= a.extra, z -= a.extra, a.back += a.extra;
}
a.was = a.length, a.mode = 23;
case 23:
for (;C = (H = a.distcode[_ & (1 << a.distbits) - 1]) >>> 16 & 255, N = 65535 & H,
!((R = H >>> 24) <= z); ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
if (0 == (240 & C)) {
for (O = R, D = C, I = N; C = (H = a.distcode[I + ((_ & (1 << O + D) - 1) >> O)]) >>> 16 & 255,
N = 65535 & H, !(O + (R = H >>> 24) <= z); ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
_ >>>= O, z -= O, a.back += O;
}
if (_ >>>= R, z -= R, a.back += R, 64 & C) {
t.msg = "invalid distance code", a.mode = 30;
break;
}
a.offset = N, a.extra = 15 & C, a.mode = 24;
case 24:
if (a.extra) {
for (L = a.extra; z < L; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
a.offset += _ & (1 << a.extra) - 1, _ >>>= a.extra, z -= a.extra, a.back += a.extra;
}
if (a.offset > a.dmax) {
t.msg = "invalid distance too far back", a.mode = 30;
break;
}
a.mode = 25;
case 25:
if (0 === f) break t;
if (E = S - f, a.offset > E) {
if ((E = a.offset - E) > a.whave && a.sane) {
t.msg = "invalid distance too far back", a.mode = 30;
break;
}
E > a.wnext ? (E -= a.wnext, A = a.wsize - E) : A = a.wnext - E, E > a.length && (E = a.length),
Z = a.window;
} else Z = r, A = o - a.offset, E = a.length;
E > f && (E = f), f -= E, a.length -= E;
do {
r[o++] = Z[A++];
} while (--E);
0 === a.length && (a.mode = 21);
break;
case 26:
if (0 === f) break t;
r[o++] = a.length, f--, a.mode = 21;
break;
case 27:
if (a.wrap) {
for (;z < 32; ) {
if (0 === l) break t;
l--, _ |= n[s++] << z, z += 8;
}
if (S -= f, t.total_out += S, a.total += S, S && (t.adler = a.check = a.flags ? b(a.check, r, S, o - S) : c(a.check, r, S, o - S)),
S = f, (a.flags ? _ : i(_)) !== a.check) {
t.msg = "incorrect data check", a.mode = 30;
break;
}
_ = 0, z = 0;
}
a.mode = 28;
case 28:
if (a.wrap && a.flags) {
for (;z < 32; ) {
if (0 === l) break t;
l--, _ += n[s++] << z, z += 8;
}
if (_ !== (4294967295 & a.total)) {
t.msg = "incorrect length check", a.mode = 30;
break;
}
_ = 0, z = 0;
}
a.mode = 29;
case 29:
T = 1;
break t;
case 30:
T = -3;
break t;
case 31:
return -4;
case 32:
default:
return k;
}
return t.next_out = o, t.avail_out = f, t.next_in = s, t.avail_in = l, a.hold = _,
a.bits = z, (a.wsize || S !== t.avail_out && a.mode < 30 && (a.mode < 27 || 4 !== e)) && d(t, t.output, t.next_out, S - t.avail_out) ? (a.mode = 31,
-4) : (B -= t.avail_in, S -= t.avail_out, t.total_in += B, t.total_out += S, a.total += S,
a.wrap && S && (t.adler = a.check = a.flags ? b(a.check, r, S, t.next_out - S) : c(a.check, r, S, t.next_out - S)),
t.data_type = a.bits + (a.last ? 64 : 0) + (a.mode === x ? 128 : 0) + (20 === a.mode || 15 === a.mode ? 256 : 0),
(0 === B && 0 === S || 4 === e) && T === v && (T = -5), T);
}, a.inflateEnd = function(t) {
if (!t || !t.state) return k;
var e = t.state;
return e.window && (e.window = null), t.state = null, v;
}, a.inflateGetHeader = function(t, e) {
var a;
return t && t.state ? 0 == (2 & (a = t.state).wrap) ? k : (a.head = e, e.done = !1,
v) : k;
}, a.inflateSetDictionary = function(t, e) {
var a, i = e.length;
return t && t.state ? 0 !== (a = t.state).wrap && 11 !== a.mode ? k : 11 === a.mode && c(1, e, i, 0) !== a.check ? -3 : d(t, e, i, i) ? (a.mode = 31,
-4) : (a.havedict = 1, v) : k;
}, a.inflateInfo = "pako inflate (from Nodeca project)";
}, {
"../utils/common": 3,
"./adler32": 5,
"./crc32": 7,
"./inffast": 10,
"./inftrees": 12
} ],
12: [ function(t, e, a) {
var i = t("../utils/common"), n = [ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 ], r = [ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 ], s = [ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0 ], o = [ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64 ];
e.exports = function(t, e, a, l, h, d, f, _) {
var u, c, b, g, m, w, p, v, k, y = _.bits, x = 0, z = 0, B = 0, S = 0, E = 0, A = 0, Z = 0, R = 0, C = 0, N = 0, O = null, D = 0, I = new i.Buf16(16), U = new i.Buf16(16), T = null, F = 0;
for (x = 0; x <= 15; x++) I[x] = 0;
for (z = 0; z < l; z++) I[e[a + z]]++;
for (E = y, S = 15; S >= 1 && 0 === I[S]; S--) ;
if (E > S && (E = S), 0 === S) return h[d++] = 20971520, h[d++] = 20971520, _.bits = 1,
0;
for (B = 1; B < S && 0 === I[B]; B++) ;
for (E < B && (E = B), R = 1, x = 1; x <= 15; x++) if (R <<= 1, (R -= I[x]) < 0) return -1;
if (R > 0 && (0 === t || 1 !== S)) return -1;
for (U[1] = 0, x = 1; x < 15; x++) U[x + 1] = U[x] + I[x];
for (z = 0; z < l; z++) 0 !== e[a + z] && (f[U[e[a + z]]++] = z);
if (0 === t ? (O = T = f, w = 19) : 1 === t ? (O = n, D -= 257, T = r, F -= 257,
w = 256) : (O = s, T = o, w = -1), N = 0, z = 0, x = B, m = d, A = E, Z = 0, b = -1,
g = (C = 1 << E) - 1, 1 === t && C > 852 || 2 === t && C > 592) return 1;
for (;;) {
p = x - Z, f[z] < w ? (v = 0, k = f[z]) : f[z] > w ? (v = T[F + f[z]], k = O[D + f[z]]) : (v = 96,
k = 0), u = 1 << x - Z, B = c = 1 << A;
do {
h[m + (N >> Z) + (c -= u)] = p << 24 | v << 16 | k | 0;
} while (0 !== c);
for (u = 1 << x - 1; N & u; ) u >>= 1;
if (0 !== u ? (N &= u - 1, N += u) : N = 0, z++, 0 == --I[x]) {
if (x === S) break;
x = e[a + f[z]];
}
if (x > E && (N & g) !== b) {
for (0 === Z && (Z = E), m += B, R = 1 << (A = x - Z); A + Z < S && !((R -= I[A + Z]) <= 0); ) A++,
R <<= 1;
if (C += 1 << A, 1 === t && C > 852 || 2 === t && C > 592) return 1;
h[b = N & g] = E << 24 | A << 16 | m - d | 0;
}
}
return 0 !== N && (h[m + N] = x - Z << 24 | 64 << 16 | 0), _.bits = E, 0;
};
}, {
"../utils/common": 3
} ],
13: [ function(t, e, a) {
e.exports = {
2: "need dictionary",
1: "stream end",
0: "",
"-1": "file error",
"-2": "stream error",
"-3": "data error",
"-4": "insufficient memory",
"-5": "buffer error",
"-6": "incompatible version"
};
}, {} ],
14: [ function(t, e, a) {
function i(t) {
for (var e = t.length; --e >= 0; ) t[e] = 0;
}
function n(t, e, a, i, n) {
this.static_tree = t, this.extra_bits = e, this.extra_base = a, this.elems = i,
this.max_length = n, this.has_stree = t && t.length;
}
function r(t, e) {
this.dyn_tree = t, this.max_code = 0, this.stat_desc = e;
}
function s(t) {
return t < 256 ? q[t] : q[256 + (t >>> 7)];
}
function o(t, e) {
t.pending_buf[t.pending++] = 255 & e, t.pending_buf[t.pending++] = e >>> 8 & 255;
}
function l(t, e, a) {
t.bi_valid > N - a ? (t.bi_buf |= e << t.bi_valid & 65535, o(t, t.bi_buf), t.bi_buf = e >> N - t.bi_valid,
t.bi_valid += a - N) : (t.bi_buf |= e << t.bi_valid & 65535, t.bi_valid += a);
}
function h(t, e, a) {
l(t, a[2 * e], a[2 * e + 1]);
}
function d(t, e) {
var a = 0;
do {
a |= 1 & t, t >>>= 1, a <<= 1;
} while (--e > 0);
return a >>> 1;
}
function f(t, e, a) {
var i, n, r = new Array(C + 1), s = 0;
for (i = 1; i <= C; i++) r[i] = s = s + a[i - 1] << 1;
for (n = 0; n <= e; n++) {
var o = t[2 * n + 1];
0 !== o && (t[2 * n] = d(r[o]++, o));
}
}
function _(t) {
var e;
for (e = 0; e < E; e++) t.dyn_ltree[2 * e] = 0;
for (e = 0; e < A; e++) t.dyn_dtree[2 * e] = 0;
for (e = 0; e < Z; e++) t.bl_tree[2 * e] = 0;
t.dyn_ltree[2 * D] = 1, t.opt_len = t.static_len = 0, t.last_lit = t.matches = 0;
}
function u(t) {
t.bi_valid > 8 ? o(t, t.bi_buf) : t.bi_valid > 0 && (t.pending_buf[t.pending++] = t.bi_buf),
t.bi_buf = 0, t.bi_valid = 0;
}
function c(t, e, a, i) {
var n = 2 * e, r = 2 * a;
return t[n] < t[r] || t[n] === t[r] && i[e] <= i[a];
}
function b(t, e, a) {
for (var i = t.heap[a], n = a << 1; n <= t.heap_len && (n < t.heap_len && c(e, t.heap[n + 1], t.heap[n], t.depth) && n++,
!c(e, i, t.heap[n], t.depth)); ) t.heap[a] = t.heap[n], a = n, n <<= 1;
t.heap[a] = i;
}
function g(t, e, a) {
var i, n, r, o, d = 0;
if (0 !== t.last_lit) do {
i = t.pending_buf[t.d_buf + 2 * d] << 8 | t.pending_buf[t.d_buf + 2 * d + 1], n = t.pending_buf[t.l_buf + d],
d++, 0 === i ? h(t, n, e) : (h(t, (r = P[n]) + S + 1, e), 0 !== (o = F[r]) && l(t, n -= Y[r], o),
h(t, r = s(--i), a), 0 !== (o = L[r]) && l(t, i -= G[r], o));
} while (d < t.last_lit);
h(t, D, e);
}
function m(t, e) {
var a, i, n, r = e.dyn_tree, s = e.stat_desc.static_tree, o = e.stat_desc.has_stree, l = e.stat_desc.elems, h = -1;
for (t.heap_len = 0, t.heap_max = R, a = 0; a < l; a++) 0 !== r[2 * a] ? (t.heap[++t.heap_len] = h = a,
t.depth[a] = 0) : r[2 * a + 1] = 0;
for (;t.heap_len < 2; ) r[2 * (n = t.heap[++t.heap_len] = h < 2 ? ++h : 0)] = 1,
t.depth[n] = 0, t.opt_len--, o && (t.static_len -= s[2 * n + 1]);
for (e.max_code = h, a = t.heap_len >> 1; a >= 1; a--) b(t, r, a);
n = l;
do {
a = t.heap[1], t.heap[1] = t.heap[t.heap_len--], b(t, r, 1), i = t.heap[1], t.heap[--t.heap_max] = a,
t.heap[--t.heap_max] = i, r[2 * n] = r[2 * a] + r[2 * i], t.depth[n] = (t.depth[a] >= t.depth[i] ? t.depth[a] : t.depth[i]) + 1,
r[2 * a + 1] = r[2 * i + 1] = n, t.heap[1] = n++, b(t, r, 1);
} while (t.heap_len >= 2);
t.heap[--t.heap_max] = t.heap[1], function(t, e) {
var a, i, n, r, s, o, l = e.dyn_tree, h = e.max_code, d = e.stat_desc.static_tree, f = e.stat_desc.has_stree, _ = e.stat_desc.extra_bits, u = e.stat_desc.extra_base, c = e.stat_desc.max_length, b = 0;
for (r = 0; r <= C; r++) t.bl_count[r] = 0;
for (l[2 * t.heap[t.heap_max] + 1] = 0, a = t.heap_max + 1; a < R; a++) (r = l[2 * l[2 * (i = t.heap[a]) + 1] + 1] + 1) > c && (r = c,
b++), l[2 * i + 1] = r, i > h || (t.bl_count[r]++, s = 0, i >= u && (s = _[i - u]),
o = l[2 * i], t.opt_len += o * (r + s), f && (t.static_len += o * (d[2 * i + 1] + s)));
if (0 !== b) {
do {
for (r = c - 1; 0 === t.bl_count[r]; ) r--;
t.bl_count[r]--, t.bl_count[r + 1] += 2, t.bl_count[c]--, b -= 2;
} while (b > 0);
for (r = c; 0 !== r; r--) for (i = t.bl_count[r]; 0 !== i; ) (n = t.heap[--a]) > h || (l[2 * n + 1] !== r && (t.opt_len += (r - l[2 * n + 1]) * l[2 * n],
l[2 * n + 1] = r), i--);
}
}(t, e), f(r, h, t.bl_count);
}
function w(t, e, a) {
var i, n, r = -1, s = e[1], o = 0, l = 7, h = 4;
for (0 === s && (l = 138, h = 3), e[2 * (a + 1) + 1] = 65535, i = 0; i <= a; i++) n = s,
s = e[2 * (i + 1) + 1], ++o < l && n === s || (o < h ? t.bl_tree[2 * n] += o : 0 !== n ? (n !== r && t.bl_tree[2 * n]++,
t.bl_tree[2 * I]++) : o <= 10 ? t.bl_tree[2 * U]++ : t.bl_tree[2 * T]++, o = 0,
r = n, 0 === s ? (l = 138, h = 3) : n === s ? (l = 6, h = 3) : (l = 7, h = 4));
}
function p(t, e, a) {
var i, n, r = -1, s = e[1], o = 0, d = 7, f = 4;
for (0 === s && (d = 138, f = 3), i = 0; i <= a; i++) if (n = s, s = e[2 * (i + 1) + 1],
!(++o < d && n === s)) {
if (o < f) do {
h(t, n, t.bl_tree);
} while (0 != --o); else 0 !== n ? (n !== r && (h(t, n, t.bl_tree), o--), h(t, I, t.bl_tree),
l(t, o - 3, 2)) : o <= 10 ? (h(t, U, t.bl_tree), l(t, o - 3, 3)) : (h(t, T, t.bl_tree),
l(t, o - 11, 7));
o = 0, r = n, 0 === s ? (d = 138, f = 3) : n === s ? (d = 6, f = 3) : (d = 7, f = 4);
}
}
function v(t, e, a, i) {
l(t, (z << 1) + (i ? 1 : 0), 3), function(t, e, a, i) {
u(t), i && (o(t, a), o(t, ~a)), k.arraySet(t.pending_buf, t.window, e, a, t.pending),
t.pending += a;
}(t, e, a, !0);
}
var k = t("../utils/common"), y = 0, x = 1, z = 0, B = 29, S = 256, E = S + 1 + B, A = 30, Z = 19, R = 2 * E + 1, C = 15, N = 16, O = 7, D = 256, I = 16, U = 17, T = 18, F = [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0 ], L = [ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 ], H = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7 ], j = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ], K = new Array(2 * (E + 2));
i(K);
var M = new Array(2 * A);
i(M);
var q = new Array(512);
i(q);
var P = new Array(256);
i(P);
var Y = new Array(B);
i(Y);
var G = new Array(A);
i(G);
var X, W, J, Q = !1;
a._tr_init = function(t) {
Q || (function() {
var t, e, a, i, r, s = new Array(C + 1);
for (a = 0, i = 0; i < B - 1; i++) for (Y[i] = a, t = 0; t < 1 << F[i]; t++) P[a++] = i;
for (P[a - 1] = i, r = 0, i = 0; i < 16; i++) for (G[i] = r, t = 0; t < 1 << L[i]; t++) q[r++] = i;
for (r >>= 7; i < A; i++) for (G[i] = r << 7, t = 0; t < 1 << L[i] - 7; t++) q[256 + r++] = i;
for (e = 0; e <= C; e++) s[e] = 0;
for (t = 0; t <= 143; ) K[2 * t + 1] = 8, t++, s[8]++;
for (;t <= 255; ) K[2 * t + 1] = 9, t++, s[9]++;
for (;t <= 279; ) K[2 * t + 1] = 7, t++, s[7]++;
for (;t <= 287; ) K[2 * t + 1] = 8, t++, s[8]++;
for (f(K, E + 1, s), t = 0; t < A; t++) M[2 * t + 1] = 5, M[2 * t] = d(t, 5);
X = new n(K, F, S + 1, E, C), W = new n(M, L, 0, A, C), J = new n(new Array(0), H, 0, Z, O);
}(), Q = !0), t.l_desc = new r(t.dyn_ltree, X), t.d_desc = new r(t.dyn_dtree, W),
t.bl_desc = new r(t.bl_tree, J), t.bi_buf = 0, t.bi_valid = 0, _(t);
}, a._tr_stored_block = v, a._tr_flush_block = function(t, e, a, i) {
var n, r, s = 0;
t.level > 0 ? (2 === t.strm.data_type && (t.strm.data_type = function(t) {
var e, a = 4093624447;
for (e = 0; e <= 31; e++, a >>>= 1) if (1 & a && 0 !== t.dyn_ltree[2 * e]) return y;
if (0 !== t.dyn_ltree[18] || 0 !== t.dyn_ltree[20] || 0 !== t.dyn_ltree[26]) return x;
for (e = 32; e < S; e++) if (0 !== t.dyn_ltree[2 * e]) return x;
return y;
}(t)), m(t, t.l_desc), m(t, t.d_desc), s = function(t) {
var e;
for (w(t, t.dyn_ltree, t.l_desc.max_code), w(t, t.dyn_dtree, t.d_desc.max_code),
m(t, t.bl_desc), e = Z - 1; e >= 3 && 0 === t.bl_tree[2 * j[e] + 1]; e--) ;
return t.opt_len += 3 * (e + 1) + 5 + 5 + 4, e;
}(t), n = t.opt_len + 3 + 7 >>> 3, (r = t.static_len + 3 + 7 >>> 3) <= n && (n = r)) : n = r = a + 5,
a + 4 <= n && -1 !== e ? v(t, e, a, i) : 4 === t.strategy || r === n ? (l(t, 2 + (i ? 1 : 0), 3),
g(t, K, M)) : (l(t, 4 + (i ? 1 : 0), 3), function(t, e, a, i) {
var n;
for (l(t, e - 257, 5), l(t, a - 1, 5), l(t, i - 4, 4), n = 0; n < i; n++) l(t, t.bl_tree[2 * j[n] + 1], 3);
p(t, t.dyn_ltree, e - 1), p(t, t.dyn_dtree, a - 1);
}(t, t.l_desc.max_code + 1, t.d_desc.max_code + 1, s + 1), g(t, t.dyn_ltree, t.dyn_dtree)),
_(t), i && u(t);
}, a._tr_tally = function(t, e, a) {
return t.pending_buf[t.d_buf + 2 * t.last_lit] = e >>> 8 & 255, t.pending_buf[t.d_buf + 2 * t.last_lit + 1] = 255 & e,
t.pending_buf[t.l_buf + t.last_lit] = 255 & a, t.last_lit++, 0 === e ? t.dyn_ltree[2 * a]++ : (t.matches++,
e--, t.dyn_ltree[2 * (P[a] + S + 1)]++, t.dyn_dtree[2 * s(e)]++), t.last_lit === t.lit_bufsize - 1;
}, a._tr_align = function(t) {
l(t, 2, 3), h(t, D, K), function(t) {
16 === t.bi_valid ? (o(t, t.bi_buf), t.bi_buf = 0, t.bi_valid = 0) : t.bi_valid >= 8 && (t.pending_buf[t.pending++] = 255 & t.bi_buf,
t.bi_buf >>= 8, t.bi_valid -= 8);
}(t);
};
}, {
"../utils/common": 3
} ],
15: [ function(t, e, a) {
e.exports = function() {
this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null,
this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null,
this.data_type = 2, this.adler = 0;
};
}, {} ],
"/": [ function(t, e, a) {
var i = {};
(0, t("./lib/utils/common").assign)(i, t("./lib/deflate"), t("./lib/inflate"), t("./lib/zlib/constants")),
e.exports = i;
}, {
"./lib/deflate": 1,
"./lib/inflate": 2,
"./lib/utils/common": 3,
"./lib/zlib/constants": 6
} ]
}, {}, [])("/");
});
\ No newline at end of file
Component({
properties: {
initColor: {
type: String,
value: "rgb(255,0,0)"
},
maskClosable: {
type: Boolean,
value: !0
},
mask: {
type: Boolean,
value: !0
},
show: {
type: Boolean,
value: !1
}
},
data: {},
lifetimes: {
attached: function() {
var t = this.data.initColor;
this.setData({
hueColor: this.hsv2rgb(this.rgb2hsv(t).h, 100, 100)
});
},
ready: function() {
var t = this, e = this.createSelectorQuery();
e.select(".target").boundingClientRect(), e.exec(function(e) {
var a = e[0];
if (a) {
t.SV = {
W: a.width - 28,
H: a.height - 28,
Step: (a.width - 28) / 100
};
var s = t.rgb2hsv(t.data.initColor), h = s.h, o = s.s, i = s.v;
t.setData({
hsv: {
h: h,
s: o,
v: i
},
x: Math.round(o * t.SV.Step),
y: Math.round((100 - i) * t.SV.Step)
});
}
});
}
},
methods: {
onEnd: function() {
this.triggerEvent("changeColor", {
color: this.data.colorRes
});
},
changeHue: function(t) {
var e = t.detail.value;
this.setData({
"hsv.h": e,
hueColor: this.hsv2rgb(e, 100, 100),
colorRes: this.hsv2rgb(e, this.data.hsv.s, this.data.hsv.v)
});
},
changeSV: function(t) {
var e = t.detail, a = e.x, s = e.y;
a = Math.round(a / this.SV.Step), s = 100 - Math.round(s / this.SV.Step), this.setData({
"hsv.s": a,
"hsv.v": s,
colorRes: this.hsv2rgb(this.data.hsv.h, a, s)
});
},
close: function(t) {
this.data.maskClosable && (this.setData({
show: !1
}), this.triggerEvent("close"));
},
preventdefault: function() {},
hsv2rgb: function(t, e, a) {
var s = (t / 360).toFixed(2), h = (e / 100).toFixed(2), o = (a / 100).toFixed(2), i = Math.floor(6 * s), r = 6 * s - i, n = o * (1 - h), l = o * (1 - r * h), c = o * (1 - (1 - r) * h), v = 0, d = 0, u = 0;
switch (i % 6) {
case 0:
v = o, d = c, u = n;
break;
case 1:
v = l, d = o, u = n;
break;
case 2:
v = n, d = o, u = c;
break;
case 3:
v = n, d = l, u = o;
break;
case 4:
v = c, d = n, u = o;
break;
case 5:
v = o, d = n, u = l;
}
return "rgb(" + Math.floor(255 * v) + "," + Math.floor(255 * d) + "," + Math.floor(255 * u) + ")";
},
rgb2hsv: function(t) {
var e, a, s = t.split(","), h = parseInt(s[0].split("(")[1]) / 255, o = parseInt(s[1]) / 255, i = parseInt(s[2].split(")")[0]) / 255, r = Math.max(h, o, i), n = Math.min(h, o, i), l = r, c = r - n;
if (a = 0 == r ? 0 : c / r, r == n) e = 0; else {
switch (r) {
case h:
e = (o - i) / c + (o < i ? 6 : 0);
break;
case o:
e = (i - h) / c + 2;
break;
case i:
e = (h - o) / c + 4;
}
e /= 6;
}
return {
h: (360 * e).toFixed(),
s: (100 * a).toFixed(),
v: (100 * l).toFixed()
};
}
}
});
\ No newline at end of file
{
"component": true,
"usingComponents": {
"color-picker": "/miniprogram_npm/mini-color-picker/color-picker",
"mp-actionSheet": "/miniprogram_npm/weui-miniprogram/actionsheet/actionsheet",
"mp-cell": "/miniprogram_npm/weui-miniprogram/cell/cell",
"mp-cells": "/miniprogram_npm/weui-miniprogram/cells/cells",
"mp-dialog": "/miniprogram_npm/weui-miniprogram/dialog/dialog",
"mp-form": "/miniprogram_npm/weui-miniprogram/form/form",
"mp-form-page": "/miniprogram_npm/weui-miniprogram/form-page/form-page",
"mp-halfScreenDialog": "/miniprogram_npm/weui-miniprogram/half-screen-dialog/half-screen-dialog",
"mp-icon": "/miniprogram_npm/weui-miniprogram/icon/icon",
"mp-msg": "/miniprogram_npm/weui-miniprogram/msg/msg",
"mp-slideview": "/miniprogram_npm/weui-miniprogram/slideview/slideview",
"mp-toptips": "/miniprogram_npm/weui-miniprogram/toptips/toptips"
}
}
\ No newline at end of file
<view class="dialog {{show?'dialog_show':''}}">
<view catchtap="close" catchtouchmove="close" class="weui-mask" wx:if="{{mask}}"></view>
<view catchtouchmove="preventdefault" class="weui-actionsheet {{show?'weui-actionsheet_toggle':''}}">
<view class="weui-half-screen-dialog__hd">
<view catchtap="close" class="weui-half-screen-dialog__hd__side" style="height:24px;width:24px;">
<a class="weui-icon-btn">
<i class="weui-icon-close-thin"></i>
</a>
</view>
<view class="weui-half-screen-dialog__hd__main">
<strong class="weui-half-screen-dialog__title">请选择颜色</strong>
<view class="weui-half-screen-dialog__subtitle">可通过下方滑块颜色预览</view>
</view>
</view>
<movable-area class="target" style="background-color:{{hueColor}}">
<movable-view animation="{{false}}" bindchange="changeSV" bindtouchend="onEnd" class="iconfont icon-ios-locate-outline" direction="all" x="{{x}}" y="{{y}}"></movable-view>
</movable-area>
<slider activeColor="transparent" backgroundColor="transparent" bindchanging="changeHue" bindtouchend="onEnd" blockColor="{{colorRes}}" class="ribbon" max="360" value="{{hsv.h}}"></slider>
</view>
</view>
.dialog {
visibility: hidden;
opacity: 0;
transition: all .3s;
}
.dialog_show {
visibility: visible;
opacity: 1;
}
.target {
height: 600rpx;
width: 600rpx;
margin: 0 auto;
background-image: url(https://cdn.makergyt.com/color_picker_mask.png);
overflow: hidden;
border: .5px solid rgba(0,0,0,.5);
}
.ribbon {
background: -webkit-linear-gradient(left,red,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);
width: 600rpx;
margin: 40rpx auto;
}
@font-face {
font-family:iconfont;src:url(data:font/truetype;charset=utf-8;base64,AAEAAAANAIAAAwBQRkZUTYt/1hMAAAcsAAAAHEdERUYAKQAKAAAHDAAAAB5PUy8yQLdMOwAAAVgAAABWY21hcAAP7fQAAAHAAAABQmdhc3D//wADAAAHBAAAAAhnbHlm3oWUVAAAAxAAAAEsaGVhZBj68wcAAADcAAAANmhoZWEHvwOFAAABFAAAACRobXR4DAAAHwAAAbAAAAAQbG9jYQCWAAAAAAMEAAAACm1heHABEgB3AAABOAAAACBuYW1lKeYRVQAABDwAAAKIcG9zdB6Dei8AAAbEAAAAPQABAAAAAQAAbSkcx18PPPUACwQAAAAAANrt14UAAAAA2u3XhQAf/58D4QNhAAAACAACAAAAAAAAAAEAAAOA/4AAXAQAAAAAAAPhAAEAAAAAAAAAAAAAAAAAAAAEAAEAAAAEAGsABAAAAAAAAgAAAAoACgAAAP8AAAAAAAAAAQQAAZAABQAAAokCzAAAAI8CiQLMAAAB6wAyAQgAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABA6knqSQOA/4AAXAOAAIAAAAABAAAAAAAABAAAAAAAAAAEAAAABAAAHwAAAAMAAAADAAAAHAABAAAAAAA8AAMAAQAAABwABAAgAAAABAAEAAEAAOpJ//8AAOpJ//8VugABAAAAAAAAAQYAAAEAAAAAAAAAAQIAAAACAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJYAAAAEAB//nwPhA2EABQARADkAagAAASY1NwYWJQ4BBx4BFz4BNy4BBSMuASc1NCYiBh0BDgEHIyIGFBY7AR4BFxUUFjI2PQE+ATczMjY0JgMOAQc1NCYiBh0BLgMnMzI2NCYrAT4DNxUUFjI2PQEeAxcjIgYUFjsBDgEDFwEBAgH+6jxPAQFPPDxPAQFPAYknDtWfEBgQn9UOJwwQEAwnDtWfEBgQn9UOJwwQENMudEAQGBBAdFw1BTQLEBALNAU1XHRAEBgQQHRcNQU0CxAQCzQFNQF6BAMFAwaPAU88PE8BAU88PE9vn9UOJwwQEAwnDtWfEBgQn9UOJwwQEAwnDtWfEBgQ/uYuNQU0CxAQCzQFNVx0QBAYEEB0XDUFNAsQEAs0BTVcdEAQGBBAdAAAABIA3gABAAAAAAAAABUALAABAAAAAAABAAgAVAABAAAAAAACAAcAbQABAAAAAAADAAgAhwABAAAAAAAEAAgAogABAAAAAAAFAAsAwwABAAAAAAAGAAgA4QABAAAAAAAKACsBQgABAAAAAAALABMBlgADAAEECQAAACoAAAADAAEECQABABAAQgADAAEECQACAA4AXQADAAEECQADABAAdQADAAEECQAEABAAkAADAAEECQAFABYAqwADAAEECQAGABAAzwADAAEECQAKAFYA6gADAAEECQALACYBbgAKAEMAcgBlAGEAdABlAGQAIABiAHkAIABpAGMAbwBuAGYAbwBuAHQACgAACkNyZWF0ZWQgYnkgaWNvbmZvbnQKAABpAGMAbwBuAGYAbwBuAHQAAGljb25mb250AABSAGUAZwB1AGwAYQByAABSZWd1bGFyAABpAGMAbwBuAGYAbwBuAHQAAGljb25mb250AABpAGMAbwBuAGYAbwBuAHQAAGljb25mb250AABWAGUAcgBzAGkAbwBuACAAMQAuADAAAFZlcnNpb24gMS4wAABpAGMAbwBuAGYAbwBuAHQAAGljb25mb250AABHAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAHMAdgBnADIAdAB0AGYAIABmAHIAbwBtACAARgBvAG4AdABlAGwAbABvACAAcAByAG8AagBlAGMAdAAuAABHZW5lcmF0ZWQgYnkgc3ZnMnR0ZiBmcm9tIEZvbnRlbGxvIHByb2plY3QuAABoAHQAdABwADoALwAvAGYAbwBuAHQAZQBsAGwAbwAuAGMAbwBtAABodHRwOi8vZm9udGVsbG8uY29tAAACAAAAAAAAAAoAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAQAAAABAAIBAhJpb3MtbG9jYXRlLW91dGxpbmUAAAAAAAAB//8AAgABAAAADAAAABYAAAACAAEAAwADAAEABAAAAAIAAAAAAAAAAQAAAADVpCcIAAAAANrt14UAAAAA2u3XhQ==) format("truetype");font-weight:400;font-style:normal;
}
.iconfont {
font-family: iconfont!important;
font-size: 28px;
line-height: 28px;
height: 28px;
width: 28px;
color: #fff;
text-align: center;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-ios-locate-outline:before {
content: "\ea49";
}
.weui-mask {
z-index: 1000;
top: 0;
right: 0;
background: rgba(0,0,0,.6);
}
.weui-actionsheet,.weui-mask {
position: fixed;
left: 0;
bottom: 0;
}
.weui-actionsheet {
transform: translate(0,100%);
backface-visibility: hidden;
z-index: 5000;
width: 100%;
background-color: #fff;
transition: transform .3s;
transition: transform .3s,-webkit-transform .3s;
border-top-left-radius: 12px;
border-top-right-radius: 12px;
overflow: hidden;
padding-bottom: calc(env(safe-area-inset-bottom));
}
.weui-actionsheet_toggle {
transform: translate(0,0);
}
.weui-half-screen-dialog__hd {
padding: 0 calc(24px + env(safe-area-inset-right));
font-size: 8px;
height: 8em;
display: flex;
-webkit-box-align: center;
align-items: center;
}
.weui-half-screen-dialog__hd .weui-icon-btn {
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.weui-half-screen-dialog__hd__side {
position: relative;
left: -8px;
}
.weui-half-screen-dialog__hd__main {
-webkit-box-flex: 1;
flex: 1;
}
.weui-half-screen-dialog__hd__side+.weui-half-screen-dialog__hd__main {
text-align: center;
padding: 0 40px;
}
.weui-half-screen-dialog__hd__main+.weui-half-screen-dialog__hd__side {
right: -8px;
left: auto;
}
.weui-half-screen-dialog__hd__main+.weui-half-screen-dialog__hd__side .weui-icon-btn {
right: 0;
}
.weui-half-screen-dialog__title {
display: block;
color: rgba(0,0,0,.9);
font-weight: 700;
font-size: 15px;
}
.weui-half-screen-dialog__subtitle {
display: block;
color: rgba(0,0,0,.5);
font-size: 10px;
}
.weui-icon-close-thin {
mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.25 10.693L6.057 4.5 5 5.557l6.193 6.193L5 17.943 6.057 19l6.193-6.193L18.443 19l1.057-1.057-6.193-6.193L19.5 5.557 18.443 4.5z' fill-rule='evenodd'/%3E%3C/svg%3E");
display: inline-block;
vertical-align: middle;
width: 24px;
height: 24px;
mask-position: 50% 50%;
mask-repeat: no-repeat;
mask-size: 100%;
background-color: currentColor;
}
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */,
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
multipleSlots: true,
// 在组件定义时的选项中启用多slot支持
addGlobalClass: true
},
properties: {
title: {
// 标题
type: String,
value: ''
},
showCancel: {
// 是否显示取消按钮
type: Boolean,
value: true
},
cancelText: {
// 取消按钮文案
type: String,
value: '取消'
},
maskClass: {
// 遮罩层class
type: String,
value: ''
},
extClass: {
// 弹出窗 class
type: String,
value: ''
},
maskClosable: {
// 点击遮罩 关闭 actionsheet
type: Boolean,
value: true
},
mask: {
// 是否需要 遮罩层
type: Boolean,
value: true
},
show: {
// 是否开启 actionsheet
type: Boolean,
value: false
},
actions: {
// actions 列表
type: Array,
value: [],
// {text, extClass}
observer: '_groupChange'
}
},
methods: {
_groupChange(e) {
// 支持 一维数组 写法
if (e.length > 0 && typeof e[0] !== 'string' && !(e[0] instanceof Array)) {
this.setData({
actions: [this.data.actions]
});
}
},
buttonTap(e) {
const {
value,
groupindex,
index
} = e.currentTarget.dataset;
this.triggerEvent('actiontap', {
value,
groupindex,
index
});
},
closeActionSheet(e) {
const {
type
} = e.currentTarget.dataset;
if (this.data.maskClosable || type) {
// 点击 action 里面的 取消
this.setData({
show: false
}); // 关闭回调事件
this.triggerEvent('close');
}
}
}
});
/***/ })
/******/ ]);
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<wxs module="utils">
var join = function(a,b) {
return a+b
};
var isNotSlot = function(v) {
return typeof v !== 'string'
}
module.exports = {
join: join,
isNotSlot: isNotSlot
}
</wxs>
<view wx:if="{{mask}}" class="weui-mask {{show ? '' : 'weui-mask_hidden'}} {{maskClass}}" bindtap="closeActionSheet"></view>
<view class="weui-actionsheet {{show ? 'weui-actionsheet_toggle' : ''}} {{extClass}}">
<!-- 标题 -->
<block wx:if="{{title}}">
<view class="weui-actionsheet__title">
<view class="weui-actionsheet__title-text">{{title}}</view>
</view>
</block>
<slot name="title" wx:else></slot>
<view
class="{{ !showCancel && index === actions.length-1 ? 'weui-actionsheet__action' : 'weui-actionsheet__menu' }}"
wx:key="index"
wx:for-item="actionItem"
wx:for-index="index"
wx:for="{{actions}}"
>
<block wx:if="{{utils.isNotSlot(actionItem)}}">
<view
class="weui-actionsheet__cell {{item.type === 'warn' ? 'weui-actionsheet__cell_warn' : '' }}"
hover-class="weui-active"
wx:key="actionIndex"
wx:for="{{actionItem}}"
wx:for-index="actionIndex"
data-groupindex="{{index}}"
data-index="{{actionIndex}}"
data-value="{{item.value}}"
bindtap="buttonTap"
>
{{item.text}}
</view>
</block>
<slot name="{{actionItem}}" wx:else></slot>
</view>
<!-- 取消按钮 -->
<view class="weui-actionsheet__action" wx:if="{{showCancel}}">
<view class="weui-actionsheet__cell" hover-class="weui-active" data-type="close" id="iosActionsheetCancel" bindtap="closeActionSheet">{{cancelText}}</view>
</view>
</view>
.weui-mask.weui-mask_hidden{opacity:0;transform:scale3d(1, 1, 0)}.weui-mask{opacity:1;transform:scale3d(1, 1, 1);transition:all .3s}
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 15);
/******/ })
/************************************************************************/
/******/ ({
/***/ 15:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
addGlobalClass: true
},
properties: {
extClass: {
type: String,
value: ''
},
content: {
type: String,
value: ''
}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="weui-badge {{extClass}} {{!content ? 'weui-badge_dot' : ''}}">{{content}}</view>
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 9);
/******/ })
/************************************************************************/
/******/ ({
/***/ 9:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
addGlobalClass: true,
multipleSlots: true
},
properties: {
hover: {
type: Boolean,
value: false
},
link: {
type: Boolean,
value: false
},
extClass: {
type: String,
value: ''
},
iconClass: {
type: String,
value: ''
},
bodyClass: {
type: String,
value: ''
},
icon: {
type: String,
value: ''
},
title: {
// 和icon二选一,都是放在cell_hd里面
type: String,
value: ''
},
value: {
type: String,
value: ''
},
showError: {
type: Boolean,
value: false
},
prop: {
// 校验的属性,给父元素form使用
type: String,
value: ''
},
url: {
// 在link为true的时候有效,表示navigator的跳转url
type: String,
value: ''
},
footerClass: {
type: String,
value: ''
},
footer: {
type: String,
value: ''
},
inline: {
// 左右布局样式还是上下布局
type: Boolean,
value: true
},
hasHeader: {
type: Boolean,
value: true
},
hasFooter: {
type: Boolean,
value: true
},
hasBody: {
type: Boolean,
value: true
},
extHoverClass: {
// 提供给需要定制 hover-class 的场景,要求 hover 为 false
type: String,
value: ''
}
},
relations: {
'../form/form': {
type: 'ancestor'
},
'../cells/cells': {
type: 'ancestor'
}
},
data: {
inForm: false
},
methods: {
setError(error) {
this.setData({
error: error || false
});
},
setInForm() {
this.setData({
inForm: true
});
},
setOuterClass(className) {
this.setData({
outerClass: className
});
},
navigateTo() {
const data = this.data;
if (data.url && data.link) {
wx.navigateTo({
url: data.url,
success: res => {
this.triggerEvent('navigatesuccess', res, {});
},
fail: fail => {
this.triggerEvent('navigateerror', fail, {});
}
});
}
}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {
"mp-cells": "../cells/cells"
}
}
\ No newline at end of file
<block wx:if="{{link}}">
<view bindtap="navigateTo" class="weui-cell weui-cell_access {{extClass}} {{outerClass}}{{inForm ? ' weui-cell-inform' : ''}}{{inline ? '' : ' .weui-cell_label-block'}}" hover-class="{{hover ? 'weui-cell_active weui-active' : extHoverClass}}">
<view wx:if="{{hasHeader}}" class="weui-cell__hd {{iconClass}}">
<block wx:if="{{icon}}">
<image src="{{icon}}" class="weui-cell__icon" mode="aspectFit"></image>
</block>
<block wx:else>
<slot name="icon"></slot>
</block>
<block wx:if="{{inForm}}">
<block wx:if="{{title}}"><view class="weui-label">{{title}}</view></block>
<block wx:else>
<slot name="title"></slot>
</block>
</block>
<block wx:else>
<block wx:if="{{title}}">{{title}}</block>
<block wx:else>
<slot name="title"></slot>
</block>
</block>
</view>
<view wx:if="{{hasBody}}" class="weui-cell__bd">
<block wx:if="{{value}}">{{value}}</block>
<block wx:else>
<slot></slot>
</block>
</view>
<view wx:if="{{hasFooter}}" class="weui-cell__ft weui-cell__ft_in-access {{footerClass}}">
<block wx:if="{{footer}}">{{footer}}</block>
<block wx:else>
<slot name="footer"></slot>
</block>
</view>
</view>
</block>
<block wx:else>
<view bindtap="navigateTo" class="weui-cell {{showError && error ? 'weui-cell_warn' : ''}} {{inForm ? 'weui-cell-inform' : ''}} {{extClass}} {{outerClass}}" hover-class="{{hover ? 'weui-cell_active weui-active' : extHoverClass}}">
<view wx:if="{{hasHeader}}" class="weui-cell__hd {{iconClass}}">
<block wx:if="{{icon}}">
<image src="{{icon}}" class="weui-cell__icon" mode="aspectFit"></image>
</block>
<block wx:else>
<slot name="icon"></slot>
</block>
<block wx:if="{{inForm}}">
<block wx:if="{{title}}"><view class="weui-label">{{title}}</view></block>
<block wx:else>
<slot name="title"></slot>
</block>
</block>
<block wx:else>
<block wx:if="{{title}}">{{title}}</block>
<block wx:else>
<slot name="title"></slot>
</block>
</block>
</view>
<view wx:if="{{hasBody}}" class="weui-cell__bd {{bodyClass}}">
<block wx:if="{{value}}">{{value}}</block>
<block wx:else>
<slot></slot>
</block>
</view>
<view wx:if="{{hasFooter}}" class="weui-cell__ft {{footerClass}}">
<block wx:if="{{footer}}">{{footer}}</block>
<block wx:else>
<slot name="footer"></slot>
</block>
<icon wx:if="{{showError && error}}" type="warn" size="23" color="#E64340"></icon>
</view>
</view>
</block>
\ No newline at end of file
.weui-cell_wxss.weui-cell_wxss:before{display:block}
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 8);
/******/ })
/************************************************************************/
/******/ ({
/***/ 8:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
addGlobalClass: true,
multipleSlots: true
},
properties: {
title: {
type: String,
value: ''
},
extClass: {
type: String,
value: ''
},
footer: {
type: String,
value: ''
}
},
data: {
firstItem: null,
checkboxCount: 0,
checkboxIsMulti: false,
outerClass: '',
childClass: ''
},
relations: {
'../cell/cell': {
type: 'descendant',
linked(target) {
if (!this.data.firstItem) {
this.data.firstItem = target;
}
if (target !== this.data.firstItem) {
target.setOuterClass('weui-cell_wxss');
}
}
},
'../form-page/form-page': {
type: 'ancestor'
},
'../checkbox-group/checkbox-group': {
type: 'descendant',
linked(target) {
this.setData({
checkboxCount: this.data.checkboxCount + 1,
checkboxIsMulti: target.data.multi
});
},
unlinked(target) {
this.setData({
checkboxCount: this.data.checkboxCount - 1,
checkboxIsMulti: target.data.multi
});
}
}
},
methods: {
setCellMulti(multi) {
this.setData({
checkboxIsMulti: multi
});
},
setCellsClass(className) {
this.setData({
childClass: className
});
},
setOuterClass(className) {
this.setData({
outerClass: className
});
}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="{{extClass}} weui-cells__group {{outerClass}} {{childClass}}">
<view wx:if="{{title}}" class="weui-cells__title">{{title}}</view>
<view class="weui-cells weui-cells_after-title {{checkboxCount > 0 && checkboxIsMulti ? 'weui-cells_checkbox' : ''}}">
<slot></slot>
</view>
<view wx:if="{{footer}}" class="weui-cells__tips">{{footer}}</view>
<slot name="footer" wx:else></slot>
</view>
\ No newline at end of file
.weui-cells__group_wxss.weui-cells__group_wxss .weui-cells__title{margin-top:24px}.weui-cells__group_form .weui-cells__tips{margin-top:8px;padding:0 32px;color:var(--weui-FG-1)}
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 24);
/******/ })
/************************************************************************/
/******/ ({
/***/ 24:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
addGlobalClass: true,
multipleSlots: true
},
properties: {
multi: {
type: Boolean,
value: true,
observer: '_multiChange'
},
extClass: {
type: String,
value: ''
},
prop: {
type: String,
value: ''
}
},
data: {
targetList: [],
parentCell: null
},
relations: {
'../checkbox/checkbox': {
type: 'descendant',
linked(target) {
this.data.targetList.push(target);
target.setMulti(this.data.multi);
if (!this.data.firstItem) {
this.data.firstItem = target;
}
if (target !== this.data.firstItem) {
target.setOuterClass('weui-cell_wxss');
}
},
unlinked(target) {
let index = -1;
this.data.targetList.forEach((item, idx) => {
if (item === target) {
index = idx;
}
});
this.data.targetList.splice(index, 1);
if (!this.data.targetList) {
this.data.firstItem = null;
}
}
},
'../form/form': {
type: 'ancestor'
},
'../cells/cells': {
type: 'ancestor',
linked(target) {
if (!this.data.parentCell) {
this.data.parentCell = target;
}
this.setParentCellsClass();
},
unlinked() {
this.data.parentCell = null; // 方便内存回收
}
}
},
methods: {
checkedChange(checked, target) {
if (this.data.multi) {
const vals = [];
this.data.targetList.forEach(item => {
if (item.data.checked) {
vals.push(item.data.value);
}
});
this.triggerEvent('change', {
value: vals
});
} else {
let val = '';
this.data.targetList.forEach(item => {
if (item === target) {
val = item.data.value;
} else {
item.setData({
checked: false
});
}
});
this.triggerEvent('change', {
value: val
}, {});
}
},
setParentCellsClass() {
const className = this.data.multi ? 'weui-cells_checkbox' : '';
if (this.data.parentCell) {
this.data.parentCell.setCellsClass(className);
}
},
_multiChange(multi) {
this.data.targetList.forEach(target => {
target.setMulti(multi);
});
if (this.data.parentCell) {
this.data.parentCell.setCellMulti(multi);
}
return multi;
}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {
"mp-cells": "../cells/cells"
}
}
\ No newline at end of file
<checkbox-group class="{{extClass}}" wx-if="{{multi}}" bindchange="checkedChange">
<slot></slot>
</checkbox-group>
<radio-group class="{{extClass}}" wx-else bindchange="checkedChange">
<slot></slot>
</radio-group>
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 25);
/******/ })
/************************************************************************/
/******/ ({
/***/ 25:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
addGlobalClass: true,
multipleSlots: true
},
properties: {
multi: {
type: Boolean,
value: true
},
checked: {
type: Boolean,
value: false
},
value: {
type: String,
value: ''
},
label: {
type: String,
value: 'label'
},
extClass: {
type: String,
value: ''
}
},
data: {},
relations: {
'../checkbox-group/checkbox-group': {
type: 'ancestor',
linked(target) {
this.data.group = target;
},
unlinked() {
this.data.group = null;
}
}
},
methods: {
setMulti(multi) {
this.setData({
multi
});
},
setOuterClass(className) {
this.setData({
outerClass: className
});
},
checkedChange() {
if (this.data.multi) {
const checked = !this.data.checked;
this.setData({
checked
});
if (this.data.group) {
this.data.group.checkedChange(checked, this);
}
} else {
const checked = this.data.checked;
if (checked) return;
this.setData({
checked: true
});
if (this.data.group) {
this.data.group.checkedChange(checked, this);
}
}
this.triggerEvent('change', {
value: this.data.value,
checked: this.data.checked
});
}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {
"mp-cell": "../cell/cell",
"mp-checkbox-group": "../checkbox-group/checkbox-group"
}
}
<mp-cell
has-footer="{{!multi}}"
has-header="{{multi}}"
bindtap="checkedChange"
ext-class="weui-check__label {{outerClass}} {{extClass}} {{!multi ? '^weui-cell_radio' : '^weui-cell_checkbox'}}"
ext-hover-class="weui-active">
<view slot="icon" wx:if="{{multi}}">
<checkbox value="{{value}}" checked="{{checked}}" disabled="{{disabled}}" color="{{color}}" class="weui-check">
</checkbox>
<!-- 未勾选 -->
<icon class="weui-icon-checked"></icon>
</view>
<view>{{label}}</view>
<view slot="footer" wx:if="{{!multi}}">
<radio value="{{value}}" checked="{{checked}}" disabled="{{disabled}}" color="{{color}}" class="weui-check"></radio>
<!-- 已勾选 -->
<icon class="weui-icon-checked"></icon>
</view>
</mp-cell>
.weui-cell_radio .weui-check+.weui-icon-checked{color:transparent}.weui-check[checked]+.weui-icon-checked{color:var(--weui-BRAND);-webkit-mask-image:url(data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M8.657%2018.435L3%2012.778l1.414-1.414%204.95%204.95L20.678%205l1.414%201.414-12.02%2012.021a1%201%200%2001-1.415%200z%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E);mask-image:url(data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M8.657%2018.435L3%2012.778l1.414-1.414%204.95%204.95L20.678%205l1.414%201.414-12.02%2012.021a1%201%200%2001-1.415%200z%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E)}
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 20);
/******/ })
/************************************************************************/
/******/ ({
/***/ 20:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
multipleSlots: true,
// 在组件定义时的选项中启用多slot支持
addGlobalClass: true
},
properties: {
title: {
// 弹窗标题,也可以通过 slot 自定义
type: String,
value: ''
},
extClass: {
// 弹窗 class
type: String,
value: ''
},
maskClosable: {
type: Boolean,
value: true
},
mask: {
// 是否需要 遮罩层
type: Boolean,
value: true
},
show: {
// 是否开启弹窗
type: Boolean,
value: false,
observer: '_showChange'
},
buttons: {
type: Array,
value: [] // {text, extClass}
}
},
data: {
innerShow: false
},
ready() {
const buttons = this.data.buttons;
const len = buttons.length;
buttons.forEach((btn, index) => {
if (len === 1) {
btn.className = 'weui-dialog__btn_primary';
} else if (index === 0) {
btn.className = 'weui-dialog__btn_default';
} else {
btn.className = 'weui-dialog__btn_primary';
}
});
this.setData({
buttons
});
},
methods: {
buttonTap(e) {
const {
index
} = e.currentTarget.dataset;
this.triggerEvent('buttontap', {
index,
item: this.data.buttons[index]
}, {});
},
close() {
const data = this.data;
if (!data.maskClosable) return;
this.setData({
show: false
});
this.triggerEvent('close', {}, {});
},
stopEvent() {}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view bindtap="close" class="weui-mask {{!show ? 'weui-mask_hidden' : '' }}" wx:if="{{mask}}"></view>
<view wx:if="{{show}}" bindtap="close" class="weui-dialog__wrp {{extClass}}">
<view class="weui-dialog" catchtap="stopEvent">
<view class="weui-dialog__hd">
<view class="weui-dialog__title">{{title}}
<slot name="title"></slot>
</view>
</view>
<view class="weui-dialog__bd">
<slot></slot>
</view>
<view class="weui-dialog__ft">
<block wx:if="{{buttons && buttons.length}}">
<view wx:for="{{buttons}}" wx:key="index" class="weui-dialog__btn {{item.className}} {{item.extClass}}" hover-class="weui-active" data-index="{{index}}" bindtap="buttonTap">{{item.text}}</view>
</block>
<slot name="footer" wx:else></slot>
</view>
</view>
</view>
.weui-dialog.weui-dialog_hidden{opacity:0;transform:scale3d(1, 1, 0)}.weui-dialog{opacity:1;-webkit-transform:scale3d(1, 1, 1) translateY(-50%);transform:scale3d(1, 1, 1) translateY(-50%);transition:all .2s ease-in}.weui-mask.weui-mask_hidden{opacity:0;transform:scale3d(1, 1, 0)}.weui-mask{opacity:1;transform:scale3d(1, 1, 1);transition:all .2s ease-in}
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 2);
/******/ })
/************************************************************************/
/******/ ({
/***/ 2:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
addGlobalClass: true,
multipleSlots: true
},
properties: {
title: {
// Msg 标题
type: String,
value: ''
},
subtitle: {
// icon 的 type
type: String,
value: ''
}
},
relations: {
'../cells/cells': {
type: 'descendant',
linked(target) {
if (!this.data.firstItem) {
this.data.firstItem = target;
}
target.setOuterClass('weui-cells__group weui-cells__group_form weui-cells_form');
if (target !== this.data.firstItem) {
target.setOuterClass('weui-cells__group_wxss weui-cells__group weui-cells__group_form weui-cells_form');
}
}
}
},
data: {
firstItem: null
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="weui-form">
<block wx:if="{{title || subtitle}}">
<view class="weui-form__text-area">
<view class="weui-form__title">{{title}}</view>
<view class="weui-form__desc">{{subtitle}}</view>
</view>
</block>
<block wx:else>
<view class="weui-form__text-area">
<slot name="title"></slot>
</view>
</block>
<view class="weui-form__control-area">
<slot></slot>
</view>
<view class="weui-form__tips-area">
<slot name="tips"></slot>
</view>
<view class="weui-form__opr-area">
<slot name="button"></slot>
</view>
<view class="weui-form__tips-area">
<slot name="suffixtips"></slot>
</view>
<view class="weui-form__extra-area">
<view class="weui-footer">
<slot name="footer"></slot>
</view>
</view>
</view>
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 4);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.diffObject = exports.diff = void 0;
const diff = (old, newVal) => {
if (!old && newVal || old && !newVal) return true;
for (const k in newVal) {
if (old[k] !== newVal[k]) return true;
}
for (const k in old) {
if (old[k] !== newVal[k]) return true;
}
return false;
};
exports.diff = diff;
const diffObject = (old, newVal) => {
if (!old && newVal) return newVal;
if (!newVal && old) return old;
const diffObj = {};
let isDiff = false;
for (const k in newVal) {
if (old[k] !== newVal[k]) {
isDiff = true;
diffObj[k] = newVal[k];
}
}
for (const k in old) {
if (old[k] !== newVal[k]) {
isDiff = true;
diffObj[k] = newVal[k];
}
}
return isDiff ? diffObj : null;
};
exports.diffObject = diffObject;
/***/ }),
/* 1 */,
/* 2 */,
/* 3 */,
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _formValidator = _interopRequireDefault(__webpack_require__(5));
var _object = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function linked(target) {
if (target.data.prop) {
this.data.formItems[target.data.prop] = target;
}
if (target.setInForm) {
target.setInForm();
}
if (!this.data.firstItem) {
this.data.firstItem = target;
}
}
function unlinked(target) {
if (target.data.prop) {
delete this.data.formItems[target.data.prop];
}
}
Component({
properties: {
models: {
type: Object,
value: {},
observer: '_modelChange'
},
rules: {
// 格式是[{name, rules: {}}]
type: Array,
value: [],
observer: '_rulesChange'
},
extClass: {
type: String,
value: ''
}
},
data: {
errors: {},
formItems: {},
firstItem: null
},
relations: {
'../cell/cell': {
type: 'descendant',
linked,
unlinked
},
'../checkbox-group/checkbox-group': {
type: 'descendant',
linked,
unlinked
}
},
attached() {
this.initRules();
this.formValidator = new _formValidator.default(this.data.models, this.data.newRules);
},
methods: {
initRules(rules) {
const newRules = {};
(rules || this.data.rules).forEach(rule => {
if (rule.name && rule.rules) {
newRules[rule.name] = rule.rules || [];
}
});
this.setData({
newRules
});
return newRules;
},
_modelChange(newVal, oldVal) {
if (!this.formValidator) {
return newVal;
} // 这个必须在前面
this.formValidator.setModel(newVal);
const diffObj = (0, _object.diffObject)(oldVal, newVal);
if (diffObj) {
let isValid = true;
const errors = [];
const errorMap = {};
Object.keys(diffObj).forEach(k => {
this.formValidator.validateField(k, diffObj[k], function (isValided, error) {
if (error && error[k]) {
errors.push(error[k]);
errorMap[k] = error[k];
}
isValid = isValided;
});
});
this._showErrors(diffObj, errorMap);
this.triggerEvent(isValid ? 'success' : 'fail', isValid ? {
trigger: 'change'
} : {
errors,
trigger: 'change'
});
}
return newVal;
},
_rulesChange(newVal) {
const newRules = this.initRules(newVal);
if (this.formValidator) {
this.formValidator.setRules(newRules);
}
return newVal;
},
_showAllErrors(errors) {
Object.keys(this.data.newRules).forEach(k => {
this._showError(k, errors && errors[k]);
});
},
_showErrors(objs, errors) {
Object.keys(objs).forEach(k => {
this._showError(k, errors && errors[k]);
});
},
_showError(prop, error) {
const formItem = this.data.formItems[prop];
if (formItem && formItem.data.showError) {
formItem.setError(error);
}
},
validate(cb) {
return this.formValidator.validate((isValid, errors) => {
this._showAllErrors(errors);
const handleError = this.handleErrors(errors);
this.triggerEvent(isValid ? 'success' : 'fail', isValid ? {
trigger: 'validate'
} : {
errors: handleError,
trigger: 'validate'
});
cb && cb(isValid, handleError);
});
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
validateField(name, value, cb = (v, error = null) => {}) {
return this.formValidator.validateField(name, value, (isValid, errors) => {
this._showError(name, errors);
const handleError = this.handleErrors(errors);
this.triggerEvent(isValid ? 'success' : 'fail', isValid ? {
trigger: 'validate'
} : {
errors: handleError,
trigger: 'validate'
});
cb && cb(isValid, handleError);
});
},
handleErrors(errors) {
if (errors) {
const newErrors = [];
this.data.rules.forEach(rule => {
if (errors[rule.name]) {
errors[rule.name].name = rule.name;
newErrors.push(errors[rule.name]);
}
});
return newErrors;
}
return errors;
},
addMethod(ruleName, method) {
return this.formValidator.addMethod(ruleName, method);
}
}
});
var _default = _formValidator.default;
exports.default = _default;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _validator = _interopRequireDefault(__webpack_require__(6));
var _object = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
const toString = Object.prototype.toString;
const validateSingleRule = (rule, value, param = null, models = null) => {
let message = '';
const ruleKeys = Object.keys(rule);
for (let i = 0, l = ruleKeys.length; i < l; ++i) {
const ruleKey = ruleKeys[i];
if (ruleKey === 'name' || ruleKey === 'message') continue;
const validateMethod = typeof rule.validator !== 'undefined' ? rule.validator : _validator.default[ruleKey];
if (typeof validateMethod === 'function') {
message = validateMethod(rule, value, param, models);
if (message) {
return message;
}
}
}
return message;
};
class FormValidator {
constructor(models, rules) {
_defineProperty(this, "models", void 0);
_defineProperty(this, "rules", void 0);
_defineProperty(this, "errors", void 0);
this.models = models;
this.rules = rules;
this.errors = {};
}
validate(cb) {
return new Promise(resolve => {
let failCount = 0;
const errors = this.errors;
const models = this.models;
let errorChanged = false;
Object.keys(this.rules).forEach(fieldName => {
const oldError = errors[fieldName];
this._innerValidateField(fieldName, models[fieldName], (valid, newError) => {
if (!valid) failCount++;
if ((0, _object.diff)(oldError, newError)) {
errors[fieldName] = newError;
errorChanged = true;
}
});
});
const keys = Object.keys(errors);
keys.forEach(key => {
if (!errors[key]) delete errors[key];
}); // 先支持同步的接口吧
resolve({
isValid: !failCount,
errors: failCount ? errors : undefined
});
cb && cb(!failCount, failCount ? errors : undefined);
});
}
validateField(name, value, cb) {
return new Promise(resolve => {
this._innerValidateField(name, value, (valid, error) => {
const errObj = {};
errObj[name] = error;
resolve({
valid,
error: valid ? undefined : error
});
cb && cb(valid, valid ? undefined : errObj);
const oldError = this.errors[name];
const errorChanged = (0, _object.diff)(oldError, error);
if (errorChanged) {
if (!error) delete this.errors[name];
this.errors[name] = error;
}
});
});
}
_innerValidateField(name, value, cb) {
const rules = this.rules[name];
if (!rules) {
console.warn(`[form-validator] rule name ${name} not exists.`);
cb(true);
return;
} // 处理参数
if (typeof value === 'function') {
cb = value;
value = undefined;
}
let isFail = false;
const models = this.models;
if (toString.call(rules) === '[object Array]') {
rules.forEach(rule => {
rule.name = name; // 字段名称
const resMessage = validateSingleRule(rule, value || models[name], rule.param, models); // 失败了直接中止
if (resMessage && !isFail) {
isFail = true; // errors[name] = {message: resMessage}
const error = resMessage ? {
message: resMessage,
rule
} : undefined;
cb(false, error);
}
}); // 成功的回调
if (!isFail) {
cb(!isFail);
}
} else {
const rule = rules;
rule.name = name;
const resMessage = validateSingleRule(rule, value || models[name], rule.param, models);
const error = resMessage ? {
message: resMessage,
rule
} : undefined;
if (resMessage) {
isFail = true;
}
cb(!isFail, error);
}
}
static addMethod(ruleName, method) {
_validator.default[ruleName] = method;
}
setModel(newModel) {
this.models = newModel;
}
setRules(newRules) {
this.rules = newRules;
}
}
var _default = FormValidator;
exports.default = _default;
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _string = __webpack_require__(7);
const defaultMessage = {
required: '%s必填',
minlength: '长度最少为%s',
maxlength: '长度最大为%s',
rangelength: '长度在%s和%s之间',
bytelength: '最多只能输入%s个字',
min: '值最小为%s',
max: '值最大为%s',
range: '值的范围为%s和%s之间',
mobile: '请输入正确的手机号',
email: '请输入正确的电子邮件',
url: '请输入正确的URL地址',
equalTo: '值和字段%s不相等'
};
const isEmpty = function (val) {
if (val === 0 || val === false) return false;
return !val;
};
var _default = {
required(r, val) {
if (r.required === false) return '';else if (isEmpty(val)) return (0, _string.sprintf)(r.message || defaultMessage.required, r.name);else return '';
},
minlength(r, val) {
const minlen = r.minlength;
val = val || '';
if (val.length < minlen) return (0, _string.sprintf)(r.message || defaultMessage.minlength, minlen);else return '';
},
maxlength(r, val) {
const maxlen = r.maxlength;
val = val || '';
if (val.length > maxlen) {
return (0, _string.sprintf)(r.message || defaultMessage.maxlength, maxlen);
} else {
return '';
}
},
rangelength(r, val) {
const range = r.rangelength;
val = val || '';
if (val.length > range[1] || val.length < range[0]) {
return (0, _string.sprintf)(r.message || defaultMessage.rangelength, range[0], range[1]);
} else {
return '';
}
},
min(r, val) {
const min = r.min;
if (val < min) {
return (0, _string.sprintf)(r.message || defaultMessage.min, min);
} else {
return '';
}
},
max(r, val) {
const max = r.max;
if (val > max) {
return (0, _string.sprintf)(r.message || defaultMessage.max, max);
} else {
return '';
}
},
range(r, val) {
const range = r.range;
if (val < range[0] || val > range[1]) {
return (0, _string.sprintf)(r.message || defaultMessage.range, range[0], range[1]);
} else {
return '';
}
},
mobile(r, val) {
val = val || '';
if (r.mobile === false) {
return '';
} else if (val.length !== 11) {
return (0, _string.sprintf)(r.message || defaultMessage.mobile);
} else {
return '';
}
},
email(r, value) {
if (r.email === false) return ''; // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
// eslint-disable-next-line
if (!/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(value)) {
return (0, _string.sprintf)(r.message || defaultMessage.email);
} else {
return '';
}
},
// http://docs.jquery.com/Plugins/Validation/Methods/url
url(r, value) {
if (r.url === false) return ''; // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
if ( // eslint-disable-next-line no-useless-escape
!/^(https?|s?ftp|weixin):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value)) {
return r.message || defaultMessage.url;
} else {
return '';
}
},
equalTo(r, value, param, models) {
const equalTo = r.equalTo;
if (value !== models[equalTo]) {
return (0, _string.sprintf)(r.message || defaultMessage.equalTo, r.name);
} else {
return '';
}
},
bytelength(r, value, param) {
param = r.param;
value = value || ''; // eslint-disable-next-line no-control-regex
const len = value.replace(/[^\x00-\xff]/g, '**').length;
if (len > param) {
return (0, _string.sprintf)(r.message || defaultMessage.bytelength, param);
} else {
return '';
}
}
};
exports.default = _default;
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.sprintf = void 0;
/**
* 占位替换
* @method sprintf
* @method String.prototype.sprintf
* @example
* "my name is %s %s".sprintf("a","b") =》"my name is a b"
*/
const sprintf = (...args) => {
let i;
let result = args[0] || '';
let para;
let reg;
const length = args.length - 1;
if (length < 1) {
return result;
}
i = 1;
while (i < length + 1) {
result = result.replace(/%s/, '{#' + i + '#}');
i++;
}
result.replace('%s', '');
i = 1; // eslint-disable-next-line
while (true) {
para = args[i];
if (para === undefined) {
// 0 也是可能的替换数字
break;
}
reg = new RegExp('{#' + i + '#}', 'g');
result = result.replace(reg, para);
i++;
}
return result;
};
exports.sprintf = sprintf;
/***/ })
/******/ ]);
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="{{extClass}}">
<slot></slot>
</view>
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 21);
/******/ })
/************************************************************************/
/******/ ({
/***/ 21:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
addGlobalClass: true
},
properties: {
imgUrls: {
type: Array,
value: [],
observer(newVal) {
this.setData({
currentImgs: newVal
});
}
},
showDelete: {
// 是否显示delete按钮
type: Boolean,
value: true
},
show: {
type: Boolean,
value: true
},
current: {
type: Number,
value: 0
},
hideOnClick: {
type: Boolean,
value: true
},
extClass: {
type: String,
value: ''
}
},
data: {
currentImgs: []
},
ready() {
const data = this.data;
this.setData({
currentImgs: data.imgUrls
});
},
methods: {
change(e) {
this.setData({
current: e.detail.current
});
this.triggerEvent('change', {
current: e.detail.current
}, {});
},
deleteImg() {
const data = this.data;
const imgs = data.currentImgs;
const url = imgs.splice(data.current, 1);
this.triggerEvent('delete', {
url: url[0],
index: data.current
}, {});
if (imgs.length === 0) {
// @ts-ignore
this.hideGallery();
return;
}
this.setData({
current: 0,
currentImgs: imgs
});
},
hideGallery() {
const data = this.data;
if (data.hideOnClick) {
this.setData({
show: false
});
this.triggerEvent('hide', {}, {});
}
}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="weui-gallery {{show ? 'weui-gallery_show' : ''}} {{extClass}}">
<view class="weui-gallery__info">{{current+1}}/{{currentImgs.length}}</view>
<swiper class="weui-gallery__img__wrp" bindtap="hideGallery" indicator-dots="{{false}}" bindchange="change" current="{{current}}" autoplay="{{false}}" duration="{{500}}">
<block wx:for="{{currentImgs}}" wx:key="index">
<swiper-item>
<image mode="aspectFit" class="weui-gallery__img" src="{{item}}"></image>
</swiper-item>
</block>
</swiper>
<view class="weui-gallery__opr" wx:if="{{showDelete}}">
<navigator bindtap="deleteImg" class="weui-gallery__del">删除</navigator>
</view>
</view>
.weui-gallery{display:none}.weui-gallery_show.weui-gallery{display:flex}
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 23);
/******/ })
/************************************************************************/
/******/ ({
/***/ 23:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
const defaultGridProps = {
target: 'self',
url: '',
openType: 'navigate',
delta: 1,
appId: '',
path: '',
extraData: '',
version: 'release',
hoverClass: 'navigator-hover',
hoverStopPropagation: false,
hoverStartTime: 50,
hoverStayTime: 600,
bindsuccess: () => {},
bindfail: () => {},
bindcomplete: () => {}
};
Component({
options: {
addGlobalClass: true,
pureDataPattern: /^_/
},
properties: {
extClass: {
type: String,
value: ''
},
grids: {
type: Array,
value: [],
observer: '_onGridsChange'
}
},
data: {
innerGrids: []
},
ready() {},
methods: {
_onGridsChange(grids) {
if (grids) {
this.setData({
innerGrids: grids.map(grid => Object.assign({}, defaultGridProps, grid))
});
}
}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="weui-grids {{extClass}}">
<block wx:for="{{innerGrids}}" wx:key="index">
<navigator
class="weui-grid"
target="{{item.target}}"
url="{{item.url}}"
open-type="{{item.openType}}"
app-id="{{item.appId}}"
path="{{item.path}}"
extra-data="{{item.extraData}}"
version="{{item.version}}"
hover-class="{{item.hoverClass}}"
hover-stop-propagation="{{item.hoverStopPropagation}}"
hover-start-time="{{item.hoverStartTime}}"
hover-stay-time="{{item.hoverStayTime}}"
bindsuccess="{{item.bindsuccess}}"
bindfail="{{item.bindfail}}"
bindcomplete="{{item.bindcomplete}}"
>
<view class="weui-grid__icon">
<image class="weui-grid__icon_img" src="{{item.imgUrl}}" alt></image>
</view>
<view class="weui-grid__label">{{item.text}}</view>
</navigator>
</block>
</view>
\ No newline at end of file
.weui-grid .weui-grid__icon_img{width:100%;height:100%}
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 17);
/******/ })
/************************************************************************/
/******/ ({
/***/ 17:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
multipleSlots: true,
// 在组件定义时的选项中启用多slot支持
addGlobalClass: true
},
properties: {
closabled: {
// 是否具有关闭标签
type: Boolean,
value: true
},
title: {
// 标题,也可以通过 slot 自定义
type: String,
value: ''
},
subTitle: {
// 副标题,也可以通过 slot 自定义
type: String,
value: ''
},
extClass: {
// 弹窗 class
type: String,
value: ''
},
desc: {
type: String,
value: ''
},
tips: {
type: String,
value: ''
},
maskClosable: {
type: Boolean,
value: true
},
mask: {
// 是否需要 遮罩层
type: Boolean,
value: true
},
show: {
// 是否开启弹窗
type: Boolean,
value: false,
observer: '_showChange'
},
buttons: {
type: Array,
value: [] // {text, extClass}
}
},
methods: {
close(e) {
const {
type
} = e.currentTarget.dataset;
if (this.data.maskClosable || type === 'close') {
this.setData({
show: false
}); // 关闭弹窗回调事件
this.triggerEvent('close');
}
},
buttonTap(e) {
const {
index
} = e.currentTarget.dataset;
this.triggerEvent('buttontap', {
index,
item: this.data.buttons[index]
}, {});
},
onMaskMouseMove(e) {// do nothing
}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="{{show ? 'weui-show' :'weui-hidden'}}">
<view class="weui-mask init" wx:if="{{mask}}" bindtap="close" catch:touchmove="onMaskMouseMove" data-type="tap"></view>
<view class="weui-half-screen-dialog {{extClass}}">
<view class="weui-half-screen-dialog__hd">
<view wx:if="{{closabled}}" class="weui-half-screen-dialog__hd__side" bindtap="close" data-type="close">
<view class="weui-icon-btn weui-icon-btn_close" hover-class="weui-active">关闭</view>
</view>
<view class="weui-half-screen-dialog__hd__main">
<block wx:if="{{title}}">
<text class="weui-half-screen-dialog__title">{{title}}</text>
<text class="weui-half-screen-dialog__subtitle">{{subTitle}}</text>
</block>
<block wx:else>
<view class="weui-half-screen-dialog__title"><slot name="title"></slot></view>
</block>
</view>
<view class="weui-half-screen-dialog__hd__side">
<view class="weui-icon-btn weui-icon-btn_more" hover-class="weui-active">更多</view>
</view>
</view>
<view class="weui-half-screen-dialog__bd">
<block wx:if="{{desc}}">
<view class="weui-half-screen-dialog__desc">{{desc}}</view>
<view class="weui-half-screen-dialog__tips">{{tips}}</view>
</block>
<slot name="desc" wx:else></slot>
</view>
<view class="weui-half-screen-dialog__ft">
<block wx:if="{{buttons && buttons.length}}">
<button
wx:for="{{buttons}}"
wx:key="index"
type="{{item.type}}"
class="weui-btn {{item.className}}"
data-index="{{index}}"
bindtap="buttonTap"
>{{item.text}}</button>
</block>
<slot name="footer" wx:else></slot>
</view>
</view>
</view>
\ No newline at end of file
.weui-mask,.weui-half-screen-dialog{transition:all .3s}.weui-hidden .weui-mask{visibility:hidden;opacity:0}.weui-hidden .weui-half-screen-dialog{transform:translateY(100%)}.weui-show .weui-mask{opacity:1;visibility:visible}.weui-show .weui-half-screen-dialog{transform:translateY(0%)}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<wxs module="utils">
var double = function(a) {
return 2*a
};
var ifSpecialIcon = function(v) {
return v === 'arrow' || v === 'back'
}
module.exports = {
double: double,
ifSpecialIcon: ifSpecialIcon
}
</wxs>
<view class="{{extClass}} weui-icon" style="background:{{color}};width:{{size}}px;height:{{ utils.ifSpecialIcon(icon) ? utils.double(size) : size}}px;mask-image:url({{src}});-webkit-mask-image:url({{src}});-moz-mask-image:url({{src}})"></view>
.weui-icon{vertical-align:middle;display:inline-block;background:black;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;-moz-mask-repeat:no-repeat;mask-size:cover;-webkit-mask-size:cover;-moz-mask-size:cover}
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 27);
/******/ })
/************************************************************************/
/******/ ({
/***/ 27:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
/***/ })
/******/ });
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 14);
/******/ })
/************************************************************************/
/******/ ({
/***/ 14:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
addGlobalClass: true
},
properties: {
extClass: {
type: String,
value: ''
},
show: {
// 默认显示出来
type: Boolean,
value: true,
observer(newValue) {
this._computedStyle(newValue, this.data.animated);
}
},
animated: {
type: Boolean,
value: false,
observer(newValue) {
this._computedStyle(this.data.show, newValue);
}
},
duration: {
// 过渡动画时间
type: Number,
value: 350
},
type: {
type: String,
value: 'dot-gray' // 取值dot-white、dot-gray、circle
},
tips: {
// type是circle的时候才有效
type: String,
value: '加载中'
}
},
data: {
animationData: {},
animationInstance: {},
displayStyle: 'none'
},
methods: {
_computedStyle(show, animated) {
if (!show) {
if (!animated) {
this.setData({
displayStyle: 'none'
});
} else {
this._startAnimation();
}
} else {
this.setData({
displayStyle: ''
});
}
},
_startAnimation() {
setTimeout(() => {
const data = this.data;
const animation = data.animationInstance;
animation.height(0).step();
this.setData({
animationData: animation.export()
});
}, 0);
}
},
lifetimes: {
attached() {
const data = this.data;
const animationInstance = wx.createAnimation({
duration: data.duration,
timingFunction: 'ease'
});
this.setData({
animationInstance
});
this._computedStyle(this.data.show, this.data.animated);
}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view style="display:{{displayStyle}};" class="wx_loading_view {{extClass}}" animation="{{animationData}}" id="wx_loading_view">
<view wx:if="{{type==='dot-white'}}" class="loading wx_dot_loading wx_dot_loading_white">
</view>
<view wx:elif="{{type==='dot-gray'}}" class="loading wx_dot_loading"></view>
<view wx:elif="{{type==='circle'}}" class="weui-loadmore">
<view class="weui-loading"></view>
<view class="weui-loadmore__tips">{{tips}}</view>
</view>
</view>
\ No newline at end of file
.wx_loading_view{display:flex;justify-content:center;align-items:center;overflow:hidden}.loading{color:rgba(255,255,255,0.9);font-size:17px;text-align:center}.loading_view_translation{transition:height .2s .3s ease}
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 19);
/******/ })
/************************************************************************/
/******/ ({
/***/ 19:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
addGlobalClass: true,
multipleSlots: true
},
properties: {
title: {
// Msg 标题
type: String,
value: ''
},
type: {
// icon 的 type
type: String,
value: ''
},
icon: {
// 可以自行设置 icon, 设置icon 之后,type 失效
type: String,
value: ''
},
desc: {
// 描述
type: String,
value: ''
},
extClass: {
type: String,
value: ''
},
size: {
// 可以自行设置 icon, 设置icon 之后,type 失效
type: Number,
value: 64
}
},
data: {}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="weui-msg {{extClass}}">
<view class="weui-msg__icon-area">
<icon type="{{type}}" size="{{size}}" wx:if="{{type}}"></icon>
<image class="weui-msg__icon-img" src="{{icon}}" mode="aspectFit" wx:elif="{{icon}}" />
</view>
<view class="weui-msg__text-area">
<view class="weui-msg__title">{{title}}</view>
<view class="weui-msg__desc">
{{desc}}
<slot name="desc" wx:if="{{!desc}}"></slot>
</view>
<slot name="extend"></slot>
</view>
<view class="weui-msg__opr-area">
<view class="weui-btn-area">
<slot name="handle"></slot>
</view>
</view>
<view class="weui-msg__tips-area">
<view class="weui-msg__tips">
<slot name="tips"></slot>
</view>
</view>
<view class="weui-msg__extra-area">
<view class="weui-footer">
<slot name="footer"></slot>
</view>
</view>
</view>
.weui-msg__icon-img{width:190rpx;height:190rpx}
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 3);
/******/ })
/************************************************************************/
/******/ ({
/***/ 3:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
multipleSlots: true,
// 在组件定义时的选项中启用多slot支持
addGlobalClass: true
},
/**
* 组件的属性列表
*/
properties: {
extClass: {
type: String,
value: ''
},
title: {
type: String,
value: ''
},
background: {
type: String,
value: ''
},
color: {
type: String,
value: ''
},
back: {
type: Boolean,
value: true
},
loading: {
type: Boolean,
value: false
},
animated: {
// 显示隐藏的时候opacity动画效果
type: Boolean,
value: true
},
show: {
// 显示隐藏导航,隐藏的时候navigation-bar的高度占位还在
type: Boolean,
value: true,
observer: '_showChange'
},
// back为true的时候,返回的页面深度
delta: {
type: Number,
value: 1
}
},
/**
* 组件的初始数据
*/
data: {
displayStyle: ''
},
attached() {
const isSupport = !!wx.getMenuButtonBoundingClientRect;
const rect = wx.getMenuButtonBoundingClientRect ? wx.getMenuButtonBoundingClientRect() : null;
wx.getSystemInfo({
success: res => {
const ios = !!(res.system.toLowerCase().search('ios') + 1);
this.setData({
ios,
statusBarHeight: res.statusBarHeight,
innerWidth: isSupport ? `width:${rect.left}px` : '',
innerPaddingRight: isSupport ? `padding-right:${res.windowWidth - rect.left}px` : '',
leftWidth: isSupport ? `width:${res.windowWidth - rect.left}px` : ''
});
}
});
},
/**
* 组件的方法列表
*/
methods: {
_showChange(show) {
const animated = this.data.animated;
let displayStyle = '';
if (animated) {
displayStyle = `opacity: ${show ? '1' : '0'};-webkit-transition:opacity 0.5s;transition:opacity 0.5s;`;
} else {
displayStyle = `display: ${show ? '' : 'none'}`;
}
this.setData({
displayStyle
});
},
back() {
const data = this.data;
if (data.delta) {
wx.navigateBack({
delta: data.delta
});
}
this.triggerEvent('back', {
delta: data.delta
}, {});
}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="weui-navigation-bar {{extClass}}">
<view class="weui-navigation-bar__placeholder {{ios ? 'ios' : 'android'}}" style="padding-top: {{statusBarHeight}}px;visibility: hidden;"></view>
<view class="weui-navigation-bar__inner {{ios ? 'ios' : 'android'}}" style="padding-top: {{statusBarHeight}}px; color: {{color}};background: {{background}};{{displayStyle}};{{innerPaddingRight}};{{innerWidth}};">
<view class='weui-navigation-bar__left' style="{{leftWidth}}">
<block wx:if="{{back}}">
<view class="weui-navigation-bar__buttons">
<view bindtap="back" class="weui-navigation-bar__button weui-navigation-bar__btn_goback" hover-class="weui-active"></view>
</view>
</block>
<block wx:else>
<slot name="left"></slot>
</block>
</view>
<view class='weui-navigation-bar__center'>
<view wx:if="{{loading}}" class="weui-navigation-bar__loading">
<view class="weui-loading" style="width:{{size.width}}rpx;height:{{size.height}}rpx;"></view>
</view>
<block wx:if="{{title}}">
<text>{{title}}</text>
</block>
<block wx:else>
<slot name="center"></slot>
</block>
</view>
<view class='weui-navigation-bar__right'>
<slot name="right"></slot>
</view>
</view>
</view>
{
"name": "weui-miniprogram",
"version": "1.0.6",
"description": "小程序 WeUI 组件库",
"author": "xushengni,tomylin,cunjinli,rockhou",
"license": "MIT"
}
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 26);
/******/ })
/************************************************************************/
/******/ ({
/***/ 26:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
addGlobalClass: true
},
properties: {
extClass: {
type: String,
value: ''
},
focus: {
type: Boolean,
value: false
},
placeholder: {
type: String,
value: '搜索'
},
value: {
type: String,
value: ''
},
search: {
// 返回Promise的函数
// @ts-ignore
type: Function,
value: null
},
throttle: {
// 500ms内只会调用一次search函数
type: Number,
value: 500
},
cancelText: {
type: String,
value: '取消'
},
cancel: {
type: Boolean,
value: true
}
},
data: {
result: [] // 搜索结果
},
/* @ts-ignore */
lastSearch: Date.now(),
lifetimes: {
// @ts-ignore
attached() {
// @ts-ignore
if (this.data.focus) {
this.setData({
searchState: true
});
}
}
},
methods: {
clearInput() {
// @ts-ignore
this.setData({
value: '',
focus: true,
result: []
}); // @ts-ignore
this.triggerEvent('clear');
},
// @ts-ignore
inputFocus(e) {
// this.setData({
// searchState: true
// })
// @ts-ignore
this.triggerEvent('focus', e.detail);
},
// @ts-ignore
inputBlur(e) {
this.setData({
focus: false
});
this.triggerEvent('blur', e.detail);
},
showInput() {
this.setData({
focus: true,
searchState: true
});
},
hideInput() {
this.setData({
searchState: false
});
this.triggerEvent('cancel');
},
// @ts-ignore
inputChange(e) {
this.setData({
value: e.detail.value
});
this.triggerEvent('input', e.detail);
if (Date.now() - this.lastSearch < this.data.throttle) {
return;
}
if (typeof this.data.search !== 'function') {
return;
}
this.lastSearch = Date.now();
this.timerId = setTimeout(() => {
this.data.search(this.data.value).then(json => {
this.setData({
result: json
});
}).catch(err => {
console.error('search error', err);
});
}, this.data.throttle);
},
// @ts-ignore
selectResult(e) {
const {
index
} = e.currentTarget.dataset;
const item = this.data.result[index];
this.triggerEvent('selectresult', {
index,
item
});
}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {
"mp-cells": "../cells/cells",
"mp-cell": "../cell/cell"
}
}
\ No newline at end of file
<view class="weui-search-bar {{searchState ? 'weui-search-bar_focusing' : ''}} {{extClass}}">
<view class="weui-search-bar__form">
<view class="weui-search-bar__box">
<icon class="weui-icon-search" type="search" size="12"></icon>
<input type="text" class="weui-search-bar__input" placeholder="{{placeholder}}" value="{{value}}" focus="{{focus}}" bindblur="inputBlur" bindfocus="inputFocus" bindinput="inputChange" />
<text class="weui-icon-clear" hover-class="weui-active" wx:if="{{value.length > 0}}" bindtap="clearInput"></text>
</view>
<label class="weui-search-bar__label" bindtap="showInput">
<icon class="weui-icon-search" type="search" size="12"></icon>
<text class="weui-search-bar__text">搜索</text>
</label>
</view>
<view wx:if="{{cancel && searchState}}" class="weui-search-bar__cancel-btn" bindtap="hideInput">{{cancelText}}</view>
</view>
<mp-cells ext-class=" {{'searchbar-result ' + extClass}}" wx:if="{{searchState && result.length > 0}}">
<mp-cell class="result" bindtap="selectResult" body-class="weui-cell_primary" data-index="{{index}}" wx:for="{{result}}" wx:key="index" hover>
<view>{{item.text}}</view>
</mp-cell>
</mp-cells>
\ No newline at end of file
.weui-search-bar__label text{display:inline-block;font-size:14px;vertical-align:middle}
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 18);
/******/ })
/************************************************************************/
/******/ ({
/***/ 18:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
/**
* 组件的属性列表
*/
options: {
addGlobalClass: true,
multipleSlots: true
},
properties: {
extClass: {
type: String,
value: ''
},
buttons: {
type: Array,
value: [],
// type, data, text, src, extClass
observer() {
this.addClassNameForButton();
}
},
disable: {
type: Boolean,
value: false
},
icon: {
// 是否是icon
type: Boolean,
value: false
},
show: {
type: Boolean,
value: false
},
duration: {
type: Number,
value: 350 // 动画市场,单位ms
},
throttle: {
type: Number,
value: 40
},
rebounce: {
type: Number,
value: 0 // 回弹距离
}
},
/**
* 组件的初始数据
*/
data: {
size: null
},
/**
* 组件的方法列表
*/
ready() {
// @ts-ignore
this.updateRight();
this.addClassNameForButton();
},
methods: {
updateRight() {
// 获取右侧滑动显示区域的宽度
const data = this.data;
const query = wx.createSelectorQuery().in(this);
query.select('.left').boundingClientRect(res => {
const btnQuery = wx.createSelectorQuery().in(this);
btnQuery.selectAll('.btn').boundingClientRect(rects => {
this.setData({
size: {
buttons: rects,
button: res,
show: data.show,
disable: data.disable,
throttle: data.throttle,
rebounce: data.rebounce
}
});
}).exec();
}).exec();
},
addClassNameForButton() {
// @ts-ignore
const {
buttons,
icon
} = this.data;
buttons.forEach(btn => {
if (icon) {
btn.className = '';
} else if (btn.type === 'warn') {
btn.className = 'weui-slideview__btn-group_warn';
} else {
btn.className = 'weui-slideview__btn-group_default';
}
});
this.setData({
buttons
});
},
buttonTapByWxs(data) {
this.triggerEvent('buttontap', data, {});
},
hide() {
this.triggerEvent('hide', {}, {});
},
show() {
this.triggerEvent('show', {}, {});
},
transitionEnd() {}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!-- slide-view/slide-view.wxml -->
<wxs module="handler" src="./slideview.wxs"></wxs>
<view class="weui-slideview weui-movable-view {{icon ? 'weui-slideview_icon' : ''}} {{extClass}}" style="width: 100%;height: 100%;">
<view bindtransitionend="{{handler.transitionEnd}}"
show="{{show}}" change:show="{{handler.showChange}}"
rebounce="{{rebounce}}" change:rebounce="{{handler.rebounceChange}}"
duration="{{duration}}" change:duration="{{handler.durationChange}}"
change:disable="{{handler.disableChange}}" disable="{{disable}}"
change:prop="{{handler.sizeReady}}" prop="{{size}}"
bindtouchstart="{{handler.touchstart}}" bindtouchmove="{{handler.touchmove}}" bindtouchend="{{handler.touchend}}" class="weui-slideview__left left" style="width:100%;">
<slot></slot>
</view>
<view class="weui-slideview__right right">
<view class="weui-slideview__buttons" style="height:100%;width:100%;" wx:if="{{buttons && buttons.length}}">
<view wx:for="{{buttons}}" wx:key="index" class='btn weui-slideview__btn__wrp {{item.className}} {{item.extClass}}'>
<view bindtap="{{handler.hideButton}}" data-data="{{item.data}}" data-index="{{index}}" class='weui-slideview__btn'>
<text wx:if="{{!icon}}">{{item.text}}</text>
<image class="weui-slideview__btn__icon" wx:else src="{{item.src}}"/>
</view>
</view>
</view>
</view>
</view>
/* eslint-disable */
var touchstart = function(event, ownerInstance) {
var ins = event.instance
var st = ins.getState()
if (st.disable) return // disable的逻辑
// console.log('touchstart st', JSON.stringify(st))
if (!st.size) return
// console.log('touchstart', JSON.stringify(event))
st.isMoving = true
st.startX = event.touches[0].pageX
st.startY = event.touches[0].pageY
st.firstAngle = 0
}
var touchmove = function(event, ownerInstance) {
var ins = event.instance
var st = ins.getState()
if (!st.size || !st.isMoving) return
// console.log('touchmove', JSON.stringify(event))
var pagex = event.touches[0].pageX - st.startX
var pagey = event.touches[0].pageY - st.startY
// 左侧45度角为界限,大于45度则允许水平滑动
if (st.firstAngle === 0) {
st.firstAngle = Math.abs(pagex) - Math.abs(pagey)
}
if (st.firstAngle < 0) {
return
}
var movex = pagex > 0 ? Math.min(st.max, pagex) : Math.max(-st.max, pagex)
// 往回滑动的情况
if (st.out) {
// 已经是划出来了,还要往左滑动,忽略
if (movex < 0) return
ins.setStyle({
'transform': 'translateX(' + (st.transformx + movex) + 'px)',
'transition': ''
})
var btns = ownerInstance.selectAllComponents('.btn')
var transformTotal = 0
var len = btns.length
var i = len - 1;
for (;i >= 0; i--) {
var transform = st.size.buttons[i].width / st.max * movex
var transformx = st.size.buttons[i].max - Math.min(st.size.buttons[i].max, transform + transformTotal)
btns[i].setStyle({
'transform': 'translateX(' + (-transformx) + 'px)',
'transition': ''
})
transformTotal += transform
}
return false
}
if (movex > 0) movex = 0
ins.setStyle({
'transform': 'translateX(' + movex + 'px)',
'transition': ''
})
st.transformx = movex
var btns = ownerInstance.selectAllComponents('.btn')
var transformTotal = 0
var len = btns.length
var i = len - 1;
for (;i >= 0; i--) {
var transform = st.size.buttons[i].width / st.max * movex
var transformx = Math.max(-st.size.buttons[i].max, transform + transformTotal)
btns[i].setStyle({
'transform': 'translateX(' + transformx + 'px)',
'transition': ''
})
st.size.buttons[i].transformx = transformx
transformTotal += transform
}
return false // 禁止垂直方向的滑动
}
var touchend = function(event, ownerInstance) {
var ins = event.instance
var st = ins.getState()
if (!st.size || !st.isMoving) return
// 左侧45度角为界限,大于45度则允许水平滑动
if (st.firstAngle < 0) {
return
}
var duration = st.duration / 1000
st.isMoving = false
// console.log('touchend', JSON.stringify(event))
var btns = ownerInstance.selectAllComponents('.btn')
var len = btns.length
var i = len - 1
// console.log('len size', len)
if (Math.abs(event.changedTouches[0].pageX - st.startX) < st.throttle || event.changedTouches[0].pageX - st.startX > 0) { // 方向也要控制
st.out = false
ins.setStyle({
'transform': 'translate3d(0px, 0, 0)',
'transition': 'transform ' + (duration) + 's'
})
for (;i >= 0; i--) {
btns[i].setStyle({
'transform': 'translate3d(0px, 0, 0)',
'transition': 'transform ' + (duration) + 's'
})
}
ownerInstance.callMethod('hide')
return
}
showButtons(ins, ownerInstance, duration)
ownerInstance.callMethod('show')
}
var REBOUNCE_TIME = 0.2
var showButtons = function(ins, ownerInstance, withDuration) {
var st = ins.getState()
if (!st.size) return
var rebounceTime = st.rebounce ? REBOUNCE_TIME : 0
var movex = st.max
st.out = true
var btns = ownerInstance.selectAllComponents('.btn')
var rebounce = st.rebounce || 0
var len = btns.length
var i = len - 1
ins.setStyle({
'transform': 'translate3d(' + (-movex - rebounce) + 'px, 0, 0)',
'transition': 'transform ' + (withDuration) + 's'
})
st.transformx = -movex
var transformTotal = 0
for (;i >= 0; i--) {
var transform = st.size.buttons[i].width / st.max * movex
var transformx = (-(transform + transformTotal))
btns[i].setStyle({
'transform': 'translate3d(' + transformx + 'px, 0, 0)',
'transition': 'transform ' + (withDuration ? withDuration + rebounceTime : withDuration) + 's'
})
st.size.buttons[i].transformx = transformx
transformTotal += transform
}
}
var innerHideButton = function(ownerInstance) {
var ins = ownerInstance.selectComponent('.left')
var st = ins.getState()
if (!st.size) return
var duration = st.duration ? st.duration / 1000 : 0
var btns = ownerInstance.selectAllComponents('.btn')
var len = btns.length
var i = len - 1
ins.setStyle({
'transform': 'translate3d(0px, 0, 0)',
'transition': 'transform ' + (duration) + 's'
})
st.transformx = 0
for (;i >= 0; i--) {
btns[i].setStyle({
'transform': 'translate3d(0px, 0, 0)',
'transition': 'transform ' + (duration) + 's'
})
st.size.buttons[i].transformx = 0
}
}
var hideButton = function(event, ownerInstance) {
innerHideButton(ownerInstance)
ownerInstance.callMethod('buttonTapByWxs', {index: event.currentTarget.dataset.index, data: event.currentTarget.dataset.data})
return false
}
var sizeReady = function(newVal, oldVal, ownerInstance, ins) {
var st = ins.getState()
// st.disable = newVal && newVal.disable
if (newVal && newVal.button && newVal.buttons) {
st.size = newVal
st.transformx = 0
// var min = newVal.button.width
var max = 0
var len = newVal.buttons.length
var i = newVal.buttons.length - 1;
var total = 0
for (; i >= 0; i--) {
max += newVal.buttons[i].width
// if (min > newVal.buttons[i]) {
// min = newVal.buttons[i].width
// }
total += newVal.buttons[i].width
newVal.buttons[i].max = total
newVal.buttons[i].transformx = 0
}
st.throttle = st.size.throttle || 40 // 固定值
st.rebounce = st.size.rebounce
st.max = max
ownerInstance.selectComponent('.right').setStyle({
'line-height': newVal.button.height + 'px',
left: (newVal.button.width) + 'px',
width: max + 'px'
})
// console.log('st size', JSON.stringify(newVal))
if (!st.size.disable && st.size.show) {
showButtons(ins, ownerInstance)
}
}
}
var disableChange = function(newVal, oldVal, ownerInstance, ins) {
var st = ins.getState()
st.disable = newVal
}
var durationChange = function(newVal, oldVal, ownerInstance, ins) {
var st = ins.getState()
st.duration = newVal || 400
}
var showChange = function(newVal, oldVal, ownerInstance, ins) {
var st = ins.getState()
st.show = newVal
if (st.disable) return
// console.log('show change')
if (st.show) {
showButtons(ins, ownerInstance, st.duration)
} else {
innerHideButton(ownerInstance)
}
}
var rebounceChange = function(newVal, oldVal, ownerInstance, ins) {
var st = ins.getState()
// console.log('rebounce', st.rebounce)
st.rebounce = newVal
}
var transitionEnd = function(event, ownerInstance) {
// console.log('transition')
var ins = event.instance
var st = ins.getState()
// 回弹效果
if (st.out && st.rebounce) {
// console.log('transition rebounce', st.rebounce)
ins.setStyle({
'transform': 'translate3d(' + (-st.max) + 'px, 0, 0)',
'transition': 'transform ' + REBOUNCE_TIME +'s'
})
}
}
module.exports = {
touchstart: touchstart,
touchmove: touchmove,
touchend: touchend,
hideButton: hideButton,
sizeReady: sizeReady,
disableChange: disableChange,
durationChange: durationChange,
showChange: showChange,
rebounceChange: rebounceChange,
transitionEnd: transitionEnd
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<svg width="12px" height="24px" viewBox="0 0 12 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 52.2 (67145) - http://www.bohemiancoding.com/sketch -->
<title>Icons/Filled/arrow Copy 2</title>
<desc>Created with Sketch.</desc>
<g id="05成员管理" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="单个成员编辑" transform="translate(-25.000000, -54.000000)">
<rect id="bg" x="0" y="0" width="375" height="236"></rect>
<g id="Navbar">
<g id="Group-4" transform="translate(8.000000, 50.000000)">
<g id="Icons/Filled/arrow" transform="translate(23.000000, 16.000000) rotate(-180.000000) translate(-23.000000, -16.000000) translate(17.000000, 4.000000)" fill="#000000" fill-opacity="0.9">
<g id="Group" transform="translate(-2.000000, 5.000000)">
<path d="M3,2.5039609 L11,2.5039609 L11,4.5039609 L4,4.5039609 L4,11.5039609 L2,11.5039609 L2,3.5039609 C2,2.95167615 2.44771525,2.5039609 3,2.5039609 Z" id="图标颜色" transform="translate(6.500000, 7.003961) rotate(135.000000) translate(-6.500000, -7.003961) "></path>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 16);
/******/ })
/************************************************************************/
/******/ ({
/***/ 16:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
addGlobalClass: true
},
properties: {
extClass: {
type: String,
value: ''
},
list: {
type: Array,
value: []
},
current: {
type: Number,
value: 0
}
},
methods: {
tabChange(e) {
const {
index
} = e.currentTarget.dataset;
if (index === this.data.current) {
return;
}
this.setData({
current: index
});
this.triggerEvent('change', {
index,
item: this.data.list[index]
});
}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {
"mp-badge": "../badge/badge"
}
}
\ No newline at end of file
<view class="weui-tabbar {{extClass}}">
<!-- 选中的时候往 weui-tabbar__item 加 class:weui-bar__item_on -->
<view data-index='{{index}}' bindtap="tabChange" wx:for="{{list}}" wx:key="index" class="weui-tabbar__item {{index === current ? 'weui-bar__item_on' : ''}}">
<view style="position: relative;display:inline-block;">
<image src="{{current === index ? item.selectedIconPath : item.iconPath}}" class="weui-tabbar__icon"></image>
<mp-badge wx:if="{{item.badge || item.dot}}" content="{{item.badge}}" style="position: absolute;top:-2px;left:calc(100% - 3px)"></mp-badge>
</view>
<view class="weui-tabbar__label">{{item.text}}</view>
</view>
</view>
\ No newline at end of file
page,[data-weui-theme='light']{--weui-BG-0:#ededed;--weui-BG-1:#f7f7f7;--weui-BG-2:#fff;--weui-BG-3:#f7f7f7;--weui-BG-4:#4c4c4c;--weui-BG-5:#fff;--weui-FG-0:rgba(0,0,0,0.9);--weui-FG-HALF:rgba(0,0,0,0.9);--weui-FG-1:rgba(0,0,0,0.5);--weui-FG-2:rgba(0,0,0,0.3);--weui-FG-3:rgba(0,0,0,0.1);--weui-RED:#fa5151;--weui-ORANGE:#fa9d3b;--weui-YELLOW:#ffc300;--weui-GREEN:#91d300;--weui-LIGHTGREEN:#95ec69;--weui-BRAND:#07c160;--weui-BLUE:#10aeff;--weui-INDIGO:#1485ee;--weui-PURPLE:#6467f0;--weui-WHITE:#fff;--weui-LINK:#576b95;--weui-TEXTGREEN:#06ae56;--weui-FG:black;--weui-BG:white;--weui-TAG-TEXT-ORANGE:#fa9d3b;--weui-TAG-BACKGROUND-ORANGE:rgba(250,157,59,0.1);--weui-TAG-TEXT-GREEN:#06ae56;--weui-TAG-BACKGROUND-GREEN:rgba(6,174,86,0.1);--weui-TAG-TEXT-BLUE:#10aeff;--weui-TAG-BACKGROUND-BLUE:rgba(16,174,255,0.1);--weui-TAG-TEXT-BLACK:rgba(0,0,0,0.5);--weui-TAG-BACKGROUND-BLACK:rgba(0,0,0,0.05)}[data-weui-theme='dark']{--weui-BG-0:#111111;--weui-BG-1:#1e1e1e;--weui-BG-2:#191919;--weui-BG-3:#202020;--weui-BG-4:#404040;--weui-BG-5:#2c2c2c;--weui-FG-0:rgba(255,255,255,0.8);--weui-FG-HALF:rgba(255,255,255,0.6);--weui-FG-1:rgba(255,255,255,0.5);--weui-FG-2:rgba(255,255,255,0.3);--weui-FG-3:rgba(255,255,255,0.05);--weui-RED:#fa5151;--weui-ORANGE:#c87d2f;--weui-YELLOW:#cc9c00;--weui-GREEN:#74a800;--weui-LIGHTGREEN:#3eb575;--weui-BRAND:#07c160;--weui-BLUE:#10aeff;--weui-INDIGO:#1196ff;--weui-PURPLE:#8183ff;--weui-WHITE:rgba(255,255,255,0.8);--weui-LINK:#7d90a9;--weui-TEXTGREEN:#259c5c;--weui-FG:white;--weui-BG:black;--weui-TAG-TEXT-ORANGE:rgba(250,157,59,0.6);--weui-TAG-BACKGROUND-ORANGE:rgba(250,157,59,0.1);--weui-TAG-TEXT-GREEN:rgba(6,174,86,0.6);--weui-TAG-BACKGROUND-GREEN:rgba(6,174,86,0.1);--weui-TAG-TEXT-BLUE:rgba(16,174,255,0.6);--weui-TAG-BACKGROUND-BLUE:rgba(16,174,255,0.1);--weui-TAG-TEXT-BLACK:rgba(255,255,255,0.5);--weui-TAG-BACKGROUND-BLACK:rgba(255,255,255,0.05)}page,[data-weui-theme='light']{--weui-BG-COLOR-ACTIVE:#ececec}[data-weui-theme='dark']{--weui-BG-COLOR-ACTIVE:#373737}page,[data-weui-theme='light']{--weui-BTN-DISABLED-FONT-COLOR:rgba(0,0,0,0.2)}[data-weui-theme='dark']{--weui-BTN-DISABLED-FONT-COLOR:rgba(255,255,255,0.2)}page,[data-weui-theme='light']{--weui-BTN-DEFAULT-BG:#f2f2f2}[data-weui-theme='dark']{--weui-BTN-DEFAULT-BG:rgba(255,255,255,0.08)}page,[data-weui-theme='light']{--weui-BTN-DEFAULT-COLOR:#06ae56}[data-weui-theme='dark']{--weui-BTN-DEFAULT-COLOR:rgba(255,255,255,0.8)}page,[data-weui-theme='light']{--weui-BTN-DEFAULT-ACTIVE-BG:#e6e6e6}[data-weui-theme='dark']{--weui-BTN-DEFAULT-ACTIVE-BG:rgba(255,255,255,0.126)}page,[data-weui-theme='light']{--weui-DIALOG-LINE-COLOR:rgba(0,0,0,0.1)}[data-weui-theme='dark']{--weui-DIALOG-LINE-COLOR:rgba(255,255,255,0.1)}@media only screen and (min-width:450px){.weui-tabbar{flex-direction:column;width:60px;height:100%}.weui-tabbar:before{left:unset;height:unset;content:" ";position:absolute;right:0;top:0;width:1px;bottom:0;border-right:1px solid var(--weui-FG-3);color:var(--weui-FG-3);transform-origin:100% 0;transform:scaleX(.5)}.weui-tabbar__item{flex:none}}
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 13);
/******/ })
/************************************************************************/
/******/ ({
/***/ 13:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
addGlobalClass: true
},
properties: {
type: {
type: String,
value: 'error',
observer: '_typeChange'
},
show: {
type: Boolean,
value: false,
observer: '_showChange'
},
msg: {
type: String,
value: ''
},
delay: {
type: Number,
value: 2000
},
extClass: {
type: String,
value: ''
}
},
data: {
typeClassMap: {
warn: 'weui-toptips_warn',
info: 'weui-toptips_info',
success: 'weui-toptips_success',
error: 'weui-toptips_error'
}
},
attached() {
const data = this.data;
this.setData({
className: data.typeClassMap[data.type] || ''
});
},
methods: {
_typeChange(newVal) {
this.setData({
className: this.data.typeClassMap[newVal] || ''
});
return newVal;
},
_showChange(newVal) {
this._showToptips(newVal);
},
_showToptips(newVal) {
if (newVal && this.data.delay) {
setTimeout(() => {
this.setData({
show: false
}, () => {
// tooltips 隐藏了,触发 hide 事件
this.triggerEvent('hide', {}, {});
});
}, this.data.delay);
}
this.setData({
show: newVal
});
}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="weui-toptips {{className}} {{extClass}} {{show ? 'weui-toptips_show' : ''}}">
<block wx:if="{{msg}}">{{msg}}</block>
<block wx:else>
<slot></slot>
</block>
</view>
\ No newline at end of file
.weui-toptips_show.weui-toptips{display:block}.weui-toptips_show{-webkit-transform:translateZ(0) translateY(0);transform:translateZ(0) translateY(0);opacity:1}.weui-toptips_success{background-color:var(--weui-BRAND)}.weui-toptips_error{background-color:var(--weui-RED)}.weui-toptips_info{background-color:var(--weui-BLUE)}
\ No newline at end of file
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 22);
/******/ })
/************************************************************************/
/******/ ({
/***/ 22:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Component({
options: {
addGlobalClass: true
},
properties: {
title: {
type: String,
value: '图片上传'
},
sizeType: {
type: Array,
value: ['original', 'compressed']
},
sourceType: {
type: Array,
value: ['album', 'camera']
},
maxSize: {
type: Number,
value: 5 * 1024 * 1024
},
maxCount: {
// 最多上传多少个文件
type: Number,
value: 1
},
files: {
// 当前的图片列表, {url, error, loading}
type: Array,
value: [],
observer(newVal) {
this.setData({
currentFiles: newVal
});
}
},
select: {
// 过滤某个文件
type: null,
value: () => {}
},
upload: {
// 返回Promise的一个文件上传的函数
type: null,
value: null
},
tips: {
type: String,
value: ''
},
extClass: {
type: String,
value: ''
},
showDelete: {
// 是否显示delete按钮
type: Boolean,
value: true
}
},
data: {
currentFiles: [],
showPreview: false,
previewImageUrls: []
},
ready() {},
methods: {
previewImage(e) {
const {
index
} = e.currentTarget.dataset;
const previewImageUrls = [];
this.data.files.forEach(item => {
previewImageUrls.push(item.url);
});
this.setData({
previewImageUrls,
previewCurrent: index,
showPreview: true
});
},
chooseImage() {
if (this.uploading) return;
wx.chooseImage({
count: this.data.maxCount - this.data.files.length,
sizeType: this.data.sizeType,
sourceType: this.data.sourceType,
success: res => {
// console.log('chooseImage resp', res)
// 首先检查文件大小
let invalidIndex = -1; // @ts-ignore
res.tempFiles.forEach((item, index) => {
if (item.size > this.data.maxSize) {
invalidIndex = index;
}
});
if (typeof this.data.select === 'function') {
const ret = this.data.select(res);
if (ret === false) {
return;
}
}
if (invalidIndex >= 0) {
this.triggerEvent('fail', {
type: 1,
errMsg: `chooseImage:fail size exceed ${this.data.maxSize}`,
total: res.tempFilePaths.length,
index: invalidIndex
}, {});
return;
} // 获取文件内容
const mgr = wx.getFileSystemManager();
const contents = res.tempFilePaths.map(item => {
// @ts-ignore
const fileContent = mgr.readFileSync(item);
return fileContent;
});
const obj = {
tempFilePaths: res.tempFilePaths,
tempFiles: res.tempFiles,
contents
}; // 触发选中的事件,开发者根据内容来上传文件,上传了把上传的结果反馈到files属性里面
this.triggerEvent('select', obj, {});
const files = res.tempFilePaths.map((item, i) => ({
loading: true,
// @ts-ignore
url: res.tempFilePaths[i] || `data:image/jpg;base64,${wx.arrayBufferToBase64(contents[i])}`
}));
if (!files || !files.length) return;
if (typeof this.data.upload === 'function') {
const len = this.data.files.length;
const newFiles = this.data.files.concat(files);
this.setData({
files: newFiles,
currentFiles: newFiles
});
this.loading = true;
this.data.upload(obj).then(json => {
this.loading = false;
if (json.urls) {
const oldFiles = this.data.files;
json.urls.forEach((url, index) => {
oldFiles[len + index].url = url;
oldFiles[len + index].loading = false;
});
this.setData({
files: oldFiles,
currentFiles: newFiles
});
this.triggerEvent('success', json, {});
} else {
this.triggerEvent('fail', {
type: 3,
errMsg: 'upload file fail, urls not found'
}, {});
}
}).catch(err => {
this.loading = false;
const oldFiles = this.data.files;
res.tempFilePaths.forEach((item, index) => {
oldFiles[len + index].error = true;
oldFiles[len + index].loading = false;
});
this.setData({
files: oldFiles,
currentFiles: newFiles
});
this.triggerEvent('fail', {
type: 3,
errMsg: 'upload file fail',
error: err
}, {});
});
}
},
fail: fail => {
if (fail.errMsg.indexOf('chooseImage:fail cancel') >= 0) {
this.triggerEvent('cancel', {}, {});
return;
}
fail.type = 2;
this.triggerEvent('fail', fail, {});
}
});
},
deletePic(e) {
const index = e.detail.index;
const files = this.data.files;
const file = files.splice(index, 1);
this.setData({
files,
currentFiles: files
});
this.triggerEvent('delete', {
index,
item: file[0]
});
}
}
});
/***/ })
/******/ });
\ No newline at end of file
{
"component": true,
"usingComponents": {
"mp-gallery": "../gallery/gallery"
}
}
<view class="weui-uploader {{extClass}}">
<view class="weui-uploader__hd">
<view class="weui-uploader__overview">
<view class="weui-uploader__title">{{title}}</view>
<view class="weui-uploader__info" wx:if="{{maxCount > 1}}">{{currentFiles.length}}/{{maxCount}}</view>
</view>
<view wx:if="{{tips}}" class="weui-uploader__tips">{{tips}}</view>
<view wx:else><slot name="tips"></slot></view>
</view>
<view class="weui-uploader__bd">
<view class="weui-uploader__files">
<block wx:for="{{currentFiles}}" wx:key="*this">
<view wx:if="{{item.error}}" data-index="{{index}}" bindtap="previewImage" class="weui-uploader__file weui-uploader__file_status">
<image class="weui-uploader__img" src="{{item.url}}" mode="aspectFill" />
<view class="weui-uploader__file-content">
<icon type="warn" size="23" color="#F43530"></icon>
</view>
</view>
<view wx:elif="{{item.loading}}" data-index="{{index}}" bindtap="previewImage" class="weui-uploader__file weui-uploader__file_status">
<image class="weui-uploader__img" src="{{item.url}}" mode="aspectFill" />
<view class="weui-uploader__file-content">
<view class="weui-loading"></view>
</view>
</view>
<view wx:else class="weui-uploader__file" data-index="{{index}}" bindtap="previewImage">
<image class="weui-uploader__img" src="{{item.url}}" mode="aspectFill" />
</view>
</block>
</view>
<view wx:if="{{currentFiles.length < maxCount}}" class="weui-uploader__input-box" hover-class="weui-active">
<view class="weui-uploader__input" bindtap="chooseImage"></view>
</view>
</view>
</view>
<mp-gallery class="gallery" hide-on-click="{{true}}" show-delete="{{showDelete}}" show="{{showPreview}}" binddelete="deletePic" img-urls="{{previewImageUrls}}" current="{{previewCurrent}}"></mp-gallery>
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
*/ */
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
...@@ -16,6 +14,29 @@ ...@@ -16,6 +14,29 @@
}, },
{
"path": "pages/photo/try",
"style": {
"navigationBarTitleText": "拍照"
}
},
{
"path": "pages/photo/preview",
"style": {
"navigationBarTitleText": "照片预览"
}
},
// {
// "path": "pages/photo/index",
// "style": {
// "navigationBarTitleText": "拍照"
// }
// },
{ {
"path": "pages/index/success", "path": "pages/index/success",
"style": { "style": {
...@@ -116,5 +137,9 @@ ...@@ -116,5 +137,9 @@
"navigationBarTitleText": "uni-app", "navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8", "navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8" "backgroundColor": "#F8F8F8"
} }
} }
<!--template>
<view>
<cover-view class="{{scale=='4_3'?'nav__scale-4-3':scale=='16_9'?'nav__scale-16-9':'nav__scale-full'}}" style="height:{{navHeight}}rpx;">
<cover-image @click="changeScale" class="nav-scaleIcon" mode="aspectFit" src="/image/{{scale}}_{{iconColor}}.png"></cover-image>
<cover-image @click="changeDevicePosition" class="nav-switchIcon" mode="aspectFit" src="/image/switch_{{iconColor}}.png"></cover-image>
<cover-image @click="changeLight" class="nav-lightIcon" mode="aspectFit" src="/image/light_{{light}}_{{iconColor}}.png"></cover-image>
</cover-view>
<camera binderror="binderror" bindinitdone="bindinitdone" bindstop="bindstop" class="camera" devicePosition="{{devicePosition}}" flash="{{light}}" resolution="high" style="height:{{cameraHeight}}rpx;top:{{scale=='4_3'?navHeight:0}}rpx">
<cover-view class="watermark-box" style="color:{{watermarkFontColor}}; {{watermarkStyle}}">
<cover-view class="watermark-box__item" v-if="{{lonLat}}">经度:{{longitudeValue?longitudeValue:'正在获取...'}}</cover-view>
<cover-view class="watermark-box__item" v-if="{{lonLat}}">纬度:{{latitudeValue?latitudeValue:'正在获取...'}}</cover-view>
<cover-view class="watermark-box__item" v-if="{{address}}">地址:{{addressValue?addressValue:'正在获取...'}}</cover-view>
<cover-view class="watermark-box__item" v-if="{{time}}">时间:{{timeValue?timeValue:'正在获取...'}}</cover-view>
<cover-view class="watermark-box__item" v-if="{{altitude}}">海拔:{{altitudeValue?altitudeValue:'正在获取...'}}</cover-view>
<cover-view class="watermark-box__item" v-if="{{weather}}">天气:{{weatherValue?weatherValue:'正在获取...'}}</cover-view>
<cover-view class="weui-flex" v-if="{{remarkArr.length>0}}">
<cover-view>备注:</cover-view>
<cover-view class="weui-flex__item" style="margin-top:1rpx;">
<cover-view v-for="{{remarkArr}}">{{item}}</cover-view>
</cover-view>
</cover-view>
</cover-view>
<cover-image class="{{direction=='normal'?'logoNormal':direction=='left'?'logoLeft':'logoRight'}}" mode="heightFix" src="{{logo}}" style="opacity:{{1-logoTransparency*5/100}};" v-if="{{logoEnable}}"></cover-image>
<cover-image class="{{direction=='normal'?'liveWatermarkNormal':direction=='left'?'liveWatermarkLeft':'liveWatermarkRight'}}" mode="aspectFit" src="{{liveWatermarkValue}}" v-if="{{liveWatermark}}"></cover-image>
<cover-image class="{{direction=='normal'?'handWritingNormal':direction=='left'?'handWritingLeft':'handWritingRight'}}" mode="aspectFit" src="{{handWriting}}"></cover-image>
</camera>
<cover-view class="camera-photoalbumIconBox {{tempImagePath?'':'1hidden'}}">
<cover-image @click="bindPhotoalbum" class="camera-photoalbumIcon" mode="aspectFill" src="{{tempImagePath}}"></cover-image>
</cover-view>
<cover-image @click="bindTakePhoto" class="camera-takeIcon" id="take" mode="aspectFit" src="/image/take.png"></cover-image>
<cover-image @click="bindSetting" class="camera-settingIcon" mode="aspectFit" src="/image/setting_white.png"></cover-image>
</view>
<canvas class="photoCanvas" id="photoCanvas" style="height:{{canvasHeight}}rpx;width:{{canvasWidth}}rpx;" type="2d"></canvas>
</template>
<script>
// import mp_dialog from '/miniprogram_npm/weui-miniprogram/dialog/dialog';
// import mp_con from '/miniprogram_npm/weui-miniprogram/icon/icon';
// import mp_form_page from '/miniprogram_npm/weui-miniprogram/form-page/form-page';
// import mp_form from '/miniprogram_npm/weui-miniprogram/form/form';
// import mp_cell from '/miniprogram_npm/weui-miniprogram/cell/cell';
// import mp_cells from '/miniprogram_npm/weui-miniprogram/cells/cells';
// import mp_slideview from '/miniprogram_npm/weui-miniprogram/slideview/slideview';
// import mp_toptips from '/miniprogram_npm/weui-miniprogram/toptips/toptips';
// import mp_actionSheet from '/miniprogram_npm/weui-miniprogram/actionsheet/actionsheet';
// import mp_halfScreenDialog from '/miniprogram_npm/weui-miniprogram/half-screen-dialog/half-screen-dialog';
// import mp_msg from '/miniprogram_npm/weui-miniprogram/msg/msg';
// import color_picker from '/miniprogram_npm/mini-color-picker/color-picker';
// export default {
// components: {
// "mp-dialog":mp_dialog,
// "mp-icon":mp_con,
// "mp-form-page":mp_form_page,
// "mp-form":mp_form,
// "mp-cell":mp_cell,
// "mp-cells":mp_cells,
// "mp-slideview":mp_slideview,
// "mp-toptips":mp_toptips,
// "mp-actionSheet":mp_actionSheet,
// "mp-halfScreenDialog":mp_halfScreenDialog,
// "mp-msg":mp_msg,
// "color-picker":color_picker
// },
data() {
return {
navHeight: o.globalData.navHeight,
scale: "4_3",
iconColor: "white",
devicePosition: "back",
light: "off",
canvasWidth: 750,
canvasHeight: 1e3,
cameraHeight: 1e3,
watermarkStyle: "bottom:20rpx;left:20rpx;",
direction: "normal",
liveWatermarkValue: "/image/live_mark.png",
baiduLocationTimer: null,
wxLocationTimer: null,
netTimeTimer: null,
localTimeTimer: null,
takePhotoTimer: 0,
originalWeather: !1,
a:'',
t:'',
i:'',
o:'',
n:'',
r:'',
l:'',
s:'',
h:''
}
},
// var a
// t = require("../../@babel/runtime/helpers/interopRequireDefault"),
// e = t(require("../../@babel/runtime/regenerator")),
// i = t(require("../../@babel/runtime/helpers/asyncToGenerator")),
// o = getApp(), n = wx.getRealtimeLogManager(),
// r = require("../../libs/bmap-wx.min.js"), l = require("../../utils/util.js"),
// s = !0,
// h = new r.BMapWX({
// ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG"
// });
onLoad: function(a) {
this.listeningDeviceMotion(), this.originalWeather = o.globalData.weather, o.globalData.weather && this.baiduWeather(),
setTimeout(function() {
s = !1;
}, 2e3);
this.initabcde()
},
onReady: function() {},
onShow: function() {
wx.startDeviceMotionListening();
var a = o.globalData.remark, t = this.formatRemark(a);
o.globalData.remarkArr = t, this.setData({
lonLat: o.globalData.lonLat,
address: o.globalData.address,
time: o.globalData.time,
altitude: o.globalData.altitude,
weather: o.globalData.weather,
liveWatermark: o.globalData.liveWatermark,
remarkArr: o.globalData.remarkArr,
handWriting: o.globalData.handWriting,
logoEnable: o.globalData.logoEnable,
logo: o.globalData.logo,
latLonFormat: o.globalData.latLonFormat,
watermarkFont: o.globalData.watermarkFont,
watermarkFontColor: o.globalData.watermarkFontColor,
logoTransparency: o.globalData.logoTransparency
}), (o.globalData.lonLat || o.globalData.altitude) && (this.wxLocation(), wx.startLocationUpdate()),
o.globalData.address && this.baiduLocation(), o.globalData.time && this.netTime(),
o.globalData.weather && this.originalWeather != o.globalData.weather && this.baiduWeather(),
this.initWatermarkBoxHeightAndWidth();
},
onHide: function() {
wx.stopDeviceMotionListening().catch(function(a) {
console.log(a);
}), (o.globalData.lonLat || o.globalData.altitude) && wx.stopLocationUpdate().catch(function(a) {
console.log(a);
}), clearInterval(this.baiduLocationTimer), clearInterval(this.wxLocationTimer),
clearInterval(this.netTimeTimer), clearInterval(this.localTimeTimer);
},
onUnload: function() {
wx.stopDeviceMotionListening();
},
onPullDownRefresh: function() {},
onReachBottom: function() {},
onShareAppMessage: function() {},
bindinitdone: function(a) {},
bindstop: function(a) {},
binderror: function(a) {},
methods: {
initabcde: function() {
var a
t = require("../../@babel/runtime/helpers/interopRequireDefault"),
e = t(require("../../@babel/runtime/regenerator")),
i = t(require("../../@babel/runtime/helpers/asyncToGenerator")),
o = getApp(),
n = wx.getRealtimeLogManager(),
r = require("../../libs/bmap-wx.min.js"),
l = require("../../utils/util.js"),
s = !0,
h = new r.BMapWX({
ak: "rpVq5d3yxaRCoKzVwmFMo0o4iC524CAG"
});
},
initWatermarkBoxHeightAndWidth: function() {
var a = this;
wx.nextTick(function() {
wx.createSelectorQuery().select(".watermark-box").boundingClientRect(function(t) {
a.watermarkBoxHeight = t.height, a.watermarkBoxWidth = t.width, a.changeWatermark();
}).exec();
});
},
listeningDeviceMotion: function() {
var a = this;
wx.onDeviceMotionChange(function(t) {
if ("ios" == o.globalData.platform) {
var e = parseFloat(t.alpha);
a.direction = e > 45 && e < 136 ? "left" : e > 225 && e < 316 ? "right" : "normal";
} else t.gamma < -40 && t.gamma > -130 ? a.direction = "right" : t.gamma > 40 && t.gamma < 130 ? a.direction = "left" : a.direction = "normal";
a.direction != a.lastDirection && (a.setData({
direction: a.direction
}), a.changeCanvas(), a.changeWatermark()), a.lastDirection = a.direction;
});
},
changeCanvas: function() {
var a = this, t = this.direction, e = this.data.canvasWidth, i = this.data.canvasHeight;
"normal" == t ? this.setData({
canvasHeight: Math.max(i, e),
canvasWidth: Math.min(i, e)
}) : this.setData({
canvasHeight: Math.min(i, e),
canvasWidth: Math.max(i, e)
}), wx.createSelectorQuery().select("#photoCanvas").fields({
node: !0,
size: !0
}).exec(function(t) {
a.canvas = t[0].node;
var e = t[0].width, i = t[0].height, n = o.globalData.pixelRatio;
a.canvas.width = e * n, a.canvas.height = i * n, a.canvas.getContext("2d").scale(n, n);
});
},
changeScale: function() {
var a, t = this, e = this.data.scale, i = this.direction, n = this.data.canvasWidth, r = this.data.canvasHeight;
"4_3" == e ? (this.setData({
scale: "16_9",
iconColor: "white",
cameraHeight: 16 / 9 * 750
}), a = 16 / 9 * 750) : "16_9" == e ? (this.setData({
scale: "full",
iconColor: "white",
cameraHeight: o.globalData.rpxScreenHeight
}), a = o.globalData.rpxScreenHeight) : (this.setData({
scale: "4_3",
iconColor: "white",
cameraHeight: 1e3
}), a = 1e3), "normal" == i ? this.setData({
canvasHeight: a,
canvasWidth: Math.min(r, n)
}) : this.setData({
canvasWidth: a,
canvasHeight: Math.min(r, n)
}), wx.nextTick(function() {
t.changeCanvas(), setTimeout(function() {
t.changeWatermark();
}, 500);
});
},
changeWatermark: function() {
var a, t = this.data.direction, e = Math.min(this.watermarkBoxWidth, this.watermarkBoxHeight), i = Math.max(this.watermarkBoxWidth, this.watermarkBoxHeight);
a = "left" == t ? [ "top:" + (20 - 2 * e + 10) + "rpx", "left:20rpx", "transform-origin: left bottom", "transform: rotate(90deg)" ].join(";") : "right" == t ? [ "bottom:" + 2 * i + "rpx", "right:20rpx", "transform-origin: right bottom", "transform: rotate(-90deg)" ].join(";") : [ "bottom:20rpx", "left:20rpx" ].join(";"),
this.setData({
watermarkStyle: a
});
},
formatRemark: function(a) {
for (var t = [], e = 0, i = 15; i < a.length; i += 15) t.push(a.substring(15 * e, i)),
e++;
return a.length % 15 != 0 && t.push(a.substring(15 * e, 15 * e + a.length % 15)),
t;
},
changeDevicePosition: function() {
"back" == this.data.devicePosition ? this.setData({
devicePosition: "front"
}) : this.setData({
devicePosition: "back"
});
},
changeLight: function() {
var a = this.data.light;
"torch" == a ? this.setData({
light: "off"
}) : "off" == a ? this.setData({
light: "on"
}) : "on" == a ? this.setData({
light: "auto"
}) : this.setData({
light: "torch"
});
},
bindPhotoalbum: function(a) {
wx.navigateTo({
url: "/pages/photoalbum/photoalbum?photoPath=" + this.data.tempImagePath
});
},
bindSetting: function() {
wx.navigateTo({
url: "/pages/settings/settings"
});
},
bindTakePhoto: function() {
var a = this;
if (!s && 0 == this.takePhotoTimer) {
this.takePhotoTimer = 1, setTimeout(function() {
a.takePhotoTimer = 0;
}, 1500), this.takePhotoAnimate();
wx.createCameraContext().takePhoto({
quality: "high"
}).then(function(t) {
a.drawPhoto(t.tempImagePath);
}).catch(function(a) {
n.error(a), console.log(a);
});
}
},
drawPhoto: (a = (0, i.default)(e.default.mark(function a(t) {
var i, n, r, l, s, h, c, g, u, d, m = this;
return e.default.wrap(function(a) {
for (;;) switch (a.prev = a.next) {
case 0:
return i = this.canvas.getContext("2d"), n = o.globalData.screenHeight / o.globalData.rpxScreenHeight,
r = this.data.canvasWidth * n, l = this.data.canvasHeight * n, a.next = 6, new Promise(function(a) {
var e = m.canvas.createImage();
e.onload = function() {
var t = r, o = l, n = m.data.direction;
"left" == n ? (i.translate(0, o), i.rotate(-Math.PI / 2), i.drawImage(e, 0, 0, o, t),
i.rotate(Math.PI / 2), i.translate(0, -o)) : "right" == n ? (i.translate(t, 0),
i.rotate(Math.PI / 2), i.drawImage(e, 0, 0, o, t), i.rotate(-Math.PI / 2), i.translate(-t, 0)) : i.drawImage(e, 0, 0, t, o),
console.log("已画照片"), a("已画照片");
}, e.onerror = function() {
console.log("照片加载失败"), a();
}, e.src = t;
});
case 6:
if (!this.data.liveWatermark || !this.data.liveWatermarkValue || "" == this.data.liveWatermarkValue) {
a.next = 9;
break;
}
return a.next = 9, new Promise(function(a) {
var t = m.canvas.createImage();
t.onload = function() {
var e = 360 * n, o = 90 * n, s = r / 2 - e / 2, h = l / 2 - o / 2;
i.drawImage(t, s, h, e, o), console.log("已画现场水印"), a("已画现场水印");
}, t.onerror = function() {
console.log("现场水印加载失败"), a();
}, t.src = m.data.liveWatermarkValue;
});
case 9:
if (!this.data.handWriting || "" == this.data.handWriting) {
a.next = 12;
break;
}
return a.next = 12, new Promise(function(a) {
var t = m.canvas.createImage();
t.onload = function() {
var e = 150 * n, o = 150 * n, s = r - e - 10, h = l - 10;
i.translate(s, h), i.rotate(-Math.PI / 2), i.drawImage(t, 0, 0, e, o), i.rotate(Math.PI / 2),
i.translate(-s, -h), console.log("已画手写签名水印"), a("已画手写签名水印");
}, t.onerror = function() {
console.log("手写签名水印加载失败"), a();
}, t.src = m.data.handWriting;
});
case 12:
if (!this.data.logoEnable || !this.data.logo || "" == this.data.logo) {
a.next = 16;
break;
}
return console.log("画水印LOGO"), a.next = 16, new Promise(function(a) {
var t = m.canvas.createImage();
t.onload = function() {
var e = 150 * n, l = 150 * n, s = r - e - 10, h = 1 - 5 * o.globalData.logoTransparency / 100;
i.globalAlpha = h, i.drawImage(t, s, 10, e, l), i.globalAlpha = 1, console.log("已画水印LOGO"),
a("已画水印LOGO");
}, t.onerror = function() {
console.log("水印LOGO加载失败"), a();
}, t.src = m.data.logo;
});
case 16:
if (console.log("画水印信息"), i.font = "14px", i.fillStyle = this.data.watermarkFontColor,
s = l - 14, h = 0, (c = this.data.remarkArr) && c.length > 0) {
for (g = c.length - 1; g >= 1; g--) u = c[g], i.fillText(u, 52, s - 18 * h++);
d = c[0], i.fillText("备注:" + d, 10, s - 18 * h++);
}
this.data.weather && this.data.weatherValue && i.fillText("天气:" + this.data.weatherValue, 10, s - 18 * h++),
this.data.altitude && this.data.altitudeValue && i.fillText("海拔:" + this.data.altitudeValue, 10, s - 18 * h++),
this.data.time && this.data.timeValue && i.fillText("时间:" + this.data.timeValue, 10, s - 18 * h++),
this.data.address && this.data.addressValue && i.fillText("地址:" + this.data.addressValue, 10, s - 18 * h++),
this.data.lonLat && this.data.latitudeValue && this.data.longitudeValue && (i.fillText("纬度:" + this.data.latitudeValue, 10, s - 18 * h++),
i.fillText("经度:" + this.data.longitudeValue, 10, s - 18 * h++)), this.savaToTempFile();
case 31:
case "end":
return a.stop();
}
}, a, this);
})), function(t) {
return a.apply(this, arguments);
}),
savaToTempFile: function() {
var a = this;
wx.canvasToTempFilePath({
canvas: this.canvas
}).then(function(t) {
console.log(t), a.setData({
tempImagePath: t.tempFilePath
}), a.saveToPhotosAlbum(t.tempFilePath);
}).catch(function(a) {
n.error(a), console.log(a);
});
},
saveToPhotosAlbum: function(a) {
wx.getSetting({
success: function(t) {
t.authSetting["scope.writePhotosAlbum"] ? wx.saveImageToPhotosAlbum({
filePath: a
}) : wx.authorize({
scope: "scope.writePhotosAlbum",
success: function() {
wx.saveImageToPhotosAlbum({
filePath: a
});
},
fail: function() {
n.error("已拒绝保存照片到本地相册授权"), console.log("已拒绝保存照片到本地相册授权");
}
});
}
});
},
takePhotoAnimate: function() {
this.animate("#take", [ {
scale: [ 1, 1 ]
}, {
scale: [ .95, .95 ]
}, {
scale: [ 1, 1 ]
} ], 300, function() {
this.clearAnimation("#take");
}.bind(this));
},
baiduWeather: function() {
var a = this;
h.weather({
success: function(t) {
var e = t.currentWeather[0];
console.log("当前天气", e);
var i = e.temperature + " " + e.weatherDesc + " " + e.wind;
a.setData({
weatherValue: i
}), a.initWatermarkBoxHeightAndWidth();
},
fail: function(a) {
n.error(a), console.log(a);
}
});
},
baiduLocation: function() {
var a = this, t = function() {
var t = {
success: function(t) {
var e = t.wxMarkerData[0];
console.log("当前定位", e);
var i = e.address;
a.setData({
addressValue: i
}), o.globalData.addressValue = i, a.initWatermarkBoxHeightAndWidth();
},
fail: function(a) {
n.error(a), console.log(a);
}
};
if ((o.globalData.lonLat || o.globalData.altitude) && a.latitude && a.longitude) {
var e = a.latitude + "," + a.longitude;
t.location = e;
}
h.regeocoding(t);
};
t(), clearInterval(this.baiduLocationTimer), this.baiduLocationTimer = setInterval(t, 6e4);
},
wxLocation: function() {
var a = this;
wx.onLocationChange(function(t) {
a.latitude = t.latitude, a.longitude = t.longitude;
var e = l.formatLonLat(t.latitude, o.globalData.latLonFormat), i = l.formatLonLat(t.longitude, o.globalData.latLonFormat), n = "0米";
t.altitude && (n = t.altitude.toFixed(2) + "米"), a.setData({
latitudeValue: e,
longitudeValue: i,
altitudeValue: n
}), o.globalData.latitudeValue = e, o.globalData.longitudeValue = i, o.globalData.altitudeValue = n;
});
},
netTime: function() {
var a = this, t = function() {
wx.request({
url: "https://www.baidu.com",
success: function(t) {
var e = new Date(t.header.Date);
o.globalData.timestampValue = e.getTime();
var i = l.formatTime(e);
a.setData({
timeValue: i
}), o.globalData.timeValue = i, a.initWatermarkBoxHeightAndWidth();
}
});
};
t(), clearInterval(this.netTimeTimer), clearInterval(this.localTimeTimer), this.netTimeTimer = setInterval(t, 6e4),
this.localTimeTimer = setInterval(function() {
if (o.globalData.timestampValue) {
o.globalData.timestampValue += 1e3;
var t = l.formatTime(new Date(o.globalData.timestampValue));
a.setData({
timeValue: t
}), o.globalData.timeValue = t;
}
}, 1e3);
}
}
}
</script>
<style>
.hidden {
display: none;
}
.camera {
width: 100%;
height: 100vh;
z-index: 1;
position: absolute;
}
.nav__scale-4-3 {
background-color: #000;
}
.nav__scale-4-3,.nav__scale-16-9 {
z-index: 5;
position: fixed;
top: 0;
left: 0;
right: 0;
}
.nav__scale-16-9 {
background-color: transparent;
}
.nav__scale-full {
z-index: 5;
position: fixed;
top: 0;
left: 0;
right: 0;
}
.nav-scaleIcon {
left: 5rpx;
}
.nav-scaleIcon,.nav-switchIcon {
z-index: 5;
width: 50rpx;
height: 50rpx;
position: absolute;
bottom: 0;
margin: 20rpx;
}
.nav-switchIcon {
left: 120rpx;
}
.nav-lightIcon {
left: 220rpx;
}
.nav-lightIcon,.nav-moreIcon {
z-index: 5;
width: 50rpx;
height: 50rpx;
position: absolute;
bottom: 0;
margin: 20rpx;
}
.nav-moreIcon {
left: 320rpx;
}
.camera-photoalbumIconBox {
z-index: 5;
width: 80rpx;
height: 80rpx;
position: absolute;
bottom: 60rpx;
left: 25%;
margin-left: -80rpx;
background-color: hsla(0,0%,100%,0);
border: 1rpx solid #fff;
border-radius: 50%;
}
.camera-photoalbumIcon {
z-index: 5;
}
.camera-takeIcon {
z-index: 5;
width: 150rpx;
height: 150rpx;
position: absolute;
bottom: 25rpx;
left: 50%;
margin-left: -75rpx;
}
.camera-settingIcon {
z-index: 5;
width: 80rpx;
height: 80rpx;
position: absolute;
bottom: 60rpx;
left: 75%;
}
.photoCanvas {
z-index: -1;
position: absolute;
left: 9999px;
}
.watermark-box {
z-index: 4;
position: absolute;
font-size: 14px;
line-height: 18px;
color: #fff;
}
.watermark-box__item {
margin: 2px 0;
}
.liveWatermarkNormal {
z-index: 3;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
width: 360rpx;
height: 90rpx;
z-index: 6;
}
.liveWatermarkRight {
transform-origin: 50% 50%;
transform: rotate(-90deg);
}
.liveWatermarkLeft,.liveWatermarkRight {
z-index: 3;
position: absolute;
left: 25%;
top: calc(50% - 45rpx);
width: 360rpx;
height: 90rpx;
z-index: 6;
}
.liveWatermarkLeft {
transform-origin: 50% 50%;
transform: rotate(90deg);
}
.handWritingNormal {
transform-origin: 50% 50%;
transform: rotate(-90deg);
right: 20rpx;
}
.handWritingLeft,.handWritingNormal {
z-index: 3;
position: absolute;
width: 150rpx;
height: 150rpx;
bottom: 20rpx;
}
.handWritingLeft {
transform-origin: 50% 50%;
left: 20rpx;
}
.handWritingRight {
transform-origin: 50% 50%;
transform: rotate(180deg);
}
.handWritingRight,.logoNormal {
z-index: 3;
position: absolute;
width: 150rpx;
height: 150rpx;
top: 20rpx;
right: 20rpx;
}
.logoNormal {
transform-origin: 50% 50%;
}
.logoLeft {
transform-origin: 50% 50%;
transform: rotate(90deg);
bottom: 20rpx;
right: 20rpx;
}
.logoLeft,.logoRight {
z-index: 3;
position: absolute;
width: 150rpx;
height: 150rpx;
}
.logoRight {
transform-origin: 50% 50%;
transform: rotate(-90deg);
top: 20rpx;
left: 20rpx;
}
</style>
<template>
</template>
<script>
export default {
data() {
return {
protocolContent:''
}
},
onLoad(e) {
},
methods: {
//拨打客服 点击
phoneCallClick: function (phone) {
uni.makePhoneCall({
phoneNumber: phone
});
},
}
}
</script>
<style>
</style>
<template>
<view class="">
<!--cover-view class="nav__scale-4-3" style="height:64rpx;">
<cover-image @click="changeScale" class="nav-scaleIcon" mode="aspectFit" :src="icon_location"></cover-image>
<cover-image @click="changeDevicePosition" class="nav-switchIcon" mode="aspectFit" :src="icon_location"></cover-image>
<cover-image @click="changeLight" class="nav-lightIcon" mode="aspectFit" :src="icon_location"></cover-image>
</cover-view-->
<camera device-position="back" flash="off" style='width:100%; height:100vh;'>
</camera>
<cover-view class="bottomView">
<cover-image class='switchIcon' :src='icon_switch_white' @click="switchClick()"> </cover-image>
<cover-image class='takeIcon' :src='icon_take' @click="takePhoto()"> </cover-image>
<cover-image class='flashIcon' :src='icon_light_on_white' @click="flashClick()"> </cover-image>
</cover-view>
<canvas v-show='showImage' canvas-id="canvas" style='width:1000px; height:1500px;'></canvas>
</view>
</template>
<script>
export default {
data() {
return {
title: '',
ctx: null,
path: "",
image: "",
showImage: false,
canvas:null,
icon_location:'https://qn-static.banshouhui.com/take_order/icon/location.png',
scale: "4_3",
icon_take:'https://qn-static.banshouhui.com/take.png',
icon_switch_white:'https://qn-static.banshouhui.com/switch_white.png',
icon_light_on_white:'https://qn-static.banshouhui.com/light_on_white.png',
}
},
onLoad(e) {
this.ctx = uni.createCameraContext();
},
methods: {
//切换前后
switchClick(){
},
//拍照
takePhoto(){
this.ctx.takePhoto({
quality: 'high',
success: (res) => {
console.log('拍照成功')
console.log(res)
this.imageChange(res)
}
});
},
//照片处理
imageChange(options) {
var that = this
//原图片信息
var _width = options.width
var _height = options.height
that.path = options.tempImagePath
console.log('原照片信息')
console.log('宽:'+options.width)
console.log('高:'+options.height)
console.log('路径:'+options.tempImagePath)
//需要的图片信息
var image_x = parseInt(_width * 0.1);
var image_y = parseInt(_height * 0.09);
var image_width = parseInt(_width * 0.8);
var image_height = parseInt(_height * 0.87);
console.log('需要的图片信息')
console.log('x:'+image_x)
console.log('y:'+image_y)
console.log('宽:'+image_width)
console.log('高:'+image_height)
uni.getImageInfo({
src: that.path,
success: function(res) {
that.showImage = true
//将原图画到canvas上面
that.canvas = uni.createCanvasContext("canvas", that)
that.canvas.drawImage(that.path, 0, 0, _width, _height)
//-----------------------------
// let ctx = uni.createCanvasContext('firstCanvas'); /** 创建画布 */
// //将图片src放到cancas内,宽高为图片大小
// ctx.drawImage(res.tempFilePaths[0], 0, 0, ress.width / 3, ress.height / 3)
that.canvas.setFontSize(18)
that.canvas.setFillStyle('#8a2929')
that.canvas.rotate(-Math.PI / 2);
let textToWidth = res.width / 3 * 0.5;
let textToHeight = res.height / 3 * 0.3;
that.canvas.fillText('我是水印', 10, 90)
/** 除了上面的文字水印,这里也可以加入图片水印 */
//ctx.drawImage('/static/watermark.png', 0, 0, ress.width / 3, ress.height / 3)
//-----------------------------
uni.showLoading({
title: '数据处理中...',
icon: 'loading',
duration: 10000
})
that.canvas.draw()
setTimeout(function() {
//导出自己需要的图片
uni.canvasToTempFilePath({
canvasId: "canvas",
x: image_x,
y: image_y,
width: image_width,
height: image_height,
destWidth: image_width,
destHeight: image_height,
success: function(ress) {
that.image = ress.tempFilePath //处理好的图片
uni.hideLoading()
console.log('处理图片 成功:')
console.log(ress.tempFilePath)
uni.showToast({
icon:'none',
title:'处理成功'
})
setTimeout(function() {
uni.previewImage({
urls: [ress.tempFilePath],
current:0
});
// uni.navigateTo({
// url:'/pages/photo/preview'+'?path=' + res.tempFilePath
// })
}, 1000);
//TODO........
},
fail: function(e) {
uni.hideLoading()
uni.showToast({
title: '出错啦...',
icon: 'loading'
})
console.log('处理图片 失败:')
console.log(e)
}
});
}, 1000);
}
})
}
}
}
</script>
<style>
.bottomView{
background-color: #000000;
z-index: 5;
width: 100%;
height: 200rpx;
position: absolute;
bottom: 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.switchIcon{
background-color: #000000;
width: 50rpx;
height: 50rpx;
}
.takeIcon{
background-color: #000000;
width: 150rpx;
height: 150rpx;
margin-left: 100rpx;
}
.flashIcon{
background-color: #000000;
width: 50rpx;
height: 50rpx;
margin-left: 100rpx;
}
</style>
...@@ -113,6 +113,17 @@ ...@@ -113,6 +113,17 @@
this.getToken() this.getToken()
}, },
onShareAppMessage(res) {
let shareObj = {
title: '',
path: '/pages/index/index',
imageUrl: '',
success(){},
fail(){}
}
return shareObj
},
methods: { methods: {
async getToken () { async getToken () {
......
var t = function(t) {
return (t = t.toString())[1] ? t : "0" + t;
};
module.exports = {
formatTime: function(n) {
var e = n.getFullYear(), r = n.getMonth() + 1, o = n.getDate(), i = n.getHours(), u = n.getMinutes(), a = n.getSeconds();
return [ e, r, o ].map(t).join("-") + " " + [ i, u, a ].map(t).join(":");
},
throttle: function(t, n) {
null != n && null != n || (n = 1500);
var e = null;
return function() {
var r = +new Date();
console.log(r + "," + e + "," + new Date()), (r - e > n || !e) && (t(), e = r);
};
},
formatLonLat: function(t, n) {
if (void 0 === t || "" == t) return "";
if (t += "", 0 == n) return parseFloat(t).toFixed(6);
var e = t.indexOf("."), r = e < 0 ? t : t.substring(0, e), o = 0, i = 0;
return e > 0 && (o = 60 * (o = "0" + t.substring(e)) + "", 2 == n ? (e = o.indexOf(".")) > 0 && (i = "0" + o.substring(e),
o = o.substring(0, e), e = (i = 60 * i + "").indexOf("."), i = i.substring(0, e + 4),
i = parseFloat(i).toFixed(0)) : 1 == n && (o = parseFloat(o).toFixed(6))), 2 == n ? r + "°" + o + "′" + i + "″" : 1 == n ? r + "°" + o + "′" : void 0;
}
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment