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

代码提交

上级 074faf10
......@@ -7,7 +7,7 @@
<script>
import CardList from '@/components/base/CardList.vue'
// import stepONeStep from '@/utils/stepOne'
import { cacheReport } from '../../api'
// import { cacheReport } from '../../api'
export default {
components: {
CardList
......@@ -22,36 +22,25 @@ export default {
}
},
data() {
return {
cardList: [],
caseId: ''
}
return {}
},
methods: {
// 下一步
// handleNext() {
// let flag = false
// this.cardList.forEach(item =>
// item.form.personAttribute.forEach(it => {
// console.log(it, '0000')
// if (it.equal === '' || it.personal === '' || it.range === '') {
// flag = true
// return false
// }
// })
// )
// if (flag) {
// this.$message.warning('请完善改步骤后才能进入下一步')
// return false
// } 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()
// })
// }
// }
handleStepOne() {
let flag = true
this.stepOneList.forEach(item =>
item.form.personAttribute.forEach(it => {
console.log(it, '333')
if (it.equal === '' || it.personal === '' || it.range === '') {
flag = false
}
})
)
if (!flag) {
this.$message.warning('请完善改步骤后才能进入下一步')
}
return flag
}
}
}
</script>
......
......@@ -28,7 +28,6 @@
<script>
import StepTab from '@/components/base/StepTab.vue'
import StepTodoList from './StepTodoList.vue'
import { cacheReport } from '../../api'
export default {
components: { StepTab, StepTodoList },
props: {
......@@ -58,38 +57,12 @@ export default {
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() {
console.log(this.time, 'time')
this.times = this.time
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: {
......@@ -99,29 +72,18 @@ export default {
handlePrev() {
this.$parent.$parent.handlePrev()
},
handleNext() {
let flag = false
console.log(this.stepTwoList, '990000')
handleStepTwo() {
this.$emit('getTime', this.times)
let flag = true
this.stepTwoList[0].form.triggerList.forEach(item => {
if (item.triggerValue === '' || this.times === '') {
flag = true
return false
flag = false
}
})
if (flag) {
if (!flag) {
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 @@
<ToolCard class="main_content">
<Step :activeStep="activeStep" class="pt50-pl60" />
<div>
<MailStepOne v-if="activeStep === 0" class="pt-50" :activeStep="activeStep" :stepOneList="stepOneList" />
<MailStepTwo v-if="activeStep === 1" class="pt-50" :stepTwoList="stepTwoList" :time="time" />
<MailStepOne
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="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_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>
</ToolCard>
......@@ -17,9 +30,9 @@
</template>
<script>
import stepONe from '@/utils/stepOne'
import stepOne from '@/utils/stepOne'
import stepTwo from '@/utils/stepTwo'
import { getReportDetail } from '../api'
import { cacheReport, getReportDetail, checkRecord } from '../api'
import ToolCard from '@/components/base/ToolCard.vue'
import MailStepOne from '../components/mail/MailStepOne.vue'
import Step from '@/components/base/Step.vue'
......@@ -36,30 +49,85 @@ export default {
activeStep: 0,
stepOneList: [],
stepTwoList: [],
time: ''
time: '',
caseId: '',
times: ''
}
},
methods: {
// 获取第二步时间
getTime(val) {
this.times = val
},
// 上一步
handlePrev() {
this.activeStep--
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--
console.log(this.activeStep, '1111')
})
console.log(this.stepOneList, 'this.stepOneList')
}
},
// 下一步
handleNext() {
this.activeStep++
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++
})
}
}
},
// 预览
handlePreview() {},
handlePreview() {
this.activeStep++
},
handlePlan() {},
// 获取步骤信息回显
getReportDetail(id) {
getReportDetail(id).then(res => {
this.activeStep = res.data.detail.answer.activeStep
if (this.activeStep === 0) {
this.stepOneList = res.data.detail.answer.commit_report
} else if (this.activeStep === 1) {
this.time = res.data.detail.answer.commit_report[1].time
this.stepTwoList = res.data.detail.answer.commit_report[0].form
console.log(res, this.time, '----')
this.stepOneList = res.data.detail.answer.commit_report[0].stepOneList
this.time = res.data.detail.answer.commit_report[2].time
this.stepTwoList = res.data.detail.answer.commit_report[1].form
console.log(this.activeStep, 'activeStep', this.stepOneList, '---', '123')
})
},
// 验证是否有未完成的答题记录
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 {
if (this.$route.query.type) {
this.getReportDetail(this.$route.query.id)
} else {
this.stepOneList = stepONe
this.stepTwoList = stepTwo
this.checkRecord()
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论