overseas 2.0.7

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 (98) hide show
  1. package/README.md +12 -0
  2. package/package.json +80 -0
  3. package/packages/.DS_Store +0 -0
  4. package/packages/base/bottom-popup/index.js +10 -0
  5. package/packages/base/bottom-popup/src/bottom-popup.vue +151 -0
  6. package/packages/base/button/index.js +10 -0
  7. package/packages/base/button/src/button.vue +108 -0
  8. package/packages/base/dialog/index.js +10 -0
  9. package/packages/base/dialog/src/dialog.vue +173 -0
  10. package/packages/base/icon/index.js +10 -0
  11. package/packages/base/icon/src/icon.vue +15 -0
  12. package/packages/base/image/index.js +10 -0
  13. package/packages/base/image/src/image.vue +40 -0
  14. package/packages/base/material-list/index.js +10 -0
  15. package/packages/base/material-list/src/material-list.vue +48 -0
  16. package/packages/base/popup/index.js +10 -0
  17. package/packages/base/popup/src/popup.vue +44 -0
  18. package/packages/business/basic-image/index.js +10 -0
  19. package/packages/business/basic-image/src/basicImage.vue +51 -0
  20. package/packages/business/bottom-fixed-button/index.js +10 -0
  21. package/packages/business/bottom-fixed-button/src/bottomFixedButton.vue +66 -0
  22. package/packages/business/class-choose/index.js +10 -0
  23. package/packages/business/class-choose/src/courseCard.vue +142 -0
  24. package/packages/business/class-choose/src/img/icon_close_bottomcard.svg +14 -0
  25. package/packages/business/class-choose/src/img/icon_date.svg +21 -0
  26. package/packages/business/class-choose/src/img/icon_full.svg +27 -0
  27. package/packages/business/class-choose/src/img/icon_full_EL.svg +49 -0
  28. package/packages/business/class-choose/src/img/icon_selected.svg +18 -0
  29. package/packages/business/class-choose/src/img/icon_star_selected.svg +13 -0
  30. package/packages/business/class-choose/src/img/icon_star_unselect.svg +13 -0
  31. package/packages/business/class-choose/src/index.vue +316 -0
  32. package/packages/business/grade-panel/index.js +10 -0
  33. package/packages/business/grade-panel/src/gradePanel.vue +150 -0
  34. package/packages/business/material-panel/index.js +10 -0
  35. package/packages/business/material-panel/src/index.vue +136 -0
  36. package/packages/business/notified-panel/index.js +10 -0
  37. package/packages/business/notified-panel/src/areaCodeList.js +181 -0
  38. package/packages/business/notified-panel/src/index.vue +491 -0
  39. package/packages/business/page-render/index.js +10 -0
  40. package/packages/business/page-render/src/pageRender.vue +73 -0
  41. package/packages/business/registration-panel/index.js +10 -0
  42. package/packages/business/registration-panel/src/areaCodeList.js +181 -0
  43. package/packages/business/registration-panel/src/img/icon_off.png +0 -0
  44. package/packages/business/registration-panel/src/img/icon_on.png +0 -0
  45. package/packages/business/registration-panel/src/index.vue +329 -0
  46. package/packages/business/registration-panel/src/languageList.js +41 -0
  47. package/packages/business/selector-panel/index.js +10 -0
  48. package/packages/business/selector-panel/src/selectorPanel.vue +134 -0
  49. package/packages/business/student-info/index.js +10 -0
  50. package/packages/business/student-info/src/api/index.js +10 -0
  51. package/packages/business/student-info/src/config.js +11 -0
  52. package/packages/business/student-info/src/studentInfo.vue +145 -0
  53. package/packages/business/switch-student/index.js +10 -0
  54. package/packages/business/switch-student/src/api/index.js +28 -0
  55. package/packages/business/switch-student/src/switchStudent.vue +245 -0
  56. package/packages/business/tips-popup/index.js +10 -0
  57. package/packages/business/tips-popup/src/tipsPopup.vue +76 -0
  58. package/packages/business/user-login/index.js +10 -0
  59. package/packages/business/user-login/src/api/index.js +23 -0
  60. package/packages/business/user-login/src/img/logo.png +0 -0
  61. package/packages/business/user-login/src/index.vue +149 -0
  62. package/packages/theme-style/package.json +38 -0
  63. package/packages/theme-style/src/bottom-fixed-button.scss +31 -0
  64. package/packages/theme-style/src/bottom-popup.scss +87 -0
  65. package/packages/theme-style/src/button.scss +110 -0
  66. package/packages/theme-style/src/class-choose.scss +251 -0
  67. package/packages/theme-style/src/common/popup.scss +39 -0
  68. package/packages/theme-style/src/common/var.scss +6 -0
  69. package/packages/theme-style/src/common.scss +97 -0
  70. package/packages/theme-style/src/dialog.scss +130 -0
  71. package/packages/theme-style/src/grade-panel.scss +76 -0
  72. package/packages/theme-style/src/icon.scss +369 -0
  73. package/packages/theme-style/src/image.scss +8 -0
  74. package/packages/theme-style/src/img/body_bg.png +0 -0
  75. package/packages/theme-style/src/img/pdf.png +0 -0
  76. package/packages/theme-style/src/img/title_bg.png +0 -0
  77. package/packages/theme-style/src/index.scss +20 -0
  78. package/packages/theme-style/src/material-list.scss +118 -0
  79. package/packages/theme-style/src/material-panel.scss +2 -0
  80. package/packages/theme-style/src/notified-panel.scss +207 -0
  81. package/packages/theme-style/src/page-render.scss +3 -0
  82. package/packages/theme-style/src/registration-panel.scss +158 -0
  83. package/packages/theme-style/src/selector-panel.scss +86 -0
  84. package/packages/theme-style/src/student-info.scss +114 -0
  85. package/packages/theme-style/src/switch-student.scss +176 -0
  86. package/packages/theme-style/src/tips-popup.scss +60 -0
  87. package/packages/theme-style/src/user-login.scss +93 -0
  88. package/src/index.js +74 -0
  89. package/src/network/api.js +53 -0
  90. package/src/network/apiUrl.js +65 -0
  91. package/src/utils/dom.js +54 -0
  92. package/src/utils/filters.js +82 -0
  93. package/src/utils/merge.js +16 -0
  94. package/src/utils/phone.js +153 -0
  95. package/src/utils/popup/index.js +115 -0
  96. package/src/utils/popup/popup-manager.js +178 -0
  97. package/src/utils/storage.js +22 -0
  98. package/src/utils/utils.js +49 -0
