jmash-core-mp 0.1.21 → 0.1.22

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 (150) hide show
  1. package/.editorconfig +9 -9
  2. package/README.md +60 -60
  3. package/babel.config.json +34 -34
  4. package/eslint.config.mjs +7 -7
  5. package/lib/api/auth/index.d.ts +21 -21
  6. package/lib/api/auth/index.js +199 -199
  7. package/lib/api/auth/types.d.ts +86 -86
  8. package/lib/api/auth/types.js +9 -9
  9. package/lib/api/cms/index.d.ts +20 -20
  10. package/lib/api/cms/index.js +161 -161
  11. package/lib/api/cms/types.d.ts +200 -200
  12. package/lib/api/cms/types.js +1 -1
  13. package/lib/api/constant.d.ts +5 -5
  14. package/lib/api/constant.js +6 -6
  15. package/lib/api/dict/index.d.ts +18 -18
  16. package/lib/api/dict/index.js +34 -34
  17. package/lib/api/dict/types.d.ts +28 -28
  18. package/lib/api/dict/types.js +1 -1
  19. package/lib/api/dicts.d.ts +18 -18
  20. package/lib/api/dicts.js +67 -67
  21. package/lib/api/files/index.d.ts +25 -25
  22. package/lib/api/files/index.js +135 -135
  23. package/lib/api/files/types.d.ts +38 -38
  24. package/lib/api/files/types.js +1 -1
  25. package/lib/api/index.d.ts +4 -4
  26. package/lib/api/index.js +6 -6
  27. package/lib/api/myorgan/types.d.ts +22 -22
  28. package/lib/api/myorgan/types.js +1 -1
  29. package/lib/api/region/index.d.ts +7 -7
  30. package/lib/api/region/index.js +19 -19
  31. package/lib/api/region/types.d.ts +19 -19
  32. package/lib/api/region/types.js +1 -1
  33. package/lib/api/storage/index.d.ts +10 -10
  34. package/lib/api/storage/index.js +43 -43
  35. package/lib/api/storage/types.d.ts +28 -28
  36. package/lib/api/storage/types.js +1 -1
  37. package/lib/api/types.d.ts +42 -42
  38. package/lib/api/types.js +1 -1
  39. package/lib/app.mpx.d.ts +1 -1
  40. package/lib/components/auth-user/jmash-update-user.mpx.d.ts +1 -1
  41. package/lib/components/auth-user/jmash-user.mpx.d.ts +1 -1
  42. package/lib/components/cms/jmash-cms-acticle-list.mpx.d.ts +1 -1
  43. package/lib/components/cms/jmash-cms-article-item.mpx.d.ts +1 -1
  44. package/lib/components/cms/jmash-cms-article-view.mpx.d.ts +1 -0
  45. package/lib/components/cms/jmash-cms-article.mpx.d.ts +1 -1
  46. package/lib/components/cms/jmash-cms-like.mpx.d.ts +1 -1
  47. package/lib/components/common/jmash-upload-picture.mpx.d.ts +1 -0
  48. package/lib/components/core/jmash-login.mpx.d.ts +1 -0
  49. package/lib/index.d.ts +21 -21
  50. package/lib/index.js +14 -14
  51. package/lib/packages/pages/cms/cms-article-list.mpx.d.ts +1 -1
  52. package/lib/pages/index.mpx.d.ts +1 -0
  53. package/lib/store/user.d.ts +31 -31
  54. package/lib/store/user.js +227 -227
  55. package/lib/utils/common.d.ts +35 -35
  56. package/lib/utils/common.js +166 -166
  57. package/lib/utils/config.d.ts +5 -5
  58. package/lib/utils/config.js +29 -29
  59. package/lib/utils/db.d.ts +21 -21
  60. package/lib/utils/db.js +84 -84
  61. package/lib/utils/grpc.d.ts +5 -5
  62. package/lib/utils/grpc.js +20 -20
  63. package/lib/utils/net.d.ts +7 -7
  64. package/lib/utils/net.js +15 -15
  65. package/lib/utils/request.d.ts +2 -2
  66. package/lib/utils/request.js +123 -123
  67. package/mpx.config.js +27 -27
  68. package/package.json +1 -1
  69. package/postcss.config.js +11 -11
  70. package/project.config.json +24 -24
  71. package/project.private.config.json +13 -13
  72. package/public/index.html +15 -15
  73. package/src/api/auth/index.ts +227 -227
  74. package/src/api/auth/types.ts +166 -166
  75. package/src/api/cms/index.ts +218 -218
  76. package/src/api/cms/types.ts +379 -379
  77. package/src/api/constant.ts +6 -6
  78. package/src/api/dict/index.ts +44 -44
  79. package/src/api/dict/types.ts +49 -49
  80. package/src/api/dicts.ts +72 -72
  81. package/src/api/files/index.ts +163 -163
  82. package/src/api/files/types.ts +67 -67
  83. package/src/api/index.ts +11 -11
  84. package/src/api/myorgan/types.ts +42 -42
  85. package/src/api/region/index.ts +23 -23
  86. package/src/api/region/types.ts +36 -36
  87. package/src/api/storage/index.ts +62 -62
  88. package/src/api/storage/types.ts +54 -54
  89. package/src/api/types.ts +72 -72
  90. package/src/app.mpx +71 -71
  91. package/src/components/auth-user/jmash-logout.mpx +91 -91
  92. package/src/components/auth-user/jmash-update-user.mpx +386 -386
  93. package/src/components/auth-user/jmash-update-user.web.mpx +366 -366
  94. package/src/components/auth-user/jmash-user.mpx +359 -359
  95. package/src/components/cms/jmash-cms-acticle-list.mpx +182 -182
  96. package/src/components/cms/jmash-cms-article-item.mpx +241 -241
  97. package/src/components/cms/jmash-cms-article-view.mpx +131 -131
  98. package/src/components/cms/jmash-cms-article.mpx +68 -68
  99. package/src/components/cms/jmash-cms-like.mpx +151 -151
  100. package/src/components/common/jmash-avatar-edit.mpx +153 -153
  101. package/src/components/common/jmash-cascader-region.mpx +112 -112
  102. package/src/components/common/jmash-menu.mpx +129 -129
  103. package/src/components/common/jmash-none-data.mpx +82 -82
  104. package/src/components/common/jmash-pic-swiper.mpx +71 -71
  105. package/src/components/common/jmash-popup.mpx +137 -137
  106. package/src/components/common/jmash-search.mpx +126 -126
  107. package/src/components/common/jmash-single-btn.mpx +53 -53
  108. package/src/components/common/jmash-stepper.mpx +214 -214
  109. package/src/components/common/jmash-tab-bar.mpx +50 -50
  110. package/src/components/common/jmash-textarea.mpx +88 -88
  111. package/src/components/common/jmash-top-navigation.mpx +203 -203
  112. package/src/components/common/jmash-upload-picture.mpx +129 -126
  113. package/src/components/core/jmash-cms-protocol.mpx +66 -66
  114. package/src/components/core/jmash-login.ali.mpx +284 -284
  115. package/src/components/core/jmash-login.mpx +348 -348
  116. package/src/components/core/jmash-login.web.mpx +421 -421
  117. package/src/components/core/jmash-popup-login.ali.mpx +311 -311
  118. package/src/components/core/jmash-popup-login.mpx +415 -415
  119. package/src/components/core/jmash-popup-login.web.mpx +389 -389
  120. package/src/custom-tab-bar/index.mpx +10 -10
  121. package/src/global.d.ts +11 -11
  122. package/src/index.ts +71 -71
  123. package/src/packages/index.mpx +10 -10
  124. package/src/packages/pages/auth/cms-protocol.mpx +31 -31
  125. package/src/packages/pages/auth/login.mpx +59 -59
  126. package/src/packages/pages/auth/update-user.mpx +17 -17
  127. package/src/packages/pages/cms/cms-article-list.mpx +164 -164
  128. package/src/packages/pages/cms/cms-article.mpx +32 -32
  129. package/src/pages/basic-component.mpx +30 -30
  130. package/src/pages/half-home.mpx +58 -58
  131. package/src/pages/home.mpx +52 -52
  132. package/src/pages/home2.mpx +47 -47
  133. package/src/pages/index.mpx +13 -3
  134. package/src/pages/tabbar/home.mpx +77 -77
  135. package/src/pages/tabbar/my.mpx +80 -80
  136. package/src/store/user.ts +270 -270
  137. package/src/styles/index.scss +20 -20
  138. package/src/styles/vars.scss +27 -27
  139. package/src/utils/common.ts +179 -179
  140. package/src/utils/config.ts +35 -35
  141. package/src/utils/db.ts +100 -100
  142. package/src/utils/grpc.ts +21 -21
  143. package/src/utils/net.ts +18 -18
  144. package/src/utils/request.ts +134 -134
  145. package/static/ali/mini.project.json +4 -4
  146. package/static/dd/project.config.json +15 -15
  147. package/static/swan/project.swan.json +14 -14
  148. package/static/tt/project.config.json +11 -11
  149. package/static/wx/project.config.json +40 -40
  150. package/uno.config.js +9 -9
