#5 fox

Merged
Fox merged 4 commits from fox into master 1 month ago
  1. +19
    -7
      components/home/productSwiper.vue
  2. +8
    -2
      pages.json
  3. +3
    -44
      pages/index/index.vue
  4. +3
    -3
      pages_order/auth/wxUserInfo.vue
  5. +17
    -9
      pages_order/components/reportCard.vue
  6. +18
    -6
      pages_order/home/recommendSwiper.vue
  7. +12
    -4
      pages_order/report/compare/result.vue
  8. +1
    -2
      pages_order/report/detail/cardHeader.vue
  9. +5
    -6
      pages_order/report/detail/index.vue
  10. +4
    -2
      pages_order/report/nutritionProgram/index.vue
  11. +0
    -6
      pages_order/report/result/index.vue
  12. +7
    -2
      pages_order/report/result/resultSummary.vue
  13. +225
    -88
      pages_order/report/test/answer.vue
  14. +4
    -1
      pages_order/report/test/intro.vue
  15. +4
    -0
      store/store.js

+ 19
- 7
components/home/productSwiper.vue View File

@ -1,5 +1,5 @@
<template>
<view class="product-swiper__view">
<view>
<swiper
class="swiper"
:current="current"
@ -49,17 +49,13 @@
export default {
components: {
indicator,
},
props: {
autoplay: {
type: Boolean,
default: false,
},
},
data() {
return {
current: 0,
list: [],
last: null,
autoplay: true,
}
},
created() {
@ -85,6 +81,22 @@
},
onChange(e) {
this.current = e.detail.current
const currentTime = this.$dayjs()
if (this.last) {
const diff = currentTime.diff(this.last, 'millisecond')
console.log('diff', diff, e.detail.source)
if (diff < 2500 && e.detail.source === 'autoplay') {
console.log('autoplay abnormal')
this.autoplay = false
setTimeout(() => {
console.log('autoplay restart')
this.autoplay = true
}, 3000 - diff)
}
}
this.last = currentTime
},
},
}


+ 8
- 2
pages.json View File

@ -101,7 +101,10 @@
"path": "report/compare/result"
},
{
"path": "product/productList"
"path": "product/productList",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "product/productDetail"
@ -134,7 +137,10 @@
}
},
{
"path": "address/addressList"
"path": "address/addressList",
"style": {
"enablePullDownRefresh": true
}
},
{
"path": "comment/commentRecordsOfProduct",


+ 3
- 44
pages/index/index.vue View File

@ -6,15 +6,11 @@
</navbar>
<view class="content">
<view id="productSwiper" class="swiper">
<productSwiper :autoplay="autoplay.productSwiper"></productSwiper>
</view>
<productSwiper></productSwiper>
<view class="section">
<sectionHeader title="个性推荐" desc="Personal Recommendation"></sectionHeader>
<view id="recommendSwiper" class="swiper">
<recommend-swiper :autoplay="autoplay.recommendSwiper"></recommend-swiper>
</view>
<recommend-swiper></recommend-swiper>
<health-records-intro></health-records-intro>
</view>
@ -66,12 +62,6 @@
},
data() {
return {
isMounted: false,
observer: null,
autoplay: {
productSwiper: false,
recommendSwiper: false,
},
}
},
onLoad() {
@ -81,37 +71,7 @@
}
},
onShow() {
if (this.isMounted) {
this.observeElement()
}
},
mounted() {
this.observeElement()
this.isMounted = true
},
unmounted() {
this.observer.disconnect()
},
onHide() {
this.observer.disconnect()
this.observer = null
this.autoplay.productSwiper = false
this.autoplay.recommendSwiper = false
},
methods: {
observeElement() {
this.observer = uni.createIntersectionObserver(this, { observeAll: true, thresholds: [0, 1] });
this.observer.relativeTo('.content').observe('.swiper', res => {
if (res.intersectionRatio === 0) {
this.autoplay[res.id] = false
} else if (res.intersectionRatio === 1) {
this.autoplay[res.id] = true
}
})
},
},
}
</script>
@ -131,10 +91,9 @@
}
.content {
// padding: 80rpx 32rpx 182rpx 32rpx;
width: 100vw;
height: calc(100vh - (var(--status-bar-height) + 120rpx) - (env(safe-area-inset-bottom) + 120rpx));
padding: 70rpx 0 182rpx 0;
// padding-bottom: calc(env(safe-area-inset-bottom) + 120rpx + 182rpx);
box-sizing: border-box;
overflow-x: hidden;
overflow-y: auto;


+ 3
- 3
pages_order/auth/wxUserInfo.vue View File

@ -45,7 +45,7 @@
</uv-form-item>
</view>
<view class="form-item">
<uv-form-item prop="phone" :customStyle="formItemStyle">
<uv-form-item prop="avatar" :customStyle="formItemStyle">
<view class="form-item-label">头像</view>
<view class="form-item-content input">
<button class="btn btn-avatar" :plain="true" :hairline="false" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
@ -109,8 +109,8 @@
message: '请输入手机号',
},
'avatar': {
type: 'array',
required: true,
type: 'string',
required: false,
message: '请选择头像',
},
},


