jmash-core-mp 0.1.21 → 0.1.23

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 (31) hide show
  1. package/lib/api/cms/types.d.ts +4 -3
  2. package/lib/components/cms/cms-channel-list.mpx.d.ts +1 -0
  3. package/lib/components/cms/jmash-cms-activity-page.mpx.d.ts +1 -0
  4. package/lib/components/cms/jmash-cms-article-list.mpx.d.ts +1 -0
  5. package/lib/components/cms/jmash-cms-location-page.mpx.d.ts +1 -0
  6. package/lib/components/cms/jmash-cms-location.mpx.d.ts +1 -0
  7. package/lib/components/common/jmash-none-data.mpx.d.ts +1 -0
  8. package/lib/components/common/jmash-search.mpx.d.ts +1 -0
  9. package/lib/index.d.ts +2 -0
  10. package/lib/index.js +4 -0
  11. package/lib/packages/pages/cms/cms-activity-list.mpx.d.ts +1 -0
  12. package/lib/packages/pages/cms/cms-info.mpx.d.ts +1 -0
  13. package/lib/packages/pages/cms/cms-list.mpx.d.ts +1 -0
  14. package/lib/packages/pages/cms/cms-location-list.mpx.d.ts +1 -0
  15. package/package.json +3 -2
  16. package/src/api/cms/types.ts +7 -1
  17. package/src/components/cms/jmash-cms-activity-page.mpx +360 -0
  18. package/src/components/cms/jmash-cms-article.mpx +174 -11
  19. package/src/components/cms/jmash-cms-location-page.mpx +275 -0
  20. package/src/components/cms/jmash-cms-location.mpx +257 -0
  21. package/src/components/common/jmash-upload-picture.mpx +129 -126
  22. package/src/index.ts +5 -0
  23. package/src/packages/index.mpx +3 -1
  24. package/src/packages/pages/cms/cms-activity-list.mpx +95 -0
  25. package/src/packages/pages/cms/cms-location-list.mpx +95 -0
  26. package/src/packages/pages/cms/cms-location.mpx +33 -0
  27. package/src/pages/home.mpx +0 -2
  28. package/src/pages/home2.mpx +0 -2
  29. package/src/pages/tabbar/home.mpx +45 -34
  30. package/src/components/cms/jmash-cms-acticle-list.mpx +0 -183
  31. package/src/packages/pages/cms/cms-article-list.mpx +0 -165
@@ -101,11 +101,14 @@ export interface CmsInfoModel {
101
101
  top?: number;
102
102
  status?: string;
103
103
  publishDate?: string;
104
+ publishDateStr?: string;
104
105
  dueTime?: string;
105
106
  channelId: Array<string>;
106
107
  sourceName?: string;
107
108
  siteId: string;
108
109
  address?: string;
110
+ geoLongitude?: number;
111
+ geoLatitude?: number;
109
112
  }
