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,176 @@
1
+ .icon-close-new-e658{
2
+ font-size: 32px;
3
+ }
4
+ .icon-left{
5
+ font-size: 32px;
6
+ }
7
+ .popup-body-wrapper {
8
+ height: 100%;
9
+
10
+ .coupon-tip-container {
11
+ // width: 343px;
12
+ // height: 44px;
13
+ // background: #fff;
14
+ // border-radius: 36px;
15
+ // border: 1px solid red;
16
+
17
+ .coupon-tip {
18
+ margin-bottom: 10px;
19
+ padding: 8px 20px;
20
+ width: 100%;
21
+ font-size: 12px;
22
+ line-height: 14px;
23
+ color: #ffaa0a;
24
+ height: 44px;
25
+ background: #fff;
26
+ border-radius: 36px;
27
+ display: flex;
28
+ align-items: center;
29
+
30
+ i,
31
+ span {
32
+ display: inline-block;
33
+ vertical-align: middle;
34
+ }
35
+
36
+ .icon-alert {
37
+ font-size: 18px;
38
+ }
39
+
40
+ span {
41
+ margin-left: 10px;
42
+ width: 272px;
43
+ word-break: keep-all;
44
+ }
45
+ }
46
+ }
47
+
48
+ .stu-switch-btn {
49
+ margin-top: 74px;
50
+ }
51
+
52
+ .empty-box {
53
+ width: 100%;
54
+ height: 54px;
55
+ }
56
+
57
+ .guide-to-add-student,
58
+ .students-list-title {
59
+ font-size: 14px;
60
+ line-height: 16px;
61
+ color: #a2aab8;
62
+ margin: 0 4px;
63
+ }
64
+
65
+ .guide-to-add-student {
66
+ margin: 10px 4px 0;
67
+
68
+ .btn-add-student {
69
+ color: #ffaa0a;
70
+ text-decoration: underline;
71
+ cursor: pointer;
72
+ }
73
+ }
74
+ }
75
+
76
+ .stu-switch-popup-txt {
77
+ margin: 10px 0;
78
+ width: 100%;
79
+ display: inline-block;
80
+ border-radius: 10px;
81
+ font-size: 16px;
82
+ line-height: 22px;
83
+
84
+ h1,
85
+ h2,
86
+ h3,
87
+ h4,
88
+ h5,
89
+ h6,
90
+ pre {
91
+ font-size: 16px;
92
+ line-height: 19px;
93
+ }
94
+ }
95
+ // 学生列表
96
+
97
+ .students-list-wrapper {
98
+ border-radius: 10px;
99
+ overflow: hidden;
100
+
101
+ .students-list{
102
+ background: #fff;
103
+ }
104
+ }
105
+
106
+ .student-card-wrapper {
107
+ width: 100%;
108
+ height: 82px;
109
+ overflow: hidden;
110
+ display: flex;
111
+ align-items: center;
112
+ justify-content: center;
113
+ border-bottom-color: #f4f6fa;
114
+ border-bottom-style: solid;
115
+
116
+ .student-card-container {
117
+ width: 100%;
118
+ }
119
+
120
+ .card-main-container {
121
+ display: flex;
122
+ margin-left: 14px;
123
+
124
+ .stu-avatar-container {
125
+ margin-right: 10px;
126
+ width: 54px;
127
+ height: 54px;
128
+ border: 2px solid #f4f6fa;
129
+ border-radius: 50%;
130
+
131
+ img {
132
+ width: 54px;
133
+ height: 54px;
134
+ border-radius: 50%;
135
+ }
136
+ }
137
+
138
+ .stu-info-container {
139
+ .stu-name {
140
+ margin: 8px 0 3px;
141
+ font-size: 16px;
142
+ line-height: 19px;
143
+ }
144
+
145
+ .stu-no {
146
+ height: 16px;
147
+ font-size: 14px;
148
+ line-height: 16px;
149
+ color: #a2aab8;
150
+ }
151
+ }
152
+ }
153
+
154
+ .btn-select-student {
155
+ width: 22px;
156
+ height: 22px;
157
+ margin-right: 16px;
158
+ // background: url('~package/business/switch-student/src/images/student_Unselected.png') center no-repeat;
159
+ // background-size: 100%;
160
+
161
+ .icon-selected {
162
+ font-size: 22px;
163
+ color: #ffaa0a;
164
+ }
165
+
166
+ .icon-unselect {
167
+ font-size: 22px;
168
+ color: #ffecca;
169
+ }
170
+ }
171
+
172
+ // .active {
173
+ // background: url('images/student_selected.png') center no-repeat;
174
+ // background-size: 100%;
175
+ // }
176
+ }
@@ -0,0 +1,60 @@
1
+ .tips-popup-wrapper {
2
+ min-width: 80vw;
3
+
4
+
5
+ .tips-popup-container {
6
+ margin: 0 16px;
7
+ border-radius: 16px 16px 0 0;
8
+ display: flex;
9
+ flex-direction: column;
10
+ align-items: center;
11
+ background: #fff;
12
+
13
+ .title {
14
+ margin-top: 34px;
15
+ font-size: 18px;
16
+ color: #172b4d;
17
+ line-height: 21px;
18
+ text-align: center;
19
+ }
20
+
21
+ .message {
22
+ font-size: 14px;
23
+ color: #a2aab8;
24
+ line-height: 16px;
25
+ margin: 22px 16px 24px;
26
+ text-align: center;
27
+ }
28
+ }
29
+
30
+ .btn-wrapper {
31
+ margin: 0 16px;
32
+ border-radius: 0 0 16px 16px;
33
+ display: flex;
34
+ justify-content: center;
35
+ align-items: flex-start;
36
+ background: #fff;
37
+
38
+ .btn {
39
+ margin-bottom: 16px;
40
+ }
41
+ }
42
+
43
+ .btn-wrapper-2 {
44
+ margin: 0 16px;
45
+ border-radius: 0 0 16px 16px;
46
+ display: flex;
47
+ justify-content: space-around;
48
+ align-items: flex-start;
49
+ background: #fff;
50
+
51
+ .btn-left {
52
+ background: #fff3dc;
53
+ color: #ffaa0a;
54
+ }
55
+
56
+ .btn {
57
+ margin-bottom: 16px;
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,93 @@
1
+ .login-box {
2
+ width: 100%;
3
+ height: 100%;
4
+ background: rgba(0, 0, 0, .5);
5
+ display: flex;
6
+ justify-content: center;
7
+ align-items: center;
8
+ .sub-box {
9
+ width: 90%;
10
+ height: 65%;
11
+ position: relative;
12
+ padding-top: 70px;
13
+ background: #fff;
14
+ border-radius: 10px;
15
+ }
16
+ }
17
+ .fade-enter-active, .fade-leave-active {
18
+ transition: opacity .5s;
19
+ }
20
+ .fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
21
+ opacity: 0;
22
+ }
23
+ .insertput{
24
+ text-align: center;
25
+ position: relative;
26
+ input {
27
+ background-color: #f4f6fa;
28
+ border: 0;
29
+ width: 90%;
30
+ outline: none;
31
+ height: 60px;
32
+ border-radius: 50px;
33
+ margin-top: 15px;
34
+ font-size: 18px;
35
+ padding-left: 20px;
36
+ }
37
+ &.code {
38
+ span {
39
+ position: absolute;
40
+ right: 35px;
41
+ color: #ff850a;
42
+ top: 50%;
43
+ }
44
+ }
45
+ }
46
+ .logo {
47
+ img {
48
+ width: 80px;
49
+ height: 80px;
50
+ }
51
+ text-align: center;
52
+ position: absolute;
53
+ top: -40px;
54
+ left: 50%;
55
+ transform: translateX(-50%);
56
+
57
+ }
58
+ .centent {
59
+ font-size: 14px;
60
+ font-weight: 500;
61
+ color: #A2AAB8;
62
+ line-height: 16px;
63
+ padding: 20px;
64
+ }
65
+
66
+ .footer {
67
+ line-height: 48px;
68
+ position: absolute;
69
+ width: 80%;
70
+ bottom: 15px;
71
+ left: 50%;
72
+ transform: translateX(-50%);
73
+ text-align: center;
74
+ margin: 0 auto;
75
+ p {
76
+ float: left;
77
+ }
78
+ .cancel {
79
+ width: 30%;
80
+ height: 48px;
81
+ background: #FFF3DC;
82
+ border-radius: 24px;
83
+ color: #FFAA0A;
84
+ margin-right: 10px;
85
+ }
86
+ .sign-in {
87
+ width: 65%;
88
+ height: 48px;
89
+ background: linear-gradient(45deg, #FFD518 0%, #FFAA0A 100%);
90
+ border-radius: 24px;
91
+ color: #fff;
92
+ }
93
+ }
package/src/index.js ADDED
@@ -0,0 +1,74 @@
1
+ import TsButton from "../packages/base/button";
2
+ import TsImage from "../packages/base/image";
3
+ import TsDialog from "../packages/base/dialog";
4
+ import TsIcon from "../packages/base/icon";
5
+ import TsPopup from "../packages/base/popup";
6
+ import TsBottomPopup from "../packages/base/bottom-popup";
7
+ import TsBasicImage from "../packages/business/basic-image";
8
+ import TsPageRender from "../packages/business/page-render";
9
+ import TsBottomFixedButton from "../packages/business/bottom-fixed-button";
10
+ import TsGradePanel from "../packages/business/grade-panel";
11
+ import TsTipsPopup from "../packages/business/tips-popup";
12
+ import TsSwitchStudent from "../packages/business/switch-student";
13
+ import TsStudentInfo from "../packages/business/student-info";
14
+ import TsUserLogin from "../packages/business/user-login";
15
+ import TsClassChoose from "../packages/business/class-choose";
16
+ import TsMaterialPanel from "../packages/business/material-panel";
17
+ // import TsCourseCard from '../packages/business/course-card';
18
+ import TsSelectorPanel from '../packages/business/selector-panel';
19
+ import TsNotifiedPanel from "../packages/business/notified-panel";
20
+ import TsRegistrationPanel from "../packages/business/registration-panel";
21
+ const components = {
22
+ TsButton,
23
+ TsImage,
24
+ TsDialog,
25
+ TsIcon,
26
+ TsPopup,
27
+ TsBasicImage,
28
+ TsPageRender,
29
+ TsBottomFixedButton,
30
+ TsGradePanel,
31
+ TsTipsPopup,
32
+ TsBottomPopup,
33
+ TsSwitchStudent,
34
+ TsStudentInfo,
35
+ TsUserLogin,
36
+ TsClassChoose,
37
+ TsMaterialPanel,
38
+ TsSelectorPanel,
39
+ TsNotifiedPanel,
40
+ TsRegistrationPanel
41
+ };
42
+
43
+ const install = (Vue) => {
44
+ Object.values(components).forEach((component) => {
45
+ Vue.component(component.name, component);
46
+ });
47
+ };
48
+
49
+ if (typeof window !== "undefined" && window.Vue) {
50
+ install(window.Vue);
51
+ }
52
+
53
+ export default {
54
+ install,
55
+ TsButton,
56
+ TsImage,
57
+ TsDialog,
58
+ TsIcon,
59
+ TsPopup,
60
+ TsBasicImage,
61
+ TsPageRender,
62
+ TsBottomFixedButton,
63
+ TsGradePanel,
64
+ TsTipsPopup,
65
+ TsBottomPopup,
66
+ TsSwitchStudent,
67
+ TsStudentInfo,
68
+ TsUserLogin,
69
+ TsClassChoose,
70
+ TsMaterialPanel,
71
+ TsSelectorPanel,
72
+ TsNotifiedPanel,
73
+ TsRegistrationPanel
74
+ };
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @description api配置和全局拦截
3
+ * @author bobo <guanbobo@100tal.com>
4
+ * @date 2021-11-06
5
+ */
6
+ import axios from 'axios';
7
+ // import qs from 'qs';
8
+ // import { removeCookies } from '@thinkacademy/overseas-ui/src/utils/utils';
9
+
10
+ // import oneApi from "./apiUrl";
11
+
12
+ export const config = {
13
+ timeout: 10000,
14
+ // baseURL: 'oneApi.netBaseUrl', process.env.NODE_ENV === development
15
+ withCredentials: true, // 请求是否携带cookie等凭证
16
+ paramsSerializer() {
17
+ // return qs.stringify(params, { arrayFormat: 'brackets' }); // `paramsSerializer` 是一个负责 `params` 序列化的函数
18
+ },
19
+ headers: {
20
+ 'Content-Type': 'application/json',
21
+ "Authorization": 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJ1aWQiOjc1OTY1MjUsImNsaWVudFR5cGUiOiJUT1VDSF9XRUJTSVRFIiwiaXNzIjoiVUNFTlRFUiIsImlhdCI6MTYzNjM2MDUwMSwianRpIjoiZmI2NjZmNDcifQ.S2EeKiNWQdvHqhpwwv6bdAwh-floB7jUCQeTr6Q1L-VvaqqK_k6viKDQ8QiSURogjwnlI8YFPMFs3Tg15xV9-0GASQkHLVIQQaEJLXJ1afnr50IST4Edmw-B_m0X_ZrXdt1ymUT-vhnmUAIdTrVrPHFrI7hF65uKs8Gp8IxRQc0'
22
+ },
23
+ };
24
+
25
+ export function useInterceptors(netApi) {
26
+ netApi.interceptors.request.use((request) => request);
27
+ netApi.interceptors.response.use(
28
+ (response) => {
29
+ // 业务返回数据
30
+ const resData = response.data || {};
31
+ if (resData.code === 9 || response.status === 403) {
32
+ // 删除token
33
+ // if (!process.server) removeCookies('_official_token');
34
+ }
35
+ return response;
36
+ },
37
+ (error) => Promise.reject(error),
38
+ );
39
+ }
40
+
41
+ /**
42
+ * 生成netApi对象
43
+ * @param configuration api配置
44
+ * @param globalInterceptors 全局拦截器
45
+ * @return {AxiosInstance}
46
+ */
47
+ function generateNet(configuration, globalInterceptors) {
48
+ const netApi = axios.create(config);
49
+ globalInterceptors(netApi);
50
+ return netApi;
51
+ }
52
+
53
+ export const net = generateNet(config, useInterceptors);
@@ -0,0 +1,65 @@
1
+
2
+ /**
3
+ * API接口地址配置
4
+ */
5
+ const onePrefix = '/one-api';
6
+
7
+ /**
8
+ * 统一对接server端接口
9
+ * 基础数据: /basic
10
+ * 认证中心(用户中心): /ucenter
11
+ * 班课中心: /course
12
+ * 售卖系统: /shop
13
+ * 教师中心: /teacher
14
+ * 特定聚合接口: /aggregate
15
+ * 配置数据 /config
16
+ * 调转中心 /changeCenter
17
+ */
18
+ export const oneApi = {
19
+
20
+ // 配置数据
21
+ // ----------------
22
+ // 基础配置数据接口7
23
+ requeryBasicData: `${onePrefix}/config/init`,
24
+
25
+ // 基础数据
26
+ // ----------------
27
+ // 年级查询(全量数据)
28
+ queryGradesAll: `${onePrefix}/basic/client/grade/query`,
29
+ // 年级查询(仅展示数据)
30
+ queryGrades: `${onePrefix}/basic/client/grade/queryWithoutHide`,
31
+
32
+ // 用户中心
33
+ // ----------------
34
+ // 登录验证码发送
35
+ sendLoginMobileCode: `${onePrefix}/ucenter/common/verification/send`,
36
+ // 快捷登录
37
+ commonLogin: `${onePrefix}/ucenter/app/account/quick_login`,
38
+ // 获取用户基础信息
39
+ queryUserBasicInfo: `${onePrefix}/ucenter/basic_info/user/get`,
40
+
41
+ // 售卖子系统
42
+ // ----------------
43
+ // 选课面板接口
44
+ coursePanel: `${onePrefix}/shop/goods/api/coursePanel`,
45
+
46
+ // 营销系统
47
+ // ----------------
48
+ // 老用户
49
+ getInviteOldInfo: `${onePrefix}/activity/api/invite/oldInfo`,
50
+ // 校验老生资格
51
+ checkOld: `${onePrefix}/activity/api/invite/checkOld`,
52
+ // 获取邀请信息
53
+ shareInfo: `${onePrefix}/activity/api/invite/shareInfo/v2`,
54
+ // 老邀新-新用户页面
55
+ getInviteNewInfo: `${onePrefix}/activity/api/invite/newInfo`,
56
+ // 老邀新-新人领券
57
+ getNewerCoupons: `${onePrefix}/activity/api/invite/coupons`,
58
+
59
+ // 数据上报
60
+ dataUpload: `${onePrefix}/data/upload`,
61
+
62
+ // 自定义H5页面相关接口
63
+ getPageScheme: `${onePrefix}/shop/goods/api/project`,
64
+
65
+ }
@@ -0,0 +1,54 @@
1
+ /* istanbul ignore next */
2
+ export function hasClass(el, cls) {
3
+ if (!el || !cls) return false;
4
+ if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
5
+ if (el.classList) {
6
+ return el.classList.contains(cls);
7
+ }
8
+ return (` ${el.className} `).indexOf(` ${cls} `) > -1;
9
+ }
10
+
11
+ /* istanbul ignore next */
12
+ export function addClass(el, cls) {
13
+ if (!el) return;
14
+ let curClass = el.className;
15
+ const classes = (cls || '').split(' ');
16
+
17
+ for (let i = 0, j = classes.length; i < j; i += 1) {
18
+ const clsName = classes[i];
19
+ // eslint-disable-next-line no-continue
20
+ if (!clsName) continue;
21
+
22
+ if (el.classList) {
23
+ el.classList.add(clsName);
24
+ } else if (!hasClass(el, clsName)) {
25
+ curClass += ` ${clsName}`;
26
+ }
27
+ }
28
+ if (!el.classList) {
29
+ el.setAttribute('class', curClass);
30
+ }
31
+ }
32
+
33
+ /* istanbul ignore next */
34
+ export function removeClass(el, cls) {
35
+ if (!el || !cls) return;
36
+ const classes = cls.split(' ');
37
+ let curClass = ` ${el.className} `;
38
+
39
+ for (let i = 0, j = classes.length; i < j; i += 1) {
40
+ const clsName = classes[i];
41
+ // eslint-disable-next-line no-continue
42
+ if (!clsName) continue;
43
+
44
+ if (el.classList) {
45
+ el.classList.remove(clsName);
46
+ } else if (hasClass(el, clsName)) {
47
+ curClass = curClass.replace(` ${clsName} `, ' ');
48
+ }
49
+ }
50
+ if (!el.classList) {
51
+ // eslint-disable-next-line no-undef
52
+ el.setAttribute('class', trim(curClass));
53
+ }
54
+ }
@@ -0,0 +1,82 @@
1
+ // const moment = require('moment-timezone');
2
+ // /**
3
+ // * 格式化日期
4
+ // * @param {日期} dateStr
5
+ // * @param {日期时间格式化字符串} formatStr
6
+ // */
7
+ // const resourceDateFormate = (timeStamp, zone, formatStr = '') => {
8
+ // let result = '';
9
+ // if (typeof timeStamp === 'number') {
10
+ // result = moment(timeStamp).tz(zone).format(formatStr);
11
+ // } else {
12
+ // result = moment(timeStamp).format(formatStr);
13
+ // }
14
+
15
+ // return result;
16
+ // }
17
+
18
+ /**
19
+ * 货币价格转换
20
+ * @param {price} price
21
+ * @param {minorUnit} minorUnit
22
+ * @param {是否保留两位小数} isKeepTwoDecimal
23
+ */
24
+
25
+ const priceUnitConvert = (price, minorUnit, isKeepTwoDecimal = '0') => {
26
+ const newprice = Number(price);
27
+ let result = newprice / minorUnit;
28
+ if (Number(isKeepTwoDecimal) === 1) {
29
+ const resultStr = result.toString();
30
+ const resultDecimal = resultStr.split('.');
31
+ if (resultDecimal.length < 2) {
32
+ // 整数
33
+ result += '.00';
34
+ } else if (resultDecimal.length === 2 && resultDecimal[1].length === 1) {
35
+ // 一位小数
36
+ result += '0';
37
+ }
38
+ }
39
+ return result;
40
+ }
41
+
42
+ // /**
43
+ // * 手机号脱敏
44
+ // * @param {phone} phone
45
+ // */
46
+ // const encryptPhone = (phone) => {
47
+ // if (!phone || phone === '') {
48
+ // return ''
49
+ // }
50
+ // if (phone.includes('*')) return phone;
51
+ // // 手机号长度
52
+ // const phoneLen = phone.length;
53
+
54
+ // // 加密长度
55
+ // const encryptLen = Math.floor(phoneLen / 2);
56
+
57
+ // const startIndex = Math.floor((phoneLen - encryptLen) / 2);
58
+ // const endIndex = startIndex + encryptLen;
59
+
60
+ // const startStr = phone.substring(0, startIndex);
61
+ // const endStr = phone.substring(endIndex, phoneLen);
62
+
63
+ // const encryptStr = phone.substring(startIndex, endIndex).replace(/\d|\D/g, '*');
64
+
65
+ // return startStr + encryptStr + endStr;
66
+ // }
67
+
68
+ // /**
69
+ // * 格式化学员卡编号
70
+ // * @param {学员卡编号}} val
71
+ // */
72
+ // const formatCardNo = (val) => {
73
+ // if (!val) return ''
74
+ // return val.replace(/(.{4})/g, '$1 ')
75
+ // }
76
+
77
+ export default {
78
+ // resourceDateFormate,
79
+ priceUnitConvert,
80
+ // encryptPhone,
81
+ // formatCardNo,
82
+ }
@@ -0,0 +1,16 @@
1
+ /* eslint-disable */
2
+ export default function (target) {
3
+ for (let i = 1, j = arguments.length; i < j; i += 1) {
4
+ const source = arguments[i] || {};
5
+ for (const prop in source) {
6
+ if (source.hasOwnProperty(prop)) {
7
+ const value = source[prop];
8
+ if (value !== undefined) {
9
+ target[prop] = value;
10
+ }
11
+ }
12
+ }
13
+ }
14
+
15
+ return target;
16
+ }