fhrons-mobile-next 2.0.0 → 2.0.1

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.
Files changed (92) hide show
  1. package/.env.poc +8 -0
  2. package/assets/css/colors.js +6 -0
  3. package/assets/css/customVant.less +60 -0
  4. package/assets/css/extra.css +32 -0
  5. package/assets/css/global.css +1 -0
  6. package/assets/css/global.less +1637 -0
  7. package/assets/css/index.js +63 -0
  8. package/assets/css/static.less +607 -0
  9. package/assets/js/func.js +361 -0
  10. package/assets/js/globalData.js +18 -0
  11. package/assets/js/qywxapi.js +484 -0
  12. package/{packages → assets/js}/storage.js +1 -20
  13. package/assets/js/upload.js +269 -0
  14. package/assets/js/validate.js +48 -0
  15. package/assets/js/vant.js +39 -0
  16. package/assets/js/wxapi.js +297 -0
  17. package/assets/vantLang/index.js +172 -0
  18. package/assets/vantLang/lib/en-US.js +95 -0
  19. package/assets/vantLang/lib/es-ES.js +95 -0
  20. package/assets/vantLang/lib/pt-PT.js +96 -0
  21. package/assets/vantLang/lib/zh-CN.js +96 -0
  22. package/assets/vantLang/lib/zh-HK.js +96 -0
  23. package/assets/vantLang/locales/en_US.js +102 -0
  24. package/assets/vantLang/locales/es_ES.js +102 -0
  25. package/assets/vantLang/locales/index.js +12 -0
  26. package/assets/vantLang/locales/pt_PT.js +102 -0
  27. package/assets/vantLang/locales/zh_CN.js +102 -0
  28. package/assets/vantLang/locales/zh_T.js +102 -0
  29. package/babel.config.js +15 -0
  30. package/fhcommon/index.js +33 -0
  31. package/fhcommon/package.json +40 -0
  32. package/index.js +68 -33
  33. package/inject-env-plugin.js +29 -0
  34. package/package.json +46 -32
  35. package/packages/areaMobile/index.js +5 -0
  36. package/packages/areaMobile/index.vue +260 -0
  37. package/packages/autoGraph/VueEsign.vue +309 -0
  38. package/packages/autoGraph/index.js +5 -0
  39. package/packages/autoGraph/index.vue +472 -0
  40. package/packages/commonForm/CommonAsyncAreaPicker.vue +223 -0
  41. package/packages/commonForm/CommonDatePicker.vue +152 -0
  42. package/packages/commonForm/CommonForm.vue +786 -0
  43. package/packages/commonForm/CommonFullTimePicker.vue +137 -0
  44. package/packages/commonForm/CommonSinglePicker.vue +121 -0
  45. package/packages/commonForm/CommonYearMonthPicker.vue +127 -0
  46. package/packages/commonForm/index.js +33 -0
  47. package/packages/dialog/index.js +32 -0
  48. package/packages/dialog/index.vue +379 -0
  49. package/packages/index.js +7 -3
  50. package/packages/introduce/index.js +5 -0
  51. package/packages/introduce/index.vue +31 -0
  52. package/packages/loading/Loading.vue +70 -0
  53. package/packages/loading/index.js +43 -0
  54. package/packages/mindMap/index.js +5 -0
  55. package/packages/mindMap/index.vue +437 -0
  56. package/packages/pdfViewer/index.js +12 -0
  57. package/packages/pdfViewer/index.vue +131 -0
  58. package/packages/sharePanel/SheetPanel.vue +316 -0
  59. package/packages/sharePanel/index.js +5 -0
  60. package/packages/sharePanel/index.vue +476 -0
  61. package/packages/sharePanel/props.js +58 -0
  62. package/packages/sharePanel/utils/QyWxShareMixin.js +93 -0
  63. package/packages/sharePanel/utils/shareWay.js +81 -0
  64. package/packages/theme/index copy.js +89 -0
  65. package/packages/theme/index.js +38 -0
  66. package/packages/theme/theme.css +910 -0
  67. package/packages/theme/theme.less +26 -0
  68. package/packages/uploadFile/VanUploadFile.vue +80 -0
  69. package/packages/uploadFile/index.js +5 -0
  70. package/packages/uploadFile/index.vue +725 -0
  71. package/packages/uploadFile/vanUpload.js +5 -0
  72. package/packages/verify/Verify/VerifyPoints.vue +247 -0
  73. package/packages/verify/Verify/VerifySlide.vue +364 -0
  74. package/packages/verify/index.js +5 -0
  75. package/packages/verify/index.vue +416 -0
  76. package/packages/verify/utils/verify.js +53 -0
  77. package/packages/videoPage/index.js +5 -0
  78. package/packages/videoPage/index.vue +405 -0
  79. package/plugins/sensors/fhsensors.js +84 -0
  80. package/plugins/sensors/sensors.js +175 -0
  81. package/plugins/sensors/sensorsFun.js +1387 -0
  82. package/fhrons-mobile-next-2.0.0.tgz +0 -0
  83. package/packages/fhImage/index.js +0 -5
  84. package/packages/fhImage/index.vue +0 -57
  85. package/packages/fhPresetImage/index.js +0 -5
  86. package/packages/fhPresetImage/index.vue +0 -39
  87. package/packages/html2canvas/index.js +0 -29
  88. package/upload copy.js +0 -468
  89. package/utils/tools.js +0 -22
  90. /package/{dist → fhcommon/dist}/fhcommon.min.js +0 -0
  91. /package/{dist → fhcommon/dist}/fhcommon.min.js.LICENSE.txt +0 -0
  92. /package/{upload.js → fhcommon/upload.js} +0 -0
