123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- $(function(){
- postini();
- });
- function postini(){
- $.ajax({
- url : getRootPath() + "-s1api" + '/ini/getstyle',
- type : "POST", // 用POST方式传输
- contentType : "application/json; charset=utf-8",
- dataType : "Json",
- data: JSON.stringify(postiniDate()),
- success:
- function(msg) {
- var resCode = msg["resultCode"];
- if(resCode == "0000"){
- //var festival = msg["festival"];
- //theme(festival["title"], festival["icon"]);加载页面信息头,图标
- var productlist = msg["product"];
- for(var i=0,l=productlist.length;i<l;i++){
- $("#fog_"+productlist[i].url).attr("value",productlist[i].fog);
- var smslist = productlist[i].icon.split(",");
- for (var int = 0; int < smslist.length; int++) {
- if(int==0){
- $("#sendsms_order_"+productlist[i].url).attr("value",smslist[int]);
- }
- if(int==1){
- $("#sendsms_cancel_"+productlist[i].url).attr("value",smslist[int]);
- }
- if(int==2){
- $("#sendsms_yuyue_"+productlist[i].url).attr("value",smslist[int]);
- }
- }
- }
- }else{//未取出对应渠道与活动组数据
- goto404();
- }
-
- if (location.href.indexOf('/cancel') >= 0) {
- burypointLogId('110002');// 退订页面pv, pv去重得到uv
- } else if (location.href.indexOf('/draw') >= 0) {
- burypointLogId('110003');// 领取页面pv, pv去重得到uv
- } else if (location.href.indexOf('/flow') >= 0) {
- burypointLogId('110004');// 流量查询pv, pv去重得到uv
- } else if (location.href.indexOf('/active') >= 0) {
- burypointLogId('110005');// 激活页面pv, pv去重得到uv
- } else {
- // location.href.indexOf('/index') >= 0
- // location.href.indexOf('/order') >= 0
- burypointLogId('110001');// 订购页面pv, pv去重得到uv
- }
- },
- error:
- function(XMLHttpRequest, textStatus,errorThrown){//加载请求失败
- goto404();
- },
- });
- }
- function postiniDate() {
- var data = {
- fes : getUrlParam("fes"),
- sou : getUrlParam("sou"),
- };
- return data;
- }
- (function () {
- Date.prototype.from = function (dateString) {
- var pattern2 = /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/
- var str = dateString.replace(/-/g, '/');
- str = str.replace(pattern2, '$1/$2/$3 $4:$5:$6')
- return new Date(str)
- }
- // 对Date的扩展,将 Date 转化为指定格式的String
- // 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
- // 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
- // 例子:
- // (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
- // (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
- Date.prototype.format = function (fmt) { //author: meizz
- var o = {
- "M+": this.getMonth() + 1, //月份
- "d+": this.getDate(), //日
- "h+": this.getHours(), //小时
- "m+": this.getMinutes(), //分
- "s+": this.getSeconds(), //秒
- "q+": Math.floor((this.getMonth() + 3) / 3), //季度
- "S": this.getMilliseconds() //毫秒
- };
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
- for (var k in o)
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
- return fmt;
- }
- })();
- function getTodaySurplusMillis() {
- var time1 = new Date();
- var time2 = time1.from(time1.getFullYear() + '-' + (time1.getMonth() + 1) + '-' + time1.getDate() + ' 23:59:59');
-
- console.log(time2.getTime() - time1)
- return time2.getTime() - time1.getTime();
- }
- function burypointLogId(operid, remark, url) {
- var uuid = getCookie('uuid');// uv
- var vvid = getCookie('vvid');// vv
- if (uuid == null || uuid.trim() == '') {
- uuid = guid();
- setCookie('uuid', uuid, getTodaySurplusMillis());
- }
- if (vvid == null || vvid.trim() == '') {
- vvid = guid();
- setCookie('vvid', vvid, -1);
- }
- if (operid == null || operid == '') {
- // 页面的埋点不通过/burypoint/logid接口实现,通过文件日志入库方式
- return;
- }
- var param = {
- operid: operid,
- uuid: uuid,
- vvid: vvid,
- fog: getMemoValbyId('xx', 'fog'),//学习强国
- userid: '',
- fes: getUrlParam("fes"),
- sou: getUrlParam("sou"),
- url: encodeURIComponent(url||window.location.href),
- remark: encodeURIComponent(remark||'')
- }
- $.ajax({
- type: "POST",
- contentType: "application/json; charset=utf-8",
- dataType: "Json",
- url: getRootPath() + "-s1api" + '/burypoint/logid',//目标地址
- data: JSON.stringify(param),
- success: function () {},
- error: function () {},
- });
- }
- function getCookie(name) {
- var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
- if(arr=document.cookie.match(reg))
- return unescape(arr[2]);
- else
- return null;
- }
- /**
- * 如果没有设置时间
- */
- function setCookie(name, value, millis) {
- millis = (millis == undefined ? 0 : millis);
- var exp = new Date();
- if (millis < 0) {
- document.cookie = name + "=" + escape(value);
- } else {
- exp.setTime(exp.getTime() + millis);
- document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
- }
- }
- function guid() {
- return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
- var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
- return v.toString(16);
- });
- }
|