index.vue
32.2 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
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
<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" @closeActivityCenter="closeActivityCenter" />
<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="start">
<template v-if="sceneType != 7">
<view class="sprite-icon icon-start-text"></view>
</template>
</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">
<template v-if="swiperCustom">
<slot name="swiperCustom" />
</template>
<template v-else>
<swiper-component :moduleList="moduleList" @click="swiperClick" :stopAutoPlay="previewOff" :imgKey="bannerKey" :loadComplete="loadComplete" :noDataObject="swiperNoDataObject"></swiper-component>
</template>
</view>
</view>
<view class="tool-box box-class">
<view class="common-title">展业工具</view>
<view class="content-box">
<Entrance @entranceClick="entranceClick"></Entrance>
</view>
</view>
</view>
<view class="content-right box-class">
<view class="common-title">服务中心</view>
<view class="content-box">
<MessageIndex class="message-box" ref="messageRef" />
</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="uploaderWebview" src="/hybrid/html/index.html" @message="handleUploadMessageNew" :webview-styles="webviewStyles"></web-view>
<!-- <web-view
ref="studyWebview"
:src="jumpUrl"
v-if="showBeisen"
></web-view> -->
<!-- 学习中心 等级考试弹窗 -->
<StudyPopup :show.sync="showStudyPopup" title="开始您的学习之旅" :topImage="require('@/assets/images/common/study-center-bg.png')" :topImageWidth="848" :topImageHeight="248">
<StudyPopupContent cardTitle="个性化学习路径" description="根据您当前的学习情况,我们将为您定制专属的学习计划,帮助您高效提升技能,实现职业突破。" :listItems="['基于当前能力水平评估', '结合岗位发展目标制定', '定期跟踪学习进度和效果']" tipText="true" :courseName="courseInfo.title" buttonText="开始测评" @cancel="handleStudyPopupCancel" @button-click="handleStartAssessment" />
</StudyPopup>
<!-- 考试提交确认弹窗 -->
<StudyPopup :show.sync="showExamPopup" title="" :width="848" :height="examPopInfo.isExamLoading ? 740 : 656" :topImage="require('@/assets/images/common/warning-notice.png')" :topImageWidth="848" :topImageHeight="248">
<ExamSubmitPopup :isLoading="examPopInfo.isExamLoading" :showError="examPopInfo.showError" :confirmText="examPopInfo.confirmText" @cancel="handleExamCancel" @confirm="handleExamConfirm" />
</StudyPopup>
<!-- 学习中心权限弹窗 -->
<StudyPopup :show.sync="showStudyPermissionPopup" title="" :width="848" :height="870" :topImage="require('@/assets/images/common/warning-notice.png')" :topImageWidth="848" :topImageHeight="248" style="overflow: hidden">
<StudyCenterPermissionPopup :lockReason="lockReason" @confirm="handleStudyPermissionConfirm" />
</StudyPopup>
<activity-popup ref="activityPopup" @JumpActivityCenter="JumpActivityCenter"></activity-popup>
<uni-popup ref="errorRef" type="message">
<uni-popup-message type="error" :message="errorMsg" :duration="1500"></uni-popup-message>
</uni-popup>
<!-- 异常订单锁单 -->
<ErrorOrderPopup :show.sync="showErrorOrderPopup" title="" :width="848" :height="870" :topImage="require('@/assets/images/common/warning-notice.png')" :topImageWidth="848" :topImageHeight="248" style="overflow: hidden">
<view>
<view class="error-order-title">异常订单提醒</view>
<view class="error-order-content">存在{{ abnormalOrderCount }} 条异常订单未处理,请尽快处理!</view>
</view>
<template #footer>
<view class="flex justify-between error-order-footer">
<!-- <view class="footer-btn cancel" @click="showErrorOrderPopup=false">
取消
</view> -->
<view class="footer-btn sure flex-1" @click="showErrorOrderPopup = false">好的</view>
</view>
</template>
</ErrorOrderPopup>
</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 SwiperComponent from '../SwiperComponent.vue'
import StudyCenter from './components/StudyCenter.vue'
import ActivityCenter from './components/ActivityCenter.vue'
import MessageIndex from './components/Message/index.vue'
import permision from '@/js_sdk/wa-permission/permission.js'
import Entrance from '@/components/Entrance.vue'
import mediaResourceManager from '@/utils/mediaResourceManager/mediaResourceManager'
import { interceptionMixin } from '@/mixin/index'
import StudyPopup from '@/components/StudyPopup.vue'
import StudyPopupContent from '@/components/StudyPopupContent.vue'
import ExamSubmitPopup from '@/components/ExamSubmitPopup.vue'
import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue'
import ActivityPopup from './components/ActivityPopup.vue'
import ErrorOrderPopup from '@/components/ErrorOrderPopup.vue'
import { FileUploadManager, UploadService } from '@/utils/recordManager/index.js'
export default {
// mixins: [recorder, uploader, timeout, versionCheck, merge, interceptionMixin],
mixins: [recorder, versionCheck, interceptionMixin],
components: {
ReceptionCenter,
StudyCenter,
SceneMarket,
LeftSide,
Point,
dayPoint,
rulePoint,
Course,
Ranking,
LevelPoint,
Calendar,
Promotion,
History,
LevelMedal,
MessageDetail,
SwiperComponent,
MessageIndex,
Entrance,
StudyPopup,
StudyPopupContent,
ExamSubmitPopup,
StudyCenterPermissionPopup,
ActivityCenter,
ActivityPopup,
ErrorOrderPopup
},
props: {
id: [String, Number],
finishDoneText: String,
finishContene: {
type: String,
default: '当前操作视为强制退出接待,若需正常流程完成接待请点击「完成接待」'
},
moduleList: {
type: Array,
default: () => []
},
bannerKey: String,
loadComplete: Boolean,
swiperNoDataObject: Object,
checkRecordAudio: {
type: Boolean,
default: true
},
swiperCustom: Boolean
},
data() {
return {
studyUrl: '',
jumpUrl: '',
transfer: '',
footerBox: true,
showHome: true,
pointComponentName: 'Point',
userInfo: {},
tabIndex: 0,
showBeisen: false,
tipsObject: {},
autoplay: true,
previewOff: false,
showStudyPopup: false,
showExamPopup: false,
examPopInfo: {
isExamLoading: false,
showError: false,
confirmText: '确认已提交'
},
showStudyPermissionPopup: false,
courseInfo: {
title: ''
},
lockReason: 0,
errorMsg: '',
showErrorOrderPopup: false,
abnormalOrderCount: 0,
webviewStyles: Object.freeze({
progress: false,
width: '10px',
height: '10px',
position: 'absolute',
top: '-1000px',
left: '-1000px'
})
}
},
beforeDestroy() {
// 组件销毁前移除监听
uni.$logger.local.info('levelStudyPopup 移除监听')
uni.$off('levelStudyPopup')
uni.$off('pageBack')
},
async mounted() {
uni.$logger.local.info('levelStudyPopup 开始监听mounted')
uni.$on('levelStudyPopup', obj => {
uni.$logger.local.info('接收到学习弹窗事件', obj)
this.showExamPopup = true
})
const userInfo = uni.$storage.get('userInfo') || {}
this.userInfo = userInfo
FileUploadManager.init({
webviewRef: this.$refs.uploaderWebview,
vueContext: this
})
if (this.checkRecordAudio) permision.requestAndroidPermission('android.permission.RECORD_AUDIO') // 进入界面时检查权限
// 检查是否锁单
const { abnormalOrderNum } = await this.getAbnormalOrderLock()
if (abnormalOrderNum > 0) {
this.showErrorOrderPopup = true
this.abnormalOrderCount = abnormalOrderNum
return
}
},
beforeDestroy() {
// 清理 FileUploadManager 资源
FileUploadManager.destroy()
},
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 : ''
},
sceneType() {
const { sceneType } = uni.$storage.get('userInfo')
return sceneType
},
activityWindowPopStatus() {
return this.$store.getters.activityWindowPopStatus
}
},
watch: {
activityWindowPopStatus: {
handler(val) {
const { id, tabIndex } = this
if (val == 2 && !id && tabIndex == 0) this.getActivityMessage()
},
immediate: true,
deep: true
}
},
created() {
// 监听自定义事件
uni.$on('pageBack', () => {
this.$refs.leftBox.getMessageInfo()
this.$refs.messageRef.getMessageSummary()
})
},
methods: {
// 处理开始测评(参考 detail.vue 的实现)
async handleStartAssessment() {
this.showStudyPopup = false
try {
// 获取北森 token
uni.showLoading({ title: '加载中...' })
const token = await this.findBeiSenSSOToken()
console.log('🔑 获取到的 token:', token)
uni.hideLoading()
if (token) {
// const COURSE_ID = 'c6d20419-fae9-4d35-a1d1-bd2b35c0c619';
const baseUrl = 'https://cloud.italent.cn/PageHome/Index'
const params = {
product: 'Learning',
keyName: 'Nusion',
pageCode: 'LearningExamTraineePage',
appCode: 'Learning',
examId: this.courseInfo.examId
}
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.join('&')
const tokenUrl = this.tokenUrl || uni.$storage.get('beisenToken')
// this.setWebviewStyle()
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`)
this.jumpUrl = `${tokenUrl}&return_url=${url}`
uni.navigateTo({
url: `/pages/common/studyWebview?url=${encodeURIComponent(this.jumpUrl)}&pageTitle=学习测评&type=0`
})
} else {
uni.showToast({
title: '培训账号未创建',
icon: 'none'
})
this.getLevelExamInfo()
throw new Error('获取 token 失败1')
}
} catch (error) {
uni.hideLoading()
console.error('❌ 获取 token 失败:', error)
uni.showToast({
title: '培训账号未创建',
icon: 'none'
})
}
},
// 获取北森 SSO Token(参考 detail.vue 的方法)
findBeiSenSSOToken() {
return new Promise((resolve, reject) => {
uni.$api.commonApi
.findBeiSenSSOToken({})
.then(res => {
uni.$storage.set('beisenToken', res.data)
resolve(res.data || '')
})
.catch(err => {
reject(err)
})
})
},
// 处理考试取消(用户选择未提交)
handleExamCancel() {
this.showExamPopup = false
this.examPopInfo = {
isExamLoading: false,
showError: false,
confirmText: '确认已提交'
}
this.getLevelExamInfo()
},
handleStudyPermissionConfirm() {
this.showStudyPermissionPopup = false
// 切换到学习中心 tab
const tabs = this.$refs.leftBox?.tabs
if (tabs) {
const studyCenterIndex = tabs.findIndex(tab => tab.name === 'StudyCenter')
if (studyCenterIndex !== -1) {
this.tabIndex = studyCenterIndex
this.changeTab({ item: tabs[studyCenterIndex], index: studyCenterIndex })
}
}
},
// 处理学习弹窗取消
handleStudyPopupCancel() {
this.showStudyPopup = false
// 切换到学习中心 tab
const tabs = this.$refs.leftBox?.tabs
if (tabs) {
const homeIndex = tabs.findIndex(tab => tab.name === 'HomeSlot')
if (homeIndex !== -1) {
this.tabIndex = homeIndex
this.changeTab({ item: tabs[homeIndex], index: homeIndex })
}
}
},
// 检查学习中心权限
async checkStudyCenterPermission() {
try {
const userInfo = uni.$storage.get('userInfo')
// 如果是渠道类型为9,没有权限
if (userInfo?.subLoginUser?.channelType == 9) {
return false
}
// 获取权限信息
let studyCenterPermission = uni.$storage.get('studyCenterPermission')
// 如果缓存中没有,调用接口获取
if (!studyCenterPermission) {
const yqMerchantIdList = userInfo?.subLoginUser?.yqMerchantIdList || []
const res = await uni.$api.commonApi.getStudyCenterPermission({ yqMerchantIdList })
studyCenterPermission = res
uni.$storage.set('studyCenterPermission', res)
}
// 判断权限:直营 或者 (鸿蒙智行 且 有延保业务)
const { directSaleAuth, hmzxAuth, authorizedBusinessList } = studyCenterPermission
const isYb = authorizedBusinessList && authorizedBusinessList.includes(1) // 1.延保 2.轻改 3.权益
// 有直营权限 或者 (有鸿蒙智行权限 且 有延保业务权限)则显示
// 这里返回 false 表示没有权限(即未完成学习任务),需要弹出提示
// TODO: 这里后续需要调用接口查询是否完成必修课
return false // 暂时返回 false 用于测试弹窗
} catch (error) {
console.error('获取学习中心权限失败:', error)
return true // 出错时默认允许通过
}
},
// 处理考试确认(用户选择已提交)
async handleExamConfirm() {
this.examPopInfo.isExamLoading = true
this.examPopInfo.showError = false
const { examId, levelExamId } = this.courseInfo
try {
const params = {
examId,
invokeType: 0,
levelExamId
}
// TODO: 这里后续调用后端查询接口
const result = await uni.$api.commonApi.getExamResult(params)
console.log('查询到的考试结果:', result)
// 模拟延迟
// await new Promise(resolve => setTimeout(resolve, 2000))
if (result) {
// 查询完成后关闭弹窗
this.examPopInfo.isExamLoading = false
console.log('查询完成,关闭弹窗')
this.showExamPopup = false
this.getLevelExamInfo()
// 关闭后刷新学习中心的学习时长
if (this.$refs.pointRef && typeof this.$refs.pointRef.getMyStudyTime === 'function') {
setTimeout(() => {
this.$refs.pointRef.getMyStudyTime()
}, 500)
}
} else {
this.examPopInfo.isExamLoading = false
this.examPopInfo.showError = true
this.examPopInfo.confirmText = '重新确认'
}
} catch (error) {
console.error('查询考试结果失败:', error)
this.examPopInfo.isExamLoading = false
this.examPopInfo.showError = true
this.examPopInfo.confirmText = '重新确认'
uni.showToast({
title: '未查询到考试结果,请重新确认',
icon: 'none'
})
}
},
async changeTab({ item, index }) {
if (index == 0) this.$refs.messageRef.getMessageSummary()
this.previewOff = index != 0
this.$emit('changeTab', index)
console.log(this.$refs.leftBox.hasPopupOpen)
// 切换到学习中心时显示弹窗
if (item.name === 'StudyCenter' && !this.$refs.leftBox.hasPopupOpen) {
this.getLevelExamInfo()
}
},
// 查询等级弹窗信息
async getLevelExamInfo() {
const res = await uni.$api.commonApi.startExam()
if (res) {
this.showStudyPopup = true
this.courseInfo = res
}
},
handleFooter(val) {
this.footerBox = val
},
backHome() {
this.showHome = true
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.start()
},
handleShowPage(name, transfer) {
this.transfer = transfer
this.showHome = false
this.pointComponentName = name
},
handleOperation(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)
}
}
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) {
const res = await uni.$api.commonApi.getStudyCenterRead({ id })
},
showReadCountTips(res) {
this.tipsObject = res
},
closeTips() {
this.$refs.leftBox.readCount = 0
this.tipsObject = {
style: '',
text: ''
}
},
swiperClick(e) {
if (this.sceneType == 0)
uni.$track.add({
eventCode: 'app_product_Introduction'
}) //轻改场景不埋点
this.previewOff = true
this.$emit('swiperClick', e)
},
previewHandler(name, off = false) {
this.previewOff = off
this.$emit(name)
},
start() {
const { sceneType } = this
if (sceneType == 7) return //二手车无接待功能
uni.$track.add({
eventCode: 'app_reception_begins'
})
this.$emit('start')
},
async updateApp(requested = false) {
if (!requested) await uni.$api.systemApi.getMockData(true)
this.checkVersion()
},
async entranceClick(item) {
console.log(item, 'item')
// 清除评估单的图片视频资源缓存
const noInterceptPage = ['DailyReport', 'DeliveryManagement', 'ReportManagement', 'WageAppeal','InspectionReport'],
{ sceneType } = this
if (!noInterceptPage.includes(item.name)) {
if (sceneType != 7) {
// if (await this.inspectionOfProhibitionBill()) return
// 检查是否限制录单
const res = await this.getLimitRecord()
if (res.lockOrder) {
this.showStudyPermissionPopup = true
this.lockReason = res.lockReason
return
}
const { abnormalOrderNum, lockOrderFlag } = await this.getAbnormalOrderLock()
if (abnormalOrderNum > 0 && lockOrderFlag === 'Y') {
this.showErrorOrderPopup = true
this.abnormalOrderCount = abnormalOrderNum
return
}
}
if (await this.checkDailyReport(sceneType != 7)) return
}
if (item.name === 'EvaluationFormList') {
mediaResourceManager.cleanupExpired()
uni.navigateTo({
url: `/pages/evaluationForm/index`
})
return
}
if (item.name === 'ReportManagement') {
const res = await uni.$api.usedCarApi.checkVisitButton({
buttonCode: 'quotation'
})
if (!res.data.data) {
uni.showToast({
title: '功能暂未开放',
icon: 'none'
})
return
}
}
if (item.page)
return uni.navigateTo({
url: item.page
})
let pageName = {
0: 'equity',
1: 'boutique',
7: 'usedCar'
}[this.sceneType]
uni.navigateTo({
url: `/pages/${pageName}/tool/index?componentName=${item.name}`
})
},
async getActivityMessage() {
this.$store.dispatch('setActivityWindowPopCount', 0)
const { sceneType } = this
if (sceneType == 7) return // 二手车业务无活动中心
const data = await uni.$api.activityApi.getActivityMessagePopUpWindow({
businessType: sceneType
})
if (data) this.$refs.activityPopup.open(data)
},
closeActivityCenter() {
this.$refs.activityPopup.close()
},
async JumpActivityCenter(data) {
const { activityId } = data,
{ shopMerchantId } = uni.$storage.get('userInfo'),
{ sceneType } = this,
res = await uni.$api.activityApi.getActivityDetail({
sceneType,
id: activityId,
merchantId: shopMerchantId
})
if (!res) {
this.errorMsg = '暂无该活动查看权限'
this.$refs.errorRef.open()
}
this.$refs.leftBox.handleActivityCenter()
},
handleErrorOrderPopupSure() {
let pageName = {
0: 'equity',
1: 'boutique'
}[this.sceneType]
uni.navigateTo({
url: `/pages/${pageName}/tool/index?componentName=OrderManagement`
})
},
handleUploadMessageNew(event) {
FileUploadManager.handleWebViewMessage(event)
},
handleTouchStart() {
uni.$emit('reset_timeout')
}
}
}
</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(68);
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: 2;
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 {
width: 100%;
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)});
.message-box {
height: 100%;
}
}
.content-left,
.content-right {
height: 100%;
flex-shrink: 0;
}
.content-left {
width: toRpx(1210);
.module-box {
height: toRpx(664);
margin-bottom: toRpx(48);
}
.tool-box {
height: calc(100% - #{toRpx(712)});
.content-box {
width: calc(100% - #{toRpx(96)});
margin: 0 toRpx(48);
}
}
}
.content-right {
width: calc(100% - #{toRpx(1322)});
// width: toRpx(800);
}
}
.app-content-box {
width: 100%;
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;
}
.error-order-title {
text-align: center;
color: #333333;
font-size: toRpx(40);
font-weight: 500;
}
.error-order-content {
text-align: center;
color: #666666;
font-size: toRpx(32);
font-weight: 400;
margin-top: toRpx(16);
}
.error-order-footer {
margin-top: toRpx(64);
margin-bottom: toRpx(48);
width: 100%;
.cancel {
height: toRpx(88);
border-radius: toRpx(64);
opacity: 1;
line-height: toRpx(88);
background: #f0f1f5;
width: toRpx(344);
text-align: center;
color: #1a1a1a;
font-size: toRpx(32);
font-weight: 400;
}
.sure {
height: toRpx(88);
border-radius: toRpx(64);
opacity: 1;
line-height: toRpx(88);
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #fff;
font-size: toRpx(32);
font-weight: 500;
width: 100%;
text-align: center;
margin-left: toRpx(32);
margin-right: toRpx(32);
}
}
</style>