添加后台代理代码

This commit is contained in:
2026-03-15 01:27:05 +08:00
parent 11f9ac4dc1
commit ea08c9366a
5254 changed files with 721042 additions and 0 deletions

View File

@@ -0,0 +1,784 @@
/*!
* Bootstrap v3.3.5 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under the MIT license
*/
if ("undefined" == typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");
+function (a) {
"use strict";
var b = a.fn.jquery.split(" ")[0].split(".");
if (b[0] < 2 && b[1] < 9 || 1 == b[0] && 9 == b[1] && b[2] < 1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")
}(jQuery), +function (a) {
"use strict";
function b() {
var a = document.createElement("bootstrap"), b = {
WebkitTransition: "webkitTransitionEnd",
MozTransition: "transitionend",
OTransition: "oTransitionEnd otransitionend",
transition: "transitionend"
};
for (var c in b)if (void 0 !== a.style[c])return {end: b[c]};
return !1
}
a.fn.emulateTransitionEnd = function (b) {
var c = !1, d = this;
a(this).one("bsTransitionEnd", function () {
c = !0
});
var e = function () {
c || a(d).trigger(a.support.transition.end)
};
return setTimeout(e, b), this
}, a(function () {
a.support.transition = b(), a.support.transition && (a.event.special.bsTransitionEnd = {
bindType: a.support.transition.end,
delegateType: a.support.transition.end,
handle: function (b) {
return a(b.target).is(this) ? b.handleObj.handler.apply(this, arguments) : void 0
}
})
})
}(jQuery), +function (a) {
"use strict";
function b(b) {
return this.each(function () {
var c = a(this), e = c.data("bs.alert");
e || c.data("bs.alert", e = new d(this)), "string" == typeof b && e[b].call(c)
})
}
var c = '[data-dismiss="alert"]', d = function (b) {
a(b).on("click", c, this.close)
};
d.VERSION = "3.3.5", d.TRANSITION_DURATION = 150, d.prototype.close = function (b) {
function c() {
g.detach().trigger("closed.bs.alert").remove()
}
var e = a(this), f = e.attr("data-target");
f || (f = e.attr("href"), f = f && f.replace(/.*(?=#[^\s]*$)/, ""));
var g = a(f);
b && b.preventDefault(), g.length || (g = e.closest(".alert")), g.trigger(b = a.Event("close.bs.alert")), b.isDefaultPrevented() || (g.removeClass("in"), a.support.transition && g.hasClass("fade") ? g.one("bsTransitionEnd", c).emulateTransitionEnd(d.TRANSITION_DURATION) : c())
};
var e = a.fn.alert;
a.fn.alert = b, a.fn.alert.Constructor = d, a.fn.alert.noConflict = function () {
return a.fn.alert = e, this
}, a(document).on("click.bs.alert.data-api", c, d.prototype.close)
}(jQuery), +function (a) {
"use strict";
function b(b) {
return this.each(function () {
var d = a(this), e = d.data("bs.button"), f = "object" == typeof b && b;
e || d.data("bs.button", e = new c(this, f)), "toggle" == b ? e.toggle() : b && e.setState(b)
})
}
var c = function (b, d) {
this.$element = a(b), this.options = a.extend({}, c.DEFAULTS, d), this.isLoading = !1
};
c.VERSION = "3.3.5", c.DEFAULTS = {loadingText: "loading..."}, c.prototype.setState = function (b) {
var c = "disabled", d = this.$element, e = d.is("input") ? "val" : "html", f = d.data();
b += "Text", null == f.resetText && d.data("resetText", d[e]()), setTimeout(a.proxy(function () {
d[e](null == f[b] ? this.options[b] : f[b]), "loadingText" == b ? (this.isLoading = !0, d.addClass(c).attr(c, c)) : this.isLoading && (this.isLoading = !1, d.removeClass(c).removeAttr(c))
}, this), 0)
}, c.prototype.toggle = function () {
var a = !0, b = this.$element.closest('[data-toggle="buttons"]');
if (b.length) {
var c = this.$element.find("input");
"radio" == c.prop("type") ? (c.prop("checked") && (a = !1), b.find(".active").removeClass("active"), this.$element.addClass("active")) : "checkbox" == c.prop("type") && (c.prop("checked") !== this.$element.hasClass("active") && (a = !1), this.$element.toggleClass("active")), c.prop("checked", this.$element.hasClass("active")), a && c.trigger("change")
} else this.$element.attr("aria-pressed", !this.$element.hasClass("active")), this.$element.toggleClass("active")
};
var d = a.fn.button;
a.fn.button = b, a.fn.button.Constructor = c, a.fn.button.noConflict = function () {
return a.fn.button = d, this
}, a(document).on("click.bs.button.data-api", '[data-toggle^="button"]', function (c) {
var d = a(c.target);
d.hasClass("btn") || (d = d.closest(".btn")), b.call(d, "toggle"), a(c.target).is('input[type="radio"]') || a(c.target).is('input[type="checkbox"]') || c.preventDefault()
}).on("focus.bs.button.data-api blur.bs.button.data-api", '[data-toggle^="button"]', function (b) {
a(b.target).closest(".btn").toggleClass("focus", /^focus(in)?$/.test(b.type))
})
}(jQuery), +function (a) {
"use strict";
function b(b) {
return this.each(function () {
var d = a(this), e = d.data("bs.carousel"), f = a.extend({}, c.DEFAULTS, d.data(), "object" == typeof b && b), g = "string" == typeof b ? b : f.slide;
e || d.data("bs.carousel", e = new c(this, f)), "number" == typeof b ? e.to(b) : g ? e[g]() : f.interval && e.pause().cycle()
})
}
var c = function (b, c) {
this.$element = a(b), this.$indicators = this.$element.find(".carousel-indicators"), this.options = c, this.paused = null, this.sliding = null, this.interval = null, this.$active = null, this.$items = null, this.options.keyboard && this.$element.on("keydown.bs.carousel", a.proxy(this.keydown, this)), "hover" == this.options.pause && !("ontouchstart" in document.documentElement) && this.$element.on("mouseenter.bs.carousel", a.proxy(this.pause, this)).on("mouseleave.bs.carousel", a.proxy(this.cycle, this))
};
c.VERSION = "3.3.5", c.TRANSITION_DURATION = 600, c.DEFAULTS = {
interval: 5e3,
pause: "hover",
wrap: !0,
keyboard: !0
}, c.prototype.keydown = function (a) {
if (!/input|textarea/i.test(a.target.tagName)) {
switch (a.which) {
case 37:
this.prev();
break;
case 39:
this.next();
break;
default:
return
}
a.preventDefault()
}
}, c.prototype.cycle = function (b) {
return b || (this.paused = !1), this.interval && clearInterval(this.interval), this.options.interval && !this.paused && (this.interval = setInterval(a.proxy(this.next, this), this.options.interval)), this
}, c.prototype.getItemIndex = function (a) {
return this.$items = a.parent().children(".item"), this.$items.index(a || this.$active)
}, c.prototype.getItemForDirection = function (a, b) {
var c = this.getItemIndex(b), d = "prev" == a && 0 === c || "next" == a && c == this.$items.length - 1;
if (d && !this.options.wrap)return b;
var e = "prev" == a ? -1 : 1, f = (c + e) % this.$items.length;
return this.$items.eq(f)
}, c.prototype.to = function (a) {
var b = this, c = this.getItemIndex(this.$active = this.$element.find(".item.active"));
return a > this.$items.length - 1 || 0 > a ? void 0 : this.sliding ? this.$element.one("slid.bs.carousel", function () {
b.to(a)
}) : c == a ? this.pause().cycle() : this.slide(a > c ? "next" : "prev", this.$items.eq(a))
}, c.prototype.pause = function (b) {
return b || (this.paused = !0), this.$element.find(".next, .prev").length && a.support.transition && (this.$element.trigger(a.support.transition.end), this.cycle(!0)), this.interval = clearInterval(this.interval), this
}, c.prototype.next = function () {
return this.sliding ? void 0 : this.slide("next")
}, c.prototype.prev = function () {
return this.sliding ? void 0 : this.slide("prev")
}, c.prototype.slide = function (b, d) {
var e = this.$element.find(".item.active"), f = d || this.getItemForDirection(b, e), g = this.interval, h = "next" == b ? "left" : "right", i = this;
if (f.hasClass("active"))return this.sliding = !1;
var j = f[0], k = a.Event("slide.bs.carousel", {relatedTarget: j, direction: h});
if (this.$element.trigger(k), !k.isDefaultPrevented()) {
if (this.sliding = !0, g && this.pause(), this.$indicators.length) {
this.$indicators.find(".active").removeClass("active");
var l = a(this.$indicators.children()[this.getItemIndex(f)]);
l && l.addClass("active")
}
var m = a.Event("slid.bs.carousel", {relatedTarget: j, direction: h});
return a.support.transition && this.$element.hasClass("slide") ? (f.addClass(b), f[0].offsetWidth, e.addClass(h), f.addClass(h), e.one("bsTransitionEnd", function () {
f.removeClass([b, h].join(" ")).addClass("active"), e.removeClass(["active", h].join(" ")), i.sliding = !1, setTimeout(function () {
i.$element.trigger(m)
}, 0)
}).emulateTransitionEnd(c.TRANSITION_DURATION)) : (e.removeClass("active"), f.addClass("active"), this.sliding = !1, this.$element.trigger(m)), g && this.cycle(), this
}
};
var d = a.fn.carousel;
a.fn.carousel = b, a.fn.carousel.Constructor = c, a.fn.carousel.noConflict = function () {
return a.fn.carousel = d, this
};
var e = function (c) {
var d, e = a(this), f = a(e.attr("data-target") || (d = e.attr("href")) && d.replace(/.*(?=#[^\s]+$)/, ""));
if (f.hasClass("carousel")) {
var g = a.extend({}, f.data(), e.data()), h = e.attr("data-slide-to");
h && (g.interval = !1), b.call(f, g), h && f.data("bs.carousel").to(h), c.preventDefault()
}
};
a(document).on("click.bs.carousel.data-api", "[data-slide]", e).on("click.bs.carousel.data-api", "[data-slide-to]", e), a(window).on("load", function () {
a('[data-ride="carousel"]').each(function () {
var c = a(this);
b.call(c, c.data())
})
})
}(jQuery), +function (a) {
"use strict";
function b(b) {
var c, d = b.attr("data-target") || (c = b.attr("href")) && c.replace(/.*(?=#[^\s]+$)/, "");
return a(d)
}
function c(b) {
return this.each(function () {
var c = a(this), e = c.data("bs.collapse"), f = a.extend({}, d.DEFAULTS, c.data(), "object" == typeof b && b);
!e && f.toggle && /show|hide/.test(b) && (f.toggle = !1), e || c.data("bs.collapse", e = new d(this, f)), "string" == typeof b && e[b]()
})
}
var d = function (b, c) {
this.$element = a(b), this.options = a.extend({}, d.DEFAULTS, c), this.$trigger = a('[data-toggle="collapse"][href="#' + b.id + '"],[data-toggle="collapse"][data-target="#' + b.id + '"]'), this.transitioning = null, this.options.parent ? this.$parent = this.getParent() : this.addAriaAndCollapsedClass(this.$element, this.$trigger), this.options.toggle && this.toggle()
};
d.VERSION = "3.3.5", d.TRANSITION_DURATION = 350, d.DEFAULTS = {toggle: !0}, d.prototype.dimension = function () {
var a = this.$element.hasClass("width");
return a ? "width" : "height"
}, d.prototype.show = function () {
if (!this.transitioning && !this.$element.hasClass("in")) {
var b, e = this.$parent && this.$parent.children(".panel").children(".in, .collapsing");
if (!(e && e.length && (b = e.data("bs.collapse"), b && b.transitioning))) {
var f = a.Event("show.bs.collapse");
if (this.$element.trigger(f), !f.isDefaultPrevented()) {
e && e.length && (c.call(e, "hide"), b || e.data("bs.collapse", null));
var g = this.dimension();
this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded", !0), this.$trigger.removeClass("collapsed").attr("aria-expanded", !0), this.transitioning = 1;
var h = function () {
this.$element.removeClass("collapsing").addClass("collapse in")[g](""), this.transitioning = 0, this.$element.trigger("shown.bs.collapse")
};
if (!a.support.transition)return h.call(this);
var i = a.camelCase(["scroll", g].join("-"));
this.$element.one("bsTransitionEnd", a.proxy(h, this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])
}
}
}
}, d.prototype.hide = function () {
if (!this.transitioning && this.$element.hasClass("in")) {
var b = a.Event("hide.bs.collapse");
if (this.$element.trigger(b), !b.isDefaultPrevented()) {
var c = this.dimension();
this.$element[c](this.$element[c]())[0].offsetHeight, this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded", !1), this.$trigger.addClass("collapsed").attr("aria-expanded", !1), this.transitioning = 1;
var e = function () {
this.transitioning = 0, this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")
};
return a.support.transition ? void this.$element[c](0).one("bsTransitionEnd", a.proxy(e, this)).emulateTransitionEnd(d.TRANSITION_DURATION) : e.call(this)
}
}
}, d.prototype.toggle = function () {
this[this.$element.hasClass("in") ? "hide" : "show"]()
}, d.prototype.getParent = function () {
return a(this.options.parent).find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]').each(a.proxy(function (c, d) {
var e = a(d);
this.addAriaAndCollapsedClass(b(e), e)
}, this)).end()
}, d.prototype.addAriaAndCollapsedClass = function (a, b) {
var c = a.hasClass("in");
a.attr("aria-expanded", c), b.toggleClass("collapsed", !c).attr("aria-expanded", c)
};
var e = a.fn.collapse;
a.fn.collapse = c, a.fn.collapse.Constructor = d, a.fn.collapse.noConflict = function () {
return a.fn.collapse = e, this
}, a(document).on("click.bs.collapse.data-api", '[data-toggle="collapse"]', function (d) {
var e = a(this);
e.attr("data-target") || d.preventDefault();
var f = b(e), g = f.data("bs.collapse"), h = g ? "toggle" : e.data();
c.call(f, h)
})
}(jQuery), +function (a) {
"use strict";
function b(b) {
var c = b.attr("data-target");
c || (c = b.attr("href"), c = c && /#[A-Za-z]/.test(c) && c.replace(/.*(?=#[^\s]*$)/, ""));
var d = c && a(c);
return d && d.length ? d : b.parent()
}
function c(c) {
c && 3 === c.which || (a(e).remove(), a(f).each(function () {
var d = a(this), e = b(d), f = {relatedTarget: this};
e.hasClass("open") && (c && "click" == c.type && /input|textarea/i.test(c.target.tagName) && a.contains(e[0], c.target) || (e.trigger(c = a.Event("hide.bs.dropdown", f)), c.isDefaultPrevented() || (d.attr("aria-expanded", "false"), e.removeClass("open").trigger("hidden.bs.dropdown", f))))
}))
}
function d(b) {
return this.each(function () {
var c = a(this), d = c.data("bs.dropdown");
d || c.data("bs.dropdown", d = new g(this)), "string" == typeof b && d[b].call(c)
})
}
var e = ".dropdown-backdrop", f = '[data-toggle="dropdown"]', g = function (b) {
a(b).on("click.bs.dropdown", this.toggle)
};
g.VERSION = "3.3.5", g.prototype.toggle = function (d) {
var e = a(this);
if (!e.is(".disabled, :disabled")) {
var f = b(e), g = f.hasClass("open");
if (c(), !g) {
"ontouchstart" in document.documentElement && !f.closest(".navbar-nav").length && a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click", c);
var h = {relatedTarget: this};
if (f.trigger(d = a.Event("show.bs.dropdown", h)), d.isDefaultPrevented())return;
e.trigger("focus").attr("aria-expanded", "true"), f.toggleClass("open").trigger("shown.bs.dropdown", h)
}
return !1
}
}, g.prototype.keydown = function (c) {
if (/(38|40|27|32)/.test(c.which) && !/input|textarea/i.test(c.target.tagName)) {
var d = a(this);
if (c.preventDefault(), c.stopPropagation(), !d.is(".disabled, :disabled")) {
var e = b(d), g = e.hasClass("open");
if (!g && 27 != c.which || g && 27 == c.which)return 27 == c.which && e.find(f).trigger("focus"), d.trigger("click");
var h = " li:not(.disabled):visible a", i = e.find(".dropdown-menu" + h);
if (i.length) {
var j = i.index(c.target);
38 == c.which && j > 0 && j--, 40 == c.which && j < i.length - 1 && j++, ~j || (j = 0), i.eq(j).trigger("focus")
}
}
}
};
var h = a.fn.dropdown;
a.fn.dropdown = d, a.fn.dropdown.Constructor = g, a.fn.dropdown.noConflict = function () {
return a.fn.dropdown = h, this
}, a(document).on("click.bs.dropdown.data-api", c).on("click.bs.dropdown.data-api", ".dropdown form", function (a) {
a.stopPropagation()
}).on("click.bs.dropdown.data-api", f, g.prototype.toggle).on("keydown.bs.dropdown.data-api", f, g.prototype.keydown).on("keydown.bs.dropdown.data-api", ".dropdown-menu", g.prototype.keydown)
}(jQuery), +function (a) {
"use strict";
function b(b, d) {
return this.each(function () {
var e = a(this), f = e.data("bs.modal"), g = a.extend({}, c.DEFAULTS, e.data(), "object" == typeof b && b);
f || e.data("bs.modal", f = new c(this, g)), "string" == typeof b ? f[b](d) : g.show && f.show(d)
})
}
var c = function (b, c) {
this.options = c, this.$body = a(document.body), this.$element = a(b), this.$dialog = this.$element.find(".modal-dialog"), this.$backdrop = null, this.isShown = null, this.originalBodyPad = null, this.scrollbarWidth = 0, this.ignoreBackdropClick = !1, this.options.remote && this.$element.find(".modal-content").load(this.options.remote, a.proxy(function () {
this.$element.trigger("loaded.bs.modal")
}, this))
};
c.VERSION = "3.3.5", c.TRANSITION_DURATION = 300, c.BACKDROP_TRANSITION_DURATION = 150, c.DEFAULTS = {
backdrop: !0,
keyboard: !0,
show: !0
}, c.prototype.toggle = function (a) {
return this.isShown ? this.hide() : this.show(a)
}, c.prototype.show = function (b) {
var d = this, e = a.Event("show.bs.modal", {relatedTarget: b});
this.$element.trigger(e), this.isShown || e.isDefaultPrevented() || (this.isShown = !0, this.checkScrollbar(), this.setScrollbar(), this.$body.addClass("modal-open"), this.escape(), this.resize(), this.$element.on("click.dismiss.bs.modal", '[data-dismiss="modal"]', a.proxy(this.hide, this)), this.$dialog.on("mousedown.dismiss.bs.modal", function () {
d.$element.one("mouseup.dismiss.bs.modal", function (b) {
a(b.target).is(d.$element) && (d.ignoreBackdropClick = !0)
})
}), this.backdrop(function () {
var e = a.support.transition && d.$element.hasClass("fade");
d.$element.parent().length || d.$element.appendTo(d.$body), d.$element.show().scrollTop(0), d.adjustDialog(), e && d.$element[0].offsetWidth, d.$element.addClass("in"), d.enforceFocus();
var f = a.Event("shown.bs.modal", {relatedTarget: b});
e ? d.$dialog.one("bsTransitionEnd", function () {
d.$element.trigger("focus").trigger(f)
}).emulateTransitionEnd(c.TRANSITION_DURATION) : d.$element.trigger("focus").trigger(f)
}))
}, c.prototype.hide = function (b) {
b && b.preventDefault(), b = a.Event("hide.bs.modal"), this.$element.trigger(b), this.isShown && !b.isDefaultPrevented() && (this.isShown = !1, this.escape(), this.resize(), a(document).off("focusin.bs.modal"), this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"), this.$dialog.off("mousedown.dismiss.bs.modal"), a.support.transition && this.$element.hasClass("fade") ? this.$element.one("bsTransitionEnd", a.proxy(this.hideModal, this)).emulateTransitionEnd(c.TRANSITION_DURATION) : this.hideModal())
}, c.prototype.enforceFocus = function () {
a(document).off("focusin.bs.modal").on("focusin.bs.modal", a.proxy(function (a) {
this.$element[0] === a.target || this.$element.has(a.target).length || this.$element.trigger("focus")
}, this))
}, c.prototype.escape = function () {
this.isShown && this.options.keyboard ? this.$element.on("keydown.dismiss.bs.modal", a.proxy(function (a) {
27 == a.which && this.hide()
}, this)) : this.isShown || this.$element.off("keydown.dismiss.bs.modal")
}, c.prototype.resize = function () {
this.isShown ? a(window).on("resize.bs.modal", a.proxy(this.handleUpdate, this)) : a(window).off("resize.bs.modal")
}, c.prototype.hideModal = function () {
var a = this;
this.$element.hide(), this.backdrop(function () {
a.$body.removeClass("modal-open"), a.resetAdjustments(), a.resetScrollbar(), a.$element.trigger("hidden.bs.modal")
})
}, c.prototype.removeBackdrop = function () {
this.$backdrop && this.$backdrop.remove(), this.$backdrop = null
}, c.prototype.backdrop = function (b) {
var d = this, e = this.$element.hasClass("fade") ? "fade" : "";
if (this.isShown && this.options.backdrop) {
var f = a.support.transition && e;
if (this.$backdrop = a(document.createElement("div")).addClass("modal-backdrop " + e).appendTo(this.$body), this.$element.on("click.dismiss.bs.modal", a.proxy(function (a) {
return this.ignoreBackdropClick ? void(this.ignoreBackdropClick = !1) : void(a.target === a.currentTarget && ("static" == this.options.backdrop ? this.$element[0].focus() : this.hide()))
}, this)), f && this.$backdrop[0].offsetWidth, this.$backdrop.addClass("in"), !b)return;
f ? this.$backdrop.one("bsTransitionEnd", b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION) : b()
} else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass("in");
var g = function () {
d.removeBackdrop(), b && b()
};
a.support.transition && this.$element.hasClass("fade") ? this.$backdrop.one("bsTransitionEnd", g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION) : g()
} else b && b()
}, c.prototype.handleUpdate = function () {
this.adjustDialog()
}, c.prototype.adjustDialog = function () {
var a = this.$element[0].scrollHeight > document.documentElement.clientHeight;
this.$element.css({
paddingLeft: !this.bodyIsOverflowing && a ? this.scrollbarWidth : "",
paddingRight: this.bodyIsOverflowing && !a ? this.scrollbarWidth : ""
})
}, c.prototype.resetAdjustments = function () {
this.$element.css({paddingLeft: "", paddingRight: ""})
}, c.prototype.checkScrollbar = function () {
var a = window.innerWidth;
if (!a) {
var b = document.documentElement.getBoundingClientRect();
a = b.right - Math.abs(b.left)
}
this.bodyIsOverflowing = document.body.clientWidth < a, this.scrollbarWidth = this.measureScrollbar()
}, c.prototype.setScrollbar = function () {
var a = parseInt(this.$body.css("padding-right") || 0, 10);
this.originalBodyPad = document.body.style.paddingRight || "", this.bodyIsOverflowing && this.$body.css("padding-right", a + this.scrollbarWidth)
}, c.prototype.resetScrollbar = function () {
this.$body.css("padding-right", this.originalBodyPad)
}, c.prototype.measureScrollbar = function () {
var a = document.createElement("div");
a.className = "modal-scrollbar-measure", this.$body.append(a);
var b = a.offsetWidth - a.clientWidth;
return this.$body[0].removeChild(a), b
};
var d = a.fn.modal;
a.fn.modal = b, a.fn.modal.Constructor = c, a.fn.modal.noConflict = function () {
return a.fn.modal = d, this
}, a(document).on("click.bs.modal.data-api", '[data-toggle="modal"]', function (c) {
var d = a(this), e = d.attr("href"), f = a(d.attr("data-target") || e && e.replace(/.*(?=#[^\s]+$)/, "")), g = f.data("bs.modal") ? "toggle" : a.extend({remote: !/#/.test(e) && e}, f.data(), d.data());
d.is("a") && c.preventDefault(), f.one("show.bs.modal", function (a) {
a.isDefaultPrevented() || f.one("hidden.bs.modal", function () {
d.is(":visible") && d.trigger("focus")
})
}), b.call(f, g, this)
})
}(jQuery), +function (a) {
"use strict";
function b(b) {
return this.each(function () {
var d = a(this), e = d.data("bs.tooltip"), f = "object" == typeof b && b;
(e || !/destroy|hide/.test(b)) && (e || d.data("bs.tooltip", e = new c(this, f)), "string" == typeof b && e[b]())
})
}
var c = function (a, b) {
this.type = null, this.options = null, this.enabled = null, this.timeout = null, this.hoverState = null, this.$element = null, this.inState = null, this.init("tooltip", a, b)
};
c.VERSION = "3.3.5", c.TRANSITION_DURATION = 150, c.DEFAULTS = {
animation: !0,
placement: "top",
selector: !1,
template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
trigger: "hover focus",
title: "",
delay: 0,
html: !1,
container: !1,
viewport: {selector: "body", padding: 0}
}, c.prototype.init = function (b, c, d) {
if (this.enabled = !0, this.type = b, this.$element = a(c), this.options = this.getOptions(d), this.$viewport = this.options.viewport && a(a.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : this.options.viewport.selector || this.options.viewport), this.inState = {
click: !1,
hover: !1,
focus: !1
}, this.$element[0] instanceof document.constructor && !this.options.selector)throw new Error("`selector` option must be specified when initializing " + this.type + " on the window.document object!");
for (var e = this.options.trigger.split(" "), f = e.length; f--;) {
var g = e[f];
if ("click" == g)this.$element.on("click." + this.type, this.options.selector, a.proxy(this.toggle, this)); else if ("manual" != g) {
var h = "hover" == g ? "mouseenter" : "focusin", i = "hover" == g ? "mouseleave" : "focusout";
this.$element.on(h + "." + this.type, this.options.selector, a.proxy(this.enter, this)), this.$element.on(i + "." + this.type, this.options.selector, a.proxy(this.leave, this))
}
}
this.options.selector ? this._options = a.extend({}, this.options, {
trigger: "manual",
selector: ""
}) : this.fixTitle()
}, c.prototype.getDefaults = function () {
return c.DEFAULTS
}, c.prototype.getOptions = function (b) {
return b = a.extend({}, this.getDefaults(), this.$element.data(), b), b.delay && "number" == typeof b.delay && (b.delay = {
show: b.delay,
hide: b.delay
}), b
}, c.prototype.getDelegateOptions = function () {
var b = {}, c = this.getDefaults();
return this._options && a.each(this._options, function (a, d) {
c[a] != d && (b[a] = d)
}), b
}, c.prototype.enter = function (b) {
var c = b instanceof this.constructor ? b : a(b.currentTarget).data("bs." + this.type);
return c || (c = new this.constructor(b.currentTarget, this.getDelegateOptions()), a(b.currentTarget).data("bs." + this.type, c)), b instanceof a.Event && (c.inState["focusin" == b.type ? "focus" : "hover"] = !0), c.tip().hasClass("in") || "in" == c.hoverState ? void(c.hoverState = "in") : (clearTimeout(c.timeout), c.hoverState = "in", c.options.delay && c.options.delay.show ? void(c.timeout = setTimeout(function () {
"in" == c.hoverState && c.show()
}, c.options.delay.show)) : c.show())
}, c.prototype.isInStateTrue = function () {
for (var a in this.inState)if (this.inState[a])return !0;
return !1
}, c.prototype.leave = function (b) {
var c = b instanceof this.constructor ? b : a(b.currentTarget).data("bs." + this.type);
return c || (c = new this.constructor(b.currentTarget, this.getDelegateOptions()), a(b.currentTarget).data("bs." + this.type, c)), b instanceof a.Event && (c.inState["focusout" == b.type ? "focus" : "hover"] = !1), c.isInStateTrue() ? void 0 : (clearTimeout(c.timeout), c.hoverState = "out", c.options.delay && c.options.delay.hide ? void(c.timeout = setTimeout(function () {
"out" == c.hoverState && c.hide()
}, c.options.delay.hide)) : c.hide())
}, c.prototype.show = function () {
var b = a.Event("show.bs." + this.type);
if (this.hasContent() && this.enabled) {
this.$element.trigger(b);
var d = a.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]);
if (b.isDefaultPrevented() || !d)return;
var e = this, f = this.tip(), g = this.getUID(this.type);
this.setContent(), f.attr("id", g), this.$element.attr("aria-describedby", g), this.options.animation && f.addClass("fade");
var h = "function" == typeof this.options.placement ? this.options.placement.call(this, f[0], this.$element[0]) : this.options.placement, i = /\s?auto?\s?/i, j = i.test(h);
j && (h = h.replace(i, "") || "top"), f.detach().css({
top: 0,
left: 0,
display: "block"
}).addClass(h).data("bs." + this.type, this), this.options.container ? f.appendTo(this.options.container) : f.insertAfter(this.$element), this.$element.trigger("inserted.bs." + this.type);
var k = this.getPosition(), l = f[0].offsetWidth, m = f[0].offsetHeight;
if (j) {
var n = h, o = this.getPosition(this.$viewport);
h = "bottom" == h && k.bottom + m > o.bottom ? "top" : "top" == h && k.top - m < o.top ? "bottom" : "right" == h && k.right + l > o.width ? "left" : "left" == h && k.left - l < o.left ? "right" : h, f.removeClass(n).addClass(h)
}
var p = this.getCalculatedOffset(h, k, l, m);
this.applyPlacement(p, h);
var q = function () {
var a = e.hoverState;
e.$element.trigger("shown.bs." + e.type), e.hoverState = null, "out" == a && e.leave(e)
};
a.support.transition && this.$tip.hasClass("fade") ? f.one("bsTransitionEnd", q).emulateTransitionEnd(c.TRANSITION_DURATION) : q()
}
}, c.prototype.applyPlacement = function (b, c) {
var d = this.tip(), e = d[0].offsetWidth, f = d[0].offsetHeight, g = parseInt(d.css("margin-top"), 10), h = parseInt(d.css("margin-left"), 10);
isNaN(g) && (g = 0), isNaN(h) && (h = 0), b.top += g, b.left += h, a.offset.setOffset(d[0], a.extend({
using: function (a) {
d.css({top: Math.round(a.top), left: Math.round(a.left)})
}
}, b), 0), d.addClass("in");
var i = d[0].offsetWidth, j = d[0].offsetHeight;
"top" == c && j != f && (b.top = b.top + f - j);
var k = this.getViewportAdjustedDelta(c, b, i, j);
k.left ? b.left += k.left : b.top += k.top;
var l = /top|bottom/.test(c), m = l ? 2 * k.left - e + i : 2 * k.top - f + j, n = l ? "offsetWidth" : "offsetHeight";
d.offset(b), this.replaceArrow(m, d[0][n], l)
}, c.prototype.replaceArrow = function (a, b, c) {
this.arrow().css(c ? "left" : "top", 50 * (1 - a / b) + "%").css(c ? "top" : "left", "")
}, c.prototype.setContent = function () {
var a = this.tip(), b = this.getTitle();
a.find(".tooltip-inner")[this.options.html ? "html" : "text"](b), a.removeClass("fade in top bottom left right")
}, c.prototype.hide = function (b) {
function d() {
"in" != e.hoverState && f.detach(), e.$element.removeAttr("aria-describedby").trigger("hidden.bs." + e.type), b && b()
}
var e = this, f = a(this.$tip), g = a.Event("hide.bs." + this.type);
return this.$element.trigger(g), g.isDefaultPrevented() ? void 0 : (f.removeClass("in"), a.support.transition && f.hasClass("fade") ? f.one("bsTransitionEnd", d).emulateTransitionEnd(c.TRANSITION_DURATION) : d(), this.hoverState = null, this)
}, c.prototype.fixTitle = function () {
var a = this.$element;
(a.attr("title") || "string" != typeof a.attr("data-original-title")) && a.attr("data-original-title", a.attr("title") || "").attr("title", "")
}, c.prototype.hasContent = function () {
return this.getTitle()
}, c.prototype.getPosition = function (b) {
b = b || this.$element;
var c = b[0], d = "BODY" == c.tagName, e = c.getBoundingClientRect();
null == e.width && (e = a.extend({}, e, {width: e.right - e.left, height: e.bottom - e.top}));
var f = d ? {
top: 0,
left: 0
} : b.offset(), g = {scroll: d ? document.documentElement.scrollTop || document.body.scrollTop : b.scrollTop()}, h = d ? {
width: a(window).width(),
height: a(window).height()
} : null;
return a.extend({}, e, g, h, f)
}, c.prototype.getCalculatedOffset = function (a, b, c, d) {
return "bottom" == a ? {
top: b.top + b.height,
left: b.left + b.width / 2 - c / 2
} : "top" == a ? {
top: b.top - d,
left: b.left + b.width / 2 - c / 2
} : "left" == a ? {top: b.top + b.height / 2 - d / 2, left: b.left - c} : {
top: b.top + b.height / 2 - d / 2,
left: b.left + b.width
}
}, c.prototype.getViewportAdjustedDelta = function (a, b, c, d) {
var e = {top: 0, left: 0};
if (!this.$viewport)return e;
var f = this.options.viewport && this.options.viewport.padding || 0, g = this.getPosition(this.$viewport);
if (/right|left/.test(a)) {
var h = b.top - f - g.scroll, i = b.top + f - g.scroll + d;
h < g.top ? e.top = g.top - h : i > g.top + g.height && (e.top = g.top + g.height - i)
} else {
var j = b.left - f, k = b.left + f + c;
j < g.left ? e.left = g.left - j : k > g.right && (e.left = g.left + g.width - k)
}
return e
}, c.prototype.getTitle = function () {
var a, b = this.$element, c = this.options;
return a = b.attr("data-original-title") || ("function" == typeof c.title ? c.title.call(b[0]) : c.title)
}, c.prototype.getUID = function (a) {
do a += ~~(1e6 * Math.random()); while (document.getElementById(a));
return a
}, c.prototype.tip = function () {
if (!this.$tip && (this.$tip = a(this.options.template), 1 != this.$tip.length))throw new Error(this.type + " `template` option must consist of exactly 1 top-level element!");
return this.$tip
}, c.prototype.arrow = function () {
return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
}, c.prototype.enable = function () {
this.enabled = !0
}, c.prototype.disable = function () {
this.enabled = !1
}, c.prototype.toggleEnabled = function () {
this.enabled = !this.enabled
}, c.prototype.toggle = function (b) {
var c = this;
b && (c = a(b.currentTarget).data("bs." + this.type), c || (c = new this.constructor(b.currentTarget, this.getDelegateOptions()), a(b.currentTarget).data("bs." + this.type, c))), b ? (c.inState.click = !c.inState.click, c.isInStateTrue() ? c.enter(c) : c.leave(c)) : c.tip().hasClass("in") ? c.leave(c) : c.enter(c)
}, c.prototype.destroy = function () {
var a = this;
clearTimeout(this.timeout), this.hide(function () {
a.$element.off("." + a.type).removeData("bs." + a.type), a.$tip && a.$tip.detach(), a.$tip = null, a.$arrow = null, a.$viewport = null
})
};
var d = a.fn.tooltip;
a.fn.tooltip = b, a.fn.tooltip.Constructor = c, a.fn.tooltip.noConflict = function () {
return a.fn.tooltip = d, this
}
}(jQuery), +function (a) {
"use strict";
function b(b) {
return this.each(function () {
var d = a(this), e = d.data("bs.popover"), f = "object" == typeof b && b;
(e || !/destroy|hide/.test(b)) && (e || d.data("bs.popover", e = new c(this, f)), "string" == typeof b && e[b]())
})
}
var c = function (a, b) {
this.init("popover", a, b)
};
if (!a.fn.tooltip)throw new Error("Popover requires tooltip.js");
c.VERSION = "3.3.5", c.DEFAULTS = a.extend({}, a.fn.tooltip.Constructor.DEFAULTS, {
placement: "right",
trigger: "click",
content: "",
template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
}), c.prototype = a.extend({}, a.fn.tooltip.Constructor.prototype), c.prototype.constructor = c, c.prototype.getDefaults = function () {
return c.DEFAULTS
}, c.prototype.setContent = function () {
var a = this.tip(), b = this.getTitle(), c = this.getContent();
a.find(".popover-title")[this.options.html ? "html" : "text"](b), a.find(".popover-content").children().detach().end()[this.options.html ? "string" == typeof c ? "html" : "append" : "text"](c), a.removeClass("fade top bottom left right in"), a.find(".popover-title").html() || a.find(".popover-title").hide()
}, c.prototype.hasContent = function () {
return this.getTitle() || this.getContent()
}, c.prototype.getContent = function () {
var a = this.$element, b = this.options;
return a.attr("data-content") || ("function" == typeof b.content ? b.content.call(a[0]) : b.content)
}, c.prototype.arrow = function () {
return this.$arrow = this.$arrow || this.tip().find(".arrow")
};
var d = a.fn.popover;
a.fn.popover = b, a.fn.popover.Constructor = c, a.fn.popover.noConflict = function () {
return a.fn.popover = d, this
}
}(jQuery), +function (a) {
"use strict";
function b(c, d) {
this.$body = a(document.body), this.$scrollElement = a(a(c).is(document.body) ? window : c), this.options = a.extend({}, b.DEFAULTS, d), this.selector = (this.options.target || "") + " .nav li > a", this.offsets = [], this.targets = [], this.activeTarget = null, this.scrollHeight = 0, this.$scrollElement.on("scroll.bs.scrollspy", a.proxy(this.process, this)), this.refresh(), this.process()
}
function c(c) {
return this.each(function () {
var d = a(this), e = d.data("bs.scrollspy"), f = "object" == typeof c && c;
e || d.data("bs.scrollspy", e = new b(this, f)), "string" == typeof c && e[c]()
})
}
b.VERSION = "3.3.5", b.DEFAULTS = {offset: 10}, b.prototype.getScrollHeight = function () {
return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
}, b.prototype.refresh = function () {
var b = this, c = "offset", d = 0;
this.offsets = [], this.targets = [], this.scrollHeight = this.getScrollHeight(), a.isWindow(this.$scrollElement[0]) || (c = "position", d = this.$scrollElement.scrollTop()), this.$body.find(this.selector).map(function () {
var b = a(this), e = b.data("target") || b.attr("href"), f = /^#./.test(e) && a(e);
return f && f.length && f.is(":visible") && [[f[c]().top + d, e]] || null
}).sort(function (a, b) {
return a[0] - b[0]
}).each(function () {
b.offsets.push(this[0]), b.targets.push(this[1])
})
}, b.prototype.process = function () {
var a, b = this.$scrollElement.scrollTop() + this.options.offset, c = this.getScrollHeight(), d = this.options.offset + c - this.$scrollElement.height(), e = this.offsets, f = this.targets, g = this.activeTarget;
if (this.scrollHeight != c && this.refresh(), b >= d)return g != (a = f[f.length - 1]) && this.activate(a);
if (g && b < e[0])return this.activeTarget = null, this.clear();
for (a = e.length; a--;)g != f[a] && b >= e[a] && (void 0 === e[a + 1] || b < e[a + 1]) && this.activate(f[a])
}, b.prototype.activate = function (b) {
this.activeTarget = b, this.clear();
var c = this.selector + '[data-target="' + b + '"],' + this.selector + '[href="' + b + '"]', d = a(c).parents("li").addClass("active");
d.parent(".dropdown-menu").length && (d = d.closest("li.dropdown").addClass("active")),
d.trigger("activate.bs.scrollspy")
}, b.prototype.clear = function () {
a(this.selector).parentsUntil(this.options.target, ".active").removeClass("active")
};
var d = a.fn.scrollspy;
a.fn.scrollspy = c, a.fn.scrollspy.Constructor = b, a.fn.scrollspy.noConflict = function () {
return a.fn.scrollspy = d, this
}, a(window).on("load.bs.scrollspy.data-api", function () {
a('[data-spy="scroll"]').each(function () {
var b = a(this);
c.call(b, b.data())
})
})
}(jQuery), +function (a) {
"use strict";
function b(b) {
return this.each(function () {
var d = a(this), e = d.data("bs.tab");
e || d.data("bs.tab", e = new c(this)), "string" == typeof b && e[b]()
})
}
var c = function (b) {
this.element = a(b)
};
c.VERSION = "3.3.5", c.TRANSITION_DURATION = 150, c.prototype.show = function () {
var b = this.element, c = b.closest("ul:not(.dropdown-menu)"), d = b.data("target");
if (d || (d = b.attr("href"), d = d && d.replace(/.*(?=#[^\s]*$)/, "")), !b.parent("li").hasClass("active")) {
var e = c.find(".active:last a"), f = a.Event("hide.bs.tab", {relatedTarget: b[0]}), g = a.Event("show.bs.tab", {relatedTarget: e[0]});
if (e.trigger(f), b.trigger(g), !g.isDefaultPrevented() && !f.isDefaultPrevented()) {
var h = a(d);
this.activate(b.closest("li"), c), this.activate(h, h.parent(), function () {
e.trigger({type: "hidden.bs.tab", relatedTarget: b[0]}), b.trigger({
type: "shown.bs.tab",
relatedTarget: e[0]
})
})
}
}
}, c.prototype.activate = function (b, d, e) {
function f() {
g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded", !1), b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded", !0), h ? (b[0].offsetWidth, b.addClass("in")) : b.removeClass("fade"), b.parent(".dropdown-menu").length && b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded", !0), e && e()
}
var g = d.find("> .active"), h = e && a.support.transition && (g.length && g.hasClass("fade") || !!d.find("> .fade").length);
g.length && h ? g.one("bsTransitionEnd", f).emulateTransitionEnd(c.TRANSITION_DURATION) : f(), g.removeClass("in")
};
var d = a.fn.tab;
a.fn.tab = b, a.fn.tab.Constructor = c, a.fn.tab.noConflict = function () {
return a.fn.tab = d, this
};
var e = function (c) {
c.preventDefault(), b.call(a(this), "show")
};
a(document).on("click.bs.tab.data-api", '[data-toggle="tab"]', e).on("click.bs.tab.data-api", '[data-toggle="pill"]', e)
}(jQuery), +function (a) {
"use strict";
function b(b) {
return this.each(function () {
var d = a(this), e = d.data("bs.affix"), f = "object" == typeof b && b;
e || d.data("bs.affix", e = new c(this, f)), "string" == typeof b && e[b]()
})
}
var c = function (b, d) {
this.options = a.extend({}, c.DEFAULTS, d), this.$target = a(this.options.target).on("scroll.bs.affix.data-api", a.proxy(this.checkPosition, this)).on("click.bs.affix.data-api", a.proxy(this.checkPositionWithEventLoop, this)), this.$element = a(b), this.affixed = null, this.unpin = null, this.pinnedOffset = null, this.checkPosition()
};
c.VERSION = "3.3.5", c.RESET = "affix affix-top affix-bottom", c.DEFAULTS = {
offset: 0,
target: window
}, c.prototype.getState = function (a, b, c, d) {
var e = this.$target.scrollTop(), f = this.$element.offset(), g = this.$target.height();
if (null != c && "top" == this.affixed)return c > e ? "top" : !1;
if ("bottom" == this.affixed)return null != c ? e + this.unpin <= f.top ? !1 : "bottom" : a - d >= e + g ? !1 : "bottom";
var h = null == this.affixed, i = h ? e : f.top, j = h ? g : b;
return null != c && c >= e ? "top" : null != d && i + j >= a - d ? "bottom" : !1
}, c.prototype.getPinnedOffset = function () {
if (this.pinnedOffset)return this.pinnedOffset;
this.$element.removeClass(c.RESET).addClass("affix");
var a = this.$target.scrollTop(), b = this.$element.offset();
return this.pinnedOffset = b.top - a
}, c.prototype.checkPositionWithEventLoop = function () {
setTimeout(a.proxy(this.checkPosition, this), 1)
}, c.prototype.checkPosition = function () {
if (this.$element.is(":visible")) {
var b = this.$element.height(), d = this.options.offset, e = d.top, f = d.bottom, g = Math.max(a(document).height(), a(document.body).height());
"object" != typeof d && (f = e = d), "function" == typeof e && (e = d.top(this.$element)), "function" == typeof f && (f = d.bottom(this.$element));
var h = this.getState(g, b, e, f);
if (this.affixed != h) {
null != this.unpin && this.$element.css("top", "");
var i = "affix" + (h ? "-" + h : ""), j = a.Event(i + ".bs.affix");
if (this.$element.trigger(j), j.isDefaultPrevented())return;
this.affixed = h, this.unpin = "bottom" == h ? this.getPinnedOffset() : null, this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix", "affixed") + ".bs.affix")
}
"bottom" == h && this.$element.offset({top: g - b - f})
}
};
var d = a.fn.affix;
a.fn.affix = b, a.fn.affix.Constructor = c, a.fn.affix.noConflict = function () {
return a.fn.affix = d, this
}, a(window).on("load", function () {
a('[data-spy="affix"]').each(function () {
var c = a(this), d = c.data();
d.offset = d.offset || {}, null != d.offsetBottom && (d.offset.bottom = d.offsetBottom), null != d.offsetTop && (d.offset.top = d.offsetTop), b.call(c, d)
})
})
}(jQuery);

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,858 @@
;(function ($) {
// 初始化函数
var init = function () {
// 通过域名判断环境
$.API_URL = 'https://dlapi.daoqijuyou77.cn/Index.php';
$.RETURN_URL = 'https://dlweb.daoqijuyou77.cn/web2/notify.html';
};
$.extend(
{
API_URL: '',
RETURN_URL: '', // 微信支付成功后的跳转地址
AVATAR_URL: 'https://dlwebv3.tscce.cn/images/noavatar.png', // 没有头像的默认地址
// ts已修改2021
// SID_SCODE_URL: 'https://api.tscce.cn/source/login/login.php', // 获取sid和scode的地址
// WX_INFO_URL: 'https://api.tscce.cn/api/user', // 获取微信用户信息地址
// PAY_URL: 'https://api.tscce.cn/source/pay/pay_1.php', // 微信支付地址
// NOTICE_URL: 'https://api.tscce.cn/source/pay/notify.php?v=', // 支付成功后的异步通知地址
// SHARE_LINK: 'https://api.tscce.cn/api/weixin/wx_share_info',
SID_SCODE_URL: 'https://api2.tscce.cn/source/login/login.php', // 获取sid和scode的地址
WX_INFO_URL: 'https://api2.tscce.cn/api/user', // 获取微信用户信息地址
PAY_URL: 'https://api2.tscce.cn/source/pay/pay_1.php', // 微信支付地址
NOTICE_URL: 'https://api2.tscce.cn/source/pay/notify.php?v=', // 支付成功后的异步通知地址
SHARE_LINK: 'https://api2.tscce.cn/api/weixin/wx_share_info',
wxInfo: {}, // 微信信息
userInfo: {}, // 用户信息
cache: {}, // 缓存
loadingLayerIndex: null,
whichSystem: function () {
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
return true;
} else if (/(Android)/i.test(navigator.userAgent)) {
return false;
}
return false;
},
isWeiXin: function () {
if(typeof this.cache.isWeiXin !== 'undefined') return this.cache.isWeiXin;
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
this.cache.isWeiXin = true;
return true;
}
this.cache.isWeiXin = false;
return false;
},
isRightId: function (playerId) {
return /^\d{6,11}$/.test(playerId);
},
isMobile: function (tel) {
return /^1[0-9]{10}$/.test(tel);
},
getQueryString: function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r !== null)
return r[2];
return null;
},
getQueryObj: function () {
if(this.cache.querys) return this.cache.querys;
var tmp = window.location.search.substr(1).split('&');
var res = {};
for (var i = 0; i < tmp.length; i++) {
var arr = tmp[i].split('=');
res[arr[0]] = arr[1];
}
this.cache.querys = res;
return res;
},
getPageName: function () {
var name = window.location.pathname.split('/').pop();
return name;
},
storage: function (name, obj) {
try {
if (typeof obj !== 'undefined') {
var tmp = (typeof obj === 'object') ? JSON.stringify(obj) : obj;
sessionStorage.setItem(name, tmp);
}
else {
var res = sessionStorage.getItem(name);
res = JSON.parse(res);
return res;
}
} catch (e) {
alert("如果此页面无法正常显示,请关闭浏览器的隐身模式,再打开此页面。");
console.log("如果此页面无法正常显示,请关闭浏览器的隐身模式,再打开此页面。", e);
}
},
convertCanvasToImage: function (canvas) {
var image = new Image();
image.src = canvas.toDataURL("image/png");
return image;
},
invite: function (name, url) {
$("#" + name).qrcode({width: 200, height: 200, text: url});
var canvas = document.getElementById(name).getElementsByTagName('canvas')[0];
canvas = this.convertCanvasToImage(canvas);
$("#" + name).html(canvas);
},
api: function (methods, params, func, isAsync) {
//console.log('params', params)
var token = sessionStorage.getItem("token");
var apiDate = {
method: methods,
format: "json",
charset: "utf-8",
version: "1.0",
user_auth_token: token,
biz_content: params
};
isAsync = isAsync || false;
if (isAsync === 1) $.loading();
var that = this;
$.ajax(
{
url: this.API_URL,
type: 'POST',
//dataType: 'json',
async: !!isAsync,
data: apiDate,
timeout: 20000,
success: function (r) {
r = ('string' == typeof r) ? eval("(" + decodeURIComponent(r) + ")") : r;
if (!r) throw "服务器端有错误发生,请联系管理员!";
console.log(methods, r);
if (r.user_auth_token ) {
try {
sessionStorage.setItem('token', r.user_auth_token);
} catch (e) {
alert("如果此页面无法正常显示,请关闭浏览器的隐身模式,再打开此页面。");
}
}
try {
if (r.retcode !== 0) throw {'code': r.retcode, 'info': r.retinfo};
if (r.biz_content.state && parseInt(r.biz_content.state) !== 0) throw {'code': r.biz_content.state, 'info': r.biz_content.error};
func && func(r.biz_content);
} catch (e) {
if(e.code === 266 || e.code === 267) {
layer.open({
content: '你的登入状态已过期,请重新登入',
btn: '重新登入',
shadeClose: false,
yes: function (i) {
sessionStorage.setItem('fromUrl', window.location.href);
var querys = $.getQueryObj();
window.location.href='manage.html?agentid='+querys.agentid+'&channelid='+querys.channelid;
}
});
} else {
$.alert(e.info);
}
}
},
complete: function (r) {
if ((typeof isAsync === 'boolean' && typeof that.loadingLayerIndex === 'number') || isAsync === 1) layer.close(that.loadingLayerIndex);
},
error: function (xhr, textStatus) {
$.alert('网络异常');
}
}
);
},
apiv2: function (methods, params, func, errFunc, isAsync) {
//console.log('params', params)
var token = sessionStorage.getItem("token");
var apiDate = {
method: methods,
format: "json",
charset: "utf-8",
version: "1.0",
user_auth_token: token,
biz_content: params
};
isAsync = isAsync || false;
if (isAsync === 1) $.loading();
var that = this;
$.ajax(
{
url: this.API_URL,
type: 'POST',
//dataType: 'json',
async: !!isAsync,
data: apiDate,
timeout: 10000,
success: function (r) {
r = ('string' == typeof r) ? eval("(" + decodeURIComponent(r) + ")") : r;
if (!r) throw "服务器端有错误发生,请联系管理员!";
console.log(methods, r);
if (r.user_auth_token)
sessionStorage.setItem('token', r.user_auth_token);
try {
if (r.retcode !== 0) {
if(r.retcode === 266) throw {code: 266, info: ''};
errFunc && errFunc(r.retcode, r.retinfo);
return;
}
if (r.biz_content.state && parseInt(r.biz_content.state) !== 0) {
errFunc && errFunc(r.biz_content.state, r.biz_content.error);
return;
}
func && func(r.biz_content);
} catch (e) {
if(e.code === 266 || e.code === 267) {
layer.open({
content: '你的登入状态已过期,请重新登入',
btn: '重新登入',
shadeClose: false,
yes: function (i) {
sessionStorage.setItem('fromUrl', window.location.href);
var querys = $.getQueryObj();
window.location.href='manage.html?agentid='+querys.agentid+'&channelid='+querys.channelid;
}
});
} else {
$.alert(e.info);
}
}
},
complete: function (r) {
if ((typeof isAsync === 'boolean' && typeof that.loadingLayerIndex === 'number') || isAsync === 1) layer.close(that.loadingLayerIndex);
},
error: function (xhr, textStatus) {
$.alert('网络较慢!')
}
}
);
},
getAgentInfo: function (func) {
var p = this.getQueryObj();
if (!p.agentid || !p.channelid) {
alert('没有agentid和channelid请重新进入页面');
return;
}
var agentInfo = sessionStorage.getItem('agentInfo');
if (agentInfo) {
agentInfo = JSON.parse(agentInfo);
//console.log('agentinfo from session', agentInfo);
func && func(agentInfo);
} else {
var that = this;
this.api(
"Youle.Youle.channelConfig",
{agentid: p.agentid, channelid: p.channelid},
function (res) {
try {
sessionStorage.setItem('agentInfo', JSON.stringify(res));
} catch (e) {
alert("如果此页面无法正常显示,请关闭浏览器的隐身模式,再打开此页面。");
}
func && func(res);
}, true
);
}
},
getSidScode: function (func) {
var that = this;
this.getAgentInfo(function (agentInfo) {
var p = that.getQueryObj();
var sid = p.sid;
var scode = sessionStorage.getItem('scode');
var result;
if (!sid || !scode) {
sid = sessionStorage.getItem('sid');
//scode = sessionStorage.getItem('scode');
if (!sid || !scode) {
var currentUrl = window.location.href.replace(/sid=\w+&/, "").replace(/scode=\w+&/, "");
var appid = agentInfo.youle_appid;
var devkey = agentInfo.youle_devkey;
var busiid = agentInfo.youle_busiid;
var randomStr = $.randomString(32);
sessionStorage.setItem('scode', randomStr);
var urlSidScode = that.SID_SCODE_URL + "?scode="+randomStr+"&appid="+appid+"&dev_key=" + devkey + "&market_key=" + busiid + "&redirect_uri=" + currentUrl;
window.location.href = urlSidScode;
return;
} else {
result = $.extend({}, {sid: sid, scode: scode}, agentInfo)
func && func(result);
}
} else {
sessionStorage.setItem('sid', sid);
//sessionStorage.setItem('scode', scode);
result = $.extend({}, {sid: sid, scode: scode}, agentInfo)
func && func(result);
}
})
},
getWxInfo: function (func) {
// 如果缓存中有微信信息,直接返回
if(this.wxInfo.openid) {
console.log('getWxInfo from cache(wxInfo)', this.wxInfo);
func && func(this.wxInfo);
return;
}
var wxInfo = sessionStorage.getItem('wxInfo');
// 如果不在微信环境
if(!$.isWeiXin()/* && (pageName === 'player_buy.html' || pageName === 'become_sales_free.html' || pageName === 'become_sales.html' || pageName === 'notify.html')*/) {
if(wxInfo) {
wxInfo = JSON.parse(wxInfo);
//console.log('getWxInfo from session(phone)', wxInfo);
func && func(wxInfo);
} else {
func && func({
"id": "",
"uid": "",
"nickname": "",
"sex": "0",
"province": "",
"city": "",
"country": "",
"headimgurl": "",
"privilege": "[]",
"subscribe": "1",
"subscribe_time": "",
"unionid": "",
"openid": ""
});
}
return;
}
if (wxInfo) {
wxInfo = JSON.parse(wxInfo);
// 将信息存到缓存中
this.wxInfo = wxInfo;
console.log('getWxInfo from session', wxInfo);
func && func(wxInfo);
} else {
var that = this;
this.getSidScode(function (r) {
var data = {sid: r.sid, scode: r.scode, appid: r.youle_appid, market_key: r.youle_busiid, devkey: r.youle_devkey};
$.ajax(
{
url: that.WX_INFO_URL,
type: 'POST',
dataType: 'json',
async: false,
data: data,
success: function (res) {
try {
if (res.error && parseInt(res.error) !== 0) throw {code: res.error, msg: res.msg};
console.log('getWxInfo', res);
if (res.dataContent.headimgurl.length < 20 || !res.dataContent.headimgurl)
res.dataContent.headimgurl = that.AVATAR_URL;
res.dataContent.headimgurl = res.dataContent.headimgurl.replace(/132132/, "132");
sessionStorage.setItem('wxInfo', JSON.stringify(res.dataContent));
that.wxInfo = res.dataContent;
func && func(res.dataContent);
} catch (e) {
$.alert(e.msg);
if(e.code && parseInt(e.code) === 1) {
sessionStorage.removeItem('sid');
sessionStorage.removeItem('scode');
}
var tmp = $.extend({}, data, e);
$.log(tmp);
}
},
error: function (xhr, textStatus) {
console.log('error', xhr, textStatus)
$.alert('网络异常!')
}
}
)
});
}
},
getUserInfo: function (func) {
var that = this;
if(!$.isWeiXin() && $.getPageName() === 'player_buy.html') {
func && func({});
return;
}
this.getWxInfo(function (r) {
var userInfo = sessionStorage.getItem('userInfo');
// 如果sessionStorage中有用户信息直接返回否则返回登录页面
if (userInfo) {
userInfo = JSON.parse(userInfo);
//console.log('getUserInfo from sessionStorage', userInfo);
func && func(userInfo);
} else {
layer.open({
content: '你的登入状态已过期,请重新登入',
btn: '重新登入',
shadeClose: false,
yes: function (i) {
sessionStorage.setItem('fromUrl', window.location.href);
var querys = $.getQueryObj();
window.location.href='manage.html?agentid='+querys.agentid+'&channelid='+querys.channelid;
}
});
}
})
},
getUserInfoNoCache: function (func) {
var that = this;
this.getWxInfo(function (r) {
var p = that.getQueryObj();
var salesid = sessionStorage.getItem('salesid');
if (salesid)
{
var password = sessionStorage.getItem('password');
if (!password) throw 'no password';
that.api(
'agent.user.login',
{
agentid: p.agentid,
channelid: p.channelid,
salesid: salesid,
password: password,
type: 1
},
function (userInfo) {
try {
if (userInfo.sausstatus && parseInt(userInfo.sausstatus) !== 0) throw '对不起,你的账号已被冻结';
if (userInfo.salesman && parseInt(userInfo.salesman) !== 1) {
window.location.href = './manage.html?agentid=' + p.agentid + '&channelid=' + p.channelid;
return;
}
if (userInfo.salesman && parseInt(userInfo.salesman) === 1) {
that.userInfo = userInfo;
func && func(userInfo);
} else {
throw '获取用户信息错误';
}
} catch (e) {
$.alert(e)
}
}
)
}
else
{
that.api
(
'agent.user.login',
{
agentid: p.agentid,
channelid: p.channelid,
openid: r.openid,
unionid: r.unionid,
nickname: r.nickname,
avatar: r.headimgurl,
sex: r.sex,
province: r.province,
type: 0
},
function (res) {
try {
if (res.sausstatus && parseInt(res.sausstatus) !== 0) throw '对不起,你的账号已被冻结';
var salesman = parseInt(res.salesman);
if (res.salesman && salesman !== 1) {
window.location.href = './manage.html?agentid=' + p.agentid + '&channelid=' + p.channelid;
return;
}
if (res.salesman && salesman === 1) {
that.userInfo = res;
func && func(res);
} else {
throw '获取用户信息错误';
}
} catch (e) {
$.alert(e)
}
}
);
}
});
},
// 给新用户第一次登录用
getUserInfoFirst: function (func, isAsync) {
var that = this;
if(!$.isWeiXin()) {
func && func({"agentid":"","channelid":"","openid":"","unionid":"","nickname":"","headimgurl":"https://dlwebv3.tscce.cn/images/noavatar.png","sex":"1","province":"","city":"","salesman":"1","salesid":"","level":"0","salestype":"11","roomcard":"1105","bean":"1007","salespower":"2222","agentmode":"2","sausstatus":"0","html_applysales":"0","global_power":"1","tel":"15621212323","wechat":"sd56465456","user_id":"","is_bind":"1","logintype":"0"});
return;
}
this.getWxInfo(function (r) {
var p = that.getQueryObj();
var isLog = sessionStorage.getItem('isLog');
that.apiv2
(
'agent.user.login',
{
agentid: p.agentid,
channelid: p.channelid,
openid: r.openid,
unionid: r.unionid,
nickname: r.nickname,
avatar: r.headimgurl,
sex: r.sex,
province: r.province,
islog: (isLog ? 0: 1)
},
function (res) {
sessionStorage.setItem('isLog', 1);
func && func(res);
},
function (code, info) {
if(code === 4254)
$.alert('未获取到你的用户信息,如果你是新用户,请先进入游戏后再登录');
else
$.alert(info);
}, isAsync
);
})
},
payLogin: function (agentInfo, func) {
if($.isWeiXin()) {
func && func({sid: '', scode: ''});
return;
}
var code = $.randomString(32);
var tmp = {
appid: agentInfo.youle_appid_pay,
devkey: agentInfo.youle_devkey_pay,
market_key: agentInfo.youle_busiid_pay,
scode: code,
agent_key: agentInfo.agentid,
game_key: 'asdf',
user_key: 'uaser',
};
$.ajax(
{
// ts已修改2021
// url: 'https://api.tscce.cn/api/login/ylnn',
url: 'https://api2.tscce.cn/api/login/ylnn',
type: 'POST',
dataType: 'json',
async: false,
data: tmp,
success: function (res) {
res = res.data;
res.scode = code;
console.log('paylog',res);
func && func(res);
},
error: function (xhr, textStatus) {
$.alert('网络异常!')
}
}
)
},
// 微信支付
toPay: function (params, agentInfo, wxInfo, billInfo, index, uid, state) {
uid = uid || '';
state = state || '';
var that = this;
var frmPost = document.createElement('form');
frmPost.id = '____frmPost____';
frmPost.name = '____frmPost____';
frmPost.method = 'post';
frmPost.action = that.PAY_URL;
//var fff={};
var add_formchild = function (name, value) {
//fff[name] = value;
var edt = document.createElement('input');
edt.type = 'text';
edt.id = name;
edt.name = name;
edt.value = value;
frmPost.appendChild(edt);
}
$.payLogin(agentInfo, function (loginSidScode) {
var method;
var type;
if (index === 'star') {
if($.isWeiXin()) {
method = 'agent.order.starPaySuccess';
} else {
method = 'agent.order.starPaySuccessH5';
}
type = 1;
} else {
if($.isWeiXin()) {
method = 'agent.order.paySuccess';
} else {
if(state === 'become')
method = 'agent.order.paySuccess';
else
method = 'agent.order.paySuccess';
}
type = 0;
}
var noticeUrl = {
url: that.API_URL,
params: {
method: method,
format: 'json',
charset: 'utf-8',
version: '1.0',
user_auth_token: '',
biz_content: {
'agentid': params.agentid,
'channelid': params.channelid,
'openid': wxInfo.openid,
'unionid': wxInfo.unionid,
'orderno': billInfo.billcode,
'money': billInfo.productmoney,
'player': billInfo.plyerid,
'playerid': (state !== 'become' ? uid : ''),
'salesid': (state === 'become' ? uid : ''),
'signkey': '0t3xm3w1foyhcmhlux31mwrmybqh4cgd'
}
}
};
var noticeUrlParams = that.NOTICE_URL + JSON.stringify(noticeUrl);
var returnUrlParams = that.RETURN_URL;
add_formchild("app_id", agentInfo.youle_appid_pay);
add_formchild("dev_key", agentInfo.youle_devkey_pay);
add_formchild("market_key", agentInfo.youle_busiid_pay);
add_formchild("fee", billInfo.productmoney * 100);
add_formchild("order_id", billInfo.billcode);
add_formchild("title", billInfo.productname);
add_formchild("notice_url", noticeUrlParams);
add_formchild("return_url", returnUrlParams);
add_formchild("agentid", params.agentid);
add_formchild("channelid", params.channelid);
add_formchild("paytype", '9');
add_formchild("type", type);
add_formchild("is_qrcode", 'n');
add_formchild("sign_key", '');
add_formchild("state", state);
if(!$.isWeiXin()) {
add_formchild("sid", loginSidScode.sid);
add_formchild("scode", loginSidScode.scode);
}
//console.log('pay_params', noticeUrlParams);
document.body.appendChild(frmPost);
frmPost.submit();
frmPost.remove();
});
},
shareLink: function (fengxiang, func) {
$.ajax(
{
type: "post",
url: this.SHARE_LINK,
dataType: 'json',
async: false,
data: fengxiang,
timeout: 1000 * 7,
success: function (data, textStatus) {
console.log('获取微信分享签名成功', data);
if (data.error == 0) {
func && func(data.data);
} else {
var code = parseInt(data.error_code);
if (code === 10008 || code === 10001 || code === 10011) {
sessionStorage.removeItem('sid');
sessionStorage.removeItem('scode');
$.getSidScode();
} else {
$.alert(data.error_code + ': ' + data.msg);
}
}
},
complete: function (res) {},
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log('error', XMLHttpRequest, textStatus, errorThrown);
$.alert("分享失败:网络异常");
}
});
},
setShareLink: function (data, param) {
var js =
{
debug: false,
appId: data.appId,
timestamp: data.timestamp,
nonceStr: data.nonceStr,
signature: data.signature,
jsApiList: [
'onMenuShareTimeline',
'onMenuShareAppMessage'
]
}
wx.config(js);
wx.ready(function () {
wx.onMenuShareTimeline(
{ //分享到朋友圈
title: param.title,
link: param.link,
imgUrl: param.imgUrl,
success: function () {
$.alert('分享成功');
},
cancel: function () {
}
});
wx.onMenuShareAppMessage(
{ //分享到好友
title: param.title,
desc: param.desc,
link: param.link,
imgUrl: param.imgUrl,
type: 'link',
success: function () {
$.alert('分享成功');
},
cancel: function () {
}
});
});
wx.error(function (res) {
console.log('wx.error', res);
$.alert('配置微信分享链接失败,请使用图片二维码分享!');
$.log(res);
});
},
alert: function (msg, func) {
if(typeof layer === 'object') {
var $obj = {
content: msg,
btn: '我知道了',
yes: function (i) {
layer.close(i);
func && func();
},
no: function (i) {
layer.close(i);
func && func();
}
};
layer.open($obj);
}
else
alert(msg);
},
confirm: function (func) {
var $obj = {
content: "确认操作?",
btn: ['确认', '取消'],
yes: function (i) {
layer.close(i);
$.loading();
func();
}
};
layer.open($obj);
},
loading: function (func) {
this.loadingLayerIndex = layer.open(
{
type: 2,
content: '加载中',
shadeClose: false,
success: function (e) {
func && func(e);
}
});
},
close: function () {
layer.closeAll();
},
randomString: function (len, charSet) {
charSet = charSet || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var randomString = '';
var randomPoz = 0;
for (var i = 0; i < len; i++) {
randomPoz = Math.floor(Math.random() * charSet.length);
randomString += charSet.substring(randomPoz,randomPoz+1);
}
return randomString;
},
log: function (data) {
var apiDate = {
method: "Youle.Youle.webLog",
format: "json",
charset: "utf-8",
version: "1.0",
user_auth_token: "",
biz_content: data
};
$.ajax(
{
url: this.API_URL,
type: 'POST',
//dataType: 'json',
data: apiDate,
timeout: 10000,
success: function (r) {}
}
);
}
});
init();
})(jQuery)

View File

@@ -0,0 +1,994 @@
;(function ($) {
/**
* 结算后台地址
* 注意:顺序不能乱
* @type {string[]}
*/
var url_settle = [
'http://localhost/proxy/trunk/settle/mobile/',
'https://proxytest.tscce.cn/settle/mobile/',
// ts已修改2021
// 'http://dlsettle.tscce.cn/mobile/'
'http://dlsettle.tscce.cn/mobile/'
];
// 初始化函数
var init = function () {
// 通过域名判断环境
$.API_URL = 'https://dlapi.daoqijuyou77.cn/Index.php';
$.RETURN_URL = 'https://dlweb.daoqijuyou77.cn/web2/notify.html';
$.SETTLE_URL = 'http://dlsettle.daoqijuyou77.cn/mobile/';
};
$.extend(
{
IS_DEBUG: false,
API_URL: '',
RETURN_URL: '', // 微信支付成功后的跳转地址
AVATAR_URL: 'https://dlwebv3.tscce.cn/images/noavatar.png', // 没有头像的默认地址
// ts已修改2021
SID_SCODE_URL: 'https://api.daoqijuyou77.cn/source/login/login.php', // 获取sid和scode的地址
WX_INFO_URL: 'https://api.daoqijuyou77.cn/api/user', // 获取微信用户信息地址
PAY_URL: 'https://api.daoqijuyou77.cn/source/pay/pay.php', // 微信支付地址
NOTICE_URL: 'https://api.daoqijuyou77.cn/source/pay/notify.php?v=', // 支付成功后的异步通知地址
SHARE_LINK: 'https://api.daoqijuyou77.cn/api/weixin/wx_share_info',
// SID_SCODE_URL: 'https://api.tscce.cn/source/login/login.php', // 获取sid和scode的地址
// WX_INFO_URL: 'https://api.tscce.cn/api/user', // 获取微信用户信息地址
// PAY_URL: 'https://api.tscce.cn/source/pay/pay.php', // 微信支付地址
// NOTICE_URL: 'https://api.tscce.cn/source/pay/notify.php?v=', // 支付成功后的异步通知地址
// SHARE_LINK: 'https://api.tscce.cn/api/weixin/wx_share_info',
SETTLE_URL: '', // 结算后台地址
wxInfo: {}, // 微信信息
userInfo: {}, // 用户信息
cache: {}, // 缓存
loadingLayerIndex: null,
whichSystem: function () {
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
return true;
} else if (/(Android)/i.test(navigator.userAgent)) {
return false;
}
return false;
},
isWeiXin: function () {
if(typeof this.cache.isWeiXin !== 'undefined') return this.cache.isWeiXin;
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") {
this.cache.isWeiXin = true;
return true;
}
this.cache.isWeiXin = false;
return false;
},
isRightId: function (playerId) {
return /^\d{6,11}$/.test(playerId);
},
isNumeric: function (playerId) {
return /^\d*$/.test(playerId);
},
isMobile: function (tel) {
return /^1[0-9]{10}$/.test(tel);
},
getQueryString: function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r !== null)
return r[2];
return null;
},
getQueryObj: function () {
if(this.cache.querys) return this.cache.querys;
var tmp = window.location.search.substr(1).split('&');
var res = {};
for (var i = 0; i < tmp.length; i++) {
var arr = tmp[i].split('=');
res[arr[0]] = arr[1];
}
this.cache.querys = res;
return res;
},
getPageName: function () {
var name = window.location.pathname.split('/').pop();
return name;
},
storage: function (name, obj) {
try {
if (typeof obj !== 'undefined') {
var tmp = (typeof obj === 'object') ? JSON.stringify(obj) : obj;
sessionStorage.setItem(name, tmp);
}
else {
var res = sessionStorage.getItem(name);
res = JSON.parse(res);
return res;
}
} catch (e) {
alert("如果此页面无法正常显示,请关闭浏览器的隐身模式,再打开此页面。");
console.log("如果此页面无法正常显示,请关闭浏览器的隐身模式,再打开此页面。", e);
}
},
convertCanvasToImage: function (canvas) {
var image = new Image();
image.src = canvas.toDataURL("image/png");
return image;
},
invite: function (name, url) {
$("#" + name).qrcode({width: 200, height: 200, text: url});
var canvas = document.getElementById(name).getElementsByTagName('canvas')[0];
canvas = this.convertCanvasToImage(canvas);
$("#" + name).html(canvas);
},
api: function (methods, params, func, isAsync) {
//console.log('params', params)
var token = sessionStorage.getItem("token");
var apiDate = {
method: methods,
format: "json",
charset: "utf-8",
version: "1.0",
user_auth_token: token,
biz_content: params
};
isAsync = isAsync || false;
if (isAsync === 1) $.loading();
var that = this;
$.ajax(
{
url: this.API_URL,
type: 'POST',
//dataType: 'json',
async: !!isAsync,
data: apiDate,
timeout: 20000,
success: function (r) {
try {
// 通过第一个字符判断数据是否正常(% => 生产环境,{ => 测试环境)
if (r.substr(0, 1) !== "%" && r.substr(0, 1) !== "{") throw "数据异常,请联系管理员排查问题";
r = JSON.parse(decodeURIComponent(r));
if (typeof r !== 'object') throw '数据异常';
} catch (e) {
$.alert(e);
return;
}
console.log(methods, r);
if (r.user_auth_token) {
try {
sessionStorage.setItem('token', r.user_auth_token);
} catch (e) {
alert("如果此页面无法正常显示,请关闭浏览器的隐身模式,再打开此页面。");
}
}
try {
if (r.retcode !== 0) throw {'code': r.retcode, 'info': r.retinfo};
if (r.biz_content.state && parseInt(r.biz_content.state) !== 0) throw {'code': r.biz_content.state, 'info': r.biz_content.error};
func && func(r.biz_content);
} catch (e) {
if(e.code === 266 || e.code === 267) {
layer.open({
content: '你的登入状态已过期,请重新登入',
btn: '重新登入',
shadeClose: false,
yes: function (i) {
sessionStorage.setItem('fromUrl', window.location.href);
var querys = $.getQueryObj();
window.location.href='manage_login.html?agentid='+querys.agentid+'&channelid='+querys.channelid;
}
});
} else {
$.alert(e.info);
}
}
},
complete: function (r) {
if ((typeof isAsync === 'boolean' && typeof that.loadingLayerIndex === 'number') || isAsync === 1) layer.close(that.loadingLayerIndex);
},
error: function (xhr, textStatus) {
$.alert('网络异常!');
}
}
);
},
apiv2: function (methods, params, func, errFunc, isAsync) {
//console.log('params', params)
var token = sessionStorage.getItem("token");
var apiDate = {
method: methods,
format: "json",
charset: "utf-8",
version: "1.0",
user_auth_token: token,
biz_content: params
};
isAsync = isAsync || false;
if (isAsync === 1) $.loading();
var that = this;
$.ajax(
{
url: this.API_URL,
type: 'POST',
//dataType: 'json',
async: !!isAsync,
data: apiDate,
timeout: 10000,
success: function (r) {
r = ('string' == typeof r) ? eval("(" + decodeURIComponent(r) + ")") : r;
if (!r) throw "服务器端有错误发生,请联系管理员!";
console.log(methods, r);
if (r.user_auth_token)
sessionStorage.setItem('token', r.user_auth_token);
try {
if (r.retcode !== 0) {
if(r.retcode === 266) throw {code: 266, info: ''};
errFunc && errFunc(r.retcode, r.retinfo);
return;
}
if (r.biz_content.state && parseInt(r.biz_content.state) !== 0) {
errFunc && errFunc(r.biz_content.state, r.biz_content.error);
return;
}
func && func(r.biz_content);
} catch (e) {
if(e.code === 266 || e.code === 267) {
layer.open({
content: '你的登入状态已过期,请重新登入',
btn: '重新登入',
shadeClose: false,
yes: function (i) {
sessionStorage.setItem('fromUrl', window.location.href);
var querys = $.getQueryObj();
window.location.href='manage_login.html?agentid='+querys.agentid+'&channelid='+querys.channelid;
}
});
} else {
$.alert(e.info);
}
}
},
complete: function (r) {
if ((typeof isAsync === 'boolean' && typeof that.loadingLayerIndex === 'number') || isAsync === 1) layer.close(that.loadingLayerIndex);
},
error: function (xhr, textStatus) {
$.alert('网络较慢!')
}
}
);
},
getAgentInfo: function (func) {
var p = this.getQueryObj();
if (!p.agentid || !p.channelid) {
alert('没有agentid和channelid请重新进入页面');
return;
}
var agentInfo = sessionStorage.getItem('agentInfo');
if (agentInfo) {
agentInfo = JSON.parse(agentInfo);
//console.log('agentinfo from session', agentInfo);
func && func(agentInfo);
} else {
var that = this;
this.api(
"Youle.Youle.channelConfig",
{agentid: p.agentid, channelid: p.channelid},
function (res) {
try {
sessionStorage.setItem('agentInfo', JSON.stringify(res));
} catch (e) {
alert("如果此页面无法正常显示,请关闭浏览器的隐身模式,再打开此页面。");
}
func && func(res);
}, true
);
}
},
getConfig: function (func) {
var that = this;
this.getAgentInfo(function (agentInfo) {
that.api(
'config.config.agentConfig',
{
id:agentInfo.id
},
function (config) {
func && func(config);
console.log('config', config);
}
)
})
},
getSidScode: function (func) {
var that = this;
this.getAgentInfo(function (agentInfo) {
var p = that.getQueryObj();
var sid = p.sid;
var scode = sessionStorage.getItem('scode');
var result;
if (!sid || !scode) {
sid = sessionStorage.getItem('sid');
//scode = sessionStorage.getItem('scode');
if (!sid || !scode) {
var currentUrl = window.location.href.replace(/sid=\w+&/, "").replace(/scode=\w+&/, "");
var appid = agentInfo.youle_appid;
var devkey = agentInfo.youle_devkey;
var busiid = agentInfo.youle_busiid;
var randomStr = $.randomString(32);
sessionStorage.setItem('scode', randomStr);
var urlSidScode = that.SID_SCODE_URL + "?scode="+randomStr+"&appid="+appid+"&dev_key=" + devkey + "&market_key=" + busiid + "&redirect_uri=" + currentUrl;
window.location.href = urlSidScode;
return;
} else {
result = $.extend({}, {sid: sid, scode: scode}, agentInfo)
func && func(result);
}
} else {
sessionStorage.setItem('sid', sid);
//sessionStorage.setItem('scode', scode);
result = $.extend({}, {sid: sid, scode: scode}, agentInfo)
func && func(result);
}
})
},
getWxInfo: function (func) {
// 如果链接中带有unionid就通过unionid获取微信信息
var that = this;
var params = $.getQueryObj();
if(params.playerid && params.unionid) {
if(this.cache.getUserInfoByUnionid) {
func && func(this.cache.getUserInfoByUnionid);
} else {
$.api(
'agent.player.login',
{
agentid: params.agentid,
channelid: params.channelid,
unionid: params.unionid,
playerid: params.playerid,
fromsign: 'WHITELOGIN'
},
function (res) {
that.cache['getUserInfoByUnionid'] = res;
func && func(res);
}
);
}
return;
}
// 如果缓存中有微信信息,直接返回
if(this.wxInfo.openid) {
console.log('getWxInfo from cache(wxInfo)', this.wxInfo);
func && func(this.wxInfo);
return;
}
var wxInfo = sessionStorage.getItem('wxInfo');
// 如果不在微信环境
if(!$.isWeiXin()/* && (pageName === 'player_buy.html' || pageName === 'become_sales_free.html' || pageName === 'become_sales.html' || pageName === 'notify.html')*/) {
if(wxInfo) {
wxInfo = JSON.parse(wxInfo);
//console.log('getWxInfo from session(phone)', wxInfo);
func && func(wxInfo);
} else {
func && func({
"id": "",
"uid": "",
"nickname": "",
"sex": "0",
"province": "",
"city": "",
"country": "",
"headimgurl": "",
"privilege": "[]",
"subscribe": "1",
"subscribe_time": "",
"unionid": "",
"openid": ""
});
}
return;
}
if (wxInfo) {
wxInfo = JSON.parse(wxInfo);
// 将信息存到缓存中
this.wxInfo = wxInfo;
console.log('getWxInfo from session', wxInfo);
func && func(wxInfo);
} else {
this.getSidScode(function (r) {
var data = {sid: r.sid, scode: r.scode, appid: r.youle_appid, market_key: r.youle_busiid, devkey: r.youle_devkey};
$.ajax(
{
url: that.WX_INFO_URL,
type: 'POST',
dataType: 'json',
async: false,
data: data,
success: function (res) {
try {
if (res.error && parseInt(res.error) !== 0) throw {code: res.error, msg: res.msg};
console.log('getWxInfo', res);
if (res.dataContent.headimgurl.length < 20 || !res.dataContent.headimgurl)
res.dataContent.headimgurl = that.AVATAR_URL;
res.dataContent.headimgurl = res.dataContent.headimgurl.replace(/132132/, "132");
sessionStorage.setItem('wxInfo', JSON.stringify(res.dataContent));
that.wxInfo = res.dataContent;
func && func(res.dataContent);
} catch (e) {
$.alert(e.msg);
if(e.code && parseInt(e.code) === 1) {
sessionStorage.removeItem('sid');
sessionStorage.removeItem('scode');
}
var tmp = $.extend({}, data, e);
$.log(tmp);
}
},
error: function (xhr, textStatus) {
console.log('error', xhr, textStatus)
$.alert('网络异常!!')
}
}
)
});
}
},
getUserInfo: function (func) {
var that = this;
// 如果链接中带有unionid就通过unionid获取微信信息 agent.user.getUserInfoByUnionid
var params = $.getQueryObj();
if(params.playerid && params.unionid) {
if(this.cache.getUserInfoByUnionid) {
func && func(this.cache.getUserInfoByUnionid);
} else {
$.api(
'agent.player.login',
{
agentid: params.agentid,
channelid: params.channelid,
playerid: params.playerid,
unionid: params.unionid,
fromsign: 'WHITELOGIN'
},
function (res) {
that.cache['getUserInfoByUnionid'] = res;
func && func(res);
}
);
}
return;
}
if(!$.isWeiXin() && $.getPageName() === 'player_buy.html') {
func && func({});
return;
}
this.getWxInfo(function (r) {
var userInfo = sessionStorage.getItem('userInfo');
// 如果sessionStorage中有用户信息直接返回否则返回登录页面
if (userInfo) {
userInfo = JSON.parse(userInfo);
//console.log('getUserInfo from sessionStorage', userInfo);
func && func(userInfo);
} else {
layer.open({
content: '你的登入状态已过期,请重新登入',
btn: '重新登入',
shadeClose: false,
yes: function (i) {
sessionStorage.setItem('fromUrl', window.location.href);
var querys = $.getQueryObj();
window.location.href='manage_login.html?agentid='+querys.agentid+'&channelid='+querys.channelid;
}
});
}
})
},
getUserInfoNoCache: function (func) {
var that = this;
this.getWxInfo(function (r) {
var p = that.getQueryObj();
var salesid = sessionStorage.getItem('salesid');
if (salesid)
{
var password = sessionStorage.getItem('password');
if (!password) throw 'no password';
that.api(
'agent.user.login',
{
agentid: p.agentid,
channelid: p.channelid,
salesid: salesid,
password: password,
type: 1
},
function (userInfo) {
try {
if (userInfo.sausstatus && parseInt(userInfo.sausstatus) !== 0) throw '对不起,你的账号已被冻结';
if (userInfo.salesman && parseInt(userInfo.salesman) !== 1) {
window.location.href = './manage_login.html?agentid=' + p.agentid + '&channelid=' + p.channelid;
return;
}
if (userInfo.salesman && parseInt(userInfo.salesman) === 1) {
that.userInfo = userInfo;
func && func(userInfo);
} else {
throw '获取用户信息错误';
}
} catch (e) {
$.alert(e)
}
}
)
}
else
{
that.api
(
'agent.user.login',
{
agentid: p.agentid,
channelid: p.channelid,
openid: r.openid,
unionid: r.unionid,
nickname: r.nickname,
avatar: r.headimgurl,
sex: r.sex,
province: r.province,
type: 0
},
function (res) {
try {
if (res.sausstatus && parseInt(res.sausstatus) !== 0) throw '对不起,你的账号已被冻结';
var salesman = parseInt(res.salesman);
if (res.salesman && salesman !== 1) {
window.location.href = './manage_login.html?agentid=' + p.agentid + '&channelid=' + p.channelid;
return;
}
if (res.salesman && salesman === 1) {
that.userInfo = res;
func && func(res);
} else {
throw '获取用户信息错误';
}
} catch (e) {
$.alert(e)
}
}
);
}
});
},
// 给新用户第一次登录用
getUserInfoFirst: function (func, isAsync) {
var that = this;
if(!$.isWeiXin()) {
func && func({"agentid":"","channelid":"","openid":"","unionid":"","nickname":"","headimgurl":"https://dlwebv3.tscce.cn/images/noavatar.png","sex":"1","province":"","city":"","salesman":"1","salesid":"","level":"0","salestype":"11","roomcard":"1105","bean":"1007","salespower":"2222","agentmode":"2","sausstatus":"0","html_applysales":"0","global_power":"1","tel":"15621212323","wechat":"sd56465456","user_id":"","is_bind":"1","logintype":"0"});
return;
}
this.getWxInfo(function (r) {
var p = that.getQueryObj();
var isLog = sessionStorage.getItem('isLog');
that.apiv2
(
'agent.user.login',
{
agentid: p.agentid,
channelid: p.channelid,
openid: r.openid,
unionid: r.unionid,
nickname: r.nickname,
avatar: r.headimgurl,
sex: r.sex,
province: r.province,
islog: (isLog ? 0: 1)
},
function (res) {
sessionStorage.setItem('isLog', 1);
func && func(res);
},
function (code, info) {
if(code === 4254) {
layer.open(
{
content: '没有查询到你的玩家信息,请先下载游戏并登录后,再操作',
btn: ['下载', '取消'],
yes: function (i) {
window.location.href = './index.html?agentid='+p.agentid+'&channelid='+p.channelid;
},
no: function () { layer.closeAll() }
}
);
}
else
$.alert(info);
}, isAsync
);
})
},
getUserAssets: function (func, isAsync) {
var that = this;
if(this.cache.assets) {
func && func(this.cache.assets);
} else {
isAsync = isAsync || false;
$.getUserInfo(function (res) {
$.api
(
'agent.user.getUserInfo',
{
idx: res.idx
},
function (res) {
that.cache.assets = res;
func && func(res);
}, isAsync
);
});
}
},
payLogin: function (agentInfo, func) {
if($.isWeiXin()) {
func && func({sid: '', scode: ''});
return;
}
var code = $.randomString(32);
var tmp = {
appid: agentInfo.youle_appid_pay,
devkey: agentInfo.youle_devkey_pay,
market_key: agentInfo.youle_busiid_pay,
scode: code,
agent_key: agentInfo.agentid,
game_key: 'asdf',
user_key: 'uaser',
};
$.ajax(
{
url: 'https://api.daoqijuyou77.cn/api/login/ylnn',
type: 'POST',
dataType: 'json',
async: false,
data: tmp,
success: function (res) {
res = res.data;
res.scode = code;
console.log('paylog',res);
func && func(res);
},
error: function (xhr, textStatus) {
$.alert('网络异常!')
}
}
)
},
// 微信支付
toPay: function (params, agentInfo, wxInfo, billInfo, index, uid, state) {
uid = uid || '';
state = state || '';
var that = this;
var frmPost = document.createElement('form');
frmPost.id = '____frmPost____';
frmPost.name = '____frmPost____';
frmPost.method = 'post';
frmPost.action = that.PAY_URL;
//var fff={};
var add_formchild = function (name, value) {
//fff[name] = value;
var edt = document.createElement('input');
edt.type = 'text';
edt.id = name;
edt.name = name;
edt.value = value;
frmPost.appendChild(edt);
}
$.payLogin(agentInfo, function (loginSidScode) {
var method;
var type;
if (index === 'star') {
type = 1;
} else if(index === 'card') {
type = 0;
} else {
// 钻石
type = 2
}
method = 'agent.order.ordersuccess';
var noticeUrl = {
url: that.API_URL,
params: {
method: method,
format: 'json',
charset: 'utf-8',
version: '1.0',
user_auth_token: '',
biz_content: {
'agentid': params.agentid,
'channelid': params.channelid,
'openid': wxInfo.openid,
'unionid': wxInfo.unionid,
'orderno': billInfo.billcode,
'money': billInfo.productmoney,
'player': 'as',
'playerid': (state !== 'become' ? uid : ''),
'salesid': (state === 'become' ? uid : ''),
'signkey': '0t3xm3w1foyhcmhlux31mwrmybqh4cgd'
}
}
};
var noticeUrlParams = that.NOTICE_URL + JSON.stringify(noticeUrl);
var returnUrlParams = that.RETURN_URL;
add_formchild("app_id", agentInfo.youle_appid_pay);
add_formchild("dev_key", agentInfo.youle_devkey_pay);
add_formchild("market_key", agentInfo.youle_busiid_pay);
add_formchild("fee", billInfo.productmoney * 100);
add_formchild("order_id", billInfo.billcode);
add_formchild("title", billInfo.productname);
add_formchild("notice_url", noticeUrlParams);
add_formchild("return_url", returnUrlParams);
add_formchild("agentid", params.agentid);
add_formchild("channelid", params.channelid);
add_formchild("type", type);
add_formchild("silence", 1);
add_formchild("is_qrcode", 'n');
add_formchild("sign_key", '');
add_formchild("state", state);
if(!$.isWeiXin()) {
add_formchild("sid", loginSidScode.sid);
add_formchild("scode", loginSidScode.scode);
}
if($.IS_DEBUG) {
console.log('pay_url', that.PAY_URL);
console.log('pay_params', noticeUrlParams);
} else {
document.body.appendChild(frmPost);
frmPost.submit();
frmPost.remove();
}
});
},
shareLink: function (fengxiang, func) {
$.ajax(
{
type: "post",
url: this.SHARE_LINK,
dataType: 'json',
async: false,
data: fengxiang,
timeout: 1000 * 7,
success: function (data, textStatus) {
console.log('获取微信分享签名成功', data);
if (data.error == 0) {
func && func(data.data);
} else {
var code = parseInt(data.error_code);
if (code === 10008 || code === 10001 || code === 10011) {
sessionStorage.removeItem('sid');
sessionStorage.removeItem('scode');
$.getSidScode();
} else {
$.alert(data.error_code + ': ' + data.msg);
}
}
},
complete: function (res) {},
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log('error', XMLHttpRequest, textStatus, errorThrown);
$.alert("分享失败:网络异常");
}
});
},
setShareLink: function (data, param) {
var js =
{
debug: false,
appId: data.appId,
timestamp: data.timestamp,
nonceStr: data.nonceStr,
signature: data.signature,
jsApiList: [
'onMenuShareTimeline',
'onMenuShareAppMessage'
]
}
wx.config(js);
wx.ready(function () {
wx.onMenuShareTimeline(
{ //分享到朋友圈
title: param.title,
link: param.link,
imgUrl: param.imgUrl,
success: function () {
$.alert('分享成功');
},
cancel: function () {
}
});
wx.onMenuShareAppMessage(
{ //分享到好友
title: param.title,
desc: param.desc,
link: param.link,
imgUrl: param.imgUrl,
type: 'link',
success: function () {
$.alert('分享成功');
},
cancel: function () {
}
});
});
wx.error(function (res) {
console.log('wx.error', res);
$.alert('配置分享链接失败');
//$.log(res);
});
},
alert: function (msg, func) {
if(typeof layer === 'object') {
var $obj = {
content: msg,
btn: '我知道了',
yes: function (i) {
layer.close(i);
func && func();
},
no: function (i) {
layer.close(i);
func && func();
}
};
layer.open($obj);
}
else
alert(msg);
},
msg: function(msg) {
layer.open({
content: msg
,skin: 'msg'
,time: 2 //2秒后自动关闭
});
},
confirm: function (func) {
var $obj = {
content: "确认操作?",
btn: ['确认', '取消'],
yes: function (i) {
layer.close(i);
$.loading();
func();
}
};
layer.open($obj);
},
loading: function (func) {
this.loadingLayerIndex = layer.open(
{
type: 2,
content: '加载中',
shadeClose: false,
success: function (e) {
func && func(e);
}
});
},
close: function () {
layer.closeAll();
},
randomString: function (len, charSet) {
charSet = charSet || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var randomString = '';
var randomPoz = 0;
for (var i = 0; i < len; i++) {
randomPoz = Math.floor(Math.random() * charSet.length);
randomString += charSet.substring(randomPoz,randomPoz+1);
}
return randomString;
},
log: function (data) {
var apiDate = {
method: "Youle.Youle.webLog",
format: "json",
charset: "utf-8",
version: "1.0",
user_auth_token: "",
biz_content: data
};
$.ajax(
{
url: this.API_URL,
type: 'POST',
//dataType: 'json',
data: apiDate,
timeout: 10000,
success: function (r) {}
}
);
}
});
init();
})(jQuery)

