var client = {}
, ts = "?tt=" + Math.random()
;
client.staticUrl = 'http://jmystatic.vrjmy.com/'; // 正式库
client.hostname = '//' + location.hostname + '/';
if (client.hostname === '//dx.778878.net/') {
client.staticUrl = 'http://dxstatic.778878.net/'; // 测试库
}
var cbSave = localStorage.getItem('cbSave')
, u = localStorage.getItem('u')
, p = localStorage.getItem('p')
, nickname = localStorage.getItem('nickname')
, loginname = (nickname || u)
// , portrait = localStorage.getItem('portrait') ? client.staticUrl + localStorage.getItem('portrait') : client.hostname + 'static/img/touxiangICON.png'
, portrait = localStorage.getItem('portrait') ? localStorage.getItem('portrait') : client.hostname + 'static/img/touxiangICON.png'
, isLogin
, isLoginStr = '<div class="linkVIP"><i style="background: url(' + portrait + ts + ') no-repeat center;background-size: cover" class="touxiang">' +
'</i><span><a>' + loginname + '</a></span>' +
'<i class="icon iconfont icon-xiala"></i></div>' +
'<div class="drop-personal"><dl>' +
'<dd><a href="/member/personal.html">个人中心</a></dd>'
+ '<dd><a href="/member/order_details.html">我的订单</a></dd>'
+ '<dd><a href="/member/personal_my_points.html">积分购买</a></dd>'
+ '<dd><a href="/member/personal_my_news.html">积分提现</a></dd>'
+ '<dd><a href="/member/personal_my_details.html">我的明细</a></dd>'
+ '<dd><a href="/member/personal_my_address.html">地址管理</a></dd>'
+ '<dd><a id="dropOut" href="javascript:void(0);">退出登录</a></dd></dl></div>'
, DOC = document
, isLoginFalse='<a href=\'/member/login.html\'>登录</a><a href=\'/member/register.html\'>注册</a>'
;
//获取view/view_basic数据
function Detailed78(option, cb) {
var self = this,
content = $("#main78"),
set
;
self.setting = {
system: 'view' //当前微服务
, suffix: '_basic'
, cdnhost: 'http://dxstatic.778878.net/'
, load: true
, getstart: 1
, getnumber: 1000
, templateUrl: ''
};
set = self.setting = $.extend({}, this.setting, option);
set['cb'] = option.cb || cb;
content.load(set.templateUrl, function () {
if (cbSave) {
/*self.getData({
url: "api7817/ucenter/lovers",
m: "check"
, pars: [u, p]
, cb: function (data) {
// console.log(data);
if (data.back&&data.back.length >= 32) {*/
//self.publicHeaderScence('', '', "Logined");
setTimeout(function () {
$('.personal').html(isLoginStr);
$('.personal .linkVIP').click(function () {//防止重复点击事件的发生
window.location.href = 'member/personal.html';
});
$('#dropOut').on('click', function (e) {
e.preventDefault();
localStorage.clear();
localStorage.setItem("nickname", "游客");
localStorage.setItem("uname", "guest");
localStorage.setItem("sid", "GUEST888-8888-8888-8888-GUEST88GUEST");
localStorage.setItem("cid", "GUEST000-8888-8888-8888-GUEST00GUEST");
localStorage.setItem("coname", "测试帐套");
isLogin = false;
localStorage.setItem('isLogin', 'false');
// console.log("成功注销");
// 成功注销以后跳转到默认的首页
window.location.href = '/index.html';
});
isLogin = localStorage.getItem('isLogin') || true;
});
/* }
}
});*/
} else {
isLogin = false;
// self.publicHeaderScence('', '', isLoginFalse);
}
set.init(); // 页面初始化
if (set.load) { self.getData(set); }
});
}
// 获取数据的方式
/*
api78({
// 这些按需配置
m: 'get', // 后端方法
bcid: 'd4856531-e9d3-20f3-4c22-fe3c65fb009c',//
cid: '',
cols: ['all'],//返回哪些列['all']
ajaxtype: "GET",//GET POST // 调用方式
cache: 'random', //WEB缓存 空:全缓存 随机:不缓存 mid行缓存 bcid cid公司缓存 sid用户缓存
backpars: {},//回调传参
order: "idpk",//排序字段
uname: '',//用于报错
//jsonbase64: 1,//已默认 pars cols数组转为字符
jsonp: 0,//jsonp
// 这些一般接口都要配置,不过也看接口要求
url: '', // 接口url
pars: [], // 参数必须数组
mid: '', // guidnew78(),
getnumber: 1000, //获取多少行数据
getstart: 0, //从哪行开始
back: function (data) { // 回调
},
});
*/
// 获取服务的数据
Detailed78.prototype.getData = function (o) {
// console.log(o);
var self = this
, m = o.m || self.setting.m
, suffix = o.suffix || self.setting.suffix
, system = o.system || self.setting.system
, pars = o.pars || self.setting.pars || []
, mid = o.mid || self.setting.mid || ''
, getnumber = o.getnumber || self.setting.getnumber || 1000
, getstart = (o.getstart - 1 || self.setting.getstart - 1) * getnumber || 0
, url = o.url || "api7817/" + system + "/" + system + suffix
, gdOption = {
url: url
, m: m // 必传
, pars: pars
, mid: mid
, getnumber: getnumber //获取多少行数据
, getstart: getstart //从哪行开始
, back: function (data) {
o.cb(data); //回调中处理
}
};
if(o['log']){
console.log(gdOption);
}
api78(gdOption);
};
client.findParent = function (o, cn) {
var pn = o.parentNode,
p = pn.className.indexOf(cn) > -1;
if (p) {
return pn;
} else {
return client.findParent(pn, cn);
}
};
client.getUrlParam = function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return decodeURI(r[2]);
}
};
client.getCityName = function () {
var cityName
, myCity = new BMap.LocalCity().get(function (r) {
localStorage.setItem('currentCityName', r.name.replace("市", ''));
});
cityName = localStorage.getItem('currentCityName');
localStorage.removeItem('currentCityName');
return cityName;
};
//生成图片验证码code
//验证码的长度,图像控件
client.createCode = function (codeLength, $canvas) {
//canvas准备中
var ctx = $canvas.getContext('2d');
var width = $canvas.width;
var height = $canvas.height;
//清空画布
ctx.clearRect(0, 0, width, height);
//上背景色
ctx.fillStyle = "#f2f2f2";
ctx.fillRect(0, 0, width, height);
ctx.fillStyle = "#3297fd";
//初始化翻转值
var flip = 1;
ctx.font = "italic bolder 20px 'Arial'";
//清空code
var code = "";
//所有候选组成验证码的字符,当然也可以用中文的
var codeChars = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
//在数组中任意选择6个字
for (var i = 0; i < codeLength; i++) {
//获取数组中随机一个字
var charNum = Math.round(Math.random() * (codeChars.length - 1));
//将code累加
code += codeChars[charNum];
//描绘canvas
//翻转正负用于计算rotate
flip = i % 2 ? -1 : 1;
ctx.save();
ctx.rotate(Math.round(3 * Math.random()) * flip * Math.PI / 180);
ctx.fillText(codeChars[charNum], (width * (0.1 + 0.14 * i)), 22 + Math.round(8 * Math.random()));
ctx.restore();
}
return code;
}
// 验证表单
// 传入 wrapper 的对象 只要是包裹着的元素都可以,不一定是 form,
//input 的 name 一定要是对应的 datetime date time mobile email num znum maxnum minnum maxlength cus
// arr 是表示要教研哪些字段
client.validate = function (formObj, arr) {
var els = formObj.getElementsByTagName('input')
, len = arr.length
, current
, currentName
, currentValue
, i
;
for (i = 0; i < len; i++) {
current = els[arr[i]];
currentName = current.name;
currentValue = current.value;
// console.log(currentValue);
if (currentValue === '') {
return {
msg: 1
, rsp: currentName + "不能为空"
};
}
switch (currentName) {
/*case "cus":
if (value.test(currentValue)) {
return true;
}else{
return false;
}
break;*/
case "datetime":
if (!(/^(?:(?!0000)[0-9]{4}([-/.]?)(?:(?:0?[1-9]|1[0-2])([-/.]?)(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])([-/.]?)(?:29|30)|(?:0?[13578]|1[02])([-/.]?)31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-/.]?)0?2([-/.]?)29)\s(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$/.test(currentValue))) {
return {
msg: 1
, rsp: currentName + "输入有误"
};
}
break;
case "time":
if (!(/^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$/.test(currentValue))) {
return {
msg: 1
, rsp: currentName + "输入有误"
};
}
return false;
case "date":
if (!(/^(?:(?!0000)[0-9]{4}([-/.]?)(?:(?:0?[1-9]|1[0-2])([-/.]?)(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])([-/.]?)(?:29|30)|(?:0?[13578]|1[02])([-/.]?)31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-/.]?)0?2([-/.]?)29)$/.test(currentValue))) {
return {
msg: 1
, rsp: currentName + "输入有误"
};
}
break;
case "mobile":
if (!(/^1[3|4|5|7|8][0-9]\d{8}$/.test(currentValue))) {
return {
msg: 1
, rsp: currentName + "输入有误"
};
}
break;
case "email":
if (!(/^(\w)+(\.\w+)*@(\w)+((\.\w{2,3}){1,3})$/.test(currentValue))) {
return {
msg: 1
, rsp: currentName + "输入有误"
};
}
break;
case "znum"://整数
if (!(/^-?(\d+)$/.test(currentValue))) {
return {
msg: 1
, rsp: currentName + "输入有误"
};
}
break;
/*case "num":
if (/^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|\d+)$/.test(currentValue)) {
obj.val(parseFloat(obj.val()));
return true;
}else{
return false;
}
break;
case "maxnum":
if (currentValue > value) {
return false;
}
break;
case "minnum":
if (currentValue < value) {
return false;
}
break;
case "must":
if (value && currentValue === "") {
return false;
}
break;
case "maxlength":
if (currentValue.length > value) {
back = false;
return false;
}
break;
case "minlength":
if (currentValue.length < value) {
back = false;
return false;
}
break;*/
default:
break;
}
}
return {
msg: 2
, rsp: "通过检验"
};
};
// 图片要加 data-mp="decorate" 属性
client.ModifiedPicture = function (wrap) {
var DOC = document
, img = wrap.querySelectorAll('img[data-mp="decorate"]')
, len = img.length, i, current, pW, pH, imgW, imgH, currentStyle, currentSrc;
// console.log(len);
for (i = 0; i < len; i++) {
current = img[i];
currentSrc = current.src.split("https://dxstatic.778878.net/")[1];
if (currentSrc) {
currentStyle = current.style;
pW = parseInt(current.parentNode.clientWidth);
pH = parseInt(current.parentNode.clientHeight);
imgW = current.clientWidth;
imgH = current.offsetHeight;
if (i === 1) {
// console.log(imgW);
// console.log(imgH);
// console.log(pW);
// console.log(pH);
}
if (imgH > pH) {
currentStyle.height = "initial";
imgH = current.offsetHeight;
currentStyle.marginTop = (pH - imgH) / 2 + 'px';
} else {
currentStyle.height = pH + "px";
currentStyle.width = "initial";
imgW = current.clientWidth;
currentStyle.marginLeft = -(imgW - pW) / 2 + 'px';
}
currentStyle.opacity = 1;
}
}
};
/**
*
* 公共的方法
*
*/
// nav 导航点击切换active
Detailed78.prototype.navClick = function (param) {
$(param).on('click', function () {
$(this).addClass("active").siblings(".active").removeClass("active");
});
};
// 页面滑动 nav
Detailed78.prototype.suspensionAnchors = function (id) {
var d = document,
container = d.getElementById(id),
containerHeight = container.offsetHeight,
anchors = container.getElementsByTagName('a'),
anchorLen = anchors.length,
oT = getElementTop(container),
sT,
pageInit = false,
anchorsContainer = {}, // 每个锚点容器的高度
thisAttr,
thisAttrObject,
thisAttrOt,
thisActive,
isThisActive,
seat = {}, // 每个锚点容器的 offsetTop
seatArr = [],
i = 0,
tg,
oTlarge,
oTSmall,
nn,
active,
tgDataSeat
;
d.onscroll = function () {
if (pageInit) {
sT = d.body.scrollTop || d.documentElement.scrollTop;
go();
toActive(sT);
}
};
againGoTo();
// 监听点击
container.addEventListener("click", function (e) {
tg = e.target;
nn = tg.nodeName.toLocaleLowerCase();
active = container.getElementsByClassName("active");
if (nn === "a") {
if (active[0]) {
active[0].className = '';
}
tgDataSeat = tg.getAttribute("data-seat");
tg.className = "active";
window.scroll(0, seat[tgDataSeat]["ot"] - containerHeight);
}
}, false);
setTimeout(function () {
if (!pageInit) {
pageInit = true;
sT = d.body.scrollTop || d.documentElement.scrollTop;
go();
toActive(sT);
}
}, 10);
// 操作容器悬浮
function go() {
if (sT >= oT) {
container.setAttribute("data-suspend", "suspend");
container.parentNode.style.paddingTop = containerHeight + "px";
} else {
container.removeAttribute("data-suspend");
container.parentNode.style.paddingTop = "initial";
}
}
// 定位 container a 的 active
function toActive(st) {
for (i = 0; i < anchorLen; i++) {
thisActive = seatArr[i];
oTSmall = seat[thisActive]["ot"] - containerHeight;
oTlarge = oTSmall + anchorsContainer[thisActive]["oh"];
if (oTSmall <= st && st <= oTlarge) {
isThisActive = container.getElementsByClassName("active");
if (isThisActive[0]) {
isThisActive[0].className = '';
}
container.querySelector('[data-seat="' + thisActive + '"]').className = 'active';
}
}
}
function getElementTop(elem) {
var elemTop = elem.offsetTop;
elem = elem.offsetParent;
while (elem != null) {
elemTop += elem.offsetTop;
elem = elem.offsetParent;
}
return elemTop;
}
function againGoTo() {
oT = getElementTop(container);
seatArr = [];
// 遍历查找所有锚点的位置
for (i = 0; i < anchorLen; i++) {
thisAttr = anchors[i].getAttribute("data-seat");
seat[thisAttr] = {};
anchorsContainer[thisAttr] = {};
thisAttrObject = d.getElementById(thisAttr);
thisAttrOt = getElementTop(thisAttrObject);
anchorsContainer[thisAttr]["oh"] = thisAttrObject.offsetHeight;
seat[thisAttr]["ot"] = thisAttrOt;
seatArr.push(thisAttr);
}
}
return {
againGoTo: againGoTo
};
};
// 展示景区票劵的详情
Detailed78.prototype.showTicketDetail = function (o) {
var d = document,
container = d.getElementById(o.id), // 容器
doItTrigger = false, // 是否已经触发展示详情
line, // 展示的该行
linehasClass,
closeBtn,
lastLine,
lastTarget,
tg,
tgHasClass,
a
;
// 监听页面
container.addEventListener('click', function (e) {
tg = e.target;
tgHasClass = tg.className.indexOf('show-Detail') > -1;
closeBtn = tg.className.indexOf('pack-up-btn') > -1;
if (tgHasClass) {
// 该标题已经打开的了,再点击即会关闭
if (lastTarget === tg) {
lastLine.className = o.line;
lastLine = null;
lastTarget = null;
return;
}
// 点击该行关闭另外打开的行
if (lastLine) {
lastLine.className = o.line;
lastLine = null;
}
line = client.findParent(tg, o.line);
linehasClass = line.className.indexOf('active') > -1;
if (!linehasClass) {
line.className = o.line + ' active';
}
}
if (closeBtn) {
line.className = o.line;
}
lastTarget = tg;
lastLine = line;
}, false);
};
client.ispc = function() {
//平台、设备和操作系统
var system = {
win: false,
mac: false,
xll: false,
ipad: false
};
//检测平台
var p = navigator.platform;
system.win = p.indexOf("Win") == 0;
system.mac = p.indexOf("Mac") == 0;
system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
system.ipad = (navigator.userAgent.match(/iPad/i) != null) ? true : false;
if (system.win || system.mac || system.xll || system.ipad) {
return true;
} else {
return false;
}
}
// 地图
// Detailed78.prototype.createMap = function (options) {
client.createMap = function (options) {
// 百度地图定位你当前的位置
var ownPoint = {
lng: 113.351056,
lat: 23.125035
}, // 这个是我先默认的,要测试 保存数据库的就先保存这个就好,到时候会有动态的
size = 80
, isPc = client.ispc() ? true : ''
, w = {
mapId: "map", // 地图的 id
zoomStartSize: 17, // 初始化时候地图的缩放级别
changeZoomSize: 18, // 点击定位到自己时候的缩放级别
scopeId: "addressScope",
// 事件
click: isPc ? "click" : "touchstart",
move: isPc ? "mousemove" : "touchmove",
up: isPc ? "mouseup" : "touchend",
// 搜索
searchId: "search",
searchInputId: "searchInput",
addMk: true, // 是否有了遮罩物
address: "", // 店铺地址
parseErrorStr: "您的地址小度暂时找不到,请稍候再试!"
, onclickFn: ''
},
mk, // 初始化时候自己位置的覆盖物
circle
, map
, myGeo
;
extend(w, options);
map = new BMap.Map(w.mapId);
myGeo = new BMap.Geocoder(); // 创建一个地址解析器的实例
// 地图的一些设置
map.enableScrollWheelZoom(); // 启用滚轮放大缩小,默认禁用
map.enableContinuousZoom(); // 启用连续缩放效果,默认禁用
map.disableDoubleClickZoom(); // 禁用双击放大
// 初始化定位到自己
if (w.address !== null) {
myGeo.getPoint(w.address, function (point) {
circle = new BMap.Circle(point, size, {
strokeColor: "blue",
strokeWeight: "0",
strokeOpacity: "0",
fillColor: "#3385FF",
fillOpacity: .2
});
circle.disableMassClear();
map.addOverlay(circle);
location(w.address, point); // 输入框内容, point -> 经纬度
if(w.onclickFn&&typeof w.onclickFn === 'function'){
w.onclickFn(ownPoint);
}
});
}
var navigationControl = new BMap.NavigationControl();
map.addControl(navigationControl);
// 点击获取经纬度,类似于点击选址
var move = 0, // 用于判断用户是点击的还是拖动的操作
moveType = isPc ? 20 : 5;
map.addEventListener(w.click, function (e) {
move = 0;
});
map.addEventListener(w.move, function (e) {
move++;
});
map.addEventListener(w.up, function (e) {
if (move < moveType) {
var pt = e.point;
if (w.addMk) {
if (ownPoint.lng === pt.lng && ownPoint.lat === pt.lat) {
map.removeOverlay(mk); // 当点击位置和地图的覆盖物的位置一样的时候,从地图中移除覆盖物
w.addMk = false;
return;
} else {
ownPoint = pt;
}
}
if (!w.addMk) {
w.addMk = true;
ownPoint = pt;
}
map.clearOverlays(); // 从地图中移除覆盖物
mk = new BMap.Marker(pt);
map.addOverlay(mk); // 将覆盖物添加到地图中
if(w.onclickFn&&typeof w.onclickFn === 'function'){
w.onclickFn(ownPoint);
}
circle.setCenter(new BMap.Point(ownPoint.lng, ownPoint.lat));
map.panTo(ownPoint); // 将地图的中心点更改为给定的点, 也就是自己的位置
}
});
function extend(target, options) {
for (var name in options) {
target[name] = options[name];
}
return target;
}
// 搜索到具体位置
function location(v, point) {
var zoomSize = map.getZoom();
if (w.addMk) {
if (ownPoint.lng !== point.lng || ownPoint.lat !== point.lat) {
w.addMk = false;
}
} else if (!point) {
return;
}
map.removeOverlay(mk); // 从地图中移除覆盖物
map.centerAndZoom(point, zoomSize);
mk = new BMap.Marker(point);
map.addOverlay(mk);
map.panTo(point); // 将地图的中心点更改为给定的点,
ownPoint = point;
map.setZoom(w.changeZoomSize); // 更改缩放级别
circle.setCenter(new BMap.Point(ownPoint.lng, ownPoint.lat));
map.panTo(ownPoint); // 将地图的中心点更改为给定的点, 也就是自己的位置
}
// 签到范围
/*document.getElementById(w.scopeId).onchange = function () {
map.panTo(ownPoint); // 将地图的中心点更改为给定的点, 也就是自己的位置
size = Number(this.value);
circle.setRadius(size);
};*/
};
// 头部公共切换
Detailed78.prototype.headerSwitch = function () {
// 个人信息
var $personal = $('.personal') // 个人信息
, $dp = $('.drop-personal') // 个人信息下拉框容器
, $jmy = $("#jmy2")
, $dlWrap = $('.dl-wrap') //
;
$personal.on('mouseenter', function () {
$dp.addClass("active");
}).on('mouseleave', function (e) {
e.stopPropagation();
$dp.removeClass("active");
});
$jmy.on('mouseenter', function () {
$dlWrap.addClass("active");
});
// 检测鼠标移动,
$(document).on("mousemove", function (e) {
// e.stopPropagation();
// 判断鼠标是否在这两个上面,
// console.log($jmy.is(":hover"));
// console.log($dlWrap.is(":hover"));
if ($jmy.is(":hover") || $dlWrap.is(":hover")) {
$jmy.attr("data-hover", "active");
$dlWrap.addClass("active");
// console.log(1);
} else {
// console.log(2);
// console.log($jmy.is(":hover"));
// console.log($dlWrap.is(":hover"))
$jmy.attr("data-hover", "");
$dlWrap.removeClass("active");
}
});
};
// Village 头部公共切换
Detailed78.prototype.headerSwitchVillage = function () {
// 个人信息
var $personal = $('.personal') // 个人信息
, $dp = $('.drop-personal') // 个人信息下拉框容器
;
$personal.on('mouseenter', function () {
$dp.addClass("active");
}).on('mouseleave', function (e) {
e.stopPropagation();
$dp.removeClass("active");
});
};
// 公共头部
// param: dropIndex 下拉
Detailed78.prototype.publicHeader = function (index, dropIndex) {
var str = "<div class=\"wrapper header-con\"><div class=\"logo\">\n" +
" <a href=\"/index.html\"><img src=\"/static/img/jmy-pc/logo.png\"></a>\n" +
" </div><div class=\"header-nav usn\"><ul><li><div class=\"nav-line\">\n" +
" <a href=\"/index.html\">首页</a>\n" +
" </div></li><li id=\"jmy2\" data-hover=\"\" class=\"drop-list\"><div class=\"nav-line\">\n" +
" <a href=\"javascript:void(0);\">微时代 <i class=\"icon iconfont icon-xiala\"></i></a>\n" +
" </div></li><li><div class=\"nav-line\">\n" +
" <a href=\"/html17/goods/eye-homePage.html\">极目兑</a>\n" +
" </div></li><li><div class=\"nav-line\">\n" +
" <a href=\"/html17/specialty/hometown-index.html\">一县一品</a>\n" +
" </div></li></ul></div><div class=\"header-search\">\n" +
" <input type=\"text\" class=\"search-input\" placeholder=\"请输入\"><button class=\"search-btn icon iconfont icon-sousuo\"></button></div>\n" +
" <div class=\"personal\">" +
" <a href='/member/login.html'>登录</a>" +
" <a href='/member/register.html'>注册</a>" +
" <div class=\"drop-personal\">" +
"<dl id=\"loginInfoStr\"></dl></div></div></div><div class=\"dl-wrap\"><div class=\"wrapper\"><dl>\n" +
" <dd class=\"dl-w-video\"><a class=\"icon iconfont icon-vrshipindaohang\" href=\"/html17/vrgame/index.html\">VR艺术</a></dd>\n" +
" <dd class=\"dl-w-shot\"><a class=\"icon iconfont icon-jingqudaohang\" href=\"/html17/view/index.html\">景区</a></dd>\n" +
" <dd class=\"dl-w-hotel\"><a class=\"icon iconfont icon-jiudiandaohang\" href=\"/html17/hotel/hotel-home.html\">酒店</a></dd>\n" +
" <dd class=\"dl-w-cate\"><a class=\"icon iconfont icon-meishidaohang\" href=\"/html17/food/food-homePage.html\">美食</a></dd>\n" +
" </dl></div></div>";
document.getElementsByClassName('header')[0].innerHTML = str;
// loginInfoStr = $('#loginInfoStr');
this.headerSwitch();
this.navClick('.dl-wrap dd');
if (index) {
$('.header-nav ul li:eq(' + (index - 1) + ')').addClass('active').siblings('.active').removeClass('active');
}
if (dropIndex) {
$('.dl-wrap dl dd:eq(' + (dropIndex - 1) + ')').addClass('active').siblings('.active').removeClass('active');
}
};
// vr视屏的头部切换
Detailed78.prototype.publicHeaderVR = function (index, dropIndex) {
if(isLogin==false){
var str = "<div class=\"wrapper header-con\"><div class=\"logo\">\n" +
" <a href=\"/index.html\"><img src=\"/static/img/jmy-pc/logo.png\"></a>\n" +
" </div><div class=\"header-nav usn\">" +
"<ul>" +
"<li><div class=\"nav-line\"><a href=\"/index.html\">首页</a></div></li>" +
"<li data-hover=\"\"><div class=\"nav-line\"><a href=\"/html17/vrgame/index.html\">VR艺术</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/html17/goods/eye-homePage.html\">极目兑</a></div></li>" +
"</ul></div><div class=\"header-search\"><input type=\"text\" class=\"search-input\" placeholder=\"请输入\"><button class=\"search-btn icon iconfont icon-sousuo\"></button></div>\n" +
" <div class=\"personal\"><a href='/member/login.html'>登录</a><a href='/member/register.html'>注册</a></div></div>";
}else{
var str = "<div class=\"wrapper header-con\"><div class=\"logo\">\n" +
" <a href=\"/index.html\"><img src=\"/static/img/jmy-pc/logo.png\"></a>\n" +
" </div><div class=\"header-nav usn\">" +
"<ul>" +
"<li><div class=\"nav-line\"><a href=\"/index.html\">首页</a></div></li>" +
"<li data-hover=\"\"><div class=\"nav-line\"><a href=\"/html17/vrgame/index.html\">VR艺术</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/html17/goods/eye-homePage.html\">极目兑</a></div></li>" +
"</ul></div><div class=\"header-search\"><input type=\"text\" class=\"search-input\" placeholder=\"请输入\"><button class=\"search-btn icon iconfont icon-sousuo\"></button></div>\n" +
" <div class=\"personal\"></div></div>";
}
document.getElementsByClassName('header')[0].innerHTML = str;
if (index) {
$('.header-nav ul li:eq(' + (index - 1) + ')').addClass('active').siblings('.active').removeClass('active');
}
if (dropIndex) {
$('.dl-wrap dl dd:eq(' + (dropIndex - 1) + ')').addClass('active').siblings('.active').removeClass('active');
}
};
//公共头部,3月13更新头部内容
Detailed78.prototype.publicHeaderScence = function (index, dropIndex, isLogindes) {
if(isLogin==false){
var str = "<div class=\"wrapper header-con\"><div class=\"logo\">\n" +
" <a href=\"/index.html\"><img src=\"/static/img/jmy-pc/logo.png\"></a>\n" +
" </div><div class=\"header-nav usn\">" +
"<ul>" +
"<li><div class=\"nav-line\"><a href=\"/index.html\">首页</a></div></li>" +
"<li data-hover=\"\"><div class=\"nav-line\"><a href=\"/html17/view/index.html\">景区</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/html17/hotel/hotel-home.html\">酒店</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/html17/food/food-homePage.html\">美食</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/html17/goods/eye-homePage.html\">极目兑</a></div></li>" +
"</ul>" +
"</div><div class=\"header-search\"><input type=\"text\" class=\"search-input\" placeholder=\"请输入\"><button class=\"search-btn icon iconfont icon-sousuo\"></button></div>\n" +
"<div class=\"personal\"><a href='/member/login.html'>登录</a><a href='/member/register.html'>注册</a></div></div>";
}else{
var str = "<div class=\"wrapper header-con\"><div class=\"logo\">\n" +
" <a href=\"/index.html\"><img src=\"/static/img/jmy-pc/logo.png\"></a>\n" +
" </div><div class=\"header-nav usn\">" +
"<ul>" +
"<li><div class=\"nav-line\"><a href=\"/index.html\">首页</a></div></li>" +
"<li data-hover=\"\"><div class=\"nav-line\"><a href=\"/html17/view/index.html\">景区</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/html17/hotel/hotel-home.html\">酒店</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/html17/food/food-homePage.html\">美食</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/html17/goods/eye-homePage.html\">极目兑</a></div></li>" +
"</ul>" +
"</div><div class=\"header-search\"><input type=\"text\" class=\"search-input\" placeholder=\"请输入\"><button class=\"search-btn icon iconfont icon-sousuo\"></button></div>\n" +
"<div class=\"personal\"></div></div>";
}
document.getElementsByClassName('header')[0].innerHTML = str;
if (index == 1) {
$('.header-nav ul li:eq(' + (index - 1) + ')').addClass('active').siblings('.active').removeClass('active');
}
if (index == 2) {
$('.header-nav ul li:eq(' + (index - 1) + ')').addClass('active').siblings('.active').removeClass('active');
}
if (index == 3) {
$('.header-nav ul li:eq(' + (index - 1) + ')').addClass('active').siblings('.active').removeClass('active');
}
if (index == 4) {
$('.header-nav ul li:eq(' + (index - 1) + ')').addClass('active').siblings('.active').removeClass('active');
}
if (dropIndex) {
$('.dl-wrap dl dd:eq(' + (dropIndex - 1) + ')').addClass('active').siblings('.active').removeClass('active');
}
};
//提交,支付,支付成功等公共头部样式
Detailed78.prototype.publicHeaderPayment = function (index, dropIndex) {
if(isLogin==false){
var str = "<div class=\"wrapper header-con\"><div class=\"logo\">\n" +
" <a href=\"/index.html\"><img src=\"/static/img/jmy-pc/logo.png\"></a>\n" +
" </div>" +
"<div class=\"personal\"><a href='/member/login.html'>登录</a><a href='/member/register.html'>注册</a></div></div>";
}else{
var str = "<div class=\"wrapper header-con\"><div class=\"logo\">\n" +
" <a href=\"/index.html\"><img src=\"/static/img/jmy-pc/logo.png\"></a>\n" +
" </div>" +
"<div class=\"personal\"></div></div>";
}
document.getElementsByClassName('header')[0].innerHTML = str;
};
//极目兑作为为单独的模块切换头部,
Detailed78.prototype.publicHeaderGoods = function (index, dropIndex) {
if(isLogin==false){
var str = "<div class=\"wrapper header-con\"><div class=\"logo\">\n" +
" <a href=\"/index.html\"><img src=\"/static/img/jmy-pc/logo.png\"></a>\n" +
" </div><div style='margin: 0 136px;' class=\"header-nav usn\">" +
"<ul>" +
"<li><div class=\"nav-line\"><a href=\"/index.html\">首页</a></div></li>" +
"<li data-hover=\"\"><div class=\"nav-line\"><a style='width: 56px' href=\"/html17/vrgame/index.html\">VR艺术</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/html17/view/index.html\">微时代</a></div></li>" +
// "<li><div class=\"nav-line\"><a href=\"/html17/specialty/hometown-index.html\">一县一品</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/html17/goods/eye-homePage.html\">极目兑</a></div></li>" +
"</ul>" +
"</div><div class=\"personal\"><a href='/member/login.html'>登录</a><a href='/member/register.html'>注册</a></div></div>";
}else{
var str = "<div class=\"wrapper header-con\"><div class=\"logo\">\n" +
" <a href=\"/index.html\"><img src=\"/static/img/jmy-pc/logo.png\"></a>\n" +
" </div><div style='margin: 0 136px;' class=\"header-nav usn\">" +
"<ul>" +
"<li><div class=\"nav-line\"><a href=\"/index.html\">首页</a></div></li>" +
"<li data-hover=\"\"><div class=\"nav-line\"><a style='width: 56px' href=\"/html17/vrgame/index.html\">VR艺术</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/html17/view/index.html\">微时代</a></div></li>" +
// "<li><div class=\"nav-line\"><a href=\"/html17/specialty/hometown-index.html\">一县一品</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/html17/goods/eye-homePage.html\">极目兑</a></div></li>" +
"</ul>" +
"</div><div class=\"personal\"></div></div>";
}
document.getElementsByClassName('header')[0].innerHTML = str;
if (index == 4) {
$('.header-nav ul li:eq(' + (index - 1) + ')').addClass('active').siblings('.active').removeClass('active');
}
};
//首页的公共头部,3月13更新首页头部内容
Detailed78.prototype.publicHeaderIndex = function (index, dropIndex) {
if (isLogin == false) {
var str = "<div class=\"wrapper header-con\"><div class=\"logo\">\n" +
" <a href=\"/index.html\"><img src=\"/static/img/jmy-pc/logo.png\"></a>\n" +
" </div><div style='margin: 0 136px;' class=\"header-nav usn\">" +
"<ul>" +
"<li><div class=\"nav-line\"><a href=\"/index.html\">首页</a></div></li>" +
"<li data-hover=\"\"><div class=\"nav-line\"><a href=\"#Conpany-Info\">公司简介</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"#Shop-box\">商品中心</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/member/login.html\">会员中心</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/html17/goods/eye-homePage.html\">客服咨询</a></div></li>" +
"</ul>" +
"</div><div class=\"personal\"><a href='/member/login.html'>登录</a><a href='/member/register.html'>注册</a></div></div>";
}else{
var str = "<div class=\"wrapper header-con\"><div class=\"logo\">\n" +
" <a href=\"/index.html\"><img src=\"/static/img/jmy-pc/logo.png\"></a>\n" +
" </div><div style='margin: 0 136px;' class=\"header-nav usn\">" +
"<ul>" +
"<li><div class=\"nav-line\"><a href=\"/index.html\">首页</a></div></li>" +
"<li data-hover=\"\"><div class=\"nav-line\"><a href=\"#Conpany-Info\">公司简介</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/index.html\">商品中心</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/member/personal.html\">会员中心</a></div></li>" +
"<li><div class=\"nav-line\"><a href=\"/html17/goods/eye-homePage.html\">客服咨询</a></div></li>" +
"</ul>" +
" </div><div class=\"personal\"></div></div>";
}
$("header").eq(0).html(str);
//document.getElementsByClassName('header')[0].innerHTML = str;
this.headerSwitchVillage();
this.navClick('.dl-wrap dd');
};
//个人中心头部内容公共样式
Detailed78.prototype.publicHeaderVIP = function (index, dropIndex) {
if(isLogin==false){
var str = "<div class=\"wrapper header-con\"><div class=\"logo\">\n" +
" <a href=\"/index.html\"><img src=\"/static/img/jmy-pc/logo.png\"></a>\n" +
" </div><div class=\"header-nav usn\">" +
"<ul>" +
"<li data-hover=\"\"><div class=\"nav-line\"><a href=\"/index.html\">首页</a></div></li>" +
//"<li><div class=\"nav-line\"><a href=\"/html17/goods/eye-homePage.html\">极目兑</a></div></li>" +
"</ul></div><div class=\"personal\"><a href='/member/login.html'>登录</a><a href='/mmeber/register.html'>注册</a></div></div>";
}else{
var str = "<div class=\"wrapper header-con\"><div class=\"logo\">\n" +
" <a href=\"/index.html\"><img src=\"/static/img/jmy-pc/logo.png\"></a>\n" +
" </div><div class=\"header-nav usn\">" +
"<ul>" +
"<li data-hover=\"\"><div class=\"nav-line\"><a href=\"/index.html\">首页</a></div></li>" +
//"<li><div class=\"nav-line\"><a href=\"/html17/goods/eye-homePage.html\">极目兑</a></div></li>" +
"</ul></div><div class=\"personal\"></div></div>";
}
document.getElementsByClassName('header')[0].innerHTML = str;
if (index) {
$('.header-nav ul li:eq(' + (index - 1) + ')').addClass('active').siblings('.active').removeClass('active');
}
if (dropIndex) {
$('.dl-wrap dl dd:eq(' + (dropIndex - 1) + ')').addClass('active').siblings('.active').removeClass('active');
}
};
//极目乡情的公共部分的头部,没有景区,酒店,美食,娱乐,VR游戏等。作为单独的一个字模块
Detailed78.prototype.publicHeaderHomeTown = function (index) {
if(isLogin==false){
var str = "<div class=\"wrapper header-con\"><div class=\"logo\">\n" +
" <a href=\"/index.html\"><img src=\"/static/img/jmy-pc/logo.png\"></a>\n" +
" </div>" +
" <div class=\"header-nav usn clearfix\"><input class='fl' type='text' placeholder=''><button class='fl'>搜索</button></div>" +
" <div class=\"personal\"><a href='/member/login.html'>登录</a><a href='/member/register.html'>注册</a></div>" +
" </div>";
}else{
var str = "<div class=\"wrapper header-con\"><div class=\"logo\">\n" +
" <a href=\"/index.html\"><img src=\"/static/img/jmy-pc/logo.png\"></a>\n" +
" </div>" +
" <div class=\"header-nav usn clearfix\"><input class='fl' type='text' placeholder=''><button class='fl'>搜索</button></div>" +
" <div class=\"personal\"></div>" +
" </div>";
}
document.getElementsByClassName('header')[0].innerHTML = str;
// this.headerSwitch();
if (index) {
$('.header-nav ul li:eq(' + (index - 1) + ')').addClass('active').siblings('.active').removeClass('active');
}
};
//登录页面的头部login/login-index1.html
Detailed78.prototype.publicHeaderLogin = function () {
var str = '<div class="wrapper header-con"><div class="logo"><img src="/static/img/jmy-pc/logo.png"></div><div class="header-nav usn"><ul><li><div class="nav-line">' +
'<a href="/index.html">首页</a>' +
'<span></span></div></li><li id="jmy" data-hover="" class="drop-list"><div class="nav-line">' +
'<a href="javascript:void(0);">微时代<i class="icon iconfont icon-xiala"></i></a>' +
'<span></span></div></li><li><div class="nav-line">' +
//'<a href="/html17/goods/eye-homePage.html">极目兑</a>' +
'<span></span></div></li><li><div class="nav-line">' +
'<a href="/html17/specialty/hometown-index.html">一县一品</a>' +
'<span></span></div></li></ul></div>' +
'<div class="header-search">' +
'<input type="text" class="search-input" placeholder="请输入">' +
'<button class="search-btn icon iconfont icon-sousuo"></button></div>' +
'<div class="personal"><i class="icon iconfont icon-touxiang"></i><i class="icon iconfont icon-xiala"></i><div class="drop-personal"><dl>' +
'<dd><a href="javascript:void(0);">登陆</a></dd>' +
'</dl></div></div></div><div class="dl-wrap"><div class="wrapper"><dl>' +
'<dd class="dl-w-video"><a class="icon iconfont icon-vrshipindaohang" href="/html17/vrgame/index.html">VR艺术</a></dd>' +
'<dd class="dl-w-shot"><a class="icon iconfont icon-jingqudaohang" href="/html17/view/index.html">景区</a></dd>' +
'<dd class="dl-w-hotel"><a class="icon iconfont icon-jiudiandaohang" href="/html17/hotel/hotel-home.html">酒店</a></dd>' +
'<dd class="dl-w-cate"><a class="icon iconfont icon-meishidaohang" href="/html17/food/food-homePage.html">美食</a></dd>' +
// '<dd class="dl-w-game"><a class="icon iconfont icon-vryouxidaohang" href="javascript:void(0);">VR游戏</a></dd>' +
'</dl></div></div>';
document.getElementsByClassName('header')[0].innerHTML = str;
this.headerSwitch();
this.navClick('.header-nav ul li');
this.navClick('.dl-wrap dd');
};
// 公共脚步
Detailed78.prototype.publicFooter = function () {
var str = '<div class="footer-wrap"><ul class="footer-content">' +
'<li><a href="javascript:void(0);">关于我们</a></li>' +
'<li><a href="javascript:void(0);">帮助中心</a></li>' +
'<li><a href="javascript:void(0);">售后服务</a></li>' +
'<li><a href="javascript:void(0);">配送与验收</a></li>' +
'<li><a href="javascript:void(0);">商务合作</a></li>' +
'<li><a href="javascript:void(0);">企业采购</a></li>' +
'<li><a href="javascript:void(0);">开放平台</a></li>' +
'<li><a href="javascript:void(0);">搜索推荐</a></li>' +
'<li><a href="/html17/footer/footdever.html">开发者</a></li>' +
'</ul>' +
'<div class="copyright"> Copyright © 2018 微时代 dx.778878.com 版权所有</div></div>';
document.getElementsByClassName('footer')[0].innerHTML = str;
};
// 键盘事件
Detailed78.prototype.publicEnter = function (inputID, toURL) {
var $input = $(inputID)
, keyCode
, inputVal
, hasFocus
, headerSearch = $('.header-search')
, shInput
;
headerSearch.on('click', '.search-btn', function () {
shInput = headerSearch.find('input')[0].value;
if (shInput) {
window.location.href = toURL + inputVal + shInput;
}
});
document.onkeydown = function (e) {
keyCode = e.keyCode || window.event.keyCode;
if (keyCode === 13) {
inputVal = $input.val();
hasFocus = $input.is(":focus");
if (inputVal && hasFocus) {
window.location.href = toURL + inputVal;
}
}
};
};
client.isInclude = function (name){
var js= /js$/i.test(name)
, type = js?'script':'link'
, doc = document
, els= doc.getElementsByTagName(type)
, tagAttr = js ? 'src' : 'href'
, len = els.length
, i
;
for(i=0;i<len;i++){if(els[i][tagAttr].indexOf(name)!==-1){return true;}}
els = doc.createElement(type);
els[tagAttr] = name;
if(type==='link'){
els.rel="stylesheet";
}
doc.head.appendChild(els);
return false;
};
// 提示框
client.ToolTip = function (str, time) {
var toolTipDiv, ttw, tth, ttdStyle, t = time || 2000;
toolTipDiv = DOC.createElement("div");
toolTipDiv.innerHTML = str;
toolTipDiv.className = 'ToolTip fadeInCenter';
DOC.body.appendChild(toolTipDiv);
ttdStyle = toolTipDiv.style;
ttw = toolTipDiv.clientWidth;
tth = toolTipDiv.clientHeight;
ttdStyle.marginLeft = '-' + (ttw / 2) + 'px';
ttdStyle.marginTop = '-' + (tth / 2) + 'px';
setTimeout(function () { DOC.body.removeChild(toolTipDiv); }, t);
};
//优惠卷内容以及事件
//data优惠卷数据 price商品总价格 Sub优惠卷id conHtml价格展示位置 Box优惠卷按钮 conpon优惠金额位置 conZ优惠卷张数
client.Coupon = function (data, price, Sub, conHtml, Box, conpon, conZ) {
sessionStorage.removeItem(Sub)
if (!Box) {
Box = $('.preferTipBox_chose')
}
if (data == null || data == '') {
Box.html('<button style="color: #666;border: 1px solid #ccc" >暂无可用优惠券</button>');
conZ.html('0');//未使用的张数
return;
} else {
Box.html('<button style="color: #666;border: 1px solid #ccc" >选择优惠卷</button>');
}
$('body >.preferMask').remove();
str = '<div class="preferMask">'+
'<div class="zhizhao"></div>'+
'<div class="preferMaskTotal">'+
'<div class="preferMask_box">'+
'<h3 class="clearfix"><span class="fl">选择优惠券</span> <i class="fr icon iconfont icon-guanbi"></i></h3>'+
'<div class="preferPanel">'+
'<ul class="clearfix">'
html = ''
str2 = '</ul>'+
'</div>'+
'<p>以下不适用于此订单</p>'+
'<div class="preferPanelNone">'+
'<ul class="clearfix">'
html2 = ''
str3 = '</ul>'+
'</div>'+
'</div>'+
'<div class="preferTochoise">'+
'<a class="TochoiseTrue">确定</a>'+
'<a class="TochoiseFalse">取消</a>'+
'</div>'+
'</div>'+
'</div>';
for (var i = 0; i < data.length; i++) {
htmls = '<li class="fl"><input type="hidden" value="'+data[i].id+'">'+
'<i></i>'+
'<div class="nouse_box clearfix">'+
'<div class="nouse_boxL fl">'+
'<i>¥</i>'+
'<span>'+data[i].couponamount+'</span>'+
'</div>'+
'<div class="nouse_boxR fr">'+
'<p>满<a>'+data[i].fullamount+'</a>元可用</p>'+
'<span>'+data[i].starttime+'——'+data[i].endtime+'</span>'+
'</div>'+
'</div>'+
'<div class="nouse_box_des">'+
'<p>限新用户领取当限新用户领取当月使用限新用户领取当月使用月使用,可购买门票…</p>'+
'<i></i>'+
'</div>'+
'</li>'
//console.log(price)
if (data[i].fullamount <= price) {
html += htmls
//$('.preferPanel >ul').append(html)
} else {
html2 += htmls
//$('.preferPanelNone >ul').append(html)
}
}
var strHtml = str + html + str2 + html2 + str3
$('body').append(strHtml);
//优惠卷数量
conZ.html($('.preferPanel >ul >li').length)
//点击显示优惠卷
Box.find('button').click(function () {
$('.preferMask').show();
})
//事件弹框
//关闭
$('.preferMask_box h3 i').click(function () {
$('.preferMask').hide();
})
$('.TochoiseFalse').click(function () {
$('.preferMask').hide();
})
$('.preferMask >div').click(function () {
if ($(this).hasClass('zhizhao')) {
$('.preferMask').hide();
}
})
//点击选择哪个优惠券使用
$('.preferPanel ul li').click(function () {
if ($(this).hasClass('choise')) {
$(this).removeClass('choise');
sessionStorage.removeItem(Sub)
} else {
$(this).addClass('choise').siblings('li').removeClass('choise');
}
})
//点击确定选择使用哪个优惠券
$('a.TochoiseTrue').click(function () {
if ($('.choise').length >= 1) {
sessionStorage.setItem(Sub, $('.choise').children('input').val())
priceSub = $('.choise').children('.nouse_box').find('.nouse_boxL').children('span').html();
priceFull = $('.choise').children('.nouse_box').find('.nouse_boxR').children('p').children('a').html();
pr = Number(price * 100 - priceSub * 100) / 100
conHtml.html(pr)
if (conpon) {
conpon.html('-¥' + priceSub)
}
$('.preferTipBox_chose button').css({ 'color': '#FF7713', 'border': '1px solid #FF7713' }).html('满' + priceFull + '减' + priceSub + '');
} else {
conHtml.html(Number(price))
if (conpon) {
conpon.html('-¥0')
}
$('.preferTipBox_chose button').css({ 'color': '#666666', 'border': '1px solid #cccccc' }).html('未选择优惠卷');
}
$('.preferMask').hide();
});
//点击显示优惠券详细的内容
var flag1 = false;
$('.nouse_box_des i').click(function () {
if (!flag1) {
$(this).css({
'background': 'url(../../../static/img/jmy-perfe/wup.png) no-repeat center center',
'backgroundSize': 'cover'
})
$(this).parent().parent('li').css({
'background': 'url(../../../static/img/jmy-perfe/nouse2.png) no-repeat center center',
'backgroundSize': 'cover'
});
$(this).siblings('p').css({
'height': '36px',
'white-space': 'normal'
})
flag1 = !flag1;
} else {
$(this).css({
'background': 'url(../../../static/img/jmy-perfe/wdown.png) no-repeat center center',
'backgroundSize': 'cover'
})
$(this).parent().parent('li').css({
'background': 'url(../../../static/img/jmy-perfe/nouse1.png) no-repeat center center',
'backgroundSize': 'cover'
});
$(this).siblings('p').css({
'height': 'auto',
'white-space': 'nowrap'
});
flag1 = !flag1;
}
})
var flag2 = false;
$('.preferPanelNone .nouse_box_des i').click(function () {
if (!flag2) {
$(this).css({
'background': 'url(../../../static/img/jmy-perfe/gup.png) no-repeat center center',
'backgroundSize': 'cover'
})
$(this).parent().parent('li').css({
'background': 'url(../../../static/img/jmy-perfe/nouseL.png) no-repeat center center',
'backgroundSize': 'cover'
});
$(this).siblings('p').css({
'height': '36px',
'white-space': 'normal'
})
flag2 = !flag2;
} else {
$(this).css({
'background': 'url(../../../static/img/jmy-perfe/gdown.png) no-repeat center center',
'backgroundSize': 'cover'
})
$(this).parent().parent('li').css({
'background': 'url(../../../static/img/jmy-perfe/nouse.png) no-repeat center center',
'backgroundSize': 'cover'
});
$(this).siblings('p').css({
'height': 'auto',
'white-space': 'nowarp'
});
flag2 = !flag2;
}
});
}
//侧边导航栏 clas插入的固定位置
client.Sidebar = function (clas) {
var html
, host = client.hostname
, img = '/html17/download/code-test.jpg'
, f = '/html17/download/filepath.png'
;
if(host==='//dx.778878.net/'){
img = '/html17/download/code-test-fw.jpg';
f = '/html17/download/filepath-fw.png';
}
html = '<div class="sidebar">' +
'<div>' +
'<span></span>' +
'</div>' +
// 验证码
'<div class="sidebar-yzm">' +
'<span></span>' +
'<div class="sid-posi">' +
'<div class="sid-img">' +
'<img src="' + f + '" />' +
'<p>微时代APP</p>' +
'</div>' +
'<div class="sid-img">' +
'<img src="'+img+'" />' +
'<p>微时代公众号</p>' +
'</div>' +
'</div>' +
'</div>' +
// 用户建议
'<div class="threebox">'+
'<span></span>' +
'<div class="sidebar-yhjy">'+
// '<span id="guanbi"></span>'+
'<p>建议版块 </p>'+
'<span>VR艺术</span>'+
'<span>景区</span>'+
'<span>酒店</span>'+
'<span>美食</span>'+
'<span>极目兑</span>'+
'<p>建议内容</p>'+
'<textarea placeholder="请输入您想说的建议"></textarea>'+
'<button id="btn">提交</button>'+
'</div>'+
'</div>'+
'<div class="sidebar-yzm">' +
'<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=78941523&site=qq&menu=yes">'+
'<span></span>' +
'<a class="sid-kefu">' +
'<p>' +
'<span></span>' +
'<span>客服1:</span>' +
'<span>7894 1523</span>' +
'</p>' +
'<p>' +
'<span></span>' +
'<span>客服2:</span>' +
'<span>7894 1523</span>' +
'</p>' +
'</a>' +
'</a>'+
'</div>' +
'</div>'
$('body').append(html)
Click()
//位置
var wid = Width()
$('.sidebar').css({ 'left': wid })
//导航条位置
$(window).scroll(function () {
var wh = document.documentElement.scrollHeight - $(window).scrollTop();
if (wh <= 1220) {
if (!$('.sidebar').hasClass('sidebar-main')) {
$('.sidebar').remove()
clas.css('position')
if (clas.css('position') == 'static') {
clas.css({ 'position': 'relative' })
}
clas.append(html)
Click()
$('.sidebar').addClass('sidebar-main')
}
} else {
$('.sidebar').remove()
wid = Width()
$('body').append(html)
Click()
$('.sidebar').css({ 'left': wid })
}
})
//窗口变化
$(window).resize(function () {
wid = Width()
if (!$('.sidebar').hasClass('sidebar-main')) {
$('.sidebar').css({ 'left': wid })
}
});
function Width() {
var s = (Number($('body').width()) - 1200) / 2 + 1200 + 10
if (s < 1210) {
s = 1210
}
return s;
}
// 如果scrollTop == 0 返回顶部就隐藏 大于0 就显示
$('.sidebar >div:eq(0)').css({display:'none'});
$('.sidebar >div:eq(1)').css({borderTop:'1px solid #e5e5e5'});
$(window).scroll(function(){
var scrollTop=$(window).scrollTop();
// console.log(scrollTop)
if(scrollTop == 0){
$('.sidebar >div:eq(0)').css({display:'none'});
$('.sidebar >div:eq(1)').css({borderTop:'1px solid #e5e5e5'});
}else if(scrollTop > 0){
$('.sidebar >div:eq(0)').css({display:'block'});
$('.sidebar >div:eq(1)').css({borderTop:'none'});
}
})
function Click() {
$('.sidebar >div:eq(0)').mouseover(function () {
$('.sidebar >div:eq(0) >span').addClass('Sid-span').html('返回顶部')
})
$('.sidebar >div:eq(0)').mouseout(function () {
$('.sidebar >div:eq(0) >span').removeClass('Sid-span').html('')
})
// // 二维码
$('.sidebar >div:eq(1)').mouseover(function () {
$('.sidebar >div:eq(1) >span').css({background:'#4A90E2',color:'#fff'})
})
$('.sidebar >div:eq(1)').mouseout(function () {
$('.sidebar >div:eq(1) >span').css({background:'#fff',color:'#a9a9a9'})
})
// 用户建议
$('.sidebar >div:eq(2)').mouseover(function () {
$('.sidebar-yhjy').css({display:'block'});
$('.sidebar >.threebox >span').addClass('Sid-span').html('用户建议');
})
$('.sidebar>div:eq(2)').mouseout(function () {
$('.sidebar >.threebox >span').removeClass('Sid-span').html('');
$('.sidebar-yhjy').css({display:'none'});
$('.sidebar-yhjy >textarea').val('');
})
$('.sidebar >.threebox').on('click','span', function(){
$(this).addClass('active').siblings().removeClass('active');
})
$('.sidebar >div:eq(0)').click(function () {
$('body,html').animate({
scrollTop: 0
}, 100);
})
// 用户建议
$('.sidebar-yhjy ').on('click','#btn',function(){
if($('.sidebar-yhjy > textarea').val()==''){
client.ToolTip('请输入您的宝贵的建议\(^o^)/~');
return;
}
api78({
url:'api7817/ucenter/lovers_advise'
, m:'add'
, pars:['Windows',$('.sidebar-yhjy >.active').text(),$('.sidebar-yhjy > textarea').val()]
,back:function(data){
console.log(data);
if(data.code == 200){
client.ToolTip("添加成功");
$('.sidebar-yhjy').css({display:'none'})
}
}
})
})
}
}
//获取日期 num : -1昨天 0今天 1明天 time:获取天数 -10前 10后
client.obtainNew = function (num,time) {
if (time) {
var timeNum = time;
var timeArr = [];
if (time < 0) {
Arr(timeNum)
function Arr(timeNum) {
if (timeNum > 0) {
return;
}
timeArr.push(GetDateStr(timeNum))
timeNum++
Arr(timeNum)
}
}
if (time > 0) {
Arr(timeNum)
function Arr(timeNum) {
console.log(timeNum)
if (timeNum < 0) {
return;
}
timeArr.unshift(GetDateStr(timeNum))
timeNum--
Arr(timeNum)
}
}
return timeArr;
} else {
return GetDateStr(num)
}
function GetDateStr(nums) {
var dd = new Date();
dd.setDate(dd.getDate() + nums);//获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1;//获取当前月份的日期
if (m < 10) {
m = '0' + m
}
var d = dd.getDate();
if (d < 10) {
d = '0' + d
}
if (time) {
return m + "-" + d;
} else {
return y + "-" + m + "-" + d;
}
}
}
//日历插入位置location style="display: block;"
//日历日期展示true==val() false == html() valHtml
//日历日期展示true==当前日期 false==选定日期 newTime
//二次调用对象
//二次时间判断对象
//单双日期true--false
//回调
//日历--酒店
client.rili = function (location, valHtml, newTime, locationSid, locaTime, num, call) {
rili(location, valHtml, newTime, locationSid, locaTime, num, call)
function rili(location, valHtml, newTime, locationSid, locaTime, num, call) {
if (newTime) {
var dd = new Date();
var y = dd.getFullYear();
var m = dd.getMonth() + 1;//获取当前月份的日期
var d = dd.getDate();
} else {
var Time = locaTime.val();
//日历
var dd = Time.split('-');
var y = Number(dd[0]);
var m = Number(dd[1]);
var d = Number(dd[2]);
}
str = ` <div class="menology-box">
<i class="month-left"></i>
<i class="month-right"></i>
<div class="menology">
<div class="meno-top">
<div class="meno-month">
<span>月</span>
</div>
<div class="meno-year">
<span>年</span>
</div>
</div>
<div class="meno-week clear">
<span>日</span>
<span>一</span>
<span>二</span>
<span>三</span>
<span>四</span>
<span>五</span>
<span>六</span>
</div>
<div class="meno-days">
<ul class="clear"></ul>
</div>
</div>
<div class="menology">
<div class="meno-top">
<div class="meno-month">
<span>月</span>
</div>
<div class="meno-year">
<span>年</span>
</div>
</div>
<div class="meno-week clear">
<span>日</span>
<span>一</span>
<span>二</span>
<span>三</span>
<span>四</span>
<span>五</span>
<span>六</span>
</div>
<div class="meno-days">
<ul class="clear"></ul>
</div>
</div>
</div>`
if ($('.menology-box').length < 1) {
$('body').append(str)
}
var box = $('.menology-box')
box.show();
var boxTop = location.offset().top + location.height() + 5
var boxLeft = location.offset().left
console.log(boxTop, boxLeft)
var Dy = y //当前年
var Dm = m //当前月
var Dd = d //当前日
//当前月和年
menolog(y, m, d, $('.meno-days >ul:eq(0)'), true, 0)
//下个月或者年
var xm = m + 1;//下月 --
var xy = y
if (xm == 13) {
xy = y + 1
xm = 1
}
menolog(xy, xm, d, $('.meno-days >ul:eq(1)'), false, 1)
function menolog(Year, Month, Day, loca, judge, num) {
locad(Year, Month, num)
loca.html('');
var month = Month
var year = Year
var da = 1;
var riqi = year + '-' + month + '-' + da;
var arys1 = new Array();
arys1 = riqi.split('-'); //日期为输入日期,格式为 2013-3-10
var ssdate = new Date(arys1[0], parseInt(arys1[1] - 1), arys1[2]);
var week = ssdate.getDay() //就是你要的星期几
console.log(week)
for (var i = week; i > 0; i--) {
var li = '<li></li>';
loca.prepend(li);
}
if (month == 2) {
if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {
//console.log('闰年')
days = 29;
} else {
// console.log('普通')
days = 28;
}
} else if (month == 4 || month == 6 || month == 9 || month == 11) {
days = 30;
} else {
days = 31
}
if (judge) {
for (var i = 1; i <= days; i++) {
if (i < Day) {
var li = '<li class="color-active" name=' + Year + '-' + Month + '-' + i + '>' + i + '</li>'
}
if (i == Day) {
var li = '<li class="days-active" name=' + Year + '-' + Month + '-' + i + '>' + i + '</li>'
}
if (i > Day) {
var li = '<li name=' + Year + '-' + Month + '-' + i + '>' + i + '</li>'
}
loca.append(li);
}
} else {
for (var i = 1; i <= days; i++) {
var li = '<li name=' + Year + '-' + Month + '-' + i + '>' + i + '</li>'
loca.append(li);
}
}
for (var i = 0; i < $('.meno-days >ul >li').length; i++) {
if ($('.meno-days >ul >li').eq(i).attr('name') == location.val()) {
$('.meno-days >ul >li').eq(i).addClass('days-active')
}
}
//if (num==0) {
// if ($('.days-active').length >= 2) {
// $('.days-active').eq(0).removeClass('days-active')
// }
//}
if (locationSid) {
if ($('.days-active').length >= 2) {
$('.days-active').eq(0).removeClass('days-active')
}
} else {
if ($('.days-active').length >= 2) {
$('.days-active').eq(0).nextAll('li').addClass('days-suer')
$('.days-active').eq(1).prevAll('li').addClass('days-suer')
$('.days-active').eq(0).prevAll('li').removeClass('days-suer')
$('.days-active').eq(1).nextAll('li').removeClass('days-suer')
}
}
}
//月份左右按键
//左
$('.month-left').click(function () {
if ((Dm > m && Dy == y) || Dy > y) {
Dm = Dm - 1;//下月
Dy = Dy
if (Dm == 0) {
Dy = Dy - 1
Dm = 12
}
if (Dm == m && Dy == y) {
menolog(Dy, Dm, d, $('.meno-days >ul:eq(0)'), true, 0)
} else {
menolog(Dy, Dm, d, $('.meno-days >ul:eq(0)'), false, 0)
}
//下个月或者年
var xm = Dm - 1;//下月 --
var xy = Dy
if (xm == 0) {
xy = Dy - 1
xm = 12
}
menolog(xy, xm, d, $('.meno-days >ul:eq(1)'), false, 1)
}
clickTime()
})
//右
$('.month-right').click(function () {
Dm = Dm + 1;//下月
Dy = Dy
if (Dm == 13) {
Dy = Dy + 1
Dm = 1
}
menolog(Dy, Dm, d, $('.meno-days >ul:eq(0)'), false, 0)
//下个月或者年
var xm = Dm + 1;//下月 --
var xy = Dy
if (xm == 13) {
xy = Dy + 1
xm = 1
}
menolog(xy, xm, d, $('.meno-days >ul:eq(1)'), false, 1)
clickTime()
})
function locad(ys, ms, num) {
$('.meno-month:eq(' + num + ') >span').html(ms + '月');
$('.meno-year:eq(' + num + ') >span').html(ys + '年')
}
clickTime()
function clickTime() {
//选择时间
$('.meno-days >ul >li').click(function () {
if ($(this).hasClass('days-active')) {
return;
}
$(this).addClass('suer-active')
var dd = $('.suer-active').attr('name')
console.log(dd)
if (locationSid) {
var ddTime = new Date(dd)
var dsTime = new Date(locationSid.val())
if (ddTime < dsTime) {
var ds = locationSid.val()
} else {
var ds = getNextDay(dd)
}
}
$('.menology-box').hide();
if (valHtml) {
location.val(dd)
if (locationSid) {
locationSid.val(ds)
rili(locationSid, valHtml, false, false, location)
}
} else {
location.html(dd)
if (locationSid) {
locationSid.html(ds)
rili(locationSid, valHtml, false, false, location)
}
}
if (call) {
call()
}
})
function getNextDay(d) {
d = new Date(d);
d = +d + 1000 * 60 * 60 * 24;
d = new Date(d);
//return d;
//格式化
return d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate();
}
}
box.css({ 'top': boxTop, 'left': boxLeft })
}
//if (newTime) {
// var dd = new Date();
// var y = dd.getFullYear();
// var m = dd.getMonth() + 1;//获取当前月份的日期
// var d = dd.getDate();
//} else {
// var Time = locaTime.val();
// //日历
// var dd = Time.split('-');
// var y = Number(dd[0]);
// var m = Number(dd[1]);
// var d = Number(dd[2]);
//}
//str = '<div class="menology-box">'+
// '<i class="month-left"></i>'+
// '<i class="month-right"></i>'+
// '<div class="menology">'+
// '<div class="meno-top">'+
// '<div class="meno-month">'+
// '<span>月</span>'+
// '</div>'+
// '<div class="meno-year">'+
// '<span>年</span>'+
// '</div>'+
// '</div>'+
// '<div class="meno-week clear">'+
// '<span>日</span>'+
// '<span>一</span>'+
// '<span>二</span>'+
// '<span>三</span>'+
// '<span>四</span>'+
// '<span>五</span>'+
// '<span>六</span>'+
// '</div>'+
// '<div class="meno-days">'+
// '<ul class="clear"></ul>'+
// '</div>'+
// '</div>'+
// '<div class="menology">'+
// '<div class="meno-top">'+
// '<div class="meno-month">'+
// '<span>月</span>'+
// '</div>'+
// '<div class="meno-year">'+
// '<span>年</span>'+
// '</div>'+
// '</div>'+
// '<div class="meno-week clear">'+
// '<span>日</span>'+
// '<span>一</span>'+
// '<span>二</span>'+
// '<span>三</span>'+
// '<span>四</span>'+
// '<span>五</span>'+
// '<span>六</span>'+
// '</div>'+
// '<div class="meno-days">'+
// '<ul class="clear"></ul>'+
// '</div>'+
// '</div>'+
// '</div>'
//if ($('.menology-box').length < 1) {
// $('body').append(str)
//}
//var box = $('.menology-box')
//box.show();
//var boxTop = location.offset().top + location.height() + 5
//var boxLeft = location.offset().left
////console.log(boxTop, boxLeft)
//var Dy = y //当前年
//var Dm = m //当前月
//var Dd = d //当前日
////当前月和年
//menolog(y, m, d, $('.meno-days >ul:eq(0)'), true, 0)
////下个月或者年
//var xm = m + 1;//下月 --
//var xy = y
//if (xm == 13) {
// xy = y + 1
// xm = 1
//}
//menolog(xy, xm, d, $('.meno-days >ul:eq(1)'), false, 1)
//function menolog(Year, Month, Day, loca, judge, num) {
// locad(Year, Month, num)
// loca.html('');
// var month = Month
// var year = Year
// var da = 1;
// var riqi = year + '-' + month + '-' + da;
// var arys1 = new Array();
// arys1 = riqi.split('-'); //日期为输入日期,格式为 2013-3-10
// var ssdate = new Date(arys1[0], parseInt(arys1[1] - 1), arys1[2]);
// var week = ssdate.getDay() //就是你要的星期几
// //console.log(week)
// for (var i = week; i > 0; i--) {
// var li = '<li></li>';
// loca.prepend(li);
// }
// if (month == 2) {
// if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {
// //console.log('闰年')
// days = 29;
// } else {
// // console.log('普通')
// days = 28;
// }
// } else if (month == 4 || month == 6 || month == 9 || month == 11) {
// days = 30;
// } else {
// days = 31
// }
// if (judge) {
// for (var i = 1; i <= days; i++) {
// if (i < Day) {
// var li = '<li class="color-active" name=' + Year + '-' + Month + '-' + i + '>' + i + '</li>'
// }
// if (i == Day) {
// var li = '<li class="days-active" name=' + Year + '-' + Month + '-' + i + '>' + i + '</li>'
// }
// if (i > Day) {
// var li = '<li name=' + Year + '-' + Month + '-' + i + '>' + i + '</li>'
// }
// loca.append(li);
// }
// } else {
// for (var i = 1; i <= days; i++) {
// var li = '<li name=' + Year + '-' + Month + '-' + i + '>' + i + '</li>'
// loca.append(li);
// }
// }
// for (var i = 0; i < $('.meno-days >ul >li').length; i++) {
// if ($('.meno-days >ul >li').eq(i).attr('name') == location.val()) {
// $('.meno-days >ul >li').eq(i).addClass('days-active')
// }
// }
// if (locationSid) {
// if ($('.days-active').length >= 2) {
// $('.days-active').eq(0).removeClass('days-active')
// }
// } else {
// if ($('.days-active').length >= 2) {
// $('.days-active').eq(0).nextAll('li').addClass('days-suer')
// $('.days-active').eq(1).prevAll('li').addClass('days-suer')
// $('.days-active').eq(0).prevAll('li').removeClass('days-suer')
// $('.days-active').eq(1).nextAll('li').removeClass('days-suer')
// }
// }
// if (num) {
// if ($('.days-active').length >= 2) {
// $('.days-active').eq(0).removeClass('days-active')
// $('.days-suer').removeClass('days-suer')
// }
// }
//}
////月份左右按键
////左
//$('.month-left').click(function () {
// if ((Dm > m && Dy == y) || Dy > y) {
// Dm = Dm - 1;//下月
// Dy = Dy
// if (Dm == 0) {
// Dy = Dy - 1
// Dm = 12
// }
// if (Dm == m && Dy == y) {
// menolog(Dy, Dm, d, $('.meno-days >ul:eq(0)'), true, 0)
// } else {
// menolog(Dy, Dm, d, $('.meno-days >ul:eq(0)'), false, 0)
// }
// //下个月或者年
// var xm = Dm - 1;//下月 --
// var xy = Dy
// if (xm == 0) {
// xy = Dy - 1
// xm = 12
// }
// menolog(xy, xm, d, $('.meno-days >ul:eq(1)'), false, 1)
// }
// clickTime()
//})
////右
//$('.month-right').click(function () {
// Dm = Dm + 1;//下月
// Dy = Dy
// if (Dm == 13) {
// Dy = Dy + 1
// Dm = 1
// }
// menolog(Dy, Dm, d, $('.meno-days >ul:eq(0)'), false, 0)
// //下个月或者年
// var xm = Dm + 1;//下月 --
// var xy = Dy
// if (xm == 13) {
// xy = Dy + 1
// xm = 1
// }
// menolog(xy, xm, d, $('.meno-days >ul:eq(1)'), false, 1)
// clickTime()
//})
//function locad(ys, ms, num) {
// $('.meno-month:eq(' + num + ') >span').html(ms + '月');
// $('.meno-year:eq(' + num + ') >span').html(ys + '年')
//}
//clickTime()
//function clickTime() {
// //选择时间
// $('.meno-days >ul >li').click(function () {
// if ($(this).hasClass('days-active')) {
// return;
// }
// $(this).addClass('suer-active')
// var dd = $('.suer-active').attr('name')
// //console.log(dd)
// if (locationSid) {
// var ddTime = new Date(dd)
// var dsTime = new Date(locationSid.val())
// if (ddTime < dsTime) {
// var ds = locationSid.val()
// } else {
// var ds = getNextDay(dd)
// }
// }
// $('.menology-box').hide();
// if (valHtml) {
// location.val(dd)
// if (locationSid) {
// locationSid.val(ds)
// client.rili(locationSid, valHtml, false, false, location)
// }
// } else {
// location.html(dd)
// if (locationSid) {
// locationSid.html(ds)
// client.rili(locationSid, valHtml, false, false, location)
// }
// }
// if (call) {
// call()
// }
// })
// function getNextDay(d) {
// d = new Date(d);
// d = +d + 1000 * 60 * 60 * 24;
// d = new Date(d);
// //return d;
// //格式化
// return d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate();
// }
//}
//box.css({ 'top': boxTop, 'left': boxLeft })
}
//日历插入位置location style="display: block;"----location
//日历日期展示true==val() false == html() valHtml----valHtml
//日历日期展示true==当前日期 false==选定日期 newTime-----newTime
//二次调用对象--------------------------------locationSid
//二次时间判断对象----------------locaTime
//单双日期true--false-----------num
//时间是否全部展示----------------judge
//回调----------call
//日历--景区
client.rili_view = function (location, valHtml, newTime, locationSid, locaTime, num, judge, call, calls) {
if (newTime) {
var dd = new Date();
var y = dd.getFullYear();
var m = dd.getMonth() + 1;//获取当前月份的日期
var d = dd.getDate();
var Time = locaTime.val();
//日历
var ddr = Time.split('-');
var yr = Number(ddr[0]);
var mr = Number(ddr[1]);
var dr = Number(ddr[2]);
} else {
var Time = locaTime.val();
//日历
var dd = Time.split('-');
var y = Number(dd[0]);
var m = Number(dd[1]);
var d = Number(dd[2]);
}
str = '<div class="menology-box-two">'+
'<i class="month-left"></i>'+
'<i class="month-right"></i>'+
'<div class="menology">'+
'<div class="meno-top">'+
'<div class="meno-month">'+
'<span>月</span>'+
'</div>'+
'<div class="meno-year">'+
'<span>年</span>'+
'</div>'+
'</div>'+
'<div class="meno-week clear">'+
'<span>日</span>'+
'<span>一</span>'+
'<span>二</span>'+
'<span>三</span>'+
'<span>四</span>'+
'<span>五</span>'+
'<span>六</span>'+
'</div>'+
'<div class="meno-days">'+
'<ul class="clear"></ul>'+
'</div>'+
'</div>'+
'</div>'
if ($('.menology-box-two').length < 1) {
$('body').append(str)
}
var box = $('.menology-box-two')
box.show();
var boxTop = location.offset().top + location.height() + 5
var boxLeft = location.offset().left
var Dy = yr //当前年
var Dm = mr //当前月
var Dd = dr //当前日
if ((Dm > m && Dy == y) || Dy > y) {
if (Dm == m && Dy == y) {
console.log(1)
menolog(Dy, Dm, d, $('.meno-days >ul:eq(0)'), true, true)
} else {
console.log(2)
menolog(Dy, Dm, d, $('.meno-days >ul:eq(0)'), false, true)
}
} else {
//当前月和年
console.log(3)
menolog(y, m, d, $('.meno-days >ul:eq(0)'), true, true)
}
function menolog(Year, Month, Day, loca, judge, num) {
locad(Year, Month)
loca.html('');
var month = Month
var year = Year
var da = 1;
var riqi = year + '-' + month + '-' + da;
var arys1 = new Array();
arys1 = riqi.split('-'); //日期为输入日期,格式为 2013-3-10
var ssdate = new Date(arys1[0], parseInt(arys1[1] - 1), arys1[2]);
var week = ssdate.getDay() //就是你要的星期几
for (var i = week; i > 0; i--) {
var li = '<li class="color-active"></li>';
loca.prepend(li);
}
if (month == 2) {
if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {
//console.log('闰年')
days = 29;
} else {
// console.log('普通')
days = 28;
}
} else if (month == 4 || month == 6 || month == 9 || month == 11) {
days = 30;
} else {
days = 31
}
if (judge) {
for (var i = 1; i <= days; i++) {
if (i < Day) {
var li = '<li class="color-active" name=' + Year + '-' + Month + '-' + i + '><p>' + i + '</p><p></p></li>'
}
if (i == Day) {
var li = '<li class="days-active" name=' + Year + '-' + Month + '-' + i + '><p>' + i + '</p><p></p></li>'
}
if (i > Day) {
var li = '<li name=' + Year + '-' + Month + '-' + i + '><p>' + i + '</p><p></p></li>'
}
loca.append(li);
}
} else {
for (var i = 1; i <= days; i++) {
var li = '<li name=' + Year + '-' + Month + '-' + i + '><p>' + i + '</p><p></p></li>'
loca.append(li);
}
}
for (var i = 0; i < $('.meno-days >ul >li').length; i++) {
if ($('.meno-days >ul >li').eq(i).attr('name') == location.val()) {
$('.meno-days >ul >li').eq(i).addClass('days-active')
}
}
if (locationSid) {
if ($('.days-active').length >= 2) {
$('.days-active').eq(0).removeClass('days-active')
}
} else {
if ($('.days-active').length >= 2) {
$('.days-active').eq(0).nextAll('li').addClass('days-suer')
$('.days-active').eq(1).prevAll('li').addClass('days-suer')
$('.days-active').eq(0).prevAll('li').removeClass('days-suer')
$('.days-active').eq(1).nextAll('li').removeClass('days-suer')
}
}
if (num) {
if ($('.days-active').length >= 2) {
$('.days-active').eq(0).removeClass('days-active')
$('.days-suer').removeClass('days-suer')
}
}
if (calls) {
calls()
}
}
//月份左右按键
//左
$('.month-left').click(function () {
if ((Dm > m && Dy == y) || Dy > y) {
Dm = Dm - 1;//下月
Dy = Dy
if (Dm == 0) {
Dy = Dy - 1
Dm = 12
}
if (Dm == m && Dy == y) {
menolog(Dy, Dm, d, $('.meno-days >ul:eq(0)'), true, true)
} else {
menolog(Dy, Dm, d, $('.meno-days >ul:eq(0)'), false, true)
}
}
clickTime()
})
//右
$('.month-right').click(function () {
Dm = Dm + 1;//下月
Dy = Dy
if (Dm == 13) {
Dy = Dy + 1
Dm = 1
}
menolog(Dy, Dm, d, $('.meno-days >ul:eq(0)'), false, true)
clickTime()
})
function locad(ys, ms) {
$('.meno-month >span').html(ms + '月');
$('.meno-year >span').html(ys + '年')
}
clickTime()
function clickTime() {
//选择时间
$('.meno-days >ul >li').click(function () {
if ($(this).hasClass('days-active') || $(this).hasClass('color-active')) {
return;
}
$(this).addClass('suer-active')
var dd = $('.suer-active').attr('name')
// console.log(dd)
if (locationSid) {
var ddTime = new Date(dd)
var dsTime = new Date(locationSid.val())
if (ddTime < dsTime) {
var ds = locationSid.val()
} else {
var ds = getNextDay(dd)
}
}
box.hide();
if (valHtml) {
location.val(dd)
if (locationSid) {
locationSid.val(ds)
rili(locationSid, valHtml, false, false, location)
}
} else {
location.html(dd)
if (locationSid) {
locationSid.html(ds)
rili(locationSid, valHtml, false, false, location)
}
}
if (call) {
call()
}
$('.suer-active').removeClass('suer-active')
})
function getNextDay(d) {
d = new Date(d);
d = +d + 1000 * 60 * 60 * 24;
d = new Date(d);
//return d;
//格式化
return d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate();
}
}
box.css({ 'top': boxTop, 'left': boxLeft })
}
//各个提交预定订单时未登陆状态
Detailed78.prototype.TestLogin = function (StrUrl) {
//未登录显示登录注册页面
if(isLogin==false){
$('.login_panelbox').fadeIn('normal');
}else{
$('.login_panelbox').fadeOut('normal');
}
var that = this;
//点击登录
$('.login_btnTel').on('click',function(){
u = $('.TelEmailval');
p = $('.TelEmailval_pas');
uVal=u.val();
pVal=p.val();
if(!uVal){return false;}
if(!pVal){return false;}
pVal = $.md5(pVal);//md5加密
that.getData({
url: "api7817/ucenter/lovers",
m: "login"
, pars: [uVal, pVal,true]
, cb: function (data) {
// console.log(data);
if (data.msg===1) {
data = data['rsp'];
var portrait = data[9];
if(portrait.indexOf('http')>0){
localStorage.setItem("portrait", portrait);
}else{
localStorage.setItem("portrait", client.staticUrl+portrait);
}
localStorage.setItem("u", uVal);
localStorage.setItem("cbSave", 'true');
localStorage.setItem('isLogin', 'true');
localStorage.setItem("p", pVal);
localStorage.setItem("uname", uVal);
localStorage.setItem("sid", data[0]);
localStorage.setItem("cid", data[1]);
localStorage.setItem("coname", data[2]);
localStorage.setItem("sidref", new Date());
localStorage.setItem("duetime", data[8]);
// localStorage.setItem("portrait", data[9]);
localStorage.setItem("nickname", data[10]);
localStorage.setItem("mobile", data[11]);
localStorage.setItem("truename", data[12]);
localStorage.setItem("bankcard", data[14]);
localStorage.setItem("isvip", data[16]);
window.location.href=StrUrl;//跳转到当前的原页面
} else {
client.ToolTip(data['rsp'][0]);
return ;
}
}
});
});
//点击消失登录框
$('.login-content>span').click(function(){
$('.login_panelbox').fadeOut('normal');
});
};
// 详情 视频列表
function detailVIVList(res) {
// console.log(res);
var that
, staticUrl = client.staticUrl
, swf = staticUrl + 'basevtour/tour.swf'
, current
, onAir
, $detailsContent = $('.details-content')
, iframe
, mySwiper
// , liBack = '" class="swiper-slide swiper-no-swiping"></li>' // 禁止滑动
, liBack = '" class="swiper-slide"></li>'
, liImg = '<li data-type="img" style="background-image: url(' // 普通图片 ^
, liVideo = '<li data-type="video" style="background-image: url(' // vr video ^
, livrpic = '<li data-type="vrpic" style="background-image: url(' // vrpic ^
// , livrpic2 = '" class="swiper-slide swiper-no-swiping"><div id="' // vrpic2 ^ 禁止拖动
, livrpic2 = '" class="swiper-slide"></li>' // vrpic2 ^
// , livrpic3 = '" class="full-img"></div><div class="vr-shade"></div></li>' // vrpic2 ^
, playing = ');" data-onair="playing" data-src="'
, lidatasrc = ');" data-src="'
// vr 视频
, vrVideo = ['vr1', 'vr2', 'vr3']
// , vrVideoImg = ['vr1_pic', 'vr2_pic', 'vr3_pic']
, vrVideoLen = vrVideo.length
, vrArr = []
, vrArrLen
, vrImgArr = []
, vrImgArrLen
// vr 图片
, vrPic = ['vrpic1', 'vrpic2', 'vrpic3', 'vrpic4', 'vrpic5']
, vrPicArr= []
, vrPicLen = vrPic.length
// 普通图片
, pic = ['pic1', 'pic2', 'pic3', 'pic4', 'pic5']
, picArr = []
, picLen = pic.length
, i
, thisVR
, thisVRPic
, str
, currentSrc
, currentVR
, currentPic
, $listWarp = $('#VRId')
, flowNum = 0
, dataType
, currentAutoPic
, isvip = localStorage.getItem('isvip') || 0 // 是不是vip、播放需要
, kind = res['alias'] // 哪个块的、用于统计视频点播
, isfree = res['isfree'] || 0 // 是否免费、没有指定先默认都是免费的
, id = res['id']
;
$listWarp.html('');
// 先提取基础数据
// vr 视频
for(i = 0; i< vrVideoLen; i++){
current = vrVideo[i];
thisVR = res[current];
// 暂时是有vr源的,才显示;如果没有vr源只有vrpic的,先不显示
if(thisVR){
thisVRPic = res[current+"_pic"];
vrArr.push(staticUrl + thisVR); // vr 视频
vrImgArr.push(thisVRPic ? staticUrl + thisVRPic : ''); // vr 视频的默认图片
}
}
// vr 图片
for(i = 0; i< vrPicLen; i++){
thisVR = res[vrPic[i]];
if(thisVR){
// console.log(thisVR);
vrPicArr.push(staticUrl + thisVR);
}
}
// 普通 图片
for(i = 0; i< picLen; i++){
thisVR = res[pic[i]];
if(thisVR){
picArr.push(staticUrl + thisVR);
}
}
// console.log("vr视频:"+vrArr);
// console.log("vr视频默认图片:"+vrImgArr);
// console.log("vr图片:"+vrPicArr);
// console.log("普通图片:"+picArr);
// vrImgArrLen = vrArr.length;
// 渲染 vr 视频
// console.log("vr视频:"+vrArr);
vrVideoLen = vrArr.length;
// console.log(vrVideoLen);
if(vrVideoLen>0){
str = '';
for(i = 0; i<vrVideoLen; i++){
flowNum++;
currentVR = vrArr[i]; // 当前vr视频路径
currentPic = vrImgArr[i]; // 当前vr默认图片路径
currentSrc = '/html17/view/vr-videoTest.html?videoSrc='+currentVR+'&autoPic='+currentPic+"&id=" + id + "&kind="+kind+"&";
if(flowNum===1){
setContainer('video', currentSrc);
str += liVideo + currentPic + playing + currentSrc + liBack;
}else{
str += liVideo + currentPic + lidatasrc + currentSrc + liBack;
}
}
$listWarp.append(str);
// console.log(str);
}
// 渲染 vr 图片
str = '';
vrPicLen = vrPicArr.length;
if(vrPicLen>0){
for(i = 0; i<vrPicLen; i++){
flowNum++;
current = vrPicArr[i];
currentSrc = '/html17/view/vr-pic.html?picURL=' + current;
currentAutoPic = 'vrpic' + i;
currentPic = current + '/jmy/thumb';
if(flowNum===1){
setContainer('vrpic', currentSrc);
str += livrpic + currentPic + playing + currentSrc + livrpic2;
}else{
str += livrpic + currentPic + lidatasrc + currentSrc + livrpic2;
}
}
$listWarp.append(str);
}
// 渲染 图片
picLen = picArr.length;
// console.log(picLen);
if(picLen>0){
str = '';
for(i = 0; i<picLen; i++){
flowNum++;
currentPic = picArr[i];
if(flowNum===1){
setContainer('img', currentPic);
str += liImg + currentPic + playing + currentPic + liBack;
}else{
str += liImg + currentPic + lidatasrc +currentPic + liBack;
}
}
$listWarp.append(str);
// console.log(str);
}
// console.log(picLen+vrVideoLen+vrPicLen);
if((picLen+vrVideoLen+vrPicLen)>5){
$('.details-group').addClass('video-more');
mySwiper = new Swiper('.swiper-container',{
// pagination: '.pagination',
slidesPerView: 5
, noSwiping : true
// autoplay : 5000
// paginationClickable: true
});
}
$('.video-row-prev').on('click', function(e){
e.preventDefault();
mySwiper.swipePrev()
});
$('.video-row-next').on('click', function(e){
e.preventDefault();
mySwiper.swipeNext()
});
// 视频图片列表的切换
$('.swiper-wrapper').on('click', 'li', function () {
that = $(this);
current = that.attr("data-src");
onAir = that.attr('data-onAir');
dataType = that.attr('data-type');
if(!onAir){
that.attr('data-onAir', 'playing').siblings('li[data-onAir="playing"]').removeAttr('data-onAir');
setContainer(dataType, current);
}
});
function setContainer(t, str) {
switch (t){
case "video":
case "vrpic":
iframe = document.createElement('iframe');
iframe.src = str+ts;
$detailsContent.html(iframe);
break;
/* case 'vrpic':
// '/html17/view/vr-pic.html?picURL=' + current;
console.log(str);
console.log('vrpic');
break;*/
case 'img':
$detailsContent.html('<span style="background-image: url('+str+');"></span>');
break;
}
}
}
//全局函数打印方法console.log
client.log = function(content){
var coname = localStorage.getItem('coname');
if(coname == 'jmy'){
console.log(content);
}else{
return;
}
};
// 微时代商家后台公共头部2018-5-21
Detailed78.prototype.publicBusiness = function(name){
var coname = localStorage.getItem('coname');
// var u = localStorage.getItem('u');
// var nickname = localStorage.getItem('nickname');
// var loginname = (nickname || u);
//未登录显示登录注册页面
if(isLogin==false){
window.location.href = '/html17/personal/businlogin.html';
}else{
var layui_header='';
layui_header+='<div class="header-box clear">' +
'<div class="header-boxLogo fl">' +
'<a href="/html17/personal/busin_nav.html">' +
'<img src="/static/img/jmy-xq/logo.png?x-oss-process=image/resize,w_160" />' +
'</a>' +
'</div>' +
// '<div class="header-boxKind fl"><p>香江大酒店</p></div>' +
'<div class="header-boxKind fl"><p>'+name+'</p></div>' +
'<div class="header-boxName fr">' +
'<div>' +
'<a href="">'+coname+'</a>' +
'<span></span>' +
'</div>' +
'<div id="rtiangle-up"></div>' +
'<div class="Name_boxNav">' +
'<ul>' +
'<li><a href="/html17/personal/changePass.html">修改密码</a></li>' +
'<li><a href="/html17/personal/busin_nav.html">返回导航</a></li>' +
'<li id="dropOutback"><a>退出登录</a></li>' +
'</ul>' +
'</div>' +
'</div>' +
'</div>';
$('.headers').html(layui_header);
//修改密码弹框
$('.header-boxName').hover(function(){
$('.Name_boxNav').show();
$('#rtiangle-up').show();
},function(){
$('.Name_boxNav').hide();
$('#rtiangle-up').hide();
});
//退出登录
$('#dropOutback').on('click', function (e) {
e.preventDefault();
localStorage.clear();
localStorage.setItem("uname", "guest");
localStorage.setItem("sid", "GUEST888-8888-8888-8888-GUEST88GUEST");
localStorage.setItem("cid", "GUEST000-8888-8888-8888-GUEST00GUEST");
localStorage.setItem("coname", "测试帐套");
window.location.href = '/html17/personal/businlogin.html';
});
// var NavLeftBox = '';
// //NavLeftBox+='<div class="custom-logo"><a href="#"><img src="../../../static/img/jmy-pc/logo.png" alt=""/></a></div>' +
// NavLeftBox+='<div class="custom-logo"></div>' +
// '<ul id="Nav" class="layui-nav layui-nav-tree">' +
// '<li class="layui-nav-item"><a href="/html17/personal/busin_index.html?kind=glass"><i class="icon iconfont icon-shouyeb"></i>首页</a></li>' +
// '<li style="display: none!important;" class="layui-nav-item"><a href="/html17/personal/salesman_des.html"><i class="icon iconfont icon-xiaoshouyuanyejixiangqing"></i>销售员业绩详情</a></li>' +
// '<li class="layui-nav-item"><a href="/html17/personal/businorder_detail.html"><i class="icon iconfont icon-dingdanliebiaoa"></i>订单管理</a></li>' +
// '<li style="display: none!important;" class="layui-nav-item"><a href="/html17/personal/salemanManage.html"><i class="icon iconfont icon-xiaoshouyuanguanli"></i>销售员管理</a></li>' +
// '<li class="layui-nav-item"><a href="/html17/personal/feedBack.html"><i class="icon iconfont icon-yijianfankui"></i>意见反馈</a></li>' +
// '</ul><div class="layui-footer"><p>商家热线:88888888</p></div>';
// $('.layui-side-scroll').html(NavLeftBox);
//
// if (index == 1) {
// $('.layui-side-scroll ul li:eq(' + (index - 1) + ')').addClass('active').siblings().removeClass('active');
// }
// if (index == 2) {
// $('.layui-side-scroll ul li:eq(' + (index - 1) + ')').addClass('active').siblings().removeClass('active');
// }
// if (index == 3) {
// $('.layui-side-scroll ul li:eq(' + (index - 1) + ')').addClass('active').siblings().removeClass('active');
// }
// if (index == 4) {
// $('.layui-side-scroll ul li:eq(' + (index - 1) + ')').addClass('active').siblings().removeClass('active');
// }
// if (index == 5) {
// $('.layui-side-scroll ul li:eq(' + (index - 1) + ')').addClass('active').siblings().removeClass('active');
// }
// if (index == 6) {
// $('.layui-side-scroll').html('<div class="custom-logo"><a href="#"><img src="../../../static/img/jmy-pc/logo.png" alt=""/></a></div>');
// }
}
};
// 微时代商家后台公共意见反馈2018-5-21
Detailed78.prototype.feedBack = function (kind){
var mains_right = '';
mains_right += '<h2>意见反馈</h2>' +
'<h3>我们倾听你的声音</h3>' +
'<div class="text">' +
'<textarea placeholder="欢迎提出宝贵意见和建议"></textarea>' +
'</div><h4>提交</h4>';
$('.mains-right').html(mains_right);
//
$('.mains-right h4').click(function(){
if($('.text textarea').val()==''){
client.ToolTip('请输入宝贵的意见');
return;
}
api78({
url:'api7817/ucenter/lovers_advise'
, m:'add'
, pars:[kind,$('.text textarea').val(),'Windows']
,back:function(data){
if(data.code == 200){
client.ToolTip('反馈成功');
$('.text textarea').val('');
}else{
client.ToolTip('服务器报错,请稍后');
return;
}
}
});
});
}
// 上传阿里云服务器
client.aliUpload = function (option) {
// 图片视频上传到阿里云 start
var ow
, file = t.files[0]
, owTime = localStorage.getItem('owTime')
, currentTime = new Date().getTime()
, owToken
, key = t.getAttribute('data-key')
, $tp = $(t.parentNode)
, $progress = $tp.siblings('.progress')
, pgBarStyle = $progress.find('span')[0].style
, upLoadAliSettings = pageSettings.upLoadAliSettings
, colName = t.getAttribute('data-id')
, colId = $("#"+colName)
, dataType = t.getAttribute('data-type')
, dataTypeEls = ''
, isImg = false
, ts = "?ts="+Math.random()
, tableName = upLoadAliSettings.menu
, fieldname = colName
, mid = upLoadAliSettings.mid
, tpStyle = t.parentNode.style
, cdn = upLoadAliSettings.host === '//www.vrjmy.com/' ? 'jmy7818' : 'jmy78' // jmy78 测试库, jmy7818:正式库
, subcatalog = t.getAttribute('data-subcatalog') // 看看是不是子目录的, xml 格式要用的,
, folder // 子目录的文件夹 input-folder
, folderVal = ''
, select
, noChange = true
;
// console.log(!!subcatalog);
if(subcatalog){
// 有子目录
folder = $tp.siblings('.input-folder')[0].value; // xml 子图片的文件夹名称
select = $tp.siblings('.input-select')[0].value; // 图片的名字 上下左右前后...
// folderVal = folder.val();
key = key + "/"+ folder + "/" + select;
// console.log(folder+"/"+select);
// console.log(key);
noChange = false;
}
// console.log(upLoadAliSettings);
t.style.display = "none";
tpStyle.opacity = .6;
if(dataType==="img"){
isImg = true;
dataTypeEls = $("#img"+colName)[0];
}
pgBarStyle.width = 0;
$progress.addClass('active');
// console.log(pageSettings);
// console.log(key);
if(owTime && (currentTime-owTime)<3600000){
// 获取下保存的信息 没有的话重新获取
owToken = localStorage.getItem('owToken');
if(owToken){
tokenControl(JSON.parse(owToken));
}
}else{
// 没有获取过的重新获取
getToken();
}
function getToken() {
api78({
url: "api7817/ucenter/lovers",
m: "StsToken"
, ajaxtype: upLoadAliSettings.ajaxtype
, back: function (data) {
if(data.code===200){
data = data.res;
localStorage.setItem('owTime', currentTime);
localStorage.setItem('owToken', JSON.stringify(data));
tokenControl(data);
}
}
});
}
function tokenControl(data) {
data = data.Credentials;
ow = new OSS.Wrapper({
region: 'oss-cn-hangzhou',
accessKeyId: data.AccessKeyId,
accessKeySecret: data.AccessKeySecret,
stsToken: data.SecurityToken,
bucket: cdn
});
ow.multipartUpload(key, file,{
progress: progress
}).then(function (result) {
if(result.res.status===200){
t.value = '';
$progress.addClass('stop');
t.style.display = "block";
tpStyle.opacity = 1;
// console.log(key);
// url = key;
// console.log(key);
if(noChange){
colId.html(key);
// console.log(upLoadAliSettings.cdnhost);
// console.log(upLoadAliSettings.cdnhost+key+ts);
if(isImg){
// 如果是图片的话更新右边的图片
dataTypeEls.setAttribute('src', upLoadAliSettings.cdnhost+key+ts);
}
// console.log([tableName, fieldname, key, mid]);
// if(!colId.html()){
// 更新数据库
api78({
url: "api7817/view/view_basic",
m: "mUpload"
, pars: [tableName+"_basic", fieldname, key, mid]
, back: function (data) {
// console.log(data);
if(data.code===200){
// data = data.res;
}
}
});
// }
}
setTimeout(function () {
$progress.addClass('fade-out');
}, 1000);
setTimeout(function () {
pgBarStyle.width = 0;
$progress.removeClass('fade-out active stop');
}, 2000);
}
}).catch(function (err) {
// console.log(err);
});
}
function progress(p) {
// console.log(p);
return function (done) {
pgBarStyle.width = Math.floor(p*100)+"%";
done();
};
}
}