Skip to content
Permalink
Browse files

feat(h5test): add link to logview

  • Loading branch information...
RobinzZH committed Jun 15, 2018
1 parent 0ef5392 commit 8f753549d75a5de5cd1cb56c2330f770ddc40855
Showing with 2 additions and 2 deletions.
  1. +1 −1 bin/tsw/util/h5-test/page/src/new.tmpl.html
  2. +1 −1 bin/tsw/util/h5-test/page/tmpl.js
@@ -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 = "还没有测试号码~"
@@ -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('');

0 comments on commit 8f75354

Please sign in to comment.
You can’t perform that action at this time.