View File

@@ -0,0 +1,28 @@
(function(r){r.fn.qrcode=function(h){var s;function u(a){this.mode=s;this.data=a}function o(a,c){this.typeNumber=a;this.errorCorrectLevel=c;this.modules=null;this.moduleCount=0;this.dataCache=null;this.dataList=[]}function q(a,c){if(void 0==a.length)throw Error(a.length+"/"+c);for(var d=0;d<a.length&&0==a[d];)d++;this.num=Array(a.length-d+c);for(var b=0;b<a.length-d;b++)this.num[b]=a[b+d]}function p(a,c){this.totalCount=a;this.dataCount=c}function t(){this.buffer=[];this.length=0}u.prototype={getLength:function(){return this.data.length},
write:function(a){for(var c=0;c<this.data.length;c++)a.put(this.data.charCodeAt(c),8)}};o.prototype={addData:function(a){this.dataList.push(new u(a));this.dataCache=null},isDark:function(a,c){if(0>a||this.moduleCount<=a||0>c||this.moduleCount<=c)throw Error(a+","+c);return this.modules[a][c]},getModuleCount:function(){return this.moduleCount},make:function(){if(1>this.typeNumber){for(var a=1,a=1;40>a;a++){for(var c=p.getRSBlocks(a,this.errorCorrectLevel),d=new t,b=0,e=0;e<c.length;e++)b+=c[e].dataCount;
for(e=0;e<this.dataList.length;e++)c=this.dataList[e],d.put(c.mode,4),d.put(c.getLength(),j.getLengthInBits(c.mode,a)),c.write(d);if(d.getLengthInBits()<=8*b)break}this.typeNumber=a}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17;this.modules=Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++){this.modules[d]=Array(this.moduleCount);for(var b=0;b<this.moduleCount;b++)this.modules[d][b]=null}this.setupPositionProbePattern(0,0);this.setupPositionProbePattern(this.moduleCount-
7,0);this.setupPositionProbePattern(0,this.moduleCount-7);this.setupPositionAdjustPattern();this.setupTimingPattern();this.setupTypeInfo(a,c);7<=this.typeNumber&&this.setupTypeNumber(a);null==this.dataCache&&(this.dataCache=o.createData(this.typeNumber,this.errorCorrectLevel,this.dataList));this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,c){for(var d=-1;7>=d;d++)if(!(-1>=a+d||this.moduleCount<=a+d))for(var b=-1;7>=b;b++)-1>=c+b||this.moduleCount<=c+b||(this.modules[a+d][c+b]=
0<=d&&6>=d&&(0==b||6==b)||0<=b&&6>=b&&(0==d||6==d)||2<=d&&4>=d&&2<=b&&4>=b?!0:!1)},getBestMaskPattern:function(){for(var a=0,c=0,d=0;8>d;d++){this.makeImpl(!0,d);var b=j.getLostPoint(this);if(0==d||a>b)a=b,c=d}return c},createMovieClip:function(a,c,d){a=a.createEmptyMovieClip(c,d);this.make();for(c=0;c<this.modules.length;c++)for(var d=1*c,b=0;b<this.modules[c].length;b++){var e=1*b;this.modules[c][b]&&(a.beginFill(0,100),a.moveTo(e,d),a.lineTo(e+1,d),a.lineTo(e+1,d+1),a.lineTo(e,d+1),a.endFill())}return a},
setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)null==this.modules[a][6]&&(this.modules[a][6]=0==a%2);for(a=8;a<this.moduleCount-8;a++)null==this.modules[6][a]&&(this.modules[6][a]=0==a%2)},setupPositionAdjustPattern:function(){for(var a=j.getPatternPosition(this.typeNumber),c=0;c<a.length;c++)for(var d=0;d<a.length;d++){var b=a[c],e=a[d];if(null==this.modules[b][e])for(var f=-2;2>=f;f++)for(var i=-2;2>=i;i++)this.modules[b+f][e+i]=-2==f||2==f||-2==i||2==i||0==f&&0==i?!0:!1}},setupTypeNumber:function(a){for(var c=
j.getBCHTypeNumber(this.typeNumber),d=0;18>d;d++){var b=!a&&1==(c>>d&1);this.modules[Math.floor(d/3)][d%3+this.moduleCount-8-3]=b}for(d=0;18>d;d++)b=!a&&1==(c>>d&1),this.modules[d%3+this.moduleCount-8-3][Math.floor(d/3)]=b},setupTypeInfo:function(a,c){for(var d=j.getBCHTypeInfo(this.errorCorrectLevel<<3|c),b=0;15>b;b++){var e=!a&&1==(d>>b&1);6>b?this.modules[b][8]=e:8>b?this.modules[b+1][8]=e:this.modules[this.moduleCount-15+b][8]=e}for(b=0;15>b;b++)e=!a&&1==(d>>b&1),8>b?this.modules[8][this.moduleCount-
b-1]=e:9>b?this.modules[8][15-b-1+1]=e:this.modules[8][15-b-1]=e;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,c){for(var d=-1,b=this.moduleCount-1,e=7,f=0,i=this.moduleCount-1;0<i;i-=2)for(6==i&&i--;;){for(var g=0;2>g;g++)if(null==this.modules[b][i-g]){var n=!1;f<a.length&&(n=1==(a[f]>>>e&1));j.getMask(c,b,i-g)&&(n=!n);this.modules[b][i-g]=n;e--; -1==e&&(f++,e=7)}b+=d;if(0>b||this.moduleCount<=b){b-=d;d=-d;break}}}};o.PAD0=236;o.PAD1=17;o.createData=function(a,c,d){for(var c=p.getRSBlocks(a,
c),b=new t,e=0;e<d.length;e++){var f=d[e];b.put(f.mode,4);b.put(f.getLength(),j.getLengthInBits(f.mode,a));f.write(b)}for(e=a=0;e<c.length;e++)a+=c[e].dataCount;if(b.getLengthInBits()>8*a)throw Error("code length overflow. ("+b.getLengthInBits()+">"+8*a+")");for(b.getLengthInBits()+4<=8*a&&b.put(0,4);0!=b.getLengthInBits()%8;)b.putBit(!1);for(;!(b.getLengthInBits()>=8*a);){b.put(o.PAD0,8);if(b.getLengthInBits()>=8*a)break;b.put(o.PAD1,8)}return o.createBytes(b,c)};o.createBytes=function(a,c){for(var d=
0,b=0,e=0,f=Array(c.length),i=Array(c.length),g=0;g<c.length;g++){var n=c[g].dataCount,h=c[g].totalCount-n,b=Math.max(b,n),e=Math.max(e,h);f[g]=Array(n);for(var k=0;k<f[g].length;k++)f[g][k]=255&a.buffer[k+d];d+=n;k=j.getErrorCorrectPolynomial(h);n=(new q(f[g],k.getLength()-1)).mod(k);i[g]=Array(k.getLength()-1);for(k=0;k<i[g].length;k++)h=k+n.getLength()-i[g].length,i[g][k]=0<=h?n.get(h):0}for(k=g=0;k<c.length;k++)g+=c[k].totalCount;d=Array(g);for(k=n=0;k<b;k++)for(g=0;g<c.length;g++)k<f[g].length&&
(d[n++]=f[g][k]);for(k=0;k<e;k++)for(g=0;g<c.length;g++)k<i[g].length&&(d[n++]=i[g][k]);return d};s=4;for(var j={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,
78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var c=a<<10;0<=j.getBCHDigit(c)-j.getBCHDigit(j.G15);)c^=j.G15<<j.getBCHDigit(c)-j.getBCHDigit(j.G15);return(a<<10|c)^j.G15_MASK},getBCHTypeNumber:function(a){for(var c=a<<12;0<=j.getBCHDigit(c)-
j.getBCHDigit(j.G18);)c^=j.G18<<j.getBCHDigit(c)-j.getBCHDigit(j.G18);return a<<12|c},getBCHDigit:function(a){for(var c=0;0!=a;)c++,a>>>=1;return c},getPatternPosition:function(a){return j.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,c,d){switch(a){case 0:return 0==(c+d)%2;case 1:return 0==c%2;case 2:return 0==d%3;case 3:return 0==(c+d)%3;case 4:return 0==(Math.floor(c/2)+Math.floor(d/3))%2;case 5:return 0==c*d%2+c*d%3;case 6:return 0==(c*d%2+c*d%3)%2;case 7:return 0==(c*d%3+(c+d)%2)%2;default:throw Error("bad maskPattern:"+
a);}},getErrorCorrectPolynomial:function(a){for(var c=new q([1],0),d=0;d<a;d++)c=c.multiply(new q([1,l.gexp(d)],0));return c},getLengthInBits:function(a,c){if(1<=c&&10>c)switch(a){case 1:return 10;case 2:return 9;case s:return 8;case 8:return 8;default:throw Error("mode:"+a);}else if(27>c)switch(a){case 1:return 12;case 2:return 11;case s:return 16;case 8:return 10;default:throw Error("mode:"+a);}else if(41>c)switch(a){case 1:return 14;case 2:return 13;case s:return 16;case 8:return 12;default:throw Error("mode:"+
a);}else throw Error("type:"+c);},getLostPoint:function(a){for(var c=a.getModuleCount(),d=0,b=0;b<c;b++)for(var e=0;e<c;e++){for(var f=0,i=a.isDark(b,e),g=-1;1>=g;g++)if(!(0>b+g||c<=b+g))for(var h=-1;1>=h;h++)0>e+h||c<=e+h||0==g&&0==h||i==a.isDark(b+g,e+h)&&f++;5<f&&(d+=3+f-5)}for(b=0;b<c-1;b++)for(e=0;e<c-1;e++)if(f=0,a.isDark(b,e)&&f++,a.isDark(b+1,e)&&f++,a.isDark(b,e+1)&&f++,a.isDark(b+1,e+1)&&f++,0==f||4==f)d+=3;for(b=0;b<c;b++)for(e=0;e<c-6;e++)a.isDark(b,e)&&!a.isDark(b,e+1)&&a.isDark(b,e+
2)&&a.isDark(b,e+3)&&a.isDark(b,e+4)&&!a.isDark(b,e+5)&&a.isDark(b,e+6)&&(d+=40);for(e=0;e<c;e++)for(b=0;b<c-6;b++)a.isDark(b,e)&&!a.isDark(b+1,e)&&a.isDark(b+2,e)&&a.isDark(b+3,e)&&a.isDark(b+4,e)&&!a.isDark(b+5,e)&&a.isDark(b+6,e)&&(d+=40);for(e=f=0;e<c;e++)for(b=0;b<c;b++)a.isDark(b,e)&&f++;a=Math.abs(100*f/c/c-50)/5;return d+10*a}},l={glog:function(a){if(1>a)throw Error("glog("+a+")");return l.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;256<=a;)a-=255;return l.EXP_TABLE[a]},EXP_TABLE:Array(256),
LOG_TABLE:Array(256)},m=0;8>m;m++)l.EXP_TABLE[m]=1<<m;for(m=8;256>m;m++)l.EXP_TABLE[m]=l.EXP_TABLE[m-4]^l.EXP_TABLE[m-5]^l.EXP_TABLE[m-6]^l.EXP_TABLE[m-8];for(m=0;255>m;m++)l.LOG_TABLE[l.EXP_TABLE[m]]=m;q.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var c=Array(this.getLength()+a.getLength()-1),d=0;d<this.getLength();d++)for(var b=0;b<a.getLength();b++)c[d+b]^=l.gexp(l.glog(this.get(d))+l.glog(a.get(b)));return new q(c,0)},mod:function(a){if(0>
this.getLength()-a.getLength())return this;for(var c=l.glog(this.get(0))-l.glog(a.get(0)),d=Array(this.getLength()),b=0;b<this.getLength();b++)d[b]=this.get(b);for(b=0;b<a.getLength();b++)d[b]^=l.gexp(l.glog(a.get(b))+c);return(new q(d,0)).mod(a)}};p.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],
[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,
116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,
43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,
3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,
55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,
45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];p.getRSBlocks=function(a,c){var d=p.getRsBlockTable(a,c);if(void 0==d)throw Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+c);for(var b=d.length/3,e=[],f=0;f<b;f++)for(var h=d[3*f+0],g=d[3*f+1],j=d[3*f+2],l=0;l<h;l++)e.push(new p(g,j));return e};p.getRsBlockTable=function(a,c){switch(c){case 1:return p.RS_BLOCK_TABLE[4*(a-1)+0];case 0:return p.RS_BLOCK_TABLE[4*(a-1)+1];case 3:return p.RS_BLOCK_TABLE[4*
(a-1)+2];case 2:return p.RS_BLOCK_TABLE[4*(a-1)+3]}};t.prototype={get:function(a){return 1==(this.buffer[Math.floor(a/8)]>>>7-a%8&1)},put:function(a,c){for(var d=0;d<c;d++)this.putBit(1==(a>>>c-d-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var c=Math.floor(this.length/8);this.buffer.length<=c&&this.buffer.push(0);a&&(this.buffer[c]|=128>>>this.length%8);this.length++}};"string"===typeof h&&(h={text:h});h=r.extend({},{render:"canvas",width:256,height:256,typeNumber:-1,
correctLevel:2,background:"#ffffff",foreground:"#000000"},h);return this.each(function(){var a;if("canvas"==h.render){a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();var c=document.createElement("canvas");c.width=h.width;c.height=h.height;for(var d=c.getContext("2d"),b=h.width/a.getModuleCount(),e=h.height/a.getModuleCount(),f=0;f<a.getModuleCount();f++)for(var i=0;i<a.getModuleCount();i++){d.fillStyle=a.isDark(f,i)?h.foreground:h.background;var g=Math.ceil((i+1)*b)-Math.floor(i*b),
j=Math.ceil((f+1)*b)-Math.floor(f*b);d.fillRect(Math.round(i*b),Math.round(f*e),g,j)}}else{a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();c=r("<table></table>").css("width",h.width+"px").css("height",h.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",h.background);d=h.width/a.getModuleCount();b=h.height/a.getModuleCount();for(e=0;e<a.getModuleCount();e++){f=r("<tr></tr>").css("height",b+"px").appendTo(c);for(i=0;i<a.getModuleCount();i++)r("<td></td>").css("width",
d+"px").css("background-color",a.isDark(e,i)?h.foreground:h.background).appendTo(f)}}a=c;jQuery(a).appendTo(this)})}})(jQuery);

