X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;ds=sidebyside;f=tools%2Fside_chain_tool%2Fweb%2Fassets%2Fmain.js;fp=tools%2Fside_chain_tool%2Fweb%2Fassets%2Fmain.js;h=0000000000000000000000000000000000000000;hb=54373c1a3efe0e373ec1605840a4363e4b246c46;hp=d310d30f3ae3e9012e1ae9580a203202e52488ba;hpb=ee01d543fdfe1fd0a4d548965c66f7923ea7b062;p=bytom%2Fvapor.git diff --git a/tools/side_chain_tool/web/assets/main.js b/tools/side_chain_tool/web/assets/main.js deleted file mode 100644 index d310d30f..00000000 --- a/tools/side_chain_tool/web/assets/main.js +++ /dev/null @@ -1,202 +0,0 @@ -$(function(){ - // 创建公钥按钮点击事件 - $('#btnCreate').click(function(){ - console.log('创建公私钥'); - $.ajax({ - method: 'post', //get or post - url: window.url + '/api/create_key_pair', - success: function(data){ - if (data.code == 200) { - console.log(data); - layer.msg('创建成功') - } - else { - console.log(data); - layer.msg('创建失败', data.msg) - } - - //appendKey('#keyContainer'); // 创建成功后传入返回数据调用,此处示例 - }, - error: function(err){ - layer.alert('创建失败' + err); - } - }) - }) - - // 创建公钥按钮点击事件 - $('#btnGetKey').click(function(){ - console.log('获取公私钥'); - $.ajax({ - method: 'get', //get or post - url: window.url + '/api/get_key_pair', - success: function(res){ - console.log(res); - layer.msg('获取key pair成功') - var assetHtml = template($('#keypairTpl').html(), { - items: JSON.parse(res.data) - }); - $('.key-pair-table').html(assetHtml); - }, - error: function(err){ - layer.alert('获取失败' + err); - } - }) -}) - // 追加内容到页面 - function appendKey(domId) { - $.ajax({ - method: 'get', //get or post - url: window.url + '/api/get_key_pair', - success: function(res){ - console.log(res); - layer.msg('获取key pair成功') - var assetHtml = template($('#keypairTpl').html(), { - items: JSON.parse(res.data) - }); - $('.key-pair-table').html(assetHtml); - }, - error: function(err){ - layer.alert('获取失败' + err); - } - }) - } - - // 创建脚本 - $('#btnCreateScript').click(function(){ - console.log('创建脚本'); - var params = { - "account_id": $('#account_id').val() - }; - - $.ajax({ - method: 'post', //get or post - url: window.url + '/api/create_pegin_address', - dataType: 'json', - contentType: 'application/json', - data: JSON.stringify(params), - success: function(data){ - if(data.code == 200){ - console.log(data); - layer.msg('创建成功') - } - else { - console.log(data); - layer.msg('创建失败', data.msg) - } - }, - error: function(err){ - layer.alert('创建失败' + err); - } - }) - }) - - // 获取脚本 - $('#btnGetScript').click(function(){ - console.log('获取脚本'); - $.ajax({ - method: 'get', //get or post - url: window.url + '/api/get_pegin_address', - success: function(res){ - console.log(res); - layer.msg('获取key pair成功') - var peginAddressHtml = template($('#peginAddressTpl').html(), { - items: JSON.parse(res.data) - }); - $('.pegin-address-table').html(peginAddressHtml); - }, - error: function(err){ - layer.alert('获取失败' + err); - } - }) - }) - // 追加内容到页面 - function appendAddress(domId) { - $.ajax({ - method: 'get', //get or post - url: window.url + '/api/get_pegin_address', - success: function(res){ - console.log(res); - layer.msg('获取key pair成功') - var peginAddressHtml = template($('#peginAddressTpl').html(), { - items: JSON.parse(res.data) - }); - $('.pegin-address-table').html(peginAddressHtml); - }, - error: function(err){ - layer.alert('获取失败' + err); - } - }) - } - - // 发送 - $('#btnSendToSide').click(function(e){ - e.stopPropagation(); - e.preventDefault(); - var data = $('#formToSide').serializeArray(); - var obj = {}; - $.each(data, function () { - obj[this.name] = this.value; - }); - $.ajax({ - method: 'post', - dataType: 'json', - contentType: 'application/json', - url: window.url + '/api/claim_tx', - data: JSON.stringify(obj), - success: function(res){ - if(res.code == 200){ - console.log(res); - layer.msg('cliam tx success'); - } - else { - console.log(data); - layer.msg('创建失败', res.msg) - } - }, - error: function(err){ - layer.alert('发送交易失败' + err); - } - }) - }) - - // 侧链到主链 - $('#btnSendToMain').click(function(e){ - e.stopPropagation(); - e.preventDefault(); - var data = $('#formToMain').serializeArray(); - var obj = {}; - $.each(data, function () { - if (this.value == ""){ - layer.alert('字段不能为空'); - } - if(this.name == "root_xpubs" || this.name == "xprvs"){ - obj[this.name] = this.value.split(","); - } else { - obj[this.name] = this.value; - } - - }); - - $.ajax({ - method: 'post', - dataType: 'json', - contentType: 'application/json', - url: window.url + '/api/send_to_mainchain', - data: JSON.stringify(obj), - success: function(res){ - if(res.code == 200){ - console.log(res); - layer.msg('send to mainchain success'); - } - else { - console.log(res.msg); - layer.msg('创建失败', res.msg) - } - }, - error: function(err){ - layer.alert('发送交易失败' + err); - } - }) - }) -}); -