@@ -0,0 +1,316 @@
1
+ <template>
2
+ <div class="choose-course-wrapper">
3
+ <ts-bottom-popup
4
+ :show.sync="showPop"
5
+ :show-left-icon="false"
6
+ :close-on-click-overlay="true"
7
+ :overlay="false"
8
+ :popup-title="title"
9
+ :show-right-icon="true"
10
+ @right-icon-handler="close"
11
+ >
12
+ <!-- <template v-slot:right-icon>
13
+ <div
14
+ class="header-icon-btn-container success-icon-container"
15
+ @click="close"
16
+ >
17
+ <i class="iconfont icon-close-new-e658" />
18
+ </div>
19
+ </template> -->
20
+ <template v-slot:body>
21
+ <div class="goods-list">
22
+ <div
23
+ v-for="item in goodsList"
24
+ :key="item.id"
25
+ @click="handleClickCourseCard(item)"
26
+ >
27
+ <course-card
28
+ :good-item="item"
29
+ :class-name-option="classNameOption"
30
+ :difficulty-option="difficultyOption"
31
+ :active="item.id === selectedId"
32
+ @enroll="enroll"
33
+ />
34
+ </div>
35
+ </div>
36
+
37
+ <div
38
+ v-show="canUseCount && showVoucher"
39
+ class="font-medium voucher-show-wrapper"
40
+ >
41
+ <div class="voucher-show">
42
+ <span class="voucher-text">You have an {{ currency }}{{ discount }} voucher, sign up now to apply your
43
+ discount!</span>
44
+ <img src="./img/icon_close_bottomcard.svg" @click="closeVoucher">
45
+ </div>
46
+ </div>
47
+ <div
48
+ :class="{'btn-bottom-class-choose':true, 'showBackground': canUseCount}"
49
+ >
50
+ <div class="price">
51
+ <span class="price-top">{{ currency }}{{ (currentSellPrice - discount) | priceUnitConvert(minorUnit, isKeepTwoDecimal) }}
52
+ <s>{{ currency }}{{ currentOrgPrice | priceUnitConvert(minorUnit, isKeepTwoDecimal) }}</s>
53
+ </span>
54
+ <div v-show="canUseCount" class="price-bottom">
55
+ Discounted price
56
+ </div>
57
+ </div>
58
+ <div class="btn-wrapper">
59
+ <button class="btn" @click="enroll">
60
+ {{ enrollText }}
61
+ </button>
62
+ </div>
63
+ </div>
64
+ </template>
65
+ </ts-bottom-popup>
66
+ </div>
67
+ </template>
68
+ <script>
69
+
70
+ import { getCookies } from '../../../../src/utils/utils'
71
+ import TsBottomPopup from '../../../base/bottom-popup'
72
+ import courseCard from './courseCard.vue'
73
+ export default {
74
+ name: "TsTouchCoursesPanel",
75
+ components: {
76
+ TsBottomPopup,
77
+ courseCard,
78
+ },
79
+ props: {
80
+ ids: {
81
+ type: Array,
82
+ default: () => [],
83
+ },
84
+ dataType: {
85
+ // 范围: courseId | packageId
86
+ default: "courseId",
87
+ type: String,
88
+ },
89
+ classNameOption: {
90
+ type: Boolean,
91
+ default: false,
92
+ },
93
+ difficultyOption: {
94
+ type: Boolean,
95
+ default: false,
96
+ },
97
+ name: {
98
+ type: String,
99
+ default: "",
100
+ },
101
+ showRight: {
102
+ default: true,
103
+ type: Boolean,
104
+ },
105
+ talWebhook: {
106
+ type: String,
107
+ default: '',
108
+ },
109
+ talSecret: {
110
+ type: String,
111
+ default: '',
112
+ },
113
+ },
114
+ data() {
115
+ return {
116
+ showPop: false,
117
+ title: "Select course",
118
+ goodsList: [],
119
+ selectedId: "",
120
+ isLogin: getCookies(),
121
+ canUseCount: 0,
122
+ discount: 0,
123
+ currentSellPrice: null,
124
+ currentOrgPrice: null,
125
+ showVoucher: true,
126
+ gradeId: "",
127
+ // 优惠券相关
128
+ products: [],
129
+ courseDetail: {},
130
+ activitySellPrice: null,
131
+ activityInfo: {},
132
+ selectedClass: null,
133
+ }
134
+ },
135
+ computed: {
136
+ //获取货币
137
+ currency() {
138
+ return this.$store.state.basicData.currency[this.$store.state.locale].symbol
139
+ },
140
+ minorUnit() {
141
+ return this.$store.state.basicData.currency[this.$store.state.locale].minorUnit;
142
+ },
143
+ enrollText(){
144
+ return this.$store.state.countryCode === 'uk' ? 'Enrol' : 'Enroll'
145
+ },
146
+ isKeepTwoDecimal(){
147
+ if (this.$store.state.locale === 'uk'){
148
+ return '1'
149
+ } else {
150
+ return '0'
151
+ }
152
+ }
153
+ },
154
+ watch: {
155
+ async selectedId(){
156
+ if (this.isLogin){
157
+ await this.loginSuccess()
158
+ }
159
+ },
160
+ },
161
+ methods: {
162
+ enroll() {
163
+ this.$sensors.track('h5_course_pop_enroll_click', {
164
+ course_pop_type: 2,
165
+ course_id: this.selectedClass.spec.courseId,
166
+ class_id: this.selectedClass.spec.clazzId,
167
+ grade_name: this.selectedClass.spec.gradeName,
168
+ payment: this.selectedClass.sellPrice,
169
+ })
170
+ this.$emit("btn-click", "switch-class", {
171
+ name: this.name,
172
+ skuNo: this.selectedId,
173
+ currentSellPrice: this.currentSellPrice,
174
+ canUseCount: this.canUseCount,
175
+ talWebhook: this.talWebhook,
176
+ talSecret: this.talSecret,
177
+ });
178
+ },
179
+ handleClickCourseCard(selectedItem) {
180
+ this.selectedClass = selectedItem
181
+ this.selectedId = selectedItem.id
182
+ this.currentSellPrice = selectedItem.sellPrice
183
+ this.currentOrgPrice = selectedItem.orgPrice
184
+ },
185
+ close() {
186
+ this.showPop = false;
187
+ },
188
+ async open({ gradeId }) {
189
+ this.gradeId = gradeId
190
+
191
+ await this.queryCourseList()
192
+ this.showPop = true
193
+
194
+ },
195
+ openPopup(){
196
+ this.showPop = true
197
+ },
198
+ closeVoucher(){
199
+ this.showVoucher = false
200
+ },
201
+ // 登录成功之后调用优惠券接口
202
+ async loginSuccess(){
203
+ // 成功之后的逻辑
204
+ await this.queryCourseDetail()
205
+ await this.getVoucher()
206
+ },
207
+ // 获取优惠券信息
208
+ async getVoucher() {
209
+ const data = {
210
+ products: this.products,
211
+ }
212
+ let res = await this.$axios.post('/one-api/coupon/api/recommend', data, {rewritePostBody: true, header: { studentId: this.$store.state.ucenter.user.uid }, })
213
+ if (res.code !== 0){
214
+ this.$toast.fail(res.msg)
215
+ return
216
+ }
217
+ const resData = res.data || {}
218
+ this.canUseCount = resData.canUseCount
219
+ this.discount = resData.useCouponInfo.discount || 0
220
+ },
221
+ // 获取课程列表
222
+ async queryCourseList(){
223
+ const data = {
224
+ source: {},
225
+ query: {
226
+ gradeId: this.gradeId,
227
+ },
228
+ }
229
+ if (this.dataType === 'courseId') data.source.courseIdList = this.ids
230
+ else if (this.dataType === 'packageId') data.source.curriculumPackageIdList = this.ids
231
+ let res = await this.$axios.post("/one-api/shop/goods/api/coursePanel", data, { rewritePostBody: true })
232
+ if (res.code !== 0){
233
+ this.$message.error(res.msg)
234
+ }
235
+ const resData = res.data || {};
236
+ console.log(resData)
237
+ this.goodsList = [].concat([...resData.goodsList])
238
+ this.selectedClass = this.goodsList[0]
239
+ this.selectedId = this.goodsList[0].id
240
+ this.currentSellPrice = this.goodsList[0].sellPrice
241
+ this.currentOrgPrice = this.goodsList[0].orgPrice
242
+ },
243
+ // 获取用户详情
244
+ async queryCourseDetail() {
245
+ const data = {
246
+ // skuId: '3238' // 选择商品的ID
247
+ skuId: this.selectedId
248
+ }
249
+ let res = await this.$axios.post('/one-api/shop/goods/api/detail', data, { rewritePostBody: true } )
250
+ console.log(res)
251
+ if (res.code !== 0){
252
+ this.$message.error(res.msg)
253
+ }
254
+ const resData = res.data || {}
255
+ this.courseDetail = resData
256
+ this.$emit('btn-click', "get-detail", resData)
257
+ this.activityInfo = this.courseDetail.activityInfo || ''
258
+ if ( this.activityInfo ){
259
+ this.activitySellPrice = this.courseDetail.activityInfo.sellPrice
260
+ } else {
261
+ this.activitySellPrice = null // 没有活动
262
+ }
263
+ this.setGoodsData()
264
+ },
265
+ // 设置购买商品(请求优惠券接口使用)
266
+ setGoodsData() {
267
+ let price = 0
268
+ if (this.activitySellPrice !== null || Number(this.activitySellPrice) - Number(this.courseDetail.sellPrice) < 0) {
269
+ price = this.activitySellPrice
270
+ } else {
271
+ price = this.courseDetail.singleSellPrice
272
+ }
273
+ this.products = [
274
+ {
275
+ skuInfo: {
276
+ clazzId: this.courseDetail.spec ? this.courseDetail.spec.clazzId : '',
277
+ skuId: this.selectedId,
278
+ goodsCategoryId: this.courseDetail.clazzCategory,
279
+ courseType: this.courseDetail.spec.courseType,
280
+ year: this.courseDetail.spec.year,
281
+ subjectId: this.courseDetail.spec.subjectId,
282
+ platformType: this.courseDetail.spec.platformType,
283
+ levelDegreeId: this.courseDetail.spec.levelDegreeId,
284
+ gradeIds: this.courseDetail.spec.gradeList.map((gradeItem) => gradeItem.id) || [],
285
+ term: this.courseDetail.spec.term,
286
+ courseId: this.courseDetail.spec.courseId,
287
+ },
288
+ price,
289
+ amount: 1,
290
+ },
291
+ ]
292
+ if (this.courseDetail.attachedItems && this.courseDetail.attachedItems.length > 0) {
293
+ this.courseDetail.attachedItems.forEach((item) => {
294
+ this.products.push({
295
+ skuInfo: {
296
+ clazzId: this.courseDetail.spec.clazzId,
297
+ skuId: item.skuId,
298
+ goodsCategoryId: item.category,
299
+ courseType: this.courseDetail.spec.courseType,
300
+ year: this.courseDetail.spec.year,
301
+ subjectId: this.courseDetail.spec.subjectId,
302
+ platformType: this.courseDetail.spec.platformType,
303
+ levelDegreeId: this.courseDetail.spec.levelDegreeId,
304
+ gradeIds: this.courseDetail.spec.gradeList.map((gradeItem) => gradeItem.id) || [],
305
+ term: this.courseDetail.spec.term,
306
+ courseId: this.courseDetail.spec.courseId,
307
+ },
308
+ price: item.price,
309
+ amount: 1,
310
+ });
311
+ })
312
+ }
313
+ },
314
+ }
315
+ }
316
+ </script>
@@ -0,0 +1,10 @@
1
+ import TsgradePanel from './src/gradePanel.vue'
2
+
3
+ // install 是默认的方法,供按需引入
4
+ // 当外界在 use 这个组件的时候,就会调用本身的install方法,同时传一个Vue这个类的参数
5
+
6
+ TsgradePanel.install = (Vue) => {
7
+ Vue.component(TsgradePanel.name, TsgradePanel)
8
+ }
9
+
10
+ export default TsgradePanel
@@ -0,0 +1,150 @@
1
+ <template>
2
+ <div class="grade-selection-list-wrapper" :style="backgroundImgStyle">
3
+ <div class="grade-selection-list-title">
4
+ {{ guide }}
5
+ </div>
6
+ <div class="grade-selection-list-container">
7
+ <ul class="grade-selection-item-wrapper">
8
+ <li v-for="(item, index) in gradeList" :key="index">
9
+ <div
10
+ class="font-medium grade-selection-item"
11
+ :class="{ active: isActive == item.gradeId }"
12
+ @click="selectGrade(item)"
13
+ >
14
+ <span class="item-text">
15
+ {{ item.gradeName }}
16
+ </span>
17
+ </div>
18
+ </li>
19
+ </ul>
20
+ <ts-button
21
+ class="btn"
22
+ style-type="primary"
23
+ size="small"
24
+ width="100%"
25
+ height="48px"
26
+ @click="btnClick"
27
+ >
28
+ {{ title }}
29
+ </ts-button>
30
+ </div>
31
+ </div>
32
+ </template>
33
+ <script>
34
+ import TsButton from "../../../base/button";
35
+
36
+ export default {
37
+ name: "TsGradeSelectionList",
38
+ components: { TsButton },
39
+ props: {
40
+ guide: {
41
+ default: "请选择孩子年级",
42
+ type: String,
43
+ },
44
+ jumpType: {
45
+ default: "",
46
+ type: String,
47
+ },
48
+ action: {
49
+ default: "",
50
+ type: String,
51
+ },
52
+ linkUrl: {
53
+ default: "",
54
+ type: String,
55
+ },
56
+ backgroundImgUrl: {
57
+ default: "",
58
+ type: String,
59
+ },
60
+ title: {
61
+ default: "SIGN UP NOW",
62
+ type: String,
63
+ },
64
+ dataType: {
65
+ // 范围: courseId | packageId
66
+ default: "courseId",
67
+ type: String,
68
+ },
69
+ ids: {
70
+ default: () => [],
71
+ type: Array,
72
+ },
73
+ },
74
+ data() {
75
+ return {
76
+ gradeList: [],
77
+ isActive: null,
78
+ };
79
+ },
80
+ computed: {
81
+ backgroundImgStyle(){
82
+ return {
83
+ backgroundImage: `url(${this.backgroundImgUrl})`,
84
+ backgroundSize: 'cover',
85
+ backgroundRepeat: 'no-repeat',
86
+ boxShadow: this.backgroundImgUrl ? 'none' : '0px 2px 11px 0px rgba(0, 45, 65, 0.17)',
87
+ }
88
+ }
89
+ },
90
+ mounted() {
91
+ this.getGradeList();
92
+ this.$sensors.track('h5_grade_list_show', {
93
+ button_name: this.title,
94
+ link_type: 2,
95
+ link_component: 2,
96
+ })
97
+ },
98
+ methods: {
99
+ selectGrade(item) {
100
+ this.isActive = item.gradeId;
101
+ this.touchAction()
102
+ },
103
+ btnClick() {
104
+ console.log("点击触发", this.$props)
105
+ if (!this.isActive) {
106
+ this.$toast("请选择年级");
107
+ return
108
+ }
109
+ this.touchAction()
110
+ },
111
+ touchAction(){
112
+ if (!this.jumpType) return;
113
+ this.$sensors.track('h5_grade_list_click', {
114
+ click_grade: this.isActive,
115
+ link_type: 2,
116
+ link_component: 2,
117
+ })
118
+ if (this.jumpType === "link" && this.linkUrl) {
119
+ this.$emit("open-other-links", {
120
+ link: this.linkUrl,
121
+ target: "_self",
122
+ });
123
+ return;
124
+ }
125
+ if (this.jumpType === "action" && this.action) {
126
+ this.$emit("btn-click", this.action, {gradeId: this.isActive});
127
+ this.$emit("btn-click", "switch-grade", {gradeId: this.isActive});
128
+ }
129
+ },
130
+ getGradeList() {
131
+ const data = {
132
+ source: {},
133
+ query: {
134
+ },
135
+ }
136
+ if (this.dataType === 'courseId') data.source.courseIdList = this.ids
137
+ else if (this.dataType === 'packageId') data.source.curriculumPackageIdList = this.ids
138
+ // queryGradeList(data, { rewritePostBody: true }).then((res) => {
139
+ // const data = res.data.data || {};
140
+ // this.gradeList = data.queryParams.gradeList;
141
+ // });
142
+ this.$axios.post("/one-api/shop/goods/api/coursePanel", data, { rewritePostBody: true }).then((res) => {
143
+ const data = res.data || {};
144
+ console.log(data)
145
+ this.gradeList = data.queryParams.gradeList;
146
+ });
147
+ },
148
+ },
149
+ };
150
+ </script>
@@ -0,0 +1,10 @@
1
+ import TsMaterialPanel from './src/index.vue'
2
+
3
+ // install 是默认的方法,供按需引入
4
+ // 当外界在 use 这个组件的时候,就会调用本身的install方法,同时传一个Vue这个类的参数
5
+
6
+ TsMaterialPanel.install = (Vue) => {
7
+ Vue.component(TsMaterialPanel.name, TsMaterialPanel)
8
+ }
9
+
10
+ export default TsMaterialPanel
@@ -0,0 +1,136 @@
1
+ <template>
2
+ <div id="material-panel" ref="material-panel">
3
+ <material-list :file-list="fileList" :title="title" />
4
+ <div class="bottom-fixed-btns-wrapper">
5
+ <div class="bottom-fixed-btns-container">
6
+ <ts-button
7
+ class="bottom-btn"
8
+ style-type="primary"
9
+ size="small"
10
+ width="100%"
11
+ height="48px"
12
+ @click="bottomBtnClick"
13
+ >
14
+ {{ btnTitle }}
15
+ </ts-button>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ import TsButton from "../../../base/button";
23
+ import MaterialList from "../../../base/material-list/src/material-list.vue";
24
+ export default {
25
+ name: "TsMaterialPanel",
26
+ components: {
27
+ TsButton,
28
+ MaterialList,
29
+ },
30
+ props: {
31
+ fileList: {
32
+ type: Array,
33
+ default: () => [],
34
+ },
35
+ title: {
36
+ type: String,
37
+ default: "Content Preview",
38
+ },
39
+ btnTitle: {
40
+ type: String,
41
+ default: "click",
42
+ },
43
+ precondition: {
44
+ type: Number,
45
+ default: 1,
46
+ },
47
+ shareDesc: {
48
+ type: String,
49
+ default: "",
50
+ },
51
+ shareDuration: {
52
+ type: Number || String,
53
+ default: 72,
54
+ },
55
+ shareNum: {
56
+ type: Number || String,
57
+ default: 3,
58
+ },
59
+ sharePoster: {
60
+ type: String,
61
+ default:
62
+ "https://kjdsfz-cdn.thethinkacademy.com/website/8601/20211126/1637893880920mLUcPnPD1B.png",
63
+ },
64
+ teacherQRCode: {
65
+ type: String,
66
+ default:
67
+ "https://kjdsfz-cdn.thethinkacademy.com/website/8601/20211126/16378938916160msIeKMVze.png",
68
+ },
69
+ },
70
+ data() {
71
+ return {
72
+ observer: "",
73
+ time: "",
74
+ };
75
+ },
76
+ mounted() {
77
+ this.$sensors.track('h5_resource_card_show', {
78
+ resource_num: this.fileList.length,
79
+ get_type: this.precondition,
80
+ share_num: this.shareNum,
81
+ button_name: this.btnTitle
82
+ })
83
+ this.observer = new IntersectionObserver(
84
+ (entries) => {
85
+ entries.forEach((item) => {
86
+ if (item.isIntersecting) {
87
+ this.time = Date.now();
88
+ } else {
89
+ this.upload();
90
+ }
91
+ });
92
+ },
93
+ {
94
+ root: null,
95
+ rootMargin: "0px 0px",
96
+ threshold: 0.7,
97
+ }
98
+ );
99
+ this.observer.observe(this.$refs["material-panel"]);
100
+ window.addEventListener("unload", this.upload);
101
+ },
102
+ beforeDestroy() {
103
+ this.upload();
104
+ },
105
+ destroyed() {
106
+ window.removeEventListener("unload", this.upload);
107
+ },
108
+ methods: {
109
+ bottomBtnClick() {
110
+ this.$emit("btn-click", "fix-bottom-share", {
111
+ props: this.$props,
112
+ });
113
+ if (this.$sensors) {
114
+ this.$sensors.track('h5_resource_card_click', {
115
+ resource_num: this.fileList.length,
116
+ get_type: this.precondition,
117
+ share_num: this.shareNum,
118
+ button_name: this.btnTitle
119
+ })
120
+ }
121
+ },
122
+ upload() {
123
+ if (this.time && Date.now() - this.time > 1000) {
124
+ if (this.$sensors) {
125
+ this.$sensors.track("show_activity_pv", {
126
+ exposure_time: Date.now() - this.time,
127
+ active_type:
128
+ this.precondition === 1 ? "直接领取" : "助力领取",
129
+ });
130
+ this.time = ""
131
+ }
132
+ }
133
+ },
134
+ },
135
+ };
136
+ </script>
@@ -0,0 +1,10 @@
1
+ import TsNotifiedPanel from './src/index.vue'
2
+
3
+ // install 是默认的方法,供按需引入
4
+ // 当外界在 use 这个组件的时候,就会调用本身的install方法,同时传一个Vue这个类的参数
5
+
6
+ TsNotifiedPanel.install = (Vue) => {
7
+ Vue.component(TsNotifiedPanel.name, TsNotifiedPanel)
8
+ }
9
+
10
+ export default TsNotifiedPanel