@@ -1,53 +1,53 @@
1
- <template>
2
- <view class="home-page">
3
- <text>主页(全屏登录)</text>
4
- <cms-acticle-list organTenant="xyvcard" siteId="{{ siteId }}" channelAlias="{{ channelAlias }}"></cms-acticle-list>
5
- <cms-article-view title="企业动态" isInfo="{{ true }}" organTenant="xyvcard" siteId="{{ siteId }}"
6
- channelAlias="{{ channelAlias }}" style="1"></cms-article-view>
7
- </view>
8
- </template>
9
-
10
- <script>
11
- import mpx, { createPage, onShow, ref } from '@mpxjs/core'
12
- import { useUserStore } from '../store/user'
13
-
14
- createPage({
15
- setup() {
16
- let config = getApp().globalData.config;
17
- let userStore = useUserStore();
18
- //强制登录.
19
- onShow(() => {
20
- //检查登录并跳转登录
21
- userStore.loginOnlyAC().then(() => {
22
- //登录成功,加载业务
23
- console.log("静默登录成功");
24
- }).catch(() => {
25
- mpx.navigateTo({
26
- url: '/jmash/pages/auth/login'
27
- })
28
- });
29
- });
30
- let siteId = ref(config.siteId);
31
- let channelAlias = ref("gzdt");
32
- return { siteId, channelAlias }
33
- }
34
- })
35
- </script>
36
-
37
- <style lang="scss">
38
- .home-page {
39
- padding: 40rpx;
40
- text-align: center;
41
- font-size: 32rpx;
42
- color: #333;
43
- }
44
- </style>
45
-
46
- <script type="application/json">
47
- {
48
- "usingComponents": {
49
- "cms-acticle-list": "../components/cms/jmash-cms-acticle-list",
50
- "cms-article-view": "../components/cms/jmash-cms-article-view"
51
- }
52
- }
1
+ <template>
2
+ <view class="home-page">
3
+ <text>主页(全屏登录)</text>
4
+ <cms-acticle-list organTenant="xyvcard" siteId="{{ siteId }}" channelAlias="{{ channelAlias }}"></cms-acticle-list>
5
+ <cms-article-view title="企业动态" isInfo="{{ true }}" organTenant="xyvcard" siteId="{{ siteId }}"
6
+ channelAlias="{{ channelAlias }}" style="1"></cms-article-view>
7
+ </view>
8
+ </template>
9
+
10
+ <script>
11
+ import mpx, { createPage, onShow, ref } from '@mpxjs/core'
12
+ import { useUserStore } from '../store/user'
13
+
14
+ createPage({
15
+ setup() {
16
+ let config = getApp().globalData.config;
17
+ let userStore = useUserStore();
18
+ //强制登录.
19
+ onShow(() => {
20
+ //检查登录并跳转登录
21
+ userStore.loginOnlyAC().then(() => {
22
+ //登录成功,加载业务
23
+ console.log("静默登录成功");
24
+ }).catch(() => {
25
+ mpx.navigateTo({
26
+ url: '/jmash/pages/auth/login'
27
+ })
28
+ });
29
+ });
30
+ let siteId = ref(config.siteId);
31
+ let channelAlias = ref("gzdt");
32
+ return { siteId, channelAlias }
33
+ }
34
+ })
35
+ </script>
36
+
37
+ <style lang="scss">
38
+ .home-page {
39
+ padding: 40rpx;
40
+ text-align: center;
41
+ font-size: 32rpx;
42
+ color: #333;
43
+ }
44
+ </style>
45
+
46
+ <script type="application/json">
47
+ {
48
+ "usingComponents": {
49
+ "cms-acticle-list": "../components/cms/jmash-cms-acticle-list",
50
+ "cms-article-view": "../components/cms/jmash-cms-article-view"
51
+ }
52
+ }
53
53
  </script>