+ 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>
<view class="flex card-header-content">
<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 class="info">
<!-- todo -->
<view class="nickname">李星星</view>
<!-- <view class="nickname">{{ userInfo.name }}</view> -->
<view class="nickname">{{ data.realName || '' }}</view>
<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>
@ -26,8 +22,20 @@
</template>
<script>
export default {
import { mapState } from 'vuex'
export default {
props: {
data: {
type: Object,
default() {
return {}
}
}
},
computed: {
...mapState(['userInfo']),
},
}
</script>


+ 18
- 6
pages_order/home/recommendSwiper.vue View File

@ -46,17 +46,13 @@
export default {
components: {
indicator,
},
props: {
autoplay: {
type: Boolean,
default: false,
},
},
data() {
return {
current: 0,
list: [],
last: null,
autoplay: true,
}
},
created() {
@ -91,6 +87,22 @@
},
onChange(e) {
this.current = e.detail.current
const currentTime = this.$dayjs()
if (this.last) {
const diff = currentTime.diff(this.last, 'millisecond')
console.log('diff', diff, e.detail.source)
if (diff < 2500 && e.detail.source === 'autoplay') {
console.log('autoplay abnormal')
this.autoplay = false
setTimeout(() => {
console.log('autoplay restart')
this.autoplay = true
}, 3000 - diff)
}
}
this.last = currentTime
}
},
}


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

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


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

