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

Merge branch 'dev-question-bank-0916' into release

* dev-question-bank-0916: (58 commits)
  分享使用shareContent字段值
  在全局上加上断行设置
  仿真模拟,刷题助考更安心!
  n一张题库卡可以解锁一个二类学科的所有题目
  您答错的题目会自动记录在这里哦
  如果没有找到,则不做后面操作
  点击购买时,关闭弹框 多选可以取消
  loading只在第一次加载或者返回刷新时才用
  激活并去练习
  添加部分埋点
  调整高度
  样式再调整
  共题干图片支持 样式
  解决样式问题
  单选等标志样式
  免费学习的提示及跳转
  直接传商品id
  没有引入函数
  配置有问题
  传入seqNo字段
  ...

# Conflicts:
#	src/views/merge-detail.vue
#	src/views/share-merge-detail.vue
......@@ -81,7 +81,7 @@ export default {
default: ""
},
projectId: {
type: String,
type: String | Number,
default: ""
},
limitTimes: {
......@@ -118,7 +118,7 @@ export default {
goShare() {
this.$sendBuriedData({
component_tag: `882#88209`
});
});
let _this = this;
let videoUrl = this.$route.query.videoUrl || '';
let info = "";
......@@ -131,15 +131,15 @@ export default {
} else {
info = JSON.stringify({
projectId: this.projectId,
})
}
})
}
let param = {
channel: 1, // 分享渠道 1:APP
info: info,
type: 3, // 业务类型 1:教培项目 2:继教项目 3:职称考项目
token: _this.userInfo.userToken,
setEntry: true
};
};
_this.NEW_POST("portal/shareParam/save", param).then(res => {
if (res.code == "000000") {
let url = getWebPageUrl(`profexam/#/sharecoop?uuid=${res.data}`);
......@@ -148,7 +148,7 @@ export default {
}
}).catch( e => {
console.error(e);;
});
});
},
//分享
......@@ -232,6 +232,12 @@ export default {
font-weight: 700;
color: rgba(51, 51, 51, 1);
line-height: 26px;
display: inline-block;
max-width: 230px;
height: 36px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.nav-part {
......
<template>
<div class="fixed-qb-header">
<div class="header-info" :class="!isWeb ? 'top-set' : ''">
<div class="info-first">
<img v-if="directoryInfo.avatarImageUrl" :src="directoryInfo.avatarImageUrl">
<img v-if="!directoryInfo.avatarImageUrl" src="../../images/question/portrait.png">
<div class="infor">
<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" @click="wrongBook(1)"><img src="../../images/question/text.png">错题集<span v-if="directoryInfo.wrongTitleBook">({{directoryInfo.wrongTitleBook}})</span></div>
<div class="item" @click="wrongBook(2)"><img src="../../images/question/heart-h.png">收藏<span v-if="directoryInfo.collectTitleBook">({{directoryInfo.collectTitleBook}})</span></div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
isWeb: window.__isWeb,
}
},
props: {
directoryInfo: {
type: Object,
default: () => {}
},
},
methods: {
wrongBook(type) {
this.$emit('handlerBook',type)
},
},
}
</script>
<style lang="less" scoped>
.fixed-qb-header{
position: relative;
.header-info{
position: fixed;
z-index: 200;
background-color: #FFFFFF;
padding: 0 16px;
box-sizing: border-box;
width: 100%;
&.top-set{
top: 73px;
}
.info-first{
display: flex;
padding: 20px 0;
img{
width: 44px;
height: 44px;
border-radius: 50%;
}
.infor{
margin-left: 12px;
.name{
color: #373839;
font-size: 18px;
font-weight: 700;
line-height: 22px;
}
.question-result{
font-size: 14px;
color: #676869;
line-height: 16px;
margin-top: 9px;
span{
margin-left: 3px;
margin-right: 15px;
color: #373839;
&.err{
color: #ED3131;
}
&.suc{
color: #449284;
}
}
}
}
}
.info-second{
display: flex;
justify-content: space-between;
align-items: center;
.item{
width: 165.5px;
height: 40px;
/*line-height: 40px;*/
text-align: center;
border-radius: 6px;
background-color: #F8F9FA;
font-size: 14px;
font-weight: 700;
color: #373839;
display: flex;
align-items: center;
justify-content: center;
img{
width: 20px;
height: 20px;
margin-right: 8px;
}
span{
font-size: 12px;
margin-left: 2px;
height: 40px;
line-height: 40px;
}
}
}
}
}
</style>
<template>
<section class="experience-dialog-wrapper">
<van-overlay :show="showDialog" class="v-overlay-q">
<section class="loading-wrapper" >
<article class="content">
<img class="img-tips" src="../../images/question/note.png" alt="">
<p class="tips">您已完成本次免费练习体验</p>
<p class="status"><span class="cm rn">{{statisConfig.rightNum}}</span>题,错<span class="cm en">{{statisConfig.errorNum}}</span>题,正确率<span class="cm rate">{{statisConfig.rate}}%</span></p>
<p class="guide-tips">想体验完整题目,请先激活或购买题库</p>
<div class="btn-wrapper">
<span class="plain" @click="activeCard">去激活</span>
<span class="primary" @click="buyCard">去购买</span>
</div>
</article>
<img class="bt-close" @click="close" src="../../images/question/dialog-close.png" alt="">
</section>
</van-overlay>
</section>
</template>
<script>
export default {
props: {
statisConfig: {
type: Object,
default: () => {
return {
rightNum: 0,
errorNum: 0,
rate: 0
}
}
},
showDialog: {
type: Boolean,
default: true,
},
// rightNum: {
// type: Number | String,
// default: 0,
// },
// errorNum: {
// type: Number | String,
// default: 0,
// },
// rate: {
// type: Number | String,
// default: 0,
// }
},
methods: {
activeCard() {
this.$emit('activeCard');
},
buyCard() {
this.$emit('buyCard');
},
close() {
this.$emit('close');
}
},
}
</script>
<style lang="less" scoped>
.experience-dialog-wrapper {
.v-overlay-q {
.loading-wrapper {
text-align: center;
position: fixed;
top: 50%;
left: 50%;
width: 300px;
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
.content {
display: flex;
flex-direction: column;
align-items: center;
font-size: 14px;
padding: 20px 15px 30px;
background-color: #ffffff;
border-radius: 3px;
.img-tips {
width: 80px;
height: 80px;
}
.tips {
margin: 10px 0;
font-size: 16px;
font-weight: 700;
color: #373839;
}
.status {
font-size: 13px;
color: #676869;
.cm {
font-size: 18px;
font-weight: 700;
padding: 0 4px;
}
.rn {
color: #373839;
}
.en {
color: #ED3131;
}
.rate {
color: #449284;
}
}
.guide-tips {
margin: 4px 0 30px;
font-size: 12px;
color: #979899;
}
.btn-wrapper {
display: flex;
flex-direction: row;
align-content: center;
& > span {
width: 115px;
height: 40px;
line-height: 40px;
font-size: 16px;
font-weight: 700;
border-radius: 20px;
&.plain {
border: 1px solid #449284;
color: #449284;
margin-right: 10px;
}
&.primary {
color: #FFFFFF;
background: #449284;
}
}
}
}
.bt-close {
margin-top: 20px;
width: 30px;
height: 30px;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="free-tips-wrapper">
<div class="left">
<img src="../../images/question/warning-h.png" alt />
<span class="text">免费练习{{total}}题,解锁全部题目需完成购买</span>
</div>
<img class="right" @click="buyCard" src="../../images/question/arror-right.png" alt />
</div>
</template>
<script>
export default {
props: {
total: {
type: String | Number,
default: 5
}
},
methods: {
buyCard() {
this.$emit("buyCard");
}
},
}
</script>
<style lang="less" scoped>
.free-tips-wrapper {
width: 100%;
position: fixed;
left: 0;
bottom: 60px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
height: 40px;
line-clamp: 40px;
padding-left: 15px;
background: #FEFAF5;
.left {
display: flex;
flex-direction: row;
align-items: center;
& > img {
width: 13px;
height: 13px;
margin-right: 4px;
}
& > span {
font-size: 13px;
color: #E6A23C;
}
}
.right {
padding: 10px 15px;
width: 15px;
height: 15px;
}
}
</style>
\ No newline at end of file
<template>
<div class="no-question-wrapper">
<img v-if="commitKind == 1" src="../../images/question/no-error.png" alt="">
<img v-else-if="commitKind == 2" src="../../images/question/no-collect.png" alt="">
<img v-else src="../../images/question/no-collect.png" alt="">
<span>{{commitKind == 1 ? "您答错的题目会自动记录在这里哦!" : commitKind == 2 ? "您收藏的题目会自动记录在这里哦!" : "那些题目都去哪儿了!?"}}</span>
</div>
</template>
<script>
export default {
props: {
commitKind: { // 答题来源 1:错题集 2:收藏 3:题库
type: Number | String,
default: 1
}
}
}
</script>
<style lang="less" scoped>
.no-question-wrapper {
display: flex;
flex-direction: column;
align-items: center;
padding-top: 100px;
img {
width: 120px;
height: 120px;
}
span {
font-size: 15px;
color: #999999;
}
}
</style>
\ No newline at end of file
此差异已折叠。
<template>
<section class="qeustion-footer-wrapper">
<article class="left" @click="toggleAnalysis()">
<img src="../../images/question/analysis.png" alt />
<span class="text">解析</span>
</article>
<article class="center" @click="toggleCollect()">
<img v-show="currentQuestion.favorFlag == 0" src="../../images/question/heart-b.png" alt />
<img v-show="currentQuestion.favorFlag != 0" src="../../images/question/heart.png" alt />
<span class="text">收藏</span>
</article>
<article class="right">
<span class="pre" :class="{'disabled': currentQuestion.titleNo == 1}" @click="previous">上一题</span>
<span class="next" :class="{'disabled': currentQuestion.titleNo == totalCount}" @click="next">下一题</span>
</article>
</section>
</template>
<script>
import { Toast } from "vant";
import { mapGetters, mapActions } from "vuex";
import { findQuestionIndexNo } from "@/utils";
export default {
props: {},
data() {
return {
queryParams: {
commitKind: 3, // 答题来源 1:错题集 2:收藏 3:题库
directoryId: 1748, // 题库ID,获取错题集或收藏时传0
pageFlag: 0, // 翻页标记:0往前翻页 1往后翻页
pageSize: 5, // 每页大小
secondSubjectId: 106, // 二级学科分类ID:用于判断学科下目录免费题数
titleNo: 0, // 起始或结束题目序号,首次进入页面时传0,系统自动定位到上次做的题
}
};
},
computed: {
...mapGetters([
"commitKind",
"questionList",
"currentQuestion",
"totalCount",
"userInfo",
"titleConfig",
"commonConfig",
])
},
methods: {
// 上一页 // 有可能要触发上分页(前端的个数只有一条)
previous() {
if(!this.canRun()) return;
this.$sendBuriedData({
component_tag: `886#88601`
});
if (this.currentQuestion.titleNo == 1) {
Toast("已是第一题");
} else {
let cIndex = findQuestionIndexNo(this.questionList, "titleNo", this.currentQuestion.titleNo);
// 如果没有找到,则不做后面操作
if(!this.questionList[cIndex - 1]) return;
this.$store.commit(
"SET_CURRENT_QUESTION",
this.questionList[cIndex - 1] || { answerList: [] }
);
console.log(cIndex == 1, this.currentQuestion.titleNo >= 2);
if(cIndex == 1 && this.currentQuestion.titleNo >= 2) {
this.$emit("pageQuestion", 0, this.questionList[0].titleNo);
}
}
},
// 下一页 // 有可能要触发下分页(后面的个数只有一条)
next() {
if(!this.canRun()) return;
this.$sendBuriedData({
component_tag: `886#88602`
});
if (this.currentQuestion.titleNo == this.totalCount
// if (this.currentQuestion.titleNo == this.questionList.length
|| this.currentQuestion.titleNo == this.questionList[this.questionList.length - 1].titleNo) {
this.$emit("statistics");
} else {
let cIndex = findQuestionIndexNo(this.questionList, 'titleNo', this.currentQuestion.titleNo);
this.$store.commit(
"SET_CURRENT_QUESTION",
this.questionList[cIndex + 1] || { answerList: [] }
);
console.log(this.currentQuestion.isAnalyzed || (this.currentQuestion.commitFlag == 2));
if((cIndex == this.questionList.length - 2) && (this.questionList.length < this.totalCount)) {
this.$emit("pageQuestion", 1, this.questionList[this.questionList.length - 1].titleNo);
}
}
},
// 解析
toggleAnalysis() {
this.currentQuestion.isAnalyzed = true;
if(!this.currentQuestion.commitFlag) {
this.commitAnswer();
} else {
setTimeout(() => {
this.$emit("scrollTop");
}, 200);
}
this.$sendBuriedData({
component_tag: `886#88603`
});
},
// 收藏/不收藏
toggleCollect() {
this.favor(this.currentQuestion);
// this.$store.commit('SET_CURRENT_QUESTION', this.currentQuestion);
},
// 收藏/取消收藏
favor() {
if(!this.canRun()) return;
let favorFlag = this.currentQuestion.favorFlag;
let sPoint = favorFlag == 1 ? "88605" : "88604";
this.$sendBuriedData({
component_tag: `886#${sPoint}`
});
let param = {
dataType: 2,
directoryId: this.currentQuestion.directoryId,
examTitleId: this.currentQuestion.titleId,
operateType: favorFlag == 1 ? 2 : 1, // 操作类型:1:收藏 2:取消收藏
paperId: this.currentQuestion.paperId,
paperIndex: this.currentQuestion.paperIndex,
token: this.userInfo.userToken || this.token,
setEntry: true
};
this.currentQuestion.favorFlag = this.currentQuestion.favorFlag == 0 ? 1 : 0;
this.POST("onlineexam/collectExamTitle", param).then(res => {
if (res.code == "000000") {
if(res.data) {
// let cIndex = this.questionList.findIndex( item => {
// return item.titleNo = this.currentQuestion.titleNo;
// });
// this.questionList[cIndex].favorFlag = favorFlag == 0 ? 1 : 0;
// this.currentQuestion.favorFlag = favorFlag == 0 ? 1 : 0;
}
}
});
},
// 提交答案
commitAnswer() {
this.checkTokenForNative( () => {
let params = {
commitKind: this.commonConfig.commitKind, // 答题来源 1:错题集 2:收藏 3:题库
directoryId: this.currentQuestion.directoryId, // 题库ID
myAnswer: this.currentQuestion.myAnswer, // 我的答案,单选时单个答案,如A;多选答案,按照顺序使用
paperId: this.currentQuestion.paperId, // 试卷ID
paperIndex: this.currentQuestion.paperIndex, // 试卷索引(随机试卷的第n套)
resultId: this.titleConfig.resultId, // 刷题库轮次ID,刷收藏和错题集时为0
// rightFlag: 1, // 答题对错:1对 2错
titleId: this.currentQuestion.titleId, // 题目ID
titleNo: this.currentQuestion.titleNo, // 题目ID
setEntry: true,
token: this.userInfo.userToken,
};
let isRight = this.currentQuestion.myAnswer == this.currentQuestion.answer;
if (isRight) {
this.currentQuestion.commitFlag = 1;
} else {
this.currentQuestion.commitFlag = 2;
}
this.currentQuestion.isAnalyzed = true;
// this.$forceUpdate();
setTimeout(() => {
this.$emit("scrollTop");
}, 200);
this.POST(`onlineexam/practise/commit`, params).then(({ data }) => {
console.log('in commitAnswer res', data);
// if(data.resultType == 1) {
// this.currentQuestion.commitFlag = 1;
// } else {
// this.currentQuestion.commitFlag = 0;
// }
}).catch( error => {
this.currentQuestion.commitFlag = 0;
this.currentQuestion.isAnalyzed = false;
})
});
}
}
};
</script>
<style lang="less" scoped>
.qeustion-footer-wrapper {
position: fixed;
width: 100%;
left: 0;
bottom: 0;
display: flex;
height: 60px;
flex-direction: row;
justify-content: space-between;
align-items: center;
background: #ffffff;
font-size: 14px;
box-shadow: 0px -2px 10px 0px rgba(0, 0, 0, 0.1);
padding: 0 5px 0 15px;
.left {
display: flex;
flex-direction: column;
margin-left: 10px;
align-items: center;
& > img {
width: 18px;
height: 18px;
}
.text {
font-size: 12px;
}
}
.center {
display: flex;
flex-direction: column;
align-items: center;
& > img {
width: 18px;
height: 18px;
}
.text {
font-size: 12px;
}
}
.right {
display: flex;
flex-direction: row;
align-items: center;
text-align: center;
width: 210px;
color: #373839;
span {
display: inline-block;
width: 100px;
height: 40px;
line-height: 40px;
&.pre {
border-radius: 20px 0 0 20px;
border: 1px solid #979899;
&.disabled {
color: #979899;
}
}
&.next {
border-radius: 0 20px 20px 0;
border: 1px solid #979899;
border-left: 0px;
}
}
}
}
</style>
\ No newline at end of file
<template>
<section class="question-header-wrapper">
<img @click="goBack" class="left" src="../../images/left-array-black.png" alt="">
<span class="center">{{title}}</span>
<div class="right" >
<span v-show="total">
<span class="order">{{order}}</span><span class="total">/{{total}}</span>
</span>
</div>
</section>
</template>
<script>
export default {
props: {
title: {
type: String,
default: "第一篇 基础知识",
},
order: {
type: Number | String,
default: 0,
},
total: {
type: Number | String,
default: 0,
}
},
methods: {
//返回
goBack() {
this.$router.back(-1);
// rocNative.goBack();
},
},
}
</script>
<style lang="less" scoped>
.question-header-wrapper {
width: 100%;
// box-sizing: content-box;
position: fixed;
top: 0;
left: 0;
z-index: 1;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 28px 15px 0;
// padding-top: 28px;
// margin: 0 15px;
background: #fff;
.left {
height: 25px;
}
.center {
height: 40px;
line-height: 40px;
font-size: 17px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
color: #000000;
padding: 0 10px;
}
.right {
min-width: 60px;
font-size: 14px;
text-align: right;
span {
&.order {
color: #373839;
font-weight: 700;
}
&.total {
color: #979899;
}
}
}
}
</style>
\ No newline at end of file
......@@ -9,6 +9,9 @@ const notFound = r => require.ensure([], () => r(require('../views/not-found')),
const goodsDetail = r => require.ensure([], () => r(require('../views/goods-detail')), 'goods-detail')
const purchaseRezult = r => require.ensure([], () => r(require('../views/purchase-rezult')), 'purchase-rezult')
const questionBank = r => require.ensure([], () => r(require('../views/question-bank')), 'question-bank')
const questionDetail = r => require.ensure([], () => r(require('../views/question-detail')), 'question-detail')
export default [{
path: '/',
component: App,
......@@ -53,5 +56,13 @@ export default [{
path: '/prezult',
component: purchaseRezult
},
{
path: '/question-bank',
component: questionBank
},
{
path: '/question-detail',
component: questionDetail
},
]
}]
......@@ -7,5 +7,14 @@ const getters = {
positionInfo: state => state.coop.positionInfo,
organizationInfo: state => state.coop.organizationInfo,
logged: state => !!(state.user.token && state.user.info.id),
// 刷题相关
commonConfig: state => state.question.commonConfig,
titleConfig: state => state.question.titleConfig,
questionList: state => state.question.questionList,
currentQuestion: state => state.question.currentQuestion,
commitKind: state => state.question.titleConfig.commitKind,
freeFlag: state => state.question.titleConfig.freeFlag,
totalCount: state => state.question.titleConfig.totalCount,
canRunNext: state => state.question.canRunNext,
}
export default getters
......@@ -2,6 +2,7 @@ import Vue from 'vue'
import Vuex from 'vuex'
import coop from './modules/coop'
import user from './modules/user'
import question from './modules/question'
import getters from './getters'
Vue.use(Vuex)
......@@ -10,6 +11,7 @@ const store = new Vuex.Store({
modules: {
coop,
user,
question
},
getters
})
......
const coop = {
state: {
userInfo: {appVersion: '343'},
userInfo: {appVersion: "344", userToken: "BEE0545CD53A43DBA2E86C97B3394EB2"},
statusBarHeight: {},
projectTabIndex: 1,
jumpURLForI: "", //中华医学会一类跳转地址
......
// import fetch from '@/utils/fetch';
// import { getBaseUrl } from '@/utils/index'
// import { setCookie, getCookie, delCookie } from '@/utils/index';
// import { envConfig } from '@/utils/env-config';
import { findQuestionIndexNo, getOrderText, concatArray } from "@/utils";
const question = {
state: {
currentTitle: "题库",
questionList: [],
currentQuestion: {
isAnalyzed: false,
options: [ // 从options加工出来
{
isCorrect: false,
isSelected: true,
text: "进行分析评估",
},
{
isCorrect: false,
isSelected: false,
text: "进行分析评估",
},
{
isCorrect: true,
isSelected: true,
text: "进行分析评估",
},
{
isCorrect: false,
isSelected: false,
text: "进行分析评估",
},
],
titleId: 1,
titleNo: 1, // 题序,从1开始
typeId: 1, // 题目类型ID 1-单选,2-多选,3-判断
unionId: "", // 联合类型题目,分组唯一标识
unionType: 1, // 0普通题型 1-共用题干; 2-共用选项
unionQuestion: "", // 共用题干
question: '题干内容<img src="https://files.yunqueyi.com/image/png/protal/project/20200702161856970.png" />', // 题干内容
config: "", // 选项
answer: "", // 正确答案
intro: "", // 题目解析
score: 0, // 题目分值
myAnswer: "", // 我的答案
commitFlag: 0, // 0还未做 1做对了 2做错了
favorFlag: 0, // 0未收藏 1已收藏
pictureFlag: "", // 0没有图 1有图
questionStreamType: "", // 题干内流媒体类型:0-文本,1-图片,2-视频,3-音频
directoryId: 0, // 题库ID
paperId: "", // 试卷ID
paperIndex: "", // 试卷索引
},
commonConfig: {
// 0: 免费; 1: 收费; 没有绑卡且是收费题库(bindStatus == 0 && freeFlag == 1)可以走免费体验流程
freeFlag: 0,
directoryId: "",
secondSubjectId: 0,
cardType: 3,
goodsType: 3,
commitKind: 3, // 答题来源 1:错题集 2:收藏 3:题库
},
titleConfig: {
bindStatus: 0, // 绑卡状态:0未绑卡 1已绑卡
commitKind: 3, // 答题来源 1:错题集 2:收藏 3:题库
currentTitleNo: 0, // 定位答题题目id
resultId: 0, // 刷题库轮次ID
totalCount: 0, // 题目总数
},
canRunNext: true,
},
mutations: {
SET_COMMON_CONIFG: (state, payload) => {
state.commonConfig = payload;
},
SET_TITLE_CONIFG: (state, payload) => {
state.titleConfig = payload;
},
SET_COMMIT_KIND: (state, payload) => {
state.titleConfig.commitKind = payload;
},
SET_FREE_FLAG: (state, payload) => {
state.titleConfig.freeFlag = payload;
},
SET_TOTAL_COUNT: (state, payload) => {
state.titleConfig.totalCount = payload;
},
SET_QUESTION_LIST: (state, payload) => {
state.questionList = payload;
},
SET_CURRENT_QUESTION: (state, payload) => {
state.currentQuestion = payload;
},
SET_CAN_RUN_NEXT: (state, payload) => {
state.canRunNext = payload;
},
},
actions: {
// 处理返回的数据
handlerQuestionList({ commit, state }, rezultData) {
let questionList = rezultData.practiseTitleModelList || [];
let handlerList = [], question, option, optionList = [], myAnswer = "",
answer = "", questionContent = "";
questionList.forEach((item, index) => {
myAnswer = item.myAnswer;
answer = item.answer;
question = JSON.parse(JSON.stringify(item));
question.unionQuestion = question.unionQuestion.replace(/<img/, '<img style="max-width:98%;"');
question.question = question.question.replace(/<img/, '<img style="max-width:98%;"');
question.intro = question.intro.replace(/<img/, '<img style="max-width:98%;"');
let isAnalyzed = question.commitFlag && myAnswer != answer;
question.isAnalyzed = isAnalyzed;
option = {};
optionList = [];
question.options.forEach((text, i) => {
option.isCorrect = answer.indexOf(getOrderText(i)) != -1;
if (myAnswer.indexOf(getOrderText(i)) != -1) {
option.isSelected = true;
} else {
option.isSelected = false;
}
option.text = text;
optionList.push(JSON.parse(JSON.stringify(option)));
});
question.options = optionList;
console.log('handlerList', index);
handlerList.push(question);
});
console.log('in handlerList', handlerList);
let newList = concatArray(state.questionList, handlerList, 'titleNo');
commit("SET_QUESTION_LIST", newList);
if (rezultData.isFirst) {
let cIndex = findQuestionIndexNo(handlerList, 'titleNo', rezultData.currentTitleNo || 1);
let titleConfig = {
bindStatus: rezultData.bindStatus, // 绑卡状态:0未绑卡 1已绑卡
commitKind: rezultData.commitKind, // 答题来源 1:错题集 2:收藏 3:题库
currentTitleNo: rezultData.currentTitleNo, // 定位答题题目id
resultId: rezultData.resultId, // 刷题库轮次ID
totalCount: rezultData.totalCount, // 题目总数
}
commit("SET_CURRENT_QUESTION", newList[cIndex] || { titleNo: 1 });
commit("SET_TITLE_CONIFG", titleConfig);
}
},
},
}
export default question;
......@@ -6,6 +6,7 @@ img {
}
body, div, span, header, footer, nav, section, aside, article, ul, dl, dt, dd, li, a, p, h1, h2, h3, h4,h5, h6, i, b, textarea, button, input, select, figure, figcaption {
word-break: break-all;
padding: 0;
margin: 0;
list-style: none;
......
......@@ -184,3 +184,10 @@
width: 40px !important;
height: 40px !important;
}
.van-button--large {
height: 44px !important;
line-height: 42px !important;
}
.van-button__text {
font-weight: 700 !important;
}
\ No newline at end of file
......@@ -11,18 +11,17 @@ const service = axios.create({
// request拦截器
service.interceptors.request.use(config => {
// debugger
if (config.data && config.data.setEntry) {
config.headers['sysCode'] = config.data.sysCode || 10
if(config.data.token){
config.headers['token'] = config.data.token || '47993ED00ECB46CE8D31ECF3AE34B4AA'
if( process.env.BUILD_ENV == "development" ){ // 本地开发环境
config.headers['token'] = config.data.token || '47993ED00ECB46CE8D31ECF3AE34B4AA';
}
delete config.data.setEntry;
delete config.data.token;
if (config.data.token) {
config.headers['token'] = config.data.token;
if (process.env.BUILD_ENV == "development") { // 本地开发环境
config.headers['token'] = config.data.token;
}
}
delete config.data.setEntry;
delete config.data.token;
config.headers['deviceInfo'] = JSON.stringify({ "app_channel": "", "app_mac": "", "app_uuid": "", "app_version": "", "device_brand": "", "device_ip": "", "device_model": "", "device_net": "", "device_ops": "", "resolution_wh": "", "system_level": "", "device_type": '10' })
}
return config
......@@ -38,7 +37,7 @@ service.interceptors.response.use(
/*
baseUrl时,返回000000为成功
apiUrl时,返回200为成功
*/
*/
if (res.code !== '000000' && response.respCode === 200) {
return Promise.reject('error')
} else {
......
/**
* Created by Anndy Yang on 19/02/28.
*/
let orderVac = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S"
];
import { envConfig } from '@/utils/env-config'
const { BUILD_ENV } = process.env;
// 获取SC服务器域名地址
export function getBaseUrl(url) {
return getConfigByEnvType('baseUrl') + url
......@@ -261,14 +282,14 @@ export const getCookie = key => {
};
export function debounce(fn, wait = 50) {
let timer;
return function() {
if (timer) clearTimeout(timer)
let timer;
return function () {
if (timer) clearTimeout(timer)
timer = setTimeout(() => {
fn.apply(this, arguments);
fn.apply(this, arguments);
timer = null;
}, wait)
}
}, wait)
}
}
function decode(input) {
......@@ -286,3 +307,41 @@ export function querystring(query) {
return result;
}
export function getOrderText(index) {
return orderVac[index];
}
// 从数组中查找某个key对应值所在的位置(序号:0开始的)
export function findQuestionIndexNo(oList, key, keyValue) {
let index = oList.findIndex(item => {
return item[key] == keyValue;
});
return index;
}
// 对两个数组中的元素进行排序
export function concatArray(firstArr = [], secondArr = [], key) {
if (firstArr.length == 0) return secondArr;
if (secondArr.length == 0) return [];
let all = [], newArr = [], deleteIndex;
if (firstArr[0][key] == secondArr[0][key]) {
return firstArr;
} else if (firstArr[0][key] < secondArr[0][key]) {
all = firstArr.concat(secondArr);
} else {
all = secondArr.concat(firstArr);
}
// 从all中去重
for (let i = 0; i < all.length; i++) {
deleteIndex = findQuestionIndexNo(all.slice(i + 1), key, all[i][key]);
if (deleteIndex >= 0) {
all.splice(deleteIndex, 1);
i--;
}
}
console.log("in contactArray", all);
return all;
}
import fetch from '@/utils/fetch'
import { getBaseUrl, getApiUrl } from '@/utils/index'
import { getBaseUrl, getApiUrl } from '@/utils/index';
import { mapGetters } from 'vuex';
// import store from '../store';
module.exports = {
data: function () {
return {
token: null
token: 'weewfwefw'
}
},
created: function () {
......@@ -15,9 +18,13 @@ module.exports = {
// alert('this.token' + this.token)
this.token = this.getUrlKey('token') || (query && query.token)
},
mounted() {
computed: {
...mapGetters(['canRunNext'])
},
mounted() {
},
methods: {
getUrlPara(obj) {
let dataStr = ''
......@@ -110,8 +117,10 @@ module.exports = {
// 通用GET请求
GET(api, para, callback, str) {
// debugger
let token = para.token || this.token || this.$store.state.user.token || '';
let token = para.token || this.token || this.$store.state.user.token || this.$store.state.coop.userInfo.userToken;
para.token = token;
delete para.token;
delete para.setEntry;
let url = api + this.getUrlPara(para)
return fetch({
url: getBaseUrl(url),
......@@ -146,8 +155,10 @@ module.exports = {
// 通用POST请求
POST(api, para, callback) {
let token = para.token || this.token || this.$store.state.user.token || '';
let token = para.token || this.token || this.$store.state.user.token || this.$store.state.coop.userInfo.userToken;
para.token = token;
delete para.token;
delete para.setEntry;
return fetch({
url: getBaseUrl(api),
method: 'post',
......@@ -158,7 +169,7 @@ module.exports = {
// 通用POST请求
NEW_POST(api, para, callback) {
// para.token = para.token || this.token || '00175A13D70D4234822D90AC3C74202C'
// para.token = para.token || this.token || this.$store.state.coop.userInfo.userToken;
return fetch({
url: getBaseUrl(api),
method: 'post',
......@@ -168,7 +179,7 @@ module.exports = {
// 通用GET请求
API_GET(api, para, callback) {
para.token = para.token || this.token || '00175A13D70D4234822D90AC3C74202C' //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token
para.token = para.token || this.token || this.$store.state.coop.userInfo.userToken; //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token
let url = api + this.getUrlPara(para)
return fetch({
url: getApiUrl(url),
......@@ -179,7 +190,7 @@ module.exports = {
// 通用POST请求
API_POST(api, para, callback) {
para.token = para.token || this.token || '00175A13D70D4234822D90AC3C74202C' //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token
para.token = para.token || this.token || this.$store.state.coop.userInfo.userToken; //'AF3DFCF2DD4B4115AC47ACA25D5420E9''F90DF48D3EFA49DFAE1267A67DBEFB18'//token
return fetch({
url: getApiUrl(api),
method: 'post',
......@@ -215,20 +226,50 @@ module.exports = {
e.target.src = 'https://file.yunqueyi.com/File/doctor_default.png';
},
// 通用token校验
commonCheckToken(noLoggedCallback) {
// 校验token,有效则调用回调函数,否则调起原生登陆页面
commonCheckToken(cb) {
let param = {
token: this.token,
// token: this.token,
token: this.token || this.$store.state.user.token || this.$store.state.coop.userInfo.userToken,
setEntry: true
};
this.GET("campaign/admin/task/checkToken", param).then(res => {
if (res.code !== "000000") {
this.goLogin();
} else {
noLoggedCallback && noLoggedCallback()
cb && cb()
}
});
}
},
// 校验token,有效则调用回调函数,否则使用调起原生登陆页面
checkTokenForNative(cb) {
let param = {
token: this.token || this.$store.state.coop.userInfo.userToken,
setEntry: true
};
this.GET("campaign/admin/task/checkToken", param).then(res => {
if (res.code !== "000000") {
rocNative.gotoLogin();
} else {
cb && cb()
}
});
},
// 防止重复点击的最简单实现
canRun(delayTime = 500){
if(this.canRunNext) {
this.$store.commit('SET_CAN_RUN_NEXT', false);
setTimeout( () => {
this.$store.commit('SET_CAN_RUN_NEXT', true)
}, delayTime);
console.log('in canRan ', this.canRunNext);
return true;
} else {
console.log('in canRan', this.canRunNext);
return false;
}
}
}
}
......@@ -221,11 +221,14 @@ export default {
// goodsType= 3 and cardType = 3 职称考课程卡
let sharePrice = goods.preferentialPrice || goods.costPrice;
let shareDesc = "¥" + (sharePrice / 100).toFixed(2);
if(goods.goodsType == 2) {
shareDesc += "\n可申请5学分,自学资料性质,由医院录入!";
} else if(goods.goodsType == 3 && goods.cardType == 3) {
shareDesc += "\n卫健委正规授权,在职医师专业解读,大量实用病例分析!";
}
shareDesc += goods.shareContent || "";
// if(goods.goodsType == 2) {
// shareDesc += "\n可申请5学分,自学资料性质,由医院录入!";
// } else if(goods.goodsType == 3 && goods.cardType == 3) {
// shareDesc += "\n卫健委正规授权,在职医师专业解读,大量实用病例分析!";
// } else if(goods.goodsType == 3 && goods.cardType == 4) {
// shareDesc += "\n仿真模拟,刷题助考更安心!";
// }
let shareUrl = getWebPageUrl(
`profexam/#/goods-detail?goodsId=${this.goods.id}`
);
......@@ -465,9 +468,9 @@ export default {
}
return getWebPageUrl(path);
},
// 绑定项目和订单的关系
// 绑定项目和订单的关系(idType=1)
createRelation(projectId, orderId) {
this.POST(`cme/projectCard/correlation/${projectId}/${orderId}`, {channel: 3}).then(res => {
this.POST(`cme/projectCard/correlation/1/${projectId}/${orderId}`, {channel: 3}).then(res => {
if (res.code == "000000") {
//
} else {
......
......@@ -284,9 +284,10 @@ export default {
cardNo: "",
cardKey: "",
cardType: 3,
orderId: 0
orderId: 0,
},
subContent: ``,
subContent: "",
hasNoUsedCard: false,
};
},
components: {
......@@ -390,11 +391,11 @@ export default {
},
// 查询是否买过类似的卡,但还没有绑定
async hasNoUsedCardAction() {
hasNoUsedCardAction() {
let param = {
setEntry: true
};
await this.GET(`cme/projectCard/queryNoUsedCard/3`, param).then(({ data }) => {
this.GET(`cme/projectCard/queryNoUsedCard/${this.project.goodsType}/${this.project.cardType}`, param).then(({ data }) => {
this.hasNoUsedCard = data.hasNoUsedCard;
if (data.hasNoUsedCard == 1) {
this.cmeCardModels = data.cmeCardModels[0] || {};
......@@ -407,8 +408,11 @@ export default {
changeCardAction(cardKey, isInTips) {
let _this = this;
let param = {
idType: 1,
cardKey: cardKey,
cardType: 3,
cardType: this.project.cardType || 3,
goodsType: this.project.goodsType || 3,
channel: 1,
portalProjectId: this.projectId,
setEntry: true
};
......@@ -553,12 +557,12 @@ export default {
getCardInfoByProvinceId(provinceId) {
let param = {
area: provinceId + "",
cardType: 3,
pageNum: 1,
pageSize: 1
cardType: this.project.cardType || 3,
cardTypeList: [ this.project.cardType || 3],
goodsType: this.project.goodsType,
};
param.setEntry = true;
this.POST("trade/goods/cardList", param).then(res => {
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: "职称考精讲课程卡" };
......@@ -903,16 +907,24 @@ export default {
}, 200);
// 请求成功后统计,获取项目名
this.$sendBuriedData({
component_tag: `882#88201#${_this.projectId}#${_this.project.projectName}`
});
// 如果 hasBindCard 为false,则获取卡信息 0:未绑卡 1:已绑卡
if (!_this.hasBindCard) {
_this.preJumper();
_this.hasNoUsedCardAction();
}
<<<<<<< HEAD
// 请求成功后统计,获取项目名
this.$sendBuriedData({
component_tag: `882#88201#${_this.projectId}#${_this.project.projectName}`
});
=======
>>>>>>> dev-question-bank-0916
}
});
},
......
......@@ -114,7 +114,7 @@ export default {
orderId: this.orderId,
setEntry: true
};
this.GET(`cme/projectCard/status/${this.projectId}/${this.orderId}`, param).then(({ data }) => {
this.GET(`cme/projectCard/status/1/${this.projectId}/${this.orderId}`, param).then(({ data }) => {
this.loading = false;
this.bindStatus = data;
// 绑定成功
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -158,6 +158,7 @@
></ChangeCard>
<Loading v-show="showLoading" />
<!-- 主动提示:激活并去学习 -->
<CourseDialog
:subContent="subContent"
confirmBtnText="激活并去学习"
......@@ -306,7 +307,8 @@ export default {
cardType: 3,
orderId: 0
},
subContent: ``,
subContent: "",
hasNoUsedCard: false,
};
},
components: {
......@@ -461,11 +463,11 @@ export default {
},
// 查询是否买过类似的卡,但还没有绑定
async hasNoUsedCardAction() {
hasNoUsedCardAction() {
let param = {
setEntry: true
};
await this.GET(`cme/projectCard/queryNoUsedCard/3`, param).then(({ data }) => {
this.GET(`cme/projectCard/queryNoUsedCard/${this.project.goodsType}/${this.project.cardType}`, param).then(({ data }) => {
this.hasNoUsedCard = data.hasNoUsedCard;
if (data.hasNoUsedCard == 1) {
this.cmeCardModels = data.cmeCardModels[0] || {};
......@@ -478,8 +480,10 @@ export default {
changeCardAction(cardKey, isInTips) {
let _this = this;
let param = {
idType: 1,
cardKey: cardKey,
cardType: 3,
cardType: this.project.cardType || 3,
goodsType: this.project.goodsType || 3,
channel: 3,
portalProjectId: this.projectId,
setEntry: true
......@@ -538,12 +542,14 @@ export default {
getCardInfoByProvinceId(provinceId) {
let param = {
area: provinceId + "",
cardType: 3,
pageNum: 1,
pageSize: 1
cardType: this.project.cardType || 3,
cardTypeList: [ this.project.cardType || 3],
goodsType: this.project.goodsType,
// pageNum: 1,
// pageSize: 1
};
param.setEntry = true;
this.POST("trade/goods/cardList", param).then(res => {
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: "职称考精讲课程卡" };
......@@ -786,12 +792,15 @@ export default {
_this.showLoading = false;
}, 800);
<<<<<<< HEAD
// 如果 hasBindCard 为false,则获取卡信息 0:未绑卡 1:已绑卡
if (!_this.hasBindCard) {
_this.preJumper();
_this.logged && _this.hasNoUsedCardAction();
}
=======
>>>>>>> dev-question-bank-0916
// 请求成功后统计,获取项目名
// this.$sendBuriedData({
// component_tag: `882#88201#${_this.projectId}#${_this.project.projectName}`
......@@ -815,6 +824,12 @@ export default {
console.log("share success...");
}
);
// 如果 hasBindCard 为false,则获取卡信息 0:未绑卡 1:已绑卡
if (!_this.hasBindCard) {
_this.preJumper();
_this.logged && _this.hasNoUsedCardAction();
}
} else {
_this.showLoading = false;
_this.$router.replace("/not-found?fromPage=2");
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册