jmash-core-mp 0.1.92 → 0.1.94

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 (120) hide show
  1. package/.gitignore +1 -0
  2. package/lib/api/cms/index.d.ts +2 -1
  3. package/lib/api/cms/index.js +11 -0
  4. package/lib/api/cms/types.d.ts +17 -0
  5. package/lib/api/files/index.d.ts +2 -0
  6. package/lib/api/files/index.js +14 -0
  7. package/lib/index.d.ts +1 -1
  8. package/lib/store/user.js +11 -5
  9. package/package.json +2 -2
  10. package/src/api/cms/index.ts +16 -0
  11. package/src/api/cms/types.ts +33 -0
  12. package/src/api/files/index.ts +14 -0
  13. package/src/app.mpx +8 -1
  14. package/src/components/auth-user/jmash-logout.mpx +25 -20
  15. package/src/components/auth-user/jmash-update-user.mpx +141 -209
  16. package/src/components/auth-user/jmash-update-user.web.mpx +149 -243
  17. package/src/components/auth-user/jmash-user.mpx +17 -53
  18. package/src/components/cms/jmash-cms-activity-item.mpx +60 -60
  19. package/src/components/cms/jmash-cms-activity-list.mpx +77 -170
  20. package/src/components/cms/jmash-cms-article-item.mpx +57 -66
  21. package/src/components/cms/jmash-cms-article-list.mpx +69 -70
  22. package/src/components/cms/jmash-cms-article-view.mpx +5 -8
  23. package/src/components/cms/jmash-cms-article.mpx +94 -108
  24. package/src/components/cms/jmash-cms-like.mpx +6 -5
  25. package/src/components/cms/jmash-cms-location-list.mpx +71 -103
  26. package/src/components/cms/jmash-cms-location.mpx +108 -133
  27. package/src/components/cms/jmash-cms-product-item.mpx +48 -63
  28. package/src/components/cms/jmash-cms-product-list.mpx +61 -65
  29. package/src/components/common/jmash-avatar-edit.mpx +21 -37
  30. package/src/components/common/jmash-cell-group.mpx +8 -4
  31. package/src/components/common/jmash-code-interest-popup.mpx +2 -6
  32. package/src/components/common/jmash-follow-tip.mpx +15 -29
  33. package/src/components/common/jmash-form-cell.mpx +7 -22
  34. package/src/components/common/jmash-menu.mpx +13 -9
  35. package/src/components/common/jmash-none-data.mpx +5 -6
  36. package/src/components/common/jmash-pic-swiper.mpx +3 -8
  37. package/src/components/common/jmash-popup.mpx +22 -17
  38. package/src/components/common/jmash-search.mpx +21 -33
  39. package/src/components/common/jmash-single-btn.mpx +27 -8
  40. package/src/components/common/jmash-status-filter.mpx +162 -156
  41. package/src/components/common/jmash-stepper.mpx +8 -8
  42. package/src/components/common/jmash-swipe-cell.mpx +1 -0
  43. package/src/components/common/jmash-tab-bar.mpx +22 -2
  44. package/src/components/common/jmash-textarea.mpx +25 -26
  45. package/src/components/common/jmash-top-navigation.mpx +5 -1
  46. package/src/components/common/jmash-upload-picture.mpx +17 -42
  47. package/src/components/core/jmash-cms-protocol.mpx +15 -4
  48. package/src/components/core/jmash-login.ali.mpx +54 -110
  49. package/src/components/core/jmash-login.mpx +149 -143
  50. package/src/components/core/jmash-login.web.mpx +110 -127
  51. package/src/components/core/jmash-popup-login.ali.mpx +90 -94
  52. package/src/components/core/jmash-popup-login.mpx +177 -174
  53. package/src/components/core/jmash-popup-login.web.mpx +153 -161
  54. package/src/components/organ/browser-organ-list.mpx +6 -5
  55. package/src/components/organ/my-organ-list.mpx +6 -5
  56. package/src/components/organ/organ-item.mpx +44 -29
  57. package/src/components/organ/organ-search.mpx +53 -23
  58. package/src/components/organ/organ-selected-item.mpx +44 -29
  59. package/src/components/shop/branch-item.mpx +44 -29
  60. package/src/components/shop/branch-search.mpx +53 -23
  61. package/src/components/shop/shop-item.mpx +44 -29
  62. package/src/components/shop/shop-search.mpx +53 -23
  63. package/src/components/shop/shop-selected-item.mpx +44 -29
  64. package/src/index.ts +2 -0
  65. package/src/packages/pages/auth/cms-protocol.mpx +3 -1
  66. package/src/packages/pages/auth/login.mpx +3 -19
  67. package/src/packages/pages/auth/setting-page.mpx +78 -38
  68. package/src/packages/pages/cms/cms-activity-list.mpx +17 -21
  69. package/src/packages/pages/cms/cms-article-list.mpx +17 -21
  70. package/src/packages/pages/cms/cms-article.mpx +3 -1
  71. package/src/packages/pages/cms/cms-location-list.mpx +17 -16
  72. package/src/packages/pages/cms/cms-location.mpx +3 -1
  73. package/src/packages/pages/cms/cms-product-list.mpx +17 -21
  74. package/src/packages/pages/share/scan.mpx +12 -13
  75. package/src/pages/basic-component.mpx +17 -5
  76. package/src/pages/branch-search.mpx +1 -5
  77. package/src/pages/cube-theme.mpx +5 -3
  78. package/src/pages/half-home.mpx +17 -5
  79. package/src/pages/home.mpx +17 -5
  80. package/src/pages/home2.mpx +17 -5
  81. package/src/pages/index.mpx +48 -5
  82. package/src/pages/organ-search.mpx +1 -5
  83. package/src/pages/organ.mpx +21 -19
  84. package/src/pages/shop-search.mpx +1 -5
  85. package/src/pages/tabbar/home.mpx +5 -1
  86. package/src/pages/tabbar/mall.mpx +5 -1
  87. package/src/pages/tabbar/my.mpx +5 -1
  88. package/src/pages/tabbar/organ.mpx +5 -1
  89. package/src/store/user.ts +14 -5
  90. package/src/styles/index.scss +1 -20
  91. package/src/styles/mixin.css +8 -0
  92. package/lib/components/auth-user/jmash-update-user.mpx.d.ts +0 -1
  93. package/lib/components/auth-user/jmash-user.mpx.d.ts +0 -1
  94. package/lib/components/cms/jmash-cms-article-view.mpx.d.ts +0 -1
  95. package/lib/components/common/jmash-none-data.mpx.d.ts +0 -1
  96. package/lib/components/common/jmash-search.mpx.d.ts +0 -1
  97. package/lib/components/common/jmash-top-navigation.mpx.d.ts +0 -1
  98. package/lib/components/core/jmash-login.mpx.d.ts +0 -1
  99. package/lib/components/organ/browser-organ-list.mpx.d.ts +0 -1
  100. package/lib/components/organ/my-organ-list.mpx.d.ts +0 -1
  101. package/lib/components/organ/organ-item.mpx.d.ts +0 -1
  102. package/lib/components/organ/organ-search.mpx.d.ts +0 -1
  103. package/lib/components/organ/organ-selected-item.mpx.d.ts +0 -1
  104. package/lib/components/shop/branch-item.mpx.d.ts +0 -1
  105. package/lib/components/shop/branch-search.mpx.d.ts +0 -1
  106. package/lib/components/shop/shop-item.mpx.d.ts +0 -1
  107. package/lib/components/shop/shop-search.mpx.d.ts +0 -1
  108. package/lib/components/shop/shop-selected-item.mpx.d.ts +0 -1
  109. package/lib/packages/pages/auth/setting-page.mpx.d.ts +0 -1
  110. package/lib/packages/pages/auth/web-view.mpx.d.ts +0 -1
  111. package/lib/packages/pages/cms/cms-activity-list.mpx.d.ts +0 -1
  112. package/lib/packages/pages/cms/cms-article-list.mpx.d.ts +0 -1
  113. package/lib/packages/pages/cms/cms-location-list.mpx.d.ts +0 -1
  114. package/lib/packages/pages/cms/cms-product-list.mpx.d.ts +0 -1
  115. package/lib/packages/pages/share/scan.mpx.d.ts +0 -1
  116. package/lib/pages/branch-search.mpx.d.ts +0 -1
  117. package/lib/pages/organ-search.mpx.d.ts +0 -1
  118. package/lib/pages/organ.mpx.d.ts +0 -1
  119. package/lib/pages/shop-search.mpx.d.ts +0 -1
  120. package/postcss.config.js +0 -11
