|
@ -0,0 +1,132 @@
|
|
|
<!DOCTYPE html>
|
|
|
<html>
|
|
|
<head>
|
|
|
<meta charset="utf-8"/>
|
|
|
<meta name="author" content="yihu.com"/>
|
|
|
<meta name="format-detection" content="telephone=no"/>
|
|
|
<meta name="viewport"
|
|
|
content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
|
|
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
|
|
|
<title>热量搜索</title>
|
|
|
<link rel="stylesheet" href="../../../css/cross.css" type="text/css"/>
|
|
|
<link rel="stylesheet" href="../css/search-bar.css" type="text/css"/>
|
|
|
<script src="../../../../weixin_common.js"></script>
|
|
|
</head>
|
|
|
<body>
|
|
|
|
|
|
|
|
|
<div class="c-border-t c-border-b mt10 bgc-fff" id="categoryMsgBox">
|
|
|
<script id="categoryMainData" type="text/html">
|
|
|
<div class="category-box-head mlr10 ptb5">
|
|
|
<div><img src="{{photo | getPhoto}}" class="category-box-head-img"></div>
|
|
|
<div class="category-box-head-txt ml10">
|
|
|
<strong>{{name}}</strong>
|
|
|
<span class="pl10">以下食物相应份量含:</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="category-box-main c-border-t">
|
|
|
|
|
|
<div class="category-box-main-left">
|
|
|
<div>
|
|
|
{{each component as value i}}
|
|
|
{{i}}<span>{{value}}</span><i>+</i>
|
|
|
{{/each}}
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="category-box-center">
|
|
|
<img src="../images/denghao_icon.png" width="16" height="9">
|
|
|
</div>
|
|
|
<div class="category-box-right">
|
|
|
<span>{{hot}}</span>
|
|
|
千卡热量
|
|
|
</div>
|
|
|
</div>
|
|
|
</script>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<ul class="category-list-box" id="categoryListBox">
|
|
|
<script id="categoryTemplate" type="text/html">
|
|
|
{{each list as value i}}
|
|
|
<li class="category-list-item">
|
|
|
<div class="category-list-img"><img src="{{value.photo | getPhoto}}" alt=""></div>
|
|
|
<div class="category-list-txt">
|
|
|
<span class="line1">{{value.name}}</span>
|
|
|
<span class="line2">{{value.weight}}</span>
|
|
|
</div>
|
|
|
</li>
|
|
|
{{/each}}
|
|
|
</script>
|
|
|
</ul>
|
|
|
|
|
|
<script type="text/javascript" src="../../../js/jquery/2.1.3/jquery.js"></script>
|
|
|
<script src="../../../js/weixin_common.js"></script>
|
|
|
<script src="../../../js/template.js"></script>
|
|
|
<script src="../../../js/common_http.js" type="text/javascript" charset="utf-8"></script>
|
|
|
<script type="text/javascript">
|
|
|
// 初始化数据加载
|
|
|
function dataInit() {
|
|
|
var
|
|
|
$categoryListBox = $('#categoryListBox'),
|
|
|
$categoryMsgBox = $('#categoryMsgBox'),
|
|
|
Request = GetRequest(),
|
|
|
pid = Request["pid"],
|
|
|
data = {},
|
|
|
singleData = {},
|
|
|
pageTitle = '';
|
|
|
|
|
|
sendPost("common/health/food/list?pid=" + pid,data, "json", "post", operateFailed, operateSuccesss);
|
|
|
function operateSuccesss(res) {
|
|
|
var categoryData = res;
|
|
|
html = template('categoryTemplate', categoryData);
|
|
|
$categoryListBox.html(html);
|
|
|
|
|
|
|
|
|
var categoryList = window.localStorage.getItem('categoryList')
|
|
|
|
|
|
if (categoryList) {
|
|
|
categoryList = $.parseJSON(categoryList);
|
|
|
|
|
|
for (var i = 0; i < categoryList.length; i++) {
|
|
|
if(categoryList[i].id == pid){
|
|
|
singleData = categoryList[i];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
pageTitle = singleData.name;
|
|
|
singleData.component = $.parseJSON(singleData.component);
|
|
|
html = template('categoryMainData', singleData);
|
|
|
$categoryMsgBox.html(html)
|
|
|
updateTitle();
|
|
|
}
|
|
|
|
|
|
};
|
|
|
function operateFailed(res) {};
|
|
|
|
|
|
//修改header 的标题
|
|
|
function updateTitle(){
|
|
|
//需要jQuery
|
|
|
var $body = $('body');
|
|
|
document.title = pageTitle;
|
|
|
// hack在微信等webview中无法修改document.title的情况
|
|
|
var $iframe = $('<iframe src="/favicon.ico"></iframe>');
|
|
|
$iframe.on('load',function() {
|
|
|
setTimeout(function() {
|
|
|
$iframe.off('load').remove();
|
|
|
}, 0);
|
|
|
}).appendTo($body);
|
|
|
}
|
|
|
|
|
|
template.helper('getPhoto', function(str){
|
|
|
return getImgUrl(str);
|
|
|
})
|
|
|
}
|
|
|
dataInit();
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|