jmash-core-mp 0.1.75 → 0.1.77

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 (43) hide show
  1. package/lib/api/types.d.ts +1 -1
  2. package/lib/components/auth-user/jmash-update-user.mpx.d.ts +1 -0
  3. package/lib/components/auth-user/jmash-user.mpx.d.ts +1 -0
  4. package/lib/components/cms/jmash-cms-activity-item.mpx.d.ts +1 -0
  5. package/lib/components/cms/jmash-cms-activity-list.mpx.d.ts +1 -0
  6. package/lib/components/cms/jmash-cms-article-item.mpx.d.ts +1 -0
  7. package/lib/components/cms/jmash-cms-article-list.mpx.d.ts +1 -0
  8. package/lib/components/cms/jmash-cms-article-view.mpx.d.ts +1 -0
  9. package/lib/components/cms/jmash-cms-like.mpx.d.ts +1 -0
  10. package/lib/components/cms/jmash-cms-location-list.mpx.d.ts +1 -0
  11. package/lib/components/cms/jmash-cms-product-item.mpx.d.ts +1 -0
  12. package/lib/components/cms/jmash-cms-product-list.mpx.d.ts +1 -0
  13. package/lib/components/common/jmash-search.mpx.d.ts +1 -0
  14. package/lib/components/core/jmash-login.mpx.d.ts +1 -0
  15. package/lib/components/organ/browser-organ-list.mpx.d.ts +1 -0
  16. package/lib/components/organ/my-organ-list.mpx.d.ts +1 -0
  17. package/lib/components/organ/organ-item.mpx.d.ts +1 -0
  18. package/lib/components/organ/organ-search.mpx.d.ts +1 -0
  19. package/lib/components/shop/branch-item.mpx.d.ts +1 -0
  20. package/lib/components/shop/branch-search.mpx.d.ts +1 -0
  21. package/lib/components/shop/shop-item.mpx.d.ts +1 -0
  22. package/lib/components/shop/shop-search.mpx.d.ts +1 -0
  23. package/lib/packages/pages/auth/setting-page.mpx.d.ts +1 -0
  24. package/lib/packages/pages/cms/cms-activity-list.mpx.d.ts +1 -0
  25. package/lib/packages/pages/cms/cms-article-list.mpx.d.ts +1 -0
  26. package/lib/packages/pages/cms/cms-location-list.mpx.d.ts +1 -0
  27. package/lib/packages/pages/cms/cms-product-list.mpx.d.ts +1 -0
  28. package/lib/packages/pages/share/scan.mpx.d.ts +1 -0
  29. package/lib/pages/organ.mpx.d.ts +1 -0
  30. package/lib/store/user.d.ts +3 -1
  31. package/lib/store/user.js +11 -1
  32. package/lib/utils/config.js +1 -1
  33. package/lib/utils/share.js +10 -10
  34. package/package.json +1 -1
  35. package/src/api/types.ts +2 -2
  36. package/src/components/core/jmash-popup-login.ali.mpx +3 -3
  37. package/src/components/core/jmash-popup-login.mpx +6 -8
  38. package/src/components/core/jmash-popup-login.web.mpx +1 -1
  39. package/src/packages/pages/auth/login.mpx +1 -1
  40. package/src/packages/pages/share/scan.mpx +13 -13
  41. package/src/store/user.ts +11 -1
  42. package/src/utils/config.ts +1 -1
  43. package/src/utils/share.ts +10 -10
@@ -3,7 +3,7 @@
3
3
  export type ResponseData<T extends string | WechatMiniprogram.IAnyObject | ArrayBuffer = string | WechatMiniprogram.IAnyObject | ArrayBuffer> = WechatMiniprogram.RequestSuccessCallbackResult<T>;
