rabbit-tian / chaoxing-source Goto Github PK
View Code? Open in Web Editor NEWchaoxing-source
chaoxing-source
收藏
jsBridge.postNotification("CLIENT_SUBSCRIBE_RES", {
cataid: "100000015",
cataName: "网址",
key: activeSign,
content: {
toolbarType: 2,
resTitle: title,
resUrl: methodFn.commonUrl + "1-02active.html?id=" + activeId,
resUid: puid,
resLogo: activeSrc
}
});
try {
jsBridge.bind("CLIENT_SUBSCRIBE_RES", function (object) {
// 成功打开后,发送ajax请求 ,收藏此活动
if (object.status) {
$.ajax({
// url: methodFn.dataUrl + "/activity/save_page?fid=1385&uid=52379735",
url: methodFn.dataUrl + "/activity/save_page",
method: "post",
dataType: "json",
data: {
fid: fid,
uid: puid,
id: id
},
success: function (data) {
if (data.status) {
$("#collect img").attr("src", "/img/red-heart.png");
$("#collect span").text("取消收藏");
isSave = 1;
}
},
error: function () { }
});
}
});
} catch (e) { }
取消收藏
// 取消收藏
jsBridge.postNotification("CLIENT_REMOVE_RES", {
cataid: "100000015",
key: activeSign
});
try {
jsBridge.bind("CLIENT_REMOVE_RES", function (object) {
// alert(JSON.stringify(object));
if (object.status) {
$.ajax({
// url: methodFn.dataUrl + "/activity/del_page?fid=1385&uid=52379735",
url: methodFn.dataUrl + "/activity/del_page?",
method: "post",
dataType: "json",
data: {
fid: fid,
uid: puid,
id: id
},
success: function (data) {
if (data.status) {
$("#collect img").attr("src", "/img/white-heart.png");
$("#collect span").text("收藏");
isSave = 0;
}
},
error: function () { }
});
}
});
} catch (e) { }
var sharebacktype = null;
var tipUrl = null;
if (dealVersion(getXxtVersion()) >= dealVersion("3.1.2.1")) {
sharebacktype = 7;
} else {
$(".mark").show();
sharebacktype = 1;
}
// 填写跳转的地址
resourceUrl = 'http://www.chaoxing.com';
var appScheme =
"chaoxingshareback://url=" +
encodeURIComponent(resourceUrl) +
"&title=" +
encodeURIComponent("运动排行") +
"&sharebacktype=" +
sharebacktype;
tipUrl =
"http://zhuanti.chaoxing.com/special/course/tips?apptag=1000&appScheme=" +
encodeURIComponent(appScheme);
//如果是ios
if (isIos()) {
//如果版本大于等于IOS9
var iosVersion = getIOSVersion();
if (iosVersion >= 9) {
tipUrl =
"http://share1.chaoxing.com/mobile/mooc/tocourse/90394356?sharebacktype=" +
sharebacktype +
"&appScheme=" +
encodeURIComponent(appScheme) +
"&title=&apptag=1000&url=" +
encodeURIComponent(resourceUrl);
}
}
$("#btn").click(function() {
document.location.href = tipUrl;
});
$(".share")
.off("touchstart")
.on("touchstart", function () {
share(
title,
methodFn.commonUrl +
"1-02active.html?id=" +
activeId,
"随手拍,视频,小程序"
);
});
function share(aa, bb, cc) {
resUrl = bb;
var content = {
resTitle: aa,
resUrl: resUrl,
resUid: cc,
toolbarType: 2
};
if (resUrl != null && resUrl != "") {
jsBridge.postNotification("CLIENT_TRANSFER_INFO", {
cataid: 100000015,
content: content
});
}
}
function videoTrigger() {
$(".video-trigger").on("click", function () {
if ($(this).attr('isVideo')) {
jsBridge.postNotification("CLIENT_VIDEO_PLAYER", {
videolist: [
{
videopathm3u8: $(this).data("m3u8"),
videopathmp4: $(this).data("mp4"),
title: $(this).data("title")
},
{
videopathm3u8: $(this).data("m3u8"),
videopathmp4: $(this).data("mp4"),
title: $(this).data("title")
}
],
title: $(this).data("title")
});
}
//隐藏学习通中白色顶部
AppUtils.hideToolbar({
toolbarType: "0"
});
});
}
var methodFn = new activityApp.activity(); // 数据请求 链接
methodFn.imgUrl
methodFn.photourl
methodFn.dataUrl
methodFn.projectUrl
简单介绍:
mobileVersion.js
common.js
base.js
js/CXJSBridge.js
app.utils.js
pulltorefresh.js
function PullRefresh() {
ptr = PullToRefresh.init({
mainElement: "#work", // above which element?
onRefresh: function () {
$load.css({ visibility: "visible" }); // loading图
$.ajax({
// url: methodFn.dataUrl + "/work/page?fid=1385&UID=52379735",
url: methodFn.dataUrl + "/work/page?",
method: "post",
dataType: "json",
data: {
fid: fid,
uid: puid,
index: 0, // 只请求 第一页数据就可
pageSize: counts,
activityId: activeId
},
success: function (data) {
// console.log(data);
if (data.status) {
var list = data.info.list;
if (Utils.isArray(list)) {
// 加载数据 索引
// workIndex += counts;
var htmlwork = workHtml(list);
$("#no-data").hide();
$work.html(htmlwork);
// 计算标题的高度 显示完全与否
titleHiehgt();
// 初始化 轮播图
for (var i = 0; i < swiperArr.length; i++) {
var swiper = new Swiper(".swiper-container" + swiperArr[i], {
slidesPerView: 3
});
}
// 初始化视频播放器
videoTrigger();
// 点赞
$load.css({
visibility: "hidden"
}); // loading图
scrollOnOff = true;
// 初始化 - 长按
$(".part").each(function (e) {
HammerInit($(this)[0]);
});
// 如果已经请求的条数 加上将要 请求的 条数 大于 数据总条数,说明没有数据了
if (data.info.index + data.info.pageSize >= data.info.counts) {
$work.append(
'<div class= "no-more"> 没有更多数据了...</div>'
);
$(window).off("scroll");
} else {
// 懒加载
winScrolld();
}
// }, 1000);
} else {
// 没有数据
$(".load").css({
visibility: "hidden"
});
// 如果第一次就没有数据, 就显示无数据内容
if (workIndex === 0) {
$("#no-data").show();
if (
stau == "已结束" ||
stau == "已过期" ||
stau == "未开始"
) {
$(".publish-now").hide();
}
}
}
}
},
error: function () {
$("#work-fail").text("请稍后重试");
$("#work-fail").show();
setTimeout(function () {
$("#work-fail").hide();
}, 1000);
}
});
}
});
}
AppUtils.hideToolbar({
toolbarType: "0"
});
<input type="text" placeholder="请选择日期" id="test">
laydate.render({
elem: '#test',//指定元素
min: timeChangeSelect(+new Date,3), // 最小时间限制
max: '2019-12-31', // 最大时间限制
});
// 时间戳转换
function timeChangeSelect(time, num) {
var date = new Date(Number(time));
Y = date.getFullYear();
M = double(date.getMonth() + 1);
D = double(date.getDate());
h = double(date.getHours());
m = double(date.getMinutes());
s = double(date.getSeconds());
if (num === 0) {
return Y + "." + M + "." + D + " " + h + ":" + m;
} else if (num === 1) {
return Y + "." + M + "." + D;
} else if (num === 2) {
return m + ":" + s;
}else if (num == 3) {
return Y + "-" + M + "-" + D;
}
// 时间补零操作
function double(time) {
return time < 10 ? "0" + time : time + "";
}
}
//判断特殊表情符号
function isEmojiCharacter(substring) {
for(var i = 0; i < substring.length; i++) {
var hs = substring.charCodeAt(i);
if(0xd800 <= hs && hs <= 0xdbff) {
if(substring.length > 1) {
var ls = substring.charCodeAt(i + 1);
var uc = ((hs - 0xd800) * 0x400) + (ls - 0xdc00) + 0x10000;
if(0x1d000 <= uc && uc <= 0x1f77f) {
return true;
}
}
} else if(substring.length > 1) {
var ls = substring.charCodeAt(i + 1);
if(ls == 0x20e3) {
return true;
}
} else {
if(0x2100 <= hs && hs <= 0x27ff) {
return true;
} else if(0x2B05 <= hs && hs <= 0x2b07) {
return true;
} else if(0x2934 <= hs && hs <= 0x2935) {
return true;
} else if(0x3297 <= hs && hs <= 0x3299) {
return true;
} else if(hs == 0xa9 || hs == 0xae || hs == 0x303d || hs == 0x3030 ||
hs == 0x2b55 || hs == 0x2b1c || hs == 0x2b1b ||
hs == 0x2b50) {
return true;
}
}
}
}
function seeImg() {
var op = {"showIndex":0,"imageUrls":[{"imageUrl":"http://p.ananas.chaoxing.com/star3/origin/56f22bd4e4b0578413c5d02e.jpg?rw=640&rh=182"},{"imageUrl":"http://img1.16q.cn/a56626a15a1c2cc92d0b0972e3d086ba"},{"imageUrl":"http://www.baidu.com/img/bd_logo1.png"}] };
// var op = { "showIndex": 0, "imageUrls": [{ "imageUrl": "http://mobile.ctld.chaoxing.com/certificate/5166546242.png?t=123" }] };
jsBridge.postNotification('CLIENT_PREVIEW_IMAGES', op);
}
// 返回
$("#link-to").on("touchstart", function () {
jsBridge.postNotification("CLIENT_REFRESH_STATUS", { status: 1 });
jsBridge.postNotification("CLIENT_EXIT_LEVEL", {});
});
// 加入 并 跳转到交流小组
$("#chat").on("touchstart", function () {
// alert(circleId)
addGroup1();
jsBridge.postNotification("CLIENT_OPEN_GROUP", {
GroupId: circleId,
Groupbbsid: circleId,
needRecord: "…"
});
});
function addGroup1() {
try {
jsBridge.postNotification("CLIENT_ADDTO_GROUP", {
groupInfo: '{"id": ' + circleId + ',"isCheck":0}',
uid: puid
});
} catch (e) { }
}
/**
* @ 功能:字数控制
* @ 参数:str:要控制的字符串,max:字数上限
*/
function fontControl(elem, max) {
let val = elem.val();
let leng = Math.round(getByteLength(val) / 2);
if(leng > max) {
if(val.replace(/[^\u0-\u80]/gi, "")) { //判断是否包含非汉字字符
let CLength;
CLength = val.match(/[^\u0-\u80]/gi).length; //输入框中值汉字的长度
//计算当输入的值包含除汉字外的字符时,一个汉字算1,两个非汉字字符算1前提下的maxlength值(此公式无逻辑,是简化后的式子)
max = 2 * max - CLength;
}
elem.val( val.substr(0, max) );
showPrompt("作品介绍只能输入500个字!");
}
}
$(".title").on("input propertychange",function(){
fontControl($(this), 500);
});
搜索页跳转链接
$("#activ-search").on("touchstart", function () {
openA('', methodFn.projectUrl + "1-18search.html?activityId=" + activeId);
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.