Files
app-govern/pages/home/feedback.vue

152 lines
4.4 KiB
Vue
Raw Normal View History

2023-02-09 16:37:53 +08:00
<template>
<Cn-page :loading='loading'>
<view slot='body'>
<view class='index'>
2023-04-07 11:35:16 +08:00
<view class="content">
2023-02-09 16:37:53 +08:00
<uni-forms>
<!-- <uni-forms-item label="类型">
<uni-data-select v-model="item.type" :localdata="range"></uni-data-select>
</uni-forms-item> -->
<uni-forms-item label="标题">
2023-03-08 13:45:57 +08:00
<uni-easyinput type="text" v-model="formData.title" placeholder="请输入问题简要" />
2023-02-09 16:37:53 +08:00
</uni-forms-item>
<uni-forms-item label="描述">
2023-04-10 09:48:03 +08:00
<uni-easyinput type="textarea" v-model="formData.description" placeholder="请输入详细描述" />
2023-03-08 13:45:57 +08:00
</uni-forms-item>
<uni-forms-item label="图片">
2023-04-10 09:48:03 +08:00
<uni-file-picker :auto-upload="false" @select="fileChange" @delete="delImg" />
2023-02-09 16:37:53 +08:00
</uni-forms-item>
</uni-forms>
</view>
<view class="btn-wrap">
<view class="btn-wrap-item " @click="submit"> 提交 </view>
</view>
2023-03-09 13:50:45 +08:00
<navigator url="/pages/home/service" hover-class="none" class="fixed-btn">
<image src="/static/service.png" style="height:66rpx;width:66rpx" />
</navigator>
2023-02-09 16:37:53 +08:00
</view>
</view>
</Cn-page>
</template>
<script>
2023-04-10 09:48:03 +08:00
import { addFeedBack } from '../../common/api/feedback'
2023-02-09 16:37:53 +08:00
export default {
2023-04-10 09:48:03 +08:00
data() {
2023-02-09 16:37:53 +08:00
return {
loading: false,
2023-03-08 13:45:57 +08:00
formData: {
title: '',
2023-04-10 09:48:03 +08:00
description: '',
type: 1,
userId: '',
files: []
2023-03-08 13:45:57 +08:00
},
2023-02-09 16:37:53 +08:00
range: [
{ value: 0, text: "DVR" },
{ value: 1, text: "APF" },
],
}
},
methods: {
2023-04-10 09:48:03 +08:00
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() {
2023-02-09 16:37:53 +08:00
this.formData.push({
type: '',
address: '',
})
},
2023-04-10 09:48:03 +08:00
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
})
2023-02-09 16:37:53 +08:00
},
2023-04-10 09:48:03 +08:00
},
onLoad(options) {
this.formData.userId = uni.getStorageSync('userInfo').id
2023-02-09 16:37:53 +08:00
}
}
</script>
<style lang='scss'>
.index {
2023-02-20 14:19:28 +08:00
padding: 20rpx;
2023-02-09 16:37:53 +08:00
.content {
margin-bottom: 20rpx;
2023-03-08 13:45:57 +08:00
padding: 34rpx;
2023-02-09 16:37:53 +08:00
background: $uni-theme-white;
border-radius: 12rpx;
}
.btn-wrap {
margin-top: 40rpx;
display: flex;
align-items: center;
justify-content: space-between;
.btn-wrap-item {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
background: $uni-theme-blue;
color: #fff;
height: 80rpx;
border-radius: 12rpx;
}
}
}
2023-03-09 13:50:45 +08:00
.fixed-btn {
position: fixed;
right: 80rpx;
bottom: 200rpx;
width: 126rpx;
height: 126rpx;
background: #fff;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.2);
image {
height: 66rpx;
width: 66rpx;
}
}
2023-02-09 16:37:53 +08:00
</style>