Browse Source

feat: 接口对接;

pull/5/head
Fox-33 2 months ago
parent
commit
bc8d0269d7
10 changed files with 259 additions and 117 deletions
  1. +17
    -9
      pages_order/components/reportCard.vue
  2. +12
    -4
      pages_order/report/compare/result.vue
  3. +1
    -2
      pages_order/report/detail/cardHeader.vue
  4. +5
    -6
      pages_order/report/detail/index.vue
  5. +4
    -2
      pages_order/report/nutritionProgram/index.vue
  6. +0
    -6
      pages_order/report/result/index.vue
  7. +7
    -2
      pages_order/report/result/resultSummary.vue
  8. +205
    -85
      pages_order/report/test/answer.vue
  9. +4
    -1
      pages_order/report/test/intro.vue
  10. +4
    -0
      store/store.js

+ 17
- 9
pages_order/components/reportCard.vue View File

@ -4,17 +4,13 @@
<image class="card-header-bg" src="@/pages_order/static/report/report-card-header-bg.png" mode="scaleToFill"></image> <image class="card-header-bg" src="@/pages_order/static/report/report-card-header-bg.png" mode="scaleToFill"></image>
<view class="flex card-header-content"> <view class="flex card-header-content">
<view class="avatar"> <view class="avatar">
<!-- todo -->
<image class="avatar-img" src="@/pages_order/static/report/avatar.png" mode="scaleToFill"></image>
<!-- <image class="avatar-img" :src="userInfo.avatar" mode="scaleToFill"></image> -->
<image class="avatar-img" :src="userInfo.avatar" mode="scaleToFill"></image>
</view> </view>
<view class="info"> <view class="info">
<!-- todo -->
<view class="nickname">李星星</view>
<!-- <view class="nickname">{{ userInfo.name }}</view> -->
<view class="nickname">{{ data.realName || '' }}</view>
<view class="desc"> <view class="desc">
<text class="age">25</text>
<text class="gender"></text>
<text class="age">{{ data.age || '' }}</text>
<text class="gender">{{ data.sex || '' }}</text>
</view> </view>
</view> </view>
</view> </view>
@ -26,8 +22,20 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'
export default { export default {
props: {
data: {
type: Object,
default() {
return {}
}
}
},
computed: {
...mapState(['userInfo']),
},
} }
</script> </script>


+ 12
- 4
pages_order/report/compare/result.vue View File

