387 lines
7.0 KiB
Vue
387 lines
7.0 KiB
Vue
<template>
|
|
<view class="ProblemFeedback">
|
|
<!-- 科室选择 -->
|
|
<view class="report">
|
|
<view class="feedback_name">请选择科室</view>
|
|
<view class="feedback_name copy" style="padding: 0;">
|
|
<view class="uni-textarea" style="width:100%">
|
|
<uni-section style="width:100%;padding: 0;" title="">
|
|
<uni-data-picker placeholder="请选择科室" :localdata="group_list" @change="onchange">
|
|
</uni-data-picker>
|
|
</uni-section>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- 是否匿名 -->
|
|
<view class="report">
|
|
<view class="feedback_name">姓名</view>
|
|
<view class="uni-textarea">
|
|
<uni-section style="width:100%;padding: 0;" title="">
|
|
<uni-easyinput class="input" trim="all" v-model="feedback.nickname" placeholder="请输入姓名"
|
|
style="width: 100%;"></uni-easyinput>
|
|
</uni-section>
|
|
</view>
|
|
</view>
|
|
<view class="report">
|
|
<view class="feedback_name">联系方式</view>
|
|
<view class="uni-textarea">
|
|
<uni-section style="width:100%;padding: 0;" title="">
|
|
<uni-easyinput class="input" trim="all" v-model="feedback.phone" placeholder="请输入联系方式"
|
|
style="width: 100%;"></uni-easyinput>
|
|
</uni-section>
|
|
</view>
|
|
</view>
|
|
<!-- 举报类型 -->
|
|
<view class="report">
|
|
<view class="feedback_name copy">
|
|
<text>详情描述</text>
|
|
<text>{{ feedback.content.length }}/200</text>
|
|
</view>
|
|
<view class="uni-textarea">
|
|
<textarea maxlength="200" style="color: #666;" v-model="feedback.content" class="activeTextCopy"
|
|
placeholder="提供更多信息有助于投诉建议被快速处理~" />
|
|
</view>
|
|
</view>
|
|
<!-- 图片上传 -->
|
|
<view class="btn_bottom">
|
|
<button @click="submitDo" class="cu-btn bnt1">提交反馈</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getUserGroupList,
|
|
Politicsh5Add
|
|
} from '@/util/api.js';
|
|
import store from '@/store/index.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
feedback: {
|
|
group_id: "",
|
|
content: "",
|
|
nickname: '',
|
|
phone: '',
|
|
user_id: 0,
|
|
politics_type: 1,
|
|
},
|
|
group_list: [],
|
|
}
|
|
},
|
|
onLoad() {
|
|
// var user = uni.getStorageSync('userInfo');
|
|
// if (!user) {
|
|
// uni.reLaunch({
|
|
// url: "/pages/index/index"
|
|
// })
|
|
// }
|
|
this.getGroupList()
|
|
},
|
|
methods: {
|
|
getGroupList() {
|
|
getUserGroupList()
|
|
.then(res => {
|
|
console.log(res);
|
|
var list = this.transformGroupData(res.data);
|
|
this.group_list = list
|
|
})
|
|
.catch(error => {
|
|
uni.showToast({
|
|
title: error,
|
|
icon: 'none',
|
|
duration: 2000
|
|
});
|
|
})
|
|
},
|
|
transformGroupData(data) {
|
|
if (!data || !Array.isArray(data)) return [];
|
|
|
|
return data.map(item => {
|
|
const newItem = {
|
|
value: item.id,
|
|
text: item.name
|
|
};
|
|
// 递归处理children
|
|
if (item.children && Array.isArray(item.children)) {
|
|
newItem.children = this.transformGroupData(item.children);
|
|
}
|
|
return newItem;
|
|
});
|
|
},
|
|
// 选择科室
|
|
onchange(e) {
|
|
console.log(e.detail.value[1].value);
|
|
this.feedback.group_id = e.detail.value[1].value;
|
|
},
|
|
submitDo() {
|
|
console.log(this.feedback);
|
|
if (this.feedback.group_id == '') {
|
|
uni.showToast({
|
|
title: '科室不能为空!',
|
|
icon: 'none',
|
|
duration: 2000
|
|
});
|
|
return;
|
|
}
|
|
if (this.feedback.content == '') {
|
|
uni.showToast({
|
|
title: '详情描述不能为空!',
|
|
icon: 'none',
|
|
duration: 2000
|
|
});
|
|
return;
|
|
}
|
|
if (this.feedback.nickname == '') {
|
|
uni.showToast({
|
|
title: '姓名不能为空!',
|
|
icon: 'none',
|
|
duration: 2000
|
|
});
|
|
return;
|
|
}
|
|
if (this.feedback.phone == '') {
|
|
uni.showToast({
|
|
title: '手机号不能为空!',
|
|
icon: 'none',
|
|
duration: 2000
|
|
});
|
|
return;
|
|
}
|
|
this.feedback.user_id = 0;
|
|
console.log(this.feedback);
|
|
Politicsh5Add(this.feedback)
|
|
.then(res => {
|
|
if (res.code == 1) {
|
|
uni.showToast({
|
|
title: '提交成功!',
|
|
icon: 'none',
|
|
duration: 2000
|
|
});
|
|
this.feedback = {
|
|
group_id: "",
|
|
content: "",
|
|
nickname: '',
|
|
phone: '',
|
|
user_id: 0,
|
|
politics_type: 1,
|
|
}
|
|
} else {
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon: 'none',
|
|
duration: 2000
|
|
});
|
|
}
|
|
console.log(res);
|
|
})
|
|
.catch(error => {
|
|
uni.showToast({
|
|
title: error,
|
|
icon: 'none',
|
|
duration: 2000
|
|
});
|
|
})
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
.uni-textarea-placeholder {
|
|
color: #ccc;
|
|
}
|
|
|
|
/deep/.uni-section-header {
|
|
padding: 0 !important;
|
|
}
|
|
|
|
.report {
|
|
padding: 0 32rpx;
|
|
}
|
|
|
|
/* ... 其他现有样式 ... */
|
|
|
|
/* 添加TabBar样式 */
|
|
.custom-tabbar {
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 100rpx;
|
|
background-color: #ffffff;
|
|
display: flex;
|
|
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
|
|
z-index: 999;
|
|
}
|
|
|
|
.tabbar-item {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
padding: 10rpx 0;
|
|
}
|
|
|
|
.tabbar-icon {
|
|
height: 50rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.tabbar-text {
|
|
font-size: 24rpx;
|
|
margin-top: 6rpx;
|
|
}
|
|
|
|
.tabbar-item.active .tabbar-text {
|
|
color: #4d5eff;
|
|
}
|
|
|
|
/* 为底部TabBar预留空间 */
|
|
.btn_bottom {
|
|
margin-bottom: 120rpx;
|
|
}
|
|
|
|
.evidence {
|
|
margin-bottom: 20rpx;
|
|
}
|
|
|
|
.ProblemFeedback {
|
|
background: #fafbfb;
|
|
height: 94vh;
|
|
|
|
.picture_list {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
|
|
view {
|
|
width: 158rpx;
|
|
margin-right: 14rpx;
|
|
height: 158rpx;
|
|
position: relative;
|
|
|
|
image,
|
|
.view {
|
|
width: 158rpx;
|
|
height: 158rpx;
|
|
border-radius: 12rpx;
|
|
}
|
|
|
|
.delete_img {
|
|
background-color: red;
|
|
color: #fff;
|
|
position: absolute;
|
|
right: 10rpx;
|
|
z-index: 10;
|
|
top: 10rpx;
|
|
text-align: center;
|
|
line-height: 36rpx;
|
|
width: 32rpx;
|
|
height: 32rpx;
|
|
border-radius: 4rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.btn_bottom {
|
|
height: 160rpx;
|
|
padding: 12rpx 32rpx;
|
|
background-color: #fafbfb;
|
|
margin-top: 100rpx;
|
|
|
|
.bnt1 {
|
|
width: 100%;
|
|
color: #fff;
|
|
background: #4d5eff;
|
|
height: 88rpx;
|
|
line-height: 88rpx;
|
|
|
|
}
|
|
}
|
|
|
|
.Upload_module {
|
|
margin: 0 34rpx;
|
|
margin-top: 40rpx;
|
|
|
|
.uploadImg {
|
|
width: 160rpx;
|
|
height: 160rpx;
|
|
border: 2rpx solid #dfdfdf;
|
|
border-radius: 12rpx;
|
|
background: #fff;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
|
|
.image {
|
|
image {
|
|
width: 70rpx;
|
|
height: 70rpx;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
.Tips {
|
|
font-size: 24rpx;
|
|
margin-top: 20rpx;
|
|
color: #999999;
|
|
}
|
|
|
|
.layout {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
}
|
|
|
|
.feedback_name {
|
|
font-size: 30rpx;
|
|
color: #333;
|
|
padding: 36rpx 0 0 0;
|
|
}
|
|
|
|
.copy {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
margin-top: 20rpx;
|
|
|
|
&>text:nth-child(2) {
|
|
color: #b0b0b0;
|
|
font-size: 26rpx;
|
|
}
|
|
}
|
|
|
|
.uni-textarea {
|
|
display: flex;
|
|
margin-top: 20rpx;
|
|
justify-content: center;
|
|
|
|
.uni-textarea-compute {
|
|
height: 100%;
|
|
}
|
|
|
|
.activeText {
|
|
border: 3rpx solid #4d5eff;
|
|
}
|
|
|
|
.activeTextCopy {
|
|
border: 3rpx solid #eee;
|
|
}
|
|
|
|
textarea {
|
|
padding: 24rpx;
|
|
font-size: 28rpx;
|
|
width: 710rpx !important;
|
|
height: 200rpx !important;
|
|
background: #fff;
|
|
border-radius: 10rpx;
|
|
}
|
|
}
|
|
|
|
}
|
|
</style> |