{include "header.inc.html"}
 <script src="http://l.tbcdn.cn/apps/top/x/sdk.js?appkey={$appKey}"></script> 
<div class="content_box">
	<div class="toolbar_box">
		<div class="toolbar"> <span> <strong>淘宝推广链接转换API</strong><br />
		<span class="english"></span> </span> </div>
	</div>

<div class="adminForm">
<form class="form" action="" method="post">
<div class="form-line"><label class="label">需要转换的URL：</label><div class="elment"><input class="text w500" type="text" name="url" id="url" value="" /></div></div>
<div class="form-line"><label class="label">推广URL：</label><div class="elment"><textarea class="text w500" type="text" name="click_url" id="click_url"></textarea><img id="loading" class="none" src="{$baseUrl}static/images/loading.gif" width="16px" height="16px" /></div></div>
<div class="form-line"><label class="label"></label><div class="elment"><input class="btn_sub" type="submit" value="转换" /></div></div>
</form>
</div>
<script type="text/javascript">
$(function(){
	$("#click_url").click(function(){
		$(this).select();
		if($(this).val()!='') window.clipboardData.setData("text",$(this).val());
	})
	$(".btn_sub").click(function(){
	$(this).attr("disabled",true);
	$("#loading").show();
		var url = $("#url").val();
		TOP.api('rest','get',{
		   method:'taobao.taobaoke.widget.url.convert',
		   url:url,
			outer_code:'qikeweb'
		},function(resp){
			$("#loading").hide();
			$(".btn_sub").removeAttr("disabled");
				if(resp.error_response){
					var msg = resp.error_response.msg;
					if(resp.error_response.sub_msg){
						msg = resp.error_response.sub_msg;
					}
					$("#click_url").val(msg);
				 }else{
				 var click_url = resp.taobaoke_item.click_url;
				$("#click_url").val(click_url);
			} 
		});
		return false;
	});
});
</script>
</div><!--.content_box-->
{include "footer.inc.html"}