/**
 * Created by tangqianchong on 2015/10/26.k
 */
define(["adoreapp/widget/BaseWidget", "adoreapp/widget/constants/ADORE"], function (BaseWidget, Adore) {
    "use strict";
    return BaseWidget.extend(function (base) {
        return {
            _initWidget: function (attrs) {
                this.style = attrs.style;
                this.jqueryNode = $(attrs.template).attr({id: this.id});
                this.circleNum = 1;
            },
            _setText: function (attrs) {
                //进行字符串的切割
                var splitSignPosition;
                var maxCharsFitNum = 0;
                var texts;
                //以空格键为所选字符进行切割
                if (attrs.text.split(" ").length > 1) {
                    texts = attrs.text.split(" ");
                }
                //空格键切割失败时切换成自动查找切割字符进行切割操作
                this.circleNum = texts.length;
                this.arrowNum = texts.length;
                this.texts = texts;
                //当样式不选择或者选择为normal的时候的处理方式
                if (this.layoutFinished) {
                    if (this.style === 0) {
                        this.jqueryNode.children().remove();
                        this.setAssistBlock();
                        for (var k = 1; k <= this.circleNum; k++) {
                            this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-contentBlock").append(this.createPart(k));
                            this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-textCircle" + k).html(k);
                            this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-partText" + k).html(this.texts[k - 1]);
                        }
                        this.setAllState(this.index);
                    }
                    else if ((this.style & Adore.Arrow) === Adore.Arrow) {
                        this.jqueryNode.children().remove();
                        this.setArrowBlock();
                        for (var rr = 1; rr <= this.arrowNum; rr++) {
                            this.contentNode.append(this.createArrowPart(rr, rr + "." + this.texts[rr - 1]));
                        }
                        this.createArrowPart();
                        this.setAllArrowState();
                    }
                }
            },
            _setIndex: function (attrs) {
                this.index = attrs.index;

                if (this.layoutFinished) {
                    if (this.style === 0) {
                        this.setAllState(this.index);
                    }
                    if ((this.style & Adore.Arrow) === Adore.Arrow) {
                        this.setAllArrowState();
                    }
                }
            },
            _setTextByIndex: function (attrs) {
                var index = attrs.content.index;
                var text = attrs.content.text;
                if (this.layoutFinished) {
                    if (this.style === 0) {
                        this.texts[index - 1] = text;
                        this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-partText" + index).html(text);
                    }
                    else if ((this.style & Adore.Arrow) === Adore.Arrow) {
                        if (text.length > this.textMaxLength) {
                            var textMaxLength = text.length;
                            var fontSize = parseInt(this.innerContentPartWidth / textMaxLength);
                            if (fontSize > this.arrowContentBlockHeight * 0.7) {
                                fontSize = this.arrowContentBlockHeight * 0.7;
                            }
                            for (var i = 1; i <= this.arrowNum; i++) {
                                this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-contentSpan" + i).css({
                                    "font-size": fontSize,
                                    "margin-top": (this.arrowContentBlockHeight - fontSize) / 2 - fontSize / 5
                                }).html(text);
                            }
                        }
                        this.texts[index - 1] = text;
                        this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-arrow-contentSpan" + index).html(index+"."+text);
                    }
                }
            },
            _setIndexByText: function (attrs) {
                //设置模糊输入 当匹配值达到50%时即可替换
                var text = attrs.text;
                var maxFixNum = 0;
                var indexWhileMaxFix;
                for (var n = 0; n < this.texts.length; n++) {
                    var fixNum = 0;
                    if (this.texts[n].length === text.length) {
                        for (var m = 0; m < this.texts[n].length; m++) {
                            if (this.texts[n][m] === text[m]) {
                                fixNum++;
                            }
                        }
                        if (maxFixNum < fixNum) {
                            maxFixNum = fixNum;
                            indexWhileMaxFix = n;
                        }
                    }
                }
                if (maxFixNum / text.length === 1 || maxFixNum / text.length >=0.5) {
                    this.index = indexWhileMaxFix + 1;
                    if (this.layoutFinished) {
                        if (this.style === 0) {
                            this.setAllState(this.index);
                        }
                        if ((this.style & Adore.Arrow) === Adore.Arrow) {
                            this.setAllArrowState();
                        }
                    }
                }
            },

            _setUnreachableIndex: function (attrs) {
                this.urIndexList = attrs.urIndexes.split(" ");
                if (this.layoutFinished) {
                    if ((this.style & Adore.Arrow) === Adore.Arrow) {
                        this.contentNode.children().remove();
                        for (var rr = 1; rr <= this.arrowNum; rr++) {
                            this.contentNode.append(this.createArrowPart(rr, rr + "." + this.texts[rr - 1]));
                        }
                        this.createArrowPart();
                        this.setAllArrowState();
                    }
                }
            },
            _setArrowMaxWidth: function (attrs) {
                this.arrowMaxWidth = attrs.arrowMaxWidth;
                if (this.layoutFinished) {
                    if ((this.style & Adore.Arrow) === Adore.Arrow) {
                        this.contentNode.children().remove();
                        for (var rr = 1; rr <= this.arrowNum; rr++) {
                            this.contentNode.append(this.createArrowPart(rr, rr + "." + this.texts[rr - 1]));
                        }
                        this.createArrowPart();
                        this.setAllArrowState();
                    }
                }
            },
            //一个获取窗体高度的方法
            _setMainHeight: function (attrs) {
                this.mainDivHeight = parseInt(attrs.mainHeight);
            },

            setAssistBlock: function () {
                if (this.layoutFinished) {
                    var assistBlockUpHeight = parseInt((this.mainDivHeight % 4) / 2);
                    var assistBlockDownHeight = this.mainDivHeight % 4 - assistBlockUpHeight;
                    var assistBlockLeftHeight = this.mainDivHeight - assistBlockUpHeight - assistBlockDownHeight;
                    var assistBlockLeftWidth = parseInt((this.mainDivWidth % this.circleNum) / 2);
                    var assistBlockRightHeight = this.mainDivHeight - assistBlockUpHeight - assistBlockDownHeight;
                    var assistBlockRightWidth = this.mainDivWidth % this.circleNum - assistBlockLeftWidth;
                    if (assistBlockLeftWidth === 0 && assistBlockLeftWidth === assistBlockRightWidth) {
                        assistBlockLeftHeight = 0;
                        assistBlockRightHeight = 0;
                    }
                    if (assistBlockLeftWidth === 0 && assistBlockLeftWidth !== assistBlockRightWidth) {
                        assistBlockLeftHeight = 0;
                    }
                    //主要div内容池的高度和宽度
                    this.contentBlockHeight = this.mainDivHeight - assistBlockUpHeight - assistBlockDownHeight;
                    this.contentBlockWidth = this.mainDivWidth - assistBlockLeftWidth - assistBlockRightWidth;
                    //设置外围4个框宽度和高度
                    this.jqueryNode.css("height", this.mainDivHeight);
                    //this.jqueryNode.css("width", this.mainDivWidth).css("height", this.mainDivHeight);
                    //插入外框辅助模块
                    this.jqueryNode.append($("<div>").addClass("wizard-assistBlock").attr("id", this.jqueryNode.attr("id") + "-assistBlockUp").css("height", assistBlockUpHeight).css("width", this.mainDivWidth));
                    this.jqueryNode.append($("<div>").addClass("wizard-assistBlock").attr("id", this.jqueryNode.attr("id") + "-assistBlockLeft").css("height", assistBlockLeftHeight).css("width", assistBlockLeftWidth));
                    this.jqueryNode.append($("<div>").addClass("wizard-contentBlock").attr("id", this.jqueryNode.attr("id") + "-contentBlock").css("height", this.contentBlockHeight).css("width", this.contentBlockWidth));
                    this.jqueryNode.append($("<div>").addClass("wizard-assistBlock").attr("id", this.jqueryNode.attr("id") + "-assistBlockRight").css("height", assistBlockRightHeight).css("width", assistBlockRightWidth));
                    this.jqueryNode.append($("<div>").addClass("wizard-assistBlock").attr("id", this.jqueryNode.attr("id") + "-assistBlockDown").css("height", assistBlockDownHeight).css("width", this.mainDivWidth));

                    this.upDiameter = parseInt((this.contentBlockHeight / 4) * 3);
                    this.outCircleDiameter = this.upDiameter - 6;
                    this.inCircleDiameter = this.outCircleDiameter - 4;
                    this.textCircleDiameter = this.inCircleDiameter - 4;
                }
            },
            createPart: function (index) {
                var partWidth = this.contentBlockWidth / this.circleNum;
                var leftWidth = parseInt((partWidth - this.upDiameter) / 2);
                var rightWidth = partWidth - leftWidth - this.upDiameter;
                var left = $("<div>").addClass("wizard-left").css("height", this.upDiameter).css("width", leftWidth);
                var leftHr = $("<hr>").addClass("wizard-leftLine").css("margin-top", parseInt(this.upDiameter / 2)).css("margin-right", "22%");
                left.append(leftHr);
                var right = $("<div>").addClass("wizard-right").css("height", this.upDiameter).css("width", rightWidth);
                var rightHr = $("<hr>").addClass("wizard-rightLine").css("margin-top", parseInt(this.upDiameter / 2)).css("margin-left", "22%");
                right.append(rightHr);
                var up = $("<div>").addClass("wizard-up").css("height", this.upDiameter).css("width", this.upDiameter);
                var outCircle = $("<div>").attr("id", this.jqueryNode.attr("id") + "-outCircle" + index).addClass("wizard-outCircle").css("width", this.outCircleDiameter).css("height", this.outCircleDiameter).css("margin", "3px 0 0 3px");
                var inCircle = $("<div>").attr("id", this.jqueryNode.attr("id") + "-inCircle" + index).addClass("wizard-inCircle").css("width", this.inCircleDiameter).css("height", this.inCircleDiameter).css("margin", "5px 0 0 5px");
                var textCircle = $("<span>").attr("id", this.jqueryNode.attr("id") + "-textCircle" + index).addClass("wizard-textCircle").css("margin-top", 2 - (this.textCircleDiameter / 4)).css("font-size", this.textCircleDiameter);
                inCircle.append(textCircle);
                up.append(outCircle);
                up.append(inCircle);
                var down = $("<div>").addClass("wizard-down").css("height", this.upDiameter / 3).css("width", partWidth);
                var partText = $("<div>").attr("id", this.jqueryNode.attr("id") + "-partText" + index).addClass("wizard-text").css("font-size", this.upDiameter / 3 * 0.9).css("margin-top", -(this.upDiameter / 12 * 0.9));
                down.append(partText);
                var part = $("<div>").addClass("wizard-part").css("width", partWidth).css("height", this.contentBlockHeight);
                part.append(left).append(up).append(right).append(down);
                return part;
            },
            setPartState: function (index, state) {
                if (state === "finished") {
                    this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-outCircle" + index).removeClass().addClass("wizard-outCircle-finished");
                    this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-inCircle" + index).children().remove();
                    this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-inCircle" + index).removeClass().addClass("wizard-inCircle-finished");
                    var tickLeftPart = $("<div>").addClass("wizard-tick-leftPart").css("width", this.inCircleDiameter * 2 / 19 + parseInt(this.mainDivHeight / 80)).css("height", this.inCircleDiameter * 5 / 19);
                    tickLeftPart.css("margin-left", this.inCircleDiameter * 9 / 38).css("margin-top", this.inCircleDiameter * 21 / 38);
                    var tickRightPart = $("<div>").addClass("wizard-tick-rightPart").css("width", this.inCircleDiameter * 2 / 19).css("height", this.inCircleDiameter * 14 / 19);
                    tickRightPart.css("margin-left", this.inCircleDiameter * 23 / 38).css("margin-top", this.inCircleDiameter * 4 / 19);
                    this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-inCircle" + index).append(tickLeftPart).append(tickRightPart);
                }
                else if (state === "handling") {
                    var textCircleHandling = $("<span>").attr("id", this.jqueryNode.attr("id") + "-textCircle" + index).addClass("wizard-textCircle-handling").css("margin-top", 2 - (this.textCircleDiameter / 4)).css("font-size", this.textCircleDiameter).html(index);
                    this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-outCircle" + index).removeClass().addClass("wizard-outCircle-handling");
                    this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-inCircle" + index).children().remove();
                    this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-inCircle" + index).removeClass().addClass("wizard-inCircle-handling").append(textCircleHandling);
                }
                else if (state === "unreached") {
                    var textCircle = $("<span>").attr("id", this.jqueryNode.attr("id") + "-textCircle" + index).addClass("wizard-textCircle").css("margin-top", 2 - (this.textCircleDiameter / 4)).css("font-size", this.textCircleDiameter).html(index);
                    this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-outCircle" + index).removeClass().addClass("wizard-outCircle");
                    this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-inCircle" + index).children().remove();
                    this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-inCircle" + index).removeClass().addClass("wizard-inCircle").append(textCircle);
                }
            },
            setAllState: function (index) {
                for (var i = 1; i < index; i++) {
                    this.setPartState(i, "finished");
                }
                this.setPartState(index, "handling");
                for (var j = index + 1; j <= this.circleNum; j++) {
                    this.setPartState(j, "unreached");
                }
            },

            //以下是wizard箭头样式的辅助方法

            setArrowBlock: function () {
                var assistBlockWidth = this.mainDivWidth % this.arrowNum;
                var assistBlockHeight = this.mainDivHeight;
                if (assistBlockWidth === 0) {
                    assistBlockHeight = 0;
                }
                var assistLeftBlockWidth = parseInt(assistBlockWidth / 2);
                var assistRightBlockWidth = assistBlockWidth - assistLeftBlockWidth;
                this.arrowContentBlockWidth = this.mainDivWidth - (this.mainDivWidth % this.arrowNum);
                this.arrowContentBlockHeight = this.mainDivHeight * 0.7;
                var arrowBlock = $("<div>").addClass("wizard-arrow-block").css({
                    "width": this.mainDivWidth,
                    "height": this.mainDivHeight
                });
                var assistLeftBlock = $("<div>").addClass("wizard-arrow-assistBlock-left").css({
                    "width": assistLeftBlockWidth,
                    "height": assistBlockHeight
                });
                var assistRightBlock = $("<div>").addClass("wizard-arrow-assistBlock-right").css({
                    "width": assistRightBlockWidth,
                    "height": assistBlockHeight
                });
                var contentBlock = $("<div>").addClass("wizard-arrow-contentBlock").css({
                    "width": this.arrowContentBlockWidth,
                    "height": this.mainDivHeight * 0.7,
                    "margin-top": this.mainDivHeight * 0.15
                }).attr({
                    "id": this.jqueryNode.attr("id") + "-arrow-contentBlock"
                });
                arrowBlock.append(assistLeftBlock).append(contentBlock).append(assistRightBlock);
                this.jqueryNode.append(arrowBlock);
                this.contentNode = this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-arrow-contentBlock");
            },
            createArrowPart: function (index, text) {

                this.arrowMaxWidth = 180;

                var contentPartWidth = this.arrowContentBlockWidth / this.arrowNum;
                if (this.arrowMaxWidth) {
                    if (contentPartWidth > this.arrowMaxWidth) {
                        contentPartWidth = this.arrowMaxWidth;
                    }
                }
                //var lrPartWidth = parseInt(contentPartWidth / 10);
                var lrPartWidth = 26;
                var innerContentPartWidth = contentPartWidth - 2 * lrPartWidth;
                this.innerContentPartWidth = innerContentPartWidth;
                var contentPart = $("<div>").addClass("wizard-arrow-contentPart").css({
                    "width": contentPartWidth,
                    "height": this.arrowContentBlockHeight
                }).attr("id", this.jqueryNode.attr("id") + "-arrow-contentPart" + index);
                var leftPart = $("<div>").addClass("wizard-arrow-leftPart").css({
                    "border-left-width": lrPartWidth,
                    "border-top-width": parseInt(this.arrowContentBlockHeight / 2),
                    "border-bottom-width": this.arrowContentBlockHeight - parseInt(this.arrowContentBlockHeight / 2)
                }).attr("id", this.jqueryNode.attr("id") + "-arrow-leftPart" + index);
                var rightPart = $("<div>").addClass("wizard-arrow-rightPart").css({
                    "border-left-width": lrPartWidth,
                    "border-top-width": parseInt(this.arrowContentBlockHeight / 2),
                    "border-bottom-width": this.arrowContentBlockHeight - parseInt(this.arrowContentBlockHeight / 2)
                }).attr("id", this.jqueryNode.attr("id") + "-arrow-rightPart" + index);
                var innerContentPart = $("<div>").addClass("wizard-arrow-innerContentPart").css({
                    "width": innerContentPartWidth,
                    "height": this.arrowContentBlockHeight
                }).attr("id", this.jqueryNode.attr("id") + "-arrow-innerContentPart" + index);
                //找出最长的字符的长度来设置合适的font-size
                var textMaxLength = 0;
                for (var i = 1; i <= this.texts.length; i++) {
                    if (textMaxLength < (this.texts[i - 1].length + 1)) {
                        textMaxLength = (this.texts[i - 1].length + 1);
                    }
                }
                this.textMaxLength = textMaxLength;
                var fontSize = parseInt(innerContentPartWidth / textMaxLength);
                if (fontSize > this.arrowContentBlockHeight * 0.7) {
                    fontSize = this.arrowContentBlockHeight * 0.7;
                }
                var contentSpan = $("<span>").addClass("wizard-arrow-contentSpan").
                    attr("id", this.jqueryNode.attr("id") + "-arrow-contentSpan" + index).css({
                        "font-size": fontSize,
                        "margin-top": (this.arrowContentBlockHeight - fontSize) / 2 - fontSize / 5
                    }).html(text);
                innerContentPart.append(contentSpan);
                contentPart.append(leftPart).append(innerContentPart).append(rightPart);
                return contentPart;
            },
            //设置状态时将所选index的箭头模块设置成相应形式
            setArrowState: function (index, state) {
                switch (state) {
                    case "finished":
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-contentPart" + index).removeClass().addClass("wizard-arrow-contentPart-finished");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-leftPart" + index).removeClass().addClass("wizard-arrow-leftPart-finished");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-rightPart" + index).removeClass().addClass("wizard-arrow-rightPart-finished");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-innerContentPart" + index).removeClass().addClass("wizard-arrow-innerContentPart-finished");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-contentSpan" + index).removeClass().addClass("wizard-arrow-contentSpan");
                        break;
                    case "unreached":
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-contentPart" + index).removeClass().addClass("wizard-arrow-contentPart-unreached");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-leftPart" + index).removeClass().addClass("wizard-arrow-leftPart-unreached");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-rightPart" + index).removeClass().addClass("wizard-arrow-rightPart-unreached");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-innerContentPart" + index).removeClass().addClass("wizard-arrow-innerContentPart-unreached");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-contentSpan" + index).removeClass().addClass("wizard-arrow-contentSpan");
                        break;
                    case "handling":
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-contentPart" + index).removeClass().addClass("wizard-arrow-contentPart-handling");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-leftPart" + index).removeClass().addClass("wizard-arrow-leftPart-handling");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-rightPart" + index).removeClass().addClass("wizard-arrow-rightPart-handling");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-innerContentPart" + index).removeClass().addClass("wizard-arrow-innerContentPart-handling");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-contentSpan" + index).removeClass().addClass("wizard-arrow-contentSpan-handling");
                        break;
                    case "unreachable":
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-contentPart" + index).removeClass().addClass("wizard-arrow-contentPart-unreachable");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-leftPart" + index).removeClass().addClass("wizard-arrow-leftPart-unreachable");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-rightPart" + index).removeClass().addClass("wizard-arrow-rightPart-unreachable");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-innerContentPart" + index).removeClass().addClass("wizard-arrow-innerContentPart-unreachable");
                        this.contentNode.find("#" + this.jqueryNode.attr("id") + "-arrow-contentSpan" + index).removeClass().addClass("wizard-arrow-contentSpan");

                }
            },
            setAllArrowState: function () {
                for (var i = 1; i <= this.circleNum; i++) {
                    this.setArrowState(i, "unreached");
                }
                for (var j = 1; j <= this.index; j++) {
                    this.setArrowState(j, "finished");
                }
                if (this.urIndexList) {
                    for (var urIndex = 0; urIndex < this.urIndexList.length; urIndex++) {
                        this.setArrowState(this.urIndexList[urIndex], "unreachable");
                    }
                }
                this.setArrowState(this.index, "handling");
            },
            //重写layout
            _layout: function () {
                base._layout.call(this);
                this.layoutFinished = true;
                this.mainDivWidth = parseInt(this.jqueryNode[0].offsetWidth);
                var own = this;
                if (this.style === 0) {
                    this.originalWidth = window.innerWidth;
                    this.setAssistBlock();
                    for (var i = 1; i <= this.circleNum; i++) {
                        this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-contentBlock").append(this.createPart(i));
                        this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-textCircle" + i).html(i);
                        this.jqueryNode.find("#" + this.jqueryNode.attr("id") + "-partText" + i).html(this.texts[i - 1]);
                    }
                    this.setAllState(this.index);

                    //配置当窗口的高度宽度切换时的逻辑
                    $(window).bind("resize." + this.id, function () {
                        if ($("#" + own.id).length === 0) {//没有正确销毁时（如父亲直接销毁）的逻辑
                            $(window).unbind("resize." + own.id);
                        }
                        if (window.innerWidth !== own.originalWidth) {
                            own.originalWidth = window.innerWidth;
                            own.mainDivWidth = parseInt(own.jqueryNode[0].offsetWidth);
                            own.jqueryNode.children().remove();
                            own.setAssistBlock();
                            for (var i = 1; i <= own.circleNum; i++) {
                                own.jqueryNode.find("#" + own.jqueryNode.attr("id") + "-contentBlock").append(own.createPart(i));
                                own.jqueryNode.find("#" + own.jqueryNode.attr("id") + "-textCircle" + i).html(i);
                                own.jqueryNode.find("#" + own.jqueryNode.attr("id") + "-partText" + i).html(own.texts[i - 1]);
                            }
                            own.setAllState(own.index);
                        }
                    })
                }
                else if ((this.style & Adore.Arrow) === Adore.Arrow) {
                    this.setArrowBlock();
                    for (var rr = 1; rr <= this.arrowNum; rr++) {
                        this.contentNode.append(this.createArrowPart(rr, rr + "." + this.texts[rr - 1]));
                    }
                    this.createArrowPart();
                    this.setAllArrowState();

                    this.originalWidth = window.innerWidth;
                    $(window).bind("resize." + this.id, function () {
                        if ($("#" + own.id).length === 0) {//没有正确销毁时（如父亲直接销毁）的逻辑
                            $(window).unbind("resize." + own.id);
                        }
                        if (window.innerWidth !== own.originalWidth) {
                            own.originalWidth = window.innerWidth;
                            own.mainDivWidth = parseInt(own.jqueryNode[0].offsetWidth);
                            own.jqueryNode.children().remove();
                            own.setArrowBlock();
                            for (var rr = 1; rr <= own.arrowNum; rr++) {
                                own.contentNode.append(own.createArrowPart(rr, rr + "." + own.texts[rr - 1]));
                            }
                            own.createArrowPart();
                            own.setAllArrowState();
                        }
                    })
                }
            }
        };
    });
});