@ -5,8 +5,7 @@
<text>BMI 指数</text>
<text class="highlight">{{ BMI || '-' }}</text>
</view>
<view class="progress">
<!-- todo: check -->
<view class="progress" v-if="BMI">
<progressBar :progress="BMI" :total="30"></progressBar>
</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" />
<view class="main">
<reportCard>
<reportCard :data="detail">
<view class="section">
<cardHeader :BMI="BMI"></cardHeader>
<cardHeader :BMI="detail.bmi"></cardHeader>
</view>
<view class="section" v-for="(step, index) in list" :key="step.key">
<view class="flex section-header">
@ -84,7 +84,7 @@
},
data() {
return {
BMI: 0,
detail: {},
list: [],
}
},
@ -92,15 +92,14 @@
const { id } = arg
this.id = id
this.fetchReportData(id)
// todo: delete
this.BMI = 16.5
},
methods: {
async fetchReportData(id) {
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) => {
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" />
<view class="main">
<reportCard>
<reportCard :data="detail">
<view class="section header">
<view>营养师基于你生活习惯和营养目标推荐</view>
<view class="highlight">量身定制的营养方案</view>
@ -73,6 +73,7 @@
data() {
return {
productId: '',
detail: {},
list: [],
comment: 0,
}
@ -107,7 +108,7 @@
async fetchReportData(id) {
try {
const { productList } = await this.$fetch('getReportDetail', { id })
const { productList, ...detail } = await this.$fetch('getReportDetail', { id })
const detectList = []
const nutrientList = []
@ -146,6 +147,7 @@
})
this.detail = detail
this.list = [
{
id: '001',


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

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


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

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


+ 225
- 88
pages_order/report/test/answer.vue View File

@ -2,77 +2,106 @@
<view class="page__view">
<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 class="right">
选择你的答案进入下一题
<view class="progress">
<view class="progress-bar" :style="{ width: `${progress}%` }"></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>
</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>
</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>
</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>
</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>
</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>
</template>
@ -84,18 +113,24 @@
data() {
return {
step: 0,
current: 0,
current: null,
tabs: [],
value: null,
noneFlag: false,
answers: [],
// tags: [],
questionsList: [],
total: 0,
}
},
computed: {
...mapState(['paperInfo']),
...mapState(['paperInfo', 'paperTags']),
preIdx() {
let index = this.tabs.findIndex(index => index === this.current)
return index - 1
},
showPreBtn() {
return this.current > 0
return this.preIdx >= 0
},
progress() {
return 100 * (this.current + 1) / this.total
@ -111,14 +146,27 @@
return false
}
return ['input', 'input-group'].includes(this.currentQuestion?.component)
return ['select-box-multiple', 'select-multiple','input', 'input-group'].includes(this.currentQuestion?.component)
},
},
watch: {
tabs: {
handler(val) {
console.log('watch-tabs', val)
},
deep: true
},
current(val) {
console.log('watch-current', val)
},
},
onLoad(arg) {
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.switchQuestion(parseInt(arg.current || 0))
this.value = this.answers[this.current]
console.log('currentQuestion', this.currentQuestion)
},
@ -130,19 +178,20 @@
const { questionsList } = category
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'
const multiple = _multiple == 'Y'
switch(type) { // 0- 1- 2-
case '1':
component = options?.length > 1 ? 'input-group' : 'input'
break
case '2':
component = 'select-box'
component = multiple ? 'select-box-multiple' : 'select-box'
break
default:
component = 'select'
component = multiple ? 'select-multiple' : 'select'
break
}
@ -152,7 +201,9 @@
type,
component,
options,
needTag: needTag ? JSON.parse(needTag).map(config => config.tags).filter(tags => tags.length) : null,
required: required == 'Y',
multiple,
desc: content,
}
})
@ -161,38 +212,94 @@
this.answers = this.questionsList.map(item => {
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
})
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('answers', this.answers)
},
switchQuestion(current) {
console.log('current', this.current, 'target', current)
let { needTag } = this.questionsList[current]
console.log('needTag length', needTag?.length)
if (!needTag?.length) {
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() {
this.current -= 1
console.log('pre')
// this.current -= 1
const preIdx = this.preIdx
this.current = this.tabs[this.preIdx]
this.value = this.answers[this.current]
this.noneFlag = false
this.tabs = this.tabs.slice(0, preIdx + 1)
console.log('tabs', this.tabs)
},
next() {
if (this.showSubmitBtn) {
return
}
this.current += 1
// this.current += 1
this.switchQuestion(this.current + 1)
this.value = this.answers[this.current]
this.noneFlag = false
},
async fetchAnswer() {
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('currentQuestion', this.currentQuestion)
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('未答题')
uni.showToast({
title: '请答题',
@ -209,13 +316,13 @@
answer = options.reduce((obj, option, oIdx) => {
const { id: optionsId } = option
obj[optionsId] = this.value[oIdx]
obj[optionsId] = Array.isArray(this.value) ? this.value[oIdx] : this.value
return obj
}, {})
answer = JSON.stringify(answer)
} else {
answer = this.value
} else if (multiple && Array.isArray(this.value)) { //
answer = this.value.join(',')
}
let params = {
@ -228,6 +335,28 @@
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
} catch (err) {
console.log('answerPaper', err)
@ -242,7 +371,6 @@
}
let succ = await this.fetchAnswer()
console.log('fetchAnswer', succ)
if (!succ) {
return
@ -254,9 +382,11 @@
}, 500)
})
},
async onSelectMulitple(id) {
this.value = this.value.includes(id) ? this.value.filter(item => item !== id) : this.value.concat(id)
},
async onConfirm() {
let succ = await this.fetchAnswer()
console.log('fetchAnswer', succ)
if (!succ) {
return
@ -269,14 +399,22 @@
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
let succ = await this.fetchAnswer()
console.log('fetchAnswer', succ)
if (!succ) {
return
@ -286,7 +424,6 @@
},
async onSubmit() {
let succ = await this.fetchAnswer()
console.log('fetchAnswer', succ)
if (!succ) {
return
@ -371,7 +508,7 @@
.main {
width: 100%;
padding: 70rpx 104rpx 0 104rpx;
padding: 70rpx 104rpx;
box-sizing: border-box;
}


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

@ -60,7 +60,6 @@
...mapState(['paperInfo']),
},
onLoad(arg) {
console.log('onLoad', arg)
const { id } = arg
this.id = id
@ -88,6 +87,10 @@
const reportId = await this.$fetch('startPaper', { id: this.id })
this.detail.reportId = reportId
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')
} catch (err) {


+ 4
- 0
store/store.js View File

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


Loading…
Cancel
Save