You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
334 lines
7.5 KiB
334 lines
7.5 KiB
<template>
|
|
<view class="add">
|
|
<view class="add-content">
|
|
<!-- <view class="content">
|
|
<view class="title">举报原因</view>
|
|
<view class="info">
|
|
<view class="li" :class="tabIndex == 1?'li-on':''" @click="tabItem(1)">
|
|
垃圾广告/骗子
|
|
<image class="img1" src="@/static/icon-check.png"></image><image class="img2" src="@/static/icon-check-on.png"></image>
|
|
</view>
|
|
<view class="li" :class="tabIndex == 2?'li-on':''" @click="tabItem(2)">
|
|
虚假信息/盗用照片
|
|
<image class="img1" src="@/static/icon-check.png"></image><image class="img2" src="@/static/icon-check-on.png"></image>
|
|
</view>
|
|
<view class="li" :class="tabIndex == 3?'li-on':''" @click="tabItem(3)">
|
|
色情低俗
|
|
<image class="img1" src="@/static/icon-check.png"></image><image class="img2" src="@/static/icon-check-on.png"></image>
|
|
</view>
|
|
<view class="li" :class="tabIndex == 4?'li-on':''" @click="tabItem(4)">
|
|
骚扰谩骂
|
|
<image class="img1" src="@/static/icon-check.png"></image><image class="img2" src="@/static/icon-check-on.png"></image>
|
|
</view>
|
|
<view class="li" :class="tabIndex == 5?'li-on':''" @click="tabItem(5)">
|
|
骗子
|
|
<image class="img1" src="@/static/icon-check.png"></image><image class="img2" src="@/static/icon-check-on.png"></image>
|
|
</view>
|
|
</view>
|
|
</view> -->
|
|
<view class="content">
|
|
<view class="title">举报原因</view>
|
|
<view class="box">
|
|
<textarea v-model="content" maxlength="200" placeholder="如有必要,请详细描述(200字以内)~"></textarea>
|
|
</view>
|
|
</view>
|
|
<view class="content">
|
|
<view class="title">上传图片</view>
|
|
<view class="list">
|
|
<view class="item" v-for="(a,i) in imgurl" :key="i">
|
|
<image class="pic" :src="a"></image>
|
|
<image class="del" @click="toDel(i)" src="@/static/fabu-cha.png"></image>
|
|
</view>
|
|
<view class="upload" @click="uploadImg()">
|
|
<image class="pic" src="@/static/fankui-tianjia.png"></image>
|
|
<view class="txt">上传图片</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="add-fd">
|
|
<view class="btn" @click="toReg()">提交</view>
|
|
</view>
|
|
<u-popup v-model="show" mode="center" border-radius="20" :mask-close-able="true">
|
|
<view class="feed">
|
|
<image src="@/static/feed-01.png"></image>
|
|
<view class="title">提交成功</view>
|
|
<view class="btn" @click="show = false">我知道了</view>
|
|
</view>
|
|
</u-popup>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
show: false,
|
|
imgurl: [],
|
|
content: "",
|
|
reportUserId: "",
|
|
type: "",
|
|
tabIndex: 1,
|
|
id: "",
|
|
uid: ""
|
|
};
|
|
},
|
|
onLoad(o) {
|
|
this.type = o.type;
|
|
this.id = o.id;
|
|
this.uid = o.uid;
|
|
},
|
|
methods: {
|
|
//上传图片
|
|
uploadImg() {
|
|
const that = this
|
|
uni.chooseImage({
|
|
count: 9-that.imgurl.length,
|
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
sourceType: ["album", "camera"],
|
|
success: (res1) => {
|
|
console.log(res1)
|
|
for(var i = 0; i<res1.tempFilePaths.length;i++){
|
|
uni.uploadFile({
|
|
name: 'file',
|
|
url: that.$baseUrl+'/prod-api/common/upload',
|
|
filePath: res1.tempFilePaths[i],
|
|
success: (res) => {
|
|
const {code, fileName, url, msg} = JSON.parse(res.data);
|
|
if(code == 200){
|
|
uni.showToast({
|
|
title: "上传成功"
|
|
})
|
|
that.imgurl.push(url)
|
|
}else{
|
|
uni.showToast({
|
|
icon: "error",
|
|
title: "上传失败"
|
|
})
|
|
}
|
|
},
|
|
fail: (err) => {
|
|
console.log(err)
|
|
}
|
|
});
|
|
}
|
|
},
|
|
fail(err){
|
|
console.log("fail",err)
|
|
}
|
|
});
|
|
},
|
|
async toReg() {
|
|
const that = this;
|
|
if(!that.content){
|
|
uni.showToast({
|
|
icon: "none",
|
|
position: "bottom",
|
|
title: "举报说明不能为空!"
|
|
})
|
|
return ;
|
|
}
|
|
if(that.imgurl.length == 0){
|
|
uni.showToast({
|
|
icon: "none",
|
|
position: "bottom",
|
|
title: "请上传图片"
|
|
})
|
|
return ;
|
|
}
|
|
const { code, data, msg } = await that.$api.report({
|
|
userId: uni.getStorageSync("userInfo").id,
|
|
content: that.content,
|
|
imgurl: that.imgurl.join(","),
|
|
reportUserId: that.type == 1?that.uid:"",
|
|
type: that.type,
|
|
eventid: that.id,
|
|
reason: ""
|
|
})
|
|
if(code == 200){
|
|
that.imgurl = [];
|
|
that.content = "";
|
|
that.show = true;
|
|
}else{
|
|
uni.showToast({
|
|
icon: "none",
|
|
position: "bottom",
|
|
title: msg
|
|
})
|
|
}
|
|
},
|
|
tabItem(index) {
|
|
this.tabIndex = index;
|
|
},
|
|
toDel(i) {
|
|
this.imgurl.splice(i,1)
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.add{
|
|
overflow: hidden;
|
|
padding-bottom: 110rpx;
|
|
.feed{
|
|
width: 670rpx;
|
|
height: 688rpx;
|
|
background: #FFFFFF;
|
|
border-radius: 20rpx;
|
|
text-align: center;
|
|
padding-top: 70rpx;
|
|
box-sizing: border-box;
|
|
image{
|
|
width: 408rpx;
|
|
height: 315rpx;
|
|
}
|
|
.title{
|
|
font-weight: 500;
|
|
font-size: 36rpx;
|
|
color: #222222;
|
|
margin-top: 50rpx;
|
|
}
|
|
.btn{
|
|
width: 400rpx;
|
|
line-height: 90rpx;
|
|
background: linear-gradient(0deg, #000000, #3D3B38);
|
|
box-shadow: 0px 4rpx 18rpx 0px rgba(42,41,39,0.34);
|
|
border-radius: 90rpx;
|
|
font-weight: 500;
|
|
font-size: 30rpx;
|
|
color: #FFFFFF;
|
|
margin: 0 auto;
|
|
margin-top: 50rpx;
|
|
}
|
|
}
|
|
&-content{
|
|
padding: 0 25rpx;
|
|
overflow: hidden;
|
|
.content{
|
|
background: #FFFFFF;
|
|
border-radius: 20rpx;
|
|
padding: 30rpx;
|
|
box-sizing: border-box;
|
|
margin-top: 20rpx;
|
|
overflow: hidden;
|
|
.box{
|
|
width: 100%;
|
|
height: 220rpx;
|
|
background: #F6F6F6;
|
|
border-radius: 10rpx;
|
|
padding: 30rpx;
|
|
box-sizing: border-box;
|
|
margin-top: 30rpx;
|
|
textarea{
|
|
width: 100%;
|
|
height: 100%;
|
|
font-weight: 400;
|
|
font-size: 30rpx;
|
|
color: #212121;
|
|
}
|
|
}
|
|
|
|
.li{
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 20rpx 0;
|
|
font-weight: 500;
|
|
font-size: 30rpx;
|
|
color: #333333;
|
|
image{
|
|
width: 35rpx;
|
|
height: 35rpx;
|
|
}
|
|
.img1{
|
|
display: block;
|
|
}
|
|
.img2{
|
|
display: none;
|
|
}
|
|
&-on{
|
|
.img1{
|
|
display: none;
|
|
}
|
|
.img2{
|
|
display: block;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.title{
|
|
font-size: 34rpx;
|
|
color: #333333;
|
|
}
|
|
.list{
|
|
width: 110%;
|
|
.upload{
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
background: #FFFFFF;
|
|
border-radius: 10rpx;
|
|
border: 1px solid #DDDDDD;
|
|
float: left;
|
|
font-weight: 400;
|
|
text-align: center;
|
|
font-size: 24rpx;
|
|
color: #999999;
|
|
margin-top: 30rpx;
|
|
image{
|
|
width: 50rpx;
|
|
height: 50rpx;
|
|
display: block;
|
|
margin: 0 auto;
|
|
margin-top: 25rpx;
|
|
margin-bottom: 10rpx;
|
|
}
|
|
}
|
|
.item{
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
border-radius: 10rpx;
|
|
float: left;
|
|
margin-top: 30rpx;
|
|
overflow: hidden;
|
|
position: relative;
|
|
margin-right: 12rpx;
|
|
.pic{
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
.del{
|
|
width: 35rpx;
|
|
height: 35rpx;
|
|
position: absolute;
|
|
right: 0;
|
|
top: 0;
|
|
z-index: 2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
&-fd{
|
|
background-color: #F3F4F5;
|
|
width: 100%;
|
|
padding: 30rpx 25rpx;
|
|
box-sizing: border-box;
|
|
position: fixed;
|
|
left: 0;
|
|
bottom: 0;
|
|
z-index: 22;
|
|
.btn{
|
|
width: 100%;
|
|
line-height: 98rpx;
|
|
background: linear-gradient(0deg, #000000, #3D3B38);
|
|
box-shadow: 0px 4rpx 18rpx 0px rgba(42,41,39,0.34);
|
|
border-radius: 98rpx;
|
|
text-align: center;
|
|
font-weight: 400;
|
|
font-size: 30rpx;
|
|
color: #FFFFFF;
|
|
letter-spacing: 5rpx;
|
|
}
|
|
}
|
|
}
|
|
</style> |