提交 c70a1adb 编写于 作者: guangjun.yang's avatar guangjun.yang

代码整理等

上级 f9bd5304
<template>
<!-- 组件详情页面:模块列表及其下面的元件列表 -->
<div class="page-container-merge">
<CommonNavbar
id="header"
:bgColor="bgColor"
v-show="isShowNavbar"
:isBlack="isBlack"
:isShowShare="isShowShare"
:title="navTitle"
:shareTitle="project.projectName"
:shareTitleInfo="project.projectIntro"
:isFixNavbar="isFixNavbar"
:burialPoint="pointStyle"
borderStyle="0px solid #fff"
:backMethod="from"
></CommonNavbar>
<div class="page-content list-container">
<!-- banner图片 -->
<div v-if="bannerType == 1" class="page-content-img-container">
<img class="banner-img" :src="attachmentUrl" />
<!-- <img v-show="project.status == 1" class="banner-img-1" src="../images/status-join.png" /> -->
<img v-show="project.status == 5" class="banner-img-5" src="../images/status-keep-on.png" />
<img v-show="project.status == 10" class="banner-img-10" src="../images/status-end-cme.png" />
</div>
<!-- banner视频 -->
<CommonTcPlayer v-if="bannerType == 2" style="flex" :options="videoOptions"></CommonTcPlayer>
<!-- 项目标题 -->
<CommonDescription
:projectName="project.projectName"
:studyNum="project.studyNum"
:subject="project.subject"
/>
<!-- 步骤条 -->
<div v-if="project.cmeType != 2">
<CmeStep
:currentProgress="project.currentProgress"
:studyProgress="project.studyProgress"
:credit="project.credit"
:creditId="project.creditId"
:certificateUrl="project.certificateUrl"
:inScope="project.inScope"
:projectId="projectId"
:certificateId="project.certificateId"
@applicationCredit="applicationCredit"
/>
</div>
<!-- 简介和目录 -->
<div class="intro-catalogue-container">
<div
id="content-title"
class="title"
:class="{'fixed-title-1': (fixedFlag && !isWeb), 'fixed-title-2': (fixedFlag && isWeb)}"
>
<span :class="{'focus': tabFlag}" @click="jumpIntro">简介</span>
<span :class="{'focus': !tabFlag}" @click="jumpCatalogue">目录</span>
</div>
<div v-if="fixedFlag" style="height: 60px;"></div>
<div id="intro-content" class="intro-content">
<BasicInfo
:projectNo="project.projectNo"
:credit="project.credit"
:level="project.level"
:scope="project.scope"
:startDate="project.startDate"
:endDate="project.endDate"
:organName="project.organName"
:remind="project.remind"
:projectCredit="project.projectCredit"
/>
<LearnKnow :mustKnow="project.mustKnow"></LearnKnow>
<CommonSpliteLine></CommonSpliteLine>
<ItemIntro :textContent="textContent" @itemIntroText="itemIntroText"></ItemIntro>
<ItemLeader v-if="projectLeader"
:projectLeader="projectLeader"
:leaderText="leaderText"
@changeLeaderText="changeLeaderText"
/>
<TeacterIntro v-if="doctorList.length" :doctorList="doctorList"></TeacterIntro>
</div>
<CommonSpliteLine></CommonSpliteLine>
<div id="catalogue-content" class="catalogue-content">
<div class="catalogue-title">目录</div>
<CellListDetail
:projectComponent="projectComponentDTOS"
:actionList="actionList"
:detailNum="detailNum"
:courseRequire="courseRequire"
/>
</div>
</div>
</div>
<Loading v-show="showLoading" />
<!-- 弹框 -->
<CommonDialog
:isShowDialog="isShowDialog"
:isSingle="isSingle"
:cancleBtnText="cancleBtnText"
:confirmBtnText="confirmBtnText"
:content="dialogContent"
@handlerAction="handlerAction"
/>
<!-- 弹框 -->
<ExjumperDialog
:isShowDialog="isShowEJDialog"
isSingle
needSubContent
content="确保您已经从云鹊平台购买优惠学习卡。跳转后请申请考试、激活学习卡,考试通过后申请证书。"
subContent="学分由中华医学电子音像出版社授予,如有问题可致电400-920-8899云鹊医客服咨询。"
cancleBtnText="我知道了"
@handlerAction="handlerEJAction"
/>
<ExjumperButton
@btnClick="beforeJumpToExam"
v-if="project.cmeType == 2 && project.inScope !== 0"
:btnText="project.currentProgress > 1 ? '参加考试' : '学完全部课程,可参加考试'"
:type="project.currentProgress > 1 ? 'primary' : 'disabled'"></ExjumperButton>
<div v-if="project.cmeType == 2 && project.inScope !== 0" style="padding-top: 30px"></div>
</div>
</template>
<script>
import CommonNavbar from "@/components/common/common-navbar";
import CommonDescription from "@/components/common/common-description";
import CommonSpliteLine from "@/components/common/common-splite-line";
import CellListDetail from "@/components/business/cell-list-detail";
// import NoPermContent from "@/components/business/no-perm-content";
// import CommonBannerVideo from "@/components/common/common-banner-video";
import CommonTcPlayer from "@/components/common/common-tcplayer";
import Loading from "@/components/common/common-loading";
import CmeStep from "@/components/cme/cme-step";
import BasicInfo from "@/components/cme/basic-info";
import LearnKnow from "@/components/cme/learn-know";
import ItemIntro from "@/components/cme/item-intro";
import ItemLeader from "@/components/cme/item-leader";
import TeacterIntro from "@/components/cme/teacter-intro";
import CommonDialog from "@/components/cme/common-dialog";
import ExjumperDialog from "@/components/cme/exjumper-dialog";
import ExjumperButton from "@/components/cme/exjumper-button";
import { getWebPageUrl, gotoPage } from "@/utils/index";
import { mapGetters, mapActions } from "vuex";
import vueFilters from "@/utils/filter";
export default {
data() {
return {
// token: "9B62E5874DA94979A54DB3E9DFC1443F",
isWeb: window.__isWeb,
textContent: "",
leaderText: "",
pageTitle: "",
isShowShare: true,
premissionFlag: false,
isSingle: false,
dialogContent: "", // 弹框内容
confirmBtnText: "", // 弹框按钮
cancleBtnText: "",
isShowDialog: false,
isShowEJDialog: false,
tabFlag: true, // 显示目录还是简介
fixedFlag: false, // 目录和简介是否固定
project: {
credit: "", // 学分
creditId: 0, // 学分Id
level: "", // 项目等级
scope: "", // 申请范围
remind: "", // 在不在范围提醒
startDate: 0, // 开始时间
endDate: 0, // 结束时间
organName: "", // 发起机构
projectName: "", // 项目名称
projectNo: "", // 项目编号
currentProgress: 0, // 项目进度
projectIntro: "", // 项目介绍
mustKnow: "", // 学习须知
studyNum: 0, // 学习人数
studyProgress: "0%", // 学习进度
subject: "", // 学科
status: 0, // 项目状态 5是进行中 10是已结束
certificateUrl: "", // 证书url
inScope: 0, // 是否在范围内判断
projectCredit: "", // 学分
certificateId: "0",
cmeType: 1, // 1: 自营项目; 2: 中华医学会二类
examBtnUrl: '', // 考试按钮跳转连接
firstIntoExam: false, // true弹框,是否首次进入考试,用于首次跳转弹框提示,只跟项目和人员有关
jumpToContents: false, // 是否跳转到目录
// cmeType=2时不显示进度,
// projectNo为空时不显示项目编号,
// projectLeader为空时不显示项目负责人,
// inScope=0时考试按钮不显示,
// currentProgress>1时考试按钮显示并可用
},
projectLeader: {},
doctorList: [],
from: "inner",
isBlack: false,
showLoading: false,
projectId: "1",
//componentId: 1,
//moduleId: 1,
contentList: [],
//moduleName: "",
bannerType: 1, // 1 图片 2视频
videoOptions: {
mp4: "",
autoplay: false, //iOS下safari浏览器,以及大部分移动端浏览器是不开放视频自动播放这个能力的
coverpic: require("../images/video-cover.png"),
width: "415", //视频的显示宽度,请尽量使用视频分辨率宽度
height: "210" //视频的显示高度,请尽量使用视频分辨率高度
},
//projectStatus: 1, //1没有获得证书 2是获得全部证书
attachmentUrl: require("../images/banner-default.png"),
bgColor: "none",
navTitle: "项目详情",
// compTitle: "组件名称",
isShowNavbar: true,
isFixNavbar: true,
pointStyle: "activity",
projectComponentDTOS: [],
actionList: [],
detailNum: 0,
courseRequire: 0,
clientType: 0,
// currentProgress>1时考试按钮显示并可用
btnType: 'primary', // primary: 可跳转时(currentProgress = 1); disabled: 不可跳转时
btnText: '学完全部课程,可参加考试' // 参加考试(currentProgress = 1); 或者学完全部课程,可参加考试
};
},
components: {
CommonNavbar,
CommonDescription,
CommonSpliteLine,
CellListDetail,
Loading,
CommonTcPlayer,
CmeStep,
BasicInfo,
LearnKnow,
ItemIntro,
ItemLeader,
TeacterIntro,
CommonDialog,
ExjumperButton,
ExjumperDialog
},
computed: {
...mapGetters(["userInfo"]),
},
created() {
let _this = this;
this.from = this.$route.query.from || this.from || "native";
this.projectId = this.$route.query.id || 1;
this.courseRequire = this.$route.query.courseRequire;
window.__getUserInfo64Comp = function(param) {
_this.token = param.userToken;
_this.setUserInfo(param);
_this.checkToken();
_this.getProjectParticularsV2();
};
_this.getUserInfo();
// if (__isWeb && process.env.BUILD_ENV == "development") {
// let param = {};
// __getUserInfo64Comp(param);
// }
if (__isWeb) {
_this.getProjectParticularsV2();
}
window.__refresh = function() {
_this.getUserInfo();
};
// 打开页面埋点
this.$sendBuriedData({
// action: "打开页面",
component_tag: `211#0#${this.projectId}#0`
});
},
mounted() {
window.addEventListener("scroll", this.scrollFun);
const _this = this;
},
beforeDestroyed() {
window.removeEventListener("scroll", this.scrollFun);
},
methods: {
...mapActions(["setUserInfo"]),
beforeJumpToExam() {
// 如果是首次,则弹出弹框
if(this.project.firstIntoExam) {
this.isShowEJDialog = true;
} else {
this.jumpToExamAction();
}
},
// 第一次跳转弹框,点击时调用相应接口
handlerEJAction() {
this.isShowEJDialog = false;
this.jumpToExamAction();
this.firstIntoExamAction();
},
// 跳转到第三方考试页面
jumpToExamAction() {
this.isShowEJDialog = false;
let paramList = [
{
key: "pageUrl",
value: this.project.examBtnUrl,
type: 4,
seqNo: 1
},
// 此字段不配置,则用原来的逻辑
{
key: "needCache",
value: '1', // 0不缓存,其它值都做缓存
type: 4,
seqNo: 1
}
];
rocNative.dispatchEventByModuleCode({
modeCode: "M300",
jsonString: paramList
});
},
// 首次进入考试时记录(点击‘我知道了’时调用)
firstIntoExamAction() {
let _this = this;
let param = {
token: _this.userInfo.userToken || this.token,
setEntry: true
};
this.NEW_POST(`cme/project/${_this.projectId}/firstIntoExam`, param).then(res => {
console.log('in isFirstIntoExam back', res);
});
},
//获取用户信息
getUserInfo() {
rocNative.getUserInfo({
__funcName: "__getUserInfo64Comp"
});
},
scrollFun() {
let scrollTop =
document.body.scrollTop || document.documentElement.scrollTop;
let h;
const catalogue = document.getElementById("catalogue-content");
// const h = catalogue.offsetTop - 600;
if (scrollTop > 20) {
this.isBlack = true;
this.bgColor = "#fff";
} else {
this.isBlack = false;
this.bgColor = "none";
}
// this.fixedFlag = scrollTop > 300 ? true : false;
// 中华医学会项目
if(this.project.cmeType == 2) {
h = catalogue.offsetTop - 520;
this.fixedFlag = scrollTop > 280 ? true : false;
} else {
h = catalogue.offsetTop - 600;
this.fixedFlag = scrollTop > 420 ? true : false;
}
this.tabFlag = scrollTop > h ? false : true;
},
// token是否失效校验
checkToken() {
let _this = this;
let param = {
token: _this.userInfo.userToken || _this.token,
setEntry: true
};
this.GET("campaign/admin/task/checkToken", param).then(res => {
if (res.code !== "000000") {
//未登录 跳转登录页
console.log("跳登录");
rocNative.gotoLogin();
} else {
// if (!_this.premissionFlag) {
// _this.premissionFlag = true;
// _this.permission(); // 提示是否有机构和在申请范围内
// }
}
});
},
//(判断是否加入机构,是否为认证用户,是否在申请范围内)
permission() {
let _this = this;
let param = {
id: _this.projectId,
creditId: _this.project.creditId,
token: _this.userInfo.userToken || this.token,
setEntry: true
};
_this.NEW_POST("cme/credit/rangeCheck", param).then(res => {
if (res.code == "219004" || res.code == "219012") {
// 未加入机构 219004 不在申请范围 219012
this.dialogContent = `该项目仅对${_this.project.scope}的用户开放`;
this.cancleBtnText = "我知道了";
this.isShowDialog = true;
this.isSingle = true;
} else {
this.isShowDialog = false;
}
});
},
// 立即申请学分
applicationCredit() {
let _this = this;
let param = {
id: _this.projectId,
creditId: _this.project.creditId,
token: _this.userInfo.userToken || this.token,
setEntry: true
};
_this.NEW_POST("cme/credit/applyCheck", param).then(res => {
if (res.code == "000000") {
gotoPage(
_this,
`cme/#/credit-edit?creditId=${_this.project.creditId}`
);
} else if (res.code == "219004" || res.code == "219005") {
// 未加入机构 219004 未身份认证 219005 不在申请范围 219012
let params = {
__funcName: "__checkPermissions",
permCode: "009014"
};
rocNative.checkPermissions(params);
}
// else if (res.code == "219012") {
// this.dialogContent = res.message;
// this.cancleBtnText = "我知道了";
// this.isShowDialog = true;
// this.isSingle = true;
// }
else {
this.dialogContent = res.message;
this.cancleBtnText = "我知道了";
this.isShowDialog = true;
this.isSingle = true;
}
});
},
// 弹框按钮事件
handlerAction(data) {
this.isShowDialog = false;
},
// 锚点到简介
jumpIntro() {
this.tabFlag = true;
this.fixedFlag = true;
const intro = document.getElementById("intro-content");
const title = document.getElementById("content-title");
let h;
if (this.isWeb) {
h = intro.offsetTop - title.offsetHeight;
} else {
h = intro.offsetTop - 85 - title.offsetHeight;
// h = intro.offsetTop - 75 - title.offsetHeight;
}
window.scrollTo(0, h);
this.isBlack = true;
this.bgColor = "#fff";
this.$sendBuriedData({
component_tag: `211#211007#${this.projectId}`
});
},
// 锚点到目录
jumpCatalogue() {
this.tabFlag = false;
this.fixedFlag = true;
const catalogue = document.getElementById("catalogue-content");
const title = document.getElementById("content-title");
let h;
if (this.isWeb) {
h = catalogue.offsetTop - title.offsetHeight;
} else {
h = catalogue.offsetTop - 85 - title.offsetHeight;
}
window.scrollTo(0, h);
this.isBlack = true;
this.bgColor = "#fff";
this.$sendBuriedData({
component_tag: `211#211008#${this.projectId}`
});
},
// 获取项目详情
getProjectParticularsV2() {
let _this = this;
let param = {
token: _this.userInfo.userToken || this.token,
setEntry: true
};
// _this.showLoading = true;
this.NEW_GET(`cme/project/${_this.projectId}/info`, param).then(res => {
if (res.code == "000000") {
// 先设置视频URL再显示视频组件 ------------ BEGIN
if (res.data.attachmentType == 2) {
_this.videoOptions.mp4 = res.data.attachmentUrl;
} else {
_this.attachmentUrl = res.data.attachmentUrl;
}
_this.bannerType = res.data.attachmentType;
if (_this.bannerType == 2) {
_this.clientType = __isWeb ? 1 : __isAndroid ? 2 : 3;
}
// 先设置视频URL再显示视频组件 ------------ END
_this.project = res.data;
if (_this.project.projectIntro) {
_this.textContent =
_this.project.projectIntro.length > 70
? _this.project.projectIntro.slice(0, 70) + "..."
: this.project.projectIntro;
}
_this.project.mustKnow = _this.project.mustKnow.replace(
/(\r\n)|\r|\n/g,
"<br>"
);
_this.projectLeader = res.data.projectLeader;
if (_this.projectLeader && _this.projectLeader.info) {
_this.leaderText =
_this.projectLeader.info.length > 70
? _this.projectLeader.info.slice(0, 70) + "..."
: this.projectLeader.info;
}
_this.doctorList = res.data.doctorList;
//_this.projectStatus = res.data.projectStatus;
_this.projectComponentDTOS = _this.setListData(
res.data.projectComponentDTOS
);
if (!_this.isWeb && !_this.premissionFlag) {
_this.premissionFlag = true;
_this.permission(); // 提示是否有机构和在申请范围内
}
// TODO Add by Anndy Yang
if (_this.project.currentProgress == 2) {
this.$nextTick(() => {
window.scrollTo(0, 0);
});
}
// 直接跳转
if(_this.project.jumpToContents) {
setTimeout(() => {
this.jumpCatalogue();
}, 200);
}
}
//_this.showLoading = false;
});
},
// 项目负责人--详情(收起)
changeLeaderText(data) {
let _this = this;
if (_this.projectLeader.info) {
if (!data.allTextFlag) {
_this.leaderText =
_this.projectLeader.info.length > 70
? _this.projectLeader.info.slice(0, 70) + "..."
: this.projectLeader.info;
} else {
_this.leaderText = _this.projectLeader.info;
}
}
},
// 项目介绍
itemIntroText(data) {
let _this = this;
if (_this.project.projectIntro) {
if (!data.allTextFlag) {
_this.textContent =
_this.project.projectIntro.length > 70
? _this.project.projectIntro.slice(0, 70) + "..."
: this.project.projectIntro;
} else {
_this.textContent = _this.project.projectIntro;
}
}
},
setListData(data) {
let _this = this;
let list = data;
let actionList = [];
let detailNum = 0;
for (let i = 0; i < list.length; i++) {
for (let j = 0; j < list[i].portalModuleDTOS.length; j++) {
detailNum++;
if (list[i].portalModuleDTOS[j].status === 2) {
list[i].portalModuleDTOS[j].value =
"共" + list[i].portalModuleDTOS[j].nodeCount + "节";
} else {
list[i].portalModuleDTOS[j].value = "尚未开始";
}
list[i].portalModuleDTOS[j].disabled =
list[i].portalModuleDTOS[j].status === 2 ? false : true;
//展开项记录
if (list[i].portalModuleDTOS[j].expandStatus == 1) {
actionList.push(list[i].portalModuleDTOS[j].expandKey);
}
for (
let z = 0;
z < list[i].portalModuleDTOS[j].contentList.length;
z++
) {
list[i].portalModuleDTOS[j].contentList[z].height = _this.getHight(
list[i].portalModuleDTOS[j].contentList[z]
);
}
}
}
_this.actionList = actionList;
_this.detailNum = detailNum;
console.log("list转为:", list, actionList, detailNum);
// list[0].portalModuleDTOS[3].contentList[0].certificateFlag = 2;
// list[0].portalModuleDTOS[3].contentList[1].certificateFlag = 2;
return list;
},
getHight(data) {
let len = vueFilters.strLength(data.name);
let certificate = data.certificateFlag;
if (len > 30 && certificate == 2) {
return "2";
} else if (len > 30 && certificate != 2) {
return 2;
} else if (len <= 30 && certificate == 2) {
return "1";
} else if (len <= 30 && certificate != 2) {
return 1;
}
}
}
};
</script>
<style lang="scss" scoped>
@import "../style/mixin";
.page-container-merge {
.nav-top .nav-title {
height: px2rem(0px);
// padding: px2rem(18px);
}
.banner-img {
display: inherit;
width: px2rem(375px);
height: px2rem(210px);
&-1 {
position: absolute;
left: 0;
top: px2rem(180px);
width: px2rem(76px);
height: px2rem(30px);
}
&-5 {
position: absolute;
left: 0;
top: px2rem(180px);
width: px2rem(76px);
height: px2rem(30px);
}
&-10 {
position: absolute;
left: 0;
top: px2rem(180px);
width: px2rem(76px);
height: px2rem(30px);
}
}
.list-container {
// margin-bottom: px2rem(40px);
}
.intro-catalogue-container {
.title {
height: px2rem(50px);
line-height: px2rem(30px);
padding: 0 px2rem(15px);
border-bottom: 1px solid #f0f1f2;
span {
display: inline-block;
line-height: px2rem(15px);
font-size: px2rem(15px);
color: #979899;
padding-right: px2rem(35px);
}
span.focus {
position: relative;
color: #373839;
}
span.focus:after {
content: "";
position: absolute;
left: px2rem(7px);
bottom: px2rem(-14px);
background: #449284;
// border-bottom: px2rem(1px) solid #449284;
width: px2rem(10px);
height: px2rem(3px);
border-radius: px2rem(3px);
}
}
.title.fixed-title-1 {
position: fixed;
left: 0;
top: px2rem(60px);
background: #fff;
width: 100%;
z-index: 999;
}
.title.fixed-title-2 {
position: fixed;
left: 0;
top: px2rem(0px);
background: #fff;
width: 100%;
z-index: 999;
}
.catalogue-content {
padding: px2rem(30px) px2rem(15px) 0;
.catalogue-title {
font-size: px2rem(18px);
color: #373839;
font-weight: 700;
margin-bottom: px2rem(16px);
}
}
}
}
</style>
<template>
<!-- 组件详情页面:模块列表及其下面的元件列表 -->
<div class="page-container-merge">
<CommonNavbar
id="header"
:bgColor="bgColor"
v-show="isShowNavbar"
:isBlack="isBlack"
:isShowShare="isShowShare"
:title="navTitle"
:shareTitle="project.projectName"
:shareTitleInfo="project.projectIntro"
:isFixNavbar="isFixNavbar"
:burialPoint="pointStyle"
borderStyle="0px solid #fff"
:backMethod="from"
></CommonNavbar>
<div class="page-content list-container">
<!-- banner图片 -->
<div v-if="bannerType == 1" class="page-content-img-container">
<img class="banner-img" :src="attachmentUrl" />
<!-- <img v-show="project.status == 1" class="banner-img-1" src="../images/status-join.png" /> -->
<img v-show="project.status == 5" class="banner-img-5" src="../images/status-keep-on.png" />
<img v-show="project.status == 10" class="banner-img-10" src="../images/status-end-cme.png" />
</div>
<!-- banner视频 -->
<CommonTcPlayer v-if="bannerType == 2" style="flex" :options="videoOptions"></CommonTcPlayer>
<!-- 项目标题 -->
<CommonDescription
:projectName="project.projectName"
:studyNum="project.studyNum"
:subject="project.subject"
/>
<!-- 步骤条 -->
<div ref="cmeStepRef">
<CmeStep
:currentProgress="project.currentProgress"
:studyProgress="project.studyProgress"
:credit="project.credit"
:creditId="project.creditId"
:certificateUrl="project.certificateUrl"
:inScope="project.inScope"
:projectId="projectId"
:certificateId="project.certificateId"
@applicationCredit="applicationCredit"
/>
</div>
<!-- 简介和目录 -->
<div class="intro-catalogue-container">
<div id="content-title" class="title" :class="{'fixed-title-1': (fixedFlag && !isWeb), 'fixed-title-2': (fixedFlag && isWeb)}">
<span :class="{'focus': tabFlag}" @click="jumpIntro">简介</span>
<span :class="{'focus': !tabFlag}" @click="jumpCatalogue">目录</span>
</div>
<div id="intro-content" class="intro-content">
<BasicInfo
:projectNo="project.projectNo"
:credit="project.credit"
:level="project.level"
:scope="project.scope"
:startDate="project.startDate"
:endDate="project.endDate"
:organName="project.organName"
:remind="project.remind"
:projectCredit="project.projectCredit"
/>
<LearnKnow :mustKnow="project.mustKnow"></LearnKnow>
<CommonSpliteLine></CommonSpliteLine>
<ItemIntro :textContent="textContent" @itemIntroText="itemIntroText"></ItemIntro>
<ItemLeader
:projectLeader="projectLeader"
:leaderText="leaderText"
@changeLeaderText="changeLeaderText"/>
<TeacterIntro :doctorList="doctorList"></TeacterIntro>
</div>
<CommonSpliteLine></CommonSpliteLine>
<div id="catalogue-content" class="catalogue-content">
<div class="catalogue-title">目录</div>
<CellListDetail
:projectComponent="projectComponentDTOS"
:actionList="actionList"
:detailNum="detailNum"
:courseRequire="courseRequire"
/>
</div>
</div>
</div>
<Loading v-show="showLoading" />
<!-- 弹框 -->
<CommonDialog
:isShowDialog="isShowDialog"
:isSingle="isSingle"
:cancleBtnText="cancleBtnText"
:confirmBtnText="confirmBtnText"
:content="dialogContent"
@handlerAction="handlerAction"
/>
</div>
</template>
<script>
import CommonNavbar from "@/components/common/common-navbar";
import CommonDescription from "@/components/common/common-description";
import CommonSpliteLine from "@/components/common/common-splite-line";
import CellListDetail from "@/components/business/cell-list-detail";
// import NoPermContent from "@/components/business/no-perm-content";
// import CommonBannerVideo from "@/components/common/common-banner-video";
import CommonTcPlayer from "@/components/common/common-tcplayer";
import Loading from "@/components/common/common-loading";
import CmeStep from "@/components/cme/cme-step";
import BasicInfo from "@/components/cme/basic-info";
import LearnKnow from "@/components/cme/learn-know";
import ItemIntro from "@/components/cme/item-intro";
import ItemLeader from "@/components/cme/item-leader";
import TeacterIntro from "@/components/cme/teacter-intro";
import CommonDialog from "@/components/cme/common-dialog";
import { getWebPageUrl, gotoPage } from "@/utils/index";
import { mapGetters, mapActions } from "vuex";
import vueFilters from "@/utils/filter";
export default {
data() {
return {
// token: "9B62E5874DA94979A54DB3E9DFC1443F",
isWeb: window.__isWeb,
textContent: "",
leaderText: "",
pageTitle: "",
isShowShare: true,
premissionFlag: false,
isSingle: false,
dialogContent: "", // 弹框内容
confirmBtnText: "", // 弹框按钮
cancleBtnText: "",
isShowDialog: false,
tabFlag: true, // 显示目录还是简介
fixedFlag: false, // 目录和简介是否固定
project: {
credit: "", // 学分
creditId: 0, // 学分Id
level: "", // 项目等级
scope: "", // 申请范围
remind: "", // 在不在范围提醒
startDate: 0, // 开始时间
endDate: 0, // 结束时间
organName: "", // 发起机构
projectName: "", // 项目名称
projectNo: "", // 项目编号
currentProgress: 0, // 项目进度
projectIntro: "", // 项目介绍
mustKnow: "", // 学习须知
studyNum: 0, // 学习人数
studyProgress: "0%", // 学习进度
subject: "", // 学科
status: 0, // 项目状态 5是进行中 10是已结束
certificateUrl: "", // 证书url
inScope: 0, // 是否在范围内判断
projectCredit: "", // 学分
certificateId: "0"
},
projectLeader: {},
doctorList: [],
from: "inner",
isBlack: false,
showLoading: false,
projectId: "1",
//componentId: 1,
//moduleId: 1,
contentList: [],
//moduleName: "",
bannerType: 1, // 1 图片 2视频
videoOptions: {
mp4: "",
autoplay: false, //iOS下safari浏览器,以及大部分移动端浏览器是不开放视频自动播放这个能力的
coverpic: require("../images/video-cover.png"),
width: "415", //视频的显示宽度,请尽量使用视频分辨率宽度
height: "210" //视频的显示高度,请尽量使用视频分辨率高度
},
//projectStatus: 1, //1没有获得证书 2是获得全部证书
attachmentUrl: require("../images/banner-default.png"),
bgColor: "none",
navTitle: "项目详情",
// compTitle: "组件名称",
isShowNavbar: true,
isFixNavbar: true,
pointStyle: "activity",
projectComponentDTOS: [],
actionList: [],
detailNum: 0,
courseRequire: 0,
clientType: 0
};
},
components: {
CommonNavbar,
CommonDescription,
CommonSpliteLine,
CellListDetail,
Loading,
CommonTcPlayer,
CmeStep,
BasicInfo,
LearnKnow,
ItemIntro,
ItemLeader,
TeacterIntro,
CommonDialog
},
computed: {
...mapGetters(["userInfo"])
},
created() {
let _this = this;
this.from = this.$route.query.from || this.from || "native";
this.projectId = this.$route.query.id || 1;
this.courseRequire = this.$route.query.courseRequire;
window.__getUserInfo64Comp = function(param) {
_this.token = param.userToken;
_this.setUserInfo(param);
_this.checkToken();
_this.getProjectParticularsV2();
};
_this.getUserInfo();
// if (__isWeb && process.env.BUILD_ENV == "development") {
// let param = {};
// __getUserInfo64Comp(param);
// }
if (__isWeb) {
_this.getProjectParticularsV2();
}
window.__refresh = function() {
_this.getUserInfo();
};
// 打开页面埋点
this.$sendBuriedData({
// action: "打开页面",
component_tag: `211#0#${this.projectId}#0`
});
},
mounted() {
window.addEventListener("scroll", this.scrollFun);
const _this = this;
},
beforeDestroyed() {
window.removeEventListener("scroll", this.scrollFun);
},
methods: {
...mapActions(["setUserInfo"]),
//获取用户信息
getUserInfo() {
rocNative.getUserInfo({
__funcName: "__getUserInfo64Comp"
});
},
scrollFun() {
let scrollTop =
document.body.scrollTop || document.documentElement.scrollTop;
const catalogue = document.getElementById("catalogue-content");
const h = catalogue.offsetTop - 600;
if (scrollTop > 20) {
this.isBlack = true;
this.bgColor = "#fff";
} else {
this.isBlack = false;
this.bgColor = "none";
}
this.fixedFlag = scrollTop > 300 ? true : false;
this.tabFlag = scrollTop > h ? false : true;
},
// token是否失效校验
checkToken() {
let _this = this;
let param = {
token: _this.userInfo.userToken || _this.token,
setEntry: true
};
this.GET("campaign/admin/task/checkToken", param).then(res => {
if (res.code !== "000000") {
//未登录 跳转登录页
console.log("跳登录");
rocNative.gotoLogin();
} else {
// if (!_this.premissionFlag) {
// _this.premissionFlag = true;
// _this.permission(); // 提示是否有机构和在申请范围内
// }
}
});
},
//(判断是否加入机构,是否为认证用户,是否在申请范围内)
permission() {
let _this = this;
let param = {
id: _this.projectId,
creditId: _this.project.creditId,
token: _this.userInfo.userToken || this.token,
setEntry: true
};
_this.NEW_POST("cme/credit/rangeCheck", param).then(res => {
if (res.code == "219004" || res.code == "219012") {
// 未加入机构 219004 不在申请范围 219012
this.dialogContent = `该项目仅对${_this.project.scope}的用户开放`;
this.cancleBtnText = "我知道了";
this.isShowDialog = true;
this.isSingle = true;
} else {
this.isShowDialog = false;
}
});
},
// 立即申请学分
applicationCredit() {
let _this = this;
let param = {
id: _this.projectId,
creditId: _this.project.creditId,
token: _this.userInfo.userToken || this.token,
setEntry: true
};
_this.NEW_POST("cme/credit/applyCheck", param).then(res => {
if (res.code == "000000") {
gotoPage(
_this,
`cme/#/credit-edit?creditId=${_this.project.creditId}`
);
} else if (res.code == "219004" || res.code == "219005") {
// 未加入机构 219004 未身份认证 219005 不在申请范围 219012
let params = {
__funcName: "__checkPermissions",
permCode: "009014"
};
rocNative.checkPermissions(params);
}
// else if (res.code == "219012") {
// this.dialogContent = res.message;
// this.cancleBtnText = "我知道了";
// this.isShowDialog = true;
// this.isSingle = true;
// }
else {
this.dialogContent = res.message;
this.cancleBtnText = "我知道了";
this.isShowDialog = true;
this.isSingle = true;
}
});
},
// 弹框按钮事件
handlerAction(data) {
this.isShowDialog = false;
},
// 锚点到简介
jumpIntro() {
this.tabFlag = true;
this.fixedFlag = true;
const intro = document.getElementById("intro-content");
const title = document.getElementById("content-title");
let h;
if(this.isWeb) {
h = intro.offsetTop - title.offsetHeight;
}else {
h = intro.offsetTop - 75 - title.offsetHeight;
}
window.scrollTo(0, h);
this.isBlack = true;
this.bgColor = "#fff";
this.$sendBuriedData({
component_tag: `211#211007#${this.projectId}`
});
},
// 锚点到目录
jumpCatalogue() {
this.tabFlag = false;
this.fixedFlag = true;
const catalogue = document.getElementById("catalogue-content");
const title = document.getElementById("content-title");
let h;
if(this.isWeb) {
h = catalogue.offsetTop - title.offsetHeight;
}else {
h = catalogue.offsetTop - 85 - title.offsetHeight;
}
window.scrollTo(0, h);
this.isBlack = true;
this.bgColor = "#fff";
this.$sendBuriedData({
component_tag: `211#211008#${this.projectId}`
});
},
// 获取项目详情
getProjectParticularsV2() {
let _this = this;
let param = {
token: _this.userInfo.userToken || this.token,
setEntry: true
};
// _this.showLoading = true;
this.NEW_GET(`cme/project/${_this.projectId}/info`, param).then(res => {
if (res.code == "000000") {
// 先设置视频URL再显示视频组件 ------------ BEGIN
if (res.data.attachmentType == 2) {
_this.videoOptions.mp4 = res.data.attachmentUrl;
} else {
_this.attachmentUrl = res.data.attachmentUrl;
}
_this.bannerType = res.data.attachmentType;
if (_this.bannerType == 2) {
_this.clientType = __isWeb ? 1 : __isAndroid ? 2 : 3;
}
// 先设置视频URL再显示视频组件 ------------ END
_this.project = res.data;
if(_this.project.projectIntro) {
_this.textContent = _this.project.projectIntro.length > 70 ? _this.project.projectIntro.slice(0, 70) + "..." : this.project.projectIntro;
}
_this.project.mustKnow = _this.project.mustKnow.replace(/(\r\n)|\r|\n/g,"<br>");
_this.projectLeader = res.data.projectLeader || {};
if(_this.projectLeader.info) {
_this.leaderText = _this.projectLeader.info.length > 70 ? _this.projectLeader.info.slice(0, 70) + "..." : this.projectLeader.info;
}
_this.doctorList = res.data.doctorList;
//_this.projectStatus = res.data.projectStatus;
_this.projectComponentDTOS = _this.setListData(
res.data.projectComponentDTOS
);
if(!_this.isWeb && !_this.premissionFlag) {
_this.premissionFlag = true;
_this.permission(); // 提示是否有机构和在申请范围内
}
// TODO Add by Anndy Yang
if(_this.project.currentProgress == 2) {
this.$nextTick( () => {
window.scrollTo(0, 0);
// window.scrollTo(0, this.$refs.cmeStepRef.offsetTop - 100);
// window.scrollTo(0, this.$refs.cmeStepRef.offsetTop - 100);
})
}
}
//_this.showLoading = false;
});
},
// 项目负责人--详情(收起)
changeLeaderText(data) {
let _this = this;
if(_this.projectLeader.info) {
if(!data.allTextFlag) {
_this.leaderText = _this.projectLeader.info.length > 70 ? _this.projectLeader.info.slice(0, 70) + "..." : this.projectLeader.info;
}else {
_this.leaderText = _this.projectLeader.info;
}
}
},
// 项目介绍
itemIntroText(data) {
let _this = this;
if(_this.project.projectIntro) {
if(!data.allTextFlag) {
_this.textContent = _this.project.projectIntro.length > 70 ? _this.project.projectIntro.slice(0, 70) + "..." : this.project.projectIntro;
}else {
_this.textContent = _this.project.projectIntro;
}
}
},
setListData(data) {
let _this = this;
let list = data;
let actionList = [];
let detailNum = 0;
for (let i = 0; i < list.length; i++) {
for (let j = 0; j < list[i].portalModuleDTOS.length; j++) {
detailNum++;
if (list[i].portalModuleDTOS[j].status === 2) {
list[i].portalModuleDTOS[j].value =
"共" + list[i].portalModuleDTOS[j].nodeCount + "节";
} else {
list[i].portalModuleDTOS[j].value = "尚未开始";
}
list[i].portalModuleDTOS[j].disabled =
list[i].portalModuleDTOS[j].status === 2 ? false : true;
//展开项记录
if (list[i].portalModuleDTOS[j].expandStatus == 1) {
actionList.push(list[i].portalModuleDTOS[j].expandKey);
}
for (
let z = 0;
z < list[i].portalModuleDTOS[j].contentList.length;
z++
) {
list[i].portalModuleDTOS[j].contentList[z].height = _this.getHight(
list[i].portalModuleDTOS[j].contentList[z]
);
}
}
}
_this.actionList = actionList;
_this.detailNum = detailNum;
console.log("list转为:", list, actionList, detailNum);
// list[0].portalModuleDTOS[3].contentList[0].certificateFlag = 2;
// list[0].portalModuleDTOS[3].contentList[1].certificateFlag = 2;
return list;
},
getHight(data) {
let len = vueFilters.strLength(data.name);
let certificate = data.certificateFlag;
if (len > 30 && certificate == 2) {
return "2";
} else if (len > 30 && certificate != 2) {
return 2;
} else if (len <= 30 && certificate == 2) {
return "1";
} else if (len <= 30 && certificate != 2) {
return 1;
}
}
// 获取单个模块信息
// getComponentInfoById(componentId) {
// let _this = this;
// let param = {
// componentId: componentId,
// token: _this.userInfo.userToken,
// setEntry: true
// };
// this.GET("portal/portalApp/component", param).then(res => {
// if (res.code == "000000") {
// _this.attachmentUrl = res.data.imageUrl;
// _this.projectIntro = res.data.introduce;
// _this.projectName = res.data.name;
// }
// });
// },
// 获取单个项目信息
// getCoopInfo(projectId) {
// let _this = this;
// let param = {
// portalProjectId: projectId,
// token: _this.userInfo.userToken,
// setEntry: true
// };
// this.GET("portal/portalApp/queryProjectParticulars", param).then(res => {
// if (res.code == "000000") {
// // 先设置视频URL再显示视频组件 ------------ BEGIN
// if (res.data.attachmentType == 2) {
// _this.videoOptions.mp4 = res.data.attachmentUrl;
// } else {
// _this.attachmentUrl = res.data.attachmentUrl;
// }
// _this.bannerType = res.data.attachmentType;
// if(_this.bannerType == 2) {
// _this.clientType = __isWeb ? 1 : __isAndroid ? 2 : 3;
// }
// // 先设置视频URL再显示视频组件 ------------ END
// _this.projectIntro = res.data.projectIntro;
// _this.projectName = res.data.projectName;
// _this.pStatus = res.data.status;
// }
// });
// },
// setContent(data) {
// let list = data;
// for(let i=0;i<list.length;i++) {
// let len = vueFilters.strLength(list[i].name);
// let certificate = list[i].certificateFlag;
// if(len > 30 && certificate == 2) {
// list[i].height = "2";
// } else if (len > 30 && certificate != 2) {
// list[i].height = 2;
// } else if (len <= 30 && certificate == 2) {
// list[i].height = "1";
// } else if(len <= 30 && certificate != 2) {
// list[i].height = 1;
// }
// }
// console.log('contentList!',list);
// return list;
// },
// 获取内容列表
// getContentList(moduleId) {
// let _this = this;
// let param = {
// moduleId: _this.moduleId,
// token: _this.userInfo.userToken,
// setEntry: true,
// projectId: _this.projectId,
// };
// _this.showLoading = true;
// this.GET("portal/portalApp/contentList", param).then(res => {
// // _this.showLoading = false;
// if (res.code == "000000") {
// _this.contentList = _this.setContent(res.data.contentList);
// }
// });
// },
}
};
</script>
<style lang="scss" scoped>
@import "../style/mixin";
.page-container-merge {
.nav-top .nav-title {
height: px2rem(0px);
// padding: px2rem(18px);
}
.banner-img {
display: inherit;
width: px2rem(375px);
height: px2rem(210px);
&-1 {
position: absolute;
left: 0;
top: px2rem(180px);
width: px2rem(76px);
height: px2rem(30px);
}
&-5 {
position: absolute;
left: 0;
top: px2rem(180px);
width: px2rem(76px);
height: px2rem(30px);
}
&-10 {
position: absolute;
left: 0;
top: px2rem(180px);
width: px2rem(76px);
height: px2rem(30px);
}
}
.list-container {
// margin-bottom: px2rem(40px);
}
.intro-catalogue-container {
.title {
height: px2rem(50px);
line-height: px2rem(30px);
padding: 0 px2rem(15px);
border-bottom: 1px solid #f0f1f2;
span {
display: inline-block;
line-height: px2rem(15px);
font-size: px2rem(15px);
color: #979899;
padding-right: px2rem(35px);
}
span.focus {
position: relative;
color: #373839;
}
span.focus:after {
content: "";
position: absolute;
left: px2rem(7px);
bottom: px2rem(-14px);
background: #449284;
// border-bottom: px2rem(1px) solid #449284;
width: px2rem(10px);
height: px2rem(3px);
border-radius: px2rem(3px);
}
}
.title.fixed-title-1 {
position: fixed;
left: 0;
top: px2rem(60px);
background: #fff;
width: 100%;
z-index: 999;
}
.title.fixed-title-2 {
position: fixed;
left: 0;
top: px2rem(0px);
background: #fff;
width: 100%;
z-index: 999;
}
.catalogue-content {
padding: px2rem(30px) px2rem(15px) 0;
.catalogue-title {
font-size: px2rem(18px);
color: #373839;
font-weight: 700;
margin-bottom: px2rem(16px);
}
}
}
}
</style>
...@@ -456,8 +456,6 @@ export default { ...@@ -456,8 +456,6 @@ export default {
let scrollTop = let scrollTop =
document.body.scrollTop || document.documentElement.scrollTop; document.body.scrollTop || document.documentElement.scrollTop;
let h = intorOffsetTop - 135 let h = intorOffsetTop - 135
console.log(`scrollFun scrollTop intorOffsetTop cataOffsetTop`, scrollTop, intorOffsetTop, cataOffsetTop);
// 显示头部导航 // 显示头部导航
if (scrollTop > 20) { if (scrollTop > 20) {
this.isBlack = true; this.isBlack = true;
...@@ -479,6 +477,7 @@ export default { ...@@ -479,6 +477,7 @@ export default {
} else { } else {
this.fixedFlag = false; this.fixedFlag = false;
} }
// 如果滚动高度大于 // 如果滚动高度大于
if(scrollTop > cataOffsetTop - 600) { if(scrollTop > cataOffsetTop - 600) {
this.tabFlag = false; this.tabFlag = false;
...@@ -490,21 +489,15 @@ export default { ...@@ -490,21 +489,15 @@ export default {
// 锚点到简介 // 锚点到简介
jumpIntro() { jumpIntro() {
// this.tabFlag = true;
// this.fixedFlag = true;
if(!this.tabFlag) { if(!this.tabFlag) {
this.tabFlag = true; this.tabFlag = true;
} }
if(!this.fixedFlag) { if(!this.fixedFlag) {
this.fixedFlag = true; this.fixedFlag = true;
} }
console.log(`jumpIntro cataOffsetTop intorOffsetTop`, cataOffsetTop, intorOffsetTop);
let h; let h;
if (this.isWeb) { if (this.isWeb) {
h = intorOffsetTop - 30 - titleOffsetHeight; h = intorOffsetTop - 30 - titleOffsetHeight;
// } else if(window.__isIOS){
// h = intorOffsetTop - 35 - titleOffsetHeight;
} else { } else {
h = intorOffsetTop - 85 - titleOffsetHeight; h = intorOffsetTop - 85 - titleOffsetHeight;
} }
...@@ -524,12 +517,10 @@ export default { ...@@ -524,12 +517,10 @@ export default {
if(!this.fixedFlag) { if(!this.fixedFlag) {
this.fixedFlag = true; this.fixedFlag = true;
} }
console.log(`jumpCatalogue cataOffsetTop intorOffsetTop`, cataOffsetTop, intorOffsetTop);
let h; let h;
if (this.isWeb) { if (this.isWeb) {
h = cataOffsetTop - titleOffsetHeight; h = cataOffsetTop - titleOffsetHeight;
} else { } else {
// h = cataOffsetTop - 75 - titleOffsetHeight;
h = cataOffsetTop - 100; h = cataOffsetTop - 100;
} }
window.scrollTo(0, h); window.scrollTo(0, h);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册