jmash-core-mp 0.1.15 → 0.1.17

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.
@@ -103,8 +103,8 @@ mpx.xfetch.interceptors.response.use(function (res) {
103
103
  }
104
104
  return Promise.reject(res);
105
105
  }
106
- // 也可以返回promise
107
- return res;
106
+ // 返回promise,通过catch ,处理 code,message.
107
+ return Promise.reject(res);
108
108
  });
109
109
  //刷新Token
110
110
  function refreshToken(refreshToken) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmash-core-mp",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "private": false,
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,356 +1,359 @@
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
- // 修改背景色从白色变到透明
142
- .auth-user-box {
143
- display: flex;
144
- align-items: center;
145
- padding: 32rpx 24rpx;
146
- // background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
147
- border-radius: 20rpx;
148
- margin: 16rpx 16rpx 24rpx;
149
- // box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
150
- transition: all 0.3s;
151
- background: transparent;
152
-
153
- &:active {
154
- transform: translateY(1rpx);
155
- box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0.06);
156
- }
157
-
158
- .auth-user-l {
159
- display: flex;
160
- align-items: center;
161
- flex: 1;
162
- width: 100%;
163
-
164
- .avatar-wrapper {
165
- position: relative;
166
- margin-right: 20rpx;
167
- flex-shrink: 0;
168
- cursor: pointer;
169
-
170
- .avatar-img {
171
- width: 130rpx;
172
- height: 130rpx;
173
- border-radius: 50%;
174
- background-color: $bg-page;
175
- display: block;
176
- transition: all 0.3s;
177
- border: 3rpx solid rgba(7, 193, 96, 0.1);
178
- box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.1);
179
-
180
- &:active {
181
- transform: scale(1.05);
182
- }
183
-
184
- &.not-logged {
185
- opacity: 0.4;
186
- filter: grayscale(100%);
187
- box-shadow: none;
188
- }
189
- }
190
-
191
- .avatar-badge {
192
- position: absolute;
193
- right: -2rpx;
194
- bottom: -2rpx;
195
- width: 36rpx;
196
- height: 36rpx;
197
- background: $primary;
198
- border-radius: 50%;
199
- border: 2rpx solid $bg-card;
200
- display: flex;
201
- align-items: center;
202
- justify-content: center;
203
- box-shadow: 0 2rpx 6rpx rgba(7, 193, 96, 0.3);
204
-
205
- .badge-icon {
206
- font-size: 16rpx;
207
- color: #fff;
208
- }
209
- }
210
- }
211
- }
212
-
213
- .auth-user-r {
214
- flex: 1;
215
- min-width: 0;
216
-
217
- .user-edit {
218
- display: flex;
219
- align-items: center;
220
- margin-bottom: 10rpx;
221
- cursor: pointer;
222
-
223
- .user-name {
224
- font-size: 32rpx;
225
- font-weight: 600;
226
- color: $text-1;
227
- line-height: 1.2;
228
- }
229
-
230
- .edit-icon-bg {
231
- width: 32rpx;
232
- height: 32rpx;
233
- background: rgba(7, 193, 96, 0.1);
234
- border-radius: 50%;
235
- display: flex;
236
- align-items: center;
237
- justify-content: center;
238
- margin-left: 8rpx;
239
-
240
- .edit-icon {
241
- font-size: 14rpx;
242
- color: $primary;
243
- }
244
- }
245
- }
246
-
247
- .user-mobile {
248
- font-size: 24rpx;
249
- color: $text-3;
250
- line-height: 1.4;
251
- }
252
- }
253
-
254
- .right-arrow {
255
- flex-shrink: 0;
256
- width: 32rpx;
257
- height: 32rpx;
258
- display: flex;
259
- align-items: center;
260
- justify-content: center;
261
-
262
- .arrow-icon {
263
- font-size: 28rpx;
264
- color: $text-3;
265
- font-weight: 300;
266
- line-height: 1;
267
- }
268
- }
269
-
270
- // 未登录状态
271
- .not-logged-in {
272
- .not-logged-wrapper {
273
- display: flex;
274
- align-items: center;
275
- width: 100%;
276
- }
277
-
278
- .avatar-wrapper {
279
- .avatar-plus {
280
- position: absolute;
281
- right: -4rpx;
282
- bottom: -4rpx;
283
- width: 40rpx;
284
- height: 40rpx;
285
- background: $primary;
286
- border-radius: 50%;
287
- border: 3rpx solid $bg-card;
288
- display: flex;
289
- align-items: center;
290
- justify-content: center;
291
- box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.3);
292
-
293
- .plus-icon {
294
- font-size: 36rpx;
295
- color: #fff;
296
- line-height: 1;
297
- font-weight: 300;
298
- }
299
- }
300
- }
301
-
302
- .auth-user-r {
303
- display: flex;
304
- flex-direction: column;
305
- flex: 1;
306
- min-width: 0;
307
- margin-left: 8rpx;
308
-
309
- .login-hint-text {
310
- font-size: 24rpx;
311
- color: $text-3;
312
- margin-bottom: 12rpx;
313
- line-height: 1.4;
314
- }
315
-
316
- .login-btn {
317
- display: inline-flex;
318
- align-items: center;
319
- padding: 12rpx 24rpx;
320
- background: linear-gradient(135deg, #07c160 0%, #05a050 100%);
321
- border-radius: 40rpx;
322
- cursor: pointer;
323
- box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.25);
324
- transition: all 0.3s;
325
- width: fit-content;
326
-
327
- &:active {
328
- transform: scale(0.98);
329
- box-shadow: 0 2rpx 6rpx rgba(7, 193, 96, 0.2);
330
- }
331
-
332
- .login-text {
333
- font-size: 26rpx;
334
- font-weight: 600;
335
- color: #fff;
336
- }
337
-
338
- .login-arrow {
339
- font-size: 30rpx;
340
- color: #fff;
341
- margin-left: 4rpx;
342
- line-height: 1;
343
- font-weight: 300;
344
- }
345
- }
346
- }
347
- }
348
- }
349
- </style>
350
-
351
- <script type="application/json">
352
- {
353
- "component": true,
354
- "usingComponents": {}
355
- }
356
- </script>
1
+ <template>
2
+ <view class="auth-user-box">
3
+ <block wx:if="{{ isLogin }}">
4
+ <view class="auth-user-l" bind:tap="handleUpdateUser">
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="{{ defaultAvatar }}" class="avatar-img" wx:elif="{{ defaultAvatar }}" mode="aspectFill"></image>
10
+ <image src="{{ resourceUrl }}/images/mall/tswk.png" class="avatar-img" wx:else mode="aspectFill"></image>
11
+ <!-- <view class="avatar-badge">
12
+ <text class="badge-icon">✎</text>
13
+ </view> -->
14
+ </view>
15
+
16
+ <!-- 用户信息 -->
17
+ <view class="auth-user-r" bind:tap="handleUpdateUser">
18
+ <view class="user-edit">
19
+ <text class="user-name" style="color: {{ userNameColor }}">{{ userInfo.realName || '微信用户' }}</text>
20
+ <view class="edit-icon-bg">
21
+ <text class="edit-icon">✎</text>
22
+ </view>
23
+ </view>
24
+ <text class="user-mobile" style="color: {{ userMobileColor }}">{{ userInfo.mobilePhoneIns || '未绑定手机号'
25
+ }}</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
+ <image src="{{ defaultAvatar }}" class="avatar-img not-logged" wx:if="{{ defaultAvatar }}" mode="aspectFill">
41
+ </image>
42
+ <image src="{{ resourceUrl }}/images/mall/tswk.png" class="avatar-img not-logged" wx:else mode="aspectFill">
43
+ </image>
44
+ <view class="avatar-plus">
45
+ <text class="plus-icon">+</text>
46
+ </view>
47
+ </view>
48
+ <view class="auth-user-r">
49
+ <text class="login-hint-text">登录后解锁更多功能</text>
50
+ <view class="login-btn" bind:tap="handleLogin">
51
+ <text class="login-text">立即登录</text>
52
+ <text class="login-arrow">›</text>
53
+ </view>
54
+ </view>
55
+ </view>
56
+ </view>
57
+ </view>
58
+ </template>
59
+
60
+ <script lang="ts">
61
+ import mpx, { createComponent, ref, onShow, computed } from '@mpxjs/core'
62
+ import { useUserStore } from '../../store/user'
63
+ import { UserInfo } from "../../api/auth/types";
64
+
65
+ createComponent({
66
+ properties: {
67
+ defaultAvatar: {
68
+ type: String,
69
+ value: ''
70
+ },
71
+ backurl: {
72
+ type: String,
73
+ value: '/pages/home'
74
+ },
75
+ tabbar: {
76
+ type: String,
77
+ value: 'false'
78
+ },
79
+ userNameColor: {
80
+ type: String,
81
+ value: '#111111'
82
+ },
83
+ userMobileColor: {
84
+ type: String,
85
+ value: '#999999'
86
+ }
87
+ },
88
+ setup(props, context) {
89
+ let config = getApp().globalData.config;
90
+ let resourceUrl = ref(config.resourceUrl);
91
+ let baseUrl = ref(config.baseUrl);
92
+ let userInfo = ref({} as UserInfo);
93
+ let userStore = useUserStore();
94
+ let refreshFunc = () => {
95
+ // 检查登录是否有效?
96
+ if (userStore.checkLogin()) {
97
+ userStore.getUserInfo().then((resp) => {
98
+ userInfo.value = resp;
99
+ });
100
+ }
101
+ };
102
+ onShow(refreshFunc);
103
+ //console.log(resourceUrl);
104
+ const isLogin = computed(() => userStore.accessToken !== '');
105
+ return { resourceUrl, baseUrl, userInfo, userStore, refreshFunc, isLogin };
106
+ },
107
+ methods: {
108
+ handleLogin() {
109
+ console.log("handleLogin");
110
+ //检查登录并跳转登录
111
+ this.userStore.loginOnlyAC().then(() => {
112
+ //登录成功,加载业务
113
+ console.log("静默登录成功");
114
+ this.refreshFunc();
115
+ }).catch(() => {
116
+ console.log("登录失败1!", this.backurl);
117
+ mpx.navigateTo({
118
+ url: '/jmash/pages/auth/login' + "?backurl=" + encodeURIComponent(this.backurl) + "&tabbar=" + this.tabbar
119
+ })
120
+ });
121
+ },
122
+ handleUpdateUser() {
123
+ mpx.navigateTo({
124
+ url: '/jmash/pages/auth/update-user'
125
+ })
126
+ },
127
+ }
128
+
129
+ })
130
+ </script>
131
+
132
+ <style lang="scss">
133
+ @use "../../styles/index.scss" as *;
134
+
135
+ // 颜色变量
136
+ $primary: #07c160;
137
+ $text-1: #111111;
138
+ $text-2: #666666;
139
+ $text-3: #999999;
140
+ $border: #e8e8e8;
141
+ $bg-page: #f5f5f5;
142
+ $bg-card: #ffffff;
143
+
144
+ // 修改背景色从白色变到透明
145
+ .auth-user-box {
146
+ display: flex;
147
+ align-items: center;
148
+ padding: 32rpx 24rpx 32rpx 0;
149
+ // background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
150
+ border-radius: 20rpx;
151
+ margin: 16rpx 16rpx 24rpx 0;
152
+ // box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
153
+ transition: all 0.3s;
154
+ background: transparent;
155
+
156
+ &:active {
157
+ transform: translateY(1rpx);
158
+ box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0.06);
159
+ }
160
+
161
+ .auth-user-l {
162
+ display: flex;
163
+ align-items: center;
164
+ flex: 1;
165
+ width: 100%;
166
+
167
+ .avatar-wrapper {
168
+ position: relative;
169
+ margin-right: 30rpx;
170
+ flex-shrink: 0;
171
+ cursor: pointer;
172
+
173
+ .avatar-img {
174
+ width: 130rpx;
175
+ height: 130rpx;
176
+ border-radius: 50%;
177
+ // background-color: $bg-page;
178
+ display: block;
179
+ transition: all 0.3s;
180
+ // border: 3rpx solid rgba(7, 193, 96, 0.1);
181
+ // box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.1);
182
+
183
+ &:active {
184
+ transform: scale(1.05);
185
+ }
186
+
187
+ &.not-logged {
188
+ opacity: 0.4;
189
+ filter: grayscale(100%);
190
+ box-shadow: none;
191
+ }
192
+ }
193
+
194
+ .avatar-badge {
195
+ position: absolute;
196
+ right: -2rpx;
197
+ bottom: -2rpx;
198
+ width: 36rpx;
199
+ height: 36rpx;
200
+ background: $primary;
201
+ border-radius: 50%;
202
+ border: 2rpx solid $bg-card;
203
+ display: flex;
204
+ align-items: center;
205
+ justify-content: center;
206
+ box-shadow: 0 2rpx 6rpx rgba(7, 193, 96, 0.3);
207
+
208
+ .badge-icon {
209
+ font-size: 16rpx;
210
+ color: #fff;
211
+ }
212
+ }
213
+ }
214
+ }
215
+
216
+ .auth-user-r {
217
+ flex: 1;
218
+ min-width: 0;
219
+
220
+ .user-edit {
221
+ display: flex;
222
+ align-items: center;
223
+ margin-bottom: 10rpx;
224
+ cursor: pointer;
225
+
226
+ .user-name {
227
+ font-size: 32rpx;
228
+ font-weight: 600;
229
+ color: $text-1;
230
+ line-height: 1.2;
231
+ }
232
+
233
+ .edit-icon-bg {
234
+ width: 36rpx;
235
+ height: 36rpx;
236
+ background: $primary;
237
+ border-radius: 50%;
238
+ display: flex;
239
+ align-items: center;
240
+ justify-content: center;
241
+ margin-left: 8rpx;
242
+
243
+ .edit-icon {
244
+ font-size: 16rpx;
245
+ color: #fff;
246
+ }
247
+ }
248
+ }
249
+
250
+ .user-mobile {
251
+ font-size: 24rpx;
252
+ color: $text-3;
253
+ line-height: 1.4;
254
+ }
255
+ }
256
+
257
+ .right-arrow {
258
+ flex-shrink: 0;
259
+ width: 32rpx;
260
+ height: 32rpx;
261
+ display: flex;
262
+ align-items: center;
263
+ justify-content: center;
264
+
265
+ .arrow-icon {
266
+ font-size: 66rpx;
267
+ color: $text-3;
268
+ font-weight: 300;
269
+ line-height: 1;
270
+ }
271
+ }
272
+
273
+ // 未登录状态
274
+ .not-logged-in {
275
+ .not-logged-wrapper {
276
+ display: flex;
277
+ align-items: center;
278
+ width: 100%;
279
+ }
280
+
281
+ .avatar-wrapper {
282
+ .avatar-plus {
283
+ position: absolute;
284
+ right: -4rpx;
285
+ bottom: -4rpx;
286
+ width: 40rpx;
287
+ height: 40rpx;
288
+ background: $primary;
289
+ border-radius: 50%;
290
+ border: 3rpx solid $bg-card;
291
+ display: flex;
292
+ align-items: center;
293
+ justify-content: center;
294
+ box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.3);
295
+
296
+ .plus-icon {
297
+ font-size: 36rpx;
298
+ color: #fff;
299
+ line-height: 1;
300
+ font-weight: 300;
301
+ }
302
+ }
303
+ }
304
+
305
+ .auth-user-r {
306
+ display: flex;
307
+ flex-direction: column;
308
+ flex: 1;
309
+ min-width: 0;
310
+ margin-left: 8rpx;
311
+
312
+ .login-hint-text {
313
+ font-size: 24rpx;
314
+ color: $text-3;
315
+ margin-bottom: 12rpx;
316
+ line-height: 1.4;
317
+ }
318
+
319
+ .login-btn {
320
+ display: inline-flex;
321
+ align-items: center;
322
+ padding: 12rpx 24rpx;
323
+ background: linear-gradient(135deg, #07c160 0%, #05a050 100%);
324
+ border-radius: 40rpx;
325
+ cursor: pointer;
326
+ box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.25);
327
+ transition: all 0.3s;
328
+ width: fit-content;
329
+
330
+ &:active {
331
+ transform: scale(0.98);
332
+ box-shadow: 0 2rpx 6rpx rgba(7, 193, 96, 0.2);
333
+ }
334
+
335
+ .login-text {
336
+ font-size: 26rpx;
337
+ font-weight: 600;
338
+ color: #fff;
339
+ }
340
+
341
+ .login-arrow {
342
+ font-size: 30rpx;
343
+ color: #fff;
344
+ margin-left: 4rpx;
345
+ line-height: 1;
346
+ font-weight: 300;
347
+ }
348
+ }
349
+ }
350
+ }
351
+ }
352
+ </style>
353
+
354
+ <script type="application/json">
355
+ {
356
+ "component": true,
357
+ "usingComponents": {}
358
+ }
359
+ </script>
@@ -1,77 +1,82 @@
1
- <template>
2
- <view class="auth-none-data" style="margin-top: {{ marginTop }}rpx; padding-top: {{ paddingTop }}rpx;">
3
- <image src="{{ resourceUrl + imgUrl }}" mode="heightFix" style="width: {{ imgWidth }};height: {{ imgHeight }};" />
4
- <view class="holder-text" style="color: {{ contentColor }};">{{ content }}</view>
5
- </view>
6
- </template>
7
- <script lang="ts">
8
- import { createComponent } from "@mpxjs/core"
9
- import { config } from "../../utils/config";
10
-
11
- createComponent({
12
- properties: {
13
- // 上外边距
14
- marginTop: {
15
- type: Number,
16
- value: 300
17
- },
18
- // 上内边距
19
- paddingTop: {
20
- type: Number,
21
- value: 0
22
- },
23
- // 文本内容
24
- content: {
25
- type: String,
26
- value: "暂无数据"
27
- },
28
- // 图片的宽
29
- imgWidth: {
30
- type: String,
31
- value: "auto"
32
- },
33
- // 图片的高
34
- imgHeight: {
35
- type: String,
36
- value: "125px"
37
- },
38
- // 图片的路径
39
- imgUrl: {
40
- type: String,
41
- value: "/components/contacts_nomore2x.png"
42
- },
43
- contentColor: {
44
- type: String,
45
- value: "#b6b6b6"
46
- }
47
- },
48
- setup() {
49
- let resourceUrl = config.resourceUrl + "/images/"
50
-
51
- return {
52
- resourceUrl
53
- }
54
- }
55
- })
56
- </script>
57
-
58
- <style lang="scss">
59
- @use "../../styles/index.scss" as *;
60
-
61
- .auth-none-data {
62
- display: flex;
63
- align-items: center;
64
- justify-content: center;
65
- flex-direction: column;
66
-
67
- .holder-text {
68
- font-size: $font-size;
69
- }
70
- }
71
- </style>
72
-
73
- <script type="application/json">
74
- {
75
- "component": true
76
- }
77
- </script>
1
+ <template>
2
+ <view class="auth-none-data" style="margin-top: {{ marginTop }}rpx; padding-top: {{ paddingTop }}rpx;">
3
+ <image src="{{ resourceUrl + imgUrl }}" mode="heightFix" style="width: {{ imgWidth }};height: {{ imgHeight }};" />
4
+ <view class="holder-text" style="color: {{ contentColor }};margin-top: {{ imgTextGap }}rpx;">{{ content }}</view>
5
+ </view>
6
+ </template>
7
+ <script lang="ts">
8
+ import { createComponent } from "@mpxjs/core"
9
+ import { config } from "../../utils/config";
10
+
11
+ createComponent({
12
+ properties: {
13
+ // 图片与文本之间的间距
14
+ imgTextGap: {
15
+ type: Number,
16
+ value: 0
17
+ },
18
+ // 上外边距
19
+ marginTop: {
20
+ type: Number,
21
+ value: 300
22
+ },
23
+ // 上内边距
24
+ paddingTop: {
25
+ type: Number,
26
+ value: 0
27
+ },
28
+ // 文本内容
29
+ content: {
30
+ type: String,
31
+ value: "暂无数据"
32
+ },
33
+ // 图片的宽
34
+ imgWidth: {
35
+ type: String,
36
+ value: "auto"
37
+ },
38
+ // 图片的高
39
+ imgHeight: {
40
+ type: String,
41
+ value: "125px"
42
+ },
43
+ // 图片的路径
44
+ imgUrl: {
45
+ type: String,
46
+ value: "/components/contacts_nomore2x.png"
47
+ },
48
+ contentColor: {
49
+ type: String,
50
+ value: "#b6b6b6"
51
+ }
52
+ },
53
+ setup() {
54
+ let resourceUrl = config.resourceUrl + "/images/"
55
+
56
+ return {
57
+ resourceUrl
58
+ }
59
+ }
60
+ })
61
+ </script>
62
+
63
+ <style lang="scss">
64
+ @use "../../styles/index.scss" as *;
65
+
66
+ .auth-none-data {
67
+ display: flex;
68
+ align-items: center;
69
+ justify-content: center;
70
+ flex-direction: column;
71
+
72
+ .holder-text {
73
+ font-size: $font-size;
74
+ }
75
+ }
76
+ </style>
77
+
78
+ <script type="application/json">
79
+ {
80
+ "component": true
81
+ }
82
+ </script>
@@ -1,44 +1,44 @@
1
- <template>
2
- <view class="page-body">
3
- <button type="default" bind:tap="toHomePage">Welcome to Jmash Core MP</button>
4
- </view>
5
- </template>
6
-
7
- <script>
8
- import mpx, { createPage } from '@mpxjs/core'
9
-
10
- createPage({
11
- setup(props, context) {
12
- return {};
13
- },
14
- methods: {
15
- toHomePage() {
16
- mpx.switchTab({
17
- url: '/pages/tabbar/home'
18
- })
19
- },
20
- }
21
- })
22
- </script>
23
-
24
- <style lang="scss">
25
- .page-body {
26
- display: flex;
27
- flex-direction: column;
28
- align-items: center;
29
- padding: 40rpx;
30
- gap: 30rpx;
31
-
32
- button {
33
- width: 80%;
34
- height: 80rpx;
35
- font-size: 32rpx;
36
- }
37
- }
38
- </style>
39
-
40
- <script type="application/json">
41
- {
42
- "usingComponents": {}
43
- }
44
- </script>
1
+ <template>
2
+ <view class="page-body">
3
+ <button type="default" bind:tap="toHomePage">Welcome to Jmash Core MP</button>
4
+ </view>
5
+ </template>
6
+
7
+ <script>
8
+ import mpx, { createPage } from '@mpxjs/core'
9
+
10
+ createPage({
11
+ setup(props, context) {
12
+ return {};
13
+ },
14
+ methods: {
15
+ toHomePage() {
16
+ mpx.switchTab({
17
+ url: '/pages/tabbar/home'
18
+ })
19
+ },
20
+ }
21
+ })
22
+ </script>
23
+
24
+ <style lang="scss">
25
+ .page-body {
26
+ display: flex;
27
+ flex-direction: column;
28
+ align-items: center;
29
+ padding: 40rpx;
30
+ gap: 30rpx;
31
+
32
+ button {
33
+ width: 80%;
34
+ height: 80rpx;
35
+ font-size: 32rpx;
36
+ }
37
+ }
38
+ </style>
39
+
40
+ <script type="application/json">
41
+ {
42
+ "usingComponents": {}
43
+ }
44
+ </script>
@@ -113,8 +113,8 @@ mpx.xfetch.interceptors.response.use(function (res) {
113
113
  }
114
114
  return Promise.reject(res);
115
115
  }
116
- // 也可以返回promise
117
- return res;
116
+ // 返回promise,通过catch ,处理 code,message.
117
+ return Promise.reject(res);
118
118
  });
119
119
 
120
120
  //刷新Token
@@ -1,41 +0,0 @@
1
- /// <reference types="miniprogram-api-typings" />
2
- /// <reference types="miniprogram-api-typings" />
3
- export type ResponseData<T extends string | WechatMiniprogram.IAnyObject | ArrayBuffer = string | WechatMiniprogram.IAnyObject | ArrayBuffer> = WechatMiniprogram.RequestSuccessCallbackResult<T>;
4
- export interface AppConfig {
5
- tenant: string;
6
- name: string;
7
- baseUrl: string;
8
- resourceUrl: string;
9
- appId: string;
10
- componentAppid: string;
11
- wechatComponentAppId: string;
12
- wechatAppId: string;
13
- wechatBiz: string;
14
- siteId: string;
15
- dev: boolean;
16
- testNewUser: boolean;
17
- }
18
- export interface ValidateData {
19
- validate: boolean;
20
- message: string;
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
- }
File without changes