-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
135 lines (115 loc) · 3.38 KB
/
Copy pathindex.js
File metadata and controls
135 lines (115 loc) · 3.38 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
"use strict";
var APICore = require('seedit-api');
var cAPI = APICore.scope('common');
function getSiteUrl(domain, host) {
host = host || document.location.host;
var tmp = host.split('.');
if (tmp.length >= 3) {
tmp = tmp.slice(1);
}
return ['//' + domain].concat(tmp).join('.');
};
var $footWrapHtml = $('<div class="g_footerWrap">'+
'<div class="g_footer">'+
'<div class="b_info clearfix">'+
'</div>'+
'</div>'+
'</div>');
//PC统一头部
var getPcHead = function () {
cAPI.get('cms/content', {type: 'block', id: '51872356327d5fe81f000024'},
function (d) {
$('body').prepend(d);
seajs.use(getSiteUrl('source') + '/common/js/global/common.min.js');
seajs.use(getSiteUrl('source') + '/common/js/common_nav.js');
},
function (e) {
console.log('ERROR LOAD PC HEAD',e);
}
);
};
exports.getPcHead = getPcHead;
//WAP头部
var getWapHead = function(){
cAPI.get('cms/content', {
type: 'block',
id: '5476d726a3c3b14d588b457e' //WAP_V2_头部内容
},
function(d) {
$('body').prepend(d);
cAPI.get('cms/content', {
type: 'block',
id: '54783a46a3c3b1a21d8b456f' //WAP_V2_头部脚本
},function(d){
$('body').append(d);
},function(e){
console.log('ERROR LOAD WAP SCRIPT IN getWapHead',e);
});
},
function(e) {
console.log('ERROR LOAD WAP CONTENT IN getWapHead',e);
}
);
};
exports.getWapHead = getWapHead;
//PC统一尾部信息
var getFooterInfo = function () {
cAPI.get('cms/content', {type: 'block', id: '51515b16327d5f037200004c'},
function (d) {
if(!!$('.g_footerWrap').length){
$('.g_footer .b_info').append(d);
}else{
//如果页面内没有<div class='g_footerWrap'></div>
$('body').append($footWrapHtml);
$('.g_footer .b_info').append(d);
}
},
function (e) {
console.log('ERROR LOAD PC FOOTER INFO',e);
}
);
};
exports.getFooterInfo = getFooterInfo;
//PC统一尾部版权
var getFooterCopyright = function () {
cAPI.get('cms/content', {type: 'block', id: '51c80fd4a3c3b10a51000000'},
function (d) {
if(!!$('.g_footerWrap').length){
$('.g_footer .b_info').after(d);
}else{
$('body').append($footWrapHtml);
$('.g_footer .b_info').after(d);
}
},
function (e) {
console.log('ERROR LOAD PC FOOTER COPYRIGHT',e);
}
);
};
exports.getFooterCopyright = getFooterCopyright;
//PC统一尾部脚本
var getFooterScript = function(){
cAPI.get('cms/content', {type: 'block', id: '5195949a327d5fe61f00003c'},
function (d) {
$('body').append(d);},
function (e) {
console.log('ERROR LOAD PC FOOTER SCRIPT',e);
}
);
};
exports.getFooterScript = getFooterScript;
exports.getPcBlocks = function () {
getPcHead();
getFooterInfo();
getFooterCopyright();
getFooterScript();
};
exports.getWapBlocks =function(){
getWapHead();
};
exports.getBlock = function(id,cb,ecb){
cAPI.get('cms/content', {type: 'block', id: id},
cb,
ecb
);
};