<!DOCTYPE html>
|
<html>
|
<head>
|
<meta charset="utf-8">
|
<title>云发单</title>
|
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
|
<link rel="stylesheet" type="text/css" href="css/base.css" />
|
<link rel="stylesheet" type="text/css" href="css/opeCloudPushOrder.css" />
|
<script>
|
window.onresize = function() {
|
document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + 'px';
|
};
|
window.onresize();
|
</script>
|
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
|
<script src="http://img.flqapp.com/resource/js/app2019112217.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
|
<link rel="stylesheet" type="text/css" href="css/load.css" />
|
<style type="text/css">
|
[v-cloak] {
|
display: none !important;
|
}
|
</style>
|
</head>
|
<body>
|
<div id="root" v-cloak>
|
<div class="div_header">
|
<div class="div_header_title">
|
<div class="div_header_1" @click="selectTab(1)">
|
<p>云发单管理</p>
|
</div>
|
<div class="div_header_mid">
|
<div></div>
|
</div>
|
<div class="div_header_2" @click="selectTab(2)">
|
<p>发单商品库</p>
|
</div>
|
</div>
|
<div class="div_header_line">
|
<div class="div_header_line_1"></div>
|
<div class="div_header_line_2"></div>
|
</div>
|
</div>
|
|
<!-- 云发单管理 -->
|
<div v-if="selectTabType==1" class="div_cloudPushOrderManage">
|
<div class="div_top_header">
|
<div class="" style="display: -webkit-flex;">
|
<img :src="userInfo.portrait" class="headPortrait">
|
<div>
|
<div class="nickName">{{userInfo.nickName}}</div>
|
<div class="desc">开通云发单,自动分享轻松赚钱</div>
|
</div>
|
</div>
|
</div>
|
|
<div class="div_contentBG1">
|
<div style="display: -webkit-flex;align-items: center; height: 0.32rem; padding-top: 0.33rem;">
|
<div style="width: 5px;height: 0.32rem; background-color: #C99663;margin-left: 0.23rem;"></div>
|
<div style="color: #000000;font-size: 0.26rem;margin-left: 0.14rem;">开启后专享特权</div>
|
</div>
|
|
<div style="display: -webkit-flex;">
|
<div class="divContent_tq1">
|
<div class="divContent_tq_img">
|
<img src="img/icon_tq1.png">
|
</div>
|
<div style="color: #666666;font-size: 0.24rem;height: 0.24rem;display: -webkit-flex;align-items: center;margin-top: 0.17rem;">
|
群自动发单
|
</div>
|
</div>
|
|
<div class="divContent_tq2">
|
<div class="divContent_tq_img">
|
<img src="img/icon_tq2.png">
|
</div>
|
<div style="color: #666666;font-size: 0.24rem;height: 0.24rem;display: -webkit-flex;align-items: center;margin-top: 0.17rem;">
|
圈自动发单
|
</div>
|
</div>
|
|
<div class="divContent_tq3">
|
<div class="divContent_tq_img">
|
<img src="img/icon_tq3.png">
|
</div>
|
<div style="color: #666666;font-size: 0.24rem;height: 0.24rem;display: -webkit-flex;align-items: center;margin-top: 0.17rem;">
|
发圈一键发单
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<div class="div_contentBG2">
|
<div style="display: -webkit-flex; flex-wrap: wrap;">
|
|
<div class="div_item" v-for="(item, index) in listMenu" @click="touchOpenPackage(item,index)">
|
<div class="div_money1">
|
<div class="moneyPrice">
|
<span style="font-size: 0.32rem;">¥</span>{{item.money}}
|
</div>
|
<div class="openDate">{{item.desc}}</div>
|
<img v-if="listMenu.length==1&&listMenu!=null" src="img/icon_money_select.png" class="img_moneySelect" :id="nameId(item,index)"
|
style="opacity: 1;">
|
<img v-else src="img/icon_money_select.png" class="img_moneySelect" :id="nameId(item,index)" style="opacity: 0;">
|
</div>
|
</div>
|
|
<div class="div_money_normol">即将开放</div>
|
</div>
|
|
<div class="div_open" @click="openVIP">
|
立即开通
|
</div>
|
<div style="display: -webkit-flex;align-items: center;margin-top: 0.2rem;">
|
<img src="img/icon_select.png" class="img_xy">
|
<div style="color: #666666;font-size: 0.22rem;margin-left: 0.16rem;">
|
同意<span style="color: #E5005C;" @click="rule">《板栗快省云发单功能包月服务协议》</span>
|
</div>
|
</div>
|
|
<div style="display: -webkit-flex;align-items: center; margin-top: 0.33rem;height: 0.25rem;" @click="openRecord()">
|
<div style="color: #BC9069;font-size: 0.26rem;margin-left: 0.16rem; margin-left: 2.95rem;">
|
开通记录
|
</div>
|
<img src="img/icon_back.png" style="width:0.1rem;height: 0.17rem;margin-left: 0.09rem;">
|
</div>
|
|
<div style="height: 0.4rem;"></div>
|
|
|
</div>
|
|
<div class="div_contentBG3">
|
<div class="div_tips">
|
开通须知
|
</div>
|
|
<div style="color: #333333; font-size: 0.24rem;margin-top: 0.37rem;padding-left: 0.25rem;padding-right: 0.15rem;">
|
1.需要通过你的微信号登录云端ipad协议才能正常使用。<br>
|
2.由于微信规则的问题,如出现个人微信号封号问题,无法事先预料和提醒,且不可逆。<br>
|
3.已经开通,无法退款,请谨慎选择。<br>
|
4.确认开通代表你同意并知晓以上问题。
|
</div>
|
|
<div style="height: 0.4rem;"></div>
|
</div>
|
|
<div style="height: 0.2rem;"></div>
|
|
</div>
|
|
<!-- 发单商品库 -->
|
<div v-if="selectTabType==2" class="div_goodsLibrary" v-cloak>
|
<div class="div_goodsLibrary_content1">
|
<div>
|
<div style="color: #333333;font-size: 0.34rem;height: 0.34rem; display: -webkit-flex;align-items: center;margin-left: 0.25rem;margin-top: 0.23rem;">
|
自动采集官方推荐
|
</div>
|
<div style="color: #666666;font-size: 0.2rem;height: 0.22rem; display: -webkit-flex;align-items: center;margin-left: 0.25rem;margin-top: 0.14rem;">
|
官方精选1个小时内仅发送一个商品(9:00~21:00)
|
</div>
|
</div>
|
<img v-if="!official" src="img/icon_off.png" style="width: 1.02rem;height: 0.62rem;margin-top: 0.27rem;margin-right: 0.2rem;"
|
@click="openGFRecomend(true)">
|
<img v-else src="img/icon_on.png" style="width: 1.02rem;height: 0.62rem;margin-top: 0.27rem;margin-right: 0.2rem;"
|
@click="openGFRecomend(false)">
|
</div>
|
|
<div class="div_goodsLibrary_content2">
|
<div>
|
<div style="color: #333333;font-size: 0.34rem;height: 0.34rem; display: -webkit-flex;align-items: center;margin-left: 0.25rem;margin-top: 0.23rem;">
|
优先发送自选商品
|
</div>
|
<div style="color: #666666;font-size: 0.2rem;height: 0.22rem; display: -webkit-flex;align-items: center;margin-left: 0.25rem;margin-top: 0.14rem;">
|
即选即发,注重质量不追求数量,避免骚扰群友
|
</div>
|
</div>
|
<img v-if="!custom" src="img/icon_off.png" style="width: 1.02rem;height: 0.62rem;margin-top: 0.27rem;margin-right: 0.2rem;"
|
@click="openFSGoods(true)">
|
<img v-else src="img/icon_on.png" style="width: 1.02rem;height: 0.62rem;margin-top: 0.27rem;margin-right: 0.2rem;"
|
@click="openFSGoods(false)">
|
</div>
|
|
<div class="div_goodsLibraryList">
|
<div class="div_item_goodsLibrary" v-for="(item, index) in goodsList" @click="goodsDetail(item)">
|
<img src="img/icon_goodsDelete.png" class="goodsDeleteImg" @click="deleteListGoods(index, item.id)">
|
|
<div class="div_goodsBG">
|
<img v-bind:src="item.goods.picUrl" class="goodsimg" />
|
<img v-if="item.goods.state==2" src="img/icon_send.png" class="topleftImg">
|
<img v-else-if="item.goods.state==1" src="img/icon_ydown.png" class="topleftImg">
|
</div>
|
|
<div class="div_item_rightBg">
|
<div class="div_goods_title_bg">
|
|
<img v-if="item.goods.shopType==10" src="img/icon_tb.png">
|
<img v-else-if="item.goods.shopType==11" src="img/icon_tm.png">
|
<img v-else-if="item.goods.shopType==20" src="img/icon_jd.png">
|
<img v-else-if="item.goods.shopType==30" src="img/icon_pdd.png" style="width: 0.81rem;">
|
<img v-else-if="item.goods.shopType==40" src="img/icon_wph.png" style="width: 0.9rem;">
|
<img v-else-if="item.goods.shopType==50" src="img/icon_sn.png" style="width: 1.12rem;">
|
|
<span v-if="item.goods.shopType==30" class="goods_title" style="text-indent: 0.93rem;">{{item.goods.title}}</span>
|
<span v-else-if="item.goods.shopType==40" class="goods_title" style="text-indent: 1.02rem;">{{item.goods.title}}</span>
|
<span v-else-if="item.goods.shopType==50" class="goods_title" style="text-indent: 1.24rem;">{{item.goods.title}}</span>
|
<span v-else class="goods_title">{{item.goods.title}}</span>
|
</div>
|
<div v-if="item.goods.labels" class="div_goods_labels_bg">
|
<div v-for="(cell, indexPath) in item.goods.labels" style="margin-left: 0.1rem;">
|
<div class="div_goods_label1" :style="{color: cell.color, borderColor:cell.color}"> {{cell.content}} </div>
|
</div>
|
</div>
|
|
<div class="div_store_bg">
|
<img v-if="item.goods.shopInfo" src="img/icon_store.png">
|
<div v-if="item.goods.shopInfo">{{item.goods.shopInfo.shopName}}</div>
|
</div>
|
|
<div class="div_coupon_bg">
|
<div v-if="item.goods.shopType!=40&&item.goods.hasCoupon" style="color: white;font-size: 0.24rem;font-weight: bold;width: 0.41rem;height: 0.36rem;background-color: #E5005C;border-radius: 0.06rem 0 0 0.06rem;text-align: center;">
|
券
|
</div>
|
<div v-else-if="item.goods.shopType==40" style="color: white;font-size: 0.24rem;background-color: #E5005C;border-radius: 0.06rem;line-height: 0.36rem;">
|
{{item.goods.discount}}
|
</div>
|
|
<div v-if="item.goods.shopType!=40&&item.goods.hasCoupon" class="coupon_money"> ¥{{item.goods.couponInfo.amount}}
|
</div>
|
|
<div v-if="item.goods.hasCoupon||item.goods.shopType==40" class="fanli_title"> 返
|
{{item.goods.moneyInfo.fanliMoney}} </div>
|
<div v-else class="fanli_title" style="margin-left: 0rem;"> 返 {{item.goods.moneyInfo.fanliMoney}}
|
</div>
|
|
<img src="img/icon_maxFan.png" style="width: 0.15rem;height: 0.22rem; margin-left: -0.22rem;">
|
|
<div v-if="item.goods.moneyInfo.maxMoney" style="color: #E5005C;font-size: 0.24rem;margin-left: -0.05rem; height: 0.36rem; background-color: #FFBBCB;border-radius: 0 0.06rem 0.06rem 0;display: -webkit-flex;align-items: center;justify-content: center;">
|
{{item.goods.moneyInfo.maxMoney}}
|
</div>
|
</div>
|
|
<div class="div_payment_sales_bg">
|
<div>¥</div>
|
|
<div v-if="item.goods.couponPrice">{{item.goods.couponPrice}}</div>
|
<div v-else>{{item.goods.zkPrice}}</div>
|
|
<div>
|
¥{{item.goods.zkPrice}}
|
</div>
|
<div v-if="item.goods.shopType!=40">月销 {{item.goods.salesCount}}</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<div class="dialogmask_notOpen">
|
<div class="dialog">
|
<img class="closeImg" src="img/icon_close.png" @click="hiddenDialog()">
|
<div class="dialog_title">未开通提醒</div>
|
<div class="dialog_content">云发单首先要登录微信,且需要购买云发单服务,完成设置后,才会自动发单/发圈。</div>
|
<div class="dialog_commit" @click="pushOpenVip">去开通</div>
|
</div>
|
</div>
|
|
<div class="dialogmask_Tips">
|
<div class="dialog">
|
<img class="closeImg" src="img/icon_close.png" @click="hiddenDialog()">
|
<div class="dialog_title">官方采集</div>
|
<div class="dialog_content">开启后30分钟内将会进行第一次发单,之后每1个小时发一个商品,你可随时关闭。</div>
|
<div class="dialog_commit" @click="sureOpenGFSendOrder">知道了</div>
|
</div>
|
</div>
|
|
<div v-show="selectTabType==2" class="loading-more"></div>
|
</div>
|
</body>
|
|
<script src="js/load.js"></script>
|
|
<script>
|
// "http://api.flqapp.com"; http://192.168.1.253:8080
|
var host = "http://api.flqapp.com";
|
var h5url = "http://apph5.banliapp.com";
|
|
$(function() {
|
var app = new Vue({
|
el: '#root',
|
data: {
|
selectTabType: 1,
|
selectOpenPakeg: 0,
|
isOpenCloud: false, //是否了开通云发单权限
|
isWxLogin: false, //是否登录了微信
|
openState: false, // 是否了开通云发单权限
|
userInfo: {},
|
listMenu: [],
|
custom: false, // 优先发送自选商品库
|
official: false, // 自动采集官方推荐
|
page: 1,
|
count: 0,
|
goodsList: [{
|
goods: {
|
labels: []
|
}
|
}]
|
},
|
watch: {
|
|
},
|
methods: {
|
selectTab: function(type) {
|
if (app.selectTabType == type) return;
|
$('.div_header_line_' + type).css('opacity', '1')
|
$('.div_header_' + type).css('color', '#E5005C')
|
|
$('.div_header_line_' + app.selectTabType).css('opacity', '0')
|
$('.div_header_' + app.selectTabType).css('color', '#000000')
|
document.body.scrollTop = document.documentElement.scrollTop = 0;
|
app.selectTabType = type;
|
if (type == 2) { //切换到发单商品库
|
app.page = 1;
|
app.fetchGoodsList();
|
}
|
},
|
|
rule: function() {
|
window.location.href = "cloudPushOrderRule.html";
|
},
|
|
hiddenDialog: function() {
|
$('.dialogmask_notOpen').css('display', 'none')
|
$('.dialogmask_Tips').css('display', 'none')
|
},
|
// 开通套餐
|
touchOpenPackage: function(item, index) {
|
var id = app.nameId(item, index);
|
if (app.selectOpenPakeg == id) return;
|
|
$('#' + id).css('opacity', '1')
|
$('#' + app.selectOpenPakeg).css('opacity', '0')
|
app.selectOpenPakeg = id;
|
},
|
|
nameId: function(item, index) {
|
return index;
|
},
|
|
// 切回开通页面
|
pushOpenVip: function() {
|
$('.dialogmask_notOpen').css('display', 'none')
|
app.selectTab(1);
|
},
|
// 开通云发单
|
openVIP: function() {
|
if (app.selectOpenPakeg == null) {
|
yesApp.toast('请选择开通时长');
|
return;
|
}
|
var type = app.listMenu[app.selectOpenPakeg].type;
|
|
yesApp.showLoading();
|
var uid = yesApp.getUid();
|
var params = {
|
uid: uid,
|
type: type
|
};
|
params = yesApp.getRequestBaseParams(params);
|
$.ajax({
|
type: "GET",
|
data: JSON.parse(params),
|
url: host + "/fanli/api/v2/user/cloud/pay",
|
dataType: "jsonp",
|
async: false,
|
success: function(result) {
|
yesApp.hideLoading();
|
if (result.code == 0) {
|
if (result.data.link.length == 0 || result.data.link == null || result.data.link == '') return;
|
window.location.href = result.data.link;
|
// yesApp.jumpWeb(result.data.link, null);
|
|
} else {
|
yesApp.toast(result.msg);
|
}
|
},
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
yesApp.hideLoading();
|
if (textStatus === 'timeout') {
|
setTimeout(function() {}, 2000);
|
}
|
}
|
});
|
},
|
// 去开通记录页面
|
openRecord: function() {
|
yesApp.jumpWeb(h5url + '/AppInside/cloudPushOrder/openRecord.html', null);
|
},
|
// 云发单开通信息
|
fetcCloudInfo: function() {
|
yesApp.showLoading();
|
var uid = yesApp.getUid();
|
var params = {
|
uid: uid,
|
};
|
params = yesApp.getRequestBaseParams(params);
|
$.ajax({
|
type: "GET",
|
data: JSON.parse(params),
|
url: host + "/fanli/api/v2/user/cloud/getCloudInfo",
|
dataType: "jsonp",
|
async: false,
|
success: function(result) {
|
yesApp.hideLoading();
|
if (result.code == 0) {
|
if (parseInt(result.data.openState) == 0) {
|
app.openState = false;
|
|
} else if (parseInt(result.data.openState) == 1) {
|
app.openState = true;;
|
}
|
app.userInfo = result.data;
|
app.listMenu = result.data.listMenu;
|
|
if (app.listMenu.length > 1 && app.listMenu != null) {
|
app.selectOpenPakeg = null;
|
}
|
|
} else {
|
yesApp.toast(result.msg);
|
}
|
},
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
yesApp.hideLoading();
|
if (textStatus === 'timeout') {
|
setTimeout(function() {}, 2000);
|
}
|
}
|
});
|
},
|
|
// 云商品状态切换 (官方)
|
openGFRecomend: function(state) {
|
if (app.openState) {
|
var states = null;
|
if (state == true) {
|
states = 1;
|
$('.dialogmask_Tips').css('display', 'block');
|
|
} else {
|
states = 0;
|
app.openGFRecomendSGoods(states, 1);
|
}
|
|
} else {
|
$('.dialogmask_notOpen').css('display', 'block');
|
}
|
},
|
|
sureOpenGFSendOrder: function() {
|
$('.dialogmask_Tips').css('display', 'none');
|
var states = 1;
|
app.openGFRecomendSGoods(states, 1);
|
},
|
|
openGFRecomendSGoods: function(states, types) {
|
yesApp.showLoading();
|
var uid = yesApp.getUid();
|
var params = {
|
uid: uid,
|
type: types,
|
state: states
|
};
|
params = yesApp.getRequestBaseParams(params);
|
$.ajax({
|
type: "GET",
|
data: JSON.parse(params),
|
url: host + "/fanli/api/v2/user/cloud/switchState",
|
dataType: "jsonp",
|
async: false,
|
success: function(result) {
|
yesApp.hideLoading();
|
if (result.code == 0) {
|
if (types == 1) {
|
app.official = result.data.state;
|
|
} else if (types == 2) {
|
app.custom = result.data.state;
|
}
|
|
} else {
|
yesApp.toast(result.msg);
|
}
|
},
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
yesApp.hideLoading();
|
if (textStatus === 'timeout') {
|
setTimeout(function() {}, 2000);
|
}
|
}
|
});
|
},
|
|
// 云商品状态切换 (自选)
|
openFSGoods: function(state) {
|
if (app.openState) { // 是否开同了云发单
|
var states = null;
|
if (state == true) {
|
states = 1;
|
|
} else {
|
states = 0;
|
}
|
app.openGFRecomendSGoods(states, 2);
|
|
} else {
|
$('.dialogmask_notOpen').css('display', 'block')
|
}
|
},
|
|
// 发单商品库
|
fetchGoodsList: function() {
|
yesApp.showLoading();
|
var uid = yesApp.getUid();
|
var params = {
|
uid: uid,
|
page: app.page
|
};
|
params = yesApp.getRequestBaseParams(params);
|
$.ajax({
|
type: "GET",
|
data: JSON.parse(params),
|
url: host + "/fanli/api/v2/user/cloud/getGoodsList",
|
dataType: "jsonp",
|
async: false,
|
success: function(result) {
|
load.hidden();
|
yesApp.hideLoading();
|
if (result.code == 0) {
|
app.custom = result.data.custom;
|
app.official = result.data.official;
|
|
if (app.page == 1) {
|
app.goodsList = new Array();
|
}
|
app.page += 1;
|
app.count = result.data.count;
|
|
var list = app.goodsList.concat(result.data.list);
|
app.goodsList = list;
|
|
if (app.count <= app.goodsList.length) {
|
load.noMore();
|
}
|
|
} else {
|
yesApp.toast(result.msg);
|
}
|
},
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
yesApp.hideLoading();
|
if (textStatus === 'timeout') {
|
setTimeout(function() {}, 2000);
|
}
|
}
|
});
|
},
|
|
goodsDetail: function(goods) {
|
var activity = null;
|
var controller = null;
|
var goodsType = goods.goods.goodsType;
|
var goodsId = goods.goods.goodsId;
|
var fromString = '云发单';
|
|
if (goods.goods.goodsType == 1) {
|
activity = 'com.yeshi.ec.rebate.myapplication.ui.recommend.GoodsDetailActivityTB';
|
controller = 'GoodDeTrViewController';
|
|
} else if (goods.goods.goodsType == 2) {
|
activity = 'com.yeshi.ec.rebate.myapplication.ui.recommend.GoodsDetailActivityJD';
|
controller = 'JDGoodsDetailController';
|
|
} else if (goods.goods.goodsType == 3) {
|
activity = 'com.yeshi.ec.rebate.myapplication.ui.recommend.GoodsDetailActivityPDD';
|
controller = 'PDDGoodsDetailController';
|
|
} else if (goods.goods.goodsType == 4) {
|
activity = 'com.yeshi.ec.rebate.myapplication.ui.recommend.GoodsDetailActivityVIP';
|
controller = 'WPHGoodsDetailController';
|
|
} else if (goods.goods.goodsType == 5) {
|
activity = 'com.yeshi.ec.rebate.myapplication.ui.recommend.GoodsDetailActivitySuning';
|
controller = 'SNGoodsDetailController';
|
}
|
var jumpDetail = {
|
activity: activity,
|
controller: controller
|
}
|
|
var params = {
|
goodsType: goodsType,
|
id: goodsId,
|
from: fromString
|
}
|
yesApp.jumpPage(jumpDetail, params);
|
},
|
|
// 删除商品
|
deleteListGoods: function(indexpath, deleteId) {
|
yesApp.showLoading();
|
var uid = yesApp.getUid();
|
var params = {
|
uid: uid,
|
id: deleteId
|
};
|
params = yesApp.getRequestBaseParams(params);
|
$.ajax({
|
type: "GET",
|
data: JSON.parse(params),
|
url: host + "/fanli/api/v2/user/cloud/deleteGoods",
|
dataType: "jsonp",
|
async: false,
|
success: function(result) {
|
yesApp.hideLoading();
|
if (result.code == 0) {
|
|
var list = app.goodsList;
|
list.splice(indexpath, 1);
|
app.goodsList = list;
|
|
} else {
|
yesApp.toast(result.msg);
|
}
|
},
|
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
yesApp.hideLoading();
|
if (textStatus === 'timeout') {
|
setTimeout(function() {}, 2000);
|
}
|
}
|
});
|
}
|
},
|
|
});
|
app.fetcCloudInfo();
|
|
window.onscroll = function() {
|
if (app.selectTabType == 2) {
|
if (Math.abs(getScrollHeight() - getDocumentTop() - getWindowHeight()) < 10) {
|
if (load.isLoading() || (app.page > 1 && app.count <= app.goodsList.length))
|
return;
|
load.show();
|
setTimeout(function() {
|
app.fetchGoodsList();
|
}, 300);
|
}
|
}
|
};
|
});
|
|
//(浏览器窗口上边界内容高度)
|
function getDocumentTop() {
|
var scrollTop = 0,
|
bodyScrollTop = 0,
|
documentScrollTop = 0;
|
if (document.body) {
|
bodyScrollTop = document.body.scrollTop;
|
}
|
if (document.documentElement) {
|
documentScrollTop = document.documentElement.scrollTop;
|
}
|
scrollTop = (bodyScrollTop - documentScrollTop > 0) ? bodyScrollTop : documentScrollTop;
|
console.log("scrollTop:" + scrollTop);
|
return scrollTop;
|
}
|
|
//可视窗口高度(屏幕可以看见的高度)
|
function getWindowHeight() {
|
var windowHeight = 0;
|
if (document.compatMode == "CSS1Compat") {
|
windowHeight = document.documentElement.clientHeight;
|
} else {
|
windowHeight = document.body.clientHeight;
|
}
|
console.log("windowHeight:" + windowHeight);
|
return windowHeight;
|
}
|
|
//滚动条滚动高度(即整个网页的高度)
|
function getScrollHeight() {
|
var scrollHeight = 0,
|
bodyScrollHeight = 0,
|
documentScrollHeight = 0;
|
if (document.body) {
|
bodyScrollHeight = document.body.scrollHeight;
|
}
|
if (document.documentElement) {
|
documentScrollHeight = document.documentElement.scrollHeight;
|
}
|
scrollHeight = (bodyScrollHeight - documentScrollHeight > 0) ? bodyScrollHeight : documentScrollHeight;
|
console.log("scrollHeight:" + scrollHeight);
|
return scrollHeight;
|
}
|
</script>
|
</html>
|