hls_crm/pagesA/profile/feedback/feedback.vue

213 lines
3.6 KiB
Vue

<template>
<view class="feedback">
<view class="feedback_area">
<textarea v-model="content" placeholder="请输入你需要反馈的内容" />
</view>
<view class="upload">
<view class="upload_title">上传图片</view>
<view class="tup">
<view class="pian" v-if="imgArr.length !== 0" v-for="(item,index) in imgArr" :key="index">
<image :src="item.url"></image>
</view>
<view class="tu" @click="upload">
<image :src="BASE_IMG_URL+'jia.png'" mode="aspectFill"></image>
<view>选择图片</view>
</view>
</view>
</view>
<view id="btn" class="btn_g bg-blue button-hover round" @click="submitFeedback">
提交
</view>
</view>
</template>
<script>
import {
netFeedBack,
uploadUrl
} from '@/api/index.js'
import {
BASE_IMG_URL
} from '@/util/api.js'
export default {
data() {
return {
BASE_IMG_URL:BASE_IMG_URL,
fileList: [],
content: '',
imgArr: [],
percent: 0,
loading: false,
disabled: false
}
},
onLoad() {
},
methods: {
upload() {
uni.chooseImage({
count: 9,
sizeType:['compressed'],
success:(res)=> {
let arr = res.tempFilePaths
arr.forEach(ele=>{
this.uploadFile(ele)
})
}
});
},
uploadFile(file) {
uni.uploadFile({
url: uploadUrl,
name: 'file',
header: {
'token': uni.getStorageSync('token')
},
filePath: file,
// #ifdef MP-ALIPAY
fileType: 'image',
// #endif
success: (res) => {
let data = JSON.parse(res.data)
this.imgArr.push(data.data)
},
fail: (err) => {
console.log(err)
}
})
},
submitFeedback() {
var that = this;
let arr = []
that.imgArr.forEach(ele => {
arr.push(ele.id)
})
let params = {
content: that.content,
file: arr.join(',')
}
netFeedBack(params).then(res => {
uni.showToast({
title: res.msg,
icon: 'none'
})
setTimeout(() => {
uni.navigateBack({
delta: 1
})
}, 2000)
})
}
},
}
</script>
<style lang="scss" scoped>
.feedback_area {
background-color: #fff;
padding: 30rpx;
margin-bottom: 20rpx;
textarea {
width: 100%;
height: 300rpx;
background: #f8f8f8;
box-sizing: border-box;
padding:24rpx;
border-radius: 20rpx;
}
}
.upload {
background-color: #fff;
padding: 30rpx;
.upload_title {
font-size: 28rpx;
margin-bottom: 30rpx;
}
.tup {
display: flex;
flex-wrap: wrap;
.tu {
width: 200rpx;
height: 200rpx;
border-radius: 5rpx;
background: #ededed;
text-align: center;
margin: 10rpx;
image {
width: 30%;
height: 30%;
margin: 0 auto;
margin-top: 50rpx;
z-index: 9;
}
}
.pian {
border-radius: 5rpx;
width: 200rpx;
height: 200rpx;
float: left;
margin: 10rpx;
// background: red;
image {
width: 100%;
height: 100%;
}
}
}
}
.fllow_form {
display: flex;
justify-content: space-between;
height: 100rpx;
line-height: 100rpx;
background-color: #fff;
border-bottom: 1rpx solid #EAEAEA;
padding: 0 24rpx;
margin: 20rpx 0;
font-size: 28rpx;
.form_right {
display: flex;
color: #999;
font-size: 24rpx;
}
.form_input {
input {
height: 100rpx;
line-height: 100rpx;
text-align: right;
margin-right: 10rpx;
}
}
}
.feedback_back {
padding: 0 30rpx;
line-height: 30rpx;
}
#btn {
font-size: 26rpx;
color: #fff;
text-align: center;
line-height: 88rpx;
width: 500rpx;
height: 88rpx;
background: $uni-text-color;
border-radius: 29rpx;
margin: 30rpx auto;
}
</style>