Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ShenXuGongZi/751d18ee0235862f787018cbc3c0ab41 to your computer and use it in GitHub Desktop.
Save ShenXuGongZi/751d18ee0235862f787018cbc3c0ab41 to your computer and use it in GitHub Desktop.
apicloud-ex
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title>main</title>
<link rel="stylesheet" type="text/css" href="../css/aui.2.0.css" />
<link rel="stylesheet" type="text/css" href="../css/api.css" />
<link rel="stylesheet" type="text/css" href="../css/common.css" />
<style>
.aui-tab-nav li a {
color: #000000;
}
.aui-tab-nav .active a {
color: #1abc9c;
}
.aui-tab-nav li a:hove {
color: #000;
}
.list {
/*color:red;*/
/*margin-left:20px;*/
}
.bg {
font-size: 16px;
}
</style>
</head>
<body onload="showPresonInfo()">
<!--tab-->
<div class="aui-content">
<div class="aui-tab" id="tab">
<div class="aui-tab-item aui-active" onclick="test(10)">
美元
</div>
<div class="aui-tab-item">
港币
</div>
<div class="aui-tab-item">
英镑
</div>
<div class="aui-tab-item">
欧元
</div>
</div>
</div>
<!-- ./tab -->
<!---->
<div class="aui-content aui-margin-b-15">
<ul class="aui-list aui-list-in">
<li id="html">
请下拉刷新
</li>
</ul>
</div>
<!--<div id="demo"></div>-->
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/aui-tab.js" ></script>
<script>
function test(item) {
// var t = item;
alert(item);
}
apiready = function() {
api.parseTapmode();
//tab
api.setRefreshHeaderInfo({
visible : true,
bgColor : 'rgba(0,0,0,0)',
textColor : '#666',
textDown : '下拉刷新',
textUp : '释放刷新'
}, function(ret, err) {
api.refreshHeaderLoadDone();
//
api.showProgress();
api.ajax({
url : 'http://web.juhe.cn:8080/finance/exchange/rmbquot?key=2e65e126c9c0b0752b132e394ed59345', //接口地址
method : 'get',
cache : 'false',
timeout : 10,
dateTpye : 'json',
}, function(ret, err) {
//coding...
api.hideProgress();
// alert(JSON.stringify(ret));
// alert( JSON.stringify( ret ) + JSON.stringify( err ) );
if (ret) {
// for(var i=0;i<ret.length;i++){
// for(var key in ret[i]){
var html = '';
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '现汇买入价 </div><div class="aui-list-item-right"><div class="aui-label aui-label-info bg">¥' + ret.result[0].data1.fBuyPri + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '现钞买入价 </div><div class="aui-list-item-right"><div class="aui-label aui-label-info bg">¥' + ret.result[0].data1.mBuyPri + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '现汇卖出价 </div><div class="aui-list-item-right"><div class="aui-label aui-label-warning bg">¥' + ret.result[0].data1.fSellPri + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '现钞卖出价 </div><div class="aui-list-item-right"><div class="aui-label aui-label-warning bg">¥' + ret.result[0].data1.mSellPri + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '银行折算价/中间价 </div><div class="aui-list-item-right"><div class="aui-label aui-label-success bg">¥' + ret.result[0].data1.bankConversionPri + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '发布日期 </div><div class="aui-list-item-right"><div class="aui-label bg">' + ret.result[0].data1.date + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '发布时间 </div><div class="aui-list-item-right"><div class="aui-label bg">' + ret.result[0].data1.time + '</div>';
html += ' </div></li>';
document.getElementById("html").innerHTML = html;
//动态内容显示
alert('更新成功');
// }
// }
} else {
api.alert({
msg : ('错误码:' + err.code + ';错误信息:' + err.msg + '网络状态码:' + err.statusCode)
});
}
});
});
api.showProgress();
api.ajax({
url : 'http://web.juhe.cn:8080/finance/exchange/rmbquot?key=2e65e126c9c0b0752b132e394ed59345', //接口地址
method : 'get',
cache : 'false',
timeout : 30,
dateTpye : 'json',
}, function(ret, err) {
//coding...
api.hideProgress();
// alert(JSON.stringify(ret));
// alert( JSON.stringify( ret ) + JSON.stringify( err ) );
if (ret) {
var html = '';
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '现汇买入价 </div><div class="aui-list-item-right"><div class="aui-label aui-label-info bg">¥' + ret.result[0].data1.fBuyPri + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '现钞买入价 </div><div class="aui-list-item-right"><div class="aui-label aui-label-info bg">¥' + ret.result[0].data1.mBuyPri + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '现汇卖出价 </div><div class="aui-list-item-right"><div class="aui-label aui-label-warning bg">¥' + ret.result[0].data1.fSellPri + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '现钞卖出价 </div><div class="aui-list-item-right"><div class="aui-label aui-label-warning bg">¥' + ret.result[0].data1.mSellPri + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '银行折算价/中间价 </div><div class="aui-list-item-right"><div class="aui-label aui-label-success bg">¥' + ret.result[0].data1.bankConversionPri + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '发布日期 </div><div class="aui-list-item-right"><div class="aui-label bg">' + ret.result[0].data1.date + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '发布时间 </div><div class="aui-list-item-right"><div class="aui-label bg">' + ret.result[0].data1.time + '</div>';
html += ' </div></li>';
document.getElementById("html").innerHTML = html;
//动态内容显示
} else {
api.alert({
msg : ('错误码:' + err.code + ';错误信息:' + err.msg + '网络状态码:' + err.statusCode)
});
}
});
var tab = new auiTab({
element : document.getElementById("tab"),
index : 1,
repeatClick : false
}, function(ret) {
var t = test(); //获取index属性的值
api.showProgress();
api.ajax({
url : 'http://web.juhe.cn:8080/finance/exchange/rmbquot?key=2e65e126c9c0b0752b132e394ed59345', //接口地址
method : 'get',
cache : 'false',
timeout : 30,
dateTpye : 'json',
}, function(ret, err) {
//coding...
api.hideProgress();
// alert(JSON.stringify(ret));
// alert( JSON.stringify( ret ) + JSON.stringify( err ) );
if (ret) {
var html = '';
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '现汇买入价 </div><div class="aui-list-item-right"><div class="aui-label aui-label-info bg">¥' + ret.result[0]['data' + t].fBuyPri + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '现钞买入价 </div><div class="aui-list-item-right"><div class="aui-label aui-label-info bg">¥' + ret.result[0]['data' + t].mBuyPri + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '现汇卖出价 </div><div class="aui-list-item-right"><div class="aui-label aui-label-warning bg">¥' + ret.result[0]['data' + t].fSellPri + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '现钞卖出价 </div><div class="aui-list-item-right"><div class="aui-label aui-label-warning bg">¥' + ret.result[0]['data' + t].mSellPri + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '银行折算价/中间价 </div><div class="aui-list-item-right"><div class="aui-label aui-label-success bg">¥' + ret.result[0]['data' + t].bankConversionPri + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '发布日期 </div><div class="aui-list-item-right"><div class="aui-label bg">' + ret.result[0]['data' + t].date + '</div>';
html += ' </div></li>';
//
html += '<li class="aui-list-item"><div class="aui-list-item-inner"><div class="aui-list-item-title">';
html += '发布时间 </div><div class="aui-list-item-right"><div class="aui-label bg">' + ret.result[0]['data' + t].time + '</div>';
html += ' </div></li>';
document.getElementById("html").innerHTML = html;
//动态内容显示
} else {
api.alert({
msg : ('错误码:' + err.code + ';错误信息:' + err.msg + '网络状态码:' + err.statusCode)
});
}
});
});
}
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment