178 lines
3.2 KiB
Vue
178 lines
3.2 KiB
Vue
|
<template>
|
||
|
<view class="container">
|
||
|
<view class="textarea">
|
||
|
<textarea placeholder="请留下您的建议或者感受" v-model="book" />
|
||
|
</view>
|
||
|
<view class="img u-flex u-col-center">
|
||
|
<view class="i" v-for="(item,index) in list" :key="index">
|
||
|
<view class="del" @click="list.splice(index,1)">
|
||
|
<uni-icons type="clear" size="30" color="#c33"></uni-icons>
|
||
|
</view>
|
||
|
<image :src="item" mode="aspectFill"></image>
|
||
|
</view>
|
||
|
<view class="i" @click="upload">
|
||
|
<image src="@/static/images/mine/up.png" mode="aspectFill"></image>
|
||
|
</view>
|
||
|
</view>
|
||
|
<view class="f-btn" @click="submit">
|
||
|
确认
|
||
|
</view>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import {userFeedback} from '@/api/mine/index.js'
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
|
||
|
http:this.$imgUrl,
|
||
|
book: "",
|
||
|
list: [],
|
||
|
userId:""
|
||
|
|
||
|
}
|
||
|
},
|
||
|
onLoad() {
|
||
|
let user = uni.getStorageSync('user')
|
||
|
this.userId = user.userId
|
||
|
if (!user.userId) {
|
||
|
uni.reLaunch({
|
||
|
url: '/pages/index/index'
|
||
|
})
|
||
|
return
|
||
|
}
|
||
|
|
||
|
},
|
||
|
methods: {
|
||
|
submit(){
|
||
|
if(!this.book){
|
||
|
uni.showToast({
|
||
|
title: '反馈内容不能为空',
|
||
|
icon: "none",
|
||
|
duration: 1500
|
||
|
});
|
||
|
return
|
||
|
}
|
||
|
uni.showModal({
|
||
|
title: '温馨提示',
|
||
|
content: '确定要提交吗?',
|
||
|
success: (res) =>{
|
||
|
if (res.confirm) {
|
||
|
console.log('用户点击确定');
|
||
|
userFeedback({
|
||
|
userId:this.userId,
|
||
|
content:this.book,
|
||
|
image:this.list.toString(),
|
||
|
}).then(res => {
|
||
|
if(res.code == 200){
|
||
|
uni.showToast({
|
||
|
title: '提交成功',
|
||
|
icon: "none",
|
||
|
duration: 1500
|
||
|
});
|
||
|
setTimeout(() => {
|
||
|
uni.navigateBack({
|
||
|
delta:1
|
||
|
})
|
||
|
}, 1500)
|
||
|
}else{
|
||
|
uni.showToast({
|
||
|
title:res.msg,
|
||
|
icon: "none",
|
||
|
duration: 1500
|
||
|
});
|
||
|
}
|
||
|
|
||
|
})
|
||
|
} else if (res.cancel) {
|
||
|
console.log('用户点击取消');
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
},
|
||
|
upload(){
|
||
|
this.$http.uploadone().then(res => {
|
||
|
this.list.push(res)
|
||
|
})
|
||
|
},
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss" scoped>
|
||
|
$color: #4892FD;
|
||
|
.container {
|
||
|
min-height: 100vh;
|
||
|
padding: 30rpx;
|
||
|
box-sizing: border-box;
|
||
|
background-color: #fff;
|
||
|
align-items:initial;
|
||
|
.img {
|
||
|
margin-top: 35rpx;
|
||
|
display: flex;
|
||
|
flex-wrap: wrap;
|
||
|
|
||
|
.i {
|
||
|
margin: 0 60rpx 30rpx 0;
|
||
|
width: 180rpx;
|
||
|
height: 180rpx;
|
||
|
position: relative;
|
||
|
|
||
|
&:nth-child(3n) {
|
||
|
margin-right: 0;
|
||
|
}
|
||
|
|
||
|
.del {
|
||
|
width: 50rpx;
|
||
|
height: 50rpx;
|
||
|
position: absolute;
|
||
|
top: -10rpx;
|
||
|
right: -10rpx;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
justify-content: center;
|
||
|
text-align: center;
|
||
|
z-index: 999;
|
||
|
}
|
||
|
|
||
|
image {
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.textarea {
|
||
|
width:100%;
|
||
|
padding: 30rpx;
|
||
|
background-color: #F5F5F5;
|
||
|
border-radius: 6rpx;
|
||
|
height: 300rpx;
|
||
|
box-sizing: border-box;
|
||
|
|
||
|
textarea {
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
|
font-size: 28rpx;
|
||
|
color: #333;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.f-btn {
|
||
|
margin-top: 150rpx;
|
||
|
width: 100%;
|
||
|
height: 90rpx;
|
||
|
line-height: 90rpx;
|
||
|
text-align: center;
|
||
|
background-color: $color;
|
||
|
color: #fff;
|
||
|
font-size: 28rpx;
|
||
|
border-radius: 20rpx;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
</style>
|