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,172 +1,175 @@
1
1
  <template>
2
- <!-- 上传图片组件 -->
3
- <view class="upload-picture-box">
4
- <block wx:for="{{ imageArray }}" wx:key="index">
5
- <view class="image_box">
6
- <image class="upload_image" src="{{ baseUrl + item }}" />
7
- <image class="del_image" src="{{ resourceUrl + 'file_del_icon.png' }}" mode="widthFix"
8
- data-index="{{ index }}" bind:tap="handleDel" />
9
- </view>
10
- </block>
11
- <view wx:if="{{ imageArray.length < limit }}" class="upload-box" bind:tap="handleUploadImage">
12
- <image class="upload-icon" src="{{ resourceUrl + 'upload_icon.png' }}" mode="widthFix" />
13
- <text>添加图片</text>
14
- </view>
2
+ <!-- 上传图片组件 -->
3
+ <view class="upload-picture-box">
4
+ <block wx:for="{{ imageArray }}" wx:key="index">
5
+ <view class="image_box">
6
+ <image class="upload_image" src="{{ baseUrl + item }}" />
7
+ <image class="del_image" src="{{ resourceUrl + 'file_del_icon.png' }}" mode="widthFix" data-index="{{ index }}"
8
+ bind:tap="handleDel" />
9
+ </view>
10
+ </block>
11
+ <view wx:if="{{ imageArray.length < limit }}" class="upload-box" bind:tap="handleUploadImage">
12
+ <image class="upload-icon" src="{{ resourceUrl + 'upload_icon.png' }}" mode="widthFix" />
13
+ <text>添加图片</text>
15
14
  </view>
15
+ </view>
16
16
 
17
17
  </template>
18
18
 
19
19
  <script lang="ts">
20
20
  import mpx, { createComponent, ref } from "@mpxjs/core";
21
21
  import { EventBase } from "../../api/types";
22
+ // import { config } from "../../utils/config";
22
23
 
