Commit 22bf6962 authored by 何娜's avatar 何娜

增加ws

parent 412d9ef5
Pipeline #27997 passed with stage
in 1 minute 45 seconds
...@@ -27,18 +27,6 @@ class TaskController extends Controller { ...@@ -27,18 +27,6 @@ class TaskController extends Controller {
this.taskIdRule = { this.taskIdRule = {
taskId: { type: 'string', format: /\d+/ }, taskId: { type: 'string', format: /\d+/ },
}; };
this.cityListRule = {
sign: 'string',
params: {
type: 'object',
rule: {
token: 'string',
appKey: 'string',
timestamp: 'string',
},
},
};
} }
async configs() { async configs() {
......
const CanvasKit = (function() {
const Easing = {
Linear: {
None(k) {
return k;
},
},
Quadratic: {
In(k) {
return k * k;
},
Out(k) {
return k * (2 - k);
},
InOut(k) {
if ((k *= 2) < 1) {
return 0.5 * k * k;
}
return -0.5 * (--k * (k - 2) - 1);
},
},
Cubic: {
In(k) {
return k * k * k;
},
Out(k) {
return --k * k * k + 1;
},
InOut(k) {
if ((k *= 2) < 1) {
return 0.5 * k * k * k;
}
return 0.5 * ((k -= 2) * k * k + 2);
},
},
Quartic: {
In(k) {
return k * k * k * k;
},
Out(k) {
return 1 - (--k * k * k * k);
},
InOut(k) {
if ((k *= 2) < 1) {
return 0.5 * k * k * k * k;
}
return -0.5 * ((k -= 2) * k * k * k - 2);
},
},
Quintic: {
In(k) {
return k * k * k * k * k;
},
Out(k) {
return --k * k * k * k * k + 1;
},
InOut(k) {
if ((k *= 2) < 1) {
return 0.5 * k * k * k * k * k;
}
return 0.5 * ((k -= 2) * k * k * k * k + 2);
},
},
Sinusoidal: {
In(k) {
return 1 - Math.cos(k * Math.PI / 2);
},
Out(k) {
return Math.sin(k * Math.PI / 2);
},
InOut(k) {
return 0.5 * (1 - Math.cos(Math.PI * k));
},
},
Exponential: {
In(k) {
return k === 0 ? 0 : Math.pow(1024, k - 1);
},
Out(k) {
return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
},
InOut(k) {
if (k === 0) {
return 0;
}
if (k === 1) {
return 1;
}
if ((k *= 2) < 1) {
return 0.5 * Math.pow(1024, k - 1);
}
return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);
},
},
Circular: {
In(k) {
return 1 - Math.sqrt(1 - k * k);
},
Out(k) {
return Math.sqrt(1 - (--k * k));
},
InOut(k) {
if ((k *= 2) < 1) {
return -0.5 * (Math.sqrt(1 - k * k) - 1);
}
return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
},
},
Elastic: {
In(k) {
if (k === 0) {
return 0;
}
if (k === 1) {
return 1;
}
return -Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI);
},
Out(k) {
if (k === 0) {
return 0;
}
if (k === 1) {
return 1;
}
return Math.pow(2, -10 * k) * Math.sin((k - 0.1) * 5 * Math.PI) + 1;
},
InOut(k) {
if (k === 0) {
return 0;
}
if (k === 1) {
return 1;
}
k *= 2;
if (k < 1) {
return -0.5 * Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI);
}
return 0.5 * Math.pow(2, -10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI) + 1;
},
},
Back: {
In(k) {
const s = 1.70158;
return k * k * ((s + 1) * k - s);
},
Out(k) {
const s = 1.70158;
return --k * k * ((s + 1) * k + s) + 1;
},
InOut(k) {
const s = 1.70158 * 1.525;
if ((k *= 2) < 1) {
return 0.5 * (k * k * ((s + 1) * k - s));
}
return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
},
},
Bounce: {
In(k) {
return 1 - TWEEN.Easing.Bounce.Out(1 - k);
},
Out(k) {
if (k < (1 / 2.75)) {
return 7.5625 * k * k;
} else if (k < (2 / 2.75)) {
return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;
} else if (k < (2.5 / 2.75)) {
return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;
}
return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;
},
InOut(k) {
if (k < 0.5) {
return TWEEN.Easing.Bounce.In(k * 2) * 0.5;
}
return TWEEN.Easing.Bounce.Out(k * 2 - 1) * 0.5 + 0.5;
},
},
};
const _animates = [];
const _timers = [];
function mix(x, y, a) {
if (x instanceof Array) {
const v = [];
for (let i = 0; i < x.length; i++) {
v.push(x[i] * (1 - a) + y[i] * a);
}
return v;
}
return x * (1 - a) + y * a;
}
function convertColor(color, alpha) {
if (typeof color === 'number') {
let r = 0xff & (color >> 16),
g = 0xff & (color >> 8),
b = 0xff & color,
a = Math.max(0, Math.min(1, alpha));
return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
}
}
function reverseConvertColor(color) {
if (color) {
if (typeof color === 'number') {
return Math.max(0, Math.min(0xffffff, Math.round(color)));
} else if (typeof color === 'string') {
if (/^#([0-9a-f]{3}){1,2}$/gi.test(color)) {
color = color.toLowerCase();
const icolor = parseInt('0x' + color.substr(1));
if (color.length == 4) { // #123 => #112233
let r = 0xf & (icolor >> 8),
g = 0xf & (icolor >> 4),
b = 0xf & icolor;
return ((r << 4) + r << 16) + ((g << 4) + g << 8) + (b << 4) + b;
}
return icolor;
}
}
}
return 0x0;
}
function distance(a, b) {
return Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));
}
function extendClass(A, B, object) {
function _(object) {
for (const prop in object) {
this[prop] = object[prop];
}
}
_.prototype = new B();
A.prototype = new _(object instanceof Object ? object : {});
}
function Timer() {
this.elapsedTime = 0;
this.interval = 0;
this._stop = !0;
this._speed = 1;
this._tick = { duration: 0, lastCallTime: 0, fn: false };
}
Timer.prototype = {
start() {
if (!this._stop) {
return;
}
this._stop = !!0;
this._startTime = +new Date();
this._lastTime = this._startTime;
_timers.push(this);
if (this._tick.duration > 0) {
this._tick.lastCallTime = this.elapsedTime;
}
typeof this.begin === 'function' && this.begin();
return this;
},
reset() {
if (!this._stop) {
this.elapsedTime = 0;
}
this._tick.duration = 0;
this._tick.fn = false;
this._tick.lastCallTime = 0;
},
repeat(duration, fn) {
duration = Math.round(+duration);
if (duration > 0 && typeof fn === 'function') {
this._tick.duration = duration;
this._tick.fn = fn;
this._tick.lastCallTime = this._stop ? 0 : this.elapsedTime;
}
return this;
},
hit() {
const currentTime = +new Date();
this.interval = (currentTime - this._lastTime) * this._speed;
this.elapsedTime += this.interval;
typeof this.update === 'function' && this.update(this.elapsedTime, this.interval);
this._lastTime = currentTime;
if (this._tick.duration > 0) {
if (this.elapsedTime >= this._tick.lastCallTime + this._tick.duration) {
this._tick.fn.call(this);
this._tick.lastCallTime += Math.round((this.elapsedTime - this._tick.lastCallTime) / this._tick.duration) * this._tick.duration;
}
}
},
stop() {
this._stop = !0;
for (let i = 0; i < _timers.length; i++) {
if (_timers[i] == this) {
_timers.splice(i, 1);
break;
}
}
return this;
},
};
function Canvas(a) {
}
Canvas.prototype = {
_init(a) {
a = a || {},
this._canvas = document.querySelector(a.target ? a.target : 'canvas'),
this._context = this._canvas.getContext('2d'),
this._pixelRatio = a.pixelRatio || ('ontouchstart' in window) ? function() {
let a = window.devicePixelRatio || 1,
c = this.webkitBackingStorePixelRatio
|| this.mozBackingStorePixelRatio
|| this.msBackingStorePixelRatio
|| this.oBackingStorePixelRatio
|| this.backingStorePixelRatio || 1;
return a / c;
}.bind(this._canvas)() : 1,
'width' in a && 'height' in a ? this.setSize(a.width, a.height) : this.setSize(this._canvas.offsetWidth, this._canvas.offsetHeight),
this._canvas.style.padding = 0,
this._canvas.style.margin = 0,
this._canvas.style.border = 0,
this._canvas.style.background = 'transparent';
},
getContext() {
return this._context;
},
getPixelRatio() {
return this._pixelRatio;
},
setPixelRatio(a) {
this._pixelRatio = a,
this.setSize(this.getWidth(), this.getHeight());
},
setWidth(a) {
this._width = this._canvas.width = a * this._pixelRatio,
this._canvas.style.width = a + 'px';
},
setHeight(a) {
this._height = this._canvas.height = a * this._pixelRatio,
this._canvas.style.height = a + 'px';
},
getWidth() {
return this._width;
},
getHeight() {
return this._height;
},
setSize(a, b) {
this.setWidth(a),
this.setHeight(b);
},
};
function Animate(opt) {
opt = opt || {};
this.node = opt.node;
this.timer = new Timer();
}
Animate.prototype = {
update() {
return (!('_update' in this)) || !!this._update.apply(this, [this.timer.interval, this.timer.elapsedTime]);
},
play() {
return '_start' in this && this._start.apply(this, arguments),
this.startTime = +new Date(),
_animates.push(this),
this.timer.start(),
this;
},
pause() {
for (let i = 0; i < _animates.length; i++) {
if (_animates[i] == this) {
_animates.splice(i, 1);
break;
}
}
return this;
},
};
function Drawer() {
this.position = [0, 0];
this.color = 0x000000;
this.alpha = 1;
this.shadow = { enabled: false, offset: { x: 0, y: 0 }, blur: 2, color: undefined, alpha: undefined };
}
Drawer.prototype = {
draw() {
'_draw' in this && this._draw.apply(this, arguments);
},
};
function Cirque(radius, tube, position, arc) {
this.radius = radius;
this.tube = tube;
this.position = position instanceof Array ? position : (position instanceof Object ? [+position.x, +position.y] : [0, 0]);
this.arc = arc;
}
extendClass(Cirque, Drawer, {
_draw(context) {
context.save();
context.lineWidth = this.tube;
context.strokeStyle = convertColor(this.color, this.alpha);
context.beginPath();
context.arc(this.position[0], this.position[1], this.radius, 0, this.arc, false);
context.closePath();
context.stroke();
context.restore();
},
});
function Circle(radius, position, color) {
this.radius = radius;
this.position = position instanceof Array ? position : (position instanceof Object ? [+position.x, +position.y] : [0, 0]);
this.color = reverseConvertColor(color);
}
extendClass(Circle, Drawer, {
_draw(ctx) {
ctx.save();
if (this.shadow.enabled) {
ctx.shadowOffsetX = this.shadow.offset.x;
ctx.shadowOffsetY = this.shadow.offset.y;
ctx.shadowBlur = this.shadow.blur;
ctx.shadowColor = convertColor(this.shadow.color === undefined ? this.color : this.shadow.color, 1); // 颜色
}
ctx.save();
ctx.fillStyle = convertColor(this.color, this.alpha);
ctx.beginPath();
ctx.arc(this.position[0], this.position[1], this.radius, 0, Math.PI * 2, true);
ctx.closePath();
ctx.fill();
ctx.restore();
},
rect() {
return { position: { x: -this.radius, y: -this.radius }, size: { width: this.radius * 2, height: this.radius * 2 } };
},
});
function Stage(a) {
this._init(a);
this._objects = [];
}
extendClass(Stage, Canvas, {
add(object) {
this._objects.push(object);
return this;
},
draw() {
let count = this._objects.length,
pixelRatio = this.getPixelRatio(),
context = this.getContext(),
width = this.getWidth(),
height = this.getHeight();
context.clearRect(0, 0, width, height);
for (let i = 0; i < count; i++) {
this._objects[i].draw(context);
}
},
});
function Renderer(stage) {
this._stop = true;
this._speed = 1;
this._stage = stage;
this._listeners = {};
}
Renderer.prototype = {
_draw() {
this._stage.draw();
},
setSpeed(speed) {
this._speed = speed;
},
pause() {
this._stop = true;
},
on(type, fn) {
type = type.replace(/^\s*|\s*$/gi, '');
if (/\s+/.test(type)) {
type.split(/\s+/).forEach(function(v, k) {
this.on(v, fn);
}, this);
return this;
}
if (typeof this._listeners[type] === 'undefined') {
this._listeners[type] = [];
}
if (typeof fn === 'function') {
this._listeners[type].push(fn);
}
return this;
},
off(type, fn) {
type = type.replace(/^\s*|\s*$/gi, '');
if (/\s+/.test(type)) {
type.split(/\s+/).forEach(function(v, k) {
this.on(v, fn);
}, this);
return this;
}
const arrayEvent = this._listeners[type];
if (typeof type === 'string' && arrayEvent instanceof Array) {
if (typeof fn === 'function') {
// 清除当前type类型事件下对应fn方法
for (let i = 0, length = arrayEvent.length; i < length; i += 1) {
if (arrayEvent[i] === fn) {
this._listeners[type].splice(i, 1);
break;
}
}
} else {
// 如果仅仅参数type, 或参数fn邪魔外道,则所有type类型事件清除
delete this._listeners[type];
}
}
return this;
},
trigger(type) {
type = type.replace(/^\s*|\s*$/gi, '');
const args = Array.prototype.slice.call(arguments, 1);
args.unshift(new Event(type));
const arrayEvent = this._listeners[type];
if (arrayEvent instanceof Array) {
for (let i = 0, length = arrayEvent.length; i < length; i += 1) {
if (typeof arrayEvent[i] === 'function') {
arrayEvent[i].apply(this, args);
}
}
}
return this;
},
run() {
if (!this._stop) {
return;
}
this._stop = false;
const self = this;
this._startTime = +new Date();
this._lastTime = this._startTime;
this.elapsedTime = 0;
var tick = function() {
if (this._stop) {
return;
}
requestAnimationFrame(tick);
const currentTime = +new Date();
this.interval = (currentTime - this._lastTime) * this._speed;
this.elapsedTime += this.interval;
for (var i = 0; i < _timers.length; i++) {
(_timers[i]._speed = this._speed) && _timers[i].hit();
}
for (var i = 0; i < _animates.length; i++) {
if (_animates[i].update()) {
}
}
this.trigger('update', this.interval, this.elapsedTime);
this._draw();
this._lastTime = currentTime;
}.bind(this);
tick();
},
};
return {
convertColor,
reverseConvertColor,
distance,
mix,
extendClass,
Easing,
Stage,
Cirque,
Circle,
Timer,
Animate,
Renderer,
};
})();
'use strict';
window.onerror = function(errorMessage, scriptURI, lineNumber, columnNumber, errorObj) {
const enabled_log_back = console.enabled_server_log;
console.enabled_server_log = true;
console.log(arguments);
console.enabled_server_log = enabled_log_back;
};
function getURLParams(url) {
const urlParts = url.split('?');
const result = {};
if (urlParts[1]) {
const params = urlParts[1].split('&');
for (let i = 0; i < params.length; ++i) {
const item = params[i].split('=');
const key = decodeURIComponent(item[0]);
const uri_encoded = item[1].replace(/%([^\da-fA-f].)/, '%25$1');
const val = decodeURIComponent(uri_encoded);
result[key] = val;
}
}
return result;
}
function serializeParams(data) {
let serializedParams = '';
for (const pro in data) {
serializedParams += (serializedParams.length ? '&' : '') + pro + '=' + encodeURIComponent(data[pro]);
}
return serializedParams;
}
function getParams(data, key, default_value) {
if (data != undefined) {
return key in data ? data[key] : default_value;
}
return default_value;
}
function isFunction(fn) {
return typeof fn === 'function';
}
function defineReactive(obj, key, val, before_change, after_change, flags) {
let blocking = false,
setter,
getter;
flags = flags || 0; // 第1位 值一样的情况下是否触发
if (val instanceof Object && isFunction(val.set) && isFunction(val.get)) {
setter = val.set;
getter = val.get;
} else {
getter = function() { return val; };
setter = function(newVal) { val = newVal; };
}
Object.defineProperty(obj, key, {
enumerable: true,
configurable: true,
get: function reactiveGetter() {
return getter.call(obj);
},
set: function reactiveSetter(newVal) {
if (blocking) {
return;
}
blocking = true;
do {
if (val === newVal && !(flags & 1)) {
break;
}
if (isFunction(before_change) && before_change.call(obj, val, newVal) === true) {
break;
}
const originVal = val;
try {
setter.call(obj, newVal);
isFunction(after_change) && after_change.call(obj, originVal, val);
} catch (e) {
blocking = false;
throw e;
}
} while (false);
blocking = false;
},
});
}
function loadScript(url, fn, error) {
const script = document.createElement('script');
script.type = 'text/javascript';
if (script.readyState) {
script.onreadystatechange = function() {
if (script.readyState == 'loaded' || script.readyState == 'complete') {
script.onreadystatechange = null;
isFunction(fn) && fn();
}
};
} else {
script.onload = function() {
isFunction(fn) && fn();
};
script.onerror = function() {
isFunction(error) && error();
};
}
script.src = url;
document.body.appendChild(script);
}
function doAjax(args) {
let request = new XMLHttpRequest(),
url = getParams(args, 'url', ''),
data = getParams(args, 'data', {}),
contentType = getParams(args, 'contentType', 'application/x-www-form-urlencoded'),
type = getParams(args, 'type', 'get');
request.onreadystatechange = function() {
console.log(args, '【doAjax】request=====', JSON.stringify(request))
if (request.readyState == 4) {
if (request.status == 200) {
let dataType = null;
if ('dataType' in args) {
dataType = args.dataType;
} else {
if (/\bContent\-Type\s*:\s* ([^\n;]+)(?=\n|;)/i.test(request.getAllResponseHeaders())) {
const contentType = RegExp.$1;
if (/\bjson\b/i.test(contentType)) {
dataType = 'json';
} else {
dataType = 'text';
}
}
}
let data = null;
if (/^json$/i.test(dataType)) {
data = JSON.parse(request.responseText);
} else {
data = request.responseText;
}
try {
if (typeof args.success === 'function') {
args.success(data);
}
} catch (e) {
}
} else {
if (typeof args.error === 'function') {
args.error(request.status);
}
}
}
};
request.onloadstart = function() {
if (typeof args.loadstart === 'function') {
args.loadstart();
}
};
request.onprogress = function(event) {
if (typeof args.progress === 'function') {
args.progress(event);
}
};
request.timeout = getParams(args, 'timeout', 0);
if (/^post$/gi.test(type)) {
request.open('POST', url, true);
request.setRequestHeader('Content-Type', contentType);
if (contentType == 'application/x-www-form-urlencoded') {
var content = typeof data === 'string' ? data : serializeParams(data);
request.send(content);
} else if (contentType == 'application/json') {
var content = typeof data === 'string' ? data : JSON.stringify(data);
request.send(content);
}
} else {
url += (url.indexOf('?') >= 0 ? '&' : '?') + serializeParams(data);
request.open('GET', url, true);
request.send();
}
}
function doJsonAjax(url, data, success, failed, loadstart, progress) {
doAjax({
url,
type: 'post',
data,
contentType: 'application/json',
success,
error: failed,
loadstart,
progress,
});
}
function extendMethod(class_name, method_set) {
for (const method_name in method_set) {
class_name.prototype[method_name] = method_set[method_name];
}
}
function EventListener() {
}
extendMethod(EventListener, {
on(event, func) {
if (typeof event === 'string' && typeof func === 'function') {
const list = this['on' + event + 'list'];
if (list instanceof Array) {
for (let i = 0; i < list.length; i++) {
if (list[i] === func) {
return this;
}
}
list.push(func);
} else {
this['on' + event + 'list'] = [func];
}
}
return this;
},
off(event, func) {
const list = this['on' + event + 'list'];
if (list instanceof Array) {
if (!func) {
list.length && list.splice(0, list.length);
} else {
for (let i = 0; i < list.length; i++) {
if (list[i] === func) {
list.splice(i, 1);
break;
}
}
}
}
return this;
},
trigger(event) {
let result = false,
list = this['on' + event + 'list'];
if (list instanceof Array) {
for (let i = 0; i < list.length; i++) {
const func = list[i];
if (typeof func !== 'function') {
continue;
}
const args = Array.prototype.slice.call(arguments, 0);
args.shift();
result = result || func.apply(this, args);
}
}
return result;
},
});
function __() {
this.timer = 0;
this.queue = [];
this.complete = null;
}
__.prototype.then = function(cb, delay) {
this.queue.push({ callback: cb, delay });
return this;
};
__.prototype.end = function(cb) {
this.complete = cb;
return this;
};
__.prototype.abort = function() {
if (this.timer) {
clearTimeout(this.timer);
this.timer = 0;
}
return this;
};
__.prototype.commit = function() {
const self = this;
if (this.queue.length && !this.timer) {
const top = this.queue.shift();
if (typeof top.callback === 'function') {
if (typeof top.delay !== 'number' || top.delay <= 0) {
top.callback.apply(self);
this.commit();
} else {
this.timer = setTimeout(function() {
top.callback.apply(self);
self.timer = 0;
self.commit();
}, top.delay);
}
} else {
self.commit();
}
} else if (!this.queue.length && !this.timer) {
if (typeof this.complete === 'function') {
this.complete.apply(this);
this.complete = null;
}
}
return this;
};
function then(cb, delay) {
return (new __()).then(cb, delay);
}
$(function() {
document.body.addEventListener('touchstart', function() {});
});
window.console = (function() {
const log = console.log;
let message_queue = new Array();
function _() {
this._init();
}
_.prototype = console;
console._init = function() {
this.enabled_server_log = false;
this.enabled_window_log = false;
};
console.log = function(msg) {
log.call(this, msg);
this._server_log(msg);
this._window_log(msg);
};
console._server_log = function(msg) {
if (!this.enabled_server_log) {
return;
}
if (msg instanceof Object) {
msg = JSON.stringify(msg);
} else {
msg = '' + msg;
}
message_queue.push({ time: +new Date(), message: msg });
this._check_queue();
};
console._window_log = function(msg) {
};
console._check_queue = function() {
if (this._server_flag) {
return;
}
if (message_queue.length > 0) {
// 消息队列队首元素
this._server_flag = true;
setTimeout(function() {
const data = message_queue;
message_queue = [];
doJsonAjax(constant.project_root + 'log', data, function() {
message_queue.shift();
this._server_flag = false;
this._check_queue();
}.bind(this));
}.bind(this), 20);
}
};
return new _();
})();
$(function() {
const C = CanvasKit;
const searchObject = searchToObject();
const netMark = searchObject.netMark || 0;
const userAppKey = searchObject.appkey || '';
const orderSn = searchObject.orderSn;
const protocol = searchObject.protocol;
let step = 0;
let title = '';
let agreement_time = '';
const yysTag = searchObject.yysTag || '';
$('.checkbox-wrapper input').off('click').on('click', function() {
if (!agreement_time) {
agreement_time = new Date();
}
});
$("input[name='args[phoneCode]']").eq(0).attr('disabled', 'disabled');
const appKeypart = ['61F5B4BDF4FF4C13A8C15FCF877C7EC4',
'417684C3D8144AD4B3E2BB8E57DCEE20',
'62CF4C62054447778275C5EC8BC6C1E1',
'3446C5603585451A9D526622EEF7227F',
'FFB91058E54C41C58293AC420E7AA59E',
'BF1166D8FD3748CAAB7F668B582B83DA',
'A85EACCFADAF4CC5A6DFB87C142F14F1',
'4B0CDD36D797429DB461BB53C68397D6',
'4662EDDC0A554C5BAAB06177C830D63B',
'A754546E72CA426EBBC402524A9C14AF',
'01A82ADD49884956A34A50F15BBB6916',
'D99BDCB5F7984494B06765CD63210D75',
'402C6D7F31E94A76910AE3BC7E35934A',
'D0DFFCC77DFC4B54B162F3AF644C490E',
'3F55FF7371A5413B8C323B1D58B99A07',
'E63B5A52077D48AEB991FFB9E617C680',
'12C7612FE27F4C779AB37EE52DB107F8',
'DB3E3A5AB86C40769882D209D4671370',
'819C519455474A19977F742488F203A8',
'D5D8CB53EF8849ED83BBE6E2A17406AA',
'59FE7EF89A154392874145A440F0DD75',
'25C41ED5D848FDCAB22384AFB7FAEC65',
'1B5463BB8E84425CA9B0FA3D37524920',
'8BD467BBFB4446989276AA4DDA57DD57',
'08216F6A12374BD721B922FC1F357EE2',
'2941942E89E04378BCA25D57340B5386',
'339948E78C2F437485C1726DDFE311ED',
'3B5E00F50C3826439EFA9D71A98F1F29',
'430FB7B62D9F4960B7CBDFA16432D279',
'4B92963DEF82C723FF63A692297D2148',
'57F7ED91A17C4D428A7877F401B367D9',
'5AF04BCAC0714C3DACE580BE028C8F28',
'5C94484869DFFF8ECF83FEC6FF04905C',
'64AC8AF9FC3F4B008A4C56FD418CA36A',
'65EAE57B7AF747F1885438F9CC4DDCE3',
'712C3D728D1940F6ACF948B9CD8EC49B',
'7E6AA154E5444BD6816719D82BC40F00',
'8C13752159AC317F7A84DCF62DF5C436',
'A3D62145EBF14E0B9D8A4DCEE43859CC',
'B4B44488770F4C3686C077EFE2FE3BED',
'B951C01F74E94A96AA82EA6192958DEC',
'DD3CA30BCA194697B1927956E243295E',
'DF33D83AE4564083927CC708A4FB07C1',
'E6B4EDDFA39849C6A39DDCB3E124BADA',
'BAAB1BF2E9E8487AA3F2A2238A59558C',
'06A8C51AB9264375BDBDD54B54DC5B9E',
'A27E54F49A904F1FA4210FEE8EDAA6BB',
'46EBBE8468C244E9BB41FE706DB7E7E7',
'58667FEE58DF4BBC8CBDE6467C407640',
'B6AD339513824FCE851BF0FED5FD1D37',
'75581CB02FAA4D66AAFF0816384E5818',
'49F4339164C14787AE83504CDEDA8846',
'0B7E2FE88610448E804875DB4C4DF26E',
'AD62BFD1314941DE8A78C9A840455528',
'82FFDEC41EBA4C9D81472CA1F59C1B3F',
'E1422BD4383E463FB5DD502D5AD880DC',
'EC7DEA631E5F491F9FD4BC23AD5278BE',
];
const appKeypart2 = ['63FF7357DB16733ACD5A026EDFD276FB',
'897AA35E876E79DEB38AE8ABB4BD3F42',
'5BD31639D6E5872B98A9E000DE4AD9E1',
'B68C0F9FD465A5E743D07D32A0FAAC13',
'3B5E00F50C3826439EFA9D71A98F1F29',
'E6B4EDDFA39849C6A39DDCB3E124BADA',
'6FE35C37D51EA5F15D0DC38342F1095D',
'2BB4A17197997332CB1F5E58ED0F8479',
'81C441A34D03C6215D6538DAAB0B7E4A',
'AF661B2B08614497A6FDA311155B56EE',
'08216F6A12374BD721B922FC1F357EE2',
'992FEE936B01D09F414165C5AFBC873F',
'9B6435BC81AC4FD8ED050E250B413328',
'5C94484869DFFF8ECF83FEC6FF04905C',
'2033A6F5E06351088DC46B6E46E0728E',
'7DBDC5F3C0D4AD328FC7CCC679C6A6DB',
'29DF6E815D51470AB6D6E67FCC577171',
'635F0982AFCF4E4D932E7DED120AA267',
'658DB609A2EB48C3880B4E156CD78002',
'8ABE3AD90E304C9FBEFD763D183F8DA8',
'1F8ADFDBFADC4B2FB6746FE0EC9D37B6',
'7AF3C05274FA42CEA073BD8A8BCB48D7',
'39614E9D0BC54FB8ADE55E95AFBD0CEE',
'F3DAF191460148AE953AC55BD28E2A79',
'3993B46AE2CB48EE973029DBB922308A',
'DE0B276B7C3247D6B2E8CF37E21AE007',
'C585193F07B74FB3AFC816F0E0280C37',
'C57B3E06C6984856BAF45E55FF3F6F83',
'4E1630EE463443E1B64C0ABC694E105E',
'249DFAFC07A1485D92380BD4BD7B5A80',
'299F779279FA4777B5F4506F841100C0',
'09BAB3F1F0004941968465755A955345',
'5F49A7CAC1AE40F6B747DAC8A38303DD',
'FBE192E391214203B477E908800200DB',
'2CB0171848364AA4BE8A6976EB4C0E54',
'34291266BC4F4758A50916EE875F1B61',
'8F637A7CD0620B6C2CCDC478A7C4CDC0',
'310C76C6BBB4404EB19EF6A48F2FC4D5',
'9BAC6DF923024B0A8F7A9A4260BB790D',
'526638E07DA2480CB05FD7D481932D48',
'B212CCCD6F254617982EACAEE49A61BD',
'9569888626894849BBD08C32402A68C9',
'8902AC29CBCD45D48F6736BB6E268539',
'CF952A13C637426687D1BA6D4132B4CD',
'EC3C2F114CF14701899F71821AEFFC10',
'80517DC1EB524E0CB32EAADC68FE92EB',
'3FA8C14350C646E4A39B46D4C7F87579',
'BF621B76957A4EF09196CCE41EE5085B',
'B9FE36C3F77F49599B5CFC90320F29CF',
'34F251656B5E4B0B9DD1D7E252C2436E',
'8FBAD81E9DE917A5A4371B5C241B2C2E',
'C6D5C77B20B996819795752415803338',
'5A96628C6920493C87772C46A9C0812A',
'8B58D7925FF04FA7A909750963B02FC4',
'AA6E00B81B00B3EFBCBD8BBD3C6B2BFD',
'0534D2DB0B464BFABB3F4731A0194E51',
'F19DFA024E224BCA9261684B3E944184',
'82273BBBA0964515B6A73D0B0FF6F638',
'FF9EF6C998004B488CB240DC386AA6C1',
'2DE70E0C739F470DB455FF34503C1A26',
'799C4C43EA9E43908B4CDD107F735FEB',
'737F8B7A649F42B7B90213BD276F05A2',
'3035C0771960447EA007743BF3C2B22F',
'5F67C71FB7894BDD864592783E8D1950',
'1845F4CAED6849DD9D7AF9F074C33CD1',
'C08F35217A23414484EBA11528C8787C',
'98D46FB4C4E9463ABEE61A8DA8CFE458',
'FD999468046C4AC985C8FEAAB0092749',
'F19DFA024E224BCA9261684B3E944184',
'7481866537B9452EA582E0C72DA3C4D2',
];
// if(userAppKey=="E6B4EDDFA39849C6A39DDCB3E124BADA"){
// $('.kefu').html('400-873-5151').attr('href','tel:4008735151');
// }
// if(userAppKey=="08216F6A12374BD721B922FC1F357EE2"){
// $('.kefu').html('400-691-5151').attr('href','tel:4006915151');
// }
// if(userAppKey=="5C94484869DFFF8ECF83FEC6FF04905C"){
// $('.kefu').html('400-860-1515').attr('href','tel:4008601515');
// }
console.enabled_server_log = constant.debug;
function replaceParamVal(paramName, replaceWith) {
const oUrl = this.location.href.toString();
const re = eval('/(' + paramName + '=)([^&]*)/gi');
const nUrl = oUrl.replace(re, paramName + '=' + replaceWith);
return nUrl;
}
function TimingAnimate(opt) {
C.Animate.call(this, opt);
this.shifting = 0;
this.fn = opt.fn;
this.initial_velocity = +(opt.velocity || opt.v || 0);
this.max_velocity = +(opt.max_velocity || opt.max_v || 0);
this.acceleration = +(opt.acceleration || opt.a || 0);
this.velocity = this.initial_velocity;
}
C.extendClass(TimingAnimate, C.Animate, {
_start() {
this.shifting = 0;
this.velocity = this.initial_velocity;
},
_update(interval, elapsedTime) {
let t = elapsedTime / 1000, // 总时间
a = this.acceleration, // 加速度
t0 = (this.max_velocity - this.initial_velocity) / a, // 达到最大速度时间点
t1 = t < t0 ? t : t0, // 匀加速时间
t2 = t > t0 ? t - t0 : 0, // 匀速时间
v0 = this.initial_velocity, // 初速度
mv = this.max_velocity; // 最大速度
this.shifting = v0 * t1 + 0.5 * a * t1 * t1 + mv * t2;
this.velocity = v0 + a * t1;
for (const key in this.fn) {
if ((key === 'position' || key === 'alpha' || key === 'color') && typeof this.fn[key] === 'function') {
this.node[key] = this.fn[key].call(this, this.shifting);
}
}
},
});
function Ball(radial_radius, radius, position, color) {
C.Circle.call(this, radius, position, color);
this.turning_velocity = 4;
this.shadow.alpha = 1;
this.status = 'none';
this.center = this.position;
this.radial_radius = radial_radius;
this.tube = radius * 2;
this.radius = radius * 1.4;
const scale = 0.85;
this.points = {
a: [this.center[0] - this.radial_radius * 0.40 * scale, this.center[1] - this.radial_radius * 0.10 * scale],
b: [this.center[0] - this.radial_radius * 0.12 * scale, this.center[1] + this.radial_radius * 0.30 * scale],
c: [this.center[0] + this.radial_radius * 0.57 * scale, this.center[1] - this.radial_radius * 0.31 * scale],
};
this.turning_angle = (function(points, o, r) {
// ax + by + c = 0;
let a = points.b[1] - points.a[1],
b = points.a[0] - points.b[0],
c = points.b[0] * points.a[1] - points.a[0] * points.b[1],
d = Math.abs((a * o[0] + b * o[1] + c) / Math.sqrt(a * a + b * b));
return Math.PI * 2 - Math.acos(d / r) - Math.atan(-a / b);
})(this.points, this.center, this.radial_radius);
}
C.extendClass(Ball, C.Circle, {
_draw(ctx) {
switch (this.status) {
case 'none':
this._draw_none(ctx);
break;
case 'timer':
case 'timer+':
this._draw_run_timer(ctx);
break;
case '-loader':
this._draw_will_loader(ctx);
break;
case 'loader':
this._draw_run_loader(ctx);
break;
case 'loaded':
this._draw_will_do(ctx);
break;
case 'doing':
this._draw_run_doing(ctx);
break;
case 'done':
this._draw_run_done(ctx);
break;
default:
}
},
_get_stretch_rate() {
return Math.max(0, (this.animate.velocity - this.turning_velocity) / (this.animate.max_velocity - this.turning_velocity));
},
_get_I() {
return Math.max(0, Math.PI * 2 * 0.05 * this._get_stretch_rate());
},
_get_point_angle(angle) {
return this.animate.fn.position.call(this.animate, angle);
},
_play() {
const fn = function(s) {
return [this.node.center[0] + this.node.radial_radius * Math.sin(s),
this.node.center[1] + this.node.radial_radius * Math.cos(s)];
};
this.animate = new TimingAnimate({
node: this,
v: 2,
max_v: 10,
a: 0.1,
fn: {
position: fn,
},
});
this.position = fn.bind(this.animate)(0);
this.animate.play();
this.status = 'loader';
},
_draw_none(ctx) {
},
_draw_run_timer(ctx) {
let elapsedTime = this.timer.elapsedTime,
finishedTime = Math.round(this.time) * 1000,
startAngle = -Math.PI / 2,
angle = Math.PI * 2;
if (finishedTime > elapsedTime) {
let elapsedSec = Math.floor(elapsedTime / 1000) * 1000,
elapsedMs = elapsedTime - elapsedSec,
beatMs = 800;
angle *= elapsedSec / finishedTime;
if (elapsedMs > 1000 - beatMs) {
angle += Math.PI * 2000 * C.Easing.Quadratic.InOut(C.mix(0, 1, (elapsedMs - (1000 - beatMs)) / beatMs)) / finishedTime;
}
} else {
this.timer.stop();
this.status = 'timer+';
}
ctx.save();
ctx.lineWidth = this.tube;
ctx.strokeStyle = C.convertColor(this.color, this.alpha);
ctx.beginPath();
ctx.arc(this.center[0], this.center[1], this.radial_radius, startAngle, startAngle + angle, false);
ctx.stroke();
ctx.restore();
},
_draw_will_loader(ctx) {
let elapsedTime = this.timer.elapsedTime,
finishedTime = 400,
startAngle = -Math.PI / 2,
endAngle = startAngle + Math.PI * 2;
if (finishedTime > elapsedTime) {
const a = C.Easing.Quadratic.InOut(finishedTime > elapsedTime ? elapsedTime / finishedTime : 1);
const b = Math.PI * a;
startAngle += b;
endAngle -= b;
if (endAngle <= startAngle) {
endAngle = startAngle;
}
ctx.save();
ctx.lineCap = 'round';
ctx.lineWidth = C.mix(this.tube, this.radius * 2, a);
ctx.strokeStyle = C.convertColor(this.color, this.alpha);
ctx.beginPath();
ctx.arc(this.center[0], this.center[1], this.radial_radius, startAngle, endAngle, false);
ctx.stroke();
ctx.restore();
} else {
this._play();
}
},
_draw_run_loader(ctx) {
let v = this.animate.velocity,
stretch_rate = this._get_stretch_rate(),
s = this.animate.shifting || 0;
if (v > this.turning_velocity) {
this.shadow.enabled = true;
this.shadow.blur = Math.round(6 * stretch_rate);
this.alpha = 0.4 + 0.6 * (1 - stretch_rate);
} else {
this.shadow.enabled = false;
this.shadow.blur = 0;
this.alpha = 1;
}
// C.Circle.prototype._draw.call(this,ctx);
ctx.save();
if (v <= this.turning_velocity) {
ctx.fillStyle = C.convertColor(this.color, this.alpha);
ctx.beginPath();
ctx.arc(this.position[0], this.position[1], this.radius, 0, Math.PI * 2, true);
ctx.closePath();
ctx.fill();
} else {
let points = [],
dI = this.radius / this.radial_radius / 3,
I = this._get_I();
this._draw_ring(ctx, s, this._get_I(), 0);
}
ctx.restore();
},
_draw_ring(ctx, start_angle, I, is_gradient) {
let points = [],
dI = this.radius / this.radial_radius / 3;
for (var i = 0; i * dI <= I; i++) {
points.push(this._get_point_angle(start_angle - i * dI));
}
is_gradient = !!is_gradient;
let alpha = is_gradient ? 1 : this.alpha;
ctx.strokeStyle = C.convertColor(this.color, alpha);
ctx.fillStyle = ctx.strokeStyle;
ctx.shadowOffsetX = this.shadow.offset.x;
ctx.shadowOffsetY = this.shadow.offset.y;
ctx.shadowBlur = this.shadow.blur;
ctx.shadowColor = C.convertColor(this.color, 1); // 颜色
let circle_start_angle = -start_angle + Math.PI * 0.5;
ctx.beginPath();
ctx.arc(points[0][0], points[0][1], this.radius, circle_start_angle, circle_start_angle + Math.PI, true);
ctx.closePath();
ctx.fill();
var length = points.length,
point = points.shift(),
i = 0;
if (points.length) {
ctx.beginPath();
ctx.moveTo(point[0], point[1]);
while (points.length) {
if (is_gradient) {
alpha = C.mix(1, this.alpha, C.Easing.Cubic.Out(i / length));
ctx.strokeStyle = C.convertColor(this.color, alpha);
ctx.fillStyle = ctx.strokeStyle;
}
ctx.lineWidth = this.radius * 2;
point = points.shift();
ctx.lineTo(point[0], point[1]);
ctx.closePath();
ctx.stroke();
ctx.beginPath();
ctx.moveTo(point[0], point[1]);
i++;
}
}
ctx.beginPath();
circle_start_angle = -(start_angle - (length - 1) * dI) - Math.PI * 0.5;
ctx.arc(point[0], point[1], this.radius, circle_start_angle, circle_start_angle + Math.PI, true);
ctx.closePath();
ctx.fill();
},
_draw_will_do(ctx) {
this._draw_run_loader(ctx);
if ((this.animate.shifting || 0) >= this.turning_angle) {
this.status = 'doing';
this.end_timer.start();
}
},
_draw_run_done(ctx) {
const points = [];
points.push(this.points.a);
points.push(this.points.b);
points.push(this.points.c);
for (let i = 0; i < points.length - 1; i++) {
this._draw_lines(ctx, points[i], points[i + 1]);
}
},
_draw_run_doing(ctx) {
const elapsedTime = this.end_timer.elapsedTime;
const points = [];
if (elapsedTime > this.duration) {
this.status = 'done';
this._draw_run_done(ctx);
typeof this._fn === 'function' && this._fn();
delete this._fn;
return;
}
const f = C.Easing.Back.Out(Math.min(elapsedTime / this.duration, 1));
if (f < this.a_rate) {
if (f < this.b_rate) {
const I = this._get_I() - this.animate.velocity * elapsedTime / 1000;
if (I > 0) {
ctx.save();
this._draw_ring(ctx, this.turning_angle, I, 1);
ctx.restore();
}
points.push(this.turning_point);
} else {
points.push(C.mix(this.turning_point, this.points.a, (f - this.b_rate) / (1 - this.b_rate)));
}
points.push(C.mix(this.turning_point, this.points.b, f / this.a_rate));
} else {
points.push(C.mix(this.turning_point, this.points.a, (f - this.b_rate) / (1 - this.b_rate)));
points.push(this.points.b);
points.push(C.mix(this.points.b, this.points.c, (f - this.a_rate) / (1 - this.a_rate)));
}
for (let i = 0; i < points.length - 1; i++) {
this._draw_lines(ctx, points[i], points[i + 1]);
}
},
_draw_lines(ctx, a, b) {
ctx.save();
ctx.beginPath();
ctx.lineWidth = this.radius * 2;
ctx.lineCap = 'round';
ctx.strokeStyle = C.convertColor(this.color, 1);
ctx.moveTo(a[0], a[1]);
ctx.lineTo(b[0], b[1]);
ctx.stroke();
ctx.restore();
},
_draw_circle(ctx, point) {
ctx.save();
ctx.fillStyle = C.convertColor(this.color, this.alpha);
ctx.beginPath();
ctx.arc(point[0], point[1], this.radius, 0, Math.PI * 2, true);
ctx.closePath();
ctx.fill();
ctx.restore();
},
play() {
if (this.timer) {
this.timer.stop();
}
if (this.animate) {
this.animate.pause();
}
if (this.status == 'timer+' || this.status == 'timer') {
this.status = '-loader';
this.timer = (new C.Timer()).start();
} else {
this._play();
}
},
timing(time, fn) {
if (this.timer) {
this.timer.stop();
}
if (this.animate) {
this.animate.pause();
}
this.status = 'timer';
this.alpha = 1;
this.time = time;
$('.canvas-dashboard .loader .sec').html(time);
this.timer = (new C.Timer()).start().repeat(1000, function() {
const second = time - Math.round(this.elapsedTime / 1000);
fn(second);
});
},
end(fn) {
this.status == 'loader' && (this.status = 'loaded') && (function() {
this.turning_angle = Math.ceil(((this.animate.shifting || 0) - this.turning_angle) / (Math.PI * 2)) * Math.PI * 2 + this.turning_angle;
this.turning_point = this._get_point_angle(this.turning_angle);
this.a_rate = 1 / (1 + C.distance(this.points.c, this.points.b) / C.distance(this.turning_point, this.points.b));
this.b_rate = 1 / (1 + C.distance(this.turning_point, this.points.a) / (this._get_I() * this.radial_radius));
this.end_timer = new C.Timer();
this.duration = Math.round((C.distance(this.turning_point, this.points.b) + C.distance(this.points.b, this.points.c)) * (1.70158 + 3) * 1000 / (this.radial_radius * this.animate.velocity));
this._fn = fn;
}.bind(this))();
},
});
function CanvasLoader() {
this.loader = $('.canvas-dashboard');
this.dashboard = $('.user-fields-dashboard');
this._init = function() {
let stage = new C.Stage(),
width = stage.getWidth(),
height = stage.getHeight(),
radius = Math.min(width, height) / 2 * 0.9,
tube = 3 * radius / 40,
cirque = new C.Cirque(radius, tube, [width / 2, height / 2], Math.PI * 2);
this.circle = new Ball(cirque.radius, tube * 0.5, cirque.position),
this.renderer = new C.Renderer(stage);
cirque.color = 0xf6f6f6;
this.circle.shadow.enabled = true;
this.circle.shadow.blur = 12;
this.circle.color = 0x439df8;
stage.add(cirque).add(this.circle);
this.renderer.on('update', function(event, interval, elapsedTime) {
});
};
this.init = function() {
if (!this.renderer) {
if (!$('canvas').is(':visible')) {
this.dashboard.addClass('loader');
this._init();
this.dashboard.removeClass('loader');
}
}
};
this.play = function() {
this.init();
this.dashboard.addClass('loader');
this.loader.removeClass('pause');
this.renderer.run();
if (this.circle.status == 'loader') {
return;
}
this.circle.play();
};
this.pause = function() {
if (this.circle && this.circle.status == 'loader') {
this.circle.status = 'none';
}
this.loader.addClass('pause');
};
this.setTag = function(tag) {
if (this.circle && this.circle.status == 'timer' || this.circle.status == 'timer+') {
return;
}
this.loader.find('.label').html(function() {
switch (tag) {
case 'login':
return '正在登录中...';
case 'logined':
return '登录完成,等待授权';
case 'data':
return '正在查询中...';
case 'success':
return '认证完成';
case 'query':
return '任务提交成功';
}
return '';
});
this.loader.find('.loader>*').not('canvas').detach();
if (this.text_timeout_timer) {
clearTimeout(this.text_timeout_timer);
delete this.text_timeout_timer;
}
if (this.text_interval_timer) {
clearTimeout(this.text_interval_timer);
delete this.text_interval_timer;
}
if (tag == 'query') {
this.loader.find('.loader').append($('<div>', { class: 'content' })
.append($('<div>', { class: 'message' }).html('此时退出不影响查询结果')));
this.text_timeout_timer = setTimeout(function() {
if (this.circle.status == 'loader') {
this.loader.find('.loader .message').html('当前查询较慢,可能还需要几秒');
}
delete this.text_timeout_timer;
}.bind(this), 30 * 1000);
} else if (tag == 'login') {
this.loader.find('.loader').append($('<div>', { class: 'content' })
.append($('<div>', { class: 'message' }).html('您可能需要等待十几秒')));
this.text_timeout_timer = setTimeout(function() {
if (this.circle.status == 'loader') {
this.loader.find('.loader .message').html('当前查询较慢,可能还需要几秒');
}
delete this.text_timeout_timer;
}.bind(this), 30 * 1000);
} else if (tag == 'data') {
let texts = ['认证时间较长,请耐心等待', '您可能需要等待几分钟'],
i = 0;
this.loader.find('.loader').append($('<div>', { class: 'content' })
.append($('<div>', { class: 'message' }).html(texts[0])));
this.text_interval_timer = setInterval(function() {
if (this.circle.status == 'loader') {
this.loader.find('.loader .message').html(texts[(++i) % texts.length]);
}
delete this.text_interval_timer;
}.bind(this), 10 * 1000);
}
};
this.setText = function(text) {
this.loader.find('.label').html(text);
};
this.timing = function(duration, fn) {
this.init();
this.dashboard.addClass('loader');
this.loader.removeClass('pause');
const self = this;
this.renderer.run();
this.loader.find('.loader >*').not('canvas').detach();
this.loader.find('.loader').append($('<div>', { class: 'content' })
.append($('<div>', { class: 'message' }).html('您可能需等待'))
.append($('<div>', { class: 'sec' })));
let sign = true;
this.circle.timing(duration, function(second) {
if (second <= 0) {
if (sign) {
setTimeout(function() {
self.loader.find('.content').addClass('in');
}, 800);
}
fn && fn.call(self);
} else {
if (second == 1) {
sign = false;
setTimeout(function() {
self.loader.find('.content').addClass('in');
}, 800);
}
self.loader.find('.sec').html(second);
}
});
};
this.end = function(fn) {
this.circle.end(function() {
this.renderer.pause();
fn && fn();
}.bind(this));
this.loader.find('.content').addClass('in');
};
this.stop = function() {
this.renderer.pause();
this.circle.status = 'none';
this.dashboard.removeClass('loader');
};
}
function CSSLoader() {
this.dashboard = $('.user-fields-dashboard');
this.init = function() {
this.dashboard.addClass('loader');
$('.canvas-dashboard').hide();
$('.css-loader-dash').show();
$('.css-shadow').show();
};
this.play = function() {
this.init();
};
this.pause = function() {
this.dashboard.removeClass('loader');
$('.css-loader-dash').hide();
$('.css-shadow').hide();
};
this.setTag = function() {
// this.dashboard.removeClass("loader");
// $('.css-loader-dash').hide();
// $('.css-shadow').show()
};
this.setText = function() {
// this.dashboard.removeClass("loader");
// $('.css-loader-dash').hide();
// $('.css-shadow').show()
};
this.end = function(fn) {
$('#load').html('认证完成,即将为您跳转');
fn && fn();
};
this.stop = function() {
this.dashboard.removeClass('loader');
$('.css-loader-dash').hide();
$('.css-shadow').hide();
};
this.timing = function(duration, fn) {
const self = this;
fn && fn.call(self);
};
}
let codeStatus = 1;
$.fn.bindPhoneActionEvent = $.fn.bindPhoneActionEvent || function() {
return this.find('.phone-code-action').on('click', function(event) {
clickStatus = true;
$("input[name='args[phoneCode]']").eq(0).removeAttr('disabled');
const self = $(this);
self.lock(self.data('cd'));
const params = $('input,select').valMap();
// console.log('【phone_code】params',JSON.stringify(params))
self.data('result', 0);
codeStatus = 0;
doJsonAjax(
constant.script_root + 'capture',
params,
function(response) {
codeStatus = 1;
if (response.code == 106 || response.code == -1) {
if (response.msg == '') {
$.prompt('验证码发送失败,请稍后重试');
} else {
$.prompt(response.msg);
}
self.data('result', -1);
// console.log('验证码发送失败');
} else {
// console.log("success");
self.data('result', 1);
$.prompt('验证码发送成功,请注意查收');
}
},
function(code) {
self.unlock();
$.prompt('请确认设备已连接到网络');
}
);
constant.hasclick = true;
}).on('clickready', function() {
const self = $(this);
if (!self.is(':visible')) {
return;
}
const result = self.data('result');
if (result == 1) {
// $.prompt("验证码正在路上,请再等会");
} else if (result == -1) {
$.prompt('没有收到验证码?请再试一次');
}
})
.restoreLock(), this;
};
let clickStatus = false;
function listen_job_v2(params, fn, failed) {
params.netMark = netMark;
return (new Scheduler({ timeout: 15 * 60 * 1000, duration: 3000 })).begin(function() {
const self = this;
doJsonAjax(
constant.project_root + 'taskId/get_job',
params,
function(result) {
result = JSON.parse(result);
// console.log(result)
switch (+result.data.state) {
case -1:
self.end(result.data.state, result.data.result);
break;
case -2:
self.end(result.data.state, result.data.result);
break;
case 2:
self.end(result.data.state);
break;
case 1:
self.end(result.data.state, result.data.html);
break;
case 3:
self.end(result.data.state, result.data.result);
break;
default:
self.update();
break;
}
},
function(code) {
self.update();
}
);
}, function(state, result) {
if (state == -1) {
failed(result);
} else {
fn(state, result);
}
}, function(error) {
failed(error.code == error.TIMEOUT ? '处理超时' : undefined);
});
}
function listen_job_ws_V2(params, success, failed, notify) {
let url;
const taskId = params.taskId;
const orderId = params.orderId;
let queryString = '?taskId=' + taskId + '&orderId=' + orderId + '&appkey=' + constant.appkey + '&netMark=' + netMark;
if ('type' in params) {
queryString += '&type=query';
}
if (window.location.protocol == 'http:') {
url = 'ws://' + window.location.host + '/yysh5/ws/' + queryString;
} else {
url = 'wss://' + window.location.host + '/yysh5/ws/' + queryString;
}
const ws = require('socket.io-client')(url);
ws.onclose = function() {
if (ws.status !== 'close') {
failed();
$.prompt('请确认网络连接情况');
}
};
ws.onerror = function() {
failed();
console.log('创建webSocket失败');
};
ws.onmessage = function(result) {
if (result.data == 'ok') {
console.log('ws连接成功');
} else {
result = JSON.parse(result.data);
const state = result.data.state;
if (state == 2 || state == 3) {
success();// 任务成功||移动第一步发送验证码任务结束
} else if (state == -1) {
failed();// 当前步数失败,重新申请新任务
$.prompt(result.data.result);
} else if (state == -2) {
$.prompt(result.data.result);
setTimeout(function() {
if (constant.redirectUrl.length > 0) {
window.location.href = lastRedirect('failed');
} else {
window.location.href = constant.script_root + 'info';
}
}, 2000);
} else if (state == 1) {
if (constant.hasclick == true) {
if (/联通/.test($('select[name=cid]').find('option:selected').text())) {
$('.phone-code-action').unlock();
showModal(result.data.html);
} else {
loader.timing(parseInt($('.phone-code-action').html()) > 0 ? parseInt($('.phone-code-action').html()) : 5, function() {
showModal(result.data.html);
});
}
} else {
showModal(result.data.html);
}
} else if (state == 5) {
loader.setTag('query');
}
if (state != 5) {
ws.status = 'close';
ws.close();
}
}
};
function showModal(html) {
constant.hasclick = true;
if (step == 1) {
title = '成功登录,请获取二次验证码';
} else {
title = '成功登录,请再次获取最新验证码';
}
const dialog = $.dialog({
title,
html,
buttons: [
{
title: '授权', className: 'confirm', tap() {
const c = $('input[name]').filter(function() {
return $(this).attr('name') == 'args[phoneCode]';
});
if (c.length == 2 && c.eq(0).val() == c.eq(1).val()) {
$.prompt('两次验证码是不同的,请获取新的验证码');
return true;
}
if (c.length == 2 && c.eq(1).val().length == 0) {
$.prompt('短信验证码不能为空');
return true;
}
if (c.length == 1 && c.eq(0).val().length == 0) {
$.prompt('短信验证码不能为空');
return true;
}
const params = this.$('input[name]').add($('input[name=task_id]')).valMap();
// notify(new Event("resume"));
loader.play();
loader.setTag('data');
carrier_job_v2(params, success, failed);
},
},
],
})
.on('load', function() {
// if ($("select[name=cid]").find("option:selected").text() == '吉林电信') {
// $("<section>", {'class': 'lamp-wrapper'})
// .html('请用本机发送“CXXD”至10001获取验证码')
// // .append($(isAppleDevice ? "<a href='sms:10001" + (isAppleDevice ? '&' : '?') + "body=CXXD'>" : "").html("点击发送"))
// // .append(isAppleDevice ? ';发送不了,请手动编辑短信' : '')
// .prependTo(this.content);
// this.$(".action").detach();
// }
if ($('select[name=cid]').find('option:selected').text() === '河北电信') {
$('<section>', { class: 'lamp-wrapper' })
.html('需要多次验证码,每次都需要重新获取,请耐心等待倒计时结束')
.prependTo(this.content);
}
this.context.find('.dialog-button.confirm').attr('disabled', 'disabled');
this.context.find('.dialog-button.confirm').submitFields(this.$('input'));
this.context.bindPhoneActionEvent();
})
.on('show', function() {
// notify(new Event("suspend"));
$('.dialog-button.confirm').attr('disabled', 'disabled');
loader.pause();
});
dialog.model(true);
$('.dialog-button.confirm').attr('disabled', 'disabled');
}
}
function searchToObject() {
let pairs = window.location.search.substring(1).split('&'),
obj = {},
pair,
i;
for (i in pairs) {
if (pairs[i] === '') continue;
pair = pairs[i].split('=');
obj[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
}
return obj;
}
function carrier_job_v2(params, fn, failed, notify) {
if (agreement_time && agreement_time != 1) {
params.agreement_time = agreement_time;
agreement_time = 1;
}
doJsonAjax(
constant.script_root + 'submit',
{ ...params, orderId: constant.orderNum },
function(response) {
if (response.errcode == 0) {
const taskId = response.data.task_id;
if (!!window.WebSocket && window.WebSocket.prototype.send) {
const wsParams = {
taskId,
orderId: constant.orderNum,
netMark,
};
listen_job_ws_V2(wsParams, fn, failed, notify);
} else {
const params = { taskId: response.data.task_id, orderId: constant.orderNum, phone: constant.phone, redirectUrl: constant.redirectUrl, appkey: constant.appkey };
listen_job_v2(params, function(state, result) {
if (state == 2 || state == 3) {
fn();
} else if (state == 1) {
constant.hasclick = true;
if (step == 1) {
title = '成功登录,请获取二次验证码';
} else {
title = '成功登录,请再次获取最新验证码';
}
const dialog = $.dialog({
title,
html: result,
buttons: [
{
title: '授权', className: 'confirm', tap() {
const c = $('input[name]').filter(function() {
return $(this).attr('name') == 'args[phoneCode]';
});
if (c.length == 2 && c.eq(0).val() == c.eq(1).val()) {
$.prompt('两次验证码是不同的,请获取新的验证码');
return true;
}
if (c.length == 2 && c.eq(1).val().length == 0) {
$.prompt('短信验证码不能为空');
return true;
}
if (c.length == 1 && c.eq(0).val().length == 0) {
$.prompt('短信验证码不能为空');
return true;
}
const params = this.$('input[name]').add($('input[name=task_id]')).valMap();
// notify(new Event("resume"));
loader.play();
carrier_job_v2(params, fn, failed);
},
},
],
})
.on('load', function() {
// if ($("select[name=cid]").find("option:selected").text() == '吉林电信') {
// $("<section>", {'class': 'lamp-wrapper'})
// .html('请用本机发送“CXXD”至10001获取验证码')
// // .append($(isAppleDevice ? "<a href='sms:10001" + (isAppleDevice ? '&' : '?') + "body=CXXD'>" : "").html("点击发送"))
// // .append(isAppleDevice ? ';发送不了,请手动编辑短信' : '')
// .prependTo(this.content);
// this.$(".action").detach();
// }
this.context.find('.dialog-button.confirm').attr('disabled', 'disabled');
this.context.find('.dialog-button.confirm').submitFields(this.$('input'));
this.context.bindPhoneActionEvent();
})
.on('show', function() {
loader.pause();
// notify(new Event("suspend"));
});
dialog.model(true);
$('.dialog-button.confirm').attr('disabled', 'disabled');
} else if (state == -1) {
failed();// 当前步数失败,重新申请新任务
$.prompt(result);
} else if (state == -2) {
$.prompt(result.data.result);
setTimeout(function() {
window.location.href = constant.script_root + 'info';
}, 2000);
}
}
, function(errmsg) {
failed();
if (errmsg) {
$(document).trigger('receive_error', errmsg);
$.prompt(errmsg);
}
});
}
} else {
setTimeout(function() {
failed();
$.prompt(response.errmsg);
}, 250);
}
},
function(code) {
failed();
if (code == 500) {
$.prompt('程序员哥哥写错代码了!');
} else if (code == 404) {
$.prompt('接口文件不见了!');
} else if (code == 0) {
$.prompt('请确认设备已连接到网络!');
} else {
$.prompt('服务器好像挂了!');
}
}
);
}
function lastRedirect(status) {
constant.redirectUrl = decodeURIComponent(constant.redirectUrl);
let hashStr = '';
if (constant.redirectUrl.indexOf('#') > -1) {
hashStr = constant.redirectUrl.split('#')[1];
constant.redirectUrl = constant.redirectUrl.split('#')[0];
}
let lastRedirect = constant.redirectUrl + (constant.redirectUrl.indexOf('?') > -1 ? '&' : '?') + 'orderSn=' + constant.orderNum + '&status=' + status + '&phone=' + $("[name='args[phone]']").val() + '&timestamp=' + (+new Date());
if (hashStr.length > 0) {
lastRedirect += '#' + hashStr;
}
return lastRedirect;
}
function setup_forget_password() {
let tag = '',
city = '',
name = '',
data = {};
if (/^(.+)(电信|移动|联通)/.test($('select[name=cid]').find('option:selected').text())) {
city = RegExp.$1;
name = RegExp.$2;
}
switch (name) {
case '电信':
tag = 'ctcc';
break;
case '移动':
tag = 'cmcc';
break;
case '联通':
tag = 'cucc';
break;
}
const cmcc = {
map: {
浙江: 0,
安徽: 0,
重庆: 1,
湖北: 0,
北京: 2,
广东: 1,
福建: 0,
甘肃: 1,
河北: 1,
河南: 0,
海南: 0,
湖南: 0,
黑龙江: 0,
吉林: 1,
江苏: 0,
上海: 1,
四川: 0,
山东: 0,
山西: 0,
陕西: 1,
},
data: {
浙江: {
body: '2010',
},
安徽: {
body: 'CZMM#身份证号',
bodyHtml: 'CZMM#<span class="hl">身份证号</span>',
},
重庆: {
body: '702',
},
湖北: {
body: 'CZMM#身份证号',
bodyHtml: 'CZMM#<span class="hl">身份证号</span>',
},
北京: {
body: 'MMCZ空格身份证号空格新密码空格新密码',
bodyHtml: 'MMCZ<span class="hl">空格身份证号空格新密码空格新密码</span>',
},
广东: {
body: 'CZMM',
},
福建: {
body: '40*新密码*身份证号#',
bodyHtml: '40*<span class="hl">新密码</span>*<span class="hl">身份证号</span>#',
},
甘肃: {
body: '602',
},
河北: {
body: 'MMCZ',
},
河南: {
body: '6021空格身份证号',
bodyHtml: '6021<span class="hl">空格身份证号</span>',
},
海南: {
body: 'CZMM空格身份证号',
bodyHtml: 'CZMM<span class="hl">空格身份证号</span>',
},
湖南: {
body: 'CZMM#身份证号#新密码#新密码',
bodyHtml: 'CZMM#<span class="hl">身份证号</span>#<span class="hl">新密码</span>#<span class="hl">新密码</span>',
},
黑龙江: {
body: 'CZMM#身份证号#',
bodyHtml: 'CZMM#<span class="hl">身份证号</span>#',
},
吉林: {
body: 'CZMM',
},
江苏: {
body: 'CZMM#身份证号',
bodyHtml: 'CZMM#<span class="hl">身份证号</span>',
},
上海: {
body: 'CZMM',
},
四川: {
body: 'CZMM空格身份证号',
bodyHtml: 'CZMM<span class="hl">空格身份证号</span>',
},
山东: {
body: '242*身份证号*新密码*新密码',
bodyHtml: '242*<span class="hl">身份证号</span>*<span class="hl">新密码</span>*<span class="hl">新密码</span>',
},
山西: {
body: 'CZSJMM#身份证号#新密码#新密码',
bodyHtml: 'CZSJMM#<span class="hl">身份证号</span>#<span class="hl">新密码</span>#<span class="hl">新密码</span>',
},
陕西: {
body: 'CZMM',
},
},
};
if (tag == 'cmcc' && city in cmcc.map) {
tag = tag + '_' + cmcc.map[city];
data = cmcc.data[city];
}
if (tag == 'ctcc' && city == '广东') {
tag = tag + '_0';
}
let html = $('#template_' + tag).html();
if (!html) {
return;
}
'bodyHtml' in data || (data.bodyHtml = data.body);
/class=\"hl\"/.test(data.bodyHtml) || (data.ps = '<span class="ps">红色部分需手动填写</span>');
while (/(#{([^}]+)})/.test(html)) {
let search = RegExp.$1,
key = RegExp.$2.replace(/^\s*|\s*$/, '');
html = html.replace(new RegExp('#{\\s*' + key + '\\s*}', 'gi'), key in data ? data[key] : '');
}
$('#form [type=password]').closest('.content').after($('<a>').html('忘记密码?').on('click', function() {
$.dialog({
title: '忘记服务密码',
html,
buttons: [{ title: '我知道了' }],
style: {
content: {
'min-height': 'auto',
'max-height': 'none',
padding: '10px 20px',
},
},
}).on('load', function() {
if (/iP(hone|ad)/.test(navigator.userAgent)) {
this.$('a[href^=sms]').each(function() {
const self = $(this);
self.attr('href', self.attr('href').replace(/\?/gi, '&'));
});
}
}).model();
}));
}
function CarrierQueryV2() {
const self = this;
let loader = new CanvasLoader();
const userAgent = navigator.userAgent;
const index = userAgent.indexOf('Android');
if (index >= 0) {
const androidVersion = parseFloat(userAgent.slice(index + 8));
if (androidVersion < 4.4) {
loader = new CSSLoader();
}
}
this.config = $('#carrier-config').data();
window.loader = loader;
this.loader = loader;
this.expiration_time = 0;
}
CarrierQueryV2.prototype = {
start() {
const self = this;
// console.log('begin');
$.dialog.global.clear();
// console.log('begin1');
if (self.expiration_time) {
// console.log('begin2');
let cd = +new Date() - self.expiration_time;
cd = Math.round(cd / 1000);
if (cd >= 5) {
self.loader.timing(cd, function() {
if (self.loading) {
self.loader.play();
}
});
$.dialog.global.blocking = true;
self.blocking_timer = setTimeout(function() {
delete self.blocking_timer;
$.dialog.global.blocking = false;
}, cd * 1000);
} else {
self.loader.play();
}
} else {
// console.log('begin3');
self.loader.play();
self.loader.setTag('data');
}
this.loading = true;
// console.log('begin4');
// var timesRun = 0;
// var waitCode=setInterval(function () {
// console.log(codeStatus)
// timesRun += 1;
// if(timesRun === 60){
// clearInterval(waitCode);
// $.prompt('服务器正忙,请稍后重试')
// self.loading = false;
// self.failed();
// }else{
// if(codeStatus==1){
// clearInterval(waitCode)
const params = $('input,select').valMap();
params.remPwd = $('#remPwd').is(':checked') ? 1 : 0;
params.orderSn = orderSn;
params.netMark = netMark;
params.appkey = userAppKey;
params.city = $('select').val();
const d = $('input[name]').filter(function() {
return $(this).attr('name') == 'args[ID]';
});
if (d.length == 1 && d.eq(0).val().length != 18) {
$.prompt('请检查身份证号码是否有效');
self.loading = false;
self.failed();
return;
}
params.remPwd = $('#remPwd').is(':checked') ? 1 : 0;
carrier_job_v2(params, function success() {
// console.log("success");
self.loader.end(function() {
self.success();
});
}, function failed() {
self.loading = false;
self.failed();
// console.log('failed');
}, function notify(event) {
if (event.type == 'resume') {
this.loader.play();
this.loader.setTag('data');
} else {
this.loader.pause();
}
});
// }
// }
// },1000)
},
success() {
let second = 3;
this.timer = setInterval(function() {
if (second == 0) {
clearInterval(this.timer);
delete this.timer;
this.loader.setText('正在加载最新信息...');
if (constant.redirectUrl.length > 0) {
window.location.href = lastRedirect('success');
}
} else {
this.loader.setText('认证完成,' + (second--) + '秒后为您自动跳转');
}
}.bind(this), 1000);
},
failed() {
this.loader.stop();
this.blocking_timer && clearTimeout(this.blocking_timer);
delete this.blocking_timer;
$.dialog.global.clear();
const arsCode = $('input').filter(function() {
return $(this).attr('name') == 'args[phoneCode]';
});
if (arsCode.length == 1) {
arsCode.val('');
$('#submit').addClass('disabled').attr('disabled', 'disabled');
}
$(document).trigger('setup_task');
},
lastFailed() {
// TODO 最终失败执行的脚本
this.loader.stop();
setTimeout(function() {
window.location.href = lastRedirect('failed');
// constant.redirectUrl + (constant.redirectUrl.indexOf("?")>-1?"&":"?")+"orderSn="+constant.orderNum+"&status=failed&phone="+$("[name='args[phone]']").val()+"&timestamp="+(+new Date);
}, 2000);
},
};
$('select[name=cid]').on('input', function(event) {
const self = $(this);
self.next().html(self.find('option:selected').text());
$('#submit').off('click').on('click', function() {
$.prompt('正在下载' + self.find('option:selected').text() + '配置');
});
doJsonAjax(
constant.script_root + 'fields',
self.valMap(),
function(response) {
if (typeof response === 'string') {
$('#form').find('>:not(.static-element)').detach();
$('#form').prepend(response);
$(document).trigger('mutation');
} else {
const errmsg = 'errmsg' in response ? response.errmsg : '未知错误';
$('#form').html(['<section class="space"></section>',
'<section class="ico-text-dashboard expr-sad cirque-loader">',
'<div class="loader"></div>',
'<div class="ico"></div>',
'<div class="highlight">' + errmsg + '</div>',
'<div class="description">点击重新加载</div>',
'</section>'].join('')).find('.ico-text-dashboard')
.on('click', function() {
if ($(this).hasClass('loading')) {
return;
}
$(this).addClass('loading');
setTimeout(function() {
self.trigger('input');
}, 300);
});
$('#submit').off('click').addClass('disabled')
.attr('disabled', 'disabled');
}
}, function(code) {
$('#form').html(['<section class="space"></section>',
'<section class="ico-text-dashboard network-error cirque-loader">',
'<div class="loader"></div>',
'<div class="ico"></div>',
'</section>'].join('')).find('.ico-text-dashboard')
.on('click', function() {
if ($(this).hasClass('loading')) {
return;
}
$(this).addClass('loading');
setTimeout(function() {
self.trigger('input');
}, 300);
});
$('#submit').off('click').addClass('disabled')
.attr('disabled', 'disabled');
}
);
});
$(document).on('setup_task', function() {
doJsonAjax(
constant.script_root + 'tasks',
{
scriptId: constant.scriptId,
orderId: constant.orderNum,
appkey: constant.appkey,
phone: constant.phone,
city: '',
operator: '',
},
function(response) {
$('[name=task_id]').val(response.task_id);
step = 0;
},
function(code) {
console.log('【tasks接口code】', code);
if (code == 500) {
$.prompt('程序员哥哥写错代码了!');
} else if (code == 404) {
$.prompt('接口文件不见了!');
} else if (code == 0) {
$.prompt('请确认设备已连接到网络!');
}
// else if (code == 201) {
// return;
// } else {
// $.prompt('服务器好像挂了!');
// }
}
);
constant.redirectUrl = constant.redirectUrl.replace('&#x3D;', '=');
constant.hasclick = false;
clickStatus = false;
codeStatus = 1;
}).on('mutation', function(event) {
if ($('#form .sys-maintenance').length > 0) {
$('#submit').off('click').attr('disabled', 'disabled');
} else {
const query = new CarrierQueryV2();
window.query = query;
$(document).bindPhoneActionEvent();
switch (constant.orderState) {
case 'failed':
case 'login':
$(document).trigger('setup_task');
break;
case 'query':
loader.play();
loader.setTag('query');
if (!!window.WebSocket && window.WebSocket.prototype.send) {
listen_job_ws_V2({
taskId: constant.taskId,
orderId: constant.orderNum,
type: 'query',
}, function() {
loader.end();
query.success();
}, function() {
query.failed();
});
} else {
query.failed();
}
break;
case 'success':
loader.play();
loader.setTag('data');
query.success();
break;
default:
$(document).trigger('setup_task');
break;
}
$('#submit').submitFields($('.input-option')).off('click')
.on('click', function() {
if ($('#form').find('.phone-code-action').length > 0) {
if (clickStatus) {
query.start();
} else {
$.prompt('该地区每次查询都需要重新获取验证码,请先获取验证码');
}
} else {
query.start();
}
});
setup_forget_password();
}
})
.trigger('mutation');
$(document).on('receive_error', (function() {
let errcount = 0;
return function(event, errmsg) {
if (/密码/gi.test(errmsg)) {
errcount++;
if (errcount == 2) {
$('#form [type=password]').closest('.input-box').find('a')
.trigger('click');
}
}
};
})());
if (yysTag) {
if (appKeypart2.indexOf(userAppKey) > -1) {
if (protocol == 1) {
new $.dialog({
html: '<iframe frameborder="0" width="100%" height="' + (window.innerHeight * 0.75) + 'px" style="background-color:white;" src="' + constant.script_root + 'protocol#self"></iframe>',
style: {
content: {
padding: 0,
maxHeight: (window.innerHeight * 0.75) + 'px',
},
},
buttons: [{
title: '仅浏览', className: 'back', tap() {
doJsonAjax(
'https://' + window.location.host + '/bury/bury_point',
{ order_id: orderSn, type: 'yys', button: 'back' },
function(response) {
console.log(response);
},
function(code) {
console.log(code);
}
);
window.history.go(-1);
try { window.parent.postMessage({ close: true, type: 'webviewclose' }, '*'); } catch (e) {}
},
}, {
title: '确认并同意', tap() {
doAjax({
url: 'https://' + window.location.host + '/bury/bury_point',
type: 'POST',
contentType: 'application/json',
data: {
order_id: orderSn,
type: 'yys',
button: 'agree',
},
success(resp) {
console.log(resp);
},
error(err) {
console.error(err);
},
});
const URL = replaceParamVal('protocol', '0');
history.pushState(null, null, URL);
},
}],
}).model();
}
}
} else {
if (appKeypart.indexOf(userAppKey) > -1) {
$('.checkbox-wrapper a').on('click', function() {
new $.dialog({
title: '运营商授权协议',
html: '<iframe frameborder="0" width="100%" height="300px" style="background-color:#f5f5f5;" src= "https://' + window.location.host + '/thxd/protocol"></iframe>',
style: {
content: {
padding: 0,
maxHeight: '300px',
backgroundColor: '#f5f5f5',
},
},
}).model();
});
} else if (appKeypart2.indexOf(userAppKey) > -1) {
if (protocol == 1) {
$('.checkbox-wrapper a').on('click', function() {
new $.dialog({
html: '<iframe frameborder="0" width="100%" height="' + (window.innerHeight * 0.75) + 'px" style="background-color:white;" src="' + constant.script_root + 'protocol#self"></iframe>',
style: {
content: {
padding: 0,
maxHeight: (window.innerHeight * 0.75) + 'px',
},
},
buttons: [{
title: '仅浏览', className: 'back', tap() {
doJsonAjax(
'https://' + window.location.host + '/bury/bury_point',
{ order_id: orderSn, type: 'yys', button: 'back' },
function(response) {
console.log(response);
},
function(code) {
console.log(code);
}
);
window.history.go(-1);
},
}, {
title: '确认并同意', tap() {
doAjax({
url: 'https://' + window.location.host + '/bury/bury_point',
type: 'POST',
contentType: 'application/json',
data: {
order_id: orderSn,
type: 'yys',
button: 'agree',
},
success(resp) {
console.log(resp);
},
error(err) {
console.error(err);
},
});
$('.checkbox-wrapper a').off('click').on('click', function() {
new $.dialog({
title: '信息授权查询委托书',
html: '<iframe frameborder="0" width="100%" height="' + (window.innerHeight * 0.7) + 'px" style="background-color:white;" src= "https://p.jianbing.com/ssr-view/agreement/yys_analysis#self"></iframe>',
style: {
content: {
padding: 0,
maxHeight: (window.innerHeight * 0.7) + 'px',
},
},
}).model();
});
},
}],
}).model();
});
$('.checkbox-wrapper a').trigger('click');
} else {
$('.checkbox-wrapper a').off('click').on('click', function() {
new $.dialog({
title: '信息授权查询委托书',
html: '<iframe frameborder="0" width="100%" height="' + (window.innerHeight * 0.7) + 'px" style="background-color:white;" src= "https://p.jianbing.com/ssr-view/agreement/yys_analysis#self"></iframe>',
style: {
content: {
padding: 0,
maxHeight: (window.innerHeight * 0.7) + 'px',
},
},
}).model();
});
}
} else {
$('.checkbox-wrapper a').on('click', function() {
new $.dialog({
title: '运营商授权协议',
html: '<iframe frameborder="0" width="100%" height="300px" style="background-color:#f5f5f5;" src= "https://p.jianbing.com/ssr-view/agreement/yys_analysis#self"></iframe>',
style: {
content: {
padding: 0,
maxHeight: '300px',
backgroundColor: '#f5f5f5',
},
},
}).model();
});
}
}
});
'use strict';
function Scheduler(option) {
option = option || {};
this.timeout = option.timeout || 60 * 2 * 1000;
this.duration = option.duration || 2000;
this.abort = false;
this.doing = false;
}
Scheduler.prototype._get_delay = function() {
let delay = typeof this.duration === 'function' ? this.duration(this.start_time) : this.duration;
delay = +delay;
return delay <= 0 && (delay = 2000), delay;
};
Scheduler.prototype.update = function() {
const delay = this._get_delay() - (+new Date() - this.last_time);
if (this.abort || this.doing) {
return;
}
this.doing = true;
setTimeout(function() {
if (this.abort) {
return;
}
this.last_time = +new Date();
this.doing = false;
this.callback();
}.bind(this), delay);
};
Scheduler.prototype.begin = function(callback, success, failed) {
this.start_time = +new Date();
this.last_time = this.start_time;
this.callback = callback;
this.success = success;
this.failed = failed;
this.abort = false;
this.callback();
this.timeout_timer = setTimeout(function() {
this.abort = true;
if (typeof this.failed === 'function') {
this.failed({ code: 1, TIMEOUT: 1, CANCEL: 2, UNKNOWN_ERROR: 3 });
}
delete this.timeout_timer;
}.bind(this), this.timeout);
return this;
};
Scheduler.prototype.cancel = function() {
this.abort = true;
if (this.timeout_timer) {
clearTimeout(this.timeout_timer);
delete this.timeout_timer;
}
if (typeof this.failed === 'function') {
this.failed({ code: 2, TIMEOUT: 1, CANCEL: 2, UNKNOWN_ERROR: 3 });
}
return this;
};
Scheduler.prototype.end = function() {
this.abort = true;
if (this.timeout_timer) {
clearTimeout(this.timeout_timer);
delete this.timeout_timer;
}
if (typeof this.success === 'function') {
this.success.apply(this, arguments);
}
return this;
};
var Zepto=function(){function a(a){return null==a?String(a):U[V.call(a)]||"object"}function b(b){return"function"==a(b)}function c(a){return null!=a&&a==a.window}function d(a){return null!=a&&a.nodeType==a.DOCUMENT_NODE}function e(b){return"object"==a(b)}function f(a){return e(a)&&!c(a)&&Object.getPrototypeOf(a)==Object.prototype}function g(a){return"number"==typeof a.length}function h(a){return D.call(a,function(a){return null!=a})}function i(a){return a.length>0?x.fn.concat.apply([],a):a}function j(a){return a.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function k(a){return a in G?G[a]:G[a]=new RegExp("(^|\\s)"+a+"(\\s|$)")}function l(a,b){return"number"!=typeof b||H[j(a)]?b:b+"px"}function m(a){var b,c;return F[a]||(b=E.createElement(a),E.body.appendChild(b),c=getComputedStyle(b,"").getPropertyValue("display"),b.parentNode.removeChild(b),"none"==c&&(c="block"),F[a]=c),F[a]}function n(a){return"children"in a?C.call(a.children):x.map(a.childNodes,function(a){return 1==a.nodeType?a:void 0})}function o(a,b,c){for(w in b)c&&(f(b[w])||Z(b[w]))?(f(b[w])&&!f(a[w])&&(a[w]={}),Z(b[w])&&!Z(a[w])&&(a[w]=[]),o(a[w],b[w],c)):b[w]!==v&&(a[w]=b[w])}function p(a,b){return null==b?x(a):x(a).filter(b)}function q(a,c,d,e){return b(c)?c.call(a,d,e):c}function r(a,b,c){null==c?a.removeAttribute(b):a.setAttribute(b,c)}function s(a,b){var c=a.className||"",d=c&&c.baseVal!==v;return b===v?d?c.baseVal:c:void(d?c.baseVal=b:a.className=b)}function t(a){try{return a?"true"==a||("false"==a?!1:"null"==a?null:+a+""==a?+a:/^[\[\{]/.test(a)?x.parseJSON(a):a):a}catch(b){return a}}function u(a,b){b(a);for(var c=0,d=a.childNodes.length;d>c;c++)u(a.childNodes[c],b)}var v,w,x,y,z,A,B=[],C=B.slice,D=B.filter,E=window.document,F={},G={},H={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},I=/^\s*<(\w+|!)[^>]*>/,J=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,K=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,L=/^(?:body|html)$/i,M=/([A-Z])/g,N=["val","css","html","text","data","width","height","offset"],O=["after","prepend","before","append"],P=E.createElement("table"),Q=E.createElement("tr"),R={tr:E.createElement("tbody"),tbody:P,thead:P,tfoot:P,td:Q,th:Q,"*":E.createElement("div")},S=/complete|loaded|interactive/,T=/^[\w-]*$/,U={},V=U.toString,W={},X=E.createElement("div"),Y={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},Z=Array.isArray||function(a){return a instanceof Array};return W.matches=function(a,b){if(!b||!a||1!==a.nodeType)return!1;var c=a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.matchesSelector;if(c)return c.call(a,b);var d,e=a.parentNode,f=!e;return f&&(e=X).appendChild(a),d=~W.qsa(e,b).indexOf(a),f&&X.removeChild(a),d},z=function(a){return a.replace(/-+(.)?/g,function(a,b){return b?b.toUpperCase():""})},A=function(a){return D.call(a,function(b,c){return a.indexOf(b)==c})},W.fragment=function(a,b,c){var d,e,g;return J.test(a)&&(d=x(E.createElement(RegExp.$1))),d||(a.replace&&(a=a.replace(K,"<$1></$2>")),b===v&&(b=I.test(a)&&RegExp.$1),b in R||(b="*"),g=R[b],g.innerHTML=""+a,d=x.each(C.call(g.childNodes),function(){g.removeChild(this)})),f(c)&&(e=x(d),x.each(c,function(a,b){N.indexOf(a)>-1?e[a](b):e.attr(a,b)})),d},W.Z=function(a,b){if(a=a||[],navigator.userAgent.indexOf("MSIE 10")>-1)for(var c in $.fn)a[c]=$.fn[c];else a.__proto__=$.fn;return a.selector=b||"",a},W.isZ=function(a){return a instanceof W.Z},W.init=function(a,c){var d;if(!a)return W.Z();if("string"==typeof a)if(a=a.trim(),"<"==a[0]&&I.test(a))d=W.fragment(a,RegExp.$1,c),a=null;else{if(c!==v)return x(c).find(a);d=W.qsa(E,a)}else{if(b(a))return x(E).ready(a);if(W.isZ(a))return a;if(Z(a))d=h(a);else if(e(a))d=[a],a=null;else if(I.test(a))d=W.fragment(a.trim(),RegExp.$1,c),a=null;else{if(c!==v)return x(c).find(a);d=W.qsa(E,a)}}return W.Z(d,a)},x=function(a,b){return W.init(a,b)},x.extend=function(a){var b,c=C.call(arguments,1);return"boolean"==typeof a&&(b=a,a=c.shift()),c.forEach(function(c){o(a,c,b)}),a},W.qsa=function(a,b){var c,e="#"==b[0],f=!e&&"."==b[0],g=e||f?b.slice(1):b,h=T.test(g);return d(a)&&h&&e?(c=a.getElementById(g))?[c]:[]:1!==a.nodeType&&9!==a.nodeType?[]:C.call(h&&!e?f?a.getElementsByClassName(g):a.getElementsByTagName(b):a.querySelectorAll(b))},x.contains=E.documentElement.contains?function(a,b){return a!==b&&a.contains(b)}:function(a,b){for(;b&&(b=b.parentNode);)if(b===a)return!0;return!1},x.type=a,x.isFunction=b,x.isWindow=c,x.isArray=Z,x.isPlainObject=f,x.isEmptyObject=function(a){var b;for(b in a)return!1;return!0},x.inArray=function(a,b,c){return B.indexOf.call(b,a,c)},x.camelCase=z,x.trim=function(a){return null==a?"":String.prototype.trim.call(a)},x.uuid=0,x.support={},x.expr={},x.map=function(a,b){var c,d,e,f=[];if(g(a))for(d=0;d<a.length;d++)c=b(a[d],d),null!=c&&f.push(c);else for(e in a)c=b(a[e],e),null!=c&&f.push(c);return i(f)},x.each=function(a,b){var c,d;if(g(a)){for(c=0;c<a.length;c++)if(b.call(a[c],c,a[c])===!1)return a}else for(d in a)if(b.call(a[d],d,a[d])===!1)return a;return a},x.grep=function(a,b){return D.call(a,b)},window.JSON&&(x.parseJSON=JSON.parse),x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){U["[object "+b+"]"]=b.toLowerCase()}),x.fn={forEach:B.forEach,reduce:B.reduce,push:B.push,sort:B.sort,indexOf:B.indexOf,concat:B.concat,map:function(a){return x(x.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return x(C.apply(this,arguments))},ready:function(a){return S.test(E.readyState)&&E.body?a(x):E.addEventListener("DOMContentLoaded",function(){a(x)},!1),this},get:function(a){return a===v?C.call(this):this[a>=0?a:a+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(a){return B.every.call(this,function(b,c){return a.call(b,c,b)!==!1}),this},filter:function(a){return b(a)?this.not(this.not(a)):x(D.call(this,function(b){return W.matches(b,a)}))},add:function(a,b){return x(A(this.concat(x(a,b))))},is:function(a){return this.length>0&&W.matches(this[0],a)},not:function(a){var c=[];if(b(a)&&a.call!==v)this.each(function(b){a.call(this,b)||c.push(this)});else{var d="string"==typeof a?this.filter(a):g(a)&&b(a.item)?C.call(a):x(a);this.forEach(function(a){d.indexOf(a)<0&&c.push(a)})}return x(c)},has:function(a){return this.filter(function(){return e(a)?x.contains(this,a):x(this).find(a).size()})},eq:function(a){return-1===a?this.slice(a):this.slice(a,+a+1)},first:function(){var a=this[0];return a&&!e(a)?a:x(a)},last:function(){var a=this[this.length-1];return a&&!e(a)?a:x(a)},find:function(a){var b,c=this;return b=a?"object"==typeof a?x(a).filter(function(){var a=this;return B.some.call(c,function(b){return x.contains(b,a)})}):1==this.length?x(W.qsa(this[0],a)):this.map(function(){return W.qsa(this,a)}):x()},closest:function(a,b){var c=this[0],e=!1;for("object"==typeof a&&(e=x(a));c&&!(e?e.indexOf(c)>=0:W.matches(c,a));)c=c!==b&&!d(c)&&c.parentNode;return x(c)},parents:function(a){for(var b=[],c=this;c.length>0;)c=x.map(c,function(a){return(a=a.parentNode)&&!d(a)&&b.indexOf(a)<0?(b.push(a),a):void 0});return p(b,a)},parent:function(a){return p(A(this.pluck("parentNode")),a)},children:function(a){return p(this.map(function(){return n(this)}),a)},contents:function(){return this.map(function(){return C.call(this.childNodes)})},siblings:function(a){return p(this.map(function(a,b){return D.call(n(b.parentNode),function(a){return a!==b})}),a)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(a){return x.map(this,function(b){return b[a]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=m(this.nodeName))})},replaceWith:function(a){return this.before(a).remove()},wrap:function(a){var c=b(a);if(this[0]&&!c)var d=x(a).get(0),e=d.parentNode||this.length>1;return this.each(function(b){x(this).wrapAll(c?a.call(this,b):e?d.cloneNode(!0):d)})},wrapAll:function(a){if(this[0]){x(this[0]).before(a=x(a));for(var b;(b=a.children()).length;)a=b.first();x(a).append(this)}return this},wrapInner:function(a){var c=b(a);return this.each(function(b){var d=x(this),e=d.contents(),f=c?a.call(this,b):a;e.length?e.wrapAll(f):d.append(f)})},unwrap:function(){return this.parent().each(function(){x(this).replaceWith(x(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(a){return this.each(function(){var b=x(this);(a===v?"none"==b.css("display"):a)?b.show():b.hide()})},prev:function(a){return x(this.pluck("previousElementSibling")).filter(a||"*")},next:function(a){return x(this.pluck("nextElementSibling")).filter(a||"*")},html:function(a){return 0 in arguments?this.each(function(b){var c=this.innerHTML;x(this).empty().append(q(this,a,b,c))}):0 in this?this[0].innerHTML:null},text:function(a){return 0 in arguments?this.each(function(b){var c=q(this,a,b,this.textContent);this.textContent=null==c?"":""+c}):0 in this?this[0].textContent:null},attr:function(a,b){var c;return"string"!=typeof a||1 in arguments?this.each(function(c){if(1===this.nodeType)if(e(a))for(w in a)r(this,w,a[w]);else r(this,a,q(this,b,c,this.getAttribute(a)))}):this.length&&1===this[0].nodeType?!(c=this[0].getAttribute(a))&&a in this[0]?this[0][a]:c:v},removeAttr:function(a){return this.each(function(){1===this.nodeType&&a.split(" ").forEach(function(a){r(this,a)},this)})},prop:function(a,b){return a=Y[a]||a,1 in arguments?this.each(function(c){this[a]=q(this,b,c,this[a])}):this[0]&&this[0][a]},data:function(a,b){var c="data-"+a.replace(M,"-$1").toLowerCase(),d=1 in arguments?this.attr(c,b):this.attr(c);return null!==d?t(d):v},val:function(a){return 0 in arguments?this.each(function(b){this.value=q(this,a,b,this.value)}):this[0]&&(this[0].multiple?x(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(a){if(a)return this.each(function(b){var c=x(this),d=q(this,a,b,c.offset()),e=c.offsetParent().offset(),f={top:d.top-e.top,left:d.left-e.left};"static"==c.css("position")&&(f.position="relative"),c.css(f)});if(!this.length)return null;var b=this[0].getBoundingClientRect();return{left:b.left+window.pageXOffset,top:b.top+window.pageYOffset,width:Math.round(b.width),height:Math.round(b.height)}},css:function(b,c){if(arguments.length<2){var d,e=this[0];if(!e)return;if(d=getComputedStyle(e,""),"string"==typeof b)return e.style[z(b)]||d.getPropertyValue(b);if(Z(b)){var f={};return x.each(b,function(a,b){f[b]=e.style[z(b)]||d.getPropertyValue(b)}),f}}var g="";if("string"==a(b))c||0===c?g=j(b)+":"+l(b,c):this.each(function(){this.style.removeProperty(j(b))});else for(w in b)b[w]||0===b[w]?g+=j(w)+":"+l(w,b[w])+";":this.each(function(){this.style.removeProperty(j(w))});return this.each(function(){this.style.cssText+=";"+g})},index:function(a){return a?this.indexOf(x(a)[0]):this.parent().children().indexOf(this[0])},hasClass:function(a){return a?B.some.call(this,function(a){return this.test(s(a))},k(a)):!1},addClass:function(a){return a?this.each(function(b){if("className"in this){y=[];var c=s(this),d=q(this,a,b,c);d.split(/\s+/g).forEach(function(a){x(this).hasClass(a)||y.push(a)},this),y.length&&s(this,c+(c?" ":"")+y.join(" "))}}):this},removeClass:function(a){return this.each(function(b){if("className"in this){if(a===v)return s(this,"");y=s(this),q(this,a,b,y).split(/\s+/g).forEach(function(a){y=y.replace(k(a)," ")}),s(this,y.trim())}})},toggleClass:function(a,b){return a?this.each(function(c){var d=x(this),e=q(this,a,c,s(this));e.split(/\s+/g).forEach(function(a){(b===v?!d.hasClass(a):b)?d.addClass(a):d.removeClass(a)})}):this},scrollTop:function(a){if(this.length){var b="scrollTop"in this[0];return a===v?b?this[0].scrollTop:this[0].pageYOffset:this.each(b?function(){this.scrollTop=a}:function(){this.scrollTo(this.scrollX,a)})}},scrollLeft:function(a){if(this.length){var b="scrollLeft"in this[0];return a===v?b?this[0].scrollLeft:this[0].pageXOffset:this.each(b?function(){this.scrollLeft=a}:function(){this.scrollTo(a,this.scrollY)})}},position:function(){if(this.length){var a=this[0],b=this.offsetParent(),c=this.offset(),d=L.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(x(a).css("margin-top"))||0,c.left-=parseFloat(x(a).css("margin-left"))||0,d.top+=parseFloat(x(b[0]).css("border-top-width"))||0,d.left+=parseFloat(x(b[0]).css("border-left-width"))||0,{top:c.top-d.top,left:c.left-d.left}}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||E.body;a&&!L.test(a.nodeName)&&"static"==x(a).css("position");)a=a.offsetParent;return a})}},x.fn.detach=x.fn.remove,["width","height"].forEach(function(a){var b=a.replace(/./,function(a){return a[0].toUpperCase()});x.fn[a]=function(e){var f,g=this[0];return e===v?c(g)?g["inner"+b]:d(g)?g.documentElement["scroll"+b]:(f=this.offset())&&f[a]:this.each(function(b){g=x(this),g.css(a,q(this,e,b,g[a]()))})}}),O.forEach(function(b,c){var d=c%2;x.fn[b]=function(){var b,e,f=x.map(arguments,function(c){return b=a(c),"object"==b||"array"==b||null==c?c:W.fragment(c)}),g=this.length>1;return f.length<1?this:this.each(function(a,b){e=d?b:b.parentNode,b=0==c?b.nextSibling:1==c?b.firstChild:2==c?b:null;var h=x.contains(E.documentElement,e);f.forEach(function(a){if(g)a=a.cloneNode(!0);else if(!e)return x(a).remove();e.insertBefore(a,b),h&&u(a,function(a){null==a.nodeName||"SCRIPT"!==a.nodeName.toUpperCase()||a.type&&"text/javascript"!==a.type||a.src||window.eval.call(window,a.innerHTML)})})})},x.fn[d?b+"To":"insert"+(c?"Before":"After")]=function(a){return x(a)[b](this),this}}),W.Z.prototype=x.fn,W.uniq=A,W.deserializeValue=t,x.zepto=W,x}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(a){function b(b){return b=a(b),!(!b.width()&&!b.height())&&"none"!==b.css("display")}function c(a,b){a=a.replace(/=#\]/g,'="#"]');var c,d,e=h.exec(a);if(e&&e[2]in g&&(c=g[e[2]],d=e[3],a=e[1],d)){var f=Number(d);d=isNaN(f)?d.replace(/^["']|["']$/g,""):f}return b(a,c,d)}var d=a.zepto,e=d.qsa,f=d.matches,g=a.expr[":"]={visible:function(){return b(this)?this:void 0},hidden:function(){return b(this)?void 0:this},selected:function(){return this.selected?this:void 0},checked:function(){return this.checked?this:void 0},parent:function(){return this.parentNode},first:function(a){return 0===a?this:void 0},last:function(a,b){return a===b.length-1?this:void 0},eq:function(a,b,c){return a===c?this:void 0},contains:function(b,c,d){return a(this).text().indexOf(d)>-1?this:void 0},has:function(a,b,c){return d.qsa(this,c).length?this:void 0}},h=new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"),i=/^\s*>/,j="Zepto"+ +new Date;d.qsa=function(b,f){return c(f,function(c,g,h){try{var k;!c&&g?c="*":i.test(c)&&(k=a(b).addClass(j),c="."+j+" "+c);var l=e(b,c)}catch(m){throw console.error("error performing selector: %o",f),m}finally{k&&k.removeClass(j)}return g?d.uniq(a.map(l,function(a,b){return g.call(a,b,l,h)})):l})},d.matches=function(a,b){return c(b,function(b,c,d){return!(b&&!f(a,b)||c&&c.call(a,null,d)!==a)})}}(Zepto),function(a){a.fn.end=function(){return this.prevObject||a()},a.fn.andSelf=function(){return this.add(this.prevObject||a())},"filter,add,not,eq,first,last,find,closest,parents,parent,children,siblings".split(",").forEach(function(b){var c=a.fn[b];a.fn[b]=function(){var a=c.apply(this,arguments);return a.prevObject=this,a}})}(Zepto),function(a){function b(b,d){var i=b[h],j=i&&e[i];if(void 0===d)return j||c(b);if(j){if(d in j)return j[d];var k=g(d);if(k in j)return j[k]}return f.call(a(b),d)}function c(b,c,f){var i=b[h]||(b[h]=++a.uuid),j=e[i]||(e[i]=d(b));return void 0!==c&&(j[g(c)]=f),j}function d(b){var c={};return a.each(b.attributes||i,function(b,d){0==d.name.indexOf("data-")&&(c[g(d.name.replace("data-",""))]=a.zepto.deserializeValue(d.value))}),c}var e={},f=a.fn.data,g=a.camelCase,h=a.expando="Zepto"+ +new Date,i=[];a.fn.data=function(d,e){return void 0===e?a.isPlainObject(d)?this.each(function(b,e){a.each(d,function(a,b){c(e,a,b)})}):0 in this?b(this[0],d):void 0:this.each(function(){c(this,d,e)})},a.fn.removeData=function(b){return"string"==typeof b&&(b=b.split(/\s+/)),this.each(function(){var c=this[h],d=c&&e[c];d&&a.each(b||d,function(a){delete d[b?g(this):a]})})},["remove","empty"].forEach(function(b){var c=a.fn[b];a.fn[b]=function(){var a=this.find("*");return"remove"===b&&(a=a.add(this)),a.removeData(),c.call(this)}})}(Zepto),function(a){function b(a){return a._zid||(a._zid=m++)}function c(a,c,f,g){if(c=d(c),c.ns)var h=e(c.ns);return(q[b(a)]||[]).filter(function(a){return!(!a||c.e&&a.e!=c.e||c.ns&&!h.test(a.ns)||f&&b(a.fn)!==b(f)||g&&a.sel!=g)})}function d(a){var b=(""+a).split(".");return{e:b[0],ns:b.slice(1).sort().join(" ")}}function e(a){return new RegExp("(?:^| )"+a.replace(" "," .* ?")+"(?: |$)")}function f(a,b){return a.del&&!s&&a.e in t||!!b}function g(a){return u[a]||s&&t[a]||a}function h(c,e,h,i,k,m,n){var o=b(c),p=q[o]||(q[o]=[]);e.split(/\s/).forEach(function(b){if("ready"==b)return a(document).ready(h);var e=d(b);e.fn=h,e.sel=k,e.e in u&&(h=function(b){var c=b.relatedTarget;return!c||c!==this&&!a.contains(this,c)?e.fn.apply(this,arguments):void 0}),e.del=m;var o=m||h;e.proxy=function(a){if(a=j(a),!a.isImmediatePropagationStopped()){a.data=i;var b=o.apply(c,a._args==l?[a]:[a].concat(a._args));return b===!1&&(a.preventDefault(),a.stopPropagation()),b}},e.i=p.length,p.push(e),"addEventListener"in c&&c.addEventListener(g(e.e),e.proxy,f(e,n))})}function i(a,d,e,h,i){var j=b(a);(d||"").split(/\s/).forEach(function(b){c(a,b,e,h).forEach(function(b){delete q[j][b.i],"removeEventListener"in a&&a.removeEventListener(g(b.e),b.proxy,f(b,i))})})}function j(b,c){return(c||!b.isDefaultPrevented)&&(c||(c=b),a.each(y,function(a,d){var e=c[a];b[a]=function(){return this[d]=v,e&&e.apply(c,arguments)},b[d]=w}),(c.defaultPrevented!==l?c.defaultPrevented:"returnValue"in c?c.returnValue===!1:c.getPreventDefault&&c.getPreventDefault())&&(b.isDefaultPrevented=v)),b}function k(a){var b,c={originalEvent:a};for(b in a)x.test(b)||a[b]===l||(c[b]=a[b]);return j(c,a)}var l,m=1,n=Array.prototype.slice,o=a.isFunction,p=function(a){return"string"==typeof a},q={},r={},s="onfocusin"in window,t={focus:"focusin",blur:"focusout"},u={mouseenter:"mouseover",mouseleave:"mouseout"};r.click=r.mousedown=r.mouseup=r.mousemove="MouseEvents",a.event={add:h,remove:i},a.proxy=function(c,d){var e=2 in arguments&&n.call(arguments,2);if(o(c)){var f=function(){return c.apply(d,e?e.concat(n.call(arguments)):arguments)};return f._zid=b(c),f}if(p(d))return e?(e.unshift(c[d],c),a.proxy.apply(null,e)):a.proxy(c[d],c);throw new TypeError("expected function")},a.fn.bind=function(a,b,c){return this.on(a,b,c)},a.fn.unbind=function(a,b){return this.off(a,b)},a.fn.one=function(a,b,c,d){return this.on(a,b,c,d,1)};var v=function(){return!0},w=function(){return!1},x=/^([A-Z]|returnValue$|layer[XY]$)/,y={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};a.fn.delegate=function(a,b,c){return this.on(b,a,c)},a.fn.undelegate=function(a,b,c){return this.off(b,a,c)},a.fn.live=function(b,c){return a(document.body).delegate(this.selector,b,c),this},a.fn.die=function(b,c){return a(document.body).undelegate(this.selector,b,c),this},a.fn.on=function(b,c,d,e,f){var g,j,m=this;return b&&!p(b)?(a.each(b,function(a,b){m.on(a,c,d,b,f)}),m):(p(c)||o(e)||e===!1||(e=d,d=c,c=l),(o(d)||d===!1)&&(e=d,d=l),e===!1&&(e=w),m.each(function(l,m){f&&(g=function(a){return i(m,a.type,e),e.apply(this,arguments)}),c&&(j=function(b){var d,f=a(b.target).closest(c,m).get(0);return f&&f!==m?(d=a.extend(k(b),{currentTarget:f,liveFired:m}),(g||e).apply(f,[d].concat(n.call(arguments,1)))):void 0}),h(m,b,e,d,c,j||g)}))},a.fn.off=function(b,c,d){var e=this;return b&&!p(b)?(a.each(b,function(a,b){e.off(a,c,b)}),e):(p(c)||o(d)||d===!1||(d=c,c=l),d===!1&&(d=w),e.each(function(){i(this,b,d,c)}))},a.fn.trigger=function(b,c){return b=p(b)||a.isPlainObject(b)?a.Event(b):j(b),b._args=c,this.each(function(){b.type in t&&"function"==typeof this[b.type]?this[b.type]():"dispatchEvent"in this?this.dispatchEvent(b):a(this).triggerHandler(b,c)})},a.fn.triggerHandler=function(b,d){var e,f;return this.each(function(g,h){e=k(p(b)?a.Event(b):b),e._args=d,e.target=h,a.each(c(h,b.type||b),function(a,b){return f=b.proxy(e),e.isImmediatePropagationStopped()?!1:void 0})}),f},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(b){a.fn[b]=function(a){return 0 in arguments?this.bind(b,a):this.trigger(b)}}),a.Event=function(a,b){p(a)||(b=a,a=b.type);var c=document.createEvent(r[a]||"Events"),d=!0;if(b)for(var e in b)"bubbles"==e?d=!!b[e]:c[e]=b[e];return c.initEvent(a,d,!0),j(c)}}(Zepto),window.Zepto=Zepto,"$"in window||(window.$=Zepto),"function"==typeof define&&define.amd&&define("jquery",[],function(){return Zepto});
$.extend($.fn, {
valMap() {
const data = {};
for (let i = 0; i < this.length; i++) {
let ele = $(this[i]),
name = ele.attr('name'),
val = ele.val();
if (ele.is('[type=hidden]') || ele.is('select')) {
// 自动转换
if (/^\s*([1-9]\d*|0)\s*$/.test(val)) {
val = +val;
} else if (val == 'true') {
val = true;
} else if (val == 'false') {
val = false;
}
} else if (ele.is('[type=number]')) {
val = +val;
}
if (name) {
name = name.replace(/^\s*|\s*$/gi, '');
if (/^([^\[]+)(?:\s*\[\s*([^\]]+)\s*\])+$/.test(name)) {
let keys = [name.substr(0, name.indexOf('[')).replace(/^\s*|\s*$/gi, '')];
keys = keys.concat(name.substr(keys[0].length).replace(/^\s*\[|\]\s*$/gi, '').split(/\]\s*\[/));
let node = data;
while (keys.length) {
const key = keys.shift();
if (keys.length == 0) {
node[key] = val;
} else {
if (typeof node[key] !== 'object') {
node = node[key] = {};
} else {
node = node[key];
}
}
}
} else {
data[name] = val;
}
}
}
return data;
},
inputValidate(config) {
for (let i = 0; i < this.length; i++) {
let ele = $(this[i]),
name = ele.attr('name').replace(/^\s*|\s*$/gi, ''),
val = ele.val();
if (!!name && !!config[name]) {
let rules = config[name];
if (!rules instanceof Array) {
rules = [rules];
}
for (let j = 0; j < rules.length; j++) {
const rule = rules[j];
if (rule.match) {
if (rule.match == 'phone') {
if (!/^1\d{10}$/.test(val)) {
ele.trigger('inputerror', rule.error);
return true;
}
} else if (rule.match == 'IDCard') {
if (!/^\d{14}(\d{3})?[\dXx]$/.test(val)) {
ele.trigger('inputerror', rule.error);
return true;
}
}
} else if (rule.pattern) {
const regexp = new RegExp(rule.pattern);
if (!regexp.test(val)) {
ele.trigger('inputerror', rule.error);
return true;
}
}
}
}
}
return false;
},
submitFields(selector) {
if (typeof selector === 'string') {
selector = $(selector);
} else if (!selector) {
selector = new $();
}
const callback = (function(selector, target) {
return function() {
const fields = selector.filter(function() { return $(this).is('.required,[required],[type=checkbox].required-checked'); });
for (let i = 0; i < fields.length; i++) {
const r = $(fields[i]);
if ('|text|password|'.indexOf(('|' + r.attr('type') + '|').toLowerCase()) >= 0 && !r.is(':visible')) {
continue;
}
if (r.hasClass('required') || r.is('[required]')) {
if (/^\s*$/.test(r.val())) {
target.attr('disabled', 'disabled');
return;
}
}
if (r.hasClass('required-checked') && r.is('[type=checkbox]')) {
if (!r.is(':checked')) {
target.attr('disabled', 'disabled');
return;
}
}
}
target.removeAttr('disabled');
};
})(selector, this);
this.trigger('uninstall').off('uninstall');
selector.length && this.on('uninstall', function() {
selector.off('input change', callback);
}) && selector
.on('input change', callback)
.eq(0).trigger('input');
return this;
},
lock(cd) {
let self = $(this),
text = self.html(),
i = cd;
self.data('origin-text', '免费获取');
const call = function() {
if (i > 0) {
self.html(i + '秒后重试');
self.attr('disabled', 'disabled');
} else {
self.html(self.data('origin-text'));
self.removeAttr('disabled');
self.data('timer', 0);
clearInterval(timer);
self.trigger('clickready');
}
i--;
};
var timer = setInterval(call, 1000);
self.data('timer', timer);
call();
const id = self.data('id');
if (window.localStorage && id) {
let cache = window.localStorage.lock_cd;
if (cache) {
cache = JSON.parse(cache);
} else {
cache = {};
}
cache[id] = Math.round(new Date().getTime() / 1000) + cd;
window.localStorage.lock_cd = JSON.stringify(cache);
}
},
unlock() {
const self = $(this);
self.html(self.data('origin-text'));
self.removeAttr('disabled');
const timer = self.data('timer');
timer && clearInterval(timer);
const id = self.data('id');
if (window.localStorage) {
let cache = window.localStorage.lock_cd;
if (cache) {
cache = JSON.parse(cache);
} else {
cache = {};
}
delete cache[id];
window.localStorage.lock_cd = JSON.stringify(cache);
}
},
restoreLock() {
const self = $(this);
if (window.localStorage) {
let cache = window.localStorage.lock_cd;
if (cache) {
cache = JSON.parse(cache);
}
const now = Math.round(new Date().getTime() / 1000);
for (const id in cache) {
const cdt = cache[id];
if (cdt - now > 0) {
(self.data('id') == id ? self : self.find('[data-id=' + id + ']')).lock(cdt - now);
}
}
}
},
lockCD() {
const self = $(this);
const lock_id = self.data('id');
try {
if (window.localStorage && lock_id) {
let cache = window.localStorage.lock_cd;
if (cache) {
cache = JSON.parse(cache);
}
const now = Math.round(new Date().getTime() / 1000);
if (lock_id in cache) {
const cdt = cache[lock_id];
if (cdt - now > 0) {
return cdt - now;
}
}
}
} catch (e) {
}
return 0;
},
});
$(function() {
$(document).restoreLock();
$('script[type*=json]').each(function() {
let self = $(this),
id = self.attr('id');
if (id) {
try {
window[id] = JSON.parse(self.html());
} catch (e) {
window[id] = undefined;
}
}
});
});
'use strict';
$.progress = (function() {
function _(option) {
}
_.prototype = {
start(container) {
const self = this;
const loader = $('<div>', { class: 'progress-top-loader' }).appendTo(container ? container : $('body'));
this._progress = 0;
this._completed = false;
loader.addClass('out');
window.requestAnimFrame = (function() {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback) {
window.setTimeout(callback, 1000 / 60);
};
})();
function rand(a, b) {
return Math.round(a + Math.random() * (b - a));
}
function mix(a, b, r) {
return a + (b - a) * r;
}
function easing(k) {
if ((k *= 2) < 1) {
return 0.5 * k * k * k;
}
return 0.5 * ((k -= 2) * k * k + 2);
}
let times = rand(1, 3),
elapsed_time = 0,
queue = [],
top,
last_time = +new Date(),
target = 20;
for (let i = 0; i < times; i++) {
target = rand(target, 40 + 20 * i);
queue.push({
duration: rand(500, 6000 - i * 2000),
target,
type: 'play',
});
queue.push({
duration: rand(500, 2000 + i * 2000),
type: 'pause',
});
}
top = queue.shift();
top.src = self._progress;
function animationLoop() {
do {
if (self._completed) {
queue = [];
top = { src: self._progress, target: 100, type: 'play', duration: 400 };
elapsed_time = 0;
last_time = +new Date();
delete self._completed;
} else if (elapsed_time <= top.duration) {
if (top.type == 'play') {
self._progress = parseFloat(mix(top.src, top.target, easing(elapsed_time / top.duration)).toFixed(2));
}
} else {
elapsed_time = 0;
if (queue.length) {
if (top.type == 'play') {
self._progress = top.target;
}
top = queue.shift();
top.src = self._progress;
} else {
if (self._progress >= 99) {
loader.css('width', self._progress + '%');
loader.removeClass('out');
setTimeout(function() {
loader.detach();
}, 200);
return;
}
}
}
if (!isNaN(self._progress)) {
loader.css('width', self._progress + '%');
}
} while (false);
const current_time = +new Date();
elapsed_time += current_time - last_time;
last_time = current_time;
requestAnimFrame(animationLoop);
}
animationLoop();
return self;
},
end() {
this._completed = true;
return self;
},
};
return _;
})();
$.prompt = function(text, delay) {
if (delay === undefined || +delay <= 0) {
delay = 3000;
}
let prompt = $('#prompt'),
timer = 0;
if (prompt.length === 0) {
prompt = $('<div>', { class: 'prompt', id: 'prompt' }).append($('<span>')).appendTo($('body'));
}
prompt.find('span').html(text);
timer = prompt.data('timer');
timer && clearTimeout(timer);
prompt.show();
prompt.data('timer', setTimeout(function() {
prompt.detach().data('timer', 0);
}, delay));
};
$.toast = function(text, delay) {
if (delay === undefined || +delay <= 0) {
delay = 3000;
}
let toast = $('#toast'),
timer = 0;
if (toast.length === 0) {
toast = $('<div>', { class: 'toast', id: 'toast' }).append($('<span>')).appendTo($('body'));
}
toast.find('span').html(text);
timer = toast.data('timer');
timer && clearTimeout(timer);
toast.show();
toast.data('timer', setTimeout(function() {
toast.detach().data('timer', 0);
}, delay));
};
$.dialog = (function() {
function _(option) {
function get_param(a, b, c) {
return b in a ? a[b] : c;
}
let title = get_param(option, 'title'),
content = get_param(option, 'content'),
style = get_param(option, 'style', {}),
buttons = get_param(option, 'buttons', [{ title: '确认' }]);
if ('html' in option) {
content = option.html;
} else if ('content' in option) {
content = (function htmlEncode(str) {
const div = document.createElement('div');
div.appendChild(document.createTextNode(str));
return div.innerHTML;
})(option.content);
}
const self = this;
this.context = $(['<div class="dialog">',
'<div class="dialog-title"></div>',
'<div class="dialog-wrapper">',
'<div class="dialog-content">',
'</div>',
'<div class="dialog-button-container">',
'</div>',
'</div>',
'</div>'].join(''));
this.context.find('.dialog-title')[title ? 'html' : 'detach'](title);
for (let i = 0; i < buttons.length; i++) {
const a = buttons[i];
this.add(get_param(a, 'title', '提示'), get_param(a, 'className'), get_param(a, 'tap'));
}
this.content = this.context.find('.dialog-content');
if (content) {
this.content.append(content);
} else {
this.content.empty();
}
for (let key in style) {
key = key.replace(/([A-Z])/g, '-$1').toLowerCase();
const ele = key == 'root' ? this.context : this.context.find('.dialog-' + key);
const css = style[key];
if (typeof css === 'string') {
ele.addClass(css);
} else if (typeof css === 'object') {
ele.css(css);
}
}
this._loaded = false;
this._alert = false;
this._listeners = {};
}
_.prototype = {
dismiss() {
const self = this;
self.trigger('dimiss');
this.context.removeClass('out');
$.dialog.global.blocking = false;
const overlay = $('.ui-overlay').removeClass('out');
setTimeout(function() {
overlay.removeClass('show');
self.context.removeClass('show');
self.trigger('hide');
self.context.detach();
}, 200);
return this;
},
on(type, fn) {
type = type.replace(/^\s*|\s*$/gi, '');
if (/\s+/.test(type)) {
type.split(/\s+/).forEach(function(v, k) {
this.on(v, fn);
}, this);
return this;
}
if (typeof this._listeners[type] === 'undefined') {
this._listeners[type] = [];
}
if (typeof fn === 'function') {
this._listeners[type].push(fn);
}
return this;
},
off(type, fn) {
type = type.replace(/^\s*|\s*$/gi, '');
if (/\s+/.test(type)) {
type.split(/\s+/).forEach(function(v, k) {
this.on(v, fn);
}, this);
return this;
}
const arrayEvent = this._listeners[type];
if (typeof type === 'string' && arrayEvent instanceof Array) {
if (typeof fn === 'function') {
// 清除当前type类型事件下对应fn方法
for (let i = 0, length = arrayEvent.length; i < length; i += 1) {
if (arrayEvent[i] === fn) {
this._listeners[type].splice(i, 1);
break;
}
}
} else {
// 如果仅仅参数type, 或参数fn邪魔外道,则所有type类型事件清除
delete this._listeners[type];
}
}
return this;
},
trigger(type) {
type = type.replace(/^\s*|\s*$/gi, '');
const args = Array.prototype.slice.call(arguments, 0);
args.unshift(document.createEvent('HTMLEvents'));
args[0].initEvent(type);
const arrayEvent = this._listeners[type];
if (arrayEvent instanceof Array) {
for (let i = 0, length = arrayEvent.length; i < length; i += 1) {
if (typeof arrayEvent[i] === 'function') {
arrayEvent[i].apply(this, args);
}
}
}
return this;
},
addClass(className) {
this.context.addClass(className);
return this;
},
attr() {
return this.context.attr.apply(this.context, Array.prototype.slice.call(arguments, 0));
},
find(selector) {
return this.content.find(selector);
},
$(selector) {
return this.find(selector);
},
model() {
let self = this,
opt = {},
args = Array.prototype.slice.call(arguments, 0);
[{
name: 'alert',
default_value: false,
}, {
name: 'animated',
default_value: true,
}].forEach(function(item, index) {
opt[item.name] = index < args.length ? args[index] : item.default_value;
});
this._alert = opt.alert;
if ($.dialog.global.blocking) {
$.dialog.global.queue.push(function() {
self.model.apply(self, args);
});
return this;
}
$.dialog.global.blocking = true;
this._loaded == false && this.trigger('load'), this._loaded = true;
let overlay = $('.ui-overlay');
overlay.length == 0 && (overlay = $('<div>', { class: 'ui-overlay' }).appendTo($('body')));
overlay.off('click').on('click', function() {
if (self._alert) {
return;
}
// self.dismiss();
});
const classNames = opt.animated ? ['show', 'out'] : ['out', 'show'];
overlay.addClass(classNames[0]);
this.trigger('show');
this.context.appendTo($('body')).addClass(classNames[0]);
setTimeout(function() {
self.context.addClass(classNames[1]);
overlay.addClass(classNames[1]);
self.trigger('model');
}, 10);
return this;
},
alert() {
return this.model(true);
},
wrap(title, className, func) {
return this.context.find('.dialog-button-container').empty(), this.add(title, className, func);
},
add(title, className, func) {
const self = this;
let btns = self.context.find('.dialog-button');
btns.removeClass('d-' + btns.length);
return (btns = btns.add($('<button>', { class: 'dialog-button' }).addClass(className).html(title)
.on('click', function() {
const i = $(this).index();
const event = document.createEvent('HTMLEvents');
event.initEvent('tap');
(typeof func === 'function' && func.apply(self, [event, this])) || self.dismiss();
self.trigger('submit', i);
}))), this.context.find('.dialog-button-container').empty().append(btns.addClass('d-' + btns.length)), this;
},
};
return function() {
let option = {};
if (arguments.length == 1) {
if (typeof arguments[0] === 'string') {
option.html = arguments[0];
} else if (typeof arguments[0] === 'object') {
option = arguments[0];
}
} else if (arguments.length >= 2) {
option.title = arguments[0];
option.html = arguments[1];
} else {
}
return new _(option);
};
})();
$.dialog.global = (function() {
let blocking = false;
const global = { queue: [], clear() {
this.queue = [];
blocking = false;
} };
Object.defineProperty(global, 'blocking', {
enumerable: true,
configurable: true,
get: function reactiveGetter() {
return blocking;
},
set: function reactiveSetter(newVal) {
newVal = !!newVal;
blocking = newVal;
if (!newVal) {
if (global.queue.length) {
const fn = global.queue.shift();
fn();
}
}
},
});
return global;
})();
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @param {Egg.Application} app - egg application * @param {Egg.Application} app - egg application
*/ */
module.exports = app => { module.exports = app => {
const { router, controller } = app; const { router, controller, io } = app;
const yysRouter = router.namespace(app.config.projectRootPath); const yysRouter = router.namespace(app.config.projectRootPath);
yysRouter.get('/index', controller.index.index);// H5页面 yysRouter.get('/index', controller.index.index);// H5页面
...@@ -20,7 +20,8 @@ module.exports = app => { ...@@ -20,7 +20,8 @@ module.exports = app => {
yysRouter.post('/dataCallback', controller.task.dataCallback);// 数据处理完成结果,不对外 yysRouter.post('/dataCallback', controller.task.dataCallback);// 数据处理完成结果,不对外
yysRouter.post('/newdataCallback', controller.task.newdataCallback);// 运营报告处理完成结果,不对外 yysRouter.post('/newdataCallback', controller.task.newdataCallback);// 运营报告处理完成结果,不对外
yysRouter.ws('/ws', controller.task.wslink); // yysRouter.ws('/', controller.task.wslink);
io.route('/ws', controller.task.wslink);
// yysRouter.get('/scripts', controller.script.fetchScripts); // 获取所有脚本信息 // yysRouter.get('/scripts', controller.script.fetchScripts); // 获取所有脚本信息
// yysRouter.get('/scripts/:phone');// 手机号获取脚本信息 // yysRouter.get('/scripts/:phone');// 手机号获取脚本信息
......
...@@ -36,5 +36,15 @@ module.exports = appInfo => { ...@@ -36,5 +36,15 @@ module.exports = appInfo => {
}, },
}; };
config.io = {
init: { }, // passed to engine.io
namespace: {
'/': {
connectionMiddleware: [],
packetMiddleware: [],
},
},
};
return config; return config;
}; };
...@@ -37,3 +37,8 @@ exports.handlebars = { ...@@ -37,3 +37,8 @@ exports.handlebars = {
enable: true, enable: true,
package: 'egg-view-handlebars', package: 'egg-view-handlebars',
}; };
exports.io = {
enable: true,
package: 'egg-socket.io',
};
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"egg-router-plus": "^1.3.0", "egg-router-plus": "^1.3.0",
"egg-scripts": "^2.5.0", "egg-scripts": "^2.5.0",
"egg-sequelize": "^4.2.0", "egg-sequelize": "^4.2.0",
"egg-socket.io": "^4.1.6",
"egg-validate": "^2.0.2", "egg-validate": "^2.0.2",
"egg-view-handlebars": "^2.0.1", "egg-view-handlebars": "^2.0.1",
"md5-node": "^1.0.1", "md5-node": "^1.0.1",
......
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