Blame view

uniapp_jiju/pages/new/yhfk/detail.vue 10.5 KB
d56bd957   “wangming”   修复问题,组建AI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
  <template>
  	<view class="main">
  		<view class="toptitle">
  			<view class="toptitle_left" @click="ht">
  				<u-icon name="arrow-left" color="#fff" size="20"></u-icon>
  			</view>
  			<view class="toptitle_title">
  				反馈详情
  			</view>
  		</view>
  		<!-- 设备问题反馈详情 -->
  		<view class="box" v-if="detail.type === 'sbwtfk'">
  			<view class="top2" v-if="detail.title">
  				<span class="f4">设备名</span>
  				<span class="f5">{{detail.title}}</span>
  			</view>
  			<view class="top2" v-if="detail.nr">
  				<span class="f4">故障信息</span>
  				<span class="f5">{{detail.nr}}</span>
  			</view>
  			<view class="top2" v-if="detail.sbmc">
  				<span class="f4">设备名称</span>
  				<span class="f5">{{detail.sbmc}}</span>
  			</view>
  			<view class="top2" v-if="detail.shry">
  				<span class="f4">售后人员</span>
  				<span class="f5">{{detail.shry}}</span>
  			</view>
  			<view class="top2" v-if="detail.shdh">
  				<span class="f4">售后电话</span>
  				<span class="f5">{{detail.shdh}}</span>
  			</view>
  			<view class="top2" v-if="detail.shyx">
  				<span class="f4">售后邮箱</span>
  				<span class="f5">{{detail.shyx}}</span>
  			</view>
  			<view class="top2" v-if="detail.fbsj">
  				<span class="f4">提交时间</span>
  				<span class="f5">{{timestampToTime(detail.fbsj)}}</span>
  			</view>
  			<view class="top2" v-if="detail.clr">
  				<span class="f4">处理人</span>
  				<span class="f5">{{detail.clr}}</span>
  			</view>
  			<view class="top2">
  				<span class="f4">处理状态</span>
  				<span class="f5" :style="{ color: getStatusColor(detail.cljg) }">{{detail.cljg == null ? '未处理' : detail.cljg}}</span>
  			</view>
  			<view class="top2" v-if="detail.fkjg">
  				<span class="f4">反馈结果</span>
  				<span class="f5">{{detail.fkjg}}</span>
  			</view>
  			
  			<!-- 附件和图片 -->
  			<view v-if="(detail.fj1 && detail.fj1.length > 0) || (detail.fj2 && detail.fj2.length > 0)" style="margin-top: 20px; padding-top: 20px; border-top: 1px solid #e5e5e5;">
  				<view class="top" style="margin-bottom: 15px;">
  					<span class="f1">附件和图片</span>
  				</view>
  				<!-- 视频附件 -->
  				<view v-if="detail.fj1 && detail.fj1.length > 0" style="margin-top: 10px;">
  					<view style="margin-bottom: 10px; font-weight: bold;">视频附件:</view>
  					<view v-for="(file, index) in detail.fj1" :key="index" style="display: flex; justify-content: space-between; align-items: center; padding: 10px; border-bottom: 1px solid #e5e5e5;">
  						<view style="display: flex; align-items: center; flex: 1;">
  							<u-icon name="play-circle-fill" color="#0052D8" size="28" style="margin-right: 10px;"></u-icon>
  							<text style="flex: 1;">{{file.name || '视频文件'}}</text>
  						</view>
  						<u-button size="small" type="primary" text="查看" @click="previewFile(file)"></u-button>
  					</view>
  				</view>
  				<!-- 图片附件 -->
  				<view v-if="detail.fj2 && detail.fj2.length > 0" style="margin-top: 10px;">
  					<view style="margin-bottom: 10px; font-weight: bold;">图片附件:</view>
  					<view style="display: flex; flex-wrap: wrap; gap: 10px;">
  						<image 
  							v-for="(img, index) in detail.fj2" 
  							:key="index"
  							:src="getFullUrl(img.url)" 
  							mode="aspectFill"
  							style="width: 30%; height: 200rpx; border-radius: 6px;"
  							@click="previewImage(index)"
  						></image>
  					</view>
  				</view>
  			</view>
  		</view>
  		
  		<!-- 系统问题反馈详情 -->
  		<view class="box" v-if="detail.type === 'xtwtfk'">
  			<view class="top2" v-if="detail.qxgn">
  				<span class="f4">问题分类</span>
  				<span class="f5">{{detail.qxgn}}</span>
  			</view>
  			<view class="top2" v-if="detail.nr">
  				<span class="f4">问题描述</span>
  				<span class="f5">{{detail.nr}}</span>
  			</view>
  			<view class="top2" v-if="detail.clr">
  				<span class="f4">对接人员</span>
  				<span class="f5">{{detail.clr}}</span>
  			</view>
  			<view class="top2" v-if="detail.fbsj">
  				<span class="f4">提交时间</span>
  				<span class="f5">{{timestampToTime(detail.fbsj)}}</span>
  			</view>
  			<view class="top2">
  				<span class="f4">处理状态</span>
  				<span class="f5" :style="{ color: getStatusColor(detail.cljg) }">{{detail.cljg == null ? '未处理' : detail.cljg}}</span>
  			</view>
  			<view class="top2" v-if="detail.fkjg">
  				<span class="f4">反馈结果</span>
  				<span class="f5">{{detail.fkjg}}</span>
  			</view>
  			
  			<!-- 附件和图片 -->
  			<view v-if="(detail.fj1 && detail.fj1.length > 0) || (detail.fj2 && detail.fj2.length > 0)" style="margin-top: 20px; padding-top: 20px; border-top: 1px solid #e5e5e5;">
  				<view class="top" style="margin-bottom: 15px;">
  					<span class="f1">附件和图片</span>
  				</view>
  				<!-- 视频附件 -->
  				<view v-if="detail.fj1 && detail.fj1.length > 0" style="margin-top: 10px;">
  					<view style="margin-bottom: 10px; font-weight: bold;">视频附件:</view>
  					<view v-for="(file, index) in detail.fj1" :key="index" style="display: flex; justify-content: space-between; align-items: center; padding: 10px; border-bottom: 1px solid #e5e5e5;">
  						<view style="display: flex; align-items: center; flex: 1;">
  							<u-icon name="play-circle-fill" color="#0052D8" size="28" style="margin-right: 10px;"></u-icon>
  							<text style="flex: 1;">{{file.name || '视频文件'}}</text>
  						</view>
  						<u-button size="small" type="primary" text="查看" @click="previewFile(file)"></u-button>
  					</view>
  				</view>
  				<!-- 图片附件 -->
  				<view v-if="detail.fj2 && detail.fj2.length > 0" style="margin-top: 10px;">
  					<view style="margin-bottom: 10px; font-weight: bold;">图片附件:</view>
  					<view style="display: flex; flex-wrap: wrap; gap: 10px;">
  						<image 
  							v-for="(img, index) in detail.fj2" 
  							:key="index"
  							:src="getFullUrl(img.url)" 
  							mode="aspectFill"
  							style="width: 30%; height: 200rpx; border-radius: 6px;"
  							@click="previewImage(index)"
  						></image>
  					</view>
  				</view>
  			</view>
  		</view>
  	</view>
  </template>
  
  <script>
  export default {
  	data() {
  		return {
  			detail: {},
  			baseUrl: 'https://hhjj.antissoft.com'
  		}
  	},
  	onLoad() {
  		const detailStr = uni.getStorageSync('fkDetail');
  		console.log('详情页加载,原始数据:', detailStr);
  		if (detailStr) {
  			try {
  				this.detail = JSON.parse(detailStr);
  				console.log('解析后的详情数据:', this.detail);
  				
  				// 确保附件字段是数组
  				if (!Array.isArray(this.detail.fj1)) {
  					// 如果 fj1 是字符串,尝试解析
  					if (typeof this.detail.fj1 === 'string' && this.detail.fj1) {
  						try {
  							this.detail.fj1 = JSON.parse(this.detail.fj1);
  						} catch (e) {
  							console.warn('解析 fj1 JSON 失败:', e);
  							this.detail.fj1 = [];
  						}
  					} else {
  						this.detail.fj1 = [];
  					}
  				}
  				if (!Array.isArray(this.detail.fj2)) {
  					// 如果 fj2 是字符串,尝试解析
  					if (typeof this.detail.fj2 === 'string' && this.detail.fj2) {
  						try {
  							this.detail.fj2 = JSON.parse(this.detail.fj2);
  						} catch (e) {
  							console.warn('解析 fj2 JSON 失败:', e);
  							this.detail.fj2 = [];
  						}
  					} else {
  						this.detail.fj2 = [];
  					}
  				}
  				
  				console.log('处理后的附件数据 - fj1(视频):', this.detail.fj1);
  				console.log('处理后的附件数据 - fj2(图片):', this.detail.fj2);
  				console.log('fj1 数量:', this.detail.fj1 ? this.detail.fj1.length : 0);
  				console.log('fj2 数量:', this.detail.fj2 ? this.detail.fj2.length : 0);
  			} catch (e) {
  				console.error('解析详情数据失败:', e);
  				this.detail = {};
  			}
  		} else {
  			console.warn('未找到详情数据');
  		}
  	},
  	methods: {
  		ht() {
  			uni.navigateBack({
  				delta: 1
  			});
  		},
  		timestampToTime(timestamp) {
  			if (!timestamp) return '';
  			const date = new Date(timestamp);
  			const Y = date.getFullYear() + '-';
  			const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
  			const D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
  			const h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
  			const m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
  			const s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
  			return Y + M + D + h + m + s;
  		},
  		getStatusColor(cljg) {
  			if (!cljg) return '#999';
  			if (cljg.includes('已处理')) return '#67C23A';
  			if (cljg.includes('进行中')) return '#E6A23C';
  			if (cljg.includes('未处理')) return '#F56C6C';
  			return '#999';
  		},
  		getFullUrl(url) {
  			if (!url) return '';
  			if (url.startsWith('http://') || url.startsWith('https://')) {
  				return url;
  			}
  			return this.baseUrl + url;
  		},
  		previewImage(index) {
  			const images = (this.detail.fj2 || []).map(img => this.getFullUrl(img.url));
  			uni.previewImage({
  				current: index,
  				urls: images
  			});
  		},
  		getFileType(file) {
  			const raw = (file.name || file.url || '').toLowerCase();
  			return raw.includes('.') ? raw.split('.').pop() : '';
  		},
  		isVideoType(type) {
  			const videoTypes = ['mp4', 'mov', 'avi', 'wmv', 'mkv', 'webm', 'mpeg', 'mpg', 'flv', '3gp'];
  			return videoTypes.includes((type || '').toLowerCase());
  		},
  		isImageType(type) {
  			const imageTypes = ['png', 'jpg', 'jpeg', 'gif', 'bmp', 'webp'];
  			return imageTypes.includes((type || '').toLowerCase());
  		},
  		isPdfType(type) {
  			return (type || '').toLowerCase() === 'pdf';
  		},
  		previewFile(file) {
  			const fileUrl = this.getFullUrl(file.url);
  			const fileType = this.getFileType(file);
  			
  			// 图片预览
  			if (this.isImageType(fileType)) {
  				uni.previewImage({
  					current: 0,
  					urls: [fileUrl]
  				});
  				return;
  			}
  			
  			// PDF预览
  			if (this.isPdfType(fileType)) {
  				uni.setStorageSync('wjurl', fileUrl);
  				uni.navigateTo({
  					url: '/pages/pdf/pdf'
  				});
  				return;
  			}
  			
  			// 视频预览
  			if (this.isVideoType(fileType)) {
  				uni.setStorageSync('videoUrl', fileUrl);
  				uni.setStorageSync('videoName', file.name || '视频');
  				uni.navigateTo({
  					url: '/pages/new/zlgl/video-preview'
  				});
  				return;
  			}
  			
  			// 其他文件类型提示
  			uni.showToast({
  				title: '该文件类型暂不支持在线预览',
  				icon: 'none',
  				duration: 2000
  			});
  		}
  	}
  }
  </script>
  
  <style scoped lang="scss">
  @import 'index.scss';
  
  .box {
  	.top2 {
  		display: flex;
  		justify-content: space-between;
  		align-items: center;
  		padding: 15px 10px;
  		border-bottom: 1px solid #e5e5e5;
  		
  		.f4 {
  			font-size: 14px;
  			color: #666;
  			flex-shrink: 0;
  		}
  		
  		.f5 {
  			font-size: 14px;
  			color: #333;
  			text-align: right;
  			flex: 1;
  			margin-left: 10px;
  			word-break: break-all;
  		}
  	}
  	
  	.top2:last-child {
  		border-bottom: none;
  	}
  }
  </style>