23
24
  createComponent({
24
- properties: {
25
- // 上传图片数量限制
26
- limit: {
27
- type: Number,
28
- value: 6
29
- }
30
- },
31
- setup() {
32
- let config = getApp().globalData.config;
33
- // 资源路径
34
- let resourceUrl = config.resourceUrl + "/images/mall/";
35
- // 图片路径
36
- let baseUrl = config.baseUrl + "/v1/file/image/clip/100/100/";
37
- // 上传图片数组
38
- let imageArray = ref([] as Array<string>);
25
+ properties: {
26
+ // 上传图片数量限制
27
+ limit: {
28
+ type: Number,
29
+ value: 6
30
+ }
31
+ },
32
+ setup() {
33
+ let config = getApp().globalData.config;
34
+ // 资源路径
35
+ let resourceUrl = config.resourceUrl + "/images/mall/";
36
+ // 图片路径
37
+ let baseUrl = config.baseUrl + "/v1/file/image/clip/100/100/";
38
+ // 上传图片数组
39
+ let imageArray = ref([] as Array<string>);
39
40
 
40
- return {
41
- resourceUrl,
42
- baseUrl,
43
- imageArray,
41
+ return {
42
+ resourceUrl,
43
+ baseUrl,
44
+ imageArray,
45
+ }
46
+ },
47
+ methods: {
48
+ handleUploadImage() {
49
+ if (this.imageArray.length > this.limit - 1) {
50
+ mpx.showToast({
51
+ title: "图片最多上传" + this.limit + "张",
52
+ icon: "none",
53
+ duration: 2000
54
+ });
55
+ return;
56
+ }
57
+ mpx.showActionSheet({
58
+ itemList: ["从相册中选择", "拍照"],
59
+ itemColor: "#486aff",
60
+ success: (res) => {
61
+ if (res.tapIndex === 0) {
62
+ this.chooseWxHeadImage("album");
63
+ } else if (res.tapIndex === 1) {
64
+ this.chooseWxHeadImage("camera");
65
+ }
44
66
  }
67
+ });
45
68
  },
46
- methods: {
47
- handleUploadImage() {
48
- if (this.imageArray.length > this.limit - 1) {
49
- mpx.showToast({
50
- title: "图片最多上传" + this.limit + "张",
69
+ chooseWxHeadImage: function (type: any) {
70
+ let config = getApp().globalData.config;
71
+ const token: string = mpx.getStorageSync("token") ? "Bearer " + mpx.getStorageSync("token") : "";
72
+ mpx.chooseMedia({
73
+ count: this.limit,
74
+ mediaType: ['image'],
75
+ sizeType: ["original", "compressed"],
76
+ sourceType: [type],
77
+ success: (res) => {
78
+ console.log('chooseImage success, temp path is', res)
79
+ const files = res.tempFiles || [];
80
+ // 逐个上传
81
+ files.forEach((file: any) => {
82
+ mpx.uploadFile({
83
+ url: config.baseUrl + "/v1/file/upload?tenant=" + config.tenant,
84
+ filePath: file.tempFilePath,
85
+ header: {
86
+ "Content-Type": "multipart/form-data",
87
+ "Authorization": token
88
+ },
89
+ formData: {
90
+ method: "POST",
91
+ },
92
+ name: "file",
93
+ success: (response) => {
94
+ console.log(response);
95
+ if (response.statusCode === 200) {
96
+ const src = JSON.parse(response.data).fileSrc;
97
+ this.imageArray.push(src);
98
+ this.triggerEvent("getImageArray", this.imageArray);
99
+ } else {
100
+ mpx.showToast({
101
+ title: "图片上传失败",
51
102
  icon: "none",
52
103
  duration: 2000
53
- });
54
- return;
55
- }
56
- mpx.showActionSheet({
57
- itemList: ["从相册中选择", "拍照"],
58
- itemColor: "#486aff",
59
- success: (res) => {
60
- if (res.tapIndex === 0) {
61
- this.chooseWxHeadImage("album");
62
- } else if (res.tapIndex === 1) {
63
- this.chooseWxHeadImage("camera");
64
- }
65
- }
66
- });
67
- },
68
- chooseWxHeadImage: function (type: any) {
69
- let config = getApp().globalData.config;
70
- const token: string = mpx.getStorageSync("token") ? "Bearer " + mpx.getStorageSync("token") : "";
71
- mpx.chooseMedia({
72
- count: this.limit,
73
- sizeType: ["original", "compressed"],
74
- sourceType: [type],
75
- success: (res) => {
76
- console.log('chooseImage success, temp path is', res)
77
- const tempFilePaths = res.tempFiles[0].tempFilePath;
78
- // 上传文件
79
- mpx.uploadFile({
80
- url: config.baseUrl + "/v1/file/upload?tenant=" + config.tenant,
81
- filePath: tempFilePaths,
82
- header: {
83
- "Content-Type": "multipart/form-data",
84
- "Authorization": token
85
- },
86
- formData: {
87
- method: "POST", //请求方式
88
- },
89
- name: "file",
90
- success: (response) => {
91
- console.log(response);
92
- if (response.statusCode === 200) {
93
- const src = JSON.parse(response.data).fileSrc;
94
- this.imageArray.push(src);
95
- // 使用this.triggerEvent传索引值给页面
96
- this.triggerEvent("getImageArray", this.imageArray);
97
- } else {
98
- mpx.showToast({
99
- title: "图片上传失败",
100
- icon: "none",
101
- duration: 2000
102
- });
103
- }
104
- }
105
- })
104
+ });
106
105
  }
106
+ }
107
107
  })
108
- },
109
- // 删除图片
110
- handleDel(e: EventBase) {
111
- this.imageArray.splice(e.currentTarget.dataset.index, 1);
112
- // 使用this.triggerEvent传索引值给页面
113
- this.triggerEvent("getImageArray", this.imageArray);
108
+ });
114
109
  }
110
+ })
111
+ },
112
+ // 删除图片
113
+ handleDel(e: EventBase) {
114
+ this.imageArray.splice(e.currentTarget.dataset.index, 1);
115
+ // 使用this.triggerEvent传索引值给页面
116
+ this.triggerEvent("getImageArray", this.imageArray);
115
117
  }
118
+ }
116
119
  })
117
120
  </script>
118
121
 
119
122
  <style lang="scss">
120
123
  .upload-picture-box {
121
- display: flex;
122
- align-items: center;
123
- flex-wrap: wrap;
124
+ display: flex;
125
+ align-items: center;
126
+ flex-wrap: wrap;
124
127
  }
125
128
 
126
129
  .upload_image {
127
- width: 100%;
128
- height: 196rpx;
129
- vertical-align: top;
130
+ width: 100%;
131
+ height: 196rpx;
132
+ vertical-align: top;
130
133
  }
131
134
 
132
135
  .upload-box {
133
- border: 2rpx dashed #dddddd;
134
- font-size: 24rpx;
135
- display: flex;
136
- flex-direction: column;
137
- height: 192rpx;
138
- justify-content: center;
139
- align-items: center;
140
- flex: 0 0 calc((100% - 42rpx)/3);
136
+ border: 2rpx dashed #dddddd;
137
+ font-size: 24rpx;
138
+ display: flex;
139
+ flex-direction: column;
140
+ height: 192rpx;
141
+ justify-content: center;
142
+ align-items: center;
143
+ flex: 0 0 calc((100% - 42rpx)/3);
141
144
 
142
- .upload-icon {
143
- width: 60rpx;
144
- margin-bottom: 10rpx;
145
- }
145
+ .upload-icon {
146
+ width: 60rpx;
147
+ margin-bottom: 10rpx;
148
+ }
146
149
  }
147
150
 
148
151
  .image_box {
149
- position: relative;
150
- height: 196rpx;
151
- flex: 0 0 calc((100% - 42rpx)/3);
152
- margin: 0 20rpx 20rpx 0;
152
+ position: relative;
153
+ height: 196rpx;
154
+ flex: 0 0 calc((100% - 42rpx)/3);
155
+ margin: 0 20rpx 20rpx 0;
153
156
  }
154
157
 
155
158
  .image_box:nth-child(3n) {
156
- margin-right: 0;
159
+ margin-right: 0;
157
160
  }
158
161
 
159
162
  .del_image {
160
- width: 36rpx;
161
- position: absolute;
162
- right: -10rpx;
163
- top: -10rpx;
163
+ width: 36rpx;
164
+ position: absolute;
165
+ right: -10rpx;
166
+ top: -10rpx;
164
167
  }
165
168
  </style>
166
169
 
167
170
  <script type="application/json">
168
171
  {
169
- "component": true,
170
- "usingComponents": {}
172
+ "component": true,
173
+ "usingComponents": {}
171
174
  }
172
- </script>
175
+ </script>
@@ -1,67 +1,67 @@
1
- <template>
2
- <view class="cms_box" wx:for="{{ contents }}" wx:key="*this">
3
- <view class="cms_title">{{ title }}</view>
4
- <rich-text nodes="{{ item.infoContent }}"></rich-text>
5
- </view>
6
- </template>
7
-
8
- <script>
9
- import { createComponent, ref, toRefs, watch } from '@mpxjs/core'
10
- import { cmsApi } from '../../api/cms/index'
11
-
12
- createComponent({
13
- properties: {
14
- // 站点ID
15
- siteId: {
16
- type: String,
17
- value: ""
18
- },
19
- // 租户
20
- tenant: {
21
- type: String,
22
- value: ""
23
- },
24
- // 别名
25
- channelAlias: {
26
- type: String,
27
- value: ""
28
- }
29
- },
30
- setup(props) {
31
- let contents = ref([{ contentId: "123" }]);
32
- let title = ref("");
33
- const { channelAlias } = toRefs(props)
34
- watch(channelAlias, (newVal) => {
35
- cmsApi.findCmsContentInfo({ siteId: props.siteId, channelAlias: newVal, tenant: props.tenant }).then(({ data }) => {
36
- console.log(data)
37
- title.value = data.cmsInfo.infoTitle;
38
- contents.value = data.infoContentResults;
39
- console.log(contents)
40
- })
41
- })
42
- return {
43
- title,
44
- contents
45
- };
46
- },
47
- })
48
- </script>
49
-
50
- <style lang="scss">
51
- .cms_box {
52
- padding: 15px 3%;
53
- font-size: 28rpx;
54
- line-height: 25px;
55
- }
56
-
57
- .cms_title {
58
- text-align: center;
59
- }
60
- </style>
61
-
62
- <script type="application/json">
63
- {
64
- "component": true,
65
- "usingComponents": {}
66
- }
1
+ <template>
2
+ <view class="cms_box" wx:for="{{ contents }}" wx:key="*this">
3
+ <view class="cms_title">{{ title }}</view>
4
+ <rich-text nodes="{{ item.infoContent }}"></rich-text>
5
+ </view>
6
+ </template>
7
+
8
+ <script>
9
+ import { createComponent, ref, toRefs, watch } from '@mpxjs/core'
10
+ import { cmsApi } from '../../api/cms/index'
11
+
12
+ createComponent({
13
+ properties: {
14
+ // 站点ID
15
+ siteId: {
16
+ type: String,
17
+ value: ""
18
+ },
19
+ // 租户
20
+ tenant: {
21
+ type: String,
22
+ value: ""
23
+ },
24
+ // 别名
25
+ channelAlias: {
26
+ type: String,
27
+ value: ""
28
+ }
29
+ },
30
+ setup(props) {
31
+ let contents = ref([{ contentId: "123" }]);
32
+ let title = ref("");
33
+ const { channelAlias } = toRefs(props)
34
+ watch(channelAlias, (newVal) => {
35
+ cmsApi.findCmsContentInfo({ siteId: props.siteId, channelAlias: newVal, tenant: props.tenant }).then(({ data }) => {
36
+ console.log(data)
37
+ title.value = data.cmsInfo.infoTitle;
38
+ contents.value = data.infoContentResults;
39
+ console.log(contents)
40
+ })
41
+ })
42
+ return {
43
+ title,
44
+ contents
45
+ };
46
+ },
47
+ })
48
+ </script>
49
+
50
+ <style lang="scss">
51
+ .cms_box {
52
+ padding: 15px 3%;
53
+ font-size: 28rpx;
54
+ line-height: 25px;
55
+ }
56
+
57
+ .cms_title {
58
+ text-align: center;
59
+ }
60
+ </style>
61
+
62
+ <script type="application/json">
63
+ {
64
+ "component": true,
65
+ "usingComponents": {}
66
+ }
67
67
  </script>