@@ -1,48 +1,48 @@
1
- <template>
2
- <view class="home-page">
3
- <text>主页(全屏登录)</text>
4
- <cms-acticle-list organTenant="xyvcard" siteId="{{ siteId }}" channelAlias="{{ channelAlias }}"></cms-acticle-list>
5
- <cms-article-view title="企业动态" isInfo="{{ true }}" organTenant="xyvcard" siteId="{{ siteId }}"
6
- channelAlias="{{ channelAlias }}" style="1"></cms-article-view>
7
- </view>
8
- </template>
9
-
10
- <script>
11
- import { createPage, onShow, ref } from '@mpxjs/core'
12
- import { useUserStore } from '../store/user'
13
-
14
- createPage({
15
- setup() {
16
- let config = getApp().globalData.config;
17
- let userStore = useUserStore();
18
- //强制登录.
19
- onShow(() => {
20
- //检查登录并跳转登录
21
- userStore.loginAC("/pages/home2", false).then((res) => {
22
- console.log(res);
23
- });
24
- });
25
- let siteId = ref(config.siteId);
26
- let channelAlias = ref("gzdt");
27
- return { siteId, channelAlias }
28
- }
29
- })
30
- </script>
31
-
32
- <style lang="scss">
33
- .home-page {
34
- padding: 40rpx;
35
- text-align: center;
36
- font-size: 32rpx;
37
- color: #333;
38
- }
39
- </style>
40
-
41
- <script type="application/json">
42
- {
43
- "usingComponents": {
44
- "cms-acticle-list": "../components/cms/jmash-cms-acticle-list",
45
- "cms-article-view": "../components/cms/jmash-cms-article-view"
46
- }
47
- }
1
+ <template>
2
+ <view class="home-page">
3
+ <text>主页(全屏登录)</text>
4
+ <cms-acticle-list organTenant="xyvcard" siteId="{{ siteId }}" channelAlias="{{ channelAlias }}"></cms-acticle-list>
5
+ <cms-article-view title="企业动态" isInfo="{{ true }}" organTenant="xyvcard" siteId="{{ siteId }}"
6
+ channelAlias="{{ channelAlias }}" style="1"></cms-article-view>
7
+ </view>
8
+ </template>
9
+
10
+ <script>
11
+ import { createPage, onShow, ref } from '@mpxjs/core'
12
+ import { useUserStore } from '../store/user'
13
+
14
+ createPage({
15
+ setup() {
16
+ let config = getApp().globalData.config;
17
+ let userStore = useUserStore();
18
+ //强制登录.
19
+ onShow(() => {
20
+ //检查登录并跳转登录
21
+ userStore.loginAC("/pages/home2", false).then((res) => {
22
+ console.log(res);
23
+ });
24
+ });
25
+ let siteId = ref(config.siteId);
26
+ let channelAlias = ref("gzdt");
27
+ return { siteId, channelAlias }
28
+ }
29
+ })
30
+ </script>
31
+
32
+ <style lang="scss">
33
+ .home-page {
34
+ padding: 40rpx;
35
+ text-align: center;
36
+ font-size: 32rpx;
37
+ color: #333;
38
+ }
39
+ </style>
40
+
41
+ <script type="application/json">
42
+ {
43
+ "usingComponents": {
44
+ "cms-acticle-list": "../components/cms/jmash-cms-acticle-list",
45
+ "cms-article-view": "../components/cms/jmash-cms-article-view"
46
+ }
47
+ }
48
48
  </script>