@@ -0,0 +1,405 @@
1
+ <template>
2
+ <div id="VideoPage" ref="videoCom" :class="[radius ? 'br8 over-hidden' : '']">
3
+ <video-player
4
+ ref="videoPlayer"
5
+ class="video-player vjs-custom-skin"
6
+ :playsinline="true"
7
+ :options="playerOptions"
8
+ :webkit-playsinline="true"
9
+ @ended="onPlayerEnded($event)"
10
+ @ready="playerReadied($event)"
11
+ @timeupdate="onPlayerTimeupdate($event)"
12
+ @play="onPlayerPlay($event)"
13
+ @fullscreenchange="onDefaultFullScreenchange($event)"
14
+ />
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ import { isAndroid } from '../../assets/js/validate';
20
+ import { mapState } from 'vuex';
21
+ Vue.use(VueVideoPlayer);
22
+ export default {
23
+ // 组件名称
24
+ name: 'VideoPage',
25
+ props: {
26
+ videoObj: {
27
+ type: Object,
28
+ default: () => {}
29
+ },
30
+ auto: {
31
+ type: Boolean,
32
+ default: () => false
33
+ },
34
+ radius: {
35
+ type: Boolean,
36
+ default: () => false
37
+ },
38
+ aspectRatio: {
39
+ type: String,
40
+ default: () => '16:9'
41
+ },
42
+ needRecord: {
43
+ type: Boolean,
44
+ default: () => true
45
+ }
46
+ },
47
+ // 组件状态值
48
+ data() {
49
+ return {
50
+ playerOptions: {
51
+ playbackRates: [0.5, 1.0, 1.25, 1.5, 2.0], // 播放速度
52
+ autoplay: this.auto, // 如果true,浏览器准备好时开始回放。
53
+ muted: false, // 默认情况下将会消除任何音频。
54
+ loop: false, // 导致视频一结束就重新开始。
55
+ preload: 'auto', // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
56
+ language: 'zh-CN',
57
+ aspectRatio: this.aspectRatio, // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
58
+ fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
59
+ sources: [
60
+ {
61
+ type: '', // 这里的种类支持很多种:基本视频格式、直播、流媒体等,具体可以参看git网址项目
62
+ src: '' // url地址
63
+ }
64
+ ],
65
+ poster: '', // 你的封面地址
66
+ notSupportedMessage: this.$t('aqcomponents.videopage.1c7h0m'), // 允许覆盖Video.js无法播放媒体源时显示的默认信息。
67
+ controlBar: {
68
+ timeDivider: true,
69
+ durationDisplay: true,
70
+ remainingTimeDisplay: true,
71
+ fullscreenToggle: false // 全屏按钮
72
+ },
73
+ asked: false
74
+ },
75
+ showTip: false,
76
+ gklog: '0', // 视频观看时长
77
+ close_icon: 'https://dop-pro-1251973116.file.myqcloud.com/upload/img/funzg/icon-gaunbi.svg',
78
+ isFullScreen: false,
79
+ clickCount: 0
80
+ };
81
+ },
82
+ // 计算属性
83
+ computed: {
84
+ currentUrl() {
85
+ return this.playerOptions.sources[0].src;
86
+ },
87
+ player() {
88
+ return this.$refs.videoPlayer.player;
89
+ },
90
+ playerWidth() {
91
+ const currentVideoDOM = this.$refs.videoPlayer.$el.querySelector('.video-js');
92
+ return {
93
+ playerWidth: currentVideoDOM.clientWidth,
94
+ clickCount: this.clickCount
95
+ };
96
+ },
97
+ ...mapState({
98
+ userInfo: state => state.user.userInfo
99
+ })
100
+ },
101
+ // 侦听器
102
+ watch: {
103
+ videoObj: {
104
+ handler(newVal, oldVal) {
105
+ this.gklog = '';
106
+ if (newVal.type) this.$set(this.playerOptions.sources[0], 'type', newVal.type);
107
+ this.$set(this.playerOptions.sources[0], 'src', newVal.videoUrl);
108
+ this.$set(this.playerOptions, 'poster', newVal.img);
109
+ },
110
+ immediate: true
111
+ },
112
+ currentUrl: {
113
+ handler(newVal, oldVal) {
114
+ setTimeout(_ => {
115
+ if (this.auto) {
116
+ document.querySelector('.vjs-play-control').click();
117
+ }
118
+ }, 100);
119
+ },
120
+ deep: true
121
+ }
122
+ },
123
+ /**
124
+ * 组件实例创建完成,属性已绑定,但DOM还未生成,$ el属性还不存在
125
+ */
126
+ created() {
127
+ // 判断当前是app还是h5
128
+ const { isApp, isIOS, isAndroid } = this.$globalData;
129
+ if (isIOS || isAndroid) {
130
+ window.appToJSNetStatus = this.appToJSNetStatus;
131
+ window.AppToJSSaveVideoDuration = this.AppToJSSaveVideoDuration;
132
+ window.AppToJSVideoBack = this.AppToJSVideoBack;
133
+ }
134
+ if (isApp) {
135
+ // app端,刻意练习,要求全屏
136
+ if (this.$route.name === 'ExerciseTaskDetails' || this.$route.name === 'ExerciseTaskClockInRecord' || this.$route.name === 'ExerciseTaskClockIn') {
137
+ this.$set(this.playerOptions.controlBar, 'fullscreenToggle', true);
138
+ }
139
+ }
140
+ },
141
+ deactivated() {
142
+ this.$refs.videoPlayer.player.pause();
143
+ },
144
+ // 组件方法
145
+ methods: {
146
+ addEvent() {
147
+ },
148
+ allClick(e) {
149
+ this.clickCount++;
150
+ },
151
+ appToJSNetStatus(data) {
152
+ const result = +data === 2 ? 'wifi' : data === 1 ? this.$t('aqcomponents.videopage.2p4g36') : this.$t('aqcomponents.videopage.73c556');
153
+ // 0 无网 2wifi 1移动网络
154
+ if (result === this.$t('aqcomponents.videopage.2p4g36')) {
155
+ this.$toast(this.$t('aqcomponents.videopage.7ikbgu'));
156
+ } else if (result === 'wifi') {
157
+ this.asked = true;
158
+ }
159
+ },
160
+ // 继续
161
+ goAhead() {
162
+ this.$refs.videoPlayer.player.play();
163
+ this.asked = true;
164
+ this.showTip = false;
165
+ },
166
+ // 暂停
167
+ pause() {
168
+ this.$refs.videoPlayer.player.pause();
169
+ this.showTip = false;
170
+ },
171
+ // 查询当前网络状态
172
+ getNetWorkState() {
173
+ if (this.$globalData.isAndroid) {
174
+ if (window.android && typeof window.android.getNetWorkState === 'function') {
175
+ const data = window.android.getNetWorkState() + 1;
176
+ const result = +data === 2 ? 'wifi' : data === 1 ? this.$t('aqcomponents.videopage.2p4g36') : this.$t('aqcomponents.videopage.73c556');
177
+ if (result === this.$t('aqcomponents.videopage.2p4g36')) {
178
+ this.$toast(this.$t('aqcomponents.videopage.7ikbgu'));
179
+ } else if (result === 'wifi') {
180
+ this.asked = true;
181
+ }
182
+ }
183
+ } else if (this.$globalData.isIOS) {
184
+ if (window['webkit'] && window.webkit['messageHandlers'] && window.webkit.messageHandlers.videoCheckNet) {
185
+ window.webkit.messageHandlers.videoCheckNet.postMessage('');
186
+ }
187
+ }
188
+ },
189
+ /* 获取视频播放进度 */
190
+ onPlayerTimeupdate(player) {
191
+ if (this.gklog === Math.floor(player.cache_.currentTime)) return;
192
+ this.gklog = parseInt(player.cache_.currentTime);
193
+ if (!this.gklog) return;
194
+ const flag = this.gklog % 10;
195
+ if (flag === 0) {
196
+ this.$emit('videoUpdate', this.gklog);
197
+ }
198
+ },
199
+ // 原生退出全屏
200
+ AppToJSVideoBack(jsonStr) {
201
+ const obj = JSON.parse(jsonStr);
202
+ const { duration = '0' } = obj;
203
+ // 设置视频进度
204
+ this.player.currentTime(duration);
205
+ },
206
+ // 保存播放进度
207
+ AppToJSSaveVideoDuration(duration) {
208
+ this.gklog = duration;
209
+ this.$emit('videoUpdate', this.gklog);
210
+ },
211
+ /* 设置视频进度 */
212
+ playerReadied(player) {
213
+ if (!this.videoObj.duration) return;
214
+ if (this.$globalData.isApp || isAndroid()) {
215
+ this.createFullButton();
216
+ } else {
217
+ this.$set(this.playerOptions.controlBar, 'fullscreenToggle', true);
218
+ }
219
+ player.currentTime(this.videoObj.duration);
220
+ },
221
+ onPlayerPlay() {
222
+ this.$sensors.callTrack('playClick', { model_name: this.$t('aqcomponents.videopage.yhj38i'), viedo_name: this.videoObj?.title || '', viedo_id: this.videoObj?.id || '' });
223
+ this.updateVideoProgress('play');
224
+ if (this.asked) return;
225
+ this.getNetWorkState();
226
+ },
227
+ onPlayerEnded(e) {
228
+ this.$emit('videoEnded');
229
+ },
230
+ updateVideoProgress() {
231
+ if (!this.needRecord || !this.judgeEmpty(this.videoObj)) return;
232
+ const saasId = this.userInfo.saasId;
233
+ const userId = this.userInfo.id || this.userInfo.userId;
234
+ const { id = '', watchStatus = '', courseId = '', title = '' } = this.videoObj;
235
+ // 如果已观看视频,就不执行保存记录
236
+ if (watchStatus === 1) return;
237
+ axios.post(`/gateway/course/cozCourseWatchRecord/saveWatchRecordCount`,{
238
+ id: '',
239
+ saasId,
240
+ userId,
241
+ duration: '0',
242
+ courseId,
243
+ courseName: title,
244
+ courseDetailId: id
245
+ }).then(res => {
246
+ // 保存成功
247
+ this.$emit('updateVideoStatus');
248
+ }).catch(() => {});
249
+ },
250
+ onPlayerFullScreenchange() {
251
+ if (this.isFullScreen) {
252
+ this.exitFullscreen();
253
+ this.isFullScreen = false;
254
+ return;
255
+ }
256
+
257
+ const { watchStatus = '', videoUrl = '', title = '' } = this.videoObj;
258
+ if (this.$globalData.isApp && !this.$globalData.isQyWeiXin) {
259
+ const fullNeed = {
260
+ courseName: title,
261
+ duration: this.gklog + '',
262
+ currentChapter: {
263
+ chapterName: title,
264
+ chapterNo: '1',
265
+ contentAddress: videoUrl,
266
+ contentName: title,
267
+ contentTime: this.player.duration() + '',
268
+ courseChildChapterList: [],
269
+ courseMainId: '961682110418128896',
270
+ coursePurchaseState: '1',
271
+ createdate: '2022-04-18 15:17:03',
272
+ id: '962734854079512576',
273
+ modifydate: '2022-04-18 15:17:03',
274
+ multiPartFlag: '0',
275
+ num: '1',
276
+ sumContentTime: '8',
277
+ duration: this.gklog + ''
278
+ },
279
+ courseChapterList: [],
280
+ isMultiPart: '0',
281
+ currentRate: this.player.playbackRate() + '',
282
+ creatorMessage: {},
283
+ isFollowed: '0',
284
+ studyCount: '0',
285
+ likeState: '0',
286
+ collectState: '0',
287
+ type: '0',
288
+ courseStudyState: watchStatus
289
+ };
290
+ if (
291
+ this.$globalData.isIOS && window.webkit
292
+ ) {
293
+ window.webkit.messageHandlers.JSToAppFullScreen.postMessage(fullNeed);
294
+ this.player.pause();
295
+ } else if (
296
+ this.$globalData.isAndroid && window.android
297
+ ) {
298
+ window.android.JSToAppFullScreen(JSON.stringify(fullNeed));
299
+ this.player.pause();
300
+ }
301
+ } else {
302
+ const playerDom = this.$refs.videoPlayer.$el.querySelector('.video-js');
303
+ this.launchFullscreen(playerDom);
304
+ this.isFullScreen = true;
305
+ }
306
+ },
307
+
308
+ // 判断各种浏览器,找到正确的方法
309
+ launchFullscreen(element) {
310
+ if (element.requestFullscreen) {
311
+ element.requestFullscreen();
312
+ } else if (element.mozRequestFullScreen) {
313
+ element.mozRequestFullScreen();
314
+ } else if (element.webkitRequestFullscreen) {
315
+ element.webkitRequestFullscreen();
316
+ } else if (element.msRequestFullscreen) {
317
+ element.msRequestFullscreen();
318
+ }
319
+ },
320
+ // 判断浏览器种类
321
+ exitFullscreen() {
322
+ // 退出视频时暂停播放视频
323
+ this.$refs.videoPlayer.player.pause();
324
+ if (document.exitFullscreen) {
325
+ document.exitFullscreen();
326
+ } else if (document.mozCancelFullScreen) {
327
+ document.mozCancelFullScreen();
328
+ } else if (document.webkitExitFullscreen) {
329
+ document.webkitExitFullscreen();
330
+ }
331
+ },
332
+ // 创建全屏按钮
333
+ createFullButton() {
334
+ const Button = videojs.getComponent('Button');
335
+ const fullButton = videojs.extend(Button, {
336
+ constructor: function(player, options) {
337
+ Button.apply(this, arguments);
338
+ this.addClass('fullscreen-enter');
339
+ },
340
+ handleClick: () => {
341
+ // 绑定点击事件
342
+ this.onPlayerFullScreenchange();
343
+ },
344
+ buildCSSClass: function() {
345
+ return 'vjs-icon-custombutton vjs-control vjs-button';
346
+ }
347
+ });
348
+ // 注册
349
+ videojs.registerComponent('fullButton', fullButton);
350
+ this.$nextTick(() => {
351
+ // 添加到controlBar中
352
+ this.player.getChild('controlBar').addChild('fullButton');
353
+ });
354
+ },
355
+ // 自带全屏按钮的点击事件
356
+ onDefaultFullScreenchange() {
357
+ }
358
+ }
359
+ };
360
+ </script>
361
+ <style scoped lang="less">
362
+ #VideoPage{
363
+ .landScapeY {
364
+ position: absolute;
365
+ z-index: 100;
366
+ top: 0;
367
+ left: 100vw;
368
+ width: 100vh;
369
+ height: 100vw;
370
+ transform: rotate(90deg);
371
+ transform-origin: 0 0;
372
+ }
373
+ .dialog-button {
374
+ width: 124px;
375
+ height: 44px;
376
+ box-sizing: border-box;
377
+ padding: 14px 46px;
378
+ }
379
+ .close-icon {
380
+ width: 24px;
381
+ height: 24px;
382
+ left: 50%;
383
+ transform: translateX(-50%);
384
+ bottom: -40px;
385
+ }
386
+ .dialog {
387
+ overflow: visible;
388
+ }
389
+ /deep/ .video-js{
390
+ .fullscreen-enter:before{
391
+ position: absolute;
392
+ width: 100%;
393
+ display: block;
394
+ height: 100%;
395
+ content: '';
396
+ left: 0;
397
+ top: 0;
398
+ background-image: url('https://dop-pro-1251973116.file.myqcloud.com/upload/img/funzg/fullscreen.png');
399
+ background-size: 20px 20px;
400
+ background-repeat: no-repeat;
401
+ background-position: center;
402
+ }
403
+ }
404
+ }
405
+ </style>
@@ -0,0 +1,84 @@
1
+ import { getStorage } from 'assets/js/storage'
2
+ import i18n from 'assets/vantLang';
3
+
4
+ function getPlatFormCode() {
5
+ const userGlobalGist = getStorage({ name: 'userGlobalGist' }) || {};
6
+ const loginResponseDO = userGlobalGist.loginResponseDO || {};
7
+ const platformCode = getStorage({ name: 'platformCode' });
8
+ const isShared = getStorage({ key: 'isTourists', type: 'session' });
9
+ const userHrefPlatformCode = getStorage({ name: 'userHrefPlatformCode' });
10
+ const finalPlatformCode = (isShared || userHrefPlatformCode) ? (platformCode || loginResponseDO?.platformCode || '00') : (loginResponseDO?.platformCode || platformCode || '00');
11
+ return finalPlatformCode; // 00 表示元租户;
12
+ }
13
+
14
+ function getPlatSaasId() {
15
+ const saasId = getStorage({ name: 'saasId' });
16
+ const userInfo = getStorage({ name: 'userInfo' });
17
+ return userInfo?.saasId || saasId || '000000';// 000000 表示元租户;
18
+ }
19
+
20
+ export default {
21
+ initSensorsData() {
22
+ function isWeiXin() {
23
+ var ua = window.navigator.userAgent.toLowerCase();
24
+ if (ua.match(/MicroMessenger/i) == 'micromessenger' && (ua.match(/wxwork/i) != 'wxwork')) {
25
+ return true;
26
+ }
27
+ return false;
28
+ }
29
+ function isQYWeiXin() {
30
+ var ua = window.navigator.userAgent.toLowerCase();
31
+ if ((ua.match(/MicroMessenger/i) == 'micromessenger') && (ua.match(/wxwork/i) == 'wxwork')) {
32
+ return true;
33
+ }
34
+ return false;
35
+ }
36
+
37
+ function isIOS() {
38
+ var ua = window.navigator.userAgent.toLowerCase();
39
+ if (ua.match(/iphone|ipad|ipod/)) {
40
+ return true;
41
+ }
42
+ return false;
43
+ }
44
+
45
+ function isAndroid() {
46
+ var ua = window.navigator.userAgent.toLowerCase();
47
+ if (ua.match(/android/)) {
48
+ return true;
49
+ }
50
+ return false;
51
+ }
52
+ const sensors = window['fhronsSensorsAnalytic202402'];
53
+ const interfaceAddress = `${window.location.origin}/gateway/datareport/behavior/getBehaviorData`;
54
+ const localTerminal = getStorage({ name: 'terminal', type: 'session' });
55
+ const terminal = localTerminal ? (localTerminal === 'normal' ? 'WECHAT' : localTerminal.toLowerCase() === 'pub' ? 'PUB' : localTerminal.toLowerCase() === 'app' ? 'APP' : '') : '';
56
+
57
+ sensors.initFhSensors({
58
+ sensorsUrl: interfaceAddress,
59
+ send_type: 'beacon',
60
+ show_log: false,
61
+ viewDuration: 10000
62
+ });
63
+ sensors.registerPage({
64
+ product_name: (function() {
65
+ if (getPlatFormCode() == '2') {
66
+ return i18n.t('api.sesnsor_request.w9jfj8');
67
+ }
68
+ return getStorage({ name: 'smPlatformInfoDto' })?.smSaasPlatformDO?.platformName;
69
+ })(),
70
+ refer_product_name: (function() {
71
+ if (isWeiXin()) {
72
+ return getStorage({ name: 'smPlatformInfoDto' })?.smSaasPlatformDO?.platformName + i18n.t('applyprocess.examine.qi3cfh');
73
+ } else if (isQYWeiXin()) {
74
+ return getStorage({ name: 'smPlatformInfoDto' })?.smSaasPlatformDO?.platformName + i18n.t('utils.mockdata.unoim4');
75
+ } else if (isAndroid() || isIOS()) {
76
+ return getStorage({ name: 'smPlatformInfoDto' })?.smSaasPlatformDO?.platformName + (terminal || 'APP');
77
+ }
78
+ return getStorage({ name: 'smPlatformInfoDto' })?.smSaasPlatformDO?.platformName + (terminal || 'MOBILE_WEB');
79
+ })(),
80
+ saas_id: getPlatSaasId(),
81
+ terminal: terminal || (isAndroid() ? 'Android' : isIOS() ? 'IOS' : isWeiXin() ? 'PUB' : isQYWeiXin() ? 'WECHAT' : 'MOBILE_WEB')
82
+ });
83
+ }
84
+ };
@@ -0,0 +1,175 @@
1
+ import i18n from 'assets/vantLang';
2
+ import sensorsFunc from './sensorsFun';
3
+ import { getStorage } from 'assets/js/storage'
4
+ function judgeHkp() {
5
+ return process.env.VUE_APP_ENV_CONFIG.includes('hk') || window.location.origin.includes('openuat.fhrons.net') || window.location.origin.includes('open.avantech.io');
6
+ }
7
+ function judgeNotHk() {
8
+ return !process.env.VUE_APP_ENV_CONFIG.includes('hk') && !window.location.origin.includes('openuat.fhrons.net') && !window.location.origin.includes('open.avantech.io')
9
+ }
10
+ function getPlatFormCode() {
11
+ const userGlobalGist = getStorage({ name: 'userGlobalGist' }) || {};
12
+ const loginResponseDO = userGlobalGist.loginResponseDO || {};
13
+ const platformCode = getStorage({ name: 'platformCode' });
14
+ const isShared = getStorage({ key: 'isTourists', type: 'session' });
15
+ const userHrefPlatformCode = getStorage({ name: 'userHrefPlatformCode' });
16
+ const finalPlatformCode = (isShared || userHrefPlatformCode) ? (platformCode || loginResponseDO?.platformCode || '00') : (loginResponseDO?.platformCode || platformCode || '00');
17
+ return finalPlatformCode; // 00 表示元租户;
18
+ }
19
+
20
+ function getPlatSaasId() {
21
+ const saasId = getStorage({ name: 'saasId' });
22
+ const userInfo = getStorage({ name: 'userInfo' });
23
+ return userInfo?.saasId || saasId || '000000';// 000000 表示元租户;
24
+ }
25
+ export default {
26
+ baseParam: null,
27
+ sensors: null,
28
+ getSensors() {
29
+ return this.sensors;
30
+ },
31
+ initBaseParam(baseParam) {
32
+ if (this.baseParam === null) {
33
+ this.baseParam = baseParam;
34
+ } else {
35
+ this.baseParam = Object.assign(this.baseParam, baseParam);
36
+ }
37
+ },
38
+ getBaseParam() {
39
+ return this.baseParam;
40
+ },
41
+ initSensorsData() {
42
+ // 埋点
43
+ function isWeiXin() {
44
+ var ua = window.navigator.userAgent.toLowerCase();
45
+ if (ua.match(/MicroMessenger/i) == 'micromessenger' && (ua.match(/wxwork/i) != 'wxwork')) {
46
+ return true;
47
+ }
48
+ return false;
49
+ }
50
+ function isQYWeiXin() {
51
+ var ua = window.navigator.userAgent.toLowerCase();
52
+ if ((ua.match(/MicroMessenger/i) == 'micromessenger') && (ua.match(/wxwork/i) == 'wxwork')) {
53
+ return true;
54
+ }
55
+ return false;
56
+ }
57
+
58
+ function isIOS() {
59
+ var ua = window.navigator.userAgent.toLowerCase();
60
+ if (ua.match(/iphone|ipad|ipod/)) {
61
+ return true;
62
+ }
63
+ return false;
64
+ }
65
+
66
+ function isAndroid() {
67
+ var ua = window.navigator.userAgent.toLowerCase();
68
+ if (ua.match(/android/)) {
69
+ return true;
70
+ }
71
+ return false;
72
+ }
73
+ var sensors = window['sensorsDataAnalytic201505'];
74
+ if (!sensors || judgeHkp()) return;
75
+ const sensorsUrl = process.env.VUE_APP_ENV_CONFIG === 'pro'
76
+ ? 'https://track.fhrons.com/sa?project=production' : 'https://track.fhrons.com/sa?project=default';
77
+ const heatmap_url = 'https://dop-pro-1251973116.file.myqcloud.com/upload/jsfile/sensors/heatmap.js';
78
+ const localTerminal = getStorage({ name: 'terminal', type: 'session' });
79
+ const terminal = localTerminal ? (localTerminal === 'normal' ? 'WECHAT' : localTerminal.toLowerCase() === 'pub' ? 'PUB' : localTerminal.toLowerCase() === 'app' ? 'APP' : '') : '';
80
+
81
+ sensors.init({
82
+ server_url: sensorsUrl,
83
+ heatmap_url,
84
+ heatmap: {
85
+ clickmap: 'default',
86
+ scroll_notice_map: 'default',
87
+ collect_tags: {
88
+ li: true,
89
+ img: true,
90
+ svg: true,
91
+ get_vtrack_config: true
92
+ }
93
+ },
94
+ is_track_single_page: true,
95
+ use_client_time: true,
96
+ send_type: 'beacon',
97
+ show_log: false,
98
+ app_js_bridge: true
99
+ });
100
+ sensors.registerPage({
101
+ product_name: function() {
102
+ if (getPlatFormCode() == '2') {
103
+ return i18n.t('api.sesnsor_request.w9jfj8');
104
+ }
105
+ return getStorage({ name: 'smPlatformInfoDto' })?.smSaasPlatformDO?.platformName;
106
+ },
107
+ refer_product_name: function() {
108
+ if (isWeiXin()) {
109
+ return getStorage({ name: 'smPlatformInfoDto' })?.smSaasPlatformDO?.platformName + i18n.t('applyprocess.examine.qi3cfh');
110
+ } else if (isQYWeiXin()) {
111
+ return getStorage({ name: 'smPlatformInfoDto' })?.smSaasPlatformDO?.platformName + i18n.t('utils.mockdata.unoim4');
112
+ } else if (isAndroid() || isIOS()) {
113
+ return getStorage({ name: 'smPlatformInfoDto' })?.smSaasPlatformDO?.platformName + (terminal || 'APP');
114
+ }
115
+ return getStorage({ name: 'smPlatformInfoDto' })?.smSaasPlatformDO?.platformName + (terminal || 'MOBILE_WEB');
116
+ },
117
+ saas_id: getPlatSaasId()
118
+ });
119
+ sensors.quick('autoTrack');
120
+ this.sensors = sensors;
121
+ },
122
+ getParam(param) {
123
+ const baseParam = Object.assign({}, this.baseParam);
124
+ if (baseParam) {
125
+ return Object.assign(baseParam, param);
126
+ }
127
+ return param;
128
+ },
129
+ separator(key, param, target) {
130
+ if (target) {
131
+ if (key === 'coreButtonClickNew' || key === 'coreButtonClickTeam' || key === 'coreButtonClickSale') {
132
+ target.track('coreButtonClick', param);
133
+ } else if (key === 'helpPageNew') {
134
+ target.track('helpPage', param);
135
+ } else if (key === 'searchClickTeam') {
136
+ target.track('searchClick', param);
137
+ } else if (key === 'searchReturnTeam') {
138
+ target.track('searchReturn', param);
139
+ } else if (key === 'digitaltabClick') {
140
+ target.track('tabClick', param);
141
+ } else {
142
+ target.track(key, param);
143
+ }
144
+ }
145
+ },
146
+ callTrack(methodName, _this, callParamFunc) {
147
+ const thirdSensors = window['sensorsDataAnalytic201505'];
148
+ if (thirdSensors && judgeNotHk()) {
149
+ if (!this.sensors) {
150
+ console.error('sensors is null ,please init first');
151
+ this.initSensorsData();
152
+ }
153
+ if (!methodName) {
154
+ this.sensors.login(_this);
155
+ return;
156
+ }
157
+ }
158
+ const rtnObj = sensorsFunc[methodName] && sensorsFunc[methodName].apply(_this, [methodName, _this]) || { key: methodName, param: _this };
159
+ // {key,param}
160
+ let { key, param } = rtnObj;
161
+ if (!key || !param) {
162
+ if (judgeHkp()) return;
163
+ alert('key or param is null');
164
+ return;
165
+ }
166
+ if (callParamFunc) {
167
+ param = callParamFunc.apply(_this, [param]);
168
+ }
169
+ if (thirdSensors && judgeNotHk()) {
170
+ this.separator(key, param, this.sensors);
171
+ }
172
+ const fhsensors = window['fhronsSensorsAnalytic202402'];
173
+ this.separator(key, param, fhsensors);
174
+ }
175
+ };