sale-client 4.3.11 → 4.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,458 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <title></title>
7
+ <script type="text/javascript" src="jquery-1.12.4.min.js"></script>
8
+ <script type="text/javascript" src="json.js"></script>
9
+ <script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>
10
+ <style>
11
+ * {
12
+ user-select: none !important;
13
+ -ms-user-select: none !important;
14
+ padding: 0;
15
+ margin: 0;
16
+ background-color: #ffffff;
17
+ }
18
+
19
+ body {
20
+ width: 1280px;
21
+ height: 800px;
22
+ overflow: hidden;
23
+ font-size: 16px;
24
+ padding: 40px;
25
+ }
26
+
27
+ .title {
28
+ font-size: 52px;
29
+ }
30
+
31
+ #business {
32
+ margin-top: 60px;
33
+ }
34
+
35
+ #business .business-title {
36
+ margin-left: 20px;
37
+ font-size: 36px;
38
+ }
39
+
40
+ #business .business-name {
41
+ margin-left: 20px;
42
+ margin-top: 10px;
43
+ font-size: 36px;
44
+ }
45
+
46
+ #eva {
47
+ margin-top: 40px;
48
+ /*float: right;*/
49
+ /*width: 768px;*/
50
+ /*height: 348px;*/
51
+ font-size: 32px;
52
+ color: #999999;
53
+ }
54
+
55
+ #eva>div {
56
+ margin-bottom: 40px;
57
+ }
58
+
59
+ #eva .q {
60
+ font-size: 36px;
61
+ margin-bottom: 20px;
62
+ margin-right: 20px;
63
+ color: black;
64
+ }
65
+
66
+ #eva .star {
67
+ font-size: 40px;
68
+ cursor: pointer;
69
+ }
70
+
71
+ #eva .star.selected {
72
+ color: #2196F3;
73
+ }
74
+
75
+ #bottom-btn {
76
+ position: fixed;
77
+ bottom: 40px;
78
+ left: 0;
79
+ width: 100%;
80
+ text-align: center;
81
+ }
82
+
83
+
84
+ #bottom-btn button {
85
+ padding: 4px 12px;
86
+ width: 160px;
87
+ border-width: 1px;
88
+ border-radius: 4px;
89
+ font-size: 28px;
90
+ outline: none;
91
+ }
92
+
93
+ #cancel-btn {
94
+ background-color: #ffffff;
95
+ color: #333333;
96
+ margin-right: 128px;
97
+ }
98
+
99
+ #submit-btn {
100
+ background-color: #2196f3;
101
+ color: #ffffff;
102
+ }
103
+
104
+ #submit-btn:active {
105
+ background-color: #85c9ff;
106
+ }
107
+
108
+ .reason {
109
+ margin-left: 30px;
110
+ }
111
+
112
+ .reason>div {
113
+ margin-top: 20px;
114
+ margin-left: 40px;
115
+ }
116
+
117
+ .no_choose,
118
+ .choose {
119
+ margin: 10px 40px 10px 40px;
120
+ padding: 0 8px;
121
+ width: 432px;
122
+ font-size: 28px;
123
+ border-width: 1px;
124
+ border-radius: 4px;
125
+ outline: none;
126
+ }
127
+
128
+ .choose,
129
+ .choose:active,
130
+ .choose:focus {
131
+ background-color: #a7dbff;
132
+ color: #0070c3;
133
+ border-color: #a7dbff;
134
+ }
135
+
136
+ .no_choose,
137
+ .no_choose:active,
138
+ .no_choose:focus {
139
+ color: #999999;
140
+ border-color: #DDDDDD;
141
+ background-color: #ffffff;
142
+ }
143
+
144
+ .hidden {
145
+ display: none !important;
146
+ }
147
+
148
+ button {
149
+ cursor: pointer;
150
+ border-color: #DDDDDD;
151
+ }
152
+
153
+ </style>
154
+ </head>
155
+
156
+ <body scroll=no onselectstart="return false;">
157
+ <h1 class="title">金煌燃气服务评价</h1>
158
+ <div id="eva">
159
+ <div id="rate">
160
+ <b style="color: #f44336;">*</b>
161
+ <span class="q">您对整体服务满意吗?</span>
162
+ <span class="star" onclick="rate(1)">★</span>
163
+ <span class="star" onclick="rate(2)">★</span>
164
+ <span class="star" onclick="rate(3)">★</span>
165
+ <span class="star" onclick="rate(4)">★</span>
166
+ <span class="star" onclick="rate(5)">★</span>
167
+ <input type="hidden" id="rating">
168
+ <span id="star-tip">非常满意</span>
169
+ </div>
170
+ </div>
171
+
172
+ <div id="bottom-btn">
173
+ <button id="cancel-btn" onclick="cancel()">取消</button>
174
+ <button id="submit-btn" onclick="submit()">确定</button>
175
+ </div>
176
+
177
+ <script>
178
+ var broadcastChannel = null
179
+ var isConnectedToMainScreen = false
180
+
181
+ $(document).ready(function () {
182
+ // 默认评分
183
+ rate(5)
184
+
185
+ // 初始化QT中的函数
186
+ if (typeof qt != 'undefined') {
187
+ new QWebChannel(qt.webChannelTransport, function (channel) {
188
+ window.JSQT = channel.objects.jsobj
189
+ JSQT.getParam(function (res) {
190
+ if (res.length > 0) {
191
+ res = JSON.parse(res)
192
+ if (res.businessName != null) {
193
+ $("#businessName").text(res.businessName)
194
+ $("#business").show()
195
+ }
196
+ }
197
+ })
198
+ })
199
+ }
200
+
201
+ // 初始化广播通道
202
+ initBroadcastChannel()
203
+
204
+ // 添加键盘快捷键支持
205
+ document.addEventListener('keydown', function(event) {
206
+ // Alt+C 取消
207
+ if (event.altKey && event.key === 'c') {
208
+ event.preventDefault()
209
+ cancel()
210
+ }
211
+ // Alt+Enter 提交
212
+ if (event.altKey && event.key === 'Enter') {
213
+ event.preventDefault()
214
+ submit()
215
+ }
216
+ })
217
+ })
218
+
219
+ // 初始化广播通道
220
+ function initBroadcastChannel() {
221
+ try {
222
+ broadcastChannel = new BroadcastChannel("QX-demo")
223
+
224
+ broadcastChannel.onmessage = function (event) {
225
+ console.log("副屏收到主屏消息:", event.data)
226
+ handleMainScreenMessage(event.data)
227
+ }
228
+
229
+ broadcastChannel.onmessageerror = function (event) {
230
+ console.error("广播通道消息错误:", event)
231
+ }
232
+
233
+ // 发送准备就绪消息
234
+ setTimeout(function() {
235
+ if (broadcastChannel) {
236
+ broadcastChannel.postMessage({
237
+ type: 'subscreen_ready',
238
+ timestamp: new Date().toISOString(),
239
+ message: '副屏已准备就绪'
240
+ })
241
+ console.log("已发送准备就绪消息给主屏")
242
+ }
243
+ }, 500)
244
+
245
+ isConnectedToMainScreen = true
246
+
247
+ } catch (error) {
248
+ console.error("初始化广播通道失败:", error)
249
+ isConnectedToMainScreen = false
250
+ }
251
+ }
252
+
253
+ // 处理主屏消息
254
+ function handleMainScreenMessage(data) {
255
+ try {
256
+ // 尝试解析JSON
257
+ var parsedData = data
258
+ if (typeof data === 'string') {
259
+ try {
260
+ parsedData = JSON.parse(data)
261
+ } catch (e) {
262
+ // 如果不是JSON,保持原样
263
+ }
264
+ }
265
+
266
+ // 处理不同类型的消息
267
+ if (typeof parsedData === 'object' && parsedData.type) {
268
+ switch (parsedData.type) {
269
+ case 'business_info':
270
+ updateBusinessInfo(parsedData.businessName)
271
+ break
272
+
273
+ case 'mainscreen_ready':
274
+ console.log("主屏已准备就绪")
275
+ break
276
+
277
+ case 'close_subscreen':
278
+ console.log("收到主屏关闭请求")
279
+ // 执行一些清理工作
280
+ setTimeout(function() {
281
+ if (typeof JSQT !== 'undefined' && JSQT.closeWindow) {
282
+ JSQT.closeWindow()
283
+ } else if (window.close) {
284
+ window.close()
285
+ }
286
+ }, 300)
287
+ break
288
+
289
+ case 'test_message':
290
+ console.log("收到测试消息: " + parsedData.message)
291
+ alert("收到主屏测试消息: " + parsedData.message)
292
+ break
293
+
294
+ default:
295
+ console.log("收到未知类型消息:", parsedData.type)
296
+ }
297
+ } else if (typeof parsedData === 'string' && parsedData.includes('业务')) {
298
+ // 兼容旧格式的消息
299
+ updateBusinessInfo(parsedData)
300
+ } else if (typeof parsedData === 'string') {
301
+ console.log("主屏消息:", parsedData)
302
+ }
303
+ } catch (error) {
304
+ console.error("处理主屏消息时出错:", error)
305
+ }
306
+ }
307
+
308
+ // 更新业务信息
309
+ function updateBusinessInfo(businessName) {
310
+ if (businessName && businessName.trim() !== '') {
311
+ $("#businessName").text(businessName)
312
+ $("#business").show()
313
+ console.log("业务信息已更新:" + businessName)
314
+ }
315
+ }
316
+
317
+ // 取消评分
318
+ function cancel() {
319
+ var result = {
320
+ errMsg: "用户取消评价"
321
+ }
322
+
323
+ // 发送取消消息给主屏
324
+ if (broadcastChannel && isConnectedToMainScreen) {
325
+ broadcastChannel.postMessage({
326
+ type: 'evaluation_canceled',
327
+ result: result,
328
+ timestamp: new Date().toISOString()
329
+ })
330
+ console.log("已发送取消消息给主屏")
331
+ }
332
+
333
+ // 同时通过QT通信
334
+ if (typeof JSQT !== 'undefined' && JSQT.setResult) {
335
+ JSQT.setResult(JSON.stringify(result))
336
+ }
337
+
338
+ // 显示取消消息
339
+ alert("评价已取消")
340
+
341
+ // 延迟关闭窗口
342
+ setTimeout(function() {
343
+ if (typeof JSQT !== 'undefined' && JSQT.closeWindow) {
344
+ JSQT.closeWindow()
345
+ } else if (window.close) {
346
+ window.close()
347
+ }
348
+ }, 500)
349
+ }
350
+
351
+ // 提交评分
352
+ function submit() {
353
+ var ratingInput = $("#rating")[0]
354
+ var rate = ratingInput.value
355
+ var result = {
356
+ eva_value: rate
357
+ }
358
+
359
+ // 发送评价结果给主屏
360
+ if (broadcastChannel && isConnectedToMainScreen) {
361
+ broadcastChannel.postMessage({
362
+ type: 'evaluation_result',
363
+ result: result,
364
+ timestamp: new Date().toISOString()
365
+ })
366
+ console.log("已发送评价结果给主屏")
367
+ }
368
+
369
+ // 同时通过QT通信
370
+ if (typeof JSQT !== 'undefined' && JSQT.setResult) {
371
+ JSQT.setResult(JSON.stringify(result))
372
+ }
373
+
374
+ // 显示提交成功消息
375
+ alert("评价提交成功!感谢您的反馈!")
376
+
377
+ // 延迟关闭窗口
378
+ setTimeout(function() {
379
+ if (typeof JSQT !== 'undefined' && JSQT.closeWindow) {
380
+ JSQT.closeWindow()
381
+ } else if (window.close) {
382
+ window.close()
383
+ }
384
+ }, 1000)
385
+ }
386
+
387
+ function choose(ele) {
388
+ if (ele.className == 'choose') {
389
+ ele.className = 'no_choose'
390
+ } else {
391
+ ele.className = 'choose'
392
+ }
393
+ }
394
+
395
+ function rate(rating) {
396
+ var stars = $(".star")
397
+ for (var i = 0; i < stars.length; i++) {
398
+ if (i < rating) {
399
+ stars[i].className = "star selected"
400
+ } else {
401
+ stars[i].className = "star"
402
+ }
403
+ }
404
+ var ratingInput = $("#rating")[0]
405
+ ratingInput.value = rating
406
+ updateTip(rating)
407
+ updateReasons(rating)
408
+ }
409
+
410
+ function updateTip(rating) {
411
+ var tip = $("#star-tip")[0]
412
+ if (rating == 1) {
413
+ tip.innerHTML = "<span>非常不满意</span>"
414
+ } else if (rating == 2) {
415
+ tip.innerHTML = "<span>不满意</span>"
416
+ } else if (rating == 3) {
417
+ tip.innerHTML = "<span>基本满意</span>"
418
+ } else if (rating == 4) {
419
+ tip.innerHTML = "<span>满意</span>"
420
+ } else if (rating == 5) {
421
+ tip.innerHTML = "<span>非常满意</span>"
422
+ }
423
+ }
424
+
425
+ function updateReasons(rating) {
426
+ var reasons = $(".reason")
427
+ for (var i = 0; i < reasons.length; i++) {
428
+ if (i === rating - 1) {
429
+ reasons[i].className = "reason"
430
+ } else {
431
+ reasons[i].className = "reason hidden"
432
+ }
433
+ }
434
+ cleanChoose()
435
+ }
436
+
437
+ function cleanChoose() {
438
+ var buttons = $(".choose")
439
+ for (var i = 0; i < buttons.length; i++) {
440
+ buttons[i].className = "no_choose"
441
+ }
442
+ }
443
+
444
+ // 页面卸载时清理资源
445
+ window.addEventListener('beforeunload', function() {
446
+ if (broadcastChannel) {
447
+ try {
448
+ broadcastChannel.close()
449
+ } catch (e) {
450
+ // 忽略错误
451
+ }
452
+ }
453
+ })
454
+
455
+ </script>
456
+ </body>
457
+
458
+ </html>