@@ -1,15 +1,19 @@
1
1
  <template>
2
2
  <view class="page-body">
3
3
  <button type="default" bind:tap="toHomePage">Welcome to Jmash Core MP</button>
4
+ <!-- 测试图片上传 -->
5
+ <jmash-upload-picture limit="6" bind:getImageArray="handleImageArray" />
6
+ <view wx:if="{{ imageArray.length }}">已上传 {{ imageArray.length }} 张图片</view>
4
7
  </view>
5
8
  </template>
6
9
 
7
10
  <script>
8
- import mpx, { createPage } from '@mpxjs/core'
11
+ import mpx, { createPage, ref } from '@mpxjs/core'
9
12
 
10
13
  createPage({
11
14
  setup(props, context) {
12
- return {};
15
+ const imageArray = ref([]);
16
+ return { imageArray };
13
17
  },
14
18
  methods: {
15
19
  toHomePage() {
@@ -17,6 +21,10 @@ createPage({
17
21
  url: '/pages/tabbar/home'
18
22
  })
19
23
  },
24
+ handleImageArray(e) {
25
+ this.imageArray = e.detail;
26
+ console.log('上传的图片:', e.detail);
27
+ },
20
28
  }
21
29
  })
22
30
  </script>
@@ -39,6 +47,8 @@ createPage({
39
47
 
40
48
  <script type="application/json">
41
49
  {
42
- "usingComponents": {}
50
+ "usingComponents": {
51
+ "jmash-upload-picture": "../components/common/jmash-upload-picture"
52
+ }
43
53
  }
44
54
  </script>
@@ -1,78 +1,78 @@
1
- <template>
2
- <view class="page-body">
3
- <button type="default" bind:tap="toHomePage">主页(全屏登录检查)</button>
4
- <button type="default" bind:tap="toHome2Page">主页(全屏登录)</button>
5
- <button type="default" bind:tap="toHalfHomePage">主页(半屏登录)</button>
6
- <button type="default" bind:tap="toCompTestPage">组件演示</button>
7
- <button type="default" bind:tap="loginOut">退出</button>
8
- </view>
9
- </template>
10
-
11
- <script>
12
- import mpx, { createPage } from '@mpxjs/core'
13
- import { useUserStore } from '../../store/user';
14
-
15
- createPage({
16
- data: {
17
- userStore: null,
18
- },
19
- onShow() {
20
- this.userStore = useUserStore();
21
- if (typeof this.getTabBar === 'function' &&
22
- this.getTabBar()) {
23
- this.getTabBar().$refs.tabBar.activeTab("Home");
24
- }
25
- },
26
- methods: {
27
- toHomePage() {
28
- mpx.navigateTo({
29
- url: '/pages/home'
30
- })
31
- },
32
- toHome2Page() {
33
- mpx.navigateTo({
34
- url: '/pages/home2'
35
- })
36
- },
37
- toHalfHomePage() {
38
- mpx.navigateTo({
39
- url: '/pages/half-home'
40
- })
41
- },
42
- toCompTestPage() {
43
- mpx.navigateTo({
44
- url: '/pages/basic-component'
45
- })
46
- },
47
- loginOut() {
48
- this.userStore.logout();
49
- mpx.showToast({
50
- title: '已退出登录',
51
- icon: 'success'
52
- })
53
- }
54
- }
55
- })
56
- </script>
57
-
58
- <style lang="scss">
59
- .page-body {
60
- display: flex;
61
- flex-direction: column;
62
- align-items: center;
63
- padding: 40rpx;
64
- gap: 30rpx;
65
-
66
- button {
67
- width: 80%;
68
- height: 80rpx;
69
- font-size: 32rpx;
70
- }
71
- }
72
- </style>
73
-
74
- <script type="application/json">
75
- {
76
- "usingComponents": {}
77
- }
1
+ <template>
2
+ <view class="page-body">
3
+ <button type="default" bind:tap="toHomePage">主页(全屏登录检查)</button>
4
+ <button type="default" bind:tap="toHome2Page">主页(全屏登录)</button>
5
+ <button type="default" bind:tap="toHalfHomePage">主页(半屏登录)</button>
6
+ <button type="default" bind:tap="toCompTestPage">组件演示</button>
7
+ <button type="default" bind:tap="loginOut">退出</button>
8
+ </view>
9
+ </template>
10
+
11
+ <script>
12
+ import mpx, { createPage } from '@mpxjs/core'
13
+ import { useUserStore } from '../../store/user';
14
+
15
+ createPage({
16
+ data: {
17
+ userStore: null,
18
+ },
19
+ onShow() {
20
+ this.userStore = useUserStore();
21
+ if (typeof this.getTabBar === 'function' &&
22
+ this.getTabBar()) {
23
+ this.getTabBar().$refs.tabBar.activeTab("Home");
24
+ }
25
+ },
26
+ methods: {
27
+ toHomePage() {
28
+ mpx.navigateTo({
29
+ url: '/pages/home'
30
+ })
31
+ },
32
+ toHome2Page() {
33
+ mpx.navigateTo({
34
+ url: '/pages/home2'
35
+ })
36
+ },
37
+ toHalfHomePage() {
38
+ mpx.navigateTo({
39
+ url: '/pages/half-home'
40
+ })
41
+ },
42
+ toCompTestPage() {
43
+ mpx.navigateTo({
44
+ url: '/pages/basic-component'
45
+ })
46
+ },
47
+ loginOut() {
48
+ this.userStore.logout();
49
+ mpx.showToast({
50
+ title: '已退出登录',
51
+ icon: 'success'
52
+ })
53
+ }
54
+ }
55
+ })
56
+ </script>
57
+
58
+ <style lang="scss">
59
+ .page-body {
60
+ display: flex;
61
+ flex-direction: column;
62
+ align-items: center;
63
+ padding: 40rpx;
64
+ gap: 30rpx;
65
+
66
+ button {
67
+ width: 80%;
68
+ height: 80rpx;
69
+ font-size: 32rpx;
70
+ }
71
+ }
72
+ </style>
73
+
74
+ <script type="application/json">
75
+ {
76
+ "usingComponents": {}
77
+ }
78
78
  </script>
@@ -1,80 +1,80 @@
1
- <template>
2
- <view class="my-page">
3
- <!-- 用户信息区(已集成) -->
4
- <jmash-user tabbar="true" backurl="/pages/tabbar/my"></jmash-user>
5
-
6
- <!-- 功能菜单区(抽离为组件) -->
7
- <jmash-menu menuGroups="{{ menuGroups }}" bind:itemClick="handleMenuClick"></jmash-menu>
8
- <!-- 底部退出组件 -->
9
- <jmash-logout version="1.0.0" bind:logoutSuccess="onLogoutSuccess"></jmash-logout>
10
- </view>
11
- </template>
12
-
13
- <script>
14
- import { createPage } from '@mpxjs/core'
15
- import mpx from '@mpxjs/core'
16
-
17
- createPage({
18
- data: {
19
- title: 'MY',
20
- // 菜单配置,新增功能直接加配置即可
21
- menuGroups: [
22
- {
23
- id: 1,
24
- items: [
25
- { key: 'order', title: '我的订单', icon: '📋', iconBg: '#409eff', path: '/pages/my/order' },
26
- { key: 'coupon', title: '我的优惠券', icon: '🎫', iconBg: '#f56c6c', path: '/pages/my/coupon', badge: '3' },
27
- { key: 'address', title: '我的地址', icon: '📍', iconBg: '#67c23a', path: '/pages/my/address' },
28
- ]
29
- },
30
- {
31
- id: 2,
32
- items: [
33
- { key: 'favorite', title: '我的收藏', icon: '⭐', iconBg: '#e6a23c', path: '/pages/my/favorite' },
34
- { key: 'help', title: '帮助与反馈', icon: '💡', iconBg: '#909399', path: '/pages/my/help' },
35
- { key: 'setting', title: '设置', icon: '⚙️', iconBg: '#722ed1', path: '/pages/my/setting' },
36
- ]
37
- }
38
- ]
39
- },
40
- onShow() {
41
- // 选中tabbar
42
- if (typeof this.getTabBar === 'function' && this.getTabBar()) {
43
- this.getTabBar().$refs.tabBar.activeTab("My");
44
- }
45
- },
46
- methods: {
47
- // 菜单点击(接收组件抛出的事件)
48
- handleMenuClick(e) {
49
- const { item } = e.detail
50
- if (item.path) {
51
- mpx.navigateTo({ url: item.path })
52
- }
53
- },
54
- // 退出成功回调(可选,根据业务需要添加逻辑)
55
- onLogoutSuccess() {
56
- console.log('退出登录成功,可在此处做后续处理')
57
- // 比如重置页面数据、刷新状态等
58
- }
59
- }
60
- })
61
- </script>
62
-
63
- <style lang="scss">
64
- $bg-page: #f5f5f5;
65
-
66
- .my-page {
67
- min-height: 100vh;
68
- background-color: $bg-page;
69
- }
70
- </style>
71
-
72
- <script type="application/json">
73
- {
74
- "usingComponents": {
75
- "jmash-user": "../../components/auth-user/jmash-user.mpx",
76
- "jmash-menu": "../../components/common/jmash-menu.mpx",
77
- "jmash-logout": "../../components/auth-user/jmash-logout.mpx"
78
- }
79
- }
80
- </script>
1
+ <template>
2
+ <view class="my-page">
3
+ <!-- 用户信息区(已集成) -->
4
+ <jmash-user tabbar="true" backurl="/pages/tabbar/my"></jmash-user>
5
+
6
+ <!-- 功能菜单区(抽离为组件) -->
7
+ <jmash-menu menuGroups="{{ menuGroups }}" bind:itemClick="handleMenuClick"></jmash-menu>
8
+ <!-- 底部退出组件 -->
9
+ <jmash-logout version="1.0.0" bind:logoutSuccess="onLogoutSuccess"></jmash-logout>
10
+ </view>
11
+ </template>
12
+
13
+ <script>
14
+ import { createPage } from '@mpxjs/core'
15
+ import mpx from '@mpxjs/core'
16
+
17
+ createPage({
18
+ data: {
19
+ title: 'MY',
20
+ // 菜单配置,新增功能直接加配置即可
21
+ menuGroups: [
22
+ {
23
+ id: 1,
24
+ items: [
25
+ { key: 'order', title: '我的订单', icon: '📋', iconBg: '#409eff', path: '/pages/my/order' },
26
+ { key: 'coupon', title: '我的优惠券', icon: '🎫', iconBg: '#f56c6c', path: '/pages/my/coupon', badge: '3' },
27
+ { key: 'address', title: '我的地址', icon: '📍', iconBg: '#67c23a', path: '/pages/my/address' },
28
+ ]
29
+ },
30
+ {
31
+ id: 2,
32
+ items: [
33
+ { key: 'favorite', title: '我的收藏', icon: '⭐', iconBg: '#e6a23c', path: '/pages/my/favorite' },
34
+ { key: 'help', title: '帮助与反馈', icon: '💡', iconBg: '#909399', path: '/pages/my/help' },
35
+ { key: 'setting', title: '设置', icon: '⚙️', iconBg: '#722ed1', path: '/pages/my/setting' },
36
+ ]
37
+ }
38
+ ]
39
+ },
40
+ onShow() {
41
+ // 选中tabbar
42
+ if (typeof this.getTabBar === 'function' && this.getTabBar()) {
43
+ this.getTabBar().$refs.tabBar.activeTab("My");
44
+ }
45
+ },
46
+ methods: {
47
+ // 菜单点击(接收组件抛出的事件)
48
+ handleMenuClick(e) {
49
+ const { item } = e.detail
50
+ if (item.path) {
51
+ mpx.navigateTo({ url: item.path })
52
+ }
53
+ },
54
+ // 退出成功回调(可选,根据业务需要添加逻辑)
55
+ onLogoutSuccess() {
56
+ console.log('退出登录成功,可在此处做后续处理')
57
+ // 比如重置页面数据、刷新状态等
58
+ }
59
+ }
60
+ })
61
+ </script>
62
+
63
+ <style lang="scss">
64
+ $bg-page: #f5f5f5;
65
+
66
+ .my-page {
67
+ min-height: 100vh;
68
+ background-color: $bg-page;
69
+ }
70
+ </style>
71
+
72
+ <script type="application/json">
73
+ {
74
+ "usingComponents": {
75
+ "jmash-user": "../../components/auth-user/jmash-user.mpx",
76
+ "jmash-menu": "../../components/common/jmash-menu.mpx",
77
+ "jmash-logout": "../../components/auth-user/jmash-logout.mpx"
78
+ }
79
+ }
80
+ </script>