110
113
  export interface CmsInfoContentReq {
111
114
  tenant?: string;
@@ -119,9 +122,7 @@ export interface CmsInfoContentModel {
119
122
  infoContent?: string;
120
123
  infoType?: string;
121
124
  orderBy?: number;
122
- infoContentList?: {
123
- path: string;
124
- }[];
125
+ infoContentList?: Array<string>;
125
126
  }
126
127
  export interface CmsInfoContentList {
127
128
  results: Array<CmsInfoContentModel>;
@@ -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 {};
package/lib/index.d.ts CHANGED
@@ -19,3 +19,5 @@ export { regionApi } from "./api/region";
19
19
  export { storageApi } from "./api/storage";
20
20
  export { net } from "./utils/net";
21
21
  export { getHeight, formatDateTime, validateRules, validateRequired, } from "./utils/common";
22
+ import * as dayjs from "dayjs";
23
+ export { dayjs };
package/lib/index.js CHANGED
@@ -12,3 +12,7 @@ export { regionApi } from "./api/region";
12
12
  export { storageApi } from "./api/storage";
13
13
  export { net } from "./utils/net";
14
14
  export { getHeight, formatDateTime, validateRules, validateRequired, } from "./utils/common";
15
+ import * as dayjsLocaleZhCn from "dayjs/locale/zh-cn";
16
+ import * as dayjs from "dayjs";
17
+ dayjs.locale(dayjsLocaleZhCn);
18
+ export { dayjs };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "jmash-core-mp",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "private": false,
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "dependencies": {
8
- "sm-crypto": "^0.4.0",
9
8
  "@mpxjs/api-proxy": "^2.10.19",
10
9
  "@mpxjs/core": "^2.10.19",
11
10
  "@mpxjs/fetch": "^2.10.19",
@@ -13,7 +12,9 @@
13
12
  "@mpxjs/pinia": "^2.10.18",
14
13
  "@mpxjs/store": "^2.10.18",
15
14
  "@mpxjs/utils": "^2.10.18",
15
+ "dayjs": "^1.11.21",
16
16
  "pinia": "^2.0.14",
17
+ "sm-crypto": "^0.4.0",
17
18
  "vue": "^2.7.0",
18
19
  "vue-demi": "^0.14.6",
19
20
  "vue-i18n": "^8.27.2",
@@ -200,6 +200,8 @@ export interface CmsInfoModel {
200
200
  status?: string;
201
201
  // 发布时间
202
202
  publishDate?: string;
203
+ // 发布时间字符串
204
+ publishDateStr?: string;
203
205
  // 到期时间
204
206
  dueTime?: string;
205
207
  // 栏目ID
@@ -210,6 +212,10 @@ export interface CmsInfoModel {
210
212
  siteId: string;
211
213
  // 地址
212
214
  address?: string;
215
+ // 经度
216
+ geoLongitude?: number;
217
+ // 纬度
218
+ geoLatitude?: number;
213
219
  }
214
220
  // 信息内容查询
215
221
  export interface CmsInfoContentReq {
@@ -235,7 +241,7 @@ export interface CmsInfoContentModel {
235
241
  // 排序
236
242
  orderBy?: number;
237
243
  // 信息内容数组
238
- infoContentList?: { path: string }[];
244
+ infoContentList?: Array<string>;
239
245
  }
240
246
  // 信息内容列表
241
247
  export interface CmsInfoContentList {
@@ -0,0 +1,360 @@
1
+ <template>
2
+ <scroll-view class="article-main" type="custom" scroll-y scroll-top="{{ scrollTop }}" bindscrolltolower="loadMore">
3
+ <block wx:for="{{ articleList }}" wx:key="index" wx:if="{{ style == '1' }}">
4
+ <view class="article-border" bind:tap="handleInfo" data-item="{{ item }}">
5
+ <view class="activity-card">
6
+ <view class="activity-accent"></view>
7
+ <view class="activity-body">
8
+ <view class="activity-title">{{ item.infoTitle }}</view>
9
+ <view class="activity-address">
10
+ <text class="meta-dot address-dot"></text>
11
+ <text class="meta-text">{{ item.address }}</text>
12
+ </view>
13
+ <view class="activity-time">
14
+ <text class="meta-dot time-dot"></text>
15
+ <text class="meta-text">{{ item.publishDateStr }}</text>
16
+ </view>
17
+ </view>
18
+ <view class="activity-arrow">›</view>
19
+ </view>
20
+ </view>
21
+ </block>
22
+ <view wx:if="{{ loading }}" class="load-tip">加载中...</view>
23
+ <view wx:elif="{{ !hasMore && articleList.length > 0 }}" class="load-tip">没有更多了</view>
24
+ </scroll-view>
25
+ </template>
26
+
27
+ <script lang="ts">
28
+ import mpx, { createComponent, ref, watch } from "@mpxjs/core";
29
+ import { EventBase } from "../../api/types";
30
+ import * as dayjs from 'dayjs';
31
+ import { cmsApi } from '../../api/cms';
32
+ import { CmsInfoModel } from '../../api/cms/types';
33
+
34
+ createComponent({
35
+ properties: {
36
+ // 样式
37
+ style: {
38
+ type: String,
39
+ value: "0",
40
+ },
41
+ // 组织租户
42
+ organTenant: {
43
+ type: String,
44
+ value: ""
45
+ },
46
+ // 站点ID
47
+ siteId: {
48
+ type: String,
49
+ value: ""
50
+ },
51
+ // 栏目ID
52
+ channelId: {
53
+ type: String,
54
+ value: ""
55
+ },
56
+ // 栏目别名
57
+ channelAlias: {
58
+ type: String,
59
+ value: ""
60
+ },
61
+ // 数量
62
+ pageSize: {
63
+ type: Number,
64
+ value: 5
65
+ },
66
+ // 搜索标题
67
+ likeInfoTitle: {
68
+ type: String,
69
+ value: ""
70
+ },
71
+ //refreshKey
72
+ refreshKey: {
73
+ type: Number,
74
+ value: 0
75
+ },
76
+ },
77
+ setup(props) {
78
+ let config = getApp().globalData.config;
79
+ const curPage = ref(1)
80
+ const hasMore = ref(true)
81
+ const loading = ref(false)
82
+ const scrollTop = ref(0)
83
+ // 资源路径
84
+ let resourceUrl = config.resourceUrl + '/images';
85
+ // 文章列表
86
+ let articleList = ref([] as CmsInfoModel[]);
87
+ console.log("cms", props);
88
+
89
+ const loadRecords = function (page: number = 1) {
90
+ if (loading.value) return
91
+ loading.value = true;
92
+ cmsApi.findCmsInfoPage({
93
+ tenant: props.organTenant || config.tenant,
94
+ siteId: props.siteId,
95
+ channelId: props.channelId,
96
+ channelAlias: props.channelAlias,
97
+ curPage: curPage.value,
98
+ pageSize: props.pageSize,
99
+ likeInfoTitle: props.likeInfoTitle,
100
+ }).then(res => {
101
+ if (res.statusCode === 200) {
102
+ // 格式化时间
103
+ res.data.results.forEach(item => {
104
+ item.publishDateStr = dayjs(item.publishDate).format("YYYY年MM月DD日 dddd");
105
+ })
106
+ if (curPage.value === 1) {
107
+ scrollTop.value = 0
108
+ articleList.value = res.data.results || []
109
+ } else {
110
+ articleList.value = [...articleList.value, ...(res.data.results || [])];
111
+ }
112
+ }
113
+ }).finally(() => {
114
+ loading.value = false
115
+ });
116
+ }
117
+ // 接口图片资源路径 容器宽高度150rpx 裁剪2倍
118
+ let imageUrl = config.baseUrl + "/v1/file/image/clip/300/300/";
119
+ const loadMore = () => {
120
+ if (!hasMore.value || loading.value) return
121
+ loadRecords(curPage.value + 1)
122
+ }
123
+ loadRecords(1);
124
+ watch(
125
+ () => props.refreshKey,
126
+ () => {
127
+ loadRecords(1)
128
+ }
129
+ )
130
+ return { resourceUrl, articleList, imageUrl, curPage, hasMore, loading, scrollTop, loadMore }
131
+ },
132
+ methods: {
133
+ // 点击详情事件
134
+ handleInfo(e: EventBase) {
135
+ let config = getApp().globalData.config;
136
+ let item = e.currentTarget.dataset.item;
137
+ mpx.navigateTo({
138
+ url: '/jmash/pages/cms/cms-article?siteId=' + this.siteId + '&infoId=' + item.infoId,
139
+ });
140
+ // 浏览
141
+ this.handelBrowse(this.organTenant || config.tenant, item.infoId);
142
+ this.triggerEvent("info", item);
143
+ },
144
+ // 浏览
145
+ handelBrowse(tenant: string, infoId: string) {
146
+ const tempData = {
147
+ // 用于检测重复请求的唯一字符串ID
148
+ requestId: Math.random() * 10 + "",
149
+ // 类型
150
+ type: "information",
151
+ // 关系
152
+ relationId: infoId,
153
+ // 租户
154
+ tenant: tenant
155
+ };
156
+ cmsApi.createfrontBrowseRecord(tempData);
157
+ },
158
+ }
159
+ })
160
+ </script>
161
+
162
+ <style lang="scss">
163
+ @use "../../styles/index.scss" as *;
164
+
165
+ .article-main {
166
+ padding: 0 30rpx;
167
+ border-radius: 20rpx;
168
+ background-color: #fff;
169
+ }
170
+
171
+ // 有分割线列表
172
+ .article-border {
173
+ padding: 24rpx 0;
174
+ border-bottom: 1rpx solid $border-line;
175
+
176
+ &:last-child {
177
+ border: none;
178
+ }
179
+ }
180
+
181
+ // 无分割线列表
182
+ .article-info {
183
+ position: relative;
184
+ padding: 24rpx;
185
+ background-color: #fff;
186
+ border-radius: 16rpx;
187
+ margin-bottom: 20rpx;
188
+ box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
189
+ }
190
+
191
+ .cms-info {
192
+ display: flex;
193
+ align-items: center;
194
+ gap: 24rpx;
195
+
196
+ .cms-text {
197
+ flex: 1;
198
+ min-width: 0;
199
+ display: flex;
200
+ flex-direction: column;
201
+ gap: 12rpx;
202
+
203
+ .cms-text-title {
204
+ color: #222;
205
+ font-size: 30rpx;
206
+ font-weight: 600;
207
+ line-height: 1.4;
208
+ overflow: hidden;
209
+ white-space: nowrap;
210
+ text-overflow: ellipsis;
211
+ }
212
+
213
+ .cms-text-desc {
214
+ color: #888;
215
+ font-size: 24rpx;
216
+ line-height: 1.5;
217
+ overflow: hidden;
218
+ display: -webkit-box;
219
+ -webkit-box-orient: vertical;
220
+ -webkit-line-clamp: 2;
221
+ text-overflow: ellipsis;
222
+ }
223
+
224
+ .cms-text-meta {
225
+ display: flex;
226
+ align-items: center;
227
+ gap: 6rpx;
228
+
229
+ .cms-meta-icon {
230
+ font-size: 22rpx;
231
+ }
232
+
233
+ .cms-meta-text {
234
+ color: #aaa;
235
+ font-size: 22rpx;
236
+ overflow: hidden;
237
+ white-space: nowrap;
238
+ text-overflow: ellipsis;
239
+ }
240
+ }
241
+ }
242
+
243
+ .cms-image {
244
+ flex-shrink: 0;
245
+ width: 180rpx;
246
+ height: 180rpx;
247
+ border-radius: 12rpx;
248
+ overflow: hidden;
249
+ background: #f0f0f0;
250
+
251
+ .cms-image-thumb {
252
+ width: 100%;
253
+ height: 100%;
254
+ }
255
+ }
256
+ }
257
+
258
+ // 活动列表卡片
259
+ .activity-card {
260
+ display: flex;
261
+ align-items: center;
262
+ gap: 20rpx;
263
+
264
+ .activity-accent {
265
+ flex-shrink: 0;
266
+ width: 6rpx;
267
+ height: 80rpx;
268
+ background: linear-gradient(180deg, #409eff, #67c23a);
269
+ border-radius: 3rpx;
270
+ }
271
+
272
+ .activity-body {
273
+ flex: 1;
274
+ min-width: 0;
275
+ display: flex;
276
+ flex-direction: column;
277
+ gap: 14rpx;
278
+
279
+ .activity-title {
280
+ font-size: 32rpx;
281
+ font-weight: 700;
282
+ color: #1a1a1a;
283
+ line-height: 1.4;
284
+ overflow: hidden;
285
+ white-space: nowrap;
286
+ text-overflow: ellipsis;
287
+ }
288
+
289
+ .activity-address,
290
+ .activity-time {
291
+ display: inline-flex;
292
+ align-items: center;
293
+ gap: 8rpx;
294
+ padding: 8rpx 16rpx;
295
+ border-radius: 6rpx;
296
+ width: fit-content;
297
+
298
+ .meta-dot {
299
+ width: 10rpx;
300
+ height: 10rpx;
301
+ border-radius: 50%;
302
+ flex-shrink: 0;
303
+ }
304
+
305
+ .address-dot {
306
+ background: #e6a23c;
307
+ }
308
+
309
+ .time-dot {
310
+ background: #67c23a;
311
+ }
312
+
313
+ .meta-text {
314
+ font-size: 24rpx;
315
+ color: #555;
316
+ font-weight: 500;
317
+ overflow: hidden;
318
+ white-space: nowrap;
319
+ text-overflow: ellipsis;
320
+ }
321
+ }
322
+
323
+ .activity-address {
324
+ background: #fdf6ec;
325
+ }
326
+
327
+ .activity-time {
328
+ background: #f0f9eb;
329
+ }
330
+ }
331
+
332
+ .activity-arrow {
333
+ flex-shrink: 0;
334
+ font-size: 32rpx;
335
+ color: #bbb;
336
+ font-weight: 300;
337
+ width: 36rpx;
338
+ text-align: center;
339
+ }
340
+ }
341
+
342
+ .article-info .cms-arrow {
343
+ display: block;
344
+ position: absolute;
345
+ right: 24rpx;
346
+ top: 50%;
347
+ transform: translateY(-50%);
348
+ font-size: 36rpx;
349
+ color: #ccc;
350
+ }
351
+ </style>
352
+
353
+ <script type="application/json">
354
+ {
355
+ "component": true,
356
+ "usingComponents": {
357
+ "jmash-cms-like": "./jmash-cms-like"
358
+ }
359
+ }
360
+ </script>