|
@@ -10,10 +10,10 @@
|
|
|
</radio-group>
|
|
|
</view>
|
|
|
<view class="textarea">
|
|
|
- <textarea placeholder="请描述您遇到的问题或意见" />
|
|
|
+ <textarea v-model="form.content" placeholder="请描述您遇到的问题或意见" />
|
|
|
</view>
|
|
|
<view class="upload">
|
|
|
- <view class="img-list" v-for="(item, index) in form.imageFiles" :key="index">
|
|
|
+ <view class="img-list" v-for="(item, index) in imageFiles" :key="index">
|
|
|
<uni-icons class="close" type="closeempty" color="#FFF" size="12" @click="getDelete(index)" />
|
|
|
<img :src="item" />
|
|
|
</view>
|
|
@@ -32,13 +32,23 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { Base64 } from 'js-base64'
|
|
|
import { list, submit } from '@/api/help.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
+ const info = getApp().globalData.userInfo
|
|
|
return {
|
|
|
// 表单
|
|
|
- form: {},
|
|
|
+ form: {
|
|
|
+ appVersion: info.version,
|
|
|
+ phone: info.phone,
|
|
|
+ platformType: info.deviceType,
|
|
|
+ systemVersion: info.systemVersion,
|
|
|
+ imageFiles: '',
|
|
|
+ type: '',
|
|
|
+ content: ''
|
|
|
+ },
|
|
|
+ // 图片列表
|
|
|
+ imageFiles: [],
|
|
|
// 单选
|
|
|
active: 0,
|
|
|
// 反馈类型
|
|
@@ -47,27 +57,12 @@ export default {
|
|
|
},
|
|
|
onLoad() {
|
|
|
this.getList()
|
|
|
- const e = getApp().globalData.userInfo
|
|
|
- this.form = {
|
|
|
- appVersion: e.version,
|
|
|
- phone: e.phone,
|
|
|
- platformType: e.deviceType,
|
|
|
- systemVersion: e.systemVersion,
|
|
|
- imageFiles: [],
|
|
|
- type: '',
|
|
|
- content: ''
|
|
|
- }
|
|
|
},
|
|
|
methods: {
|
|
|
// 反馈类型
|
|
|
getList() {
|
|
|
- uni.showLoading({
|
|
|
- title: '加载中...',
|
|
|
- mask: true
|
|
|
- })
|
|
|
list().then(res => {
|
|
|
if (res.data.code === 0) {
|
|
|
- uni.hideLoading()
|
|
|
this.typeOptions = res.data.data
|
|
|
}
|
|
|
})
|
|
@@ -75,54 +70,40 @@ export default {
|
|
|
|
|
|
// 单选
|
|
|
radioChange(e) {
|
|
|
- this.typeOptions.map(i => {
|
|
|
- if (i.id === e.detail.value) {
|
|
|
- this.active = i.id
|
|
|
- this.form.type = i.id
|
|
|
- }
|
|
|
- })
|
|
|
+ this.active = e.detail.value
|
|
|
+ this.form.type = e.detail.value
|
|
|
},
|
|
|
|
|
|
// 上传
|
|
|
upload() {
|
|
|
- // let count = 9 - this.form.imageFiles.length
|
|
|
- // uni.chooseImage({
|
|
|
- // count: count,
|
|
|
- // sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
|
- // sourceType: ['album'], //从相册选择
|
|
|
- // success: (res) => {
|
|
|
- // res.tempFilePaths.map(i => {
|
|
|
- // this.form.imageFiles.push(Base64.encode(i))
|
|
|
- // })
|
|
|
- // }
|
|
|
- // })
|
|
|
selectImageCount.postMessage(`${this.form.imageFiles.length}`)
|
|
|
selectImage.postMessage('获取相册信息')
|
|
|
- window['receiveImageAddress'] = res => {
|
|
|
- JSON.parse(res).addressList.map(i => {
|
|
|
- this.form.imageFiles.push(Base64.encode(i))
|
|
|
+ window['receiveImageAddress'] = e => {
|
|
|
+ JSON.parse(e).addressList.map(i => {
|
|
|
+ this.imageFiles.push(i)
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
|
|
|
// 删除按钮
|
|
|
getDelete(index) {
|
|
|
- this.form.imageFiles.splice(index, 1)
|
|
|
+ this.imageFiles.splice(index, 1)
|
|
|
},
|
|
|
|
|
|
// 提交
|
|
|
getSubmit() {
|
|
|
if (this.form.type !== '' && this.form.content !== '') {
|
|
|
- uni.showLoading({
|
|
|
- title: '提交中...',
|
|
|
- mask: true
|
|
|
- })
|
|
|
+ this.form.imageFiles = this.imageFiles.join(',')
|
|
|
submit(this.form).then(res => {
|
|
|
- uni.hideLoading()
|
|
|
if (res.data.code === 0) {
|
|
|
uni.showToast({
|
|
|
title: '提交成功!'
|
|
|
})
|
|
|
+ this.form.imageFiles = ''
|
|
|
+ this.form.type = ''
|
|
|
+ this.active = 0
|
|
|
+ this.form.content = ''
|
|
|
+ this.imageFiles = []
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: res.data.message,
|