559 lines
16 KiB
JavaScript
559 lines
16 KiB
JavaScript
|
|
var apiurl = "http://wx.agqyjs.com";
|
|
var appId_weixin = "wx160602dbb3ae284b";
|
|
var GaodeMapAPIKey = "";
|
|
var fileName = "fs://app/";//新版本文件名
|
|
var ewmName = "fs://image/limewm.png";//下载二维码地址
|
|
var ewmName2 = "fs://image/limewm2.png";//下载直播二维码地址
|
|
var updateurl = "http://wx.agqyjs.com/app/";//下载新apk文件地址
|
|
var widgetid ="A1819008501056274437";
|
|
var licenceURL="";
|
|
var licenceKey="";
|
|
var qCloudVODPlayer = null;
|
|
//去掉空格
|
|
function fTrim(str) {
|
|
if (str != "") {
|
|
str=str.replace(/(^\s*)|(\s*$)/g, "");
|
|
}
|
|
return str;
|
|
}
|
|
function changeTwoDecimal_f(x) {
|
|
var f_x = parseFloat(x);
|
|
if (isNaN(f_x)) {
|
|
|
|
tishi3("格式不正确");
|
|
return false;
|
|
}
|
|
var f_x = Math.round(x * 100) / 100;
|
|
var s_x = f_x.toString();
|
|
var pos_decimal = s_x.indexOf('.');
|
|
if (pos_decimal < 0) {
|
|
pos_decimal = s_x.length;
|
|
s_x += '.';
|
|
}
|
|
while (s_x.length <= pos_decimal + 2) {
|
|
s_x += '0';
|
|
}
|
|
return s_x;
|
|
}
|
|
function change0Decimal_f(x) {
|
|
var f_x = parseFloat(x);
|
|
if (isNaN(f_x)) {
|
|
|
|
tishi3("格式不正确");
|
|
return false;
|
|
}
|
|
var f_x = Math.round(x * 100) / 100;
|
|
var s_x = f_x.toString();
|
|
return s_x;
|
|
}
|
|
function setlocalStorage(name, value)
|
|
{
|
|
window.localStorage.setItem("dykquan" +name, value);
|
|
}
|
|
//清除localStorage
|
|
function clearlocalStorage(name) {
|
|
window.localStorage.removeItem("dykquan" +name);
|
|
}
|
|
function getlocalStorage(name)
|
|
{
|
|
|
|
var cvalue = window.localStorage.getItem("dykquan" +name);
|
|
if (cvalue == "null") {
|
|
cvalue = null;
|
|
}
|
|
return cvalue;
|
|
}
|
|
function getUuid(){
|
|
var s = [];
|
|
var hexDigits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
for (var i = 0; i < 36; i++) {
|
|
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1)
|
|
}
|
|
s[14] = "4"
|
|
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1)
|
|
s[8] = s[13] = s[18] = s[23] = "-"
|
|
let uuid = s.join("")
|
|
return uuid
|
|
}
|
|
function isNumberOr_Letter(s) {//判断是否是数字或字母
|
|
|
|
var regu = "^[0-9a-zA-Z\_]+$";
|
|
|
|
var re = new RegExp(regu);
|
|
|
|
if (re.test(s)) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
function isNumber(s) {//判断是否是数字
|
|
|
|
var regu = "^[0-9]+$";
|
|
|
|
var re = new RegExp(regu);
|
|
|
|
if (re.test(s)) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
function Base64() {
|
|
|
|
// private property
|
|
_keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
|
|
// public method for encoding
|
|
this.encode = function (input) {
|
|
var output = "";
|
|
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
|
var i = 0;
|
|
input = _utf8_encode(input);
|
|
while (i < input.length) {
|
|
chr1 = input.charCodeAt(i++);
|
|
chr2 = input.charCodeAt(i++);
|
|
chr3 = input.charCodeAt(i++);
|
|
enc1 = chr1 >> 2;
|
|
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
|
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
|
enc4 = chr3 & 63;
|
|
if (isNaN(chr2)) {
|
|
enc3 = enc4 = 64;
|
|
} else if (isNaN(chr3)) {
|
|
enc4 = 64;
|
|
}
|
|
output = output +
|
|
_keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
|
|
_keyStr.charAt(enc3) + _keyStr.charAt(enc4);
|
|
}
|
|
return output;
|
|
}
|
|
|
|
// public method for decoding
|
|
this.decode = function (input) {
|
|
var output = "";
|
|
var chr1, chr2, chr3;
|
|
var enc1, enc2, enc3, enc4;
|
|
var i = 0;
|
|
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
|
while (i < input.length) {
|
|
enc1 = _keyStr.indexOf(input.charAt(i++));
|
|
enc2 = _keyStr.indexOf(input.charAt(i++));
|
|
enc3 = _keyStr.indexOf(input.charAt(i++));
|
|
enc4 = _keyStr.indexOf(input.charAt(i++));
|
|
chr1 = (enc1 << 2) | (enc2 >> 4);
|
|
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
|
|
chr3 = ((enc3 & 3) << 6) | enc4;
|
|
output = output + String.fromCharCode(chr1);
|
|
if (enc3 != 64) {
|
|
output = output + String.fromCharCode(chr2);
|
|
}
|
|
if (enc4 != 64) {
|
|
output = output + String.fromCharCode(chr3);
|
|
}
|
|
}
|
|
output = _utf8_decode(output);
|
|
return output;
|
|
}
|
|
|
|
// private method for UTF-8 encoding
|
|
_utf8_encode = function (string) {
|
|
string = string.replace(/\r\n/g,"\n");
|
|
var utftext = "";
|
|
for (var n = 0; n < string.length; n++) {
|
|
var c = string.charCodeAt(n);
|
|
if (c < 128) {
|
|
utftext += String.fromCharCode(c);
|
|
} else if((c > 127) && (c < 2048)) {
|
|
utftext += String.fromCharCode((c >> 6) | 192);
|
|
utftext += String.fromCharCode((c & 63) | 128);
|
|
} else {
|
|
utftext += String.fromCharCode((c >> 12) | 224);
|
|
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
|
utftext += String.fromCharCode((c & 63) | 128);
|
|
}
|
|
|
|
}
|
|
return utftext;
|
|
}
|
|
|
|
// private method for UTF-8 decoding
|
|
_utf8_decode = function (utftext) {
|
|
var string = "";
|
|
var i = 0;
|
|
var c = c1 = c2 = 0;
|
|
while ( i < utftext.length ) {
|
|
c = utftext.charCodeAt(i);
|
|
if (c < 128) {
|
|
string += String.fromCharCode(c);
|
|
i++;
|
|
} else if((c > 191) && (c < 224)) {
|
|
c2 = utftext.charCodeAt(i+1);
|
|
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
|
|
i += 2;
|
|
} else {
|
|
c2 = utftext.charCodeAt(i+1);
|
|
c3 = utftext.charCodeAt(i+2);
|
|
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
|
|
i += 3;
|
|
}
|
|
}
|
|
return string;
|
|
}
|
|
}
|
|
|
|
function reload(){
|
|
window.location.reload();
|
|
}
|
|
function closeALLFrame() {
|
|
var ifapp = 0;
|
|
var aifapp = getlocalStorage("ifapp");
|
|
if (aifapp != null) {
|
|
ifapp = aifapp;
|
|
}
|
|
if (ifapp == 1) {
|
|
execScript1("video", "video_content", "pausevideo()");
|
|
try {
|
|
api.closeFrame({
|
|
name: "video_common"
|
|
});
|
|
} catch {
|
|
|
|
}
|
|
try {
|
|
api.closeFrame({
|
|
name: "video_circle"
|
|
});
|
|
} catch {
|
|
|
|
}
|
|
try {
|
|
api.closeFrame({
|
|
name: "video_cart"
|
|
});
|
|
} catch {
|
|
|
|
}
|
|
try {
|
|
api.closeFrame({
|
|
name: "video_cartto"
|
|
});
|
|
} catch {
|
|
|
|
}
|
|
}
|
|
}
|
|
function closeFrame(fname) {
|
|
api.closeFrame({
|
|
name: fname
|
|
});
|
|
}
|
|
function closeWin(){
|
|
history.go(-1);
|
|
}
|
|
function toast(msg){
|
|
api.toast({
|
|
msg: msg,
|
|
duration: 3000,
|
|
location: 'middle'
|
|
});
|
|
}
|
|
|
|
function execScript(winName, jsfun){
|
|
api.execScript({
|
|
name: winName,
|
|
script: jsfun
|
|
});
|
|
}
|
|
function execScript0(frameName, jsfun){
|
|
try{
|
|
api.execScript({
|
|
frameName: frameName,
|
|
script: jsfun
|
|
});
|
|
}catch(err){
|
|
alert(err);
|
|
}
|
|
}
|
|
function execScript1(winName, frameName, jsfun){
|
|
api.execScript({
|
|
name: winName,
|
|
frameName: frameName,
|
|
script: jsfun
|
|
});
|
|
}
|
|
function onlink(url) {
|
|
var scrollPos = 0;
|
|
if ($("#wrapper").length > 0) {
|
|
scrollPos = $("#wrapper").scrollTop();
|
|
}
|
|
setlocalStorage("indexScTop", scrollPos);
|
|
top.location.href = url;
|
|
}
|
|
function onloginlink(url){
|
|
userId = getlocalStorage("userId");
|
|
if(userId!=null){
|
|
onlink(url);
|
|
}else{
|
|
onlink("/");
|
|
}
|
|
}
|
|
|
|
|
|
function logout(t) {
|
|
var userId = getlocalStorage("userId");
|
|
var LoginId = getlocalStorage("LoginId");
|
|
if (userId != null) {
|
|
var index_=layer.confirm('您确定要退出登录吗?', {
|
|
title: "退出提醒",
|
|
btn: ['是', '否'] //按钮
|
|
}, function () {
|
|
|
|
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: "/apiajax.ashx",
|
|
data: { "action": "logout", "userId": (userId != null ? userId : ""), "LoginId": (LoginId != null ? LoginId : "") },
|
|
|
|
dataType: "JSON",
|
|
error: function (jqXHR) {
|
|
//tishi3("发生错误:" + jqXHR.status);
|
|
},
|
|
success: function (data) {
|
|
|
|
clearlocalStorage("userId");
|
|
clearlocalStorage("LoginId");
|
|
layer.close(index_);
|
|
if (t == 1) {
|
|
setlocalStorage("myrefresh", 1);
|
|
closeWin();
|
|
} else {
|
|
rdata(0);
|
|
$("#wrapper").animate({ scrollTop: 0 }, 300);
|
|
}
|
|
api.closeWidget({
|
|
silent: true // 静默退出
|
|
});
|
|
}
|
|
|
|
|
|
})
|
|
}, function () {
|
|
}
|
|
);
|
|
} else {
|
|
onlink("/");
|
|
}
|
|
}
|
|
function updateonline(str) {
|
|
var userId=getlocalStorage("userId");
|
|
var LoginId = getlocalStorage("LoginId")
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: "/apiajax.ashx",
|
|
data: { "action": "updateonline", "userId": (userId != null ? userId : ""), "LoginId": (LoginId != null ? LoginId : "") },
|
|
|
|
dataType: "JSON",
|
|
error: function (jqXHR) {
|
|
//tishi3("发生错误:" + jqXHR.status);
|
|
},
|
|
success: function (data) {
|
|
|
|
if (data.status == 1) {
|
|
clearlocalStorage("userId");
|
|
clearlocalStorage("LoginId");
|
|
}
|
|
|
|
}
|
|
})
|
|
}
|
|
|
|
function judgetime(time){
|
|
var today=new Date();
|
|
var nowtime=parseInt(today.getTime()/1000);
|
|
var overtime=moment(time, 'YYYY/MM/DDTHH:mm:ss.sssZ');
|
|
var deadline=overtime.unix();
|
|
var minus=nowtime-deadline;
|
|
if((minus/86400)>1){
|
|
// var d="2015-12-16T06:27:19.189Z";
|
|
/*var ctime=new Date(time.replace("-","/"));
|
|
var yy=ctime.getFullYear();
|
|
var MM=ctime.getMonth()+1;
|
|
var dd=ctime.getDate();
|
|
return yy+"-"+MM+"-"+dd;*/
|
|
return time.split(" ")[0];
|
|
// alert(ztime);
|
|
}else if((minus/3600)>1){
|
|
var hh=parseInt(minus/3600);
|
|
return hh+"小时前";
|
|
// alert(ztime);
|
|
}else if((minus/60)>1){
|
|
var mm=parseInt(minus/60);
|
|
return mm+"分钟前";
|
|
// alert(ztime);
|
|
}else{
|
|
return "刚刚";
|
|
}
|
|
}
|
|
function judgetime0(time) {
|
|
var thedate = new Date(time);
|
|
return date2str(thedate, "MM月dd日");
|
|
}
|
|
function judgetime1(time){
|
|
var thedate = new Date(time);
|
|
return date2str(thedate,"yyyyMMddhhmmss");
|
|
}
|
|
|
|
function judgetime2(time){
|
|
var thedate = new Date(time);
|
|
return date2str(thedate,"MM-dd");
|
|
}
|
|
function date2str(x,y) {
|
|
var z = {y:x.getFullYear(),M:x.getMonth()+1,d:x.getDate(),h:x.getHours(),m:x.getMinutes(),s:x.getSeconds()};
|
|
return y.replace(/(y+|M+|d+|h+|m+|s+)/g,function(v) {return ((v.length>1?"0":"")+eval('z.'+v.slice(-1))).slice(-(v.length>2?v.length:2))});
|
|
}
|
|
|
|
function DeleteOrder(orderid) {
|
|
var index_ = layer.confirm('删除不可恢复,您确定是否要删除?', {
|
|
title: "删除提醒",
|
|
btn: ['是', '否'] //按钮
|
|
}, function () {
|
|
|
|
var userId = getlocalStorage("userId");
|
|
var LoginId = getlocalStorage("LoginId");
|
|
var status = $("#status_" + orderid);
|
|
var cz = $("#cz_" + orderid);
|
|
cz.html("请稍候...");
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: "/apiajax.ashx",
|
|
data: { "action": "DeleteOrder", "orderid": orderid, "userId": (userId != null ? userId : ""), "LoginId": (LoginId != null ? LoginId : "") },
|
|
|
|
dataType: "JSON",
|
|
error: function (jqXHR) {
|
|
tishi3("发生错误:" + jqXHR.status);
|
|
},
|
|
success: function (data) {
|
|
layer.close(index_);
|
|
if (data) {
|
|
|
|
|
|
if (data.status == 1) {
|
|
cz.html("已删除");
|
|
status.html("已删除");
|
|
} else {
|
|
tishi3(data.msg, "2000");
|
|
reload();
|
|
}
|
|
|
|
} else {
|
|
|
|
}
|
|
}
|
|
});
|
|
|
|
})
|
|
}
|
|
|
|
function SetRemainTime3() {
|
|
var times = $(".showtime");
|
|
|
|
if (times.length > 0) {
|
|
for (var i = 0; i < times.length; i++) {
|
|
setRemainTimeSite3($(times[i]), parseInt($(times[i]).attr("time")));
|
|
}
|
|
}
|
|
}
|
|
|
|
function setRemainTimeSite3(theid, SysSecond) {
|
|
|
|
if (SysSecond > 0) {
|
|
SysSecond = SysSecond - 1;
|
|
theid.attr("time", SysSecond);
|
|
//alert(SysSecond / 3600);
|
|
var second = Math.floor(SysSecond % 60).toString();
|
|
var minite = Math.floor((SysSecond / 60) % 60).toString();
|
|
var hour = Math.floor((SysSecond / 3600) % 24).toString();
|
|
var day = Math.floor((SysSecond / (3600*24))).toString();
|
|
if(hour.length==1){
|
|
hour="0"+hour;
|
|
}
|
|
if(minite.length==1){
|
|
minite="0"+minite;
|
|
}
|
|
if(second.length==1){
|
|
second="0"+second;
|
|
}
|
|
theid.html("<span class=\"sytime\">" + hour + "</span><span>:</span><span class=\"sytime\">" + minite + "</span><span>:</span><span class=\"sytime\">" + second +"</span>");
|
|
//theid.html("" + day + " 天 " + hour + " 时 " + minite + " 分 " + second + " 秒");
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
(function ($) {
|
|
$.getUrlParam = function (name) {
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
|
var r = decodeURIComponent(window.location.search).substr(1).match(reg);
|
|
if (r != null) return unescape(r[2]); return null;
|
|
}
|
|
})(jQuery);
|
|
Date.prototype.Format = function (fmt) {
|
|
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;
|
|
};
|
|
var ifapp = true;
|
|
$(document).ready(function () {
|
|
var ifapp = 0;
|
|
var aifapp = getlocalStorage("ifapp");
|
|
if (aifapp != null) {
|
|
ifapp = aifapp;
|
|
}
|
|
if (ifapp == 1) {
|
|
$("header").addClass("appheader");
|
|
} else {
|
|
$("header").removeClass("appheader");
|
|
}
|
|
//判断用户是不是通过后退按钮访问本页面的
|
|
window.addEventListener('pageshow', function (e) {
|
|
if (e.persisted || (window.performance && window.performance.navigation.type == 2)) {
|
|
var indexScTop = getlocalStorage("indexScTop");
|
|
if (indexScTop != null) {
|
|
|
|
const setIndexScTop = setInterval(function () {
|
|
|
|
if ($("#wrapper").length > 0) {
|
|
$("#wrapper").scrollTop(indexScTop);
|
|
}
|
|
clearlocalStorage("indexScTop")
|
|
clearInterval(setIndexScTop)
|
|
|
|
}, 100)
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|