index.vue
15.8 KB
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
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
<template>
<view
class="container"
@click="handleTouchStart"
>
<view :class="['home', { show: !id && showHome }]">
<left-side
:userInfo="userInfo"
:tabIndex.sync="tabIndex"
ref="leftBox"
@changeTab="changeTab"
@stopAudio="stopAudio"
@showReadCountTips="showReadCountTips"
@closeTips="closeTips"
/>
<view
class="tips-box"
:style="tipsObject.style"
@click.stop="closeTips"
>{{tipsObject.text}}</view>
<view class="right-side">
<view :class="['app-content-box right-content',{'show-content-box':tabIndex == 0}]">
<view
class="start"
@click="$emit('start')"
>
<view class="sprite-icon icon-start-text"></view>
</view>
<view class="right-content-box flex">
<view class="content-left">
<view class="module-box box-class">
<view class="common-title">产品介绍</view>
<view class="content-box">
<swiper-component
:moduleList="moduleList"
@click="swiperClick"
:stopAutoPlay="previewOff"
:imgKey="bannerKey"
></swiper-component>
</view>
</view>
<view class="tool-box box-class">
<view class="common-title">展业工具</view>
<view class="content-box">
<view class="developing flex">
<image
class="developing-icon"
src="../../assets/images/common/developing.webp"
/>
功能开发中
</view>
</view>
</view>
</view>
<view class="content-right box-class">
<view class="common-title">服务中心</view>
<view class="content-box">
<MessageIndex />
</view>
</view>
</view>
</view>
<view :class="['app-content-box right-content',{'show-content-box':tabIndex == 99}]">
<component
:is="'Point'"
ref="pointRef"
:userInfo="userInfo"
@showPage="handleShowPage"
/>
</view>
<template v-if="tabIndex != 0 && tabIndex != 99">
<component
:is="componentName"
ref="pointRef"
:userInfo="userInfo"
@showPage="handleShowPage"
:isPermissionFunction="isPermission"
/>
</template>
</view>
<view
class="store-addr"
v-if="footerBox"
>
<view class="icon-addr sprite-icon icon-addr"></view>
<view class="addr-text">{{ userInfo.shopMerchantName }}</view>
</view>
</view>
<view :class="['detail', { show: id }]">
<slot name="detail" />
</view>
<view
class="point-page"
v-if="!showHome"
>
<component
:is="pointComponentName"
@backHome="backHome"
@jump="jump"
:transfer="transfer"
/>
</view>
<!-- 未点击开始接待,弹窗 -->
<MessageBox
ref="previewRef"
@confirm="previewHandler('preview',true)"
:popupW="704"
content="直接点击素材可进行预览,若面向车主展示,请点击「开始接待」"
confirmBtnText="预览素材"
@cancel="previewHandler('previewCancel')"
@close="previewHandler('previewClose')"
></MessageBox>
<!-- 停留弹框 -->
<!-- <MessageBox ref="tipBox" @cancel="tipCancel" @confirm="tipConfirm" content="系统检测到您在当前页面停留较久,是否仍在客户接待中?" cancelBtnText="否" confirmBtnText="是"></MessageBox> -->
<!-- 退出弹框 -->
<MessageBox
:popupW="704"
ref="finish"
:content="finishContene"
:isFooter="false"
>
<view class="footer">
<view
class="footer-btn confirm flex"
@click="$emit('openStep')"
>
<template v-if="finishDoneText">
{{ finishDoneText }}
</template>
<template v-else>
完成接待
<text>(推荐)</text>
</template>
</view>
<view
class="footer-btn cancel flex"
@click="$emit('backHome')"
>
仍要退出
<text>(不推荐)</text>
</view>
</view>
</MessageBox>
<!-- 升级弹框 -->
<update-box />
<slot name="content" />
<web-view
@message="handlerMessage"
ref="webview"
src="/hybrid/html/index.html"
></web-view>
<web-view
ref="studyWebview"
:src="jumpUrl"
v-if="showBeisen"
></web-view>
</view>
</template>
<script>
import ReceptionCenter from './components/ReceptionCenter/index.vue'
import SceneMarket from './components/SceneMarket/index.vue'
// import myClick from '@/mixin/click'
import timeout from '@/mixin/timeout'
import recorder from '@/mixin/record/recorder'
import uploader from '@/mixin/record/uploader.js'
import versionCheck from '@/mixin/versionCheck.js'
import LeftSide from './components/LeftSide.vue'
import Point from './components/Point.vue'
import dayPoint from './components/Point/DayPoint.vue'
import rulePoint from './components/Point/RulePoint.vue'
import LevelPoint from './components/Point/LevelPoint.vue'
import LevelMedal from './components/Point/LevelMedal.vue'
import Course from './components/Point/Course.vue'
import Ranking from './components/Point/Ranking.vue'
import Calendar from './components/Income/Calendar.vue'
import Promotion from './components/Income/Promotion.vue'
import History from './components/Income/History.vue'
import merge from '@/mixin/record/merge.js'
import MessageDetail from './components/Message/MessageDetail.vue'
import StudyCenter from './components/StudyCenter.vue'
import SwiperComponent from '../SwiperComponent.vue'
import MessageIndex from './components/Message/index.vue'
export default {
mixins: [recorder, uploader, timeout, versionCheck, merge],
components: { ReceptionCenter, StudyCenter, SceneMarket, LeftSide, Point, dayPoint, rulePoint, Course, Ranking, LevelPoint, Calendar, Promotion, History, LevelMedal, MessageDetail, SwiperComponent, MessageIndex },
props: {
id: [String, Number],
finishDoneText: String,
finishContene: {
type: String,
default: '当前操作视为强制退出接待,若需正常流程完成接待请点击「完成接待」'
},
moduleList: {
type: Array,
default: () => []
},
bannerKey: String
},
data () {
return {
studyUrl: '',
jumpUrl: '',
transfer: '',
footerBox: true,
showHome: true,
pointComponentName: 'Point',
userInfo: {},
tabIndex: 0,
showBeisen: false,
tipsObject: {},
autoplay: true,
previewOff: false,
}
},
mounted () {
const userInfo = uni.$storage.get('userInfo') || {}
this.userInfo = userInfo
this.checkVersion()
},
provide () {
return {
showPage: this.handleShowPage,
hideFooter: this.handleFooter
}
},
computed: {
previewRef () {
return this.$refs.previewRef
},
finishRef () {
return this.$refs.finish
},
componentName () {
let tabs = this.$refs.leftBox?.tabs
return tabs ? tabs[this.tabIndex].name : ''
}
},
methods: {
async changeTab ({ item, jumpUrl, index }) {
this.previewOff = index != 0
this.$emit('changeTab', index)
this.showBeisen = false
if (item.isTrack) {
this.jumpUrl = jumpUrl
if (!this.jumpUrl) {
uni.showToast({
title: '培训账号未创建',
icon: 'none'
})
return
}
} else {
this.jumpUrl = ''
}
},
handleFooter (val) {
this.footerBox = val
},
backHome () {
this.showHome = true
console.log(this.$refs.pointRef)
Promise.resolve().then(() => {
this.$refs.pointRef?.$refs?.centerRef?.init && this.$refs.pointRef.$refs.centerRef.init()
})
},
jump (val) {
this.showHome = true
if (val == 'CustomerFile') {
this.tabIndex = 2
return
}
this.$emit('start')
},
handleShowPage (name, transfer) {
this.transfer = transfer
this.showHome = false
this.pointComponentName = name
},
handleOperation (val, data) {
console.log(val, data, 'val, data')
const { type } = val;
// 提取公共的webview设置逻辑
const setWebviewStyle = () => {
//修改UA为PC端
// plus.navigator.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0')
const setWebviewStyleWithRetry = () => {
const currentWebview = this.$parent.$scope.$getAppWebview();
const wv = currentWebview.children()[1];
if (wv) {
wv.setStyle({
left: '8%',
top: '3%',
height: '97%',
width: '92%'
});
return true; // 成功设置样式
} else {
return false; // 未找到wv
}
};
const retrySetWebviewStyle = () => {
if (!setWebviewStyleWithRetry()) {
// 如果未成功,继续重试
setTimeout(retrySetWebviewStyle, 50);
} else {
// 成功设置样式,结束循环
console.log('Webview样式设置成功');
}
};
setTimeout(retrySetWebviewStyle, 100);
};
// 处理课程详情
const handleCourseDetail = () => {
const COURSE_ID = val.data.courseId;
const baseUrl = 'https://cloud.italent.cn/PageHome/Index';
const params = {
product: 'Learning',
keyName: 'Nusion',
pageCode: 'LearningCourseTraineeDetailPage',
appCode: 'Learning',
id: COURSE_ID
};
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.join('&');
const tokenUrl = uni.$storage.get('beisenToken')
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
this.jumpUrl = `${tokenUrl}&return_url=${url}`;
};
// 根据操作类型执行相应逻辑
switch (type) {
case 'openCourse':
this.showBeisen = true;
setWebviewStyle();
break;
case 'courseDetail':
handleCourseDetail();
this.showBeisen = true;
setWebviewStyle();
this.getStudyCenterRead(val.data.id)
break;
}
},
// 学习中心修改阅读状态,打开后才修改
async getStudyCenterRead (id) {
console.log(id, 'getStudyCenterRead')
const res = await uni.$api.commonApi.getStudyCenterRead({ id })
console.log(res)
},
showReadCountTips (res) {
this.tipsObject = res
},
closeTips () {
this.$refs.leftBox.readCount = 0
this.tipsObject = {
style: '',
text: ''
}
},
swiperClick (e) {
this.previewOff = true
this.$emit('swiperClick', e)
},
previewHandler (name, off = false) {
this.previewOff = off
this.$emit(name)
}
}
}
</script>
<style scoped lang="scss">
.container {
position: relative;
.tips-box {
position: absolute;
color: #ffffff;
font-size: toRpx(28);
width: toRpx(310);
height: toRpx(90);
line-height: toRpx(64);
background-image: url('@/assets/images/home/daliog.png');
background-size: 100% 100%;
z-index: 9;
padding-left: toRpx(60);
text-align: left;
display: none;
opacity: 0;
}
&::after {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
background-image: url('@/assets/images/common/home-bg-1.webp');
background-size: 100% 100%;
z-index: 1;
}
.home,
.detail {
position: fixed;
width: 100%;
height: 100%;
z-index: -1;
top: 0;
left: 0;
visibility: hidden;
opacity: 0;
}
.point-page {
position: fixed;
width: 100%;
height: 100%;
z-index: 1;
top: 0;
left: 0;
}
.home {
display: flex;
height: 100vh;
position: relative;
.store-addr {
position: absolute;
left: 50%;
bottom: toRpx(24);
transform: translateX(-50%);
display: flex;
align-items: center;
.icon-addr {
width: toRpx(32);
height: toRpx(32);
flex-shrink: 0;
}
.addr-text {
font-size: toRpx(24);
color: #999999;
word-wrap: break-word;
white-space: normal;
line-height: toRpx(32);
margin-left: toRpx(4);
flex-shrink: 0;
}
&::before,
&::after {
content: '';
width: toRpx(600);
height: toRpx(2);
margin: 0 toRpx(40);
}
&::before {
background-image: linear-gradient(270deg, #eeeeee 0%, #d8d8d800 100%);
}
&::after {
background-image: linear-gradient(90deg, #eeeeee 0%, #d8d8d800 100%);
}
}
}
.show {
opacity: 1;
position: absolute;
z-index: 2;
visibility: visible;
animation: show-content-left 0.15s forwards;
}
}
@keyframes show-content-left {
0% {
left: 100%;
}
100% {
left: 0;
}
}
.right-side {
flex: 1;
position: relative;
width: calc(100vw - #{toRpx(240)});
.right-content {
height: 100vh;
box-sizing: border-box;
position: relative;
animation: show-box 0.15s forwards;
overflow: hidden;
}
@keyframes show-box {
0% {
left: 100%;
}
100% {
left: 0;
}
}
.start {
height: toRpx(232);
box-sizing: border-box;
margin-right: toRpx(64);
position: relative;
background: url('@/assets/images/home/start-btn.png') no-repeat;
background-size: 100% 100%;
padding-top: toRpx(60);
display: flex;
justify-content: center;
.sprite-icon {
zoom: 2;
}
}
.right-content-box {
height: calc(100% - #{toRpx(232)});
gap: toRpx(48);
box-sizing: border-box;
padding: toRpx(32) 0 toRpx(80);
.box-class {
background: #ffffff59;
backdrop-filter: blur(toRpx(16));
box-shadow: inset 0 0 toRpx(16) 0 #ffffff;
border-radius: toRpx(48);
overflow: hidden;
}
.content-box {
position: relative;
width: 100%;
height: calc(100% - #{toRpx(120)});
.developing {
height: 100%;
flex-direction: column;
color: #999999;
font-size: 20rpx;
&-icon {
width: 344rpx;
height: 208rpx;
}
}
}
.content-left,
.content-right {
height: 100%;
}
.content-left {
width: toRpx(1210);
.module-box {
height: toRpx(664);
margin-bottom: toRpx(48);
}
.tool-box {
height: calc(100% - #{toRpx(712)});
}
}
.content-right {
width: toRpx(800);
}
}
.app-content-box {
position: absolute;
left: 0;
top: 0;
opacity: 0;
z-index: -999;
}
.show-content-box {
opacity: 1;
z-index: 1;
}
}
.footer {
border-top: toRpx(2) solid #eff0f2;
font-weight: 600;
font-size: toRpx(32);
margin-top: toRpx(48);
.footer-btn {
justify-content: center;
margin: toRpx(16) auto 0;
}
.confirm {
width: toRpx(608);
height: toRpx(80);
background: #2c66f7;
border-radius: toRpx(40);
color: #fff;
}
.cancel {
width: toRpx(608);
height: toRpx(80);
background: #ffffff00;
border-radius: toRpx(40);
color: #2c66f7;
}
text {
font-size: toRpx(24);
}
}
.lead-page {
height: 100vh;
width: 100vw;
z-index: 999999;
position: fixed;
}
</style>