View File

@@ -0,0 +1,2 @@
/*! layer弹层组件拓展类 */
;!function(){layer.use("skin/layer.ext.css",function(){layer.layui_layer_extendlayerextjs=!0});var a=layer.cache||{},b=function(b){return a.skin?" "+a.skin+" "+a.skin+"-"+b:""};layer.prompt=function(a,c){a=a||{},"function"==typeof a&&(c=a);var d,e=2==a.formType?'<textarea class="layui-layer-input">'+(a.value||"")+"</textarea>":function(){return'<input type="'+(1==a.formType?"password":"text")+'" class="layui-layer-input" value="'+(a.value||"")+'">'}();return layer.open($.extend({btn:["&#x786E;&#x5B9A;","&#x53D6;&#x6D88;"],content:e,skin:"layui-layer-prompt"+b("prompt"),success:function(a){d=a.find(".layui-layer-input"),d.focus()},yes:function(b){var e=d.val();""===e?d.focus():e.length>(a.maxlength||500)?layer.tips("&#x6700;&#x591A;&#x8F93;&#x5165;"+(a.maxlength||500)+"&#x4E2A;&#x5B57;&#x6570;",d,{tips:1}):c&&c(e,b,d)}},a))},layer.tab=function(a){a=a||{};var c=a.tab||{};return layer.open($.extend({type:1,skin:"layui-layer-tab"+b("tab"),title:function(){var a=c.length,b=1,d="";if(a>0)for(d='<span class="layui-layer-tabnow">'+c[0].title+"</span>";a>b;b++)d+="<span>"+c[b].title+"</span>";return d}(),content:'<ul class="layui-layer-tabmain">'+function(){var a=c.length,b=1,d="";if(a>0)for(d='<li class="layui-layer-tabli xubox_tab_layer">'+(c[0].content||"no content")+"</li>";a>b;b++)d+='<li class="layui-layer-tabli">'+(c[b].content||"no content")+"</li>";return d}()+"</ul>",success:function(a){var b=a.find(".layui-layer-title").children(),c=a.find(".layui-layer-tabmain").children();b.on("mousedown",function(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0;var b=$(this),d=b.index();b.addClass("layui-layer-tabnow").siblings().removeClass("layui-layer-tabnow"),c.eq(d).show().siblings().hide()})}},a))},layer.photos=function(a,c,d){function e(a,b,c){var d=new Image;d.onload=function(){d.onload=null,b(d)},d.onerror=function(a){d.onerror=null,c(a)},d.src=a}var f={};if(a=a||{},a.photos){var g=a.photos.constructor===Object,h=g?a.photos:{},i=h.data||[],j=h.start||0;if(f.imgIndex=j+1,g){if(0===i.length)return void layer.msg("&#x6CA1;&#x6709;&#x56FE;&#x7247;")}else{var k=$(a.photos),l=k.find(a.img||"img");if(0===l.length)return;if(c||k.find(h.img||"img").each(function(b){var c=$(this);i.push({alt:c.attr("alt"),pid:c.attr("layer-pid"),src:c.attr("layer-src")||c.attr("src"),thumb:c.attr("src")}),c.on("click",function(){layer.photos($.extend(a,{photos:{start:b,data:i,tab:a.tab},full:a.full}),!0)})}),!c)return}f.imgprev=function(a){f.imgIndex--,f.imgIndex<1&&(f.imgIndex=i.length),f.tabimg(a)},f.imgnext=function(a,b){f.imgIndex++,f.imgIndex>i.length&&(f.imgIndex=1,b)||f.tabimg(a)},f.keyup=function(a){if(!f.end){var b=a.keyCode;a.preventDefault(),37===b?f.imgprev(!0):39===b?f.imgnext(!0):27===b&&layer.close(f.index)}},f.tabimg=function(b){i.length<=1||(h.start=f.imgIndex-1,layer.close(f.index),layer.photos(a,!0,b))},f.event=function(){f.bigimg.hover(function(){f.imgsee.show()},function(){f.imgsee.hide()}),f.bigimg.find(".layui-layer-imgprev").on("click",function(a){a.preventDefault(),f.imgprev()}),f.bigimg.find(".layui-layer-imgnext").on("click",function(a){a.preventDefault(),f.imgnext()}),$(document).on("keyup",f.keyup)},f.loadi=layer.load(1,{shade:"shade"in a?!1:.9,scrollbar:!1}),e(i[j].src,function(c){layer.close(f.loadi),f.index=layer.open($.extend({type:1,area:function(){var b=[c.width,c.height],d=[$(window).width()-100,$(window).height()-100];return!a.full&&b[0]>d[0]&&(b[0]=d[0],b[1]=b[0]*d[1]/b[0]),[b[0]+"px",b[1]+"px"]}(),title:!1,shade:.9,shadeClose:!0,closeBtn:!1,move:".layui-layer-phimg img",moveType:1,scrollbar:!1,moveOut:!0,shift:5*Math.random()|0,skin:"layui-layer-photos"+b("photos"),content:'<div class="layui-layer-phimg"><img src="'+i[j].src+'" alt="'+(i[j].alt||"")+'" layer-pid="'+i[j].pid+'"><div class="layui-layer-imgsee">'+(i.length>1?'<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>':"")+'<div class="layui-layer-imgbar" style="display:'+(d?"block":"")+'"><span class="layui-layer-imgtit"><a href="javascript:;">'+(i[j].alt||"")+"</a><em>"+f.imgIndex+"/"+i.length+"</em></span></div></div></div>",success:function(b,c){f.bigimg=b.find(".layui-layer-phimg"),f.imgsee=b.find(".layui-layer-imguide,.layui-layer-imgbar"),f.event(b),a.tab&&a.tab(i[j],b)},end:function(){f.end=!0,$(document).off("keyup",f.keyup)}},a))},function(){layer.close(f.loadi),layer.msg("&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;",{time:3e4,btn:["下一张","不看了"],yes:function(){i.length>1&&f.imgnext(!0,!0)}})})}}}();

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,19 @@
/**
* Created by zhaohuilin on 2017/10/12.
*/
$("#vuenum").on("touchmove",function(){
$(".huad-left").hide();
});
$("#vuenum").on("click",function(){
$(".huad-left").hide();
});
$(".nav-li").click(function(){
var obj = $(this);
obj.find(".nav-li-a").addClass("active");
obj.siblings().find(".nav-li-a").removeClass("active");
});
$(".footer_ul li").click(function(){
var obj = $(this);
obj.addClass("blue");
obj.siblings().removeClass("blue");
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,190 @@
;(function ($) {
"use strict";
// 默认api配置
var defaults = {
api_url: '',
data: {
method: '',
format: 'json',
charset: 'utf-8',
version: '1.0',
user_auth_token: '',
biz_content: null
},
cacheMethods: []
};
// 缓存
var Cache = {};
// 初始化函数
var init = function () {
// 通过域名判断环境
switch (window.location.hostname) {
case 'localhost':
defaults.api_url = 'http://localhost/proxy/trunk/api/Index.php';
break;
case 'proxytest.tscce.cn':
defaults.api_url = 'https://proxytest.tscce.cn/api/Index.php';
break;
default:
defaults.api_url = 'https://dlapiv3.tscce.cn/Index.php';
}
if($.getPageName() === 'welcome.html')
{
var adminInfo = sessionStorage.getItem('adminInfo');
if (adminInfo) Cache.adminInfo = JSON.parse(adminInfo);
}
};
$.extend(
{
api: function (obj) {
// 判断是否有缓存
var tmp = obj.data.method;
if(Cache[tmp]) {
console.log(tmp, 'from cache');
obj.success && obj.success(Cache[obj.data.method]);
return;
}
var data = $.extend({}, defaults.data, obj.data);
//console.log('merge data', data);
var token = sessionStorage.getItem("token");
data.user_auth_token = token;
if(Cache.adminInfo) data.biz_content = $.extend({}, data.biz_content, Cache.adminInfo);
if(obj.isLoading) $.loading();
$.ajax(
{
url: defaults.api_url,
type: 'POST',
//dataType: 'json',
//async: !!obj.async,
data: data,
timeout: 10000,
success: function (r) {
try {
r = (typeof r === 'string') ? JSON.parse(decodeURIComponent(r)) : r;
if (typeof r !== 'object') throw {code: 1, msg: '数据异常'};
console.log(data.method, r);
if (r.user_auth_token) {
try {
sessionStorage.setItem('token', r.user_auth_token);
} catch (e) {
alert("如果此页面无法正常显示,请关闭浏览器的隐身模式,再打开此页面。");
}
}
if (r.retcode !== 0) throw {code: r.retcode, msg: r.retinfo};
if (r.biz_content.state && parseInt(r.biz_content.state) !== 0) throw {
code: r.biz_content.state,
msg: r.biz_content.error
};
// 判断是否要缓存数据
if($.inArray(data.method, defaults.cacheMethods) !== -1) {
Cache[data.method] = r.biz_content;
}
obj.success && obj.success(r.biz_content);
} catch (e) {
if(obj.error)
obj.error(e);
else
$.alert(e.msg);
}
},
complete: function (r) {
if(obj.isLoading && typeof Cache.loadingLayerIndex === 'number') layer.close(Cache.loadingLayerIndex);
obj.complete && obj.complete(r);
},
error: function (xhr, textStatus) {
alert('网络较慢!');
}
}
)
},
alert: function (msg) {
if(typeof layer === 'object')
layer.open({content: msg, btn: '我知道了'});
else
alert(msg);
//layer ? layer.open({content: msg, btn: '我知道了'}) : alert(msg);
},
confirm: function (func) {
var $obj = {
content: "确认操作?",
btn: ['确认', '取消'],
yes: function (i) {
layer.close(i);
func();
}
};
layer.open($obj);
},
loading: function (func) {
Cache.loadingLayerIndex = layer.open(
{
type: 2,
content: '加载中',
shadeClose: false,
success: function (e) {
func && func(e);
}
});
},
store: function (name, obj) {
sessionStorage.setItem(name, JSON.stringify(obj));
},
isRightId: function (playerId) {
return /^\d{6,10}$/.test(playerId);
},
isWeiXin: function () {
if(typeof Cache.isWeiXin === 'boolean') return Cache.isWeiXin;
var ua = navigator.userAgent.toLowerCase().match("micromessenger");
if (ua && ua[0] === "micromessenger") {
Cache.isWeiXin = true;
return true;
}
Cache.isWeiXin = false;
return false;
},
getQueryObj: function () {
if(Cache.get) return Cache.get;
var tmp = window.location.search.substr(1).split('&');
var res = {};
for (var i = 0; i < tmp.length; i++) {
var arr = tmp[i].split('=');
res[arr[0]] = arr[1];
}
if(!res.agentid || !res.channelid) throw {code: 1, msg: '链接中没有agentid或channelid参数请确认链接是否正确'};
Cache.get = res;
return res;
},
getPageName: function () {
if(Cache.pageName) return Cache.pageName;
var name = window.location.pathname.split('/').pop();
Cache.pageName = name;
return name;
}
}
);
init();
})(jQuery);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff