detail-dynamic.js
697 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* 动态获取页面数据
* @author liuchuanyang
* @date 2016/10/09
*/
var $ = require('yoho-jquery');
require('../common');
function getDynamicById(id) {
'use strict';
var param = {
id: id
};
// //guang.yohobuy.com/guang/info/detailData
return $.getJSON('/guang/info/detailData', param);
}
function renderData(data) {
'use strict';
if (data && data.code === 200 && data.data) {
$('.guang-detail-page .page-view').text(data.data.browseNum || 0);
}
}
function refreshData() {
'use strict';
var qs = window.queryString;
var id = qs.id || $('.detail').data('id');
getDynamicById(id).done(renderData);
}
refreshData();