提交 b8a44575 编写于 作者: yi.li's avatar yi.li

题库详情页开发联调

上级 064aaab4
......@@ -10,46 +10,43 @@
<div class="question-bank-content">
<div class="header-info">
<div class="info-first">
<img src="../images/question/portrait.png">
<img v-if="directoryInfo.avatarImageUrl" :src="directoryInfo.avatarImageUrl">
<img v-if="!directoryInfo.avatarImageUrl" src="../images/question/portrait.png">
<div class="infor">
<p class="name">医生</p>
<p class="question-result">已做题<span>0</span>错误题<span class="err">0</span>正确率<span class="suc">0%</span></p>
<p class="name">{{directoryInfo.name}} 医生</p>
<p class="question-result">已做题<span>{{directoryInfo.finishedNum}}</span>错误题<span class="err">{{directoryInfo.wrongTitle}}</span>正确率<span class="suc">{{directoryInfo.correctRatio}}%</span></p>
</div>
</div>
<div class="info-second">
<div class="item"><img src="../images/question/text.png">错题集<span>(80)</span></div>
<div class="item"><img src="../images/question/heart-h.png">收藏<span>(5)</span></div>
<div class="item" @click="wrongBook"><img src="../images/question/text.png">错题集<span v-if="directoryInfo.wrongTitleBook">({{directoryInfo.wrongTitleBook}})</span></div>
<div class="item" @click="collectBook"><img src="../images/question/heart-h.png">收藏<span v-if="directoryInfo.collectTitleBook">({{directoryInfo.collectTitleBook}})</span></div>
</div>
</div>
<div class="question-intro">
<p>你发我耳环佛为放假哦还文化佛为金佛还温恩覅偶尔为九佛我IE花覅偶平稳破郭伟鹏狂派舞恶徒提交奇偶文化宫呢</p>
<div class="question-intro" v-if="directoryInfo.directoryImageUrl || directoryInfo.directoryIntro">
<img v-if="directoryInfo.directoryImageUrl" :src="directoryInfo.directoryImageUrl">
<p v-if="directoryInfo.directoryIntro">{{directoryInfo.directoryIntro}}</p>
</div>
<div class="course-list">
<div class="course-list" v-if="subDirectoryModelList && subDirectoryModelList.length > 0">
<p class="title"><span class="line"></span>考点</p>
<div class="course-item">
<div class="course-item" v-for="(item, index) in subDirectoryModelList" :key="index">
<div class="left-c">
<p class="title-c">第一篇 基础知识</p>
<p class="join-c">234人已参与</p>
</div>
<div class="right-btn"><span>免费练习</span></div>
</div>
<div class="course-item">
<div class="left-c">
<p class="title-c">第二篇 相关专业知识</p>
<p class="join-c">234人已参与</p>
<!--<div class="progress-course">
<div class="progress-w"><van-progress :percentage="50" :stroke-width="6" color="#449284" :show-pivot="false"/></div>
<span class="mg-set">50%</span><span>共50道</span>
</div>-->
<p class="title-c">{{item.directoryName}}</p>
<p class="join-c" v-if="!cardStatus">{{item.joinUserNum}}人已参与</p>
<div class="progress-course" v-else>
<div class="progress-w"><van-progress :percentage="item.finishedRatio" :stroke-width="6" color="#449284" :show-pivot="false"/></div>
<span class="mg-set">{{item.finishedRatio}}%</span><span>{{item.sumTitle}}</span>
</div>
</div>
<div class="right-btn">
<!-- <span>免费练习</span>-->
<img src="../images/question/lock.png">
<span v-if="!cardStatus && (item.freeFlag == 0)" @click="freeStudy(item)">免费练习</span>
<img v-if="!cardStatus && (item.freeFlag == 1)" src="../images/question/lock.png" @click="unlockHand">
<span v-if="cardStatus == 1" @click="goStudy(item)">{{setTxt(item.finishedRatio)}}</span>
</div>
</div>
</div>
</div>
<BindCardButton
v-if="!cardStatus"
:cardInfo="cardInfo"
@changeClick="changeClick"
@gotoBuy="confirm"
......@@ -60,55 +57,291 @@
@cancle="cancleChangeCard"
@confirm="changeCardAction">
</ChangeCard>-->
<CourseDialog
:subContent="subContent"
confirmBtnText="激活并去学习"
needSubContent
:isShowDialog="showBindCardTips"
@handlerAction="handlerAction"
></CourseDialog>
</div>
</template>
<script>
import CommonNavbar from "@/components/common/common-navbar";
import BindCardButton from "@/components/cme/bind-card-button";
import ChangeCard from "@/components/cme/change-card";
import CourseDialog from "@/components/course/course-dialog";
import { Progress } from 'vant';
import { mapGetters, mapActions } from "vuex";
export default {
components: {
CommonNavbar,
BindCardButton,
ChangeCard,
Progress
Progress,
CourseDialog
},
data() {
return {
token: '',
isWeb: window.__isWeb,
isInfresh: false,
bgColor: "#fff",
isShowNavbar: true,
navTitle: '中级-内科',
isFixNavbar: true,
firstSubjectId: 66,
directoryInfo: {},
subDirectoryModelList: [],
userId: null,
cardStatus: 0,
cardInfo: {
id: 0
},
subContent: '',
cmeCardModels: {},
showBindCardTips: false,
}
},
created() {
let _this = this;
window.__getUserInfoQB = function(param) {
console.log("__getUserInfoQB", param);
_this.token = param.userToken;
_this.userMobile = param.userMobile;
_this.setUserInfo(param);
// _this.checkToken();
_this.initData();
};
_this.getUserInfo();
if (_this.isWeb) {
_this.initData();
}
window.__refresh = function() {
_this.isInfresh = true;
_this.getUserInfo();
};
window.__getPositionData = function(param) {
console.log(param);
// _this.showLoading = false;
param.setEntry = true;
_this.getProvinceIdByPosition(param);
};
},
mounted() {
this.initData();
},
computed: {
...mapGetters(["userInfo"]),
setTxt() {
let txt = '';
return function (val) {
if (val == 0) {
txt = '开始练习';
}else if (val == 100) {
txt = '重新练习';
}else {
txt = '继续练习';
}
return txt;
}
},
},
methods: {
...mapActions(["setUserInfo"]),
//获取用户信息
getUserInfo() {
rocNative.getUserInfo({
__funcName: "__getUserInfoQB"
});
},
initData() {
let param = {
token: this.token,
setEntry: true
};
this.GET(`portal/titleTest/user/getBrushTitleInfo/${this.firstSubjectId}`, param).then(res => {
console.log('详情结果',res.data.data)
if (res.code == "000000") {
this.directoryInfo = JSON.parse(JSON.stringify(res.data.data));
const { subDirectoryModelList, userId, cardType, goodsType, organizationId, provinceId } = this.directoryInfo;
this.subDirectoryModelList = subDirectoryModelList;
this.userId = userId;
//获取底部卡信息
// 如果 hasBindCard 为false,则获取卡信息 0:未绑卡 1:已绑卡
if (!this.cardStatus) {
this.preJumper();
// 查询有无已买未激活的卡
this.hasNoUsedCard();
}
} else {
this.$toast(res.message);
}
});
},
changeClick() {
// token是否失效校验
checkToken() {
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("跳登录", _this.isInfresh);
if(_this.isInfresh) {
rocNative.goBack();
} else {
rocNative.gotoLogin();
}
_this.isInfresh = false;
}else {
}
});
},
// 跳转前判断是否有机构,否则使用定位信息
preJumper() {
// TODO 测试代码
if (window.__isWeb) {
this.getCardInfoByProvinceId(310);
} else {
if (this.directoryInfo.organizationId != 0 && this.directoryInfo.provinceId != 0) {
this.getCardInfoByProvinceId(this.directoryInfo.provinceId);
} else {
this.getPositionData();
}
}
},
// 根据省ID,获取学习卡信息
getCardInfoByProvinceId(provinceId) {
let param = {
area: provinceId + "",
cardType: this.directoryInfo.cardType || 3,
cardTypeList: [ this.directoryInfo.cardType || 3],
goodsType: this.directoryInfo.goodsType,
};
param.setEntry = true;
this.POST("trade/goods/cardList_v2", param).then(res => {
if (res.code == "000000") {
// this.showLoading = false;
this.cardInfo = (res.data && res.data[0]) || { id: 0, name: "职称考精讲课程卡" };
this.subContent = `您已购买“${this.cardInfo.goodsName}”,是否用此卡绑定并激活当前课程。学习卡激活码一旦使用,不可更改不可退回`
}
});
},
// 获取地理位置信息
getPositionData() {
// this.showLoading = true;
console.log("getPositionData");
rocNative.getPositionData({
__funcName: "__getPositionData"
});
},
// 根据位置信息获取省ID
getProvinceIdByPosition(param) {
param.setEntry = true;
this.POST("aggregate/cme/convertLocationToProvinceId", param)
.then(res => {
if (res.code == "000000") {
this.getCardInfoByProvinceId(res.data);
}
}
);
},
// 查询是否买过类似的卡,但还没有激活
hasNoUsedCard() {
let param = {
setEntry: true
};
this.GET(`cme/projectCard/queryNoUsedCard/${this.directoryInfo.goodsType}/${this.directoryInfo.cardType}`, param).then(({ data }) => {
//hasNoUsedCard是否有购买未使用的学习卡:1有,0没有
this.hasNoUsedCard = data.hasNoUsedCard;
if (data.hasNoUsedCard == 1) {
this.cmeCardModels = data.cmeCardModels[0] || {};
this.showBindCardTips = true;
}
});
},
// 处理提示信息框
handlerAction(type) {
if(type == 1) {
this.$sendBuriedData({
component_tag: `882#88219`
});
this.showBindCardTips = false;
} else {
this.$sendBuriedData({
component_tag: `882#88218`
});
this.changeCardAction(this.cmeCardModels.cardKey, true)
}
},
//错题集
wrongBook() {
this.checkTokenForNative(() => {
// this.changeCardAction(cardKey, isInTips);
this.$router.push({
path: '/question-detail',
query: {
directoryId: 0,
secondSubjectId: this.firstSubjectId,//需跟后端确认
cardType: this.directoryInfo.cardType,
goodsType : this.directoryInfo.goodsType,
commitKind : 1,
freeFlag: 1,
currentTitle: '错题集'
}
})
});
},
//收藏
collectBook() {
this.checkTokenForNative(() => {
// this.changeCardAction(cardKey, isInTips);
this.$router.push({
path: '/question-detail',
query: {
directoryId: 0,
secondSubjectId: this.firstSubjectId,//需跟后端确认
cardType: this.directoryInfo.cardType,
goodsType : this.directoryInfo.goodsType,
commitKind : 2,
freeFlag: 1,
currentTitle: '收藏'
}
})
});
},
changeClick() {},
confirm() {},
//免费练习
freeStudy(obj) {
this.checkTokenForNative(() => {
// this.changeCardAction(cardKey, isInTips);
this.$router.push({
path: '/question-detail',
query: {
directoryId: obj.directoryId,
secondSubjectId: this.firstSubjectId,//需跟后端确认
cardType: this.directoryInfo.cardType,
goodsType : this.directoryInfo.goodsType,
commitKind : 3,
freeFlag: obj.freeFlag,
currentTitle: obj.directoryName
}
})
});
},
//解锁
unlockHand() {
this.$toast('购买后可练习')
},
//开始练习
goStudy(obj) {},
},
}
</script>
......@@ -116,7 +349,7 @@ export default {
.question-bank-wrap{
background-color: #FFFFFF;
width: 100%;
padding-bottom: 30px;
padding-bottom: 60px;
box-sizing: border-box;
.question-bank-content{
padding: 0 16px;
......@@ -192,15 +425,17 @@ export default {
box-sizing: border-box;
box-shadow: 0 1px 12px 0 rgba(0, 0, 0, 0.05);
border-radius: 12px;
padding: 12px 0;
img{
width: 100%;
border-radius: 6px 6px 0 0;
display: block;
height: 160px;
}
p{
color: #676869;
font-size: 12px;
line-height: 18px;
padding: 0 12px;
padding: 12px;
/*&:first-child{
margin-top: 12px;
}*/
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册