2025-08-11 11:06:07 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="view-page">
|
2025-10-23 16:04:28 +08:00
|
|
|
|
<navBar :style="{marginTop: `${statusBarHeight}${uni.getSystemInfoSync().platform === 'ios' ? 'px': 'dp'}`}"
|
|
|
|
|
|
:navTitle="'举报'" bgColor="#fff" :emitBack="true" @backEvent="back">
|
2025-08-11 11:06:07 +08:00
|
|
|
|
</navBar>
|
|
|
|
|
|
<view class="content">
|
|
|
|
|
|
<uni-forms ref="baseForm" :modelValue="formData" label-position="top">
|
|
|
|
|
|
<uni-forms-item label="举报类型" required>
|
|
|
|
|
|
<view class="view-picker">
|
|
|
|
|
|
<view class="uni-list-cell">
|
|
|
|
|
|
<view class="uni-list-cell-db">
|
|
|
|
|
|
<picker @change="bindPickerChange" :value="typeIndex" :range="array">
|
|
|
|
|
|
<view class="uni-input">{{array[typeIndex]}}</view>
|
|
|
|
|
|
</picker>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</uni-forms-item>
|
|
|
|
|
|
<uni-forms-item label="举报原因" required>
|
|
|
|
|
|
<view class="">
|
|
|
|
|
|
<uni-easyinput type="textarea" autoHeight v-model="formData.content"
|
|
|
|
|
|
placeholder="请输入举报原因"></uni-easyinput>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</uni-forms-item>
|
|
|
|
|
|
</uni-forms>
|
|
|
|
|
|
<view class="view-picker">
|
|
|
|
|
|
<uploadImage ref="uploadImage" @changeImageList="successUpload"></uploadImage>
|
|
|
|
|
|
<!-- <uni-file-picker limit="9" title="最多选择9张图片"></uni-file-picker> -->
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="flex-line w-fill mt-24 color-3" style="justify-content: center;">
|
|
|
|
|
|
<view class="comfirmButton flex-line" @click="comfirm">
|
|
|
|
|
|
确认举报
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2025-10-23 16:04:28 +08:00
|
|
|
|
<uni-popup ref="message" type="message">
|
|
|
|
|
|
<uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
|
|
|
|
|
|
</uni-popup>
|
2025-08-11 11:06:07 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import headerHeight from '@/component/headerHeight.vue';
|
|
|
|
|
|
import navBar from '@/component/nav.vue';
|
|
|
|
|
|
import http from '@/until/http.js';
|
|
|
|
|
|
import logout from '@/static/image/union/logout.png'
|
|
|
|
|
|
import logo from '@/static/image/logo.png';
|
|
|
|
|
|
import uploadImage from '@/component/uploadImage.vue'
|
|
|
|
|
|
export default {
|
|
|
|
|
|
components: {
|
|
|
|
|
|
headerHeight,
|
|
|
|
|
|
uploadImage,
|
|
|
|
|
|
navBar
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
formData: {
|
|
|
|
|
|
content: ""
|
|
|
|
|
|
},
|
2025-10-23 16:04:28 +08:00
|
|
|
|
optionsProps: {
|
|
|
|
|
|
|
2025-08-11 11:06:07 +08:00
|
|
|
|
},
|
|
|
|
|
|
array: [],
|
2025-10-23 16:04:28 +08:00
|
|
|
|
typeList: [],
|
|
|
|
|
|
statusBarHeight: 0,
|
2025-08-11 11:06:07 +08:00
|
|
|
|
typeIndex: 0,
|
|
|
|
|
|
messageText: "",
|
|
|
|
|
|
msgType: "success"
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-10-23 16:04:28 +08:00
|
|
|
|
watch: {
|
|
|
|
|
|
typeIndex(val) {
|
2025-08-11 11:06:07 +08:00
|
|
|
|
console.log(val)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
|
// fromType 1-用户,2房间,3动态 fromId对应的id
|
|
|
|
|
|
const {
|
|
|
|
|
|
id,
|
|
|
|
|
|
fromType,
|
2025-10-23 16:04:28 +08:00
|
|
|
|
fromId,
|
|
|
|
|
|
h
|
2025-08-11 11:06:07 +08:00
|
|
|
|
} = options
|
|
|
|
|
|
this.optionsProps = {
|
|
|
|
|
|
id,
|
|
|
|
|
|
fromType,
|
|
|
|
|
|
fromId
|
|
|
|
|
|
}
|
|
|
|
|
|
uni.setStorageSync('token', id)
|
|
|
|
|
|
this.statusBarHeight = h
|
|
|
|
|
|
uni.setStorageSync('BarHeight', h)
|
|
|
|
|
|
if (uni.getStorageSync('token')) {
|
|
|
|
|
|
this.getTypeList()
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
back() {
|
|
|
|
|
|
this.closeWeb()
|
|
|
|
|
|
},
|
|
|
|
|
|
closeWeb() {
|
|
|
|
|
|
// 关闭页面
|
|
|
|
|
|
const platform = uni.getSystemInfoSync().platform;
|
|
|
|
|
|
if (platform === 'ios') {
|
|
|
|
|
|
window.webkit.messageHandlers.nativeHandler.postMessage({
|
|
|
|
|
|
'action': 'closeWeb'
|
|
|
|
|
|
});
|
|
|
|
|
|
} else if (platform === 'android') {
|
|
|
|
|
|
window.Android.closeWeb();
|
2025-10-23 16:04:28 +08:00
|
|
|
|
|
2025-08-11 11:06:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-10-23 16:04:28 +08:00
|
|
|
|
async getTypeList() {
|
2025-08-11 11:06:07 +08:00
|
|
|
|
http.get('/api/Report/report_type_list', {
|
2025-10-23 16:04:28 +08:00
|
|
|
|
token: uni.getStorageSync('token') || ''
|
2025-08-11 11:06:07 +08:00
|
|
|
|
}).then(response => {
|
2025-10-23 16:04:28 +08:00
|
|
|
|
const {
|
|
|
|
|
|
code,
|
|
|
|
|
|
data
|
|
|
|
|
|
} = response
|
2025-08-11 11:06:07 +08:00
|
|
|
|
this.typeList = data
|
2025-10-23 16:04:28 +08:00
|
|
|
|
this.array = data.map(ele => {
|
|
|
|
|
|
return ele.type
|
|
|
|
|
|
})
|
2025-08-11 11:06:07 +08:00
|
|
|
|
this.typeIndex = 0
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2025-10-23 16:04:28 +08:00
|
|
|
|
bindPickerChange({
|
|
|
|
|
|
detail
|
|
|
|
|
|
}) {
|
2025-08-11 11:06:07 +08:00
|
|
|
|
// console.log()
|
|
|
|
|
|
this.typeIndex = detail.value
|
|
|
|
|
|
},
|
2025-10-23 16:04:28 +08:00
|
|
|
|
comfirm() {
|
2025-08-11 11:06:07 +08:00
|
|
|
|
const formData = {
|
2025-10-23 16:04:28 +08:00
|
|
|
|
type_id: this.typeList[this.typeIndex].id,
|
2025-08-11 11:06:07 +08:00
|
|
|
|
report_type: this.optionsProps.fromType || 1,
|
2025-10-23 16:04:28 +08:00
|
|
|
|
content: this.formData.content || '',
|
|
|
|
|
|
image: this.formData.image,
|
|
|
|
|
|
from_id: this.optionsProps.fromId || ""
|
2025-08-11 11:06:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
http.post('/api/Report/report', {
|
|
|
|
|
|
...formData,
|
2025-10-23 16:04:28 +08:00
|
|
|
|
token: uni.getStorageSync('token') || ''
|
2025-08-11 11:06:07 +08:00
|
|
|
|
}).then(response => {
|
|
|
|
|
|
const {
|
|
|
|
|
|
data,
|
|
|
|
|
|
code,
|
|
|
|
|
|
msg
|
|
|
|
|
|
} = response
|
|
|
|
|
|
if (code) {
|
|
|
|
|
|
this.messageText = `提交成功`
|
|
|
|
|
|
this.$refs.message.open()
|
|
|
|
|
|
this.msgType = 'success'
|
|
|
|
|
|
this.formData = {
|
|
|
|
|
|
content: "",
|
2025-10-23 16:04:28 +08:00
|
|
|
|
image: "",
|
2025-08-11 11:06:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
this.$refs.uploadImage.clearImage()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.messageText = msg
|
|
|
|
|
|
this.msgType = 'error'
|
|
|
|
|
|
this.$refs.message.open()
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2025-10-23 16:04:28 +08:00
|
|
|
|
successUpload(list) {
|
|
|
|
|
|
const imageList = list.map(ele => {
|
|
|
|
|
|
return ele.tempFilePath
|
|
|
|
|
|
})
|
|
|
|
|
|
if (imageList && imageList.length) {
|
2025-08-11 11:06:07 +08:00
|
|
|
|
this.formData.image = imageList.join(',')
|
|
|
|
|
|
} else {
|
|
|
|
|
|
this.formData.image = ""
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
::v-deep .is-input-border {
|
|
|
|
|
|
border: 0;
|
|
|
|
|
|
border-radius: 22rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.view-page {
|
|
|
|
|
|
font-family: Source Han Sans CN, Source Han Sans CN;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
background-color: #f8f8f8;
|
|
|
|
|
|
// background-image: url('@/static/image/help/bg.png');
|
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
|
background-size: 100% 100%;
|
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
|
|
|
|
|
|
|
.content {
|
|
|
|
|
|
padding: 0 24rpx;
|
|
|
|
|
|
margin-top: 24rpx;
|
|
|
|
|
|
|
|
|
|
|
|
.view-picker {
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
padding: 21rpx;
|
|
|
|
|
|
border-radius: 14rpx;
|
|
|
|
|
|
}
|
2025-10-23 16:04:28 +08:00
|
|
|
|
|
|
|
|
|
|
.comfirmButton {
|
2025-08-11 11:06:07 +08:00
|
|
|
|
width: 600rpx;
|
|
|
|
|
|
height: 84rpx;
|
2025-10-23 16:04:28 +08:00
|
|
|
|
background: var(--primary-color);
|
|
|
|
|
|
font-size: var(--font-button-size);
|
|
|
|
|
|
color: var(--font-button-color);
|
2025-08-11 11:06:07 +08:00
|
|
|
|
border-radius: 106rpx;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|