package/.gitignore CHANGED
@@ -6,3 +6,4 @@ deploy/
6
6
  output/
7
7
  dist/
8
8
  .vscode/
9
+ .pnpm-store/
@@ -1,4 +1,4 @@
1
- import { CmsSiteKey, CmsSiteList, CmsSiteModel, CmsChannelReq, CmsChannelList, CmsInfoReq, CmsInfoPage, CmsInfoKey, CmsInfoModel, CmsInfoContentReq, CmsInfoContentList, CmsContentInfoReq, CmsContentInfoModel, CmsInfoFileReq, CmsInfoFileList, FrontInteractKey, FrontInteractModel, FrontLikeKey, FrontLikeModel, FrontLikeCreateReq, FrontBrowseRecordCreateReq, FrontBrowseRecordModel, FrontCommentCreateReq, FrontCommentModel, FrontCommentPage, FrontCommentReq, FrontCollectCreateReq, FrontCollectModel, FrontCollectPage, FrontCollectReq, CmsChannelKey, CmsChannelModel, CmsSeatsReq, CmsSeatsList, CmsSeatInfoReq, CmsSeatInfoList } from "./types";
1
+ import { CmsSiteKey, CmsSiteList, CmsSiteModel, CmsChannelReq, CmsChannelList, CmsInfoReq, CmsInfoPage, CmsInfoKey, CmsInfoModel, CmsInfoContentReq, CmsInfoContentList, CmsContentInfoReq, CmsContentInfoModel, CmsInfoFileReq, CmsInfoFileList, FrontInteractKey, FrontInteractModel, FrontLikeKey, FrontLikeModel, FrontLikeCreateReq, FrontBrowseRecordCreateReq, FrontBrowseRecordModel, FrontRelayRecordCreateReq, FrontRelayRecordModel, FrontCommentCreateReq, FrontCommentModel, FrontCommentPage, FrontCommentReq, FrontCollectCreateReq, FrontCollectModel, FrontCollectPage, FrontCollectReq, CmsChannelKey, CmsChannelModel, CmsSeatsReq, CmsSeatsList, CmsSeatInfoReq, CmsSeatInfoList } from "./types";
2
2
  import { ResponseData } from "../../api/types";