4
4
  export interface AppConfig {
5
5
  tenant: string;
6
- name: string;
6
+ xcxName: string;
7
7
  baseUrl: string;
8
8
  resourceUrl: string;
9
9
  appId: string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -9,7 +9,9 @@ interface UserState {
9
9
  referee: string;
10
10
  }
11
11
  export declare const useUserStore: import("@mpxjs/pinia").StoreDefinition<"user", UserState, {}, {
12
- /** 登录检查 */
12
+ /** 尝试登录,无需处理异常 */
13
+ loginTry(): Promise<boolean>;
14
+ /** 登录检查(需处理异常) */
13
15
  loginOnlyAC(): Promise<boolean>;
14
16
  /** 登录检查并跳转登录 */
15
17
  loginAC(backurl: string, tabbar: boolean, loginurl?: string): Promise<boolean>;
package/lib/store/user.js CHANGED
@@ -14,7 +14,17 @@ export const useUserStore = defineStore("user", {
14
14
  referee: db.getReferee() || "",
15
15
  }),
16
16
  actions: {
17
- /** 登录检查 */
17
+ /** 尝试登录,无需处理异常 */
18
+ loginTry() {
19
+ return this.loginOnlyAC()
20
+ .then((res) => {
21
+ return res;
22
+ })
23
+ .catch(() => {
24
+ return false;
25
+ });
26
+ },
27
+ /** 登录检查(需处理异常) */
18
28
  loginOnlyAC() {
19
29
  // 1. 已登录 → 直接返回成功
20
30
  if (this.checkLogin()) {
@@ -1,6 +1,6 @@
1
1
  import mpx from "@mpxjs/core";
2
2
  const defaultConfig = {
3
- name: "Jmash Core MPX",
3
+ xcxName: "Jmash Core MPX",
4
4
  dev: true,
5
5
  testNewUser: false,
6
6
  tenant: "xyvcard",
@@ -45,7 +45,7 @@ class ShareUtil {
45
45
  .findShopBranchById(options.organTenant, options.branchId)
46
46
  .then((res) => {
47
47
  return shopStore.switchBranch(res.data).then(() => {
48
- return userStore.loginOnlyAC();
48
+ return userStore.loginTry();
49
49
  });
50
50
  });
51
51
  }
@@ -54,7 +54,7 @@ class ShareUtil {
54
54
  console.log("商城ID", options.shopId);
55
55
  return shopApi.findShopInfoById(options.shopId).then((res) => {
56
56
  return shopStore.switchShop(res.data).then(() => {
57
- return userStore.loginOnlyAC();
57
+ return userStore.loginTry();
58
58
  });
59
59
  });
60
60
  }
@@ -64,11 +64,11 @@ class ShareUtil {
64
64
  console.log("组织Token", options.organTenant);
65
65
  return organStore.setOrganTenant(options.organTenant).then(() => {
66
66
  //静默登录
67
- return userStore.loginOnlyAC();
67
+ return userStore.loginTry();
68
68
  });
69
69
  }
70
70
  //静默登录
71
- return userStore.loginOnlyAC();
71
+ return userStore.loginTry();
72
72
  }
73
73
  // 分享用户页给好友
74
74
  shareUserPath(pagePath, query) {
@@ -91,7 +91,7 @@ class ShareUtil {
91
91
  userStore.setReferee(options.referee);
92
92
  }
93
93
  //静默登录
94
- return userStore.loginOnlyAC();
94
+ return userStore.loginTry();
95
95
  }
96
96
  // 分享组织页给好友
97
97
  shareOrganPath(pagePath, query) {
@@ -122,11 +122,11 @@ class ShareUtil {
122
122
  if (options.organTenant) {
123
123
  return organStore.setOrganTenant(options.organTenant).then(() => {
124
124
  //静默登录
125
- return userStore.loginOnlyAC();
125
+ return userStore.loginTry();
126
126
  });
127
127
  }
128
128
  //静默登录
129
- return userStore.loginOnlyAC();
129
+ return userStore.loginTry();
130
130
  }
131
131
  // 分享电商页给好友
132
132
  shareMallPath(pagePath, query) {
@@ -175,7 +175,7 @@ class ShareUtil {
175
175
  .findShopBranchById(options.organTenant, options.branchId)
176
176
  .then((res) => {
177
177
  return shopStore.switchBranch(res.data).then(() => {
178
- return userStore.loginOnlyAC();
178
+ return userStore.loginTry();
179
179
  });
180
180
  });
181
181
  }
@@ -184,12 +184,12 @@ class ShareUtil {
184
184
  console.log("商城ID", options.shopId);
185
185
  return shopApi.findShopInfoById(options.shopId).then((res) => {
186
186
  return shopStore.switchShop(res.data).then(() => {
187
- return userStore.loginOnlyAC();
187
+ return userStore.loginTry();
188
188
  });
189
189
  });
190
190
  }
191
191
  //静默登录
192
- return userStore.loginOnlyAC();
192
+ return userStore.loginTry();
193
193
  }
194
194
  }
195
195
  const share = new ShareUtil();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmash-core-mp",
3
- "version": "0.1.75",
3
+ "version": "0.1.77",
4
4
  "private": false,
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/api/types.ts CHANGED
@@ -2,14 +2,14 @@ export type ResponseData<
2
2
  T extends string | WechatMiniprogram.IAnyObject | ArrayBuffer =
3
3
  | string
4
4
  | WechatMiniprogram.IAnyObject
5
- | ArrayBuffer
5
+ | ArrayBuffer,
6
6
  > = WechatMiniprogram.RequestSuccessCallbackResult<T>;
7
7
 
8
8
  export interface AppConfig {
9
9
  //租户
10
10
  tenant: string;
11
11
  // 名称
12
- name: string;
12
+ xcxName: string;
13
13
  //请求地址
14
14
  baseUrl: string;
15
15
  //静态资源地址
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <!-- 支付宝小程序授权登录 -->
3
- <cube-modal a:ref="loginModal" visible="{{ isVisible }}" noBuiltInBtns="true" maskClosable="false" z-index="999"
3
+ <cube-modal a:ref="loginModal" visible="{{ isVisible }}" noBuiltInBtns="true" maskClosable="false"
4
4
  bind:cancel="onClose" mask-opacity="0.1" class="login-popup">
5
5
  <!-- 标题区域 -->
6
6
  <view class="popup-header" slot="header">
@@ -51,9 +51,9 @@ createComponent({
51
51
  }
52
52
  },
53
53
  setup(props) {
54
- let config = getApp().globalData.config || { resourceUrl: '', name: '应用' };
54
+ let config = getApp().globalData.config || { resourceUrl: '', xcxName: '应用' };
55
55
  let resourceUrl = config.resourceUrl;
56
- let appName = config.name;
56
+ let appName = config.xcxName;
57
57
  let isCheckBox = ref(false);
58
58
  let isVisible = ref(props.visible);
59
59
  let userStore = useUserStore();
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <!-- 授权登录 -->
3
- <cube-modal wx:ref="loginModal" visible="{{ isVisible }}" noBuiltInBtns="true" maskClosable="false" z-index="999999"
3
+ <cube-modal wx:ref="loginModal" visible="{{ isVisible }}" noBuiltInBtns="true" maskClosable="false"
4
4
  bind:cancel="onClose" mask-opacity="0.1" class="login-popup">
5
5
  <!-- 标题区域 -->
6
6
  <view class="popup-header" slot="header">
@@ -16,7 +16,7 @@
16
16
  <view class="popup-body" slot="content">
17
17
  <!-- 头像区域 -->
18
18
  <view class="avatar-section">
19
- <button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
19
+ <button class="avatar-wrapper" plain open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
20
20
  <image wx:if="{{ avatarUrl || avatar }}" class="avatar-img" src="{{ avatarUrl || avatar }}"
21
21
  mode="aspectFill" />
22
22
  <view class="avatar-badge">
@@ -73,9 +73,9 @@ createComponent({
73
73
  }
74
74
  },
75
75
  setup(props) {
76
- let config = getApp().globalData.config || { resourceUrl: '', name: '应用' };
76
+ let config = getApp().globalData.config || { resourceUrl: '', xcxName: '应用' };
77
77
  let resourceUrl = config.resourceUrl;
78
- let appName = config.name;
78
+ let appName = config.xcxName;
79
79
  let avatar = resourceUrl + "/images/components/gray_head2x.png";
80
80
  let avatarUrl = ref('');
81
81
  let nameValue = ref('');
@@ -252,15 +252,14 @@ $bg-card: #ffffff;
252
252
  position: relative;
253
253
  margin: 0;
254
254
  padding: 0;
255
- background: none;
256
- border: none;
255
+ background: transparent !important;
256
+ border: none !important;
257
257
  line-height: 1;
258
258
 
259
259
  .avatar-img {
260
260
  width: 120rpx;
261
261
  height: 120rpx;
262
262
  border-radius: 50%;
263
- border: 4rpx solid $border;
264
263
  display: block;
265
264
  }
266
265
 
@@ -272,7 +271,6 @@ $bg-card: #ffffff;
272
271
  height: 36rpx;
273
272
  background: $primary;
274
273
  border-radius: 50%;
275
- border: 3rpx solid $bg-card;
276
274
  display: flex;
277
275
  align-items: center;
278
276
  justify-content: center;
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <!-- Web端账号登录弹窗 -->
3
- <cube-modal wx:ref="loginModal" visible="{{ isVisible }}" noBuiltInBtns="true" maskClosable="false" z-index="999"
3
+ <cube-modal wx:ref="loginModal" visible="{{ isVisible }}" noBuiltInBtns="true" maskClosable="false"
4
4
  bind:cancel="onClose" mask-opacity="0.1" class="login-popup">
5
5
  <!-- 标题区域 -->
6
6
  <view class="popup-header" slot="header">
@@ -16,7 +16,7 @@ createPage({
16
16
  setup(props) {
17
17
  let config = getApp().globalData.config;
18
18
  let resourceUrl = ref(config.resourceUrl);
19
- let appName = ref(config.name);
19
+ let appName = ref(config.xcxName);
20
20
  let linkType = ref("redirectTo");
21
21
  let backurl = ref("/pages/home");
22
22
  onLoad((options) => {
@@ -19,19 +19,16 @@ createPage({
19
19
  * 生命周期函数--监听页面加载
20
20
  */
21
21
  onLoad(async (options) => {
22
- // 判断是否登录-静默登录
23
- userStore.loginOnlyAC().then(() => {
24
- // 处理页面参数
25
- if (options.q) {
26
- const q = decodeURIComponent(options.q);
27
- if (q.includes("share?")) {
28
- const params = _URIParams(q);
29
- onRedirectTo(params, _ReturnParams(params));
30
- }
31
- } else {
32
- onRedirectTo(options, _ReturnParams(options));
22
+ // 处理页面参数
23
+ if (options.q) {
24
+ const q = decodeURIComponent(options.q);
25
+ if (q.includes("share?")) {
26
+ const params = _URIParams(q);
27
+ onRedirectTo(params, _ReturnParams(params));
33
28
  }
34
- });
29
+ } else {
30
+ onRedirectTo(options, _ReturnParams(options));
31
+ }
35
32
  });
36
33
 
37
34
  // 跳转页面
@@ -45,7 +42,10 @@ createPage({
45
42
  mpx.switchTab({ url: options.action });
46
43
  });
47
44
  } else {
48
- mpx.navigateTo({ url: `${options.action}${query}` });
45
+ // 判断是否登录-静默登录
46
+ userStore.loginTry().then(() => {
47
+ mpx.navigateTo({ url: `${options.action}${query}` });
48
+ });
49
49
  }
50
50
  };
51
51
 
package/src/store/user.ts CHANGED
@@ -40,7 +40,17 @@ export const useUserStore = defineStore("user", {
40
40
  referee: db.getReferee() || "",
41
41
  }),
42
42
  actions: {
43
- /** 登录检查 */
43
+ /** 尝试登录,无需处理异常 */
44
+ loginTry(): Promise<boolean> {
45
+ return this.loginOnlyAC()
46
+ .then((res) => {
47
+ return res;
48
+ })
49
+ .catch(() => {
50
+ return false;
51
+ });
52
+ },
53
+ /** 登录检查(需处理异常) */
44
54
  loginOnlyAC(): Promise<boolean> {
45
55
  // 1. 已登录 → 直接返回成功
46
56
  if (this.checkLogin()) {
@@ -2,7 +2,7 @@ import { AppConfig } from "../api/types";
2
2
  import mpx from "@mpxjs/core";
3
3
 
4
4
  const defaultConfig: AppConfig = {
5
- name: "Jmash Core MPX",
5
+ xcxName: "Jmash Core MPX",
6
6
  dev: true,
7
7
  testNewUser: false,
8
8
  tenant: "xyvcard",
@@ -46,7 +46,7 @@ class ShareUtil {
46
46
  .findShopBranchById(options.organTenant, options.branchId)
47
47
  .then((res) => {
48
48
  return shopStore.switchBranch(res.data).then(() => {
49
- return userStore.loginOnlyAC();
49
+ return userStore.loginTry();
50
50
  });
51
51
  });
52
52
  } else if (options.shopId) {
@@ -54,7 +54,7 @@ class ShareUtil {
54
54
  console.log("商城ID", options.shopId);
55
55
  return shopApi.findShopInfoById(options.shopId).then((res) => {
56
56
  return shopStore.switchShop(res.data).then(() => {
57
- return userStore.loginOnlyAC();
57
+ return userStore.loginTry();
58
58
  });
59
59
  });
60
60
  } else if (options.organTenant) {
@@ -63,11 +63,11 @@ class ShareUtil {
63
63
  console.log("组织Token", options.organTenant);
64
64
  return organStore.setOrganTenant(options.organTenant).then(() => {
65
65
  //静默登录
66
- return userStore.loginOnlyAC();
66
+ return userStore.loginTry();
67
67
  });
68
68
  }
69
69
  //静默登录
70
- return userStore.loginOnlyAC();
70
+ return userStore.loginTry();
71
71
  }
72
72
 
73
73
  // 分享用户页给好友
@@ -91,7 +91,7 @@ class ShareUtil {
91
91
  userStore.setReferee(options.referee);
92
92
  }
93
93
  //静默登录
94
- return userStore.loginOnlyAC();
94
+ return userStore.loginTry();
95
95
  }
96
96
  // 分享组织页给好友
97
97
  shareOrganPath(pagePath: string, query: string): string {
@@ -122,11 +122,11 @@ class ShareUtil {
122
122
  if (options.organTenant) {
123
123
  return organStore.setOrganTenant(options.organTenant).then(() => {
124
124
  //静默登录
125
- return userStore.loginOnlyAC();
125
+ return userStore.loginTry();
126
126
  });
127
127
  }
128
128
  //静默登录
129
- return userStore.loginOnlyAC();
129
+ return userStore.loginTry();
130
130
  }
131
131
 
132
132
  // 分享电商页给好友
@@ -174,7 +174,7 @@ class ShareUtil {
174
174
  .findShopBranchById(options.organTenant, options.branchId)
175
175
  .then((res) => {
176
176
  return shopStore.switchBranch(res.data).then(() => {
177
- return userStore.loginOnlyAC();
177
+ return userStore.loginTry();
178
178
  });
179
179
  });
180
180
  } else if (options.shopId) {
@@ -182,12 +182,12 @@ class ShareUtil {
182
182
  console.log("商城ID", options.shopId);
183
183
  return shopApi.findShopInfoById(options.shopId).then((res) => {
184
184
  return shopStore.switchShop(res.data).then(() => {
185
- return userStore.loginOnlyAC();
185
+ return userStore.loginTry();
186
186
  });
187
187
  });
188
188
  }
189
189
  //静默登录
190
- return userStore.loginOnlyAC();
190
+ return userStore.loginTry();
191
191
  }
192
192
  }
193
193
  const share = new ShareUtil();