|
|
|
@ -10,18 +10,17 @@ |
|
|
|
<uv-form |
|
|
|
ref="form" |
|
|
|
:model="form" |
|
|
|
:rules="rules" |
|
|
|
errorType="toast" |
|
|
|
> |
|
|
|
<view class="form-item"> |
|
|
|
<uv-form-item prop="project" :customStyle="formItemStyle"> |
|
|
|
<uv-form-item prop="activityId" :customStyle="formItemStyle"> |
|
|
|
<view class="form-item-label"> |
|
|
|
<image class="icon" src="@/pages_order/static/icon-require.png" mode="widthFix"></image> |
|
|
|
关联项目 |
|
|
|
</view> |
|
|
|
<view class="form-item-content"> |
|
|
|
<view class="flex row" @click="openRelatePojectPicker"> |
|
|
|
<view v-if="form.project" class="text">{{ projectDesc }}</view> |
|
|
|
<view v-if="form.activityId" class="text">{{ projectDesc }}</view> |
|
|
|
<view v-else class="text placeholder">请选择关联项目</view> |
|
|
|
<uv-icon name="arrow-right" color="#C6C6C6" size="32rpx"></uv-icon> |
|
|
|
</view> |
|
|
|
@ -30,31 +29,31 @@ |
|
|
|
</uv-form-item> |
|
|
|
</view> |
|
|
|
<view class="form-item"> |
|
|
|
<uv-form-item prop="tripNum" :customStyle="formItemStyle"> |
|
|
|
<uv-form-item prop="processScore" :customStyle="formItemStyle"> |
|
|
|
<view class="flex row"> |
|
|
|
<view class="form-item-label">行程</view> |
|
|
|
<view class="form-item-content"> |
|
|
|
<formRate v-model="form.tripNum"></formRate> |
|
|
|
<formRate v-model="form.processScore"></formRate> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uv-form-item> |
|
|
|
</view> |
|
|
|
<view class="form-item"> |
|
|
|
<uv-form-item prop="spotNum" :customStyle="formItemStyle"> |
|
|
|
<uv-form-item prop="spotScore" :customStyle="formItemStyle"> |
|
|
|
<view class="flex row"> |
|
|
|
<view class="form-item-label">景点</view> |
|
|
|
<view class="form-item-content"> |
|
|
|
<formRate v-model="form.spotNum"></formRate> |
|
|
|
<formRate v-model="form.spotScore"></formRate> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uv-form-item> |
|
|
|
</view> |
|
|
|
<view class="form-item"> |
|
|
|
<uv-form-item prop="mentorNum" :customStyle="formItemStyle"> |
|
|
|
<uv-form-item prop="teacherScore" :customStyle="formItemStyle"> |
|
|
|
<view class="flex row"> |
|
|
|
<view class="form-item-label">导师</view> |
|
|
|
<view class="form-item-content"> |
|
|
|
<formRate v-model="form.mentorNum"></formRate> |
|
|
|
<formRate v-model="form.teacherScore"></formRate> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uv-form-item> |
|
|
|
@ -67,11 +66,11 @@ |
|
|
|
</view> |
|
|
|
</uv-form-item> |
|
|
|
</view> |
|
|
|
<view class="form-item" v-for="(item, index) in questions" :key="item.id"> |
|
|
|
<view class="form-item" v-for="(item, index) in configList.experienceQuestionList" :key="item.id"> |
|
|
|
<uv-form-item :prop="`texts[${index}]`" :customStyle="formItemStyle"> |
|
|
|
<view class="form-item-label"> |
|
|
|
<image class="icon" src="@/pages_order/static/icon-require.png" mode="widthFix"></image> |
|
|
|
{{ item.label }} |
|
|
|
{{ item.question }} |
|
|
|
</view> |
|
|
|
<view class="form-item-content"> |
|
|
|
<formTextarea v-model="form.texts[index]"></formTextarea> |
|
|
|
@ -89,6 +88,8 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { mapState } from 'vuex' |
|
|
|
|
|
|
|
import reloateProjectPopup from '@/pages_order/components/reloateProjectPopup.vue' |
|
|
|
import formTextarea from '@/pages_order/components/formTextarea.vue' |
|
|
|
import formUpload from '@/pages_order/components/formUpload.vue' |
|
|
|
@ -105,88 +106,74 @@ |
|
|
|
return { |
|
|
|
isShow: false, |
|
|
|
form: { |
|
|
|
project: null, |
|
|
|
tripNum: null, |
|
|
|
spotNum: null, |
|
|
|
mentorNum: null, |
|
|
|
activityId: null, |
|
|
|
processScore: null, |
|
|
|
spotScore: null, |
|
|
|
teacherScore: null, |
|
|
|
images: [], |
|
|
|
texts: [], |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
// todo |
|
|
|
}, |
|
|
|
projects: [], |
|
|
|
questions: [], |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
...mapState(['userInfo', 'configList']), |
|
|
|
projectDesc() { |
|
|
|
const { project } = this.form |
|
|
|
const target = this.projects?.find?.(item => item.id === project) |
|
|
|
const { activityId } = this.form |
|
|
|
const target = this.projects?.find?.(item => item.id === activityId) |
|
|
|
|
|
|
|
return target?.name || '' |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getData() { |
|
|
|
// todo |
|
|
|
this.projects = [ |
|
|
|
{ |
|
|
|
id: '001', |
|
|
|
name: '亲子•坝上双草原6日 |乌兰布统+锡林郭勒+长城', |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '002', |
|
|
|
name: '青青草原•云中岭 |5-10公里AB线强度可选', |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '003', |
|
|
|
name: '新疆天山行7/9日丨醉美伊犁&吐鲁番双套餐', |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '004', |
|
|
|
name: '九色甘南|人间净土6日/7日深度游', |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '005', |
|
|
|
name: '北疆全景12日| 入疆首推!阿勒泰+伊犁+吐鲁番', |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '006', |
|
|
|
name: '塞上江南•神奇宁夏5日|穿越大漠与历史对话', |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '007', |
|
|
|
name: '尊享•天山环线9日| 伊犁全景+独库,头等舱大巴', |
|
|
|
}, |
|
|
|
] |
|
|
|
async fetchProjectOptions() { |
|
|
|
try { |
|
|
|
const records = (await this.$fetch('queryExperienceList', { pageNo: 1, pageSize: 1000, }))?.records |
|
|
|
|
|
|
|
this.projects = records.map(item => { |
|
|
|
return { |
|
|
|
id: item.activityId, |
|
|
|
name: item.activityTitle || item.activityId_dictText || '' |
|
|
|
} |
|
|
|
}) |
|
|
|
} catch (err) { |
|
|
|
|
|
|
|
this.questions = [ |
|
|
|
{ |
|
|
|
id: '001', |
|
|
|
label: '这次研学之旅,整体给你留下了怎样的印象?用几个词或几句话简单概括一下', |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '002', |
|
|
|
label: '在整个行程中,你最喜欢的部分是哪里?为什么?', |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: '003', |
|
|
|
label: '你觉得这次研学的行程安排是否合理?有没有哪些地方让你觉得特别满意或需要改进的?', |
|
|
|
} |
|
|
|
}, |
|
|
|
setRules() { |
|
|
|
const rules = { |
|
|
|
'activityId': { |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请选择关联项目', |
|
|
|
}, |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
// todo: check |
|
|
|
// this.questions.forEach((item, index) => { |
|
|
|
// rules[`texts[${index}]`] = { |
|
|
|
// type: 'string', |
|
|
|
// required: true, |
|
|
|
// message: `请回答“${item.label}”`, |
|
|
|
// } |
|
|
|
// }) |
|
|
|
|
|
|
|
this.$refs.form.setRules(rules) |
|
|
|
}, |
|
|
|
async open() { |
|
|
|
|
|
|
|
await this.getData() |
|
|
|
await this.fetchProjectOptions() |
|
|
|
|
|
|
|
const texts = this.questions.map(() => '') |
|
|
|
console.log('projects', this.projects) |
|
|
|
console.log('experienceQuestionList', this.configList.experienceQuestionList) |
|
|
|
|
|
|
|
const texts = this.configList.experienceQuestionList.map(() => '') |
|
|
|
|
|
|
|
this.form = { |
|
|
|
project: null, |
|
|
|
tripNum: null, |
|
|
|
spotNum: null, |
|
|
|
mentorNum: null, |
|
|
|
activityId: null, |
|
|
|
processScore: null, |
|
|
|
spotScore: null, |
|
|
|
teacherScore: null, |
|
|
|
images: [], |
|
|
|
texts, |
|
|
|
} |
|
|
|
@ -198,25 +185,43 @@ |
|
|
|
}, |
|
|
|
onPopupChange(e) { |
|
|
|
this.isShow = e.show |
|
|
|
|
|
|
|
// todo: need settimeout? |
|
|
|
setTimeout(() => { |
|
|
|
this.setRules() |
|
|
|
}, 800) |
|
|
|
}, |
|
|
|
openRelatePojectPicker() { |
|
|
|
this.$refs.reloateProjectPopup.open(this.form.project?.id || null) |
|
|
|
this.$refs.reloateProjectPopup.open(this.form.activityId || null) |
|
|
|
}, |
|
|
|
onRelateProjectChange(id) { |
|
|
|
this.form.project = id |
|
|
|
this.form.activityId = id |
|
|
|
}, |
|
|
|
async onPublish() { |
|
|
|
try { |
|
|
|
await this.$refs.form.validate() |
|
|
|
|
|
|
|
const { |
|
|
|
activityId, |
|
|
|
processScore, |
|
|
|
spotScore, |
|
|
|
teacherScore, |
|
|
|
images, |
|
|
|
texts, |
|
|
|
} = this.form |
|
|
|
|
|
|
|
const params = { |
|
|
|
// todo: check |
|
|
|
userId: this.userInfo.id, |
|
|
|
activityId, |
|
|
|
processScore, |
|
|
|
spotScore, |
|
|
|
teacherScore, |
|
|
|
image: images.join(','), |
|
|
|
content: texts.join('\r\n') // todo: check |
|
|
|
} |
|
|
|
|
|
|
|
// todo: fetch |
|
|
|
// await this.$fetch('updateAddress', params) |
|
|
|
await this.$fetch('addExperience', params) |
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
icon: 'success', |
|
|
|
|