@ -3,7 +3,7 @@
<navbar title="报告对比" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" /> <navbar title="报告对比" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />
<view class="main"> <view class="main">
<reportCard>
<reportCard :data="detail">
<view class="report" v-if="list.length"> <view class="report" v-if="list.length">
<view class="flex section"> <view class="flex section">
<view <view
@ -36,11 +36,11 @@
<view class="section-item info-BMI"> <view class="section-item info-BMI">
<view class="flex label"> <view class="flex label">
<text>BMI 指数</text> <text>BMI 指数</text>
<text class="highlight">{{ item.BMI || '-' }}</text>
<text class="highlight">{{ item.bmi || '-' }}</text>
</view> </view>
<view class="progress">
<view class="progress" v-if="item.bmi">
<!-- todo: check --> <!-- todo: check -->
<progressBar :progress="item.BMI" :total="30"></progressBar>
<progressBar :progress="item.bmi" :total="30"></progressBar>
</view> </view>
</view> </view>
</view> </view>
@ -120,6 +120,7 @@
}, },
data() { data() {
return { return {
detail: {},
list: [], list: [],
axis: ['饮食', '运动', '心理', '体质', '作息'] axis: ['饮食', '运动', '心理', '体质', '作息']
} }
@ -137,6 +138,9 @@
const result = await this.$fetch('getReportDetail', { id }) const result = await this.$fetch('getReportDetail', { id })
const { const {
realName,
age,
sex,
createTime, createTime,
score, score,
scoreDetail, scoreDetail,
@ -146,6 +150,9 @@
const obj = { const obj = {
id, id,
realName,
age,
sex,
createTime: this.$dayjs(createTime).format('YYYY-MM-DD'), createTime: this.$dayjs(createTime).format('YYYY-MM-DD'),
score: parseInt(score), score: parseInt(score),
scoreDetail: JSON.parse(scoreDetail).map(item => ({ name: item.name, score: parseInt(item.score) })), scoreDetail: JSON.parse(scoreDetail).map(item => ({ name: item.name, score: parseInt(item.score) })),
@ -166,6 +173,7 @@
console.log('results', results) console.log('results', results)
this.list = results.map(item => item.value) this.list = results.map(item => item.value)
this.detail = this.list[0]
console.log('list', this.list) console.log('list', this.list)
}, },
}, },


+ 1
- 2
pages_order/report/detail/cardHeader.vue View File

@ -5,8 +5,7 @@
<text>BMI 指数</text> <text>BMI 指数</text>
<text class="highlight">{{ BMI || '-' }}</text> <text class="highlight">{{ BMI || '-' }}</text>
</view> </view>
<view class="progress">
<!-- todo: check -->
<view class="progress" v-if="BMI">
<progressBar :progress="BMI" :total="30"></progressBar> <progressBar :progress="BMI" :total="30"></progressBar>
</view> </view>
</view> </view>


+ 5
- 6
pages_order/report/detail/index.vue View File

@ -3,9 +3,9 @@
<navbar title="详情报告" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" /> <navbar title="详情报告" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />
<view class="main"> <view class="main">
<reportCard>
<reportCard :data="detail">
<view class="section"> <view class="section">
<cardHeader :BMI="BMI"></cardHeader>
<cardHeader :BMI="detail.bmi"></cardHeader>
</view> </view>
<view class="section" v-for="(step, index) in list" :key="step.key"> <view class="section" v-for="(step, index) in list" :key="step.key">
<view class="flex section-header"> <view class="flex section-header">
@ -84,7 +84,7 @@
}, },
data() { data() {
return { return {
BMI: 0,
detail: {},
list: [], list: [],
} }
}, },
@ -92,15 +92,14 @@
const { id } = arg const { id } = arg
this.id = id this.id = id
this.fetchReportData(id) this.fetchReportData(id)
// todo: delete
this.BMI = 16.5
}, },
methods: { methods: {
async fetchReportData(id) { async fetchReportData(id) {
try { try {
const { json } = await this.$fetch('getReportDetail', { id })
const { json, ...detail } = await this.$fetch('getReportDetail', { id })
this.detail = detail
this.list = JSON.parse(json).map((item, index) => { this.list = JSON.parse(json).map((item, index) => {
let url = `/pages_order/static/report/report-detail-${index + 1}.png` let url = `/pages_order/static/report/report-detail-${index + 1}.png`


+ 4
- 2
pages_order/report/nutritionProgram/index.vue View File

@ -3,7 +3,7 @@
<navbar title="营养方案" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" /> <navbar title="营养方案" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />
<view class="main"> <view class="main">
<reportCard>
<reportCard :data="detail">
<view class="section header"> <view class="section header">
<view>营养师基于你生活习惯和营养目标推荐</view> <view>营养师基于你生活习惯和营养目标推荐</view>
<view class="highlight">量身定制的营养方案</view> <view class="highlight">量身定制的营养方案</view>
@ -73,6 +73,7 @@
data() { data() {
return { return {
productId: '', productId: '',
detail: {},
list: [], list: [],
comment: 0, comment: 0,
} }
@ -107,7 +108,7 @@
async fetchReportData(id) { async fetchReportData(id) {
try { try {
const { productList } = await this.$fetch('getReportDetail', { id })
const { productList, ...detail } = await this.$fetch('getReportDetail', { id })
const detectList = [] const detectList = []
const nutrientList = [] const nutrientList = []
@ -146,6 +147,7 @@
}) })
this.detail = detail
this.list = [ this.list = [
{ {
id: '001', id: '001',


+ 0
- 6
pages_order/report/result/index.vue View File

@ -48,12 +48,6 @@
resultSummary, resultSummary,
tonicCard, tonicCard,
}, },
props: {
id: {
type: String | Number,
default: null,
}
},
data() { data() {
return { return {
id: null, id: null,


+ 7
- 2
pages_order/report/result/resultSummary.vue View File

@ -3,8 +3,8 @@
<view class="flex top"> <view class="flex top">
<view class="left"> <view class="left">
<view class="title"> <view class="title">
<!-- todo -->
<text class="highlight">战斗世界</text>
<!-- todo: check -->
<text class="highlight">{{ userInfo.name || '' }}</text>
<text>的健康测评</text> <text>的健康测评</text>
</view> </view>
<view class="grade"> <view class="grade">
@ -45,6 +45,8 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'
import progressCircle from './progressCircle.vue' import progressCircle from './progressCircle.vue'
import radarChart from './radarChart.vue'; import radarChart from './radarChart.vue';
@ -61,6 +63,9 @@
} }
} }
}, },
computed: {
...mapState(['userInfo']),
},
} }
</script> </script>


+ 205
- 85
pages_order/report/test/answer.vue View File

@ -2,77 +2,106 @@
<view class="page__view"> <view class="page__view">
<navbar :title="`问题 ${current + 1}/${total}`" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="transparent" /> <navbar :title="`问题 ${current + 1}/${total}`" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="transparent" />
<view class="bar">
<view class="flex tools">
<view class="left">
<button class="flex btn" v-if="showPreBtn" @click="pre">
<image class="btn-icon" src="@/pages_order/static/report/icon-wrapper.png" mode="widthFix"></image>
<text>上一题</text>
</button>
<template v-if="currentQuestion">
<view class="bar">
<view class="flex tools">
<view class="left">
<button class="flex btn" v-if="showPreBtn" @click="pre">
<image class="btn-icon" src="@/pages_order/static/report/icon-wrapper.png" mode="widthFix"></image>
<text>上一题</text>
</button>
</view>
<view class="right">
选择你的答案进入下一题
</view>
</view> </view>
<view class="right">
选择你的答案进入下一题
<view class="progress">
<view class="progress-bar" :style="{ width: `${progress}%` }"></view>
</view> </view>
</view> </view>
<view class="progress">
<view class="progress-bar" :style="{ width: `${progress}%` }"></view>
</view>
</view>
<view class="main">
<view class="question">{{ currentQuestion.question }}</view>
<template v-if="currentQuestion.component === 'select'">
<view class="select">
<view
v-for="item in currentQuestion.options"
:key="item.id"
:class="['flex', 'select-option', item.id === value ? 'is-active' : '']"
@click="onSelect(item.id)"
>
{{ item.content }}
<view class="main">
<view class="question">{{ currentQuestion.question }}</view>
<template v-if="currentQuestion.component === 'select'">
<view class="select">
<view
v-for="item in currentQuestion.options"
:key="item.id"
:class="['flex', 'select-option', item.id === value ? 'is-active' : '']"
@click="onSelect(item.id)"
>
{{ item.content }}
</view>
</view> </view>
</view>
</template>
<template v-else-if="currentQuestion.component === 'select-box'">
<view class="select-box">
<view
v-for="item in currentQuestion.options"
:key="item.id"
:class="['flex', 'flex-column', 'select-box-option', item.id === value ? 'is-active' : '']"
@click="onSelect(item.id)"
>
<image class="img" :src="item.id === value ? item.imageAfter : item.image" mode="aspectFit"></image>
<view class="text">{{ item.content }}</view>
</template>
<template v-else-if="currentQuestion.component === 'select-multiple'">
<view class="select">
<view
v-for="item in currentQuestion.options"
:key="item.id"
:class="['flex', 'select-option', value.includes(item.id) ? 'is-active' : '']"
@click="onSelectMulitple(item.id)"
>
{{ item.content }}
</view>
</view> </view>
</view>
</template>
<template v-else-if="currentQuestion.component === 'input'">
<view class="input">
<view class="flex input-box">
<view class="input-label" v-if="currentQuestion.options[0].prefix">{{ currentQuestion.options[0].prefix }}</view>
<input class="input-doc" v-model="value" placeholder="请输入内容" placeholder-style="font-family: PingFang SC; font-weight: 400; line-height: 1.4; font-size: 32rpx; color: #AAAACA;" />
<view class="input-unit" v-if="currentQuestion.options[0].suffix">{{ currentQuestion.options[0].suffix }}</view>
</template>
<template v-else-if="currentQuestion.component === 'select-box'">
<view class="select-box">
<view
v-for="item in currentQuestion.options"
:key="item.id"
:class="['flex', 'flex-column', 'select-box-option', item.id === value ? 'is-active' : '']"
@click="onSelect(item.id)"
>
<image class="img" :src="item.id === value ? item.imageAfter : item.image" mode="aspectFit"></image>
<view class="text">{{ item.content }}</view>
</view>
</view> </view>
</view>
</template>
<template v-else-if="currentQuestion.component === 'input-group'">
<view class="input">
<view class="flex input-box" v-for="(item, index) in currentQuestion.options" :key="item.id">
<view class="input-label" v-if="item.prefix">{{ item.prefix }}</view>
<input class="input-doc" v-model="value[index]" placeholder="请输入内容" placeholder-style="font-family: PingFang SC; font-weight: 400; line-height: 1.4; font-size: 32rpx; color: #AAAACA;" />
<view class="input-unit" v-if="item.suffix">{{ item.suffix }}</view>
</template>
<template v-else-if="currentQuestion.component === 'select-box-multiple'">
<view class="select-box">
<view
v-for="item in currentQuestion.options"
:key="item.id"
:class="['flex', 'flex-column', 'select-box-option', value.includes(item.id) ? 'is-active' : '']"
@click="onSelectMulitple(item.id)"
>
<image class="img" :src="value.includes(item.id) ? item.imageAfter : item.image" mode="aspectFit"></image>
<view class="text">{{ item.content }}</view>
</view>
</view>
</template>
<template v-else-if="currentQuestion.component === 'input'">
<view class="input">
<view class="flex input-box">
<view class="input-label" v-if="currentQuestion.options[0].prefix">{{ currentQuestion.options[0].prefix }}</view>
<input class="input-doc" v-model="value" :type="currentQuestion.options[0].inputType || 'text'" placeholder="请输入内容" placeholder-style="font-family: PingFang SC; font-weight: 400; line-height: 1.4; font-size: 32rpx; color: #AAAACA;" />
<view class="input-unit" v-if="currentQuestion.options[0].suffix">{{ currentQuestion.options[0].suffix }}</view>
</view>
</view>
</template>
<template v-else-if="currentQuestion.component === 'input-group'">
<view class="input">
<view class="flex input-box" v-for="(item, index) in currentQuestion.options" :key="item.id">
<view class="input-label" v-if="item.prefix">{{ item.prefix }}</view>
<input class="input-doc" v-model="value[index]" :type="currentQuestion.options[index].inputType || 'text'" placeholder="请输入内容" placeholder-style="font-family: PingFang SC; font-weight: 400; line-height: 1.4; font-size: 32rpx; color: #AAAACA;" />
<view class="input-unit" v-if="item.suffix">{{ item.suffix }}</view>
</view>
</view> </view>
</template>
<view class="flex btns">
<button :class="['btn', 'btn-palin', noneFlag ? 'is-active' : '']" v-if="!currentQuestion.required" @click="onSelectNone"> </button>
<button class="btn" v-if="showConfirmBtn" @click="onConfirm"> </button>
<button class="btn" v-if="showSubmitBtn" @click="onSubmit"> </button>
</view>
<view class="desc" v-if="currentQuestion.desc">
<uv-parse :content="currentQuestion.desc"></uv-parse>
</view> </view>
</template>
<view class="flex btns">
<button :class="['btn', 'btn-palin', noneFlag ? 'is-active' : '']" v-if="!currentQuestion.required" @click="onSelectNone"> </button>
<button class="btn" v-if="showConfirmBtn" @click="onConfirm"> </button>
<button class="btn" v-if="showSubmitBtn" @click="onSubmit"> </button>
</view>
<view class="desc" v-if="currentQuestion.desc">
<uv-parse :content="currentQuestion.desc"></uv-parse>
</view> </view>
</view>
</template>
</view> </view>
</template> </template>
@ -85,17 +114,23 @@
return { return {
step: 0, step: 0,
current: 0, current: 0,
tabs: [],
value: null, value: null,
noneFlag: false, noneFlag: false,
answers: [], answers: [],
// tags: [],
questionsList: [], questionsList: [],
total: 0, total: 0,
} }
}, },
computed: { computed: {
...mapState(['paperInfo']),
...mapState(['paperInfo', 'paperTags']),
preIdx() {
let index = this.tabs.findIndex(index => index === this.current)
return index - 1
},
showPreBtn() { showPreBtn() {
return this.current > 0
return this.preIdx >= 0
}, },
progress() { progress() {
return 100 * (this.current + 1) / this.total return 100 * (this.current + 1) / this.total
@ -111,14 +146,16 @@
return false return false
} }
return ['input', 'input-group'].includes(this.currentQuestion?.component)
return ['select-box-multiple', 'select-multiple','input', 'input-group'].includes(this.currentQuestion?.component)
}, },
}, },
onLoad(arg) { onLoad(arg) {
this.step = parseInt(arg.step) this.step = parseInt(arg.step)
this.current = parseInt(arg.current || 0)
// this.current = parseInt(arg.current || 0)
console.log('paperTags', this.paperTags)
this.fetchQuestionList() this.fetchQuestionList()
this.switchQuestion(parseInt(arg.current || 0))
this.value = this.answers[this.current]
console.log('currentQuestion', this.currentQuestion) console.log('currentQuestion', this.currentQuestion)
}, },
@ -130,19 +167,20 @@
const { questionsList } = category const { questionsList } = category
this.questionsList = questionsList.map(item => { this.questionsList = questionsList.map(item => {
const { id, text, type, options, required, content } = item
const { id, text, type, options, needTag, required, multiple: _multiple, content } = item
let component = 'select' let component = 'select'
const multiple = _multiple == 'Y'
switch(type) { // 0- 1- 2- switch(type) { // 0- 1- 2-
case '1': case '1':
component = options?.length > 1 ? 'input-group' : 'input' component = options?.length > 1 ? 'input-group' : 'input'
break break
case '2': case '2':
component = 'select-box'
component = multiple ? 'select-box-multiple' : 'select-box'
break break
default: default:
component = 'select'
component = multiple ? 'select-multiple' : 'select'
break break
} }
@ -152,7 +190,9 @@
type, type,
component, component,
options, options,
needTag: needTag ? JSON.parse(needTag).map(config => config.tags).filter(tags => tags.length) : null,
required: required == 'Y', required: required == 'Y',
multiple,
desc: content, desc: content,
} }
}) })
@ -161,19 +201,68 @@
this.answers = this.questionsList.map(item => { this.answers = this.questionsList.map(item => {
let val = null let val = null
if (item.component === 'input-group') {
val = new Array(item.options.length).fill(0).map(() => null)
switch (item.component) {
case 'select-box-multiple':
case 'select-multiple':
val = []
break
case 'input-group':
val = new Array(item.options.length).fill(0).map(() => '')
break;
default:
val = null
break;
} }
return val return val
}) })
this.value = this.answers[this.current]
// this.tags = this.paperTags[this.step]
// this.value = this.answers[this.current]
console.log('questionsList', this.questionsList) console.log('questionsList', this.questionsList)
console.log('answers', this.answers) console.log('answers', this.answers)
}, },
switchQuestion(current) {
let { needTag } = this.questionsList[current]
if (!needTag) {
this.current = current
this.tabs.push(this.current)
return
}
const selectTags = this.paperTags.flat(2)
console.log('selectTags', selectTags)
console.log('needTag', needTag)
let valid = needTag.some(tags => {
return tags.every(tag => {
const { value, exclude } = tag
let include = selectTags.includes(value)
return exclude ? !include : include
})
})
console.log('valid', valid)
if (valid) {
this.current = current
this.tabs.push(this.current)
return
}
if (current + 1 < this.questionsList.length) {
current += 1
this.switchQuestion(current)
return
}
this.$utils.redirectTo(`/pages_order/report/test/step?step=${this.step + 1}`)
},
pre() { pre() {
this.current -= 1
// this.current -= 1
this.current = this.preIdx
this.value = this.answers[this.current] this.value = this.answers[this.current]
this.noneFlag = false this.noneFlag = false
}, },
@ -181,18 +270,19 @@
if (this.showSubmitBtn) { if (this.showSubmitBtn) {
return return
} }
this.current += 1
// this.current += 1
this.switchQuestion(this.current + 1)
this.value = this.answers[this.current] this.value = this.answers[this.current]
this.noneFlag = false this.noneFlag = false
}, },
async fetchAnswer() { async fetchAnswer() {
try { try {
const { id: questionsId, type, required, options } = this.currentQuestion
const { id: questionsId, type, required, multiple, options } = this.currentQuestion
console.log('paperInfo', this.paperInfo) console.log('paperInfo', this.paperInfo)
console.log('currentQuestion', this.currentQuestion) console.log('currentQuestion', this.currentQuestion)
console.log('required', required, 'noneFlag', this.noneFlag, 'value', this.value) console.log('required', required, 'noneFlag', this.noneFlag, 'value', this.value)
if (required && !this.noneFlag && (!this.value || this.value?.every?.(val => !val))) {
if (required && !this.noneFlag && (!this.value || !this.value?.length || this.value?.every?.(val => !val))) {
console.log('未答题') console.log('未答题')
uni.showToast({ uni.showToast({
title: '请答题', title: '请答题',
@ -214,8 +304,8 @@
return obj return obj
}, {}) }, {})
answer = JSON.stringify(answer) answer = JSON.stringify(answer)
} else {
answer = this.value
} else if (multiple && Array.isArray(this.value)) { //
answer = this.value.join(',')
} }
let params = { let params = {
@ -228,6 +318,28 @@
this.answers[this.current] = this.value this.answers[this.current] = this.value
let paperTags = [...this.paperTags]
if (type == 1) {
paperTags[this.step][this.current] = []
} else {
let selectedIdArr = Array.isArray(this.value) ? this.value : [this.value]
console.log('selectedIdArr', selectedIdArr, 'options', options)
paperTags[this.step][this.current] = selectedIdArr.reduce((arr, id) => {
const { settingTag } = options.find(item => item.id === id) || {}
if (settingTag) {
const tags = settingTag?.split?.(',')
tags?.length && (arr = arr.concat(tags))
}
return arr
}, [])
}
console.log('paperTags', paperTags)
this.$store.commit('setPaperTags', paperTags)
return true return true
} catch (err) { } catch (err) {
console.log('answerPaper', err) console.log('answerPaper', err)
@ -242,7 +354,6 @@
} }
let succ = await this.fetchAnswer() let succ = await this.fetchAnswer()
console.log('fetchAnswer', succ)
if (!succ) { if (!succ) {
return return
@ -254,9 +365,11 @@
}, 500) }, 500)
}) })
}, },
async onSelectMulitple(id) {
this.value = this.value.includes(id) ? this.value.filter(item => item !== id) : this.value.concat(id)
},
async onConfirm() { async onConfirm() {
let succ = await this.fetchAnswer() let succ = await this.fetchAnswer()
console.log('fetchAnswer', succ)
if (!succ) { if (!succ) {
return return
@ -269,14 +382,22 @@
let val = null let val = null
if (this.currentQuestion.component === 'input-group') {
val = new Array(this.currentQuestion.options.length).fill(0).map(() => '')
switch (this.currentQuestion.component) {
case 'select-box-multiple':
case 'select-multiple':
val = []
break
case 'input-group':
val = new Array(this.currentQuestion.options.length).fill(0).map(() => '')
break;
default:
val = null
break;
} }
this.value = val this.value = val
let succ = await this.fetchAnswer() let succ = await this.fetchAnswer()
console.log('fetchAnswer', succ)
if (!succ) { if (!succ) {
return return
@ -286,7 +407,6 @@
}, },
async onSubmit() { async onSubmit() {
let succ = await this.fetchAnswer() let succ = await this.fetchAnswer()
console.log('fetchAnswer', succ)
if (!succ) { if (!succ) {
return return


+ 4
- 1
pages_order/report/test/intro.vue View File

@ -60,7 +60,6 @@
...mapState(['paperInfo']), ...mapState(['paperInfo']),
}, },
onLoad(arg) { onLoad(arg) {
console.log('onLoad', arg)
const { id } = arg const { id } = arg
this.id = id this.id = id
@ -88,6 +87,10 @@
const reportId = await this.$fetch('startPaper', { id: this.id }) const reportId = await this.$fetch('startPaper', { id: this.id })
this.detail.reportId = reportId this.detail.reportId = reportId
this.$store.commit('setPaperInfo', this.detail) this.$store.commit('setPaperInfo', this.detail)
const defaultPaperTags = this.detail.category.map(category => {
return category.questionsList.map(() => [])
})
this.$store.commit('setPaperTags', defaultPaperTags)
this.$utils.navigateTo('/pages_order/report/test/step?step=0') this.$utils.navigateTo('/pages_order/report/test/step?step=0')
} catch (err) { } catch (err) {


+ 4
- 0
store/store.js View File

@ -16,6 +16,7 @@ const store = new Vuex.Store({
applyServiceProduct: [], // 售后服务商品 applyServiceProduct: [], // 售后服务商品
addressInfo: null, addressInfo: null,
paperInfo: null, paperInfo: null,
paperTags: null,
}, },
getters: { getters: {
// 角色 true为水洗店 false为酒店 : 身份判断如果不需要,可以删除 // 角色 true为水洗店 false为酒店 : 身份判断如果不需要,可以删除
@ -135,6 +136,9 @@ const store = new Vuex.Store({
setPaperInfo(state, data) { setPaperInfo(state, data) {
state.paperInfo = data state.paperInfo = data
}, },
setPaperTags(state, data) {
state.paperTags = data
},
}, },
actions: { actions: {
async addCart(state, data) { async addCart(state, data) {


Loading…
Cancel
Save