550 lines
16 KiB
HTML
550 lines
16 KiB
HTML
<!--#layout("/mobile/platform.html"){#-->
|
|
|
|
<style>
|
|
:root {
|
|
--primary-color: rgb(0, 78, 100);
|
|
--primary-light: rgba(0, 78, 100, 0.1);
|
|
--secondary-color: #37A6BD;
|
|
--text-color: #333333;
|
|
--text-secondary: #666666;
|
|
--text-light: #999999;
|
|
--bg-color: #f5f7fa;
|
|
--card-bg: #ffffff;
|
|
--border-color: #eeeeee;
|
|
--success-color: #07c160;
|
|
--warning-color: #ff976a;
|
|
}
|
|
|
|
#app {
|
|
min-height: 100vh;
|
|
background-color: var(--bg-color);
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
/* 页面样式 */
|
|
.suggestion-list {
|
|
padding: 16px;
|
|
background-color: var(--bg-color);
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.van-pull-refresh, .van-list {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.suggestion-card {
|
|
background-color: var(--card-bg);
|
|
border-radius: 12px;
|
|
margin-bottom: 16px;
|
|
padding: 16px;
|
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
|
|
transition: all 0.2s ease;
|
|
border: 1px solid rgba(0, 0, 0, 0.02);
|
|
}
|
|
|
|
.suggestion-card:active {
|
|
transform: scale(0.98);
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
|
}
|
|
|
|
.suggestion-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.suggestion-title {
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
color: var(--text-color);
|
|
flex: 1;
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.suggestion-status {
|
|
font-size: 12px;
|
|
padding: 3px 8px;
|
|
border-radius: 12px;
|
|
margin-left: 10px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.status-pending {
|
|
background-color: #e6f7ff;
|
|
color: #1890ff;
|
|
}
|
|
|
|
.status-processing {
|
|
background-color: #fff7e6;
|
|
color: #fa8c16;
|
|
}
|
|
|
|
.status-completed {
|
|
background-color: #f6ffed;
|
|
color: #52c41a;
|
|
}
|
|
|
|
.suggestion-content {
|
|
font-size: 14px;
|
|
color: var(--text-secondary);
|
|
line-height: 1.6;
|
|
margin-bottom: 16px;
|
|
overflow: hidden;
|
|
background-color: var(--bg-color);
|
|
padding: 10px;
|
|
border-radius: 8px;
|
|
word-break: break-all;
|
|
white-space: pre-line;
|
|
max-height: 3.2em;
|
|
text-overflow: ellipsis;
|
|
display: block;
|
|
}
|
|
|
|
.suggestion-footer {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
font-size: 13px;
|
|
color: var(--text-light);
|
|
border-top: 1px solid #f5f5f5;
|
|
padding-top: 12px;
|
|
}
|
|
|
|
.suggestion-time {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.suggestion-time .van-icon {
|
|
font-size: 14px;
|
|
margin-right: 4px;
|
|
}
|
|
|
|
.suggestion-action {
|
|
color: var(--primary-color);
|
|
display: flex;
|
|
align-items: center;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.suggestion-action .van-icon {
|
|
font-size: 14px;
|
|
margin-left: 2px;
|
|
}
|
|
|
|
.empty-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 64px 16px;
|
|
flex: 1;
|
|
}
|
|
|
|
.empty-icon {
|
|
font-size: 64px;
|
|
color: #ddd;
|
|
margin-bottom: 16px;
|
|
text-align: center;
|
|
}
|
|
|
|
.empty-text {
|
|
font-size: 15px;
|
|
color: var(--text-light);
|
|
text-align: center;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
/* 详情弹窗样式 */
|
|
.detail-popup {
|
|
padding: 24px;
|
|
max-height: 80vh;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.detail-header {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.detail-title {
|
|
font-size: 20px;
|
|
font-weight: 600;
|
|
margin-bottom: 10px;
|
|
color: var(--text-color);
|
|
}
|
|
|
|
.detail-meta {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
color: var(--text-light);
|
|
font-size: 14px;
|
|
}
|
|
|
|
.detail-section {
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.detail-label {
|
|
color: var(--text-secondary);
|
|
margin-bottom: 8px;
|
|
font-weight: 500;
|
|
font-size: 15px;
|
|
}
|
|
|
|
.detail-content {
|
|
color: var(--text-color);
|
|
line-height: 1.8;
|
|
font-size: 15px;
|
|
}
|
|
|
|
.detail-reply {
|
|
background-color: #f9f9f9;
|
|
padding: 16px;
|
|
border-radius: 8px;
|
|
border-left: 4px solid var(--primary-color);
|
|
}
|
|
|
|
.detail-attachments {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.attachment-item {
|
|
width: 90px;
|
|
height: 90px;
|
|
margin-right: 10px;
|
|
margin-bottom: 10px;
|
|
border-radius: 6px;
|
|
overflow: hidden;
|
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.attachment-image {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.loader {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
padding: 20px;
|
|
}
|
|
|
|
/*!* 自定义导航栏样式 *!*/
|
|
/*.van-nav-bar {*/
|
|
/* background-color: var(--primary-color);*/
|
|
/*}*/
|
|
|
|
/*.van-nav-bar .van-nav-bar__title {*/
|
|
/* color: white;*/
|
|
/* font-weight: 500;*/
|
|
/*}*/
|
|
|
|
/*.van-nav-bar .van-icon, .van-nav-bar .van-nav-bar__text {*/
|
|
/* color: white;*/
|
|
/*}*/
|
|
|
|
.van-button--primary {
|
|
background-color: var(--primary-color);
|
|
border-color: var(--primary-color);
|
|
}
|
|
|
|
/* 下拉刷新和上拉加载样式 */
|
|
.van-pull-refresh__track {
|
|
flex: 1;
|
|
}
|
|
|
|
.van-list {
|
|
min-height: 100%;
|
|
}
|
|
|
|
.no-reply {
|
|
padding: 20px 0;
|
|
text-align: center;
|
|
background-color: var(--bg-color);
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.no-reply-icon {
|
|
font-size: 36px;
|
|
color: #ccc;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.no-reply-text {
|
|
font-size: 14px;
|
|
color: var(--text-light);
|
|
}
|
|
|
|
.submitter-info {
|
|
background-color: var(--bg-color);
|
|
border-radius: 8px;
|
|
padding: 12px 15px;
|
|
}
|
|
|
|
.info-item {
|
|
display: flex;
|
|
align-items: center;
|
|
margin-bottom: 8px;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.info-item:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.info-label {
|
|
color: var(--text-secondary);
|
|
width: 80px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.info-value {
|
|
color: var(--text-color);
|
|
flex: 1;
|
|
font-size: 14px;
|
|
}
|
|
</style>
|
|
|
|
<div id="app" v-cloak>
|
|
<van-nav-bar title="我的意见建议" left-arrow @click-left="pjaxReplace('/platform/suggestionBox/h5')" fixed placeholder left-text="返回"></van-nav-bar>
|
|
|
|
<!-- 内容区域 -->
|
|
<div class="suggestion-list">
|
|
<!-- 下拉刷新和上拉加载更多 -->
|
|
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
|
|
<van-list
|
|
v-model="loading"
|
|
:finished="finished"
|
|
finished-text="没有更多了"
|
|
@load="loadMore"
|
|
>
|
|
<!-- 空状态 -->
|
|
<div class="empty-list" v-if="suggestions.length === 0 && !loading">
|
|
<van-icon name="comment-circle-o" class="empty-icon"/>
|
|
<div class="empty-text">您还没有提交过意见</div>
|
|
<van-button type="primary" size="normal" round @click="goToSubmitPage">去提交意见</van-button>
|
|
</div>
|
|
|
|
<!-- 意见列表 -->
|
|
<div class="suggestion-card" v-for="(item, index) in suggestions" :key="item.id"
|
|
@click="showDetail(item)">
|
|
<div class="suggestion-header">
|
|
<div class="suggestion-title">{{ item.title || '意见反馈' }}</div>
|
|
<div class="suggestion-status" :class="getStatusClass(item.isReply)">
|
|
{{ getStatusText(item.isReply) }}
|
|
</div>
|
|
</div>
|
|
<div class="suggestion-content">{{ item.content }}</div>
|
|
<div class="suggestion-footer">
|
|
<div class="suggestion-time">
|
|
<van-icon name="clock-o"/>
|
|
<span>{{ formatDate(item.submitTime) }}</span>
|
|
</div>
|
|
<div class="suggestion-action">
|
|
查看详情
|
|
<van-icon name="arrow"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</van-list>
|
|
</van-pull-refresh>
|
|
</div>
|
|
|
|
<!-- 详情弹出层 -->
|
|
<van-popup v-model="showDetailPopup" round closeable position="bottom" :style="{ height: '80%' }">
|
|
<div class="detail-popup" v-if="currentSuggestion">
|
|
<div class="detail-header">
|
|
<div class="detail-title">{{ currentSuggestion.title || '意见反馈' }}</div>
|
|
<div class="detail-meta">
|
|
<span>{{ formatDate(currentSuggestion.submitTime) }}</span>
|
|
<span :class="getStatusClass(currentSuggestion.isReply)">{{ getStatusText(currentSuggestion.isReply) }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="detail-section">
|
|
<div class="detail-label">提交人信息</div>
|
|
<div class="submitter-info">
|
|
<div class="info-item">
|
|
<span class="info-label">姓名:</span>
|
|
<span class="info-value">{{ currentSuggestion.submitterName || '未填写' }}</span>
|
|
</div>
|
|
<div class="info-item">
|
|
<span class="info-label">工号:</span>
|
|
<span class="info-value">{{ currentSuggestion.submitterLoginName || '未填写' }}</span>
|
|
</div>
|
|
<div class="info-item">
|
|
<span class="info-label">单位:</span>
|
|
<span class="info-value">{{ currentSuggestion.submitterUnitName || '未填写' }}</span>
|
|
</div>
|
|
<div class="info-item">
|
|
<span class="info-label">联系方式:</span>
|
|
<span class="info-value">{{ currentSuggestion.concat || '未填写' }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="detail-section">
|
|
<div class="detail-label">意见内容</div>
|
|
<div class="detail-content">{{ currentSuggestion.content }}</div>
|
|
</div>
|
|
|
|
<div class="detail-section"
|
|
v-if="currentSuggestion.attachments && currentSuggestion.attachments.length > 0">
|
|
<div class="detail-label">附件</div>
|
|
<div class="detail-attachments">
|
|
<vant-file-upload :del="false" :files.sync="currentSuggestion.attachments"
|
|
view></vant-file-upload>
|
|
<!-- <div class="attachment-item" v-for="(file, idx) in currentSuggestion.attachments" :key="idx"
|
|
@click.stop="previewImage(file.url, idx)">
|
|
<img :src="file.url" class="attachment-image">
|
|
</div>-->
|
|
</div>
|
|
</div>
|
|
|
|
<div class="detail-section" v-if="currentSuggestion.isReply">
|
|
<div class="detail-label">回复</div>
|
|
<div class="detail-reply detail-content">{{ currentSuggestion.replyContent }}</div>
|
|
</div>
|
|
|
|
<div v-else class="detail-section">
|
|
<div class="detail-label">回复</div>
|
|
<div class="no-reply">
|
|
<van-icon name="chat-o" class="no-reply-icon"/>
|
|
<div class="no-reply-text">暂无回复</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</van-popup>
|
|
</div>
|
|
|
|
<script>
|
|
const vue = new Vue({
|
|
el: '#app',
|
|
data() {
|
|
return {
|
|
refreshing: false,
|
|
loading: false,
|
|
finished: false,
|
|
showDetailPopup: false,
|
|
currentSuggestion: null,
|
|
pageNumber: 1,
|
|
pageSize: 10,
|
|
suggestions: []
|
|
}
|
|
},
|
|
created() {
|
|
this.loadData();
|
|
},
|
|
methods: {
|
|
loadData() {
|
|
this.loading = true;
|
|
$.post('/platform/suggestionBox/pageData', {
|
|
pageNumber: this.pageNumber,
|
|
pageSize: this.pageSize
|
|
}).done((res) => {
|
|
if (res.code === 0 && res.data) {
|
|
if (this.pageNumber === 1) {
|
|
this.suggestions = res.data.list || [];
|
|
} else {
|
|
this.suggestions = this.suggestions.concat(res.data.list || []);
|
|
}
|
|
|
|
this.finished = !res.data.list || res.data.list.length < this.pageSize;
|
|
} else {
|
|
this.finished = true;
|
|
}
|
|
this.loading = false;
|
|
this.refreshing = false;
|
|
}).fail(() => {
|
|
this.loading = false;
|
|
this.refreshing = false;
|
|
this.finished = true;
|
|
});
|
|
},
|
|
|
|
// 下拉刷新
|
|
onRefresh() {
|
|
this.pageNumber = 1;
|
|
this.finished = false;
|
|
this.loadData();
|
|
},
|
|
|
|
// 上拉加载更多
|
|
loadMore() {
|
|
this.pageNumber++;
|
|
this.loadData();
|
|
},
|
|
|
|
// 查看详情
|
|
showDetail(suggestion) {
|
|
if (suggestion.attachments && typeof suggestion.attachments === 'string') {
|
|
try {
|
|
suggestion.attachments = JSON.parse(suggestion.attachments);
|
|
} catch (e) {
|
|
suggestion.attachments = [];
|
|
}
|
|
}
|
|
this.currentSuggestion = suggestion;
|
|
this.showDetailPopup = true;
|
|
},
|
|
|
|
// 获取状态class
|
|
getStatusClass(isReply) {
|
|
if (!isReply || isReply === 0) return 'status-pending';
|
|
if (isReply === 1) return 'status-processing';
|
|
return 'status-completed';
|
|
},
|
|
|
|
// 获取状态文本
|
|
getStatusText(isReply) {
|
|
if (!isReply || isReply === 0) return '待处理';
|
|
if (isReply === 1) return '处理中';
|
|
return '已处理';
|
|
},
|
|
|
|
// 格式化日期
|
|
formatDate(dateStr) {
|
|
if (!dateStr) return '';
|
|
const date = new Date(dateStr);
|
|
return date.getFullYear() + '-' + String(date.getMonth() + 1).padStart(2, '0') + '-' + String(date.getDate()).padStart(2, '0');
|
|
},
|
|
|
|
// 前往提交意见页面
|
|
goToSubmitPage() {
|
|
window.location.href = '/platform/suggestionBox/h5/write';
|
|
},
|
|
|
|
// 预览图片
|
|
previewImage(url, index) {
|
|
if (!url) return;
|
|
|
|
// 创建图片查看器
|
|
const urls = this.currentSuggestion.attachments.map(file => file.url);
|
|
this.$imagePreview({
|
|
images: urls,
|
|
startPosition: index
|
|
});
|
|
}
|
|
}
|
|
});
|
|
window.addEventListener('pageshow', e => {
|
|
if (e.persisted || (window.performance && window.performance.navigation.type === 2)) {
|
|
vue.loadData()
|
|
}
|
|
})
|
|
</script>
|
|
|
|
|
|
<!--#}#-->
|