$(function () {
$(".shop-item-img:not(.mini)").each(function (i, e) {
var $item = $(e), $parent = $item.parents(":not(a):first"), rz = $item.data("rz");
if ($parent.length > 0) {
$parent.addClass("shop-item-img-frame")
.append($("")
.addClass("shop-item-img-rz")
.addClass("icon_rz")
.addClass("rz_" + rz));
}
});
$(".shop-item-img.mini").each(function (i, e) {
var $item = $(e), $parent = $item.parents(":not(a,i):first"), rz = $item.data("rz");
if ($parent.length > 0) {
$parent.addClass("shop-item-img-frame")
.addClass($parent.find(".range").length > 0 ? "range-mini" : "mini")
.append($("")
.addClass("shop-item-img-rz")
.addClass("icon_rz")
.addClass("rz_" + rz));
}
});
});
var Wanche;
(function (Wanche) {
var Global = /** @class */ (function () {
function Global() {
}
Global.showMsg = function (msg, title, btn_text, cancel_btn_text, confirmFunc) {
if (title === void 0) { title = ""; }
if (btn_text === void 0) { btn_text = "确定"; }
if (cancel_btn_text === void 0) { cancel_btn_text = "取消"; }
if (confirmFunc === void 0) { confirmFunc = null; }
if (!confirmFunc) {
swal({
title: title,
text: msg,
confirmButtonText: btn_text
});
}
else {
swal({
title: title,
text: msg,
showCancelButton: true,
confirmButtonText: btn_text,
cancelButtonText: cancel_btn_text
}, function () {
confirmFunc();
});
}
};
Global.showMsgAutoHide = function (msg, timer, title, btn_text) {
if (timer === void 0) { timer = 2000; }
if (title === void 0) { title = ""; }
if (btn_text === void 0) { btn_text = "确定"; }
swal({
title: title,
text: msg,
confirmButtonText: btn_text,
timer: timer
});
};
Global.showSuccess = function (msg, title, btn_text) {
if (title === void 0) { title = ""; }
if (btn_text === void 0) { btn_text = "确定"; }
swal({
title: title,
type: "success",
text: msg,
confirmButtonText: btn_text
});
};
Global.showError = function (msg, title, btn_text) {
if (title === void 0) { title = ""; }
if (btn_text === void 0) { btn_text = "确定"; }
swal({
title: title,
type: "error",
text: msg,
confirmButtonText: btn_text
});
};
Global.showLoading = function (text) {
this.hideLoading();
var $dialog = $("#loading-dialog"), $span = $dialog.find("span");
$span.text(text);
var html = $dialog.html();
$.flavr({
modal: true,
dialog: 'form',
form: { content: html, addClass: 'loading-dialog' },
buttons: {}
});
};
Global.hideLoading = function () {
var $dialog = $(".flavr-form.loading-dialog").parents(".flavr-container");
$dialog.remove();
};
Global.showLogin = function (callback) {
window.location.href = "/login";
};
return Global;
}());
Wanche.Global = Global;
var Helper = /** @class */ (function () {
function Helper() {
}
Helper.createKindEditor = function (id, uploadJson) {
return KindEditor.create(id, {
resizeType: 1,
width: 850,
height: 800,
uploadJson: uploadJson,
imageUploadLimit: 15,
allowImageRemote: false,
items: ['undo', 'redo', '|', 'cut', 'copy', 'paste', '|', 'image', 'multiimage', '|', 'fullscreen'],
htmlTags: {
img: ['src', '/'],
p: ['/']
}
});
};
return Helper;
}());
Wanche.Helper = Helper;
var UserBindingPhone = /** @class */ (function () {
function UserBindingPhone() {
}
UserBindingPhone.prototype.init = function () {
this.islogin = $("#hidden_islogin").val() == "true";
this.userbindingphone = $("#hidden_userbindingphone").val() == "true";
this.hidebindingtip = $("#hidden_hidebindingtip").val() == "true";
if (this.isBinding() && !this.hidebindingtip) {
this.bindingTip();
}
};
UserBindingPhone.prototype.isBinding = function () {
return (this.islogin && !this.userbindingphone);
};
UserBindingPhone.prototype.bindingTip = function () {
swal({
title: "您的账号尚未绑定手机",
text: "您的账号尚未绑定手机,可能会有安全风险,请前往绑定页面进行绑定。",
type: "warning",
showCancelButton: false,
confirmButtonColor: "#09bb07",
confirmButtonText: "立即前往绑定",
cancelButtonColor: "#DD6B55",
cancelButtonText: "暂时不绑定",
allowEscapeKey: false,
closeOnConfirm: false
}, function () {
document.getElementById("go_binding_phone").click();
});
};
return UserBindingPhone;
}());
Wanche.UserBindingPhone = UserBindingPhone;
var PartsListMini = /** @class */ (function () {
function PartsListMini($root) {
this.$root = $root;
this.show_h = 25;
this.$more = $root.find(".show_more");
this.$list = $root.find(".parts_min_list");
this.init();
}
PartsListMini.setList = function () {
$(".item_parts_min").each(function (i, e) {
new PartsListMini($(e));
});
};
PartsListMini.prototype.init = function () {
var _this = this;
if (this.$list.height() > this.show_h) {
this.$more.show();
this.$more.click(function (e) {
_this.$root.addClass("full");
_this.$more.hide();
});
}
};
return PartsListMini;
}());
Wanche.PartsListMini = PartsListMini;
})(Wanche || (Wanche = {}));
(function (Wanche) {
var UserCenter;
(function (UserCenter) {
var FormImage = /** @class */ (function () {
function FormImage($root) {
this.$root = $root;
this.$upload = $root.find(".file-upload");
this.$content = $root.find(".image-upload-content");
}
FormImage.prototype.resetCss = function () {
var temp = this.$content.offset();
this.$upload.css({
top: temp.top
});
this.$upload.show();
};
return FormImage;
}());
UserCenter.FormImage = FormImage;
var MyMessageCount = /** @class */ (function () {
function MyMessageCount() {
}
MyMessageCount.getCount = function () {
if (!islogin)
return;
var $msg_count = jQuery(".msgcount-text");
var $msg_frame = jQuery(".msgcount-frame");
var count = 0;
$.ajax({
url: "/usercentre/getmymessageunread",
method: "GET",
}).done(function (x) {
var count_val = "";
if (!!x && !!x.Success) {
var count = parseInt(x.Data);
if (count > 99) {
count_val = "99+";
}
else {
count_val = "" + count;
}
}
$msg_count.html(count_val);
if (count > 0) {
$msg_frame.addClass("unread");
}
else {
$msg_frame.removeClass("unread");
}
});
};
return MyMessageCount;
}());
UserCenter.MyMessageCount = MyMessageCount;
})(UserCenter = Wanche.UserCenter || (Wanche.UserCenter = {}));
})(Wanche || (Wanche = {}));
if (!window["ismobile"]) {
window["ismobile"] = false;
}
if (!window["islogin"]) {
window["islogin"] = false;
}
$(function () {
new Wanche.UserBindingPhone().init();
Wanche.PartsListMini.setList();
islogin = $("#hidden_islogin").val() == "true";
new Wanche.UserCenter.MyMessageCount.getCount();
});