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

Loading…
Cancel
Save