反馈接口对接
This commit is contained in:
@@ -11,10 +11,10 @@
|
||||
<uni-easyinput type="text" v-model="formData.title" placeholder="请输入问题简要" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="描述">
|
||||
<uni-easyinput type="textarea" v-model="formData.des" placeholder="请输入详细描述" />
|
||||
<uni-easyinput type="textarea" v-model="formData.description" placeholder="请输入详细描述" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="图片">
|
||||
<uni-file-picker :auto-upload="false" :fileList="formData.fileList" @change="fileChange" />
|
||||
<uni-file-picker :auto-upload="false" @select="fileChange" @delete="delImg" />
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
@@ -29,14 +29,17 @@
|
||||
</Cn-page>
|
||||
</template>
|
||||
<script>
|
||||
import { addFeedBack } from '../../common/api/feedback'
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
formData: {
|
||||
title: '',
|
||||
des: '',
|
||||
fileList: []
|
||||
description: '',
|
||||
type: 1,
|
||||
userId: '',
|
||||
files: []
|
||||
},
|
||||
range: [
|
||||
{ value: 0, text: "DVR" },
|
||||
@@ -46,16 +49,55 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
delImg(e) {
|
||||
console.log(e);
|
||||
this.formData.files = this.formData.files.filter(item => item.url !== e.tempFilePath)
|
||||
},
|
||||
fileChange(e) {
|
||||
console.log(e);
|
||||
e.tempFilePaths.forEach(item => {
|
||||
this.formData.files.push({
|
||||
url: item,
|
||||
name: 'files'
|
||||
})
|
||||
})
|
||||
console.log(this.formData.files);
|
||||
},
|
||||
add() {
|
||||
this.formData.push({
|
||||
type: '',
|
||||
address: '',
|
||||
})
|
||||
},
|
||||
submit () {
|
||||
console.log(this.formData)
|
||||
uni.navigateBack({ delta: 1 })
|
||||
submit() {
|
||||
if (!this.formData.title) {
|
||||
uni.showToast({
|
||||
title: '请输入标题',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
addFeedBack(this.formData).then(res => {
|
||||
console.log(res)
|
||||
res = res[1]
|
||||
res = JSON.parse(res.data)
|
||||
console.log(res);
|
||||
if (res.code = 'A0000') {
|
||||
this.$util.toast(res.message)
|
||||
setTimeout(() => {
|
||||
// uni.redirectTo({ url: '/pages/message/feedback' })
|
||||
}, 1000);
|
||||
} else {
|
||||
this.$util.toast(res.message)
|
||||
}
|
||||
|
||||
}).catch(err => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
this.formData.userId = uni.getStorageSync('userInfo').id
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user