3
3
  declare class CmsApiImpl {
4
4
  findCmsSiteList(tenant: string): Promise<ResponseData<CmsSiteList>>;
@@ -18,6 +18,7 @@ declare class CmsApiImpl {
18
18
  isLike(data: FrontLikeKey): Promise<ResponseData<any>>;
19
19
  frontLike(data: FrontLikeCreateReq): Promise<ResponseData<FrontLikeModel>>;
20
20
  createfrontBrowseRecord(data: FrontBrowseRecordCreateReq): Promise<ResponseData<FrontBrowseRecordModel>>;
21
+ createFrontRelayRecord(data: FrontRelayRecordCreateReq): Promise<ResponseData<FrontRelayRecordModel>>;
21
22
  findFrontCommentPage(data: FrontCommentReq): Promise<ResponseData<FrontCommentPage>>;
22
23
  createFrontComment(data: FrontCommentCreateReq): Promise<ResponseData<FrontCommentModel>>;
23
24
  createMyFrontCollect(data: FrontCollectCreateReq): Promise<ResponseData<FrontCollectModel>>;
@@ -202,6 +202,17 @@ class CmsApiImpl {
202
202
  },
203
203
  });
204
204
  }
205
+ // 转发
206
+ createFrontRelayRecord(data) {
207
+ return mpx.xfetch.fetch({
208
+ url: "/v1/front/front/front_relay_record",
209
+ method: "POST",
210
+ data,
211
+ header: {
212
+ "Grpc-Metadata-Tenant": data.tenant,
213
+ },
214
+ });
215
+ }
205
216
  // 查询翻页信息评论表
