提交 fa88e691 authored 作者: matian's avatar matian

代码提交

上级 074faf10
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<script> <script>
import CardList from '@/components/base/CardList.vue' import CardList from '@/components/base/CardList.vue'
// import stepONeStep from '@/utils/stepOne' // import stepONeStep from '@/utils/stepOne'
import { cacheReport } from '../../api' // import { cacheReport } from '../../api'
export default { export default {
components: { components: {
CardList CardList
...@@ -22,36 +22,25 @@ export default { ...@@ -22,36 +22,25 @@ export default {
} }
}, },
data() { data() {
return { return {}
cardList: [],
caseId: ''
}
}, },
methods: { methods: {
// 下一步 // 下一步
// handleNext() { handleStepOne() {
// let flag = false let flag = true
// this.cardList.forEach(item => this.stepOneList.forEach(item =>
// item.form.personAttribute.forEach(it => { item.form.personAttribute.forEach(it => {
// console.log(it, '0000') console.log(it, '333')
// if (it.equal === '' || it.personal === '' || it.range === '') { if (it.equal === '' || it.personal === '' || it.range === '') {
// flag = true flag = false
// return false }
// } })
// }) )
// ) if (!flag) {
// if (flag) { this.$message.warning('请完善改步骤后才能进入下一步')
// this.$message.warning('请完善改步骤后才能进入下一步') }
// return false return flag
// } else { }
// console.log(this.$store.state.case.id, '0000')
// const reports = { activeStep: 0, type: 2, commit_report: this.stepOneList }
// cacheReport(this.$store.state.case.id, { reports: JSON.stringify(reports) }).then(res => {
// this.caseId = res.data.id
// this.$parent.$parent.handleNext()
// })
// }
// }
} }
} }
</script> </script>
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
<script> <script>
import StepTab from '@/components/base/StepTab.vue' import StepTab from '@/components/base/StepTab.vue'
import StepTodoList from './StepTodoList.vue' import StepTodoList from './StepTodoList.vue'
import { cacheReport } from '../../api'
export default { export default {
components: { StepTab, StepTodoList }, components: { StepTab, StepTodoList },
props: { props: {
...@@ -58,38 +57,12 @@ export default { ...@@ -58,38 +57,12 @@ export default {
tabName: '条件触发' tabName: '条件触发'
} }
] ]
// 条件触发列表
// form: {
// triggerList: [
// {
// triggerValue: '',
// list: [
// { value: '0', label: '启动APP' },
// { value: '1', label: '用户登录' },
// { value: '2', label: '购买基金商品' },
// { value: '3', label: '购买理财产品' },
// { value: '4', label: '购买保险产品' },
// { value: '5', label: '浏览基金产品' },
// { value: '6', label: '浏览理财产品' },
// { value: '7', label: '浏览保险产品' },
// { value: '8', label: '关闭APP' }
// ]
// }
// ]
// }
} }
}, },
mounted() { mounted() {
console.log(this.time, 'time') console.log(this.time, 'time')
this.times = this.time this.times = this.time
console.log(this.stepTwoList, '9999') console.log(this.stepTwoList, '9999')
// console.log(JSON.parse(window.localStorage.getItem('triggerList')), '123')
// if (JSON.parse(window.localStorage.getItem('triggerList'))) {
// this.form.triggerList = JSON.parse(window.localStorage.getItem('triggerList'))
// }
// if (window.localStorage.getItem('time')) {
// this.time = window.localStorage.getItem('time')
// }
}, },
methods: { methods: {
...@@ -99,29 +72,18 @@ export default { ...@@ -99,29 +72,18 @@ export default {
handlePrev() { handlePrev() {
this.$parent.$parent.handlePrev() this.$parent.$parent.handlePrev()
}, },
handleNext() { handleStepTwo() {
let flag = false this.$emit('getTime', this.times)
console.log(this.stepTwoList, '990000') let flag = true
this.stepTwoList[0].form.triggerList.forEach(item => { this.stepTwoList[0].form.triggerList.forEach(item => {
if (item.triggerValue === '' || this.times === '') { if (item.triggerValue === '' || this.times === '') {
flag = true flag = false
return false
} }
}) })
if (flag) { if (!flag) {
this.$message.warning('请完善改步骤后才能进入下一步') this.$message.warning('请完善改步骤后才能进入下一步')
return false
} else {
const reports = {
activeStep: 1,
type: 2,
commit_report: [{ form: this.stepTwoList }, { time: this.times }]
}
cacheReport(this.$store.state.case.id, { reports: JSON.stringify(reports) }).then(res => {
this.caseId = res.data.id
this.$parent.$parent.handleNext()
})
} }
return flag
} }
} }
} }
......
...@@ -3,13 +3,26 @@ ...@@ -3,13 +3,26 @@
<ToolCard class="main_content"> <ToolCard class="main_content">
<Step :activeStep="activeStep" class="pt50-pl60" /> <Step :activeStep="activeStep" class="pt50-pl60" />
<div> <div>
<MailStepOne v-if="activeStep === 0" class="pt-50" :activeStep="activeStep" :stepOneList="stepOneList" /> <MailStepOne
<MailStepTwo v-if="activeStep === 1" class="pt-50" :stepTwoList="stepTwoList" :time="time" /> v-if="activeStep === 0"
class="pt-50"
:activeStep="activeStep"
:stepOneList="stepOneList"
ref="mailStepOne"
/>
<MailStepTwo
v-if="activeStep === 1"
class="pt-50"
:stepTwoList="stepTwoList"
:time="time"
@getTime="getTime"
ref="mailStepTwo"
/>
<div class="main_content_btn"> <div class="main_content_btn">
<div class="step_prev step_btn" @click="handlePrev" v-if="activeStep > 0">上一步</div> <div class="step_prev step_btn" @click="handlePrev" v-if="activeStep > 0">上一步</div>
<div class="step_next step_btn" @click="handleNext" v-if="activeStep >= 0 && activeStep < 2">下一步</div> <div class="step_next step_btn" @click="handleNext" v-if="activeStep >= 0 && activeStep < 2">下一步</div>
<div class="step_finished step_btn" @click="handlePreview" v-if="activeStep === 2">点击生成预览</div> <div class="step_finished step_btn" @click="handlePreview" v-if="activeStep === 2">点击生成预览</div>
<div class="step_finished step_btn" @click="handlePreview" v-if="activeStep === 3">执行营销计划</div> <div class="step_finished step_btn" @click="handlePlan" v-if="activeStep === 3">执行营销计划</div>
</div> </div>
</div> </div>
</ToolCard> </ToolCard>
...@@ -17,9 +30,9 @@ ...@@ -17,9 +30,9 @@
</template> </template>
<script> <script>
import stepONe from '@/utils/stepOne' import stepOne from '@/utils/stepOne'
import stepTwo from '@/utils/stepTwo' import stepTwo from '@/utils/stepTwo'
import { getReportDetail } from '../api' import { cacheReport, getReportDetail, checkRecord } from '../api'
import ToolCard from '@/components/base/ToolCard.vue' import ToolCard from '@/components/base/ToolCard.vue'
import MailStepOne from '../components/mail/MailStepOne.vue' import MailStepOne from '../components/mail/MailStepOne.vue'
import Step from '@/components/base/Step.vue' import Step from '@/components/base/Step.vue'
...@@ -36,30 +49,85 @@ export default { ...@@ -36,30 +49,85 @@ export default {
activeStep: 0, activeStep: 0,
stepOneList: [], stepOneList: [],
stepTwoList: [], stepTwoList: [],
time: '' time: '',
caseId: '',
times: ''
} }
}, },
methods: { methods: {
// 获取第二步时间
getTime(val) {
this.times = val
},
// 上一步 // 上一步
handlePrev() { handlePrev() {
if (this.$refs.mailStepTwo.handleStepTwo()) {
const reports = {
activeStep: this.activeStep,
type: 2,
commit_report: [{ stepOneList: this.stepOneList }, { form: this.stepTwoList }, { time: this.times }]
}
cacheReport(this.$store.state.case.id, { reports: JSON.stringify(reports) }).then(res => {
this.caseId = res.data.id
this.activeStep-- this.activeStep--
console.log(this.activeStep, '1111')
})
console.log(this.stepOneList, 'this.stepOneList')
}
}, },
// 下一步 // 下一步
handleNext() { handleNext() {
if (this.activeStep === 0) {
if (this.$refs.mailStepOne.handleStepOne()) {
// 保存步骤信息
const reports = { activeStep: 0, type: 2, commit_report: [{ stepOneList: this.stepOneList }] }
cacheReport(this.$store.state.case.id, { reports: JSON.stringify(reports) }).then(res => {
this.caseId = res.data.id
this.activeStep++
})
}
} else if (this.activeStep === 1) {
if (this.$refs.mailStepTwo.handleStepTwo()) {
const reports = {
activeStep: 1,
type: 2,
commit_report: [{ stepOneList: this.stepOneList }, { form: this.stepTwoList }, { time: this.times }]
}
cacheReport(this.$store.state.case.id, { reports: JSON.stringify(reports) }).then(res => {
this.caseId = res.data.id
this.activeStep++ this.activeStep++
})
}
}
}, },
// 预览 // 预览
handlePreview() {}, handlePreview() {
this.activeStep++
},
handlePlan() {},
// 获取步骤信息回显
getReportDetail(id) { getReportDetail(id) {
getReportDetail(id).then(res => { getReportDetail(id).then(res => {
this.activeStep = res.data.detail.answer.activeStep this.activeStep = res.data.detail.answer.activeStep
if (this.activeStep === 0) { this.stepOneList = res.data.detail.answer.commit_report[0].stepOneList
this.stepOneList = res.data.detail.answer.commit_report this.time = res.data.detail.answer.commit_report[2].time
} else if (this.activeStep === 1) { this.stepTwoList = res.data.detail.answer.commit_report[1].form
this.time = res.data.detail.answer.commit_report[1].time console.log(this.activeStep, 'activeStep', this.stepOneList, '---', '123')
this.stepTwoList = res.data.detail.answer.commit_report[0].form })
console.log(res, this.time, '----') },
// 验证是否有未完成的答题记录
checkRecord() {
checkRecord(this.$store.state.case.id, 2).then(res => {
console.log(res, 'res000')
if (res.data.status === true) {
if (res.data.items.length) {
this.getReportDetail(res.data.items[0].id)
}
} else {
this.stepOneList = stepOne
this.stepTwoList = stepTwo
this.time = this.times
} }
}) })
} }
...@@ -68,8 +136,7 @@ export default { ...@@ -68,8 +136,7 @@ export default {
if (this.$route.query.type) { if (this.$route.query.type) {
this.getReportDetail(this.$route.query.id) this.getReportDetail(this.$route.query.id)
} else { } else {
this.stepOneList = stepONe this.checkRecord()
this.stepTwoList = stepTwo
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论