Skip to content

Commit

Permalink
feat(h5test): add link to logview
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinzZH committed Jun 15, 2018
1 parent 0ef5392 commit 8f75354
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/tsw/util/h5-test/page/src/new.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
for (var i in data.data) {
num++;
var val = data.data[i];
html += '<p>' + i + ':' + val + '</p>';
html += '<p><a href="/log/view/' + i + '" target="_blank" class="link">' + i + '</a>' + ':' + val + '</p>';
}
if (num == 0) {
html = "还没有测试号码~"
Expand Down
2 changes: 1 addition & 1 deletion bin/tsw/util/h5-test/page/tmpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ define(function(require, exports, module) {
_p(data.appid);
__p.push('\',\n uid: getCookie(\'uid\'),\n token: getCookie(\'token\')\n };\n var _api = {};\n /*\n * 添加白名单\n * */\n _api.addTestUser = function(params){\n var defer =$.Deferred();\n $.ajax({\n url: \'/api/h5test/add\',\n data:$.extend({},commomData,{\n uin: params.uin,\n val: params.val\n }),\n success: function(data){\n if(data && data.code === 0 ) {\n defer.resolve(data);\n }else {\n var message = (data && data.msg && data.msg != "") ? data.msg : "系统繁忙,请稍后再试";\n defer.reject( message);\n }\n },\n fail: function(err){\n var message = "系统繁忙,请稍后再试";\n if(err && err.msg) {\n message = err.msg;\n }\n defer.reject( message);\n }\n });\n\n return defer;\n };\n\n /*\n * 删除白名单\n */\n _api.delTestUser = function(params){\n var defer =$.Deferred();\n $.ajax({\n url: \'/api/h5test/del\',\n data:$.extend({},commomData,{\n uin: params.uin\n }),\n success: function(data){\n if(data && data.code === 0 ) {\n defer.resolve(data);\n }else {\n var message = (data && data.msg && data.msg != "") ? data.msg : "系统繁忙,请稍后再试";\n defer.reject( message);\n }\n },\n fail: function(err){\n var message = "系统繁忙,请稍后再试";\n if(err && err.msg) {\n message = err.msg;\n }\n defer.reject( message);\n }\n });\n\n return defer;\n };\n _api.getTestUser = function(params){\n var defer =$.Deferred();\n\n $.ajax({\n url: \'/api/h5test/get\',\n data:$.extend({},commomData),\n success: function(data){\n if(data && data.code === 0 ) {\n defer.resolve(data);\n }else {\n var message = (data && data.msg && data.msg != "") ? data.msg : "系统繁忙,请稍后再试";\n defer.reject( message);\n }\n },\n fail: function(err){\n var message = "系统繁忙,请稍后再试";\n if(err && err.msg) {\n message = err.msg;\n }\n defer.reject( message);\n }\n });\n\n return defer;\n };\n return _api;\n })()\n </scr');
__p.push('ipt>\n <scr');
__p.push('ipt type="text/javascript">\n (function() {\n var handlerNums = function(val){\n return val.split(/(\\b[0-9a-zA-Z_\\-]{1,64}\\b)/g);\n }\n $(\'#join-submit2\').click(function(event){\n var deferArr = [];\n var val = $(\'#join-textarea\').val();\n var arr = handlerNums(val);\n var selectVal = $(\'.selected\')[0].value;\n for(var i = 1; i < arr.length; i++) {\n (function(uin){\n var request = api.addTestUser({\n uin : uin,\n val : selectVal\n });\n deferArr.push(request);\n }(arr[i]));\n i++;\n }\n $.when.apply(this, deferArr).done(function(){\n alert("你的号码,现已加入H5测试环境");\n }).fail(function(errMsg){\n errMsg = errMsg || "出了点小问题,请联系系统管理员处理";\n alert(errMsg);\n }).always(function () {\n });\n return false;\n });\n $(\'#remove-submit2\').click(function(event){\n var deferArr = [];\n var val = $(\'#join-textarea\').val();\n var arr = handlerNums(val);\n\n for(var i = 1; i < arr.length; i++) {\n\n var request = api.delTestUser({\n uin : arr[i]\n });\n deferArr.push(request);\n\n i++;\n }\n $.when.apply(this, deferArr).done(function(){\n alert("H5测试环境删除成功");\n }).fail(function(errMsg){\n errMsg = errMsg || "出了点小问题,请联系系统管理员处理";\n alert(errMsg);\n }).always(function () {\n });\n return false;\n });\n $(\'#number-get\').click(function(event){\n var self = this;\n if($(self).is(\'.expended\')){\n $(self).removeClass(\'expended\').text(\'查看H5测试号码列表\');\n $(\'#number-list\').html(\'\');\n return;\n }\n var request = api.getTestUser();\n request.done(function(data) {\n var html = "";\n var num = 0;\n for (var i in data.data) {\n num++;\n var val = data.data[i];\n html += \'<p>\' + i + \':\' + val + \'</p>\';\n }\n if (num == 0) {\n html = "还没有测试号码~"\n }\n $(\'#number-list\').html(html);\n $(self).addClass(\'expended\').text(\'收起H5测试号码列表\');\n }).fail(function(errMsg) {\n errMsg = errMsg || "出了点小问题,请联系系统管理员处理";\n alert(errMsg);\n });\n return false;\n });\n\n $(document).on(\'click\', \'.js-select-btn\', function(event){\n var target = $(this);\n $(\'.js-select-btn\').removeClass(\'btn-primary positive\');\n $(\'.js-select-btn\').removeClass(\'selected positive\');\n target.addClass(\'btn-primary positive\');\n target.addClass(\'selected\');\n if (history.replaceState) {\n var server = target.attr(\'value\');\n var newUrl = location.protocol + \'//\' + location.host + location.pathname + \'?server=\' + encodeURIComponent(server);\n history.replaceState({server: server}, \'\', newUrl);\n }\n });\n var server = getUrlParam(\'server\');\n if (server) {\n $(\'.js-select-btn\').each(function(i, el) {\n var $el = $(el);\n if ($el.attr(\'value\') === server) {\n var $box = $el.closest(\'.column>div\');\n $box.scrollTop(el.offsetTop - 140);\n $el.trigger(\'click\');\n return false;\n }\n });\n }\n })();\n </scr');
__p.push('ipt type="text/javascript">\n (function() {\n var handlerNums = function(val){\n return val.split(/(\\b[0-9a-zA-Z_\\-]{1,64}\\b)/g);\n }\n $(\'#join-submit2\').click(function(event){\n var deferArr = [];\n var val = $(\'#join-textarea\').val();\n var arr = handlerNums(val);\n var selectVal = $(\'.selected\')[0].value;\n for(var i = 1; i < arr.length; i++) {\n (function(uin){\n var request = api.addTestUser({\n uin : uin,\n val : selectVal\n });\n deferArr.push(request);\n }(arr[i]));\n i++;\n }\n $.when.apply(this, deferArr).done(function(){\n alert("你的号码,现已加入H5测试环境");\n }).fail(function(errMsg){\n errMsg = errMsg || "出了点小问题,请联系系统管理员处理";\n alert(errMsg);\n }).always(function () {\n });\n return false;\n });\n $(\'#remove-submit2\').click(function(event){\n var deferArr = [];\n var val = $(\'#join-textarea\').val();\n var arr = handlerNums(val);\n\n for(var i = 1; i < arr.length; i++) {\n\n var request = api.delTestUser({\n uin : arr[i]\n });\n deferArr.push(request);\n\n i++;\n }\n $.when.apply(this, deferArr).done(function(){\n alert("H5测试环境删除成功");\n }).fail(function(errMsg){\n errMsg = errMsg || "出了点小问题,请联系系统管理员处理";\n alert(errMsg);\n }).always(function () {\n });\n return false;\n });\n $(\'#number-get\').click(function(event){\n var self = this;\n if($(self).is(\'.expended\')){\n $(self).removeClass(\'expended\').text(\'查看H5测试号码列表\');\n $(\'#number-list\').html(\'\');\n return;\n }\n var request = api.getTestUser();\n request.done(function(data) {\n var html = "";\n var num = 0;\n for (var i in data.data) {\n num++;\n var val = data.data[i];\n html += \'<p><a href="/log/view/\' + i + \'" target="_blank" class="link">\' + i + \'</a>\' + \':\' + val + \'</p>\';\n }\n if (num == 0) {\n html = "还没有测试号码~"\n }\n $(\'#number-list\').html(html);\n $(self).addClass(\'expended\').text(\'收起H5测试号码列表\');\n }).fail(function(errMsg) {\n errMsg = errMsg || "出了点小问题,请联系系统管理员处理";\n alert(errMsg);\n });\n return false;\n });\n\n $(document).on(\'click\', \'.js-select-btn\', function(event){\n var target = $(this);\n $(\'.js-select-btn\').removeClass(\'btn-primary positive\');\n $(\'.js-select-btn\').removeClass(\'selected positive\');\n target.addClass(\'btn-primary positive\');\n target.addClass(\'selected\');\n if (history.replaceState) {\n var server = target.attr(\'value\');\n var newUrl = location.protocol + \'//\' + location.host + location.pathname + \'?server=\' + encodeURIComponent(server);\n history.replaceState({server: server}, \'\', newUrl);\n }\n });\n var server = getUrlParam(\'server\');\n if (server) {\n $(\'.js-select-btn\').each(function(i, el) {\n var $el = $(el);\n if ($el.attr(\'value\') === server) {\n var $box = $el.closest(\'.column>div\');\n $box.scrollTop(el.offsetTop - 140);\n $el.trigger(\'click\');\n return false;\n }\n });\n }\n })();\n </scr');
__p.push('ipt>');

return __p.join('');
Expand Down

0 comments on commit 8f75354

Please sign in to comment.