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,153 @@
1
+ /**
2
+ * 手机号相关配置
3
+ * 国际区号配置及对应正则
4
+ */
5
+
6
+ export default {
7
+ // 本地默认区号
8
+ localeAreaCode: {
9
+ uk: 44,
10
+ sg: 65,
11
+ us: 1,
12
+ },
13
+
14
+ codeList: [{
15
+ // 美国
16
+ countryName: 'United States',
17
+ countryCode: 'us',
18
+ value: 1,
19
+ reg: /^\d{10}$/,
20
+ }, {
21
+ // 英国
22
+ countryName: 'United Kingdom',
23
+ countryCode: 'uk',
24
+ value: '44',
25
+ reg: /^\d{10}$/,
26
+ }, {
27
+ // 新加坡
28
+ countryName: 'Singapore',
29
+ countryCode: 'sg',
30
+ value: '65',
31
+ reg: /^\d{8}$/,
32
+ }, {
33
+ // 中国
34
+ countryName: 'China',
35
+ countryCode: 'cn',
36
+ value: '86',
37
+ reg: /^\d{11}$/,
38
+ }, {
39
+ // 澳大利亚
40
+ countryName: 'Australia',
41
+ countryCode: 'au',
42
+ value: '61',
43
+ reg: /^\d{10}$/,
44
+ }, {
45
+ // 柬埔寨
46
+ countryName: 'Cambodia',
47
+ countryCode: 'kh',
48
+ value: '855',
49
+ reg: /^\d{10}$/,
50
+ }, {
51
+ // 加拿大
52
+ countryName: 'Canada',
53
+ countryCode: 'ca',
54
+ value: '1',
55
+ reg: /^\d{10}$/,
56
+ }, {
57
+ // 法国
58
+ countryName: 'France',
59
+ countryCode: 'fr',
60
+ value: '33',
61
+ reg: /^\d{10}$/,
62
+ }, {
63
+ // 德国
64
+ countryName: 'Germany',
65
+ countryCode: 'de',
66
+ value: '49',
67
+ reg: /^\d{11}$/,
68
+ }, {
69
+ // 香港
70
+ countryName: 'Hong Kong, China',
71
+ countryCode: 'hk',
72
+ value: '852',
73
+ reg: /^\d{8}$/,
74
+ }, {
75
+ // 印度
76
+ countryName: 'India',
77
+ countryCode: 'in',
78
+ value: '91',
79
+ reg: /^\d{10}$/,
80
+ }, {
81
+ // 印度尼西亚
82
+ countryName: 'Indonesia',
83
+ countryCode: 'id',
84
+ value: '62',
85
+ reg: /^\d{11}$/,
86
+ }, {
87
+ // 爱尔兰
88
+ countryName: 'Ireland',
89
+ countryCode: 'ie',
90
+ value: '353',
91
+ reg: /^\d{9,10}$/,
92
+ }, {
93
+ // 意大利
94
+ countryName: 'Italy',
95
+ countryCode: 'it',
96
+ value: '39',
97
+ reg: /^\d{10}$/,
98
+ }, {
99
+ // 日本
100
+ countryName: 'Japan',
101
+ countryCode: 'jp',
102
+ value: '81',
103
+ reg: /^\d{11}$/,
104
+ }, {
105
+ // 澳门
106
+ countryName: 'Macau, China',
107
+ countryCode: 'mo',
108
+ value: '853',
109
+ reg: /^\d{8}$/,
110
+ }, {
111
+ // 马来西亚
112
+ countryName: 'Malaysia',
113
+ countryCode: 'ms',
114
+ value: '60',
115
+ reg: /^\d{8,10}$/,
116
+ }, {
117
+ // 挪威
118
+ countryName: 'Norway',
119
+ countryCode: 'no',
120
+ value: '47',
121
+ reg: /^\d{8}$/,
122
+ }, {
123
+ // 波兰
124
+ countryName: 'Poland',
125
+ countryCode: 'pl',
126
+ value: '48',
127
+ reg: /^\d{9}$/,
128
+ }, {
129
+ // 韩国
130
+ countryName: 'South Korea',
131
+ countryCode: 'kr',
132
+ value: '82',
133
+ reg: /^\d{11}$/,
134
+ }, {
135
+ // 西班牙
136
+ countryName: 'Spain',
137
+ countryCode: 'es',
138
+ value: '34',
139
+ reg: /^\d{9}$/,
140
+ }, {
141
+ // 泰国
142
+ countryName: 'Thailand',
143
+ countryCode: 'th',
144
+ value: '66',
145
+ reg: /^\d{10}$/,
146
+ }, {
147
+ // 阿联酋
148
+ countryName: 'United Arab Emirates',
149
+ countryCode: 'ae',
150
+ value: '971',
151
+ reg: /^\d{9,10}$/,
152
+ }],
153
+ }
@@ -0,0 +1,115 @@
1
+ import Vue from 'vue';
2
+ import merge from '../merge';
3
+ import PopupManager from './popup-manager';
4
+
5
+ let idSeed = 1;
6
+
7
+ export default {
8
+ props: {
9
+ visible: {
10
+ type: Boolean,
11
+ default: false,
12
+ },
13
+ // 点击蒙层时关闭
14
+ closeOnClickModal: {
15
+ type: Boolean,
16
+ default: false,
17
+ },
18
+ },
19
+ data() {
20
+ return {
21
+ };
22
+ },
23
+ watch: {
24
+ visible(val) {
25
+ if (val) {
26
+ if (this._opening) return;
27
+ if (!this.rendered) {
28
+ this.rendered = true;
29
+ Vue.nextTick(() => {
30
+ this.open();
31
+ });
32
+ } else {
33
+ this.open();
34
+ }
35
+ } else {
36
+ this.close();
37
+ }
38
+ },
39
+ },
40
+ beforeMount() {
41
+ // 组件渲染前
42
+ this._popupId = `popup-${idSeed += 1}`;
43
+ PopupManager.register(this._popupId, this);
44
+ },
45
+ beforeDestory() {
46
+ // 组件销毁前
47
+ PopupManager.deregister(this._popupId);
48
+ PopupManager.closeModal()
49
+ },
50
+ methods: {
51
+ open(options) {
52
+ console.log('open dialog')
53
+ const props = merge({}, this.$props || this, options);
54
+ this.doOpen(props)
55
+ },
56
+ doOpen(props) {
57
+ console.log('do open')
58
+ if (this.$isServer) return;
59
+ if (this.opened) return;
60
+
61
+ console.log('do opening')
62
+
63
+ this._opening = true;
64
+
65
+ const dom = this.$el;
66
+
67
+ const { modal } = props;
68
+
69
+ const { zIndex } = props;
70
+
71
+ if (zIndex) {
72
+ PopupManager.zIndex = zIndex;
73
+ }
74
+
75
+ // 显示遮罩层
76
+ if (modal) {
77
+ if (this._closing) {
78
+ PopupManager.closeModal(this._popupId);
79
+ this._closing = false;
80
+ }
81
+ PopupManager.openModal(this._popupId, PopupManager.nextZIndex(), this.modalAppendToBody ? undefined : dom, props.modalClass, props.modalFade);
82
+ }
83
+
84
+ dom.style.zIndex = PopupManager.nextZIndex();
85
+ this.opened = true;
86
+
87
+ if (this.onOpen) this.onOpen();
88
+
89
+ this.doAfterOpen();
90
+ },
91
+ doAfterOpen() {
92
+ this._opening = false;
93
+ },
94
+ close() {
95
+ this.doClose();
96
+ },
97
+ doClose() {
98
+ this._closing = true;
99
+
100
+ if (this.onClose) this.onClose();
101
+
102
+ // if (this.lockScroll) {
103
+ // setTimeout(this.restoreBodyStyle, 200);
104
+ // }
105
+
106
+ this.opened = false;
107
+
108
+ this.doAfterClose();
109
+ },
110
+ doAfterClose() {
111
+ PopupManager.closeModal(this._popupId);
112
+ this._closing = false;
113
+ },
114
+ },
115
+ }
@@ -0,0 +1,178 @@
1
+ /* eslint-disable no-use-before-define */
2
+ import Vue from 'vue';
3
+ import { addClass, removeClass } from '../dom';
4
+
5
+ let hasInitZIndex = false;
6
+ const initZIndex = 2000;
7
+ let zIndex;
8
+ let hasModal = false;
9
+
10
+ // eslint-disable-next-line func-names
11
+ const getModal = function () {
12
+ if (Vue.prototype.$isServer) return null;
13
+ let { modalDom } = PopupManager;
14
+ if (modalDom) {
15
+ hasModal = true;
16
+ } else {
17
+ hasModal = false;
18
+ modalDom = document.createElement('div');
19
+ PopupManager.modalDom = modalDom;
20
+
21
+ modalDom.addEventListener('touchmove', (event) => {
22
+ event.preventDefault();
23
+ event.stopPropagation();
24
+ });
25
+
26
+ modalDom.addEventListener('click', () => {
27
+ if (PopupManager.doOnModalClick) PopupManager.doOnModalClick();
28
+ });
29
+ }
30
+
31
+ return modalDom;
32
+ };
33
+ const instances = {};
34
+
35
+ const PopupManager = {
36
+ modalFade: true,
37
+
38
+ getInstance(id) {
39
+ return instances[id];
40
+ },
41
+
42
+ // 注册弹出层
43
+ register(id, instance) {
44
+ if (id && instance) {
45
+ instances[id] = instance;
46
+ }
47
+ },
48
+
49
+ // 删除弹出层
50
+ deregister(id) {
51
+ if (id) {
52
+ instances[id] = null;
53
+ delete instances[id];
54
+ }
55
+ },
56
+
57
+ nextZIndex() {
58
+ // eslint-disable-next-line no-plusplus
59
+ return PopupManager.zIndex++
60
+ },
61
+
62
+ modalStack: [],
63
+
64
+ doOnModalClick() {
65
+ const topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
66
+ if (!topItem) return;
67
+
68
+ const instance = PopupManager.getInstance(topItem.id);
69
+ if (instance && instance.closeOnClickModal) {
70
+ instance.close();
71
+ }
72
+ },
73
+
74
+ // 显示蒙层
75
+ // eslint-disable-next-line no-shadow
76
+ openModal(id, zIndex, dom, modalClass, modalFade) {
77
+ console.log('open modal')
78
+ if (Vue.prototype.$isServer) return;
79
+ if (!id || zIndex === undefined) return;
80
+
81
+ this.modalFade = modalFade;
82
+
83
+ const { modalStack } = this;
84
+
85
+ for (let i = 0, j = modalStack.length; i < j; i += 1) {
86
+ const item = modalStack[i];
87
+ if (item.id === id) {
88
+ return;
89
+ }
90
+ }
91
+
92
+ const modalDom = getModal();
93
+
94
+ addClass(modalDom, 'v-modal');
95
+ if (this.modalFade && !hasModal) {
96
+ addClass(modalDom, 'v-modal-enter');
97
+ }
98
+ if (modalClass) {
99
+ const classArr = modalClass.trim().split(/\s+/);
100
+ classArr.forEach((item) => addClass(modalDom, item));
101
+ }
102
+ setTimeout(() => {
103
+ removeClass(modalDom, 'v-modal-enter');
104
+ }, 200);
105
+
106
+ if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
107
+ dom.parentNode.appendChild(modalDom);
108
+ } else {
109
+ document.body.appendChild(modalDom);
110
+ }
111
+
112
+ if (zIndex) {
113
+ modalDom.style.zIndex = zIndex;
114
+ }
115
+ modalDom.tabIndex = 0;
116
+ modalDom.style.display = '';
117
+
118
+ this.modalStack.push({ id, zIndex, modalClass });
119
+ },
120
+
121
+ // 关闭蒙层
122
+ closeModal(id) {
123
+ const { modalStack } = this;
124
+ const modalDom = getModal();
125
+
126
+ if (modalStack.length > 0) {
127
+ const topItem = modalStack[modalStack.length - 1];
128
+ if (topItem.id === id) {
129
+ if (topItem.modalClass) {
130
+ const classArr = topItem.modalClass.trim().split(/\s+/);
131
+ classArr.forEach((item) => removeClass(modalDom, item));
132
+ }
133
+
134
+ modalStack.pop();
135
+ if (modalStack.length > 0) {
136
+ modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
137
+ }
138
+ } else {
139
+ for (let i = modalStack.length - 1; i >= 0; i -= 1) {
140
+ if (modalStack[i].id === id) {
141
+ modalStack.splice(i, 1);
142
+ break;
143
+ }
144
+ }
145
+ }
146
+ }
147
+
148
+ if (modalStack.length === 0) {
149
+ if (this.modalFade) {
150
+ addClass(modalDom, 'v-modal-leave');
151
+ }
152
+ setTimeout(() => {
153
+ if (modalStack.length === 0) {
154
+ if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
155
+ modalDom.style.display = 'none';
156
+ PopupManager.modalDom = undefined;
157
+ }
158
+ removeClass(modalDom, 'v-modal-leave');
159
+ }, 200);
160
+ }
161
+ },
162
+ }
163
+
164
+ Object.defineProperty(PopupManager, 'zIndex', {
165
+ configurable: true,
166
+ get() {
167
+ if (!hasInitZIndex) {
168
+ zIndex = zIndex || (Vue.prototype.$ELEMENT || {}).zIndex || initZIndex;
169
+ hasInitZIndex = true;
170
+ }
171
+ return zIndex;
172
+ },
173
+ set(value) {
174
+ zIndex = value;
175
+ },
176
+ });
177
+
178
+ export default PopupManager;
@@ -0,0 +1,22 @@
1
+ export const myStorage = {
2
+ //存储
3
+ set(key, value) {
4
+ localStorage.setItem(key, JSON.stringify(value));
5
+ },
6
+ //取出数据
7
+ get(key) {
8
+ try {
9
+ const value = localStorage.getItem(key);
10
+ if (value === null || value === undefined || value === "") {
11
+ return null;
12
+ }
13
+ return JSON.parse(localStorage.getItem(key));
14
+ } catch (err) {
15
+ return null;
16
+ }
17
+ },
18
+ //删除数据
19
+ remove(key) {
20
+ localStorage.removeItem(key);
21
+ },
22
+ };
@@ -0,0 +1,49 @@
1
+ import Cookies from 'js-cookie';
2
+
3
+ /**
4
+ * 设置accessToken
5
+ */
6
+ export const setCookies = (tokenName = '_official_token', token) => {
7
+ let domain = window.location.hostname;
8
+ const reg = /\./g;
9
+ const domainTestResult = domain.match(reg);
10
+ // cookies存储在二级域名上
11
+ if (domainTestResult && domainTestResult.length > 1) {
12
+ const regDomain = /\.[a-zA-Z\d\.]+$/;
13
+ const result = domain.match(regDomain);
14
+ // eslint-disable-next-line prefer-destructuring
15
+ if (result && result.length > 0) domain = result[0];
16
+ }
17
+
18
+ // 历史原因,设置Cookies之前,先删除原完整域名下的cookies
19
+ Cookies.remove(tokenName);
20
+ // 设置官网的Cookies
21
+ Cookies.set(tokenName, token, { expires: 365, domain });
22
+ }
23
+
24
+ /**
25
+ * 移除Cookies
26
+ */
27
+ export const getCookies = (tokenName = '_official_token') => {
28
+ return Cookies.get(tokenName) || ''
29
+ }
30
+
31
+ /**
32
+ * 移除Cookies
33
+ */
34
+ export const removeCookies = (tokenName = '_official_token') => {
35
+ let domain = window.location.hostname;
36
+ const reg = /\./g;
37
+ const domainTestResult = domain.match(reg);
38
+ // cookies存储在二级域名上
39
+ if (domainTestResult && domainTestResult.length > 1) {
40
+ const regDomain = /\.[a-zA-Z\d\.]+$/;
41
+ const result = domain.match(regDomain);
42
+ // eslint-disable-next-line prefer-destructuring
43
+ if (result && result.length > 0) domain = result[0];
44
+ }
45
+
46
+ // 清除官网的Cookies
47
+ Cookies.remove(tokenName, { domain });
48
+ Cookies.remove(tokenName);
49
+ }