Browse Source

修改事件上报校验

feature
战立标 2 years ago
parent
commit
bfacb03ae8
  1. 39
      src/views/event/index.vue

39
src/views/event/index.vue

@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<van-tabs v-model="type" animated sticky swipeable lazy-render> <van-tabs v-model="type" animated lazy-render sticky swipeable>
<van-tab title="上报诉求"> <van-tab title="上报诉求">
<div class="container"> <div class="container">
<div class="block"> <div class="block">
@ -17,8 +17,8 @@
> >
<template #extra> <template #extra>
<div class="speech"> <div class="speech">
<Audio v-show="audio.duration" :audioSrc="audio" /> <Audio v-show="audio.duration" :audioSrc="audio"/>
<Recording :isFile="isFile" @change="setAudio" /> <Recording :isFile="isFile" @change="setAudio"/>
</div> </div>
</template> </template>
</van-field> </van-field>
@ -28,7 +28,7 @@
<div class="block"> <div class="block">
<van-cell title="上传图片"> <van-cell title="上传图片">
<template #label> <template #label>
<van-uploader v-model="fileList" :after-read="afterRead" :max-count="3" :max-size="10 * 1024 * 1024" /> <van-uploader v-model="fileList" :after-read="afterRead" :max-count="3" :max-size="10 * 1024 * 1024"/>
</template> </template>
</van-cell> </van-cell>
</div> </div>
@ -39,7 +39,7 @@
</van-cell> </van-cell>
</div> </div>
<div class="block"> <div class="block">
<van-field v-model="name" label="联系人" placeholder="请输入联系人" required /> <van-field v-model="name" label="联系人" placeholder="请输入联系人" required/>
<van-field <van-field
v-model="phone" v-model="phone"
label="联系电话" label="联系电话"
@ -51,31 +51,31 @@
</div> </div>
<van-button block color="linear-gradient(to right, #81B5FB, #3E92FF)" round @click="submit">提交</van-button> <van-button block color="linear-gradient(to right, #81B5FB, #3E92FF)" round @click="submit">提交</van-button>
<Perfect /> <Perfect/>
<Map ref="map" @locationChange="locationChange" /> <Map ref="map" @locationChange="locationChange"/>
</div> </div>
</van-tab> </van-tab>
<van-tab title="我的诉求"> <van-tab title="我的诉求">
<appeal v-if="type == 1" /> <appeal v-if="type == 1"/>
</van-tab> </van-tab>
</van-tabs> </van-tabs>
</div> </div>
</template> </template>
<script> <script>
import { setConfig } from '@/utils/jweixin' import {setConfig} from '@/utils/jweixin'
import Recording from '@/components/Recording' import Recording from '@/components/Recording'
import Perfect from '@/components/Perfect' import Perfect from '@/components/Perfect'
import Audio from '@/components/Audio' import Audio from '@/components/Audio'
import Map from '@/components/Map' import Map from '@/components/Map'
import appeal from '@/views/appeal' import appeal from '@/views/appeal'
import { uploadvariedfile } from '@/api/basic' import {uploadvariedfile} from '@/api/basic'
import { saveOfficialAccountEvent } from '@/api/event' import {saveOfficialAccountEvent} from '@/api/event'
import { mapKey } from '@/config' import {mapKey} from '@/config'
export default { export default {
name: 'event', name: 'event',
components: { Recording, Audio, Perfect, Map, appeal }, components: {Recording, Audio, Perfect, Map, appeal},
data() { data() {
return { return {
type: 0, type: 0,
@ -131,7 +131,8 @@ export default {
errorPosition() { errorPosition() {
console.log('定位失败,再次进行定位') console.log('定位失败,再次进行定位')
}, },
clickUpload() {}, clickUpload() {
},
setAudio(val) { setAudio(val) {
console.log(val, 'this.val') console.log(val, 'this.val')
this.isFile = false this.isFile = false
@ -156,9 +157,11 @@ export default {
}) })
}, },
submit() { submit() {
if (!this.eventContent) { if (!this.audio.serverId) {
this.$toast.fail('请输入描述') if (!this.eventContent) {
return this.$toast.fail('请输入描述')
return
}
} }
if (!this.name) { if (!this.name) {
this.$toast.fail('请输入姓名') this.$toast.fail('请输入姓名')
@ -181,7 +184,7 @@ export default {
address: this.address, address: this.address,
reporterName: this.name, reporterName: this.name,
reporterMobile: this.phone, reporterMobile: this.phone,
eventContent: this.eventContent, eventContent: this.eventContent ? this.eventContent : '语音报事',
userId: this.$store.state.app.userInfo.userId, userId: this.$store.state.app.userInfo.userId,
customerId: this.$store.state.app.userInfo.customerId customerId: this.$store.state.app.userInfo.customerId
}).then(() => { }).then(() => {

Loading…
Cancel
Save