提交 8a218e55 authored 作者: lihuihui's avatar lihuihui

feat: 营销工具1.1开发

上级 080f552a
...@@ -13,3 +13,22 @@ export function submitReport(data) { ...@@ -13,3 +13,22 @@ export function submitReport(data) {
headers: { 'Content-Type': 'application/json' } headers: { 'Content-Type': 'application/json' }
}) })
} }
// 保存营销工具记录
export function cacheReport(id, data) {
return httpRequest.post(`/api/xtraining/api/v1/answer/${id}/save-marketing-record`, data, {
headers: { 'Content-Type': 'application/json' }
})
}
// 获取营销工具报告详情
export function getReportDetail(id) {
return httpRequest.get(`/api/xtraining/api/v1/answer/${id}/marketing-report`).then({})
}
// 验证是否有未完成的答题记录
export function checkRecord(id, type) {
return httpRequest.post(`/api/xtraining/api/v1/answer/${id}/check-record/${type}`, {
headers: { 'Content-Type': 'application/json' }
})
}
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
</el-form-item> </el-form-item>
<el-form-item label="视频"> <el-form-item label="视频">
<upload-video v-model="form.url" @input="input"></upload-video> <upload-video v-model="form.url" @input="input"></upload-video>
ddd'd'd'd'd'd'd'd </el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div class="dy-box"> <div class="dy-box">
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
<div class="text">{{ registerText }}</div> <div class="text">{{ registerText }}</div>
</div> </div>
<div class="mian-btn"> <div class="mian-btn">
<el-button type="primary" @click="cacheReport">保存</el-button>
<el-button type="primary" @click="stepsIndex--" v-if="stepsIndex != 0">上一步</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 == 0" type="primary" @click="registerNextBtn">下一步</el-button>
<el-button v-if="stepsIndex == 1" type="primary" @click="formNextBtn">下一步</el-button> <el-button v-if="stepsIndex == 1" type="primary" @click="formNextBtn">下一步</el-button>
...@@ -68,7 +69,7 @@ ...@@ -68,7 +69,7 @@
</template> </template>
<script> <script>
import { getReport, submitReport } from '../api' import { submitReport, cacheReport, checkRecord, getReportDetail } from '../api'
import UploadVideo from '@/components/upload/UploadVideo.vue' import UploadVideo from '@/components/upload/UploadVideo.vue'
export default { export default {
components: { UploadVideo }, components: { UploadVideo },
...@@ -86,10 +87,22 @@ export default { ...@@ -86,10 +87,22 @@ export default {
dataText: '第一步:点击“我”,进入个人主页' dataText: '第一步:点击“我”,进入个人主页'
} }
}, },
computed: {
cases() {
return this.$store.state.case
}
},
mounted() { mounted() {
this.getReport() this.checkRecord()
}, },
methods: { methods: {
// 验证是否有未完成的答题记录
checkRecord() {
checkRecord(this.cases.id, 2)
.then(res => {
this.getReportDetail(res.data.items[0].id)
})
},
registerNextBtn() { registerNextBtn() {
if (this.registerIndex === 4) { if (this.registerIndex === 4) {
this.stepsIndex++ this.stepsIndex++
...@@ -137,12 +150,34 @@ export default { ...@@ -137,12 +150,34 @@ export default {
this.$message.error(err.message || '稍后再试') this.$message.error(err.message || '稍后再试')
}) })
}, },
// 保存报告
cacheReport() {
console.log(this.form)
const commitReport = [
this.form,
{ steps: this.stepsIndex, registerIndex: this.registerIndex, dataIndex: this.dataIndex }
]
console.log(commitReport, '=123')
const param = { type: 1, commit_report: commitReport }
cacheReport(this.cases.id, { reports: JSON.stringify(param) })
.then(res => {
this.$message({ type: 'success', message: '保存成功' })
})
.catch(err => {
this.$message.error(err.message || '稍后再试')
})
},
// 获取报告 // 获取报告
getReport() { getReportDetail(id) {
getReport().then(res => { getReportDetail(id).then(res => {
if (res.data.reports.length) { const cachData = res.data.detail.answer.commit_report
this.form = res.data.reports[0].answer.commit_report this.form.title = cachData[0].title
} this.form.dec = cachData[0].dec
this.form.url = cachData[0].url
this.stepsIndex = cachData[1].steps
this.registerIndex = cachData[1].registerIndex
this.dataIndex = cachData[1].dataIndex
// this.stepsIndex = cachData[1].steps
}) })
}, },
// 查看营销数据教程 // 查看营销数据教程
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论