jmash-core-mp 0.1.27 → 0.1.28
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/package.json +1 -1
- package/src/app.mpx +3 -14
- package/src/components/auth-user/jmash-logout.mpx +4 -2
- package/src/components/auth-user/jmash-user.mpx +4 -55
- package/src/components/cms/jmash-cms-article-list.mpx +1 -1
- package/src/components/cms/jmash-cms-like.mpx +1 -1
- package/src/components/cms/jmash-cms-location-list.mpx +1 -1
- package/src/components/cms/jmash-cms-product-list.mpx +1 -1
- package/src/components/common/jmash-avatar-edit.mpx +1 -1
- package/src/components/common/jmash-popup.mpx +5 -0
- package/src/components/common/jmash-tab-bar.mpx +1 -5
- package/src/components/core/jmash-cms-protocol.mpx +1 -1
- package/src/components/core/jmash-login.mpx +2 -3
- package/src/components/core/jmash-login.web.mpx +2 -3
- package/src/components/core/jmash-popup-login.ali.mpx +2 -1
- package/src/packages/pages/auth/cms-protocol.mpx +1 -2
- package/src/packages/pages/cms/cms-article.mpx +1 -2
- package/src/packages/pages/cms/cms-location.mpx +1 -2
- package/src/pages/half-home.mpx +2 -2
- package/src/pages/home.mpx +3 -3
- package/src/pages/home2.mpx +2 -2
- package/src/store/user.ts +0 -1
- package/src/utils/common.ts +0 -1
- package/src/utils/request.ts +0 -3
package/package.json
CHANGED
package/src/app.mpx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import mpx, { createApp } from '@mpxjs/core';
|
|
3
|
-
//api代理
|
|
3
|
+
// api代理
|
|
4
4
|
import apiProxy from '@mpxjs/api-proxy';
|
|
5
5
|
mpx.use(apiProxy, { usePromise: true })
|
|
6
|
-
|
|
6
|
+
// 状态管理
|
|
7
7
|
import { createPinia } from '@mpxjs/pinia';
|
|
8
8
|
createPinia();
|
|
9
|
-
|
|
9
|
+
// 网络请求和App配置
|
|
10
10
|
import { mpxFetch, config, initConfig } from "./index";
|
|
11
11
|
mpx.use(mpxFetch);
|
|
12
12
|
|
|
@@ -58,14 +58,3 @@ createApp({
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
</script>
|
|
61
|
-
|
|
62
|
-
<!--也可以通过以下形式用js输出json,便于书写注释和使用条件编译-->
|
|
63
|
-
|
|
64
|
-
<!--<script name="json">-->
|
|
65
|
-
<!-- // 可以写注释,通过defs注入的常量做一些判断之类的操作-->
|
|
66
|
-
<!-- module.exports = {-->
|
|
67
|
-
<!-- pages: [-->
|
|
68
|
-
<!-- './pages/index'-->
|
|
69
|
-
<!-- ]-->
|
|
70
|
-
<!-- }-->
|
|
71
|
-
<!--</script>-->
|
|
@@ -33,7 +33,8 @@ createComponent({
|
|
|
33
33
|
content: '确定要退出登录吗?',
|
|
34
34
|
success: (res) => {
|
|
35
35
|
if (res.confirm) {
|
|
36
|
-
|
|
36
|
+
// 调用退出接口
|
|
37
|
+
this.userStore.logout()
|
|
37
38
|
mpx.showToast({ title: '已退出登录', icon: 'success' })
|
|
38
39
|
// 通知父组件退出成功
|
|
39
40
|
this.triggerEvent('logoutSuccess');
|
|
@@ -50,7 +51,8 @@ $primary: #07c160;
|
|
|
50
51
|
$text-3: #999999;
|
|
51
52
|
|
|
52
53
|
.logout-section {
|
|
53
|
-
|
|
54
|
+
// 底部留空适配tabbar
|
|
55
|
+
padding: 40rpx 16rpx 80rpx;
|
|
54
56
|
display: flex;
|
|
55
57
|
flex-direction: column;
|
|
56
58
|
align-items: center;
|
|
@@ -8,9 +8,6 @@
|
|
|
8
8
|
wx:if="{{ userInfo.avatar }}" mode="aspectFill"></image>
|
|
9
9
|
<image src="{{ defaultAvatar }}" class="avatar-img" wx:elif="{{ defaultAvatar }}" mode="aspectFill"></image>
|
|
10
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
11
|
</view>
|
|
15
12
|
|
|
16
13
|
<!-- 用户信息 -->
|
|
@@ -22,13 +19,8 @@
|
|
|
22
19
|
</view>
|
|
23
20
|
</view>
|
|
24
21
|
<text class="user-mobile" style="color: {{ userMobileColor }}">{{ userInfo.mobilePhoneIns || '未绑定手机号'
|
|
25
|
-
|
|
22
|
+
}}</text>
|
|
26
23
|
</view>
|
|
27
|
-
|
|
28
|
-
<!-- 右侧箭头 -->
|
|
29
|
-
<!-- <view class="right-arrow" bind:tap="handleUpdateUser">
|
|
30
|
-
<text class="arrow-icon">›</text>
|
|
31
|
-
</view> -->
|
|
32
24
|
</view>
|
|
33
25
|
</block>
|
|
34
26
|
|
|
@@ -36,7 +28,6 @@
|
|
|
36
28
|
<view class="auth-user-l not-logged-in" wx:else>
|
|
37
29
|
<view class="not-logged-wrapper">
|
|
38
30
|
<view class="avatar-wrapper" bind:tap="handleLogin">
|
|
39
|
-
<!-- <image src="{{ resourceUrl }}/images/mall/tswk.png" class="avatar-img not-logged" mode="aspectFill"></image> -->
|
|
40
31
|
<image src="{{ defaultAvatar }}" class="avatar-img not-logged" wx:if="{{ defaultAvatar }}" mode="aspectFill">
|
|
41
32
|
</image>
|
|
42
33
|
<image src="{{ resourceUrl }}/images/mall/tswk.png" class="avatar-img not-logged" wx:else mode="aspectFill">
|
|
@@ -66,7 +57,7 @@ createComponent({
|
|
|
66
57
|
properties: {
|
|
67
58
|
defaultAvatar: {
|
|
68
59
|
type: String,
|
|
69
|
-
value:
|
|
60
|
+
value: getApp().globalData.config.resourceUrl + "/images/mall/tswk.png"
|
|
70
61
|
},
|
|
71
62
|
backurl: {
|
|
72
63
|
type: String,
|
|
@@ -100,16 +91,15 @@ createComponent({
|
|
|
100
91
|
}
|
|
101
92
|
};
|
|
102
93
|
onShow(refreshFunc);
|
|
103
|
-
//console.log(resourceUrl);
|
|
104
94
|
const isLogin = computed(() => userStore.accessToken !== '');
|
|
105
95
|
return { resourceUrl, baseUrl, userInfo, userStore, refreshFunc, isLogin };
|
|
106
96
|
},
|
|
107
97
|
methods: {
|
|
108
98
|
handleLogin() {
|
|
109
99
|
console.log("handleLogin");
|
|
110
|
-
|
|
100
|
+
// 检查登录并跳转登录
|
|
111
101
|
this.userStore.loginOnlyAC().then(() => {
|
|
112
|
-
|
|
102
|
+
// 登录成功,加载业务
|
|
113
103
|
console.log("静默登录成功");
|
|
114
104
|
this.refreshFunc();
|
|
115
105
|
}).catch(() => {
|
|
@@ -146,10 +136,8 @@ $bg-card: #ffffff;
|
|
|
146
136
|
display: flex;
|
|
147
137
|
align-items: center;
|
|
148
138
|
padding: 32rpx 24rpx 32rpx 0;
|
|
149
|
-
// background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
|
|
150
139
|
border-radius: 20rpx;
|
|
151
140
|
margin: 16rpx 16rpx 24rpx 0;
|
|
152
|
-
// box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
|
153
141
|
transition: all 0.3s;
|
|
154
142
|
background: transparent;
|
|
155
143
|
|
|
@@ -174,11 +162,8 @@ $bg-card: #ffffff;
|
|
|
174
162
|
width: 130rpx;
|
|
175
163
|
height: 130rpx;
|
|
176
164
|
border-radius: 50%;
|
|
177
|
-
// background-color: $bg-page;
|
|
178
165
|
display: block;
|
|
179
166
|
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
167
|
|
|
183
168
|
&:active {
|
|
184
169
|
transform: scale(1.05);
|
|
@@ -190,26 +175,6 @@ $bg-card: #ffffff;
|
|
|
190
175
|
box-shadow: none;
|
|
191
176
|
}
|
|
192
177
|
}
|
|
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
178
|
}
|
|
214
179
|
}
|
|
215
180
|
|
|
@@ -254,22 +219,6 @@ $bg-card: #ffffff;
|
|
|
254
219
|
}
|
|
255
220
|
}
|
|
256
221
|
|
|
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
222
|
// 未登录状态
|
|
274
223
|
.not-logged-in {
|
|
275
224
|
.not-logged-wrapper {
|
|
@@ -24,7 +24,6 @@ createComponent({
|
|
|
24
24
|
},
|
|
25
25
|
methods: {
|
|
26
26
|
clickHandler(tab) {
|
|
27
|
-
// console.log('tab was clicked', tab)
|
|
28
27
|
const target = this.tabs.find(item => item.value === tab.detail.value)
|
|
29
28
|
if (target) {
|
|
30
29
|
mpx.switchTab({
|
|
@@ -33,7 +32,6 @@ createComponent({
|
|
|
33
32
|
}
|
|
34
33
|
},
|
|
35
34
|
activeTab(value) {
|
|
36
|
-
// console.log('activeTab set value:', value)
|
|
37
35
|
this.selectedLabelDefault = value;
|
|
38
36
|
}
|
|
39
37
|
}
|
|
@@ -42,9 +40,7 @@ createComponent({
|
|
|
42
40
|
<script type="application/json">
|
|
43
41
|
{
|
|
44
42
|
"usingComponents": {
|
|
45
|
-
"cube-tab-bar": "@mpxjs/mpx-cube-ui/lib/components/tab-bar/index.mpx"
|
|
46
|
-
// "cube-tab": "@mpxjs/mpx-cube-ui/lib/components/tab-bar/tab.mpx",
|
|
47
|
-
// "cube-icon": "@mpxjs/mpx-cube-ui/lib/components/icon/index.mpx"
|
|
43
|
+
"cube-tab-bar": "@mpxjs/mpx-cube-ui/lib/components/tab-bar/index.mpx"
|
|
48
44
|
}
|
|
49
45
|
}
|
|
50
46
|
</script>
|
|
@@ -62,8 +62,7 @@ createComponent({
|
|
|
62
62
|
type: String,
|
|
63
63
|
value: "color: #0551ff",
|
|
64
64
|
},
|
|
65
|
-
|
|
66
|
-
//登录后跳转页面
|
|
65
|
+
// 登录后跳转页面
|
|
67
66
|
backurl: {
|
|
68
67
|
type: String,
|
|
69
68
|
value: "/pages/home",
|
|
@@ -73,7 +72,7 @@ createComponent({
|
|
|
73
72
|
type: String,
|
|
74
73
|
value: "redirectTo",
|
|
75
74
|
},
|
|
76
|
-
|
|
75
|
+
// 遮罩层效果
|
|
77
76
|
isShowModel: {
|
|
78
77
|
type: Boolean,
|
|
79
78
|
value: false,
|
|
@@ -71,8 +71,7 @@ createComponent({
|
|
|
71
71
|
type: String,
|
|
72
72
|
value: "color: #0551ff",
|
|
73
73
|
},
|
|
74
|
-
|
|
75
|
-
//登录后跳转页面
|
|
74
|
+
// 登录后跳转页面
|
|
76
75
|
backurl: {
|
|
77
76
|
type: String,
|
|
78
77
|
value: "/pages/home",
|
|
@@ -82,7 +81,7 @@ createComponent({
|
|
|
82
81
|
type: String,
|
|
83
82
|
value: "redirectTo",
|
|
84
83
|
},
|
|
85
|
-
|
|
84
|
+
// 遮罩层效果
|
|
86
85
|
isShowModel: {
|
|
87
86
|
type: Boolean,
|
|
88
87
|
value: false,
|
package/src/pages/half-home.mpx
CHANGED
|
@@ -15,9 +15,9 @@ createPage({
|
|
|
15
15
|
setup() {
|
|
16
16
|
let isLoginPopup = ref(false);
|
|
17
17
|
let userStore = useUserStore();
|
|
18
|
-
|
|
18
|
+
// 检查登录并跳转登录
|
|
19
19
|
userStore.loginOnlyAC().then(() => {
|
|
20
|
-
|
|
20
|
+
// 登录成功,加载业务
|
|
21
21
|
console.log("静默登录成功");
|
|
22
22
|
}).catch(() => {
|
|
23
23
|
isLoginPopup.value = true;
|
package/src/pages/home.mpx
CHANGED
|
@@ -16,11 +16,11 @@ createPage({
|
|
|
16
16
|
setup() {
|
|
17
17
|
let config = getApp().globalData.config;
|
|
18
18
|
let userStore = useUserStore();
|
|
19
|
-
|
|
19
|
+
// 强制登录
|
|
20
20
|
onShow(() => {
|
|
21
|
-
|
|
21
|
+
// 检查登录并跳转登录
|
|
22
22
|
userStore.loginOnlyAC().then(() => {
|
|
23
|
-
|
|
23
|
+
// 登录成功,加载业务
|
|
24
24
|
console.log("静默登录成功");
|
|
25
25
|
}).catch(() => {
|
|
26
26
|
mpx.navigateTo({
|
package/src/pages/home2.mpx
CHANGED
|
@@ -14,9 +14,9 @@ createPage({
|
|
|
14
14
|
setup() {
|
|
15
15
|
let config = getApp().globalData.config;
|
|
16
16
|
let userStore = useUserStore();
|
|
17
|
-
|
|
17
|
+
// 强制登录
|
|
18
18
|
onShow(() => {
|
|
19
|
-
|
|
19
|
+
// 检查登录并跳转登录
|
|
20
20
|
userStore.loginAC("/pages/home2", false).then((res) => {
|
|
21
21
|
console.log(res);
|
|
22
22
|
});
|
package/src/store/user.ts
CHANGED
|
@@ -154,7 +154,6 @@ export const useUserStore = defineStore("user", {
|
|
|
154
154
|
},
|
|
155
155
|
// 登录处理
|
|
156
156
|
loginProcess(resp: ResponseData<LoginRes>): LoginRes {
|
|
157
|
-
//console.log("miniappLogin", resp);
|
|
158
157
|
if (resp.statusCode === 200 && resp.data.status === true) {
|
|
159
158
|
console.log("login success");
|
|
160
159
|
this.loginSuccess(resp.data.token);
|
package/src/utils/common.ts
CHANGED
|
@@ -164,7 +164,6 @@ export const validateRequired = (
|
|
|
164
164
|
value: string | number,
|
|
165
165
|
message: string
|
|
166
166
|
): boolean => {
|
|
167
|
-
console.log(value, message);
|
|
168
167
|
const valueStr = typeof value === "number" ? String(value) : value;
|
|
169
168
|
if (!valueStr || valueStr.trim() === "") {
|
|
170
169
|
// 显示错误提示
|
package/src/utils/request.ts
CHANGED
|
@@ -18,7 +18,6 @@ mpx.xfetch.interceptors.request.use(function (config) {
|
|
|
18
18
|
const appconfig = getApp().globalData.config;
|
|
19
19
|
config.url = appconfig.baseUrl + config.url;
|
|
20
20
|
}
|
|
21
|
-
//console.log("request:", config);
|
|
22
21
|
// Grpc Gateway 清理默认值,Enum,时间等不能空;
|
|
23
22
|
grpc.clearEmpty(config.params);
|
|
24
23
|
grpc.clearEmpty(config.data);
|
|
@@ -52,7 +51,6 @@ mpx.xfetch.interceptors.request.use(function (config) {
|
|
|
52
51
|
} else {
|
|
53
52
|
delete config.header["Grpc-Metadata-Tenant"];
|
|
54
53
|
}
|
|
55
|
-
//console.log("header:", config.header);
|
|
56
54
|
} else if (!db.getRefreshToken()) {
|
|
57
55
|
console.log("not token request. ");
|
|
58
56
|
return config;
|
|
@@ -96,7 +94,6 @@ mpx.xfetch.interceptors.request.use(function (config) {
|
|
|
96
94
|
});
|
|
97
95
|
|
|
98
96
|
mpx.xfetch.interceptors.response.use(function (res) {
|
|
99
|
-
// console.log(“response:”,res);
|
|
100
97
|
if (res.statusCode === 200) {
|
|
101
98
|
return res;
|
|
102
99
|
} else if (res.statusCode === 401) {
|