From 47a4f85d1438321491db86a0fcdb8f129fa6ea46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?= Date: Mon, 11 Nov 2019 12:14:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E4=B8=80=E6=AD=A5=E7=BC=A9=E7=9F=AD?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/script.js b/script.js index 14fbdfba..0e3a7520 100644 --- a/script.js +++ b/script.js @@ -85,18 +85,17 @@ var Formation = function(teamCount,memberCount){ } } Formation.prototype.outObj= function(){ - var obj = { - t:this.title, - d:this.detail, - f:this.team.map(function(t){ + let obj = {}; + if (this.title != undefined && this.title.length>0) obj.t = this.title; + if (this.detail != undefined && this.detail.length>0) obj.d = this.detail; + obj.f = this.team.map(function(t){ return t.map(function(st){ return st.map(function(m){ return m.outObj(); }) }) - }) - } - if (this.badge>0) obj.b = this.badge; //徽章 + }); + if (this.badge != undefined && this.badge>0) obj.b = this.badge; //徽章 return obj; } Formation.prototype.loadObj= function(f){