jmash-core-mp 0.1.7 → 0.1.9

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.
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { AppConfig, ResponseData, ValidateData } from "./types/core";
1
+ export type { AppConfig, ResponseData, ValidateData, EventBase, EventTarget, CanvasResponse } from "./types/core";
2
2
  export type { Entry, DictEntryModel } from "./api/dict/types";
3
3
  export { EntryDict, EnumDict } from "./api/dicts";
4
4
  export { mpxFetch } from "./utils/request";
@@ -19,3 +19,23 @@ export interface ValidateData {
19
19
  validate: boolean;
20
20
  message: string;
21
21
  }
22
+ export interface EventBase {
23
+ changedTouches?: any;
24
+ currentTarget: EventTarget;
25
+ target?: EventTarget;
26
+ type?: string;
27
+ detail?: any;
28
+ touches: any;
29
+ }
30
+ export interface EventTarget {
31
+ dataset: any;
32
+ id: string | number;
33
+ offsetLeft?: number;
34
+ offsetTop?: number;
35
+ }
36
+ export interface CanvasResponse {
37
+ width?: number;
38
+ height?: number;
39
+ nodeCanvasType?: string;
40
+ node: any;
41
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmash-core-mp",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "private": false,
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,345 +1,355 @@
1
- <template>
2
- <view class="auth-user-box">
3
- <block wx:if="{{ isLogin }}">
4
- <view class="auth-user-l">
5
- <!-- 头像 -->
6
- <view class="avatar-wrapper">
7
- <image src="{{ baseUrl+'/v1/file/image/clip/200/200/' + userInfo.avatar }}" class="avatar-img"
8
- wx:if="{{ userInfo.avatar }}" mode="aspectFill"></image>
9
- <image src="{{ resourceUrl + '/images/mall/' + defaultAvatar }}" class="avatar-img"
10
- wx:elif="{{ defaultAvatar }}" mode="aspectFill"></image>
11
- <image src="{{ resourceUrl }}/images/mall/tswk.png" class="avatar-img" wx:else mode="aspectFill"></image>
12
- <view class="avatar-badge">
13
- <text class="badge-icon">✎</text>
14
- </view>
15
- </view>
16
-
17
- <!-- 用户信息 -->
18
- <view class="auth-user-r" bind:tap="handleUpdateUser">
19
- <view class="user-edit">
20
- <text class="user-name">{{ userInfo.realName || '微信用户' }}</text>
21
- <view class="edit-icon-bg">
22
- <text class="edit-icon">✎</text>
23
- </view>
24
- </view>
25
- <text class="user-mobile">{{ userInfo.mobilePhoneIns || '未绑定手机号' }}</text>
26
- </view>
27
-
28
- <!-- 右侧箭头 -->
29
- <view class="right-arrow" bind:tap="handleUpdateUser">
30
- <text class="arrow-icon">›</text>
31
- </view>
32
- </view>
33
- </block>
34
-
35
- <!-- 未登录状态 -->
36
- <view class="auth-user-l not-logged-in" wx:else>
37
- <view class="not-logged-wrapper">
38
- <view class="avatar-wrapper" bind:tap="handleLogin">
39
- <image src="{{ resourceUrl }}/images/mall/tswk.png" class="avatar-img not-logged" mode="aspectFill"></image>
40
- <view class="avatar-plus">
41
- <text class="plus-icon">+</text>
42
- </view>
43
- </view>
44
- <view class="auth-user-r">
45
- <text class="login-hint-text">登录后解锁更多功能</text>
46
- <view class="login-btn" bind:tap="handleLogin">
47
- <text class="login-text">立即登录</text>
48
- <text class="login-arrow">›</text>
49
- </view>
50
- </view>
51
- </view>
52
- </view>
53
- </view>
54
- </template>
55
-
56
- <script lang="ts">
57
- import mpx, { createComponent, ref, onShow, computed } from '@mpxjs/core'
58
- import { useUserStore } from '../../store/user'
59
- import { UserInfo } from "../../api/auth/types";
60
-
61
- createComponent({
62
- properties: {
63
- defaultAvatar: {
64
- type: String,
65
- value: ''
66
- },
67
- backurl: {
68
- type: String,
69
- value: '/pages/home'
70
- },
71
- tabbar: {
72
- type: String,
73
- value: 'false'
74
- }
75
- },
76
- setup(props, context) {
77
- let config = getApp().globalData.config;
78
- let resourceUrl = ref(config.resourceUrl);
79
- let baseUrl = ref(config.baseUrl);
80
- let userInfo = ref({} as UserInfo);
81
- let userStore = useUserStore();
82
- let refreshFunc = () => {
83
- // 检查登录是否有效?
84
- if (userStore.checkLogin()) {
85
- userStore.getUserInfo().then((resp) => {
86
- userInfo.value = resp;
87
- });
88
- }
89
- };
90
- onShow(refreshFunc);
91
- //console.log(resourceUrl);
92
- const isLogin = computed(() => userStore.accessToken !== '');
93
- return { resourceUrl, baseUrl, userInfo, userStore, refreshFunc, isLogin };
94
- },
95
- methods: {
96
- handleLogin() {
97
- console.log("handleLogin");
98
- //检查登录并跳转登录
99
- this.userStore.loginOnlyAC().then(() => {
100
- //登录成功,加载业务
101
- console.log("静默登录成功");
102
- this.refreshFunc();
103
- }).catch(() => {
104
- console.log("登录失败1!", this.backurl);
105
- mpx.navigateTo({
106
- url: '/jmash/pages/auth/login' + "?backurl=" + encodeURIComponent(this.backurl) + "&tabbar=" + this.tabbar
107
- })
108
- });
109
- },
110
- handleUpdateUser() {
111
- mpx.navigateTo({
112
- url: '/jmash/pages/auth/update-user'
113
- })
114
- },
115
- }
116
-
117
- })
118
- </script>
119
-
120
- <style lang="scss">
121
- @use "../../styles/index.scss" as *;
122
-
123
- // 颜色变量
124
- $primary: #07c160;
125
- $text-1: #111111;
126
- $text-2: #666666;
127
- $text-3: #999999;
128
- $border: #e8e8e8;
129
- $bg-page: #f5f5f5;
130
- $bg-card: #ffffff;
131
-
132
- .auth-user-box {
133
- display: flex;
134
- align-items: center;
135
- padding: 32rpx 24rpx;
136
- background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
137
- border-radius: 20rpx;
138
- margin: 16rpx 16rpx 24rpx;
139
- box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
140
- transition: all 0.3s;
141
-
142
- &:active {
143
- transform: translateY(1rpx);
144
- box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0.06);
145
- }
146
-
147
- .auth-user-l {
148
- display: flex;
149
- align-items: center;
150
- flex: 1;
151
- width: 100%;
152
-
153
- .avatar-wrapper {
154
- position: relative;
155
- margin-right: 20rpx;
156
- flex-shrink: 0;
157
- cursor: pointer;
158
-
159
- .avatar-img {
160
- width: 96rpx;
161
- height: 96rpx;
162
- border-radius: 50%;
163
- background-color: $bg-page;
164
- display: block;
165
- transition: all 0.3s;
166
- border: 3rpx solid rgba(7, 193, 96, 0.1);
167
- box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.1);
168
-
169
- &:active {
170
- transform: scale(1.05);
171
- }
172
-
173
- &.not-logged {
174
- opacity: 0.4;
175
- filter: grayscale(100%);
176
- box-shadow: none;
177
- }
178
- }
179
-
180
- .avatar-badge {
181
- position: absolute;
182
- right: -2rpx;
183
- bottom: -2rpx;
184
- width: 36rpx;
185
- height: 36rpx;
186
- background: $primary;
187
- border-radius: 50%;
188
- border: 2rpx solid $bg-card;
189
- display: flex;
190
- align-items: center;
191
- justify-content: center;
192
- box-shadow: 0 2rpx 6rpx rgba(7, 193, 96, 0.3);
193
-
194
- .badge-icon {
195
- font-size: 16rpx;
196
- color: #fff;
197
- }
198
- }
199
- }
200
- }
201
-
202
- .auth-user-r {
203
- flex: 1;
204
- min-width: 0;
205
-
206
- .user-edit {
207
- display: flex;
208
- align-items: center;
209
- margin-bottom: 6rpx;
210
- cursor: pointer;
211
-
212
- .user-name {
213
- font-size: 32rpx;
214
- font-weight: 600;
215
- color: $text-1;
216
- line-height: 1.2;
217
- }
218
-
219
- .edit-icon-bg {
220
- width: 32rpx;
221
- height: 32rpx;
222
- background: rgba(7, 193, 96, 0.1);
223
- border-radius: 50%;
224
- display: flex;
225
- align-items: center;
226
- justify-content: center;
227
- margin-left: 8rpx;
228
-
229
- .edit-icon {
230
- font-size: 14rpx;
231
- color: $primary;
232
- }
233
- }
234
- }
235
-
236
- .user-mobile {
237
- font-size: 24rpx;
238
- color: $text-3;
239
- line-height: 1.4;
240
- }
241
- }
242
-
243
- .right-arrow {
244
- flex-shrink: 0;
245
- width: 32rpx;
246
- height: 32rpx;
247
- display: flex;
248
- align-items: center;
249
- justify-content: center;
250
-
251
- .arrow-icon {
252
- font-size: 28rpx;
253
- color: $text-3;
254
- font-weight: 300;
255
- line-height: 1;
256
- }
257
- }
258
-
259
- // 未登录状态
260
- .not-logged-in {
261
- .not-logged-wrapper {
262
- display: flex;
263
- align-items: center;
264
- width: 100%;
265
- }
266
-
267
- .avatar-wrapper {
268
- .avatar-plus {
269
- position: absolute;
270
- right: -4rpx;
271
- bottom: -4rpx;
272
- width: 40rpx;
273
- height: 40rpx;
274
- background: $primary;
275
- border-radius: 50%;
276
- border: 3rpx solid $bg-card;
277
- display: flex;
278
- align-items: center;
279
- justify-content: center;
280
- box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.3);
281
-
282
- .plus-icon {
283
- font-size: 36rpx;
284
- color: #fff;
285
- line-height: 1;
286
- font-weight: 300;
287
- }
288
- }
289
- }
290
-
291
- .auth-user-r {
292
- display: flex;
293
- flex-direction: column;
294
- flex: 1;
295
- min-width: 0;
296
- margin-left: 8rpx;
297
-
298
- .login-hint-text {
299
- font-size: 24rpx;
300
- color: $text-3;
301
- margin-bottom: 12rpx;
302
- line-height: 1.4;
303
- }
304
-
305
- .login-btn {
306
- display: inline-flex;
307
- align-items: center;
308
- padding: 12rpx 24rpx;
309
- background: linear-gradient(135deg, #07c160 0%, #05a050 100%);
310
- border-radius: 40rpx;
311
- cursor: pointer;
312
- box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.25);
313
- transition: all 0.3s;
314
- width: fit-content;
315
-
316
- &:active {
317
- transform: scale(0.98);
318
- box-shadow: 0 2rpx 6rpx rgba(7, 193, 96, 0.2);
319
- }
320
-
321
- .login-text {
322
- font-size: 26rpx;
323
- font-weight: 600;
324
- color: #fff;
325
- }
326
-
327
- .login-arrow {
328
- font-size: 30rpx;
329
- color: #fff;
330
- margin-left: 4rpx;
331
- line-height: 1;
332
- font-weight: 300;
333
- }
334
- }
335
- }
336
- }
337
- }
338
- </style>
339
-
340
- <script type="application/json">
341
- {
342
- "component": true,
343
- "usingComponents": {}
344
- }
345
- </script>
1
+ <template>
2
+ <view class="auth-user-box">
3
+ <block wx:if="{{ isLogin }}">
4
+ <view class="auth-user-l">
5
+ <!-- 头像 -->
6
+ <view class="avatar-wrapper">
7
+ <image src="{{ baseUrl+'/v1/file/image/clip/200/200/' + userInfo.avatar }}" class="avatar-img"
8
+ wx:if="{{ userInfo.avatar }}" mode="aspectFill"></image>
9
+ <image src="{{ resourceUrl + '/images/mall/' + defaultAvatar }}" class="avatar-img"
10
+ wx:elif="{{ defaultAvatar }}" mode="aspectFill"></image>
11
+ <image src="{{ resourceUrl }}/images/mall/tswk.png" class="avatar-img" wx:else mode="aspectFill"></image>
12
+ <view class="avatar-badge">
13
+ <text class="badge-icon">✎</text>
14
+ </view>
15
+ </view>
16
+
17
+ <!-- 用户信息 -->
18
+ <view class="auth-user-r" bind:tap="handleUpdateUser">
19
+ <view class="user-edit">
20
+ <text class="user-name" style="color: {{ userNameColor }}">{{ userInfo.realName || '微信用户' }}</text>
21
+ <view class="edit-icon-bg">
22
+ <text class="edit-icon">✎</text>
23
+ </view>
24
+ </view>
25
+ <text class="user-mobile" style="color: {{ userMobileColor }}">{{ userInfo.mobilePhoneIns || '未绑定手机号'
26
+ }}</text>
27
+ </view>
28
+
29
+ <!-- 右侧箭头 -->
30
+ <view class="right-arrow" bind:tap="handleUpdateUser">
31
+ <text class="arrow-icon">›</text>
32
+ </view>
33
+ </view>
34
+ </block>
35
+
36
+ <!-- 未登录状态 -->
37
+ <view class="auth-user-l not-logged-in" wx:else>
38
+ <view class="not-logged-wrapper">
39
+ <view class="avatar-wrapper" bind:tap="handleLogin">
40
+ <image src="{{ resourceUrl }}/images/mall/tswk.png" class="avatar-img not-logged" mode="aspectFill"></image>
41
+ <view class="avatar-plus">
42
+ <text class="plus-icon">+</text>
43
+ </view>
44
+ </view>
45
+ <view class="auth-user-r">
46
+ <text class="login-hint-text">登录后解锁更多功能</text>
47
+ <view class="login-btn" bind:tap="handleLogin">
48
+ <text class="login-text">立即登录</text>
49
+ <text class="login-arrow">›</text>
50
+ </view>
51
+ </view>
52
+ </view>
53
+ </view>
54
+ </view>
55
+ </template>
56
+
57
+ <script lang="ts">
58
+ import mpx, { createComponent, ref, onShow, computed } from '@mpxjs/core'
59
+ import { useUserStore } from '../../store/user'
60
+ import { UserInfo } from "../../api/auth/types";
61
+
62
+ createComponent({
63
+ properties: {
64
+ defaultAvatar: {
65
+ type: String,
66
+ value: ''
67
+ },
68
+ backurl: {
69
+ type: String,
70
+ value: '/pages/home'
71
+ },
72
+ tabbar: {
73
+ type: String,
74
+ value: 'false'
75
+ },
76
+ userNameColor: {
77
+ type: String,
78
+ value: '#111111'
79
+ },
80
+ userMobileColor: {
81
+ type: String,
82
+ value: '#999999'
83
+ }
84
+ },
85
+ setup(props, context) {
86
+ let config = getApp().globalData.config;
87
+ let resourceUrl = ref(config.resourceUrl);
88
+ let baseUrl = ref(config.baseUrl);
89
+ let userInfo = ref({} as UserInfo);
90
+ let userStore = useUserStore();
91
+ let refreshFunc = () => {
92
+ // 检查登录是否有效?
93
+ if (userStore.checkLogin()) {
94
+ userStore.getUserInfo().then((resp) => {
95
+ userInfo.value = resp;
96
+ });
97
+ }
98
+ };
99
+ onShow(refreshFunc);
100
+ //console.log(resourceUrl);
101
+ const isLogin = computed(() => userStore.accessToken !== '');
102
+ return { resourceUrl, baseUrl, userInfo, userStore, refreshFunc, isLogin };
103
+ },
104
+ methods: {
105
+ handleLogin() {
106
+ console.log("handleLogin");
107
+ //检查登录并跳转登录
108
+ this.userStore.loginOnlyAC().then(() => {
109
+ //登录成功,加载业务
110
+ console.log("静默登录成功");
111
+ this.refreshFunc();
112
+ }).catch(() => {
113
+ console.log("登录失败1!", this.backurl);
114
+ mpx.navigateTo({
115
+ url: '/jmash/pages/auth/login' + "?backurl=" + encodeURIComponent(this.backurl) + "&tabbar=" + this.tabbar
116
+ })
117
+ });
118
+ },
119
+ handleUpdateUser() {
120
+ mpx.navigateTo({
121
+ url: '/jmash/pages/auth/update-user'
122
+ })
123
+ },
124
+ }
125
+
126
+ })
127
+ </script>
128
+
129
+ <style lang="scss">
130
+ @use "../../styles/index.scss" as *;
131
+
132
+ // 颜色变量
133
+ $primary: #07c160;
134
+ $text-1: #111111;
135
+ $text-2: #666666;
136
+ $text-3: #999999;
137
+ $border: #e8e8e8;
138
+ $bg-page: #f5f5f5;
139
+ $bg-card: #ffffff;
140
+ // 修改背景色从白色变到透明
141
+ .auth-user-box {
142
+ display: flex;
143
+ align-items: center;
144
+ padding: 32rpx 24rpx;
145
+ // background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
146
+ border-radius: 20rpx;
147
+ margin: 16rpx 16rpx 24rpx;
148
+ // box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
149
+ transition: all 0.3s;
150
+ background: transparent;
151
+
152
+ &:active {
153
+ transform: translateY(1rpx);
154
+ box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0.06);
155
+ }
156
+
157
+ .auth-user-l {
158
+ display: flex;
159
+ align-items: center;
160
+ flex: 1;
161
+ width: 100%;
162
+
163
+ .avatar-wrapper {
164
+ position: relative;
165
+ margin-right: 20rpx;
166
+ flex-shrink: 0;
167
+ cursor: pointer;
168
+
169
+ .avatar-img {
170
+ width: 96rpx;
171
+ height: 96rpx;
172
+ border-radius: 50%;
173
+ background-color: $bg-page;
174
+ display: block;
175
+ transition: all 0.3s;
176
+ border: 3rpx solid rgba(7, 193, 96, 0.1);
177
+ box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.1);
178
+
179
+ &:active {
180
+ transform: scale(1.05);
181
+ }
182
+
183
+ &.not-logged {
184
+ opacity: 0.4;
185
+ filter: grayscale(100%);
186
+ box-shadow: none;
187
+ }
188
+ }
189
+
190
+ .avatar-badge {
191
+ position: absolute;
192
+ right: -2rpx;
193
+ bottom: -2rpx;
194
+ width: 36rpx;
195
+ height: 36rpx;
196
+ background: $primary;
197
+ border-radius: 50%;
198
+ border: 2rpx solid $bg-card;
199
+ display: flex;
200
+ align-items: center;
201
+ justify-content: center;
202
+ box-shadow: 0 2rpx 6rpx rgba(7, 193, 96, 0.3);
203
+
204
+ .badge-icon {
205
+ font-size: 16rpx;
206
+ color: #fff;
207
+ }
208
+ }
209
+ }
210
+ }
211
+
212
+ .auth-user-r {
213
+ flex: 1;
214
+ min-width: 0;
215
+
216
+ .user-edit {
217
+ display: flex;
218
+ align-items: center;
219
+ margin-bottom: 10rpx;
220
+ cursor: pointer;
221
+
222
+ .user-name {
223
+ font-size: 32rpx;
224
+ font-weight: 600;
225
+ color: $text-1;
226
+ line-height: 1.2;
227
+ }
228
+
229
+ .edit-icon-bg {
230
+ width: 32rpx;
231
+ height: 32rpx;
232
+ background: rgba(7, 193, 96, 0.1);
233
+ border-radius: 50%;
234
+ display: flex;
235
+ align-items: center;
236
+ justify-content: center;
237
+ margin-left: 8rpx;
238
+
239
+ .edit-icon {
240
+ font-size: 14rpx;
241
+ color: $primary;
242
+ }
243
+ }
244
+ }
245
+
246
+ .user-mobile {
247
+ font-size: 24rpx;
248
+ color: $text-3;
249
+ line-height: 1.4;
250
+ }
251
+ }
252
+
253
+ .right-arrow {
254
+ flex-shrink: 0;
255
+ width: 32rpx;
256
+ height: 32rpx;
257
+ display: flex;
258
+ align-items: center;
259
+ justify-content: center;
260
+
261
+ .arrow-icon {
262
+ font-size: 28rpx;
263
+ color: $text-3;
264
+ font-weight: 300;
265
+ line-height: 1;
266
+ }
267
+ }
268
+
269
+ // 未登录状态
270
+ .not-logged-in {
271
+ .not-logged-wrapper {
272
+ display: flex;
273
+ align-items: center;
274
+ width: 100%;
275
+ }
276
+
277
+ .avatar-wrapper {
278
+ .avatar-plus {
279
+ position: absolute;
280
+ right: -4rpx;
281
+ bottom: -4rpx;
282
+ width: 40rpx;
283
+ height: 40rpx;
284
+ background: $primary;
285
+ border-radius: 50%;
286
+ border: 3rpx solid $bg-card;
287
+ display: flex;
288
+ align-items: center;
289
+ justify-content: center;
290
+ box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.3);
291
+
292
+ .plus-icon {
293
+ font-size: 36rpx;
294
+ color: #fff;
295
+ line-height: 1;
296
+ font-weight: 300;
297
+ }
298
+ }
299
+ }
300
+
301
+ .auth-user-r {
302
+ display: flex;
303
+ flex-direction: column;
304
+ flex: 1;
305
+ min-width: 0;
306
+ margin-left: 8rpx;
307
+
308
+ .login-hint-text {
309
+ font-size: 24rpx;
310
+ color: $text-3;
311
+ margin-bottom: 12rpx;
312
+ line-height: 1.4;
313
+ }
314
+
315
+ .login-btn {
316
+ display: inline-flex;
317
+ align-items: center;
318
+ padding: 12rpx 24rpx;
319
+ background: linear-gradient(135deg, #07c160 0%, #05a050 100%);
320
+ border-radius: 40rpx;
321
+ cursor: pointer;
322
+ box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.25);
323
+ transition: all 0.3s;
324
+ width: fit-content;
325
+
326
+ &:active {
327
+ transform: scale(0.98);
328
+ box-shadow: 0 2rpx 6rpx rgba(7, 193, 96, 0.2);
329
+ }
330
+
331
+ .login-text {
332
+ font-size: 26rpx;
333
+ font-weight: 600;
334
+ color: #fff;
335
+ }
336
+
337
+ .login-arrow {
338
+ font-size: 30rpx;
339
+ color: #fff;
340
+ margin-left: 4rpx;
341
+ line-height: 1;
342
+ font-weight: 300;
343
+ }
344
+ }
345
+ }
346
+ }
347
+ }
348
+ </style>
349
+
350
+ <script type="application/json">
351
+ {
352
+ "component": true,
353
+ "usingComponents": {}
354
+ }
355
+ </script>
@@ -110,8 +110,12 @@ createComponent({
110
110
  const defaultTitleColorWhite = "#fff";
111
111
  const defaultTitleColorBlack = "#333";
112
112
  let color: string;
113
- // 只有开启渐变模式时才改变标题颜色
114
- let titleColor = this.isGradient ? (scrollTop >= 80 ? defaultTitleColorBlack : (scrollTop > 0 ? defaultTitleColorWhite : defaultTitleColorBlack)) : this.titleColor;
113
+ // 计算标题颜色:回到顶部时使用自定义颜色,否则根据渐变模式切换
114
+ let titleColor = scrollTop === 0
115
+ ? this.titleColor
116
+ : (this.isGradient
117
+ ? (scrollTop >= 80 ? defaultTitleColorBlack : defaultTitleColorWhite)
118
+ : this.titleColor);
115
119
 
116
120
  if (scrollTop === 0) {
117
121
  color = "rgba(255, 255, 255, 0)";
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type { AppConfig, ResponseData, ValidateData } from "./types/core";
1
+ export type { AppConfig, ResponseData, ValidateData, EventBase, EventTarget, CanvasResponse } from "./types/core";
2
2
  export type { Entry, DictEntryModel } from "./api/dict/types";
3
3
  export { EntryDict, EnumDict } from "./api/dicts";
4
4
  export { mpxFetch } from "./utils/request";
@@ -1,30 +1,4 @@
1
- // 圆角
2
- $border-radius: 20rpx;
3
- $border-mini-radius: 10rpx;
4
- $border-max-radius: 50rpx;
5
- // 字体大小
6
- $font-size: 28rpx;
7
- $font-size-mini: 24rpx;
8
- // 颜色
9
- $white-color: #fff;
10
- $red-color: #ef4444;
11
- $green-color: #16a34a;
12
- $blue-color: #2563eb;
13
- $black-color: #000;
14
- // 字体颜色
15
- $font-color: #333;
16
- $font-color-grey: #666;
17
- $font-color-grey-opacity: #999;
18
- // 宽
19
- $width: 100%;
20
- // 层级
21
- $z-index: 99999;
22
- // 下拉线颜色
23
- $border-line: #ebebeb;
24
- // 背景色
25
- $background-color: #f6f6f6;
26
- // 白色背景
27
- $background-white-color: #fff;
1
+ @forward "@/styles/vars.scss";
28
2
 
29
3
  //tabbar web 放在底部
30
4
  /* @mpx-if (__mpx_mode__ === 'web') */
@@ -0,0 +1,27 @@
1
+ // 圆角
2
+ $border-radius: 20rpx;
3
+ $border-mini-radius: 10rpx;
4
+ $border-max-radius: 50rpx;
5
+ // 字体大小
6
+ $font-size: 28rpx;
7
+ $font-size-mini: 24rpx;
8
+ // 颜色
9
+ $white-color: #fff;
10
+ $red-color: #ef4444;
11
+ $green-color: #16a34a;
12
+ $blue-color: #2563eb;
13
+ $black-color: #000;
14
+ // 字体颜色
15
+ $font-color: #333;
16
+ $font-color-grey: #666;
17
+ $font-color-grey-opacity: #999;
18
+ // 宽
19
+ $width: 100%;
20
+ // 层级
21
+ $z-index: 99999;
22
+ // 下拉线颜色
23
+ $border-line: #ebebeb;
24
+ // 背景色
25
+ $background-color: #f6f6f6;
26
+ // 白色背景
27
+ $background-white-color: #fff;
package/src/types/core.ts CHANGED
@@ -39,3 +39,32 @@ export interface ValidateData {
39
39
  // 校验失败提示信息.
40
40
  message: string;
41
41
  }
42
+
43
+ // 事件基础
44
+ export interface EventBase {
45
+ // 在触摸事件中使用,表示触摸点的状态
46
+ changedTouches?: any;
47
+ // 事件绑定的元素
48
+ currentTarget: EventTarget;
49
+ // 指向触发事件的目标节点
50
+ target?: EventTarget;
51
+ // 事件的类型,指示事件的具体类型,如 click, input, blur
52
+ type?: string;
53
+ detail?: any;
54
+ touches: any;
55
+ }
56
+ // 事件绑定的元素
57
+ export interface EventTarget {
58
+ dataset: any;
59
+ id: string | number;
60
+ offsetLeft?: number;
61
+ offsetTop?: number;
62
+ }
63
+
64
+ // canvas返回的数据
65
+ export interface CanvasResponse {
66
+ width?: number;
67
+ height?: number;
68
+ nodeCanvasType?: string;
69
+ node: any;
70
+ }
@@ -1,31 +0,0 @@
1
- <template>
2
- <view class="search-component">
3
- <text>搜索组件</text>
4
- </view>
5
- </template>
6
-
7
- <script>
8
- import { createComponent } from '@mpxjs/core'
9
-
10
- createComponent({
11
- data: {
12
- title: '搜索'
13
- }
14
- })
15
- </script>
16
-
17
- <style lang="scss">
18
- .search-component {
19
- padding: 40rpx;
20
- text-align: center;
21
- font-size: 32rpx;
22
- color: #333;
23
- }
24
- </style>
25
-
26
- <script type="application/json">
27
- {
28
- "component": true,
29
- "usingComponents": {}
30
- }
31
- </script>