From c92c3ace7b5858b7135f5293ca90222f9bdadd00 Mon Sep 17 00:00:00 2001 From: Bosn Ma Date: Wed, 18 Jun 2014 11:46:48 +0800 Subject: [PATCH] see UPDATELOG.md for details --- UPDATELOG.md | 5 ++++- WebContent/stat/js/core/rap.js | 22 +++++++++++++++++++--- WebContent/workspace/myWorkspace.vm | 14 ++++++++++---- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/UPDATELOG.md b/UPDATELOG.md index e95d135..7148d15 100644 --- a/UPDATELOG.md +++ b/UPDATELOG.md @@ -1,6 +1,9 @@ ### RAP v0.9.2 ### +* [BUG] 修复工作区mock=true时console报错的问题。2014-06-18 +* [体验] 本次存储记录Mock视图状态。 2014-06-18 +* [功能] 增加对请求参数列表的JSON导入功能 2014-06-18 * [功能] 增加管理员万用密码,修改PRIVATE_CONFIG.adminPassword不为空即可使用万用密码登录,方便调试问题。注意不要上传带有内容的PRIVATE_CONFIG.java 2014-06-17 -* [体验] 修复用户名密码自动完成位置错误的问题 2014-06-17 +* [体验] 修复用户名密码自动完成位置错误的问题, 2014-06-17 ### RAP v0.9.1 ### diff --git a/WebContent/stat/js/core/rap.js b/WebContent/stat/js/core/rap.js index 939cfd5..d528d5c 100644 --- a/WebContent/stat/js/core/rap.js +++ b/WebContent/stat/js/core/rap.js @@ -1209,7 +1209,7 @@ if (!window.console) { "REQUEST_BEGIN" : "

请求参数列表

", "REQUEST_BEGIN_EDIT" : "

请求参数列表

变量名含义类型备注
", "REQUEST_END" : "
OP变量名含义类型备注
", - "REQUEST_PARAMETER_ADD_BUTTON" : "
新增请求参数
", + "REQUEST_PARAMETER_ADD_BUTTON" : "
新增请求参数     导入JSON
", "RESPONSE_BEGIN" : "

响应参数列表

", "RESPONSE_BEGIN_EDIT" : "

响应参数列表

变量名含义类型备注
", @@ -1279,6 +1279,10 @@ if (!window.console) { */ ws.init = function(workspaceObj, urlObj, actionId) { var me = this; + var cb = arguments[arguments.length - 1]; + if (!cb || typeof cb !== 'function') { + cb = function(){}; + } _isLocalStorageEnabled = typeof(localStorage) != 'undefined'; _isMockDisplay = false; URL = urlObj; @@ -1337,6 +1341,9 @@ if (!window.console) { ecui.ui.Tree.prototype.onclick = function (event) { return event.target == this.getBase(); }; + + // callback invokation + cb(); }); @@ -2106,8 +2113,9 @@ if (!window.console) { ecui.get('importJSONFloater').hide(); }; - ws.importJSON = function() { + ws.importJSON = function(doesImportToRequest) { ecFloater.show("importJSONFloater"); + this._doesImportToRequest = !!doesImportToRequest; }; /** @@ -2367,6 +2375,9 @@ if (!window.console) { } var html = b.g('btnToggleMockDisplay').innerHTML; _isMockDisplay = !_isMockDisplay; + if (typeof window.localStorage !== 'undefined') { + localStorage.setItem('_isMockDisplay', _isMockDisplay); + } ws.switchA(_curActionId, true); }; @@ -3189,9 +3200,14 @@ if (!window.console) { */ function processJSONImport(f, k, pId, notFirst) { var id, param, item; + var doesImportToRequest = ws._doesImportToRequest; if (notFirst) { if (!pId) { - id = p.addResponseParameter(_curActionId); + if (doesImportToRequest === true) { + id = p.addRequestParameter(_curActionId); + } else { + id = p.addResponseParameter(_curActionId); + } param = p.getParameter(id); param.identifier = k; } else { diff --git a/WebContent/workspace/myWorkspace.vm b/WebContent/workspace/myWorkspace.vm index 4475f9e..128d15d 100644 --- a/WebContent/workspace/myWorkspace.vm +++ b/WebContent/workspace/myWorkspace.vm @@ -383,11 +383,17 @@ data.projectData.moduleList = [{"id":ws.generateId(),"name":"某模块(点击编辑后双击修改)","introduction":"","pageList":[{"moduleId":ws.generateId(),"name":"某页面","introduction":"","id":ws.generateId(),"isIdGenerated":true,"actionList":[{"pageId":ws.generateId(),"name":"某请求","requestType":"1","requestUrl":"","responseTemplate":"","description":"","id":ws.generateId(),"requestParameterList":[{"id":ws.generateId(),"identifier":"reqParam","name":"某请求参数","remark":"","validator":"","dataType":"number","parameterList":[]}],"responseParameterList":[{"id":ws.generateId(),"identifier":"resParam","name":"某响应参数","remark":"","validator":"","dataType":"number","parameterList":[]}]}]}]}]; } - ws.init(data, urlObj#if($actionId),$actionId#end); + ws.init(data, urlObj#if($actionId),$actionId#end, callbackHandler); - #if($mock) - ws.toggleMockDisplay(); - #end + function callbackHandler() { + #if($mock == true) + ws.toggleMockDisplay(); + #else + if (window.location.toString().indexOf("mock=") == -1 && window.localStorage && window.localStorage.getItem("_isMockDisplay") === 'true') { + ws.toggleMockDisplay(); + } + #end + }
OP变量名含义类型备注