206
217
  findFrontCommentPage(data) {
207
218
  if (data) {
@@ -87,6 +87,7 @@ export interface CmsInfoReq {
87
87
  isImg?: boolean;
88
88
  modelCode?: string;
89
89
  hasModel?: boolean;
90
+ organId?: string;
90
91
  }
91
92
  export interface CmsInfoKey {
92
93
  tenant?: string;
@@ -274,6 +275,22 @@ export interface FrontBrowseRecordCreateReq {
274
275
  export interface FrontBrowseRecordModel {
275
276
  browseId?: string;
276
277
  }
278
+ export interface FrontRelayRecordCreateReq {
279
+ tenant: string;
280
+ requestId?: string;
281
+ validateOnly?: boolean;
282
+ type?: string;
283
+ relationId?: string;
284
+ organId?: string;
285
+ }
286
+ export interface FrontRelayRecordModel {
287
+ relayId?: string;
288
+ type?: string;
289
+ relationId?: string;
290
+ realIp?: string;
291
+ createTime?: string;
292
+ createBy?: string;
293
+ }
277
294
  export interface FrontCommentCreateReq {
278
295
  tenant: string;
279
296
  requestId?: string;
@@ -16,6 +16,8 @@ declare class FileApi {
16
16
  fileUrl(fileUrl?: string): string;
17
17
  fileIdUrl(fileId?: string): string;
18
18
  uploadBase64File(base64: FileBase64Req): Promise<ResponseData<FileInfo>>;
19
+ /** 上传文件 */
20
+ uploadFileWeb(file: File): Promise<ResponseData<FileInfo>>;
19
21
  uploadFile(file: string): Promise<FileInfo>;
20
22
  downloadFile(url: string): Promise<FileDownInfo>;
21
23
  uploadWebFile(data: FileWebReq): Promise<ResponseData<FileInfo>>;
@@ -65,6 +65,20 @@ class FileApi {
65
65
  data: base64,
66
66
  });
67
67
  }
68
+ /** 上传文件 */
69
+ uploadFileWeb(file) {
70
+ const formData = new FormData();
71
+ formData.append("file", file);
72
+ return mpx.xfetch.fetch({
73
+ url: "/api/v1/files",
74
+ method: "POST",
75
+ data: formData,
76
+ header: {
77
+ "Content-Type": "multipart/form-data",
78
+ Authorization: db.getBearerToken(),
79
+ },
80
+ });
81
+ }
68
82
  // 上传文件
69
83
  uploadFile(file) {
70
84
  const p = mpx.uploadFile({
package/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type { AppConfig, ResponseData, ValidateData, EventBase, EventTarget, CanvasResponse, } from "./api/types";
2
2
  export type { LoginReq, LoginRes, RolesPerms, WebLoginReq, TokenModel, PhoneRegisterReq, PhoneReplaceReq, UpdateUserReq, UserInfoReq, UserInfo, GzhSubscribeCheckReq, } from "./api/auth/types";
3
- export type { CmsSiteList, CmsSiteKey, CmsSiteModel, CmsChannelReq, CmsChannelList, CmsChannelModel, CmsChannelKey, CmsInfoPage, CmsInfoModelTotal, CmsInfoReq, CmsInfoKey, CmsInfoModel, CmsInfoContentReq, CmsInfoContentModel, CmsInfoContentList, CmsContentInfoReq, CmsContentInfoModel, CmsInfoFileReq, CmsInfoFileModel, CmsInfoFileList, CmsSeatsReq, CmsSeatsList, CmsSeatsModel, CmsSeatInfoReq, CmsSeatInfoList, CmsSeatInfoModel, FrontInteractKey, FrontInteractModel, FrontLikeKey, FrontLikeCreateReq, FrontLikeModel, FrontBrowseRecordCreateReq, FrontBrowseRecordModel, FrontCommentCreateReq, FrontCommentModel, FrontCommentModelTotal, FrontCommentPage, FrontCommentReq, FrontCollectCreateReq, FrontCollectModel, FrontCollectModelTotal, FrontCollectPage, FrontCollectReq, } from "./api/cms/types";
3
+ export type { CmsSiteList, CmsSiteKey, CmsSiteModel, CmsChannelReq, CmsChannelList, CmsChannelModel, CmsChannelKey, CmsInfoPage, CmsInfoModelTotal, CmsInfoReq, CmsInfoKey, CmsInfoModel, CmsInfoContentReq, CmsInfoContentModel, CmsInfoContentList, CmsContentInfoReq, CmsContentInfoModel, CmsInfoFileReq, CmsInfoFileModel, CmsInfoFileList, CmsSeatsReq, CmsSeatsList, CmsSeatsModel, CmsSeatInfoReq, CmsSeatInfoList, CmsSeatInfoModel, FrontInteractKey, FrontInteractModel, FrontLikeKey, FrontLikeCreateReq, FrontLikeModel, FrontBrowseRecordCreateReq, FrontBrowseRecordModel, FrontRelayRecordCreateReq, FrontRelayRecordModel, FrontCommentCreateReq, FrontCommentModel, FrontCommentModelTotal, FrontCommentPage, FrontCommentReq, FrontCollectCreateReq, FrontCollectModel, FrontCollectModelTotal, FrontCollectPage, FrontCollectReq, } from "./api/cms/types";
4
4
  export type { Entry, DictEntryModel, DictEntryLayModel, } from "./api/dict/types";
5
5
  export { EntryDict, EnumDict, EntryLayDict, CustomBizDict } from "./api/dicts";
6
6
  export type { FileInfo, FileBase64Req, FileDownInfo, FileWebReq, } from "./api/files/types";
package/lib/store/user.js CHANGED
@@ -2,7 +2,7 @@ import { defineStore } from "@mpxjs/pinia";
2
2
  import { authApi } from "../api/auth/index";
3
3
  import { db } from "../utils/db";
4
4
  import { net } from "../utils/net";
5
- import mpx from "@mpxjs/core";
5
+ import mpx, { unref } from "@mpxjs/core";
6
6
  export const useUserStore = defineStore("user", {
7
7
  state: () => ({
8
8
  userInfo: db.getUserInfo() || {},
@@ -161,17 +161,23 @@ export const useUserStore = defineStore("user", {
161
161
  },
162
162
  /** 检查登录是否有效? */
163
163
  checkLogin() {
164
- if (this.accessToken && !this.isTokenExpires()) {
164
+ const accessToken = unref(this.accessToken);
165
+ if (accessToken && accessToken !== "" && !this.isTokenExpires()) {
165
166
  return true;
166
167
  }
167
168
  return false;
168
169
  },
169
170
  //是否Token过期.
170
171
  isTokenExpires() {
171
- const expiresDate = this.expiresDate;
172
- //无token/无过期时间直接视为过期
173
- if (!this.accessToken || !expiresDate)
172
+ const accessToken = unref(this.accessToken);
173
+ const expiresDate = Number(unref(this.expiresDate));
174
+ // 部分运行环境可能保留 Ref 包装;先取实际值,再判断有效期。
175
+ if (!accessToken ||
176
+ accessToken === "" ||
177
+ !Number.isFinite(expiresDate) ||
178
+ expiresDate <= 0) {
174
179
  return true;
180
+ }
175
181
  const now = new Date().getTime();
176
182
  return now + 30000 > expiresDate;
177
183
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmash-core-mp",
3
- "version": "0.1.92",
3
+ "version": "0.1.94",
4
4
  "private": false,
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "@mpxjs/store": "^2.11.0",
14
14
  "@mpxjs/utils": "^2.11.0",
15
15
  "dayjs": "^1.11.23",
16
- "pinia": "^2.0.14",
16
+ "pinia": "~2.0.36",
17
17
  "vue": "^2.7.0",
18
18
  "sm-crypto": "0.4.0",
19
19
  "vue-demi": "^0.14.10",
@@ -21,6 +21,8 @@ import {
21
21
  FrontLikeCreateReq,
22
22
  FrontBrowseRecordCreateReq,
23
23
  FrontBrowseRecordModel,
24
+ FrontRelayRecordCreateReq,
25
+ FrontRelayRecordModel,
24
26
  FrontCommentCreateReq,
25
27
  FrontCommentModel,
26
28
  FrontCommentPage,
@@ -278,6 +280,20 @@ class CmsApiImpl {
278
280
  });
279
281
  }
280
282
 
283
+ // 转发
284
+ createFrontRelayRecord(
285
+ data: FrontRelayRecordCreateReq,
286
+ ): Promise<ResponseData<FrontRelayRecordModel>> {
287
+ return mpx.xfetch.fetch({
288
+ url: "/v1/front/front/front_relay_record",
289
+ method: "POST",
290
+ data,
291
+ header: {
292
+ "Grpc-Metadata-Tenant": data.tenant,
293
+ },
294
+ });
295
+ }
296
+
281
297
  // 查询翻页信息评论表
282
298
  findFrontCommentPage(
283
299
  data: FrontCommentReq,
@@ -173,6 +173,8 @@ export interface CmsInfoReq {
173
173
  modelCode?: string;
174
174
  // 是否包含信息模型
175
175
  hasModel?: boolean;
176
+ // 组织ID
177
+ organId?: string;
176
178
  }
177
179
 
178
180
  // 信息主表主键.
@@ -531,6 +533,37 @@ export interface FrontBrowseRecordModel {
531
533
  browseId?: string;
532
534
  }
533
535
 
536
+ // 转发记录表新增
537
+ export interface FrontRelayRecordCreateReq {
538
+ // 租户
539
+ tenant: string;
540
+ // 用于检测重复请求的唯一字符串ID
541
+ requestId?: string;
542
+ // 如果为true,则表示给定的请求仅需要被检验,而不是被执行
543
+ validateOnly?: boolean;
544
+ // 类型(cms_info: 信息, cms_product: 产品, vcard_share: 递名片, vcard_forward: 转发名片)
545
+ type?: string;
546
+ // 关系
547
+ relationId?: string;
548
+ // 组织ID
549
+ organId?: string;
550
+ }
551
+ // 转发记录表实体
552
+ export interface FrontRelayRecordModel {
553
+ // 转发id
554
+ relayId?: string;
555
+ // 类型
556
+ type?: string;
557
+ // 关系
558
+ relationId?: string;
559
+ // 用户IP地址
560
+ realIp?: string;
561
+ // 创建时间
562
+ createTime?: string;
563
+ // 创建者
564
+ createBy?: string;
565
+ }
566
+
534
567
  // 评论表新增
535
568
  export interface FrontCommentCreateReq {
536
569
  // 租户
@@ -89,6 +89,20 @@ class FileApi {
89
89
  data: base64,
90
90
  });
91
91
  }
92
+ /** 上传文件 */
93
+ uploadFileWeb(file: File): Promise<ResponseData<FileInfo>> {
94
+ const formData = new FormData();
95
+ formData.append("file", file);
96
+ return mpx.xfetch.fetch({
97
+ url: "/api/v1/files",
98
+ method: "POST",
99
+ data: formData,
100
+ header: {
101
+ "Content-Type": "multipart/form-data",
102
+ Authorization: db.getBearerToken(),
103
+ },
104
+ });
105
+ }
92
106
 
93
107
  // 上传文件
94
108
  uploadFile(file: string): Promise<FileInfo> {
package/src/app.mpx CHANGED
@@ -28,11 +28,18 @@ createApp({
28
28
 
29
29
  <style lang="scss">
30
30
  @use './styles/theme-default' as theme;
31
+ @import './styles/mixin.css';
31
32
 
32
- // 更换主题
33
33
  page,
34
34
  #app {
35
35
  @include theme.variables;
36
+ box-sizing: border-box;
37
+ min-height: 100%;
38
+ background: var(--cube-fill-bgc, #f2f2f2);
39
+ color: var(--cube-text-color, #323233);
40
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
41
+ font-size: var(--cube-font-size-sm, 28rpx);
42
+ line-height: 1.6;
36
43
  }
37
44
  </style>
38
45
 
@@ -1,13 +1,14 @@
1
1
  <template>
2
2
  <view class="logout-section">
3
3
  <!-- 登录状态才显示退出按钮 -->
4
- <cube-button primary class="jmash-btn btn-width-50" bind:tap="handleLogout" wx:if="{{ isLogin }}">退出登录</cube-button>
4
+ <cube-button primary class="jmash-btn btn-width-50" bind:tap="handleLogout"
5
+ wx:if="{{ userStore.checkLogin() }}">退出登录</cube-button>
5
6
  <text class="version-text">当前版本 V{{ version }}</text>
6
7
  </view>
7
8
  </template>
8
9
 
9
10
  <script>
10
- import mpx, { createComponent, computed } from '@mpxjs/core'
11
+ import mpx, { createComponent } from '@mpxjs/core'
11
12
  import { useUserStore } from '../../store/user'
12
13
 
13
14
  createComponent({
@@ -20,9 +21,8 @@ createComponent({
20
21
  },
21
22
  setup() {
22
23
  let userStore = useUserStore();
23
- const isLogin = computed(() => userStore.accessToken !== '');
24
24
  return {
25
- isLogin, userStore
25
+ userStore
26
26
  };
27
27
  },
28
28
  methods: {
@@ -31,14 +31,13 @@ createComponent({
31
31
  mpx.showModal({
32
32
  title: '提示',
33
33
  content: '确定要退出登录吗?',
34
- success: (res) => {
35
- if (res.confirm) {
36
- // 调用退出接口
37
- this.userStore.logout()
38
- mpx.showToast({ title: '已退出登录', icon: 'success' })
39
- // 通知父组件退出成功
40
- this.triggerEvent('logoutSuccess');
41
- }
34
+ }).then((res) => {
35
+ if (res.confirm) {
36
+ // 调用退出接口
37
+ this.userStore.logout()
38
+ mpx.showToast({ title: '已退出登录', icon: 'success' })
39
+ // 通知父组件退出成功
40
+ this.triggerEvent('logoutSuccess');
42
41
  }
43
42
  })
44
43
  }
@@ -49,19 +48,25 @@ createComponent({
49
48
  <style lang="scss">
50
49
  @import "../../styles/mixin.css";
51
50
 
52
- .btn-width-50 {
53
- width: 50%;
54
- }
55
-
56
51
  .logout-section {
57
52
  display: flex;
58
53
  flex-direction: column;
59
54
  align-items: center;
55
+ gap: 24rpx;
56
+ padding: 32rpx 24rpx;
57
+ --cube-btn-font-size: 28rpx;
58
+ --cube-btn-border-radius: 20rpx;
59
+ }
60
60
 
61
- .version-text {
62
- font-size: var(--cube-font-size-sm);
63
- color: var(--cube-text-color-hint);
64
- }
61
+ .btn-width-50 {
62
+ width: 100%;
63
+ max-width: 560px;
64
+ }
65
+
66
+ .version-text {
67
+ color: var(--cube-text-color-hint, #999);
68
+ font-size: 24rpx;
69
+ line-height: 1.6;
65
70
  }
66
71
  </style>
67
72