提交 bb8d187a authored 作者: lihuihui's avatar lihuihui

fix: 修改bug

上级 069a7af4
......@@ -6,7 +6,7 @@
<el-step title="查看营销数据"></el-step>
</el-steps>
<div class="content-box">
<div class="step-content1" v-if="stepsIndex === 0">
<div class="step-content1" v-show="stepsIndex === 0">
<div class="video-box">
<div class="dy-box" v-if="!registerIndex">
<img src="https://webapp-pub.ezijing.com/x-training-new/dy-bg.png" />
......@@ -21,9 +21,9 @@
</div>
<div class="text">{{ registerText }}</div>
</div>
<div class="step-content2" v-if="stepsIndex === 1">
<div class="step-content2" v-show="stepsIndex === 1">
<div class="form-box">
<el-form ref="form" :model="form" label-width="80px" :disabled="$route.query.type !== 1 ? false : true">
<el-form ref="form" :model="form" label-width="80px" :disabled="$route.query.type == 1 ? true : false ">
<el-form-item label="标题">
<el-input v-model="form.title"></el-input>
</el-form-item>
......@@ -42,7 +42,7 @@
<video :src="form.url" width="375px" class="video"></video>
</div>
</div>
<div class="step-content1 step-content3" v-if="stepsIndex === 2">
<div class="step-content1 step-content3" v-show="stepsIndex === 2">
<div class="video-box">
<div class="dy-box" v-if="!dataIndex">
<img src="https://webapp-pub.ezijing.com/x-training-new/dy-bg.png" />
......@@ -58,7 +58,7 @@
<div class="text">{{ registerText }}</div>
</div>
<div class="mian-btn">
<el-button type="primary" @click="cacheReport" v-if="$route.query.type != 1">保存</el-button>
<el-button type="primary" @click="cacheReport(1)" v-if="$route.query.type != 1">保存</el-button>
<el-button type="primary" @click="stepsIndex--" v-if="stepsIndex != 0">上一步</el-button>
<el-button v-if="stepsIndex == 0" type="primary" @click="registerNextBtn">下一步</el-button>
<el-button v-if="stepsIndex == 1" type="primary" @click="formNextBtn">下一步</el-button>
......@@ -93,7 +93,11 @@ export default {
}
},
mounted() {
this.checkRecord()
if (this.$route.query.type) {
this.getReportDetail(this.$route.query.id)
} else {
this.checkRecord()
}
},
methods: {
// 验证是否有未完成的答题记录
......@@ -111,7 +115,8 @@ export default {
} else {
if (this.registerIndex === 4) {
this.stepsIndex++
this.registerIndex = 0
this.cacheReport()
// this.registerIndex = 0
} else {
this.$message({ message: '请完成当前步骤', type: 'warning' })
}
......@@ -126,6 +131,7 @@ export default {
})
if (isNull === -1) {
this.stepsIndex++
this.cacheReport()
} else {
this.$message({ message: '请在发布视频完善信息', type: 'warning' })
}
......@@ -166,7 +172,7 @@ export default {
})
},
// 保存报告
cacheReport() {
cacheReport(num) {
const commitReport = [
this.form,
{ steps: this.stepsIndex, registerIndex: this.registerIndex, dataIndex: this.dataIndex }
......@@ -174,7 +180,7 @@ export default {
const param = { type: 1, commit_report: commitReport }
cacheReport(this.cases.id, { reports: JSON.stringify(param) })
.then(res => {
this.$message({ type: 'success', message: '保存成功' })
if (num) this.$message({ type: 'success', message: '保存成功' })
})
.catch(err => {
this.$message.error(err.message || '稍后再试')
......@@ -184,10 +190,12 @@ export default {
getReportDetail(id) {
getReportDetail(id).then(res => {
const cachData = res.data.detail.answer.commit_report
if (this.$route.query.type === 0) {
if (this.$route.query.type !== '1') {
this.stepsIndex = cachData[1].steps
this.registerIndex = cachData[1].registerIndex
this.dataIndex = cachData[1].dataIndex
if (this.stepsIndex === 0) this.registerNext(1)
if (this.stepsIndex === 2) this.dataNext(1)
}
this.form.title = cachData[0].title
this.form.dec = cachData[0].dec
......@@ -196,30 +204,38 @@ export default {
})
},
// 查看营销数据教程
dataNext() {
dataNext(num) {
const styles = {
1: { w: '50px', t: '30px', l: '320px', text: '第二步:点击右上角,进入菜单' },
2: { w: '200px', t: '300px', l: '100px', text: '第三步:点击”创作者服务中心“' },
3: { w: '50px', t: '190px', l: '290px', text: '第四步:点击”数据中心“' },
4: { w: '0px', t: '0px', l: '0px', text: '完成' }
}
if (this.dataIndex < 4) this.dataIndex++
if (num !== 1) {
if (this.dataIndex < 4) this.dataIndex++
}
const getStyle = styles[this.dataIndex]
const getDom = this.$refs.dataBtn.style
this.setStyle(getStyle, getDom)
this.$nextTick(() => {
const getDom = this.$refs.dataBtn.style
this.setStyle(getStyle, getDom)
}, 1000)
},
// 注册教程
registerNext() {
registerNext(num) {
const styles = {
1: { w: '310px', t: '380px', l: '30px', text: '第二步:点击其他手机号登录' },
2: { w: '310px', t: '280px', l: '30px', text: '第三步:输入手机号点击获取手机验证码' },
3: { w: '310px', t: '340px', l: '30px', text: '第四步:点击登录' },
4: { w: '0px', t: '0px', l: '0px', text: '第五步:登录成功之后,在右下角点击“我”,就可以修改自己的头像和资料了' }
}
if (this.registerIndex < 4) this.registerIndex++
if (num !== 1) {
if (this.registerIndex < 4) this.registerIndex++
}
const getStyle = styles[this.registerIndex]
const getDom = this.$refs.registerBtn.style
this.setStyle(getStyle, getDom)
this.$nextTick(() => {
const getDom = this.$refs.registerBtn.style
this.setStyle(getStyle, getDom)
}, 1000)
},
setStyle(sty, dom) {
dom.width = sty.w
......
......@@ -3,7 +3,12 @@
<div class="tit-box">
<span class="title">{{ title }}</span>
<slot name="tips"></slot>
<span class="err-btn" v-if="isErrorBtn && $route.path !== '/product-analysis/report'" @click="$emit('errorResolution')">错误解析</span>
<span
class="err-btn"
v-if="isErrorBtn && $route.path !== '/product-analysis/report'"
@click="$emit('errorResolution')"
>错题解析</span
>
</div>
<slot></slot>
</div>
......
<template>
<box title="业绩比较基准" class="compares-box" :id="firstItem.id" :isErrorBtn="isErrorBtn()" @errorResolution="errorResolution">
<div slot="tips" class="tips">
<div slot="tips" class="tips" v-if="cases.tag === 'index_fund_1'">
<i class="el-icon-warning-outline"></i>
<div class="text">提示:本案例中所出现的指数为单一参照指数,故比重默认为100%。</div>
</div>
......@@ -38,6 +38,9 @@ export default {
firstItem() {
const [first = {}] = this.data.completions
return first
},
cases() {
return this.$store.state.case
}
},
methods: {
......
......@@ -2,23 +2,71 @@
<div class="report-box">
<slot></slot>
<template v-if="Object.keys(titleData).length">
<div class="title">产品分析报告<span @click="errorResolutionTit" v-if="$route.path !== '/product-analysis/report' && !this.titleData.completions[0].is_correct">错误解析</span></div>
<input v-if="$route.path !== '/product-analysis/result'" type="text" class="code isDomActive" placeholder="请输入基金简称+基金代码" v-model="titleValue"/>
<input v-else type="text" :class="`code isDomActive ${titleData.completions[0].is_correct ? '' : 'active'}`" placeholder="请输入基金简称+基金代码" v-model="titleValue"/>
<div class="title">
产品分析报告<span
@click="errorResolutionTit"
v-if="$route.path !== '/product-analysis/report' && !this.titleData.completions[0].is_correct"
>错题解析</span
>
</div>
<input
v-if="$route.path !== '/product-analysis/result'"
type="text"
class="code isDomActive"
placeholder="请输入基金简称+基金代码"
v-model="titleValue"
/>
<input
v-else
type="text"
:class="`code isDomActive ${titleData.completions[0].is_correct ? '' : 'active'}`"
placeholder="请输入基金简称+基金代码"
v-model="titleValue"
/>
</template>
<div v-for="(item, index) in completions" :key="index">
<!-- 产品概括 -->
<product @errorResolution="errorResolution" ref="product" v-if="item.tag === 'product_overview'" :data="item"></product>
<product
@errorResolution="errorResolution"
ref="product"
v-if="item.tag === 'product_overview'"
:data="item"
></product>
<!-- 投资目标 -->
<invest-target @errorResolution="errorResolution" ref="investTarget" v-if="item.tag === 'investment_objectives'" :data="item"></invest-target>
<invest-target
@errorResolution="errorResolution"
ref="investTarget"
v-if="item.tag === 'investment_objectives'"
:data="item"
></invest-target>
<!-- 投资目标 -->
<invest-strategy @errorResolution="errorResolution" ref="investStrategy" v-if="item.tag === 'investment_strategy'" :data="item"></invest-strategy>
<invest-strategy
@errorResolution="errorResolution"
ref="investStrategy"
v-if="item.tag === 'investment_strategy'"
:data="item"
></invest-strategy>
<!-- 业绩比较基准 -->
<compares @errorResolution="errorResolution" ref="compares" v-if="item.tag === 'performance_benchmark'" :data="item"></compares>
<compares
@errorResolution="errorResolution"
ref="compares"
v-if="item.tag === 'performance_benchmark'"
:data="item"
></compares>
<!-- 风险收益特征 -->
<features @errorResolution="errorResolution" ref="features" v-if="item.tag === 'risk_return_characteristics'" :data="item"></features>
<features
@errorResolution="errorResolution"
ref="features"
v-if="item.tag === 'risk_return_characteristics'"
:data="item"
></features>
<!-- 基金涉及费用 -->
<cost @errorResolution="errorResolution" ref="cost" v-if="item.tag === 'fund_related_expenses'" :data="item"></cost>
<cost
@errorResolution="errorResolution"
ref="cost"
v-if="item.tag === 'fund_related_expenses'"
:data="item"
></cost>
</div>
<!-- 提交 -->
<div class="tool-btn">
......@@ -74,8 +122,12 @@ export default {
cacheCaseAnswer() {
const data = this.getAnswer(1)
cacheCaseAnswer(this.cases.id, { answers: JSON.stringify(data) })
.then(res => { this.$message({ type: 'success', message: '保存成功' }) })
.catch(err => { this.$message.error(err.message || '稍后再试') })
.then(res => {
this.$message({ type: 'success', message: '保存成功' })
})
.catch(err => {
this.$message.error(err.message || '稍后再试')
})
},
// 模板 数据回显
caseCompletions(id) {
......@@ -86,7 +138,7 @@ export default {
const findData = this.resultCompletions.answer.find(fItem => {
return fItem.id === cItem.id
})
findData ? cItem = Object.assign(cItem, findData) : cItem.commit_answer = ''
findData ? (cItem = Object.assign(cItem, findData)) : (cItem.commit_answer = '')
} else {
cItem.commit_answer = ''
}
......@@ -132,19 +184,24 @@ export default {
const investStrategyCount = [{ id: strategyData.id, commit_answer: strategyData.commit_answer }]
// 业绩比较基准数据
const comparesCount = []
this.$refs.compares[0].inputList.forEach(item => {
comparesCount.push(`${item.input1.split(';').join('')},${item.input2.split(';').join('')}`)
})
const comparesData = {
id: this.$refs.compares[0].data.completions[0].id,
commit_answer: comparesCount.join(';')
let comparesData = {}
if (this.$refs.compares) {
this.$refs.compares[0].inputList.forEach(item => {
comparesCount.push(`${item.input1.split(';').join('')},${item.input2.split(';').join('')}`)
})
comparesData = {
id: this.$refs.compares[0].data.completions[0].id,
commit_answer: comparesCount.join(';')
}
this.$refs.compares[0].data.completions[0].commit_answer = comparesCount.join(';')
}
this.$refs.compares[0].data.completions[0].commit_answer = comparesCount.join(';')
// 风险收益特征数据
const featuresCount = []
this.$refs.features[0].data.completions.forEach(item => {
featuresCount.push({ id: item.id, commit_answer: item.commit_answer })
})
if (this.$refs.compares) {
this.$refs.features[0].data.completions.forEach(item => {
featuresCount.push({ id: item.id, commit_answer: item.commit_answer })
})
}
// 基金涉及费用数据
const costCount = []
this.$refs.cost[0].data.completions.forEach(item => {
......@@ -164,6 +221,7 @@ export default {
...costCount,
...investStrategyCount
]
allAnswer = allAnswer.filter(item => Object.keys(item).length !== 0)
if (isCache) {
allAnswer = allAnswer.filter(item => item.commit_answer !== '')
}
......@@ -174,13 +232,15 @@ export default {
// 空数据的索引
let emptyDataIndex = this.getAnswer().findIndex(item => item.commit_answer === '')
// 判断业绩比较基准是否为空
const hasEmptyInput = !!this.$refs.compares[0].inputList.find(item => {
return item.input1 === '' || item.input2 === ''
})
if (hasEmptyInput) {
const dataId = this.$refs.compares[0].data.completions[0].id
const dataIndex = this.getAnswer().findIndex(item => item.id === dataId)
emptyDataIndex = emptyDataIndex > dataIndex && emptyDataIndex !== -1 ? dataIndex : emptyDataIndex
if (this.$refs.compares) {
const hasEmptyInput = !!this.$refs.compares[0].inputList.find(item => {
return item.input1 === '' || item.input2 === ''
})
if (hasEmptyInput) {
const dataId = this.$refs.compares[0].data.completions[0].id
const dataIndex = this.getAnswer().findIndex(item => item.id === dataId)
emptyDataIndex = emptyDataIndex > dataIndex && emptyDataIndex !== -1 ? dataIndex : emptyDataIndex
}
}
if (emptyDataIndex === -1) {
commitCase({ answers: JSON.stringify(this.getAnswer()) })
......@@ -200,7 +260,7 @@ export default {
// 空数据的元素
const emptyElement = document.querySelector(`[id="${this.getAnswer()[emptyDataIndex].id}"]`)
// 空的情况,所有的高亮
$('.isDomActive').each(function() {
$('.isDomActive').each(function () {
$(this).removeClass('active')
if (this.tagName === 'INPUT' || this.tagName === 'TEXTAREA') {
if ($(this).val() === '') $(this).addClass('active')
......@@ -211,7 +271,7 @@ export default {
})
$('.tag-input').css('border-bottom', '1px solid rgba(219, 38, 38, 1)')
// 监听输入,去掉高亮
$('.isDomActive').bind('input propertychange', function() {
$('.isDomActive').bind('input propertychange', function () {
$(this).removeClass('active')
})
let top = 140
......@@ -235,8 +295,8 @@ input {
background: none;
border: none;
outline: none;
&.active{
border-bottom: 1px solid #C11818 !important;
&.active {
border-bottom: 1px solid #c11818 !important;
}
}
.code {
......@@ -269,7 +329,7 @@ input {
text-align: center;
margin-top: 27px;
position: relative;
span{
span {
position: absolute;
right: 25px;
top: 0;
......@@ -279,7 +339,7 @@ input {
z-index: 999;
}
}
.tool-btn{
.tool-btn {
display: flex;
justify-content: center;
}
......
......@@ -13,10 +13,10 @@
<div class="analysis-box" v-if="isShow">
<div class="content">
<div class="close" @click="close">×</div>
<div class="tit">查看答案</div>
<div class="tit">错题解析</div>
<ul>
<li v-for="(item, index) in answerList" :key="index">
<div class="title">{{ `${index + 1}.${item.subject}` }}</div>
<div class="title">{{ `${index + 1}.${item.subject}` }}:(分值:{{ item.sum_score }}</div>
<div class="my">我的答案:{{ item.commit_answer }}</div>
<div class="answer">正确答案:{{ item.answer }}</div>
</li>
......@@ -78,6 +78,8 @@ export default {
background: #FFFFFF;
opacity: 1;
border-radius: 16px;
max-height: 500px;
overflow-y: scroll;
.close{
position: absolute;
top: 10px;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论