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

每周更新课程

背景色等
上级 95fdcf43
......@@ -31,10 +31,11 @@
<span
v-if="!item.id"
class="text-action text-action-no"
@click="toastToBuy('每周更新课程')"
>
更新中
</span>
<img v-else-if="!hasBindCard && item.trySeeFlag == 1 && !item.trySeeTime" @click="toastToBuy" class="key" v-show="!hasBindCard" src="../../images/cme/phrase2/key.png" alt="">
<img class="key" v-else-if="!hasBindCard && item.trySeeFlag == 1 && !item.trySeeTime" @click="toastToBuy('升级最新版本可试看课程')" src="../../images/cme/phrase2/key.png" alt="">
<span
v-else-if="!hasBindCard && item.trySeeFlag == 1"
@click="gotoExamOrCourse(item, portalModule.contentList, index, true)"
......@@ -338,8 +339,8 @@ export default {
},
// 弹框提示
toastToBuy() {
Toast('购买后可学习课程');
toastToBuy(toastMsg) {
Toast(toastMsg);
}
}
};
......@@ -614,6 +615,7 @@ export default {
.key {
width: px2rem(15px);
height: px2rem(15px);
margin-right: px2rem(20px);
}
}
span {
......
......@@ -18,7 +18,7 @@
<li
v-for="(model, mIndex) in titleTestModelList"
:key="mIndex"
:class="{active: crrentModelIndex == mIndex}"
:class="{active: currentModelIndex == mIndex}"
@click="selectModel(model, mIndex)"
>
<span>{{model.title}}</span>
......@@ -29,7 +29,8 @@
<li class="list" v-for="(item, index) in listData" :key="index">
<span class="title">{{item.name}}</span>
<ul class="item">
<li :id="'subject_' + sIndex"
<li
:id="'subject_' + sIndex"
:class="{'no-active' : subject.openFlag == 0, 'has-bind' : subject.bindCardStatus == 1}"
v-for="(subject, sIndex) in item.secondSubjectModelList"
:key="sIndex"
......@@ -38,7 +39,10 @@
<span>{{subject.name}}</span>
<span>({{subject.code}})</span>
<span v-show="subject.bindCardStatus == 1" class="buy">己购</span>
<span v-show="subject.openFlag == 0" class="time">{{formatTime(subject.predictTime, '{y}年{m}月')}}上线</span>
<span
v-show="subject.openFlag == 0"
class="time"
>{{formatTime(subject.predictTime, '{y}年{m}月')}}上线</span>
</li>
</ul>
</li>
......@@ -65,13 +69,13 @@ import CardBanner from "@/components/cme/card-banner";
import Loading from "@/components/common/common-loading";
import CommonTitle from "@/components/common/common-title";
import { mapGetters, mapActions } from "vuex";
import { getWebPageUrl, parseTime } from '@/utils/index'
import { getWebPageUrl, parseTime } from "@/utils/index";
export default {
data() {
return {
existBind: 0,
crrentModelIndex: 0,
currentModelIndex: 0,
titleTestModelList: [],
showLoading: false,
isWeb: window.__isWeb,
......@@ -120,7 +124,7 @@ export default {
}
],
isInfresh: false,
hasLogin: false,
hasLogin: false
};
},
computed: {
......@@ -135,7 +139,7 @@ export default {
},
created() {
var _this = this;
_this.crrentModelIndex = 0;
_this.currentModelIndex = 0;
window.__getUserInfo = function(param) {
_this.setUserInfo(param);
_this.token = param.userToken;
......@@ -150,7 +154,8 @@ export default {
}
window.__refresh = function() {
_this.isInfresh = true;
_this.crrentModelIndex = 0;
_this.currentModelIndex = 0;
console.log(_this.currentModelIndex);
_this.getUserInfo();
};
......@@ -163,8 +168,8 @@ export default {
},
mounted() {
var _this = this;
this.listData = [];
this.currentModelIndex = 0;
},
methods: {
......@@ -172,14 +177,14 @@ export default {
// 选择职称
selectModel(model, index) {
this.crrentModelIndex = index;
this.currentModelIndex = index;
this.listData =
this.titleTestModelList[index].firstSubjectModelList || [];
},
// 跳转到项目页面
coopDetails(item) {
if(item.openFlag == 0) return;
if (item.openFlag == 0) return;
// this.$sendBuriedData({
// component_tag: `880#8803#${item.id}#${item.name}` //'210#210002#0#'+item.projectName
// });
......@@ -206,9 +211,7 @@ export default {
let paramList = [
{
key: "pageUrl",
value: getWebPageUrl(
`profexam/#/coop?id=${item.projectId}`
),
value: getWebPageUrl(`profexam/#/coop?id=${item.projectId}`),
type: 4,
seqNo: 1
}
......@@ -217,7 +220,6 @@ export default {
modeCode: "M300",
jsonString: paramList
});
},
//获取版本号
......@@ -240,7 +242,7 @@ export default {
if (res.code == "000000") {
this.existBind = res.data.existBind || 0;
this.titleTestModelList = res.data.titleTestModelList;
if(this.existBind) {
if (this.existBind) {
this.resetPosition(this.titleTestModelList);
}
this.listData = res.data.titleTestModelList[0].firstSubjectModelList;
......@@ -252,14 +254,17 @@ export default {
// 查找对应的职称与专业
resetPosition(list) {
if(!list.length) return;
let parentIndex = 0, subIndex = 0, firstSub = [], secondSub = [];
for(let i = 0; i < list.length; i ++) {
if (!list.length) return;
let parentIndex = 0,
subIndex = 0,
firstSub = [],
secondSub = [];
for (let i = 0; i < list.length; i++) {
firstSub = list[i].firstSubjectModelList;
for(let j = 0; j < firstSub.length; j ++) {
for (let j = 0; j < firstSub.length; j++) {
secondSub = firstSub[j].secondSubjectModelList;
for(let k = 0; k < secondSub.length; k ++) {
if(secondSub[k].bindCardStatus) {
for (let k = 0; k < secondSub.length; k++) {
if (secondSub[k].bindCardStatus) {
parentIndex = i;
subIndex = k;
break;
......@@ -267,20 +272,21 @@ export default {
}
}
}
this.crrentModelIndex = parentIndex;
this.currentModelIndex = parentIndex;
this.resetProjectPosition(subIndex);
},
// 将定位到的元素,滚动到最上面
resetProjectPosition(subIndex) {
this.$nextTick( () => {
this.$nextTick(() => {
setTimeout(() => {
// let scrollTop = this.$refs['subject_' + subIndex].offsetTop;
let scrollTop = document.getElementById('subject_' + subIndex).offsetTop;
let scrollTop = document.getElementById("subject_" + subIndex)
.offsetTop;
console.log(scrollTop);
window.scrollTo(0, scrollTop);
}, 100);
})
});
},
// 监听滚动事件
......@@ -300,7 +306,7 @@ export default {
// 格式化时间
formatTime(time, cFormat) {
return parseTime(time, cFormat)
return parseTime(time, cFormat);
},
// token是否失效校验
......@@ -314,7 +320,7 @@ export default {
if (res.code !== "000000") {
//未登录 跳转登录页
console.log("跳登录", _this.isInfresh);
if(_this.isInfresh) {
if (_this.isInfresh) {
rocNative.goBack();
} else {
rocNative.gotoLogin();
......@@ -324,7 +330,7 @@ export default {
_this.hasLogin = true;
}
});
},
}
}
};
</script>
......@@ -403,6 +409,7 @@ export default {
}
&.has-bind {
color: #449284;
background: rgba(68, 146, 132, 1);
.buy {
position: absolute;
top: 0;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册