h5使用模块模板,循环输出模块列表
博主使用freemarker为框架,不过不影响功能的说明,首先来看看成品效果图
然后是html
[#import "/common/layout.ftl" as layout] [@layout.head title="支付页"]
<link rel="stylesheet" href="/assets/css/chrematistics/gaohuitongDeposit.css"> [/@layout.head] [@layout.body]
<div class="container funding--container">
<div id="title-msg" >
<div id ="rule-msg">
<img src="./assets/images/chrematistics/mark.png" />
<label class="mon1-detals">美国反洗钱法要求到账起60天内不可取款</label>
</div>
<div id ="card-msg">
<img src="./assets/images/chrematistics/pay_icon.png" />
<label class="mon1-detals">使用中国境内银行卡安全支付</label>
</div>
</div> <div id="bankcards" >
<lu class="bankcard-layout">
<li id={$bankinfoid} class={$display} value={$bankdata} >
<div class="bankcard-icon-div">
<img src={$bankcardIcon} />
</div>
<div class="column-info">
<p class="bank-name">{$name}</p>
<p class="bank-num">
{$number}
</p>
</div>
<div class="bankcard-goin-div">
<img id ="bankcard-goin" src="./assets/images/chrematistics/bankcard_right.png" />
</div>
</li>
</lu>
<div id="footer">
<div class="bankcard-item-add">
<img src="./assets/images/chrematistics/bankcard_pay_new.png" />
<span class="bank-add-msg">使用新卡</span>
</div>
</div>
</div>
</div>
<script src="../../project-h5/intoGold/js/zepto.min.js"></script>
<script src="../../project-h5/common/js/bridge.js"></script>
<script src="/assets/js/common/public.js"></script>
<script src="/assets/js/chrematistics/gaohuitongDeposit.js"></script>
[/@layout.body]
css:
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/ html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
th,
sub,
sup,
tt,
var,
b,
label,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin:;
padding:;
border:;
font-size: 100%;
font: inherit;
vertical-align: baseline;
} /* HTML5 display-role reset for older browsers */ article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
display: block;
} body {
line-height:;
} ol,
ul {
list-style: none;
} blockquote,
q {
quotes: none;
} blockquote:before,
blockquote:after,
q:before,
q:after {
content: '';
content: none;
} table {
border-collapse: collapse;
border-spacing:;
} * {
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
} hr {
border: none;
border-bottom: 1px solid #e4e5e7;
margin: 0.92308em 0;
} @media (min-width: 750px) {
hr {
margin: 3.07692em 0;
}
} html {
font-size: 13px;
} @media (min-width: 750px) {
html {
font-size: 14px;
}
} @media (min-width: 970px) {
html {
font-size: 16px;
}
} @media (min-width: 1170px) {
html {
font-size: 16px;
}
} body,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="range"],
input[type="search"],
input[type="tel"],
textarea,
select,
.checkbox,
.radio {
font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
color: #798088;
line-height: 1.5;
font-weight:;
-webkit-font-smoothing: antialiased;
} body {
background-color: #f8f8f9;
} ::-moz-selection {
background: #C0C8D2;
color: white;
} ::selection {
background: #C0C8D2;
color: white;
} .single-line {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
} b,
label,
strong,
th {
color: #60666c;
font-weight:;
} small {
font-size: 0.92308em;
color: #93999f;
} h1,
h2,
h3,
h4,
h5,
h6 {
color: #484c51;
line-height: 1.3;
margin-top: 1.07692em;
margin-bottom: 0.46154em;
-webkit-font-smoothing: subpixel-antialiased;
} h1.-no-top-spacing,
h2.-no-top-spacing,
h3.-no-top-spacing,
h4.-no-top-spacing,
h5.-no-top-spacing,
h6.-no-top-spacing {
margin-top:;
} h1 {
font-size: 1.84615em;
font-weight:;
color: #303336;
} h2 {
font-size: 1.38462em;
} h3 {
font-size: 1.23077em;
} h4 {
font-size: 1.07692em;
} h5 {
font-size: 1em;
} h6 {
font-size: 0.92308em;
text-transform: uppercase;
} @media (min-width: 750px) {
h1 {
font-size: 2.76923em;
}
h2 {
font-size: 2em;
}
h3 {
font-size: 1.69231em;
}
h4 {
font-size: 1.46154em;
}
h5 {
font-size: 1.23077em;
}
h6 {
font-size: 1.07692em;
text-transform: uppercase;
}
} p {
margin: 0.61538em 0;
} a {
color: #3FBA9A;
text-decoration: none;
font-weight:;
cursor: pointer;
} a:hover {
text-decoration: underline;
} ul,
ol {
margin: 0.61538em 0;
padding-left: 0.53846em;
} ul li {
list-style-type: disc;
margin: 0 0;
} ol li {
list-style-type: decimal;
margin: 0 0;
} code {
background-color: #f8f8f9;
border: 1px solid #ebebec;
padding: 0.30769em 0.46154em;
border-radius: 4px;
font-family: monospace;
font-size: 0.92308em;
color: #54595f;
} pre code {
display: block;
} pre {
margin: 0.92308em 0;
} input,
textarea,
keygen,
select,
button {
font-size: 1em;
} header {
background-color: #FEC109;
color: #fff;
position: relative;
} header .logo {
float: left;
text-indent: -9999px;
} header nav {
width: 100%;
width: calc(100% + 1.53846em);
margin-left: -0.76923em;
background-color: #e4ad08;
max-height:;
overflow: hidden;
-webkit-transition: 0.3s ease max-height;
transition: 0.3s ease max-height;
} header nav ul {
padding: 0.61538em 0;
margin:;
} header nav li {
margin:;
padding:;
} header nav a {
color: #fff4d4;
text-decoration: none;
font-size: 1.07692em;
display: block;
padding: 0.42857em 0.76923em;
text-align: center;
} header nav a.btn {
margin: 0.30769em 0.76923em;
width: auto;
} @media (min-width: 750px) {
header nav {
width: 100%;
margin:;
background-color: transparent;
max-height: none;
-webkit-transition: none;
transition: none;
position: absolute;
top:;
height: 4rem;
text-align: right;
}
header nav ul {
padding:;
}
header nav li {
display: inline-block;
line-height: 4rem;
}
header nav a {
font-size: 1em;
display: inline-block;
padding-top:;
padding-bottom:;
}
header nav a.btn {
margin:;
padding: 0.66667em 1.2em;
line-height: 1.5;
vertical-align: baseline;
}
} @media (min-width: 750px) {
header:after {
content: "";
display: table;
clear: both;
}
header .logo {
float: left;
}
header nav {
float: right;
}
} #title-msg {
width: 100%;
text-align: center;
} #rule-msg {
width: 100%;
height: auto;
padding: 15px 0;
font-size: 14px;
color: #666666;
background: #f2e2cb;
text-align: center;
margin: 0 auto;
} #rule-msg label {
vertical-align: middle;
font-size: 12px;
color: #f36d00;
} #rule-msg img {
height: 12px;
vertical-align: middle;
} #card-msg {
width: 100%;
padding: 15px 0;
font-size: 14px;
color: #666666;
text-align: center;
margin: 0 auto;
} #card-msg label {
vertical-align: middle;
font-size: 14px;
color: #666666;
} #card-msg img {
height: 18px;
vertical-align: middle;
} .bankcard-layout {
} #bankcard-item-default { } #bankcard-icon {
float: left;
width: 40px;
height: 40px;
padding-top: 22px;
} .column-info {
width: 76%;
height: auto;
text-align: left;
padding-top: 22px;
padding-bottom: 22px;
} #bankcard-goin {
float: right;
width: 12px;
padding-top: 22px;
} .horizontalcenter.show{
height: 100px;
width: 80%;
padding-right: 16px;
padding-left: 16px;
text-align: center;
margin: 0 auto;
background: -webkit-linear-gradient(left, #45bbff, #4da0fc);
border-radius: 10px;
margin-bottom: 20px; display: -moz-box;
display: -webkit-box;
display: -o-box;
display: box;
-moz-box-pack: justify;
-webkit-box-pack: justify;
-o-box-pack: justify;
box-pack: justify
} .horizontalcenter.hidden{
display: none;
} .bank-name{
color: #fff;
size: 15px;
padding-bottom: 6px;
margin-right: 30px;
margin-left: 12px;
border-bottom: 1px solid #fff;
}
.bank-num {
color: #fff;
size: 15px;
margin-left: 12px;
} .bankcard-item-add {
width: 80%;
height: 100px;
padding-right: 16px;
padding-left: 16px;
text-align: center;
margin: 0 auto;
background: #fff;
border-radius: 10px;
border: 1px solid #e4e5e7;
line-height: 100px;
} .bankcard-item-add img {
width: 6%;
display: inline-block;
position: relative;
top: 6px;
}
.bankcard-icon-div img{
width: 50px;
margin-top: 20px;
}
.bankcard-item-add p {
display: inline-block;
}
.bankcard-item-add span{
color: #009dff;
}
#footer{
margin-top: 20px;
}
js:
(function (window) {
//canvas and register
var bankcardItemAdd, bankcards, bankcardLayout, bankcardIcon, bankName, bankNum, userId, token,saveMoney, template,dataList; var parseDom = function () {
bankcardItemAdd = document.querySelector('.bankcard-item-add');//添加银行卡布局
bankcards = document.querySelector('.bankcards');//银行s卡栏 bankcardLayout = $(".bankcard-layout");//默认银行卡栏-带下边距
template = bankcardLayout.html(); userId = common.GetQueryString("userId");
token = common.GetQueryString("token");
saveMoney = common.GetQueryString("saveMoney");
} function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function () {
oldonload();
func();
}
}
} function btnEvent() {
bankcardItemAdd.addEventListener('tap', function (e) {
window.location.href = "/addBankCard?userId=" + userId + "&token=" + token;
});
} var getUserAssetInfo = function (event) {
var params = {
"data": JSON.stringify({
//构建数据
})
}
params.data = common.base64ecode(params.data);
$.ajax({
type: "post",
url: "//url",
data: params,
async: true,
success: function (data) {
if (!data) {
return;
} data = typeof(data) == "string" ? JSON.parse(data) : data;
if (data.header.respCode == 1) {
var form_list;
dataList = data.body.bankCardList;
template.replace(/\{\$display\}/gi, "horizontalcenter hidden");//设置模板class为隐藏的 for (key in dataList) {
form_list = template;
form_list = form_list.replace(/\{\$display\}/gi, "horizontalcenter show ");
form_list = form_list.replace(/\{\$bankinfoid\}/gi, "bankcard-item-default-"+key);
form_list = form_list.replace(/\{\$icon\}/gi, dataList[key].logoUrl);
form_list = form_list.replace(/\{\$name\}/gi, dataList[key].bankName);
form_list = form_list.replace(/\{\$number\}/gi, dataList[key].accountNo);
form_list = form_list.replace(/\{\$bankcardIcon\}/gi, dataList[key].logoUrl);
form_list = form_list.replace(/\{\$bankdata\}/gi, key); bankcardLayout.append(form_list);
var bankitem = document.getElementById('bankcard-item-default-'+key);
bankitem.addEventListener("tap",function(){
pay(this.getAttribute("value"));
},false);
}
document.getElementById('\{\$bankinfoid\}').setAttribute("style", "display:none");
} else {
alert(data.header.errorMsg)
}
},
error: function (e) {
alert("操作失败" + e); } })
} var pay = function (bankdata) {
//验证密码入口,打开Native代码
var t = dataList[bankdata];
var dataSend = {
"cmd": 'verifyLogined',
"time": new Date().getTime(),
"data": {
"dialogCheckBean": t,
"injectMoney":saveMoney
}
};
if (utilBridge !== undefined) {
utilBridge.send(dataSend, function (responseData) {
});
}
return;
} var toPayPag = function () {
window.location.href = "http://www.baidu.com";
} var bindListener = function () { bankcardItemAdd.addEventListener('tap', function (event) {
var e = event || window.event;
if (e.stopPropagation) {
e.stopPropagation();
} else {
e.cancelBubble = true;
}
if (verificationValue)
toPayPag();
}, false);
} var init = function () {
parseDom();
bindListener();
getUserAssetInfo();
addLoadEvent(btnEvent);//等到页面内包括图片的所有元素加载完毕后才能执行
}
init();
})(window);//在页面DOM文档加载完成后加载执行的,等效于$(document).ready(function(){...}); 优于window.onload
h5使用模块模板,循环输出模块列表的更多相关文章
- Flask初级(七)flash模板循环,判断
Project name :Flask_Plan templates:templates static:static 继续前面的代码 修改Flask_Plan.py @app.route('/') d ...
- fileinput模块可以循环一个或多个文本文件的内容
fileinput模块可以循环一个或多个文本文件的内容. [默认格式] fileinput.input (files=None, inplace=False, backup='', bufsize=0 ...
- Python基础、判断、循环、列表、字典,day1
一.Python 简介 1.介绍 Python 是一个高层次的结合了解释性.编译性.互动性和面向对象的脚本语言. Python 的设计具有很强的可读性,相比其他语言经常使用英文关键字,其他语言的一些标 ...
- Jquery制作--循环滚动列表
自己模仿JQ插件的写法写了一个循环滚动列表插件,支持自定义上.下.左.右四个方向,支持平滑滚动或者间断滚动两种方式,都是通过参数设置.JQ里面有些重复的地方,暂时没想到更好的方法去精简.不过效果还是可 ...
- 多行滚动jQuery循环新闻列表代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- discuz! X3.2 自定义后台门户模块模板里的标签
这里只提供对源码的修改, 至于插件, 暂不考虑... 想在首页里展示一些自定义字段的内容, 奈何dz无此功能, 无奈去扒源码. 首先切到 source 文件夹下 1. 在 class/block/po ...
- day2_python的数据类型,sys,os模块,编码解码,列表,字典
今天主要了解了python的数据类型,sys,os模块,编码解码,列表,字典 1.数据类型:int(python3没有长整型)文本总是Unicode,str表示二进制用byte类表示布尔型:True( ...
- python中循环删除列表中元素时的坑!
循环删除列表中元素时千万别用正序遍历,一定要用反序遍历! 废话不多说,先上案例代码: def test(data): for i in data: data.remove(i) return data ...
- for循环,列表,元组
依旧是python基础 for循环 s = 'woeudbwieb' for i in s:#s代表可迭代对象 print(i) if 'c' not in s: print('没有c') 列表 每个 ...
随机推荐
- 005-环境安装【docker、fabric】
1.参考地址:https://hyperledger-fabric.readthedocs.io/en/latest/prereqs.html#install-curl 一.前置条件和系统配置 1.安 ...
- google protobuf使用2
protobuf mutable_* 函数 从该函数的实现上来看,该函数返回指向该字段的一个指针.同时将该字段置为被设置状态. 若该对象存在,则直接返回该对象,若不存在则新new 一个.
- java反射基础知识(二)
1. 了解 Java 中的反射 1.1 什么是 Java 的反射 Java 反射是可以让我们在运行时获取类的函数.属性.父类.接口等 Class 内部信息的机制.通过反射还可以让我们在运行期实例化对象 ...
- 转:使用log4net完成程序异常日志记录(使用SQLite数据库记录和普通文本记录)
http://www.cnblogs.com/kyo-yo/archive/2010/06/11/use-log4net-to-log-exception.html 在前端时间开发的时候由于需要将异常 ...
- [笔记]WiX制作msi安装包的例子
WiX是制作msi安装文件的工具,看了半天文档,感觉没有什么比一个例子更简单粗暴的了. <?xml version="1.0" encoding="UTF-8&qu ...
- python+selenium+API
一.浏览器操作 1.浏览器最大化 driver.maximize_window() #将浏览器最大化显示 2.设置浏览器宽.高 driver.set_window_size(480, 800)#设置浏 ...
- gif 命令大全
git init # 初始化本地git仓库(创建新仓库) git config --global user.name "xxx" # 配置用户名 git config --glob ...
- 链接指示:extern "C"
C++程序有时需要调用其他语言编写的函数,最常见的是调用C语言编写的函数.像所有其他名字一样,其他语言中的函数名字也必须在C++中进行声明,并且该声明必须指定返回类型和形参列表.对于其他语言编写的函数 ...
- FTP vsftp 安装、管理
FTP简介 FTP是File Transfer Protocol(文件传输协议)的英文简称,而中文简称为文传协议,用户Internet上的控制文件的双向传输. FTP的主要作用,就是让用户链接上一个远 ...
- 配置zabbix_server通过zabbix_proxy进行监控Host
zabbix_server添加proxy并监控主机 zabbix分布式监控系统安装配置:http://www.cnblogs.com/LuckWJL/p/9037007.html 安装配置zabbix ...