jmash-core-mp 0.1.16 → 0.1.18
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/api/types.d.ts +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/utils/config.d.ts +3 -1
- package/lib/utils/config.js +14 -15
- package/package.json +1 -1
- package/src/api/types.ts +2 -0
- package/src/app.mpx +5 -7
- package/src/components/auth-user/jmash-update-user.mpx +6 -2
- package/src/components/auth-user/jmash-user.mpx +19 -16
- package/src/components/common/jmash-pic-swiper.mpx +1 -1
- package/src/index.ts +1 -1
- package/src/utils/config.ts +17 -13
package/lib/api/types.d.ts
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type { FileInfo, FileBase64Req, FileDownInfo, FileWebReq, } from "./api/f
|
|
|
7
7
|
export type { DictRegionList, DictRegionReq, DictRegionModel, } from "./api/region/types";
|
|
8
8
|
export type { StorageOrganInfoReq, StorageOrganInfoList, StorageOrganInfoModel, ShopBrowserUserList, ShopBrowserUserModel, StorageOrganBrowserUpdateReq, StorageOrganBrowserModel, } from "./api/storage/types";
|
|
9
9
|
export { mpxFetch } from "./utils/request";
|
|
10
|
-
export { config } from "./utils/config";
|
|
10
|
+
export { config, initConfig, setConfig } from "./utils/config";
|
|
11
11
|
export { grpc } from "./utils/grpc";
|
|
12
12
|
export { db } from "./utils/db";
|
|
13
13
|
export { useUserStore } from "./store/user";
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { EntryDict, EnumDict } from "./api/dicts";
|
|
2
2
|
export { mpxFetch } from "./utils/request";
|
|
3
|
-
export { config } from "./utils/config";
|
|
3
|
+
export { config, initConfig, setConfig } from "./utils/config";
|
|
4
4
|
export { grpc } from "./utils/grpc";
|
|
5
5
|
export { db } from "./utils/db";
|
|
6
6
|
export { useUserStore } from "./store/user";
|
package/lib/utils/config.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { AppConfig } from "../api/types";
|
|
2
2
|
declare const config: AppConfig;
|
|
3
|
-
|
|
3
|
+
declare function setConfig(cfg: Partial<AppConfig>): void;
|
|
4
|
+
declare function initConfig(config: Partial<AppConfig>, mode: string): Partial<AppConfig>;
|
|
5
|
+
export { config, setConfig, initConfig };
|
package/lib/utils/config.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import mpx from "@mpxjs/core";
|
|
2
|
+
const defaultConfig = {
|
|
2
3
|
name: "Jmash Core MPX",
|
|
3
4
|
dev: true,
|
|
4
5
|
testNewUser: false,
|
|
@@ -12,19 +13,17 @@ const config = {
|
|
|
12
13
|
wechatBiz: "",
|
|
13
14
|
siteId: "c0a28f0f-023a-420b-b4e8-0ce138ac8269",
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
config
|
|
16
|
+
const config = { ...defaultConfig };
|
|
17
|
+
function setConfig(cfg) {
|
|
18
|
+
Object.assign(config, cfg);
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
function initConfig(config, mode) {
|
|
21
|
+
if (__mpx_mode__ !== "web") {
|
|
22
|
+
// 只有运行时才能调用
|
|
23
|
+
const accountInfo = mpx.getAccountInfoSync();
|
|
24
|
+
// 微信
|
|
25
|
+
config.appId = accountInfo.miniProgram.appId;
|
|
26
|
+
}
|
|
27
|
+
return config;
|
|
22
28
|
}
|
|
23
|
-
|
|
24
|
-
// Web
|
|
25
|
-
config.appId = "web";
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
// 执行其他环境相关逻辑
|
|
29
|
-
}
|
|
30
|
-
export { config };
|
|
29
|
+
export { config, setConfig, initConfig };
|
package/package.json
CHANGED
package/src/api/types.ts
CHANGED
package/src/app.mpx
CHANGED
|
@@ -7,20 +7,18 @@ mpx.use(apiProxy, { usePromise: true })
|
|
|
7
7
|
import { createPinia } from '@mpxjs/pinia';
|
|
8
8
|
createPinia();
|
|
9
9
|
//网络请求和App配置
|
|
10
|
-
import { mpxFetch, config } from "./index";
|
|
10
|
+
import { mpxFetch, config, initConfig } from "./index";
|
|
11
11
|
mpx.use(mpxFetch);
|
|
12
12
|
|
|
13
13
|
createApp({
|
|
14
|
+
onLaunch(options) {
|
|
15
|
+
initConfig(config, "dev");
|
|
16
|
+
console.log("config", config);
|
|
17
|
+
},
|
|
14
18
|
globalData: {
|
|
15
19
|
config: config
|
|
16
20
|
}
|
|
17
21
|
})
|
|
18
|
-
if (__mpx_mode__ !== "web") {
|
|
19
|
-
// 只有运行时才能调用
|
|
20
|
-
const accountInfo = mpx.getAccountInfoSync();
|
|
21
|
-
// 微信
|
|
22
|
-
config.appId = accountInfo.miniProgram.appId;
|
|
23
|
-
}
|
|
24
22
|
</script>
|
|
25
23
|
|
|
26
24
|
<style></style>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<view class="main-profile" wx:if="{{ isUserAvatar }}">
|
|
7
7
|
<view class="profile-left">头像</view>
|
|
8
8
|
<view class="profile-right">
|
|
9
|
-
<button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar@wx="onChooseAvatar"
|
|
9
|
+
<button class="avatar-wrapper" plain open-type="chooseAvatar" bind:chooseavatar@wx="onChooseAvatar"
|
|
10
10
|
onChooseAvatar@ali="onChooseAvatar">
|
|
11
11
|
<image class="avatar-img" src="{{ resourceUrl + '/components/gray_head2x.png' }}" mode="aspectFill"
|
|
12
12
|
wx:if="{{ !userInfo.avatar }}" />
|
|
@@ -259,8 +259,12 @@ $bg-card: #ffffff;
|
|
|
259
259
|
margin: 0;
|
|
260
260
|
padding: 0;
|
|
261
261
|
background: transparent;
|
|
262
|
-
border: none;
|
|
263
262
|
line-height: 1;
|
|
263
|
+
border: 0;
|
|
264
|
+
|
|
265
|
+
&::after {
|
|
266
|
+
display: none;
|
|
267
|
+
}
|
|
264
268
|
|
|
265
269
|
.avatar-img {
|
|
266
270
|
width: 88rpx;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="auth-user-box">
|
|
3
3
|
<block wx:if="{{ isLogin }}">
|
|
4
|
-
<view class="auth-user-l">
|
|
4
|
+
<view class="auth-user-l" bind:tap="handleUpdateUser">
|
|
5
5
|
<!-- 头像 -->
|
|
6
6
|
<view class="avatar-wrapper">
|
|
7
7
|
<image src="{{ baseUrl+'/v1/file/image/clip/200/200/' + userInfo.avatar }}" class="avatar-img"
|
|
8
8
|
wx:if="{{ userInfo.avatar }}" mode="aspectFill"></image>
|
|
9
|
-
<image src="{{
|
|
10
|
-
wx:elif="{{ defaultAvatar }}" mode="aspectFill"></image>
|
|
9
|
+
<image src="{{ defaultAvatar }}" class="avatar-img" wx:elif="{{ defaultAvatar }}" mode="aspectFill"></image>
|
|
11
10
|
<image src="{{ resourceUrl }}/images/mall/tswk.png" class="avatar-img" wx:else mode="aspectFill"></image>
|
|
12
|
-
<view class="avatar-badge">
|
|
11
|
+
<!-- <view class="avatar-badge">
|
|
13
12
|
<text class="badge-icon">✎</text>
|
|
14
|
-
</view>
|
|
13
|
+
</view> -->
|
|
15
14
|
</view>
|
|
16
15
|
|
|
17
16
|
<!-- 用户信息 -->
|
|
@@ -27,9 +26,9 @@
|
|
|
27
26
|
</view>
|
|
28
27
|
|
|
29
28
|
<!-- 右侧箭头 -->
|
|
30
|
-
<view class="right-arrow" bind:tap="handleUpdateUser">
|
|
29
|
+
<!-- <view class="right-arrow" bind:tap="handleUpdateUser">
|
|
31
30
|
<text class="arrow-icon">›</text>
|
|
32
|
-
</view>
|
|
31
|
+
</view> -->
|
|
33
32
|
</view>
|
|
34
33
|
</block>
|
|
35
34
|
|
|
@@ -37,7 +36,11 @@
|
|
|
37
36
|
<view class="auth-user-l not-logged-in" wx:else>
|
|
38
37
|
<view class="not-logged-wrapper">
|
|
39
38
|
<view class="avatar-wrapper" bind:tap="handleLogin">
|
|
40
|
-
<image src="{{ resourceUrl }}/images/mall/tswk.png" class="avatar-img not-logged" mode="aspectFill"></image>
|
|
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>
|
|
41
44
|
<view class="avatar-plus">
|
|
42
45
|
<text class="plus-icon">+</text>
|
|
43
46
|
</view>
|
|
@@ -171,11 +174,11 @@ $bg-card: #ffffff;
|
|
|
171
174
|
width: 130rpx;
|
|
172
175
|
height: 130rpx;
|
|
173
176
|
border-radius: 50%;
|
|
174
|
-
background-color: $bg-page;
|
|
177
|
+
// background-color: $bg-page;
|
|
175
178
|
display: block;
|
|
176
179
|
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);
|
|
180
|
+
// border: 3rpx solid rgba(7, 193, 96, 0.1);
|
|
181
|
+
// box-shadow: 0 4rpx 12rpx rgba(7, 193, 96, 0.1);
|
|
179
182
|
|
|
180
183
|
&:active {
|
|
181
184
|
transform: scale(1.05);
|
|
@@ -228,9 +231,9 @@ $bg-card: #ffffff;
|
|
|
228
231
|
}
|
|
229
232
|
|
|
230
233
|
.edit-icon-bg {
|
|
231
|
-
width:
|
|
232
|
-
height:
|
|
233
|
-
background:
|
|
234
|
+
width: 36rpx;
|
|
235
|
+
height: 36rpx;
|
|
236
|
+
background: $primary;
|
|
234
237
|
border-radius: 50%;
|
|
235
238
|
display: flex;
|
|
236
239
|
align-items: center;
|
|
@@ -238,8 +241,8 @@ $bg-card: #ffffff;
|
|
|
238
241
|
margin-left: 8rpx;
|
|
239
242
|
|
|
240
243
|
.edit-icon {
|
|
241
|
-
font-size:
|
|
242
|
-
color:
|
|
244
|
+
font-size: 16rpx;
|
|
245
|
+
color: #fff;
|
|
243
246
|
}
|
|
244
247
|
}
|
|
245
248
|
}
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
<script lang="ts">
|
|
14
14
|
import mpx, { createComponent, ref } from "@mpxjs/core"
|
|
15
|
-
import { config } from "../../utils/config";
|
|
16
15
|
import { EventBase } from "../../api/types";
|
|
17
16
|
|
|
18
17
|
createComponent({
|
|
19
18
|
setup() {
|
|
19
|
+
let config = getApp().globalData.config;
|
|
20
20
|
// 静态图片资源
|
|
21
21
|
let imageUrl = config.baseUrl + "/v1/file/image/clip/750/750/"
|
|
22
22
|
// 接口资源路径
|
package/src/index.ts
CHANGED
|
@@ -52,7 +52,7 @@ export type {
|
|
|
52
52
|
} from "./api/storage/types";
|
|
53
53
|
|
|
54
54
|
export { mpxFetch } from "./utils/request";
|
|
55
|
-
export { config } from "./utils/config";
|
|
55
|
+
export { config, initConfig, setConfig } from "./utils/config";
|
|
56
56
|
export { grpc } from "./utils/grpc";
|
|
57
57
|
export { db } from "./utils/db";
|
|
58
58
|
export { useUserStore } from "./store/user";
|
package/src/utils/config.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AppConfig } from "../api/types";
|
|
2
|
+
import mpx from "@mpxjs/core";
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
+
const defaultConfig: AppConfig = {
|
|
4
5
|
name: "Jmash Core MPX",
|
|
5
6
|
dev: true,
|
|
6
7
|
testNewUser: false,
|
|
@@ -15,17 +16,20 @@ const config: AppConfig = {
|
|
|
15
16
|
siteId: "c0a28f0f-023a-420b-b4e8-0ce138ac8269",
|
|
16
17
|
};
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
const config: AppConfig = { ...defaultConfig };
|
|
20
|
+
|
|
21
|
+
function setConfig(cfg: Partial<AppConfig>) {
|
|
22
|
+
Object.assign(config, cfg);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function initConfig(config: Partial<AppConfig>, mode: string) {
|
|
26
|
+
if (__mpx_mode__ !== "web") {
|
|
27
|
+
// 只有运行时才能调用
|
|
28
|
+
const accountInfo = mpx.getAccountInfoSync();
|
|
29
|
+
// 微信
|
|
30
|
+
config.appId = accountInfo.miniProgram.appId;
|
|
31
|
+
}
|
|
32
|
+
return config;
|
|
29
33
|
}
|
|
30
34
|
|
|
31
|
-
export { config };
|
|
35
|
+
export { config, setConfig, initConfig };
|