Files
g.hnyhua.cn/Mtxfw.VipSite/mobile/dvideo.html

849 lines
40 KiB
HTML
Raw Normal View History

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title>短视频</title>
<link rel="stylesheet" type="text/css" href="/css/api.css" />
<link rel="stylesheet" type="text/css" href="/css/content.css" />
<script type="text/javascript" src="/scripts/jquery-2.0.2.min.js"></script>
<script type="text/javascript" src="/scripts/jquery.cookie.min.js"></script>
<!--<script type="text/javascript" src="/scripts/iscroll.js"></script>-->
<script type="text/javascript" src="/script/main.js?t=0"></script>
<script type="text/javascript" src="/layer/layer.js"></script>
<script type="text/javascript" src="/Scripts/long.js"></script>
<script type="text/javascript" src="/script/moment.js"></script>
<script type="text/javascript" src="/script/api.js"></script>
<style type="text/css">
html, body {
overflow: hidden;
background-color:#000;
}
.mybalance-item {
float: none;
}
.mybalance-item div {
float: none;
}
#wrapper {
flex: 1;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.pullDown {
position: absolute;
top: -1.25rem;
left: 0;
width: 100%;
z-index: 100;
text-align: center;
display: none;
}
.pullUp {
position: absolute;
bottom: -1.25rem;
left: 0;
width: 100%;
z-index: 100;
text-align: center;
display: none;
}
.pullDown.loading, .pullUp.loading, .pullDown.refresh, .pullUp.refresh {
display: block;
}
.mydata_box0 {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
height: 5em;
background-color: #fff;
}
.mydata_box0 div {
margin-top: 0.5em;
width: 50%;
height: 3em;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #000;
box-sizing: border-box;
}
.mydata_box0.ktxtime div {
margin-top: 0.5em;
width: 25%;
height: 3em;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #000;
box-sizing: border-box;
}
/*.button_box div#czbutton {
width: 97%;
margin-right: 0;
}*/
</style>
<script type="text/javascript">
var userId = null;
var LoginId = null;
var Start = 0;
var demo = null;
var isplay = 0;
var videoindex = 0;
var videocount = 0;
var videolist = null;
var wxPlus = null;
var viewids = "";
var sign = "";
apiready = function () {
userId = getlocalStorage("userId");
LoginId = getlocalStorage("LoginId");
demo = api.require('douYinSlidePlayer');
rdata(1);
api.addEventListener({
name: 'keyback'
}, function (ret, err) {
closeALLFrame();
closeWin();
});
};
function rdata(ag) {
userId = getlocalStorage("userId");
LoginId = getlocalStorage("LoginId");
if (userId != null && LoginId != null) {
var userinfo = getlocalStorage("userinfo");
var userdata = JSON.parse(userinfo);
if (userdata.bdshEnable == "1") {
$("#footer-business").addClass("uhide");
}
}
$api.removeCls($api.dom(".ajaxLoader"), "uhide");
hideshowthjto(0);
hideshowthjto(1);
hideshowthjto(2);
if (ag == 0 || ag == 1) {
Start = 0;
}
api.ajax({
url: apiurl + "/apiajax.ashx?action=getggsplist&userId=" + (userId == null ? "" : userId) + "&LoginId=" + (LoginId == null ? "" : LoginId) + "&Start=" + Start,
method: 'get',
dataType: 'json'
},
function (data, status) {
if (data) {
$api.addCls($api.dom(".ajaxLoader"), "uhide");
if (data.status == 1) {
var html = "";
var list = data.data;
videolist = list;
videocount = list.length;
if (list.length > 0) {
if (ag == 0) {//刷新
} else if (ag == 1) { //第一次打开
$api.setStorage("msecond", list[0].msecond);
$api.setStorage("isView", list[0].isView);
$api.setStorage("productids", list[0].productids);
$api.setStorage("ltype", list[0].ltype);
try {
demo.openPlayer({
rect: {
x: 0,
y: 0,
w: api.frameWidth,
h: api.frameHeight - 50
},
fixed: true,
videos: list,
}, function (ret, err) {
demo.addEventListener(function (ret0, err0) {
//alert(JSON.stringify(ret0));
if (ret0.event == "onGoodsClick") {//点击商品事件
var ltype = ret0.itemData.ltype;
var productid = ret0.itemData.productid;
var linkurl = ret0.itemData.linkurl;
var vid = ret0.itemData.vid;
pausevideo();
if (ltype == 1) {
$api.setStorage("videoid", vid);
onloginlink("zixun.html");
} else {
ondetail(productid);
}
} else if (ret0.event == "onFootListClick") {//点击底部链接事件
} else if (ret0.event == "onDoubleTap") {//视频双击事件
} else if (ret0.event == "onSingleTapConfirmed") {//视频单击事件
if (isplay == 0) {
pausevideo();
} else {
playvideo();
}
} else if (ret0.event == "onFollowBtnClick") {//关注按钮点击事件
var isFollowed = ret0.isFollowed;
var id = ret0.itemData.uid;
if (id == 0) {
toast('此用户不能关注');
} else {
api.ajax({
url: apiurl + "/apiajax.ashx?action=guangzhu&userId=" + userId + "&LoginId=" + LoginId + "&id=" + id + "&t=" + (!isFollowed ? 1 : 0),
method: 'GET',
dataType: 'json'
},
function (data, status) {
if (data) {
if (data.status == 1) {
demo.setLikeCount({
likeCountStr: data.dznum
}, function (ret1, err1) {
//alert(JSON.stringify(ret1,err1));
});
} else {
toast(data.msg);
}
} else {
toast('网络异常,请稍后重试');
}
})
}
} else if (ret0.event == "onLikeBtnClick") {//点赞按钮点击事件
var isLike = ret0.isLike;
var id = ret0.itemData.vid;
api.ajax({
url: apiurl + "/apiajax.ashx?action=dzvideo&userId=" + userId + "&LoginId=" + LoginId + "&id=" + id + "&t=" + (!isLike ? 1 : 0),
method: 'GET',
dataType: 'json'
},
function (data, status) {
if (data) {
if (data.status == 1) {
demo.setLikeCount({
likeCountStr: data.dznum
}, function (ret1, err1) {
//alert(JSON.stringify(ret1,err1));
});
} else {
toast(data.msg);
}
} else {
toast('网络异常,请稍后重试');
}
})
} else if (ret0.event == "onCommonBtnClick") {//评论按钮点击事件
var id = ret0.itemData.vid;
$api.setStorage("videoid", id);
pausevideo();
api.openFrame({
name: 'video_common',
url: 'video_common.html',
bounces: false,
allowEdit: true,
rect: { // 推荐使用Margin布局用于适配屏幕的动态变化
marginBottom: 0, // main页面距离win顶部的高度
w: 'auto', // main页面的宽度 自适应屏幕宽度
}
});
} else if (ret0.event == "onShareBtnClick") {//分享按钮点击事件
alert("此流量视频不能分享!");
/*var id = ret0.itemData.vid;
$api.setStorage("videoid", id);
api.openFrame({
name: 'video_share',
url: 'video_share.html',
bounces: false,
allowEdit: true,
rect: { // 推荐使用Margin布局用于适配屏幕的动态变化
marginBottom: 0, // main页面距离win顶部的高度
w: 'auto', // main页面的宽度 自适应屏幕宽度
}
});*/
} else if (ret0.event == "onMusicBtnClick") {//音乐动画区域点击事件
} else if (ret0.event == "onAuthorNameClick") {//作者名字区域点击事件
} else if (ret0.event == "onVideoTitleClick") {//视频标题区域点击事件
var autoLinkMode = ret0.autoLinkMode;
var matchedText = ret0.matchedText;
} else if (ret0.event == "onMarqueeTextClick") {//跑马灯文字区域点击事件
} else if (ret0.event == "onBackBtnClick") {//返回按钮点击事件
pausevideo();
} else if (ret0.event == "onPageSelected") {//页面上下滑动切换事件这个事件可以获取当前页的index
var id = ret0.itemData.vid;
var isView = ret0.itemData.isView;
var isviewed = 0;
if (viewids != "") {
if (viewids.indexOf("," + id + ",") != -1) {
isviewed = 1;
}
}
if (isviewed == 1) {
isView = true;
}
var index = ret0.curPage;
var msecond = ret0.itemData.msecond;
var ltype = ret0.itemData.ltype;
var productids = ret0.itemData.productids;
execScript0("video_circle", "displaycircle()");
$api.setStorage("videoid", id);
$api.setStorage("videoindex", index);
$api.setStorage("msecond", msecond);
$api.setStorage("isView", isView);
$api.setStorage("isPlay", true);
execScript0("video_circle", "rdata()");
$api.setStorage("productids", productids);
$api.setStorage("ltype", ltype);
execScript0("video_cart", "rdata()");
/*if(index==0){
rdata(2);
}*/
} else if (ret0.event == "isFullScreen") {//全屏切换时有改值,是全屏还是竖屏
}
});
});
} catch (err) {
alert(err)
}
$api.setStorage("isPlay", true);
var closeInterval = setInterval(function () {
clearInterval(closeInterval);
api.openFrame({
name: 'video_circle',
url: 'video_circle.html',
bounces: false,
allowEdit: true,
rect: { // 推荐使用Margin布局用于适配屏幕的动态变化
marginTop: 50, // main页面距离win顶部的高度
marginRight: 10, // main页面距离win顶部的高度
w: '50', // main页面的宽度 自适应屏幕宽度
h: '50'
}
});
execScript0("video_circle", "rdata()");
api.openFrame({
name: 'video_cart',
url: 'video_cart.html',
bounces: false,
allowEdit: true,
rect: { // 推荐使用Margin布局用于适配屏幕的动态变化
marginBottom: 140, // main页面距离win顶部的高度
marginRight: 10, // main页面距离win顶部的高度
w: '36', // main页面的宽度 自适应屏幕宽度
h: '36'
}
});
execScript0("video_cart", "rdata()");
}, 300);
} else if (ag == 2) {//加载更多
Start += list.length;
demo.addVideoDatas({
videos: list
}, function (ret, err) {
toast("加载成功");
});
}
} else {
showbox(2);
}
} else {
sign = data.sign;
if (data.msg == "您未登录微信认证过") {
showbox(0);
} else if (data.msg == "您的流量额度不足") {
showbox(1);
} else if (data.msg == "您未登录") {
$api.rmStorage("userId");
$api.rmStorage("LoginId");
onlink("/");
} else {
toast(data.msg);
}
}
} else {
toast("网络错误!", "1000");
$api.addCls($api.dom(".ajaxLoader"), "uhide");
}
})
}
function showbox(type) {
$api.removeCls($api.dom("#showthjto" + type), "uhide");
}
function onshowcart() {
pausevideo();
api.openFrame({
name: 'video_cartto',
url: 'video_cartto.html',
bounces: false,
allowEdit: true,
rect: { // 推荐使用Margin布局用于适配屏幕的动态变化
marginBottom: 0, // main页面距离win顶部的高度
w: 'auto', // main页面的宽度 自适应屏幕宽度
}
});
}
function delVideo() {
var vindex = $api.getStorage("videoindex");
if (vindex != null) {
videoindex = vindex;
videolist[videoindex].isView = true;
if (viewids == "") {
viewids = "," + videolist[videoindex].vid + ",";
} else {
viewids += videolist[videoindex].vid + ",";
}
/*videolist.splice(videoindex, 1);
demo.setVideoDatas({
videos :videolist
},function(ret,err){
});*/
}
/*if(videocount>1){
demo.delVideoByIndex(videoindex);
}
videocount-=1;
if(videocount<=0){
demo.closePlayer();
showbox(2);
}*/
}
function hideshowthjto(type) {
$api.addCls($api.dom("#showthjto" + type), "uhide");
}
function onRefresh(type) {
rdata(1);
}
function stopPropagation(e) {
if (e.stopPropagation)
e.stopPropagation();
else
e.cancelBubble = true;
}
function dlweixin() {
try {
var dltype = $api.domAll("#dltype0:checked").length;
if (dltype == 1) {
var aliPayPlus = api.require('aliPayPlus');
aliPayPlus.authDirect({
authInfoStr: sign
}, function (ret) {
if (ret.resultStatus == "9000") {
alipayyz(ret.result);
}
});
} else {
wxPlus = api.require('wxPlus');
wxPlus.isInstalled(function (ret, err) {
if (ret.installed) {
$api.removeCls($api.dom(".ajaxLoader"), "uhide");
var getaccessToken = $api.getStorage("accessToken");
var getdynamicToken = $api.getStorage("dynamicToken");
var getexpires = $api.getStorage("accessTokenexpires");
var getopenId = $api.getStorage("openId");
if (getaccessToken != null && getdynamicToken != null && getexpires != null && getopenId != null) {
var dt = judgetime3(new Date());
var dt0 = judgetime3(getexpires);
if (dt > dt0) {
wxPlus.refreshToken({
apiKey: '',
dynamicToken: getdynamicToken
}, function (ret0, err0) {
if (ret0.status) {
var accessToken = ret0.accessToken;
var dynamicToken = ret0.dynamicToken;
var expires = ret0.expires;
var openId = ret0.openId;
$api.setStorage("accessToken", accessToken);
$api.setStorage("dynamicToken", dynamicToken);
$api.setStorage("openId", openId);
var curTime = new Date();
var timeexpire = curTime.setSeconds(curTime.getSeconds() + parseInt(expires));
$api.setStorage("accessTokenexpires", judgetime3(timeexpire));
weixinyz(openId, accessToken);
} else {
if (err0.code == "-1") {
$api.addCls($api.dom(".ajaxLoader"), "uhide");
toast("未知错误!");
} else if (err0.code == "0") {
toast("成功!");
} else if (err0.code == "1") {
toast("apiKey值为空或非法");
} else if (err0.code == "2") {
toast("refreshToken值为空");
} else if (err0.code == "3") {
toast("refreshToken非法");
} else if (err0.code == "4") {
toast("网络超时!");
}
}
});
} else {
weixinyz(getopenId, getaccessToken);
}
} else {
wxPlus.auth({
apiKey: ''
}, function (ret, err) {
if (ret.status) {
var code = ret.code;
wxPlus.getToken({
code: code
}, function (ret0, err0) {
if (ret0.status) {
var accessToken = ret0.accessToken;
var dynamicToken = ret0.dynamicToken;
var expires = ret0.expires;
var openId = ret0.openId;
$api.setStorage("accessToken", accessToken);
$api.setStorage("dynamicToken", dynamicToken);
$api.setStorage("openId", openId);
var curTime = new Date();
var timeexpire = curTime.setSeconds(curTime.getSeconds() + parseInt(expires));
$api.setStorage("accessTokenexpires", judgetime3(timeexpire));
weixinyz(openId, accessToken);
} else {
$api.addCls($api.dom(".ajaxLoader"), "uhide");
if (err0.code == "-1") {
toast("未知错误!");
} else if (err0.code == "0") {
toast("成功!");
} else if (err0.code == "1") {
toast("apiKey值为空或非法");
} else if (err0.code == "2") {
toast("apiSecret值为空或非法");
} else if (err0.code == "3") {
toast("code值为空或非法");
} else if (err0.code == "4") {
toast("网络超时!");
}
}
});
} else {
if (err.code == "-1") {
$api.addCls($api.dom(".ajaxLoader"), "uhide");
toast("未知错误!");
} else if (err.code == "0") {
toast("成功,用户同意!");
} else if (err.code == "1") {
toast("用户取消!");
} else if (err.code == "2") {
toast("用户拒绝授权!");
} else if (err.code == "3") {
toast("当前设备未安装微信客户端!");
}
}
});
}
} else {
$api.addCls($api.dom(".ajaxLoader"), "uhide");
toast("当前设备未安装微信客户端!");
}
});
}
} catch (err) {
$api.addCls($api.dom(".ajaxLoader"), "uhide");
toast(err);
}
}
function alipayyz(result) {
api.ajax({
url: apiurl + "/apiajax.ashx",
method: 'post',
dataType: 'json',
data: {
values: {
action: "alipayyz",
userId: userId,
LoginId: LoginId,
result: result
}
}
},
function (data2, status) {
if (data2) {
$api.addCls($api.dom(".ajaxLoader"), "uhide");
if (data2.status == 1) {
toast(data2.msg);
rdata(1);
} else {
toast(data2.msg);
}
} else {
$api.addCls($api.dom(".ajaxLoader"), "uhide");
toast("网络错误!");
}
})
}
function weixinyz(openId, accessToken) {
wxPlus.getUserInfo({
accessToken: accessToken,
openId: openId
}, function (ret1, err1) {
if (ret1.status) {
var nickname = ret1.nickname;
var sex = ret1.sex;
var headimgurl = ret1.headimgurl;
userId = $api.getStorage("userId");
LoginId = $api.getStorage("LoginId");
if (userId != null) {
api.ajax({
url: apiurl + "/apiajax.ashx",
method: 'post',
dataType: 'json',
data: {
values: {
action: "weixinyz",
userId: userId,
LoginId: LoginId,
openId: openId,
nickname: nickname,
sex: sex,
headimgurl: headimgurl
}
}
},
function (data2, status) {
if (data2) {
$api.addCls($api.dom(".ajaxLoader"), "uhide");
if (data2.status == 1) {
toast(data2.msg);
rdata(1);
} else {
toast(data2.msg);
}
} else {
$api.addCls($api.dom(".ajaxLoader"), "uhide");
toast("网络错误!");
}
})
} else {
$api.addCls($api.dom(".ajaxLoader"), "uhide");
onlink("/");
}
} else {
$api.addCls($api.dom(".ajaxLoader"), "uhide");
if (err1.code == "-1") {
toast("未知错误!");
} else if (err1.code == "0") {
toast("成功!");
} else if (err1.code == "1") {
toast("accessToken 过期!");
} else if (err1.code == "2") {
toast("openId非法");
} else if (err1.code == "3") {
toast("openId值为空");
} else if (err1.code == "4") {
toast("accessToken值为空");
} else if (err1.code == "5") {
toast("accessToken非法");
} else if (err1.code == "6") {
toast("网络超时!");
}
}
});
}
function ongm() {
syindex = 2;
ontolink(0, "../");
}
function onplay0(url) {
$api.setStorage("videourl", url);
onlink("playvideo.html");
}
function setCommonCount(ccount) {
demo.setCommonCount({
commonCountStr: ccount
}, function (ret, err) {
});
}
function pausevideo() {
if (demo != null) {
demo.pause();
isplay = 1;
$api.setStorage("isPlay", false);
execScript0("video_circle", "rdata()");
}
}
function pausevideo0() {
if (demo != null) {
execScript0("video_circle", "closesecond()");
demo.pause();
}
}
function playvideo() {
if (demo != null) {
demo.play();
isplay = 0;
$api.setStorage("isPlay", true);
execScript0("video_circle", "rdata()");
}
}
function ondetail(id) {
onlink("shop_view.html?id=" + id);
}
</script>
</head>
<body class="wrap">
<header style="background:none;">
<div class="ub">
<!--<div class="nav-btn" id="nav-left" style=" margin:0; padding:0; min-width:8.8em">
<img src="/image/header_logo.png" style="margin-left:0.8em; margin-top:0.9em; height:2em;width:8em;" />
</div>-->
<h1 class="ub-f1">短视频</h1>
<!-- <div class="nav-btn blue" id="nav-right" style=" margin:0; padding:0; min-width:3.5em">
<div class="msgbox" onclick="onlink('message.html')">
<span class="msgbox_ico"></span>
<span class="yuanquan_maxbox hover" id="MsgCount">0</span>
</div>
</div>-->
</div>
</header>
<section class="ub-f1" id="wrapper"></section>
<footer style="">
<!--overflow:hidden;box-sizing:border-box;-->
<div class="ub">
<div class="pos_re ub ub-f1 footer-box">
<div id="index_0" class="ub-f1 ub ub-ver" onclick='closeALLFrame();onloginlink("/mobile/")'>
<div class="ub-img5 icon"></div>
<div class="uinn-a13 tx-c">
首页
</div>
</div>
</div>
<div class="pos_re ub ub-f1 footer-box">
<div id="index_2" class="ub-f1 ub ub-ver" onclick='closeALLFrame();onloginlink("news.html")'>
<div class="ub-img5 icon"></div>
<div class="uinn-a13 tx-c">
资讯
</div>
</div>
</div>
<!--<div class="pos_re ub ub-f1 footer-box" onclick='tishi3("正在建设中...")'>
<div class="footer-center-box">
<img src="/image/center.png?t=2">
</div>
</div>-->
<div class="pos_re ub ub-f1 footer-box">
<div id="index_1" class="ub-f1 ub ub-ver " onclick='onloginlink("dvideo.html")'>
<div class="ub-img5 icon icon_act"></div>
<div class="uinn-a13 uinn-a13-hover tx-c">
短视频
</div>
</div>
</div>
<div class="pos_re ub ub-f1 footer-box">
<div id="index_3" class="ub-f1 ub ub-ver " onclick='closeALLFrame();onloginlink("business.html")'>
<div class="ub-img5 icon"></div>
<div class="uinn-a13 tx-c">
门店
</div>
</div>
</div>
<div class="pos_re ub ub-f1 footer-box">
<div id="index_4" class="ub-f1 ub ub-ver " onclick='closeALLFrame();onloginlink("my.html")'>
<div class="ub-img5 icon"></div>
<div class="uinn-a13 tx-c">
我的
</div>
</div>
</div>
</div>
</footer>
<div class="ajaxLoader ub ub-ac uhide" onclick="reload()">
<div class="ub ub-ac ub-ver"><img src="image/load.gif" /><br>正在加载...</div>
</div>
</body>
</html>