jmash-core-mp 0.1.76 → 0.1.78
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.
- package/.editorconfig +9 -9
- package/.gitignore +8 -0
- package/.npmignore +44 -0
- package/README.md +60 -60
- package/babel.config.json +34 -34
- package/eslint.config.mjs +7 -7
- package/lib/api/auth/index.d.ts +22 -22
- package/lib/api/auth/index.js +211 -211
- package/lib/api/auth/types.d.ts +90 -90
- package/lib/api/auth/types.js +9 -9
- package/lib/api/cms/index.d.ts +20 -20
- package/lib/api/cms/index.js +161 -161
- package/lib/api/cms/types.d.ts +201 -201
- package/lib/api/cms/types.js +1 -1
- package/lib/api/constant.d.ts +6 -6
- package/lib/api/constant.js +8 -8
- package/lib/api/dict/index.d.ts +24 -24
- package/lib/api/dict/index.js +51 -51
- package/lib/api/dict/types.d.ts +40 -40
- package/lib/api/dict/types.js +1 -1
- package/lib/api/dicts.d.ts +32 -32
- package/lib/api/dicts.js +118 -118
- package/lib/api/files/index.d.ts +25 -25
- package/lib/api/files/index.js +134 -134
- package/lib/api/files/types.d.ts +38 -38
- package/lib/api/files/types.js +1 -1
- package/lib/api/index.d.ts +5 -5
- package/lib/api/index.js +8 -8
- package/lib/api/myorgan/index.d.ts +8 -8
- package/lib/api/myorgan/index.js +24 -24
- package/lib/api/myorgan/types.d.ts +22 -22
- package/lib/api/myorgan/types.js +1 -1
- package/lib/api/region/index.d.ts +7 -7
- package/lib/api/region/index.js +20 -20
- package/lib/api/region/types.d.ts +19 -19
- package/lib/api/region/types.js +1 -1
- package/lib/api/shop/index.d.ts +11 -11
- package/lib/api/shop/index.js +53 -53
- package/lib/api/shop/types.d.ts +123 -123
- package/lib/api/shop/types.js +1 -1
- package/lib/api/storage/index.d.ts +11 -11
- package/lib/api/storage/index.js +53 -53
- package/lib/api/storage/types.d.ts +39 -39
- package/lib/api/storage/types.js +1 -1
- package/lib/api/types.d.ts +43 -43
- package/lib/api/types.js +1 -1
- package/lib/components/organ/browser-organ-list.mpx.d.ts +1 -1
- package/lib/components/organ/my-organ-list.mpx.d.ts +1 -1
- package/lib/components/{auth-user/jmash-update-user.mpx.d.ts → organ/organ-search.mpx.d.ts} +1 -1
- package/lib/components/{auth-user/jmash-user.mpx.d.ts → shop/branch-search.mpx.d.ts} +1 -1
- package/lib/components/{core/jmash-login.mpx.d.ts → shop/shop-search.mpx.d.ts} +1 -1
- package/lib/index.d.ts +28 -28
- package/lib/index.js +23 -23
- package/lib/{packages/pages/auth/setting-page.mpx.d.ts → pages/branch-search.mpx.d.ts} +1 -1
- package/lib/pages/organ-search.mpx.d.ts +1 -0
- package/lib/pages/organ.mpx.d.ts +1 -1
- package/lib/pages/shop-search.mpx.d.ts +1 -0
- package/lib/store/organ.d.ts +19 -19
- package/lib/store/organ.js +83 -83
- package/lib/store/shop.d.ts +18 -18
- package/lib/store/shop.js +104 -104
- package/lib/store/user.d.ts +35 -35
- package/lib/store/user.js +243 -243
- package/lib/utils/common.d.ts +37 -35
- package/lib/utils/common.js +178 -165
- package/lib/utils/config.d.ts +5 -5
- package/lib/utils/config.js +36 -36
- package/lib/utils/db.d.ts +52 -52
- package/lib/utils/db.js +202 -202
- package/lib/utils/grpc.d.ts +5 -5
- package/lib/utils/grpc.js +20 -20
- package/lib/utils/net.d.ts +7 -7
- package/lib/utils/net.js +15 -15
- package/lib/utils/request.d.ts +2 -2
- package/lib/utils/request.js +114 -114
- package/lib/utils/share.d.ts +16 -16
- package/lib/utils/share.js +196 -196
- package/mpx.config.js +38 -38
- package/package.json +1 -1
- package/pnpm-workspace.yaml +5 -0
- package/postcss.config.js +11 -11
- package/project.config.json +24 -24
- package/project.private.config.json +13 -13
- package/public/index.html +15 -15
- package/src/api/auth/index.ts +241 -241
- package/src/api/auth/types.ts +173 -173
- package/src/api/cms/index.ts +218 -218
- package/src/api/cms/types.ts +385 -385
- package/src/api/constant.ts +8 -8
- package/src/api/dict/index.ts +68 -68
- package/src/api/dict/types.ts +73 -73
- package/src/api/dicts.ts +132 -132
- package/src/api/files/index.ts +162 -162
- package/src/api/files/types.ts +67 -67
- package/src/api/index.ts +15 -15
- package/src/api/myorgan/index.ts +29 -29
- package/src/api/myorgan/types.ts +42 -42
- package/src/api/region/index.ts +24 -24
- package/src/api/region/types.ts +36 -36
- package/src/api/shop/index.ts +74 -74
- package/src/api/shop/types.ts +244 -244
- package/src/api/storage/index.ts +74 -74
- package/src/api/storage/types.ts +74 -74
- package/src/api/types.ts +74 -74
- package/src/app.mpx +78 -78
- package/src/components/auth-user/jmash-logout.mpx +93 -93
- package/src/components/auth-user/jmash-update-user.mpx +387 -387
- package/src/components/auth-user/jmash-update-user.web.mpx +367 -367
- package/src/components/auth-user/jmash-user.mpx +310 -310
- package/src/components/cms/jmash-cms-activity-item.mpx +207 -207
- package/src/components/cms/jmash-cms-activity-list.mpx +357 -357
- package/src/components/cms/jmash-cms-article-item.mpx +221 -221
- package/src/components/cms/jmash-cms-article-list.mpx +248 -248
- package/src/components/cms/jmash-cms-article-view.mpx +131 -131
- package/src/components/cms/jmash-cms-article.mpx +231 -231
- package/src/components/cms/jmash-cms-like.mpx +151 -151
- package/src/components/cms/jmash-cms-location-list.mpx +286 -286
- package/src/components/cms/jmash-cms-location.mpx +256 -256
- package/src/components/cms/jmash-cms-product-item.mpx +185 -185
- package/src/components/cms/jmash-cms-product-list.mpx +230 -230
- package/src/components/common/jmash-avatar-edit.mpx +154 -154
- package/src/components/common/jmash-cascader-region.mpx +118 -118
- package/src/components/common/jmash-cell-group.mpx +206 -206
- package/src/components/common/jmash-code-interest-popup.mpx +223 -223
- package/src/components/common/jmash-form-cell.mpx +491 -525
- package/src/components/common/jmash-menu.mpx +129 -129
- package/src/components/common/jmash-none-data.mpx +95 -95
- package/src/components/common/jmash-pic-swiper.mpx +72 -72
- package/src/components/common/jmash-popup.mpx +138 -138
- package/src/components/common/jmash-search.mpx +130 -130
- package/src/components/common/jmash-single-btn.mpx +53 -53
- package/src/components/common/jmash-stepper.mpx +236 -236
- package/src/components/common/jmash-swipe-cell.mpx +153 -153
- package/src/components/common/jmash-tab-bar.mpx +58 -58
- package/src/components/common/jmash-textarea.mpx +88 -88
- package/src/components/common/jmash-top-navigation.mpx +203 -203
- package/src/components/common/jmash-upload-picture.mpx +199 -199
- package/src/components/core/jmash-cms-protocol.mpx +72 -72
- package/src/components/core/jmash-login.ali.mpx +284 -284
- package/src/components/core/jmash-login.mpx +378 -378
- package/src/components/core/jmash-login.web.mpx +420 -420
- package/src/components/core/jmash-popup-login.ali.mpx +312 -312
- package/src/components/core/jmash-popup-login.mpx +414 -416
- package/src/components/core/jmash-popup-login.web.mpx +389 -389
- package/src/components/organ/browser-organ-list.mpx +66 -66
- package/src/components/organ/my-organ-list.mpx +67 -67
- package/src/components/organ/organ-item.mpx +124 -124
- package/src/components/organ/organ-search.mpx +148 -148
- package/src/components/organ/organ-selected-item.mpx +88 -88
- package/src/components/shop/branch-item.mpx +111 -111
- package/src/components/shop/branch-search.mpx +142 -142
- package/src/components/shop/shop-item.mpx +112 -112
- package/src/components/shop/shop-search.mpx +142 -142
- package/src/components/shop/shop-selected-item.mpx +89 -89
- package/src/custom-tab-bar/index.mpx +10 -10
- package/src/global.d.ts +11 -11
- package/src/index.ts +94 -94
- package/src/packages/index.mpx +16 -16
- package/src/packages/pages/auth/cms-protocol.mpx +35 -35
- package/src/packages/pages/auth/login.mpx +62 -62
- package/src/packages/pages/auth/setting-page.mpx +134 -134
- package/src/packages/pages/auth/update-user.mpx +17 -17
- package/src/packages/pages/cms/cms-activity-list.mpx +86 -86
- package/src/packages/pages/cms/cms-article-list.mpx +88 -88
- package/src/packages/pages/cms/cms-article.mpx +32 -32
- package/src/packages/pages/cms/cms-location-list.mpx +83 -83
- package/src/packages/pages/cms/cms-location.mpx +32 -32
- package/src/packages/pages/cms/cms-product-list.mpx +88 -88
- package/src/packages/pages/share/scan.mpx +103 -103
- package/src/pages/basic-component.mpx +30 -30
- package/src/pages/branch-search.mpx +60 -60
- package/src/pages/half-home.mpx +58 -58
- package/src/pages/home.mpx +54 -54
- package/src/pages/home2.mpx +45 -45
- package/src/pages/index.mpx +43 -43
- package/src/pages/organ-search.mpx +60 -60
- package/src/pages/organ.mpx +105 -105
- package/src/pages/shop-search.mpx +60 -60
- package/src/pages/tabbar/home.mpx +114 -114
- package/src/pages/tabbar/mall.mpx +87 -87
- package/src/pages/tabbar/my.mpx +79 -79
- package/src/pages/tabbar/organ.mpx +86 -86
- package/src/store/organ.ts +100 -100
- package/src/store/shop.ts +130 -130
- package/src/store/user.ts +288 -288
- package/src/styles/index.scss +20 -20
- package/src/styles/vars.scss +27 -27
- package/src/utils/common.ts +196 -178
- package/src/utils/config.ts +43 -43
- package/src/utils/db.ts +229 -229
- package/src/utils/grpc.ts +21 -21
- package/src/utils/net.ts +18 -18
- package/src/utils/request.ts +126 -126
- package/src/utils/share.ts +194 -194
- package/static/ali/mini.project.json +4 -4
- package/static/dd/project.config.json +15 -15
- package/static/swan/project.swan.json +14 -14
- package/static/tt/project.config.json +11 -11
- package/static/wx/project.config.json +40 -40
- package/uno.config.js +9 -9
- package/lib/packages/pages/share/scan.mpx.d.ts +0 -1
|
@@ -1,287 +1,287 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<scroll-view class="article-main" type="custom" scroll-y scroll-top="{{ scrollTop }}" bindscrolltolower="loadMore">
|
|
3
|
-
<view class="article-list" wx:if="{{ styles == '1' }}">
|
|
4
|
-
<view class="article-border" wx:for="{{ articleList }}" wx:key="index" bind:tap="handleInfo"
|
|
5
|
-
data-item="{{ item }}">
|
|
6
|
-
<view class="cms-info">
|
|
7
|
-
<view class="cms-image" catch:tap="handlePreview" data-url="{{ item.imgUrl }}">
|
|
8
|
-
<image wx:if="{{ imageUrl }}" class="cms-image-thumb" src="{{ imageUrl + item.imgUrl }}"
|
|
9
|
-
mode="aspectFill" />
|
|
10
|
-
</view>
|
|
11
|
-
<view class="cms-text">
|
|
12
|
-
<view class="cms-text-title">{{ item.infoTitle }}</view>
|
|
13
|
-
<view class="cms-text-desc">{{ item.intro }}</view>
|
|
14
|
-
<view class="cms-text-meta">
|
|
15
|
-
<text class="cms-meta-icon">📍</text>
|
|
16
|
-
<text class="cms-meta-text">{{ item.address }}</text>
|
|
17
|
-
</view>
|
|
18
|
-
</view>
|
|
19
|
-
</view>
|
|
20
|
-
</view>
|
|
21
|
-
</view>
|
|
22
|
-
<view wx:if="{{ loading }}">加载中...</view>
|
|
23
|
-
</scroll-view>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script lang="ts">
|
|
27
|
-
import mpx, { createComponent, ref, watch } from "@mpxjs/core";
|
|
28
|
-
import { EventBase } from "../../api/types";
|
|
29
|
-
import { cmsApi } from '../../api/cms';
|
|
30
|
-
import { CmsInfoModel } from '../../api/cms/types';
|
|
31
|
-
|
|
32
|
-
createComponent({
|
|
33
|
-
properties: {
|
|
34
|
-
// 样式
|
|
35
|
-
styles: {
|
|
36
|
-
type: String,
|
|
37
|
-
value: "0",
|
|
38
|
-
},
|
|
39
|
-
// 组织租户
|
|
40
|
-
organTenant: {
|
|
41
|
-
type: String,
|
|
42
|
-
value: ""
|
|
43
|
-
},
|
|
44
|
-
// 站点ID
|
|
45
|
-
siteId: {
|
|
46
|
-
type: String,
|
|
47
|
-
value: ""
|
|
48
|
-
},
|
|
49
|
-
// 栏目ID
|
|
50
|
-
channelId: {
|
|
51
|
-
type: String,
|
|
52
|
-
value: ""
|
|
53
|
-
},
|
|
54
|
-
// 栏目别名
|
|
55
|
-
channelAlias: {
|
|
56
|
-
type: String,
|
|
57
|
-
value: ""
|
|
58
|
-
},
|
|
59
|
-
// 数量
|
|
60
|
-
pageSize: {
|
|
61
|
-
type: Number,
|
|
62
|
-
value: 5
|
|
63
|
-
},
|
|
64
|
-
// 搜索标题
|
|
65
|
-
likeInfoTitle: {
|
|
66
|
-
type: String,
|
|
67
|
-
value: ""
|
|
68
|
-
},
|
|
69
|
-
// refreshKey
|
|
70
|
-
refreshKey: {
|
|
71
|
-
type: Number,
|
|
72
|
-
value: 0
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
setup(props) {
|
|
76
|
-
let config = getApp().globalData.config;
|
|
77
|
-
const curPage = ref(1)
|
|
78
|
-
const totalSize = ref(0)
|
|
79
|
-
const loading = ref(false)
|
|
80
|
-
const scrollTop = ref(0)
|
|
81
|
-
// 资源路径
|
|
82
|
-
let resourceUrl = config.resourceUrl + '/images';
|
|
83
|
-
// 文章列表
|
|
84
|
-
let articleList = ref([] as CmsInfoModel[]);
|
|
85
|
-
console.log("cms", props);
|
|
86
|
-
|
|
87
|
-
const loadRecords = function (page: number = 1) {
|
|
88
|
-
if (!props.channelAlias && !props.channelId) return
|
|
89
|
-
if (loading.value) return
|
|
90
|
-
loading.value = true;
|
|
91
|
-
curPage.value = page;
|
|
92
|
-
cmsApi.findCmsInfoPage({
|
|
93
|
-
tenant: props.organTenant || config.siteTenant,
|
|
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
|
-
status: 'published',
|
|
101
|
-
}).then(res => {
|
|
102
|
-
if (res.statusCode === 200) {
|
|
103
|
-
if (curPage.value === 1) {
|
|
104
|
-
scrollTop.value = 0
|
|
105
|
-
articleList.value = res.data.results || []
|
|
106
|
-
} else {
|
|
107
|
-
articleList.value = [...articleList.value, ...(res.data.results || [])];
|
|
108
|
-
}
|
|
109
|
-
totalSize.value = res.data.totalSize as number;
|
|
110
|
-
}
|
|
111
|
-
}).finally(() => {
|
|
112
|
-
loading.value = false
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
// 接口图片资源路径 容器宽高度150rpx 裁剪2倍
|
|
116
|
-
let imageUrl = config.baseUrl + "/v1/file/image/clip/300/300/";
|
|
117
|
-
const loadMore = () => {
|
|
118
|
-
if (totalSize.value === articleList.value.length || loading.value) {
|
|
119
|
-
mpx.showToast({ title: "没有更多数据了", icon: "none" });
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
loadRecords(curPage.value + 1)
|
|
123
|
-
}
|
|
124
|
-
loadRecords(1);
|
|
125
|
-
watch(
|
|
126
|
-
() => props.refreshKey,
|
|
127
|
-
() => {
|
|
128
|
-
loadRecords(1)
|
|
129
|
-
}
|
|
130
|
-
)
|
|
131
|
-
return { resourceUrl, articleList, imageUrl, curPage, totalSize, loading, scrollTop, loadMore }
|
|
132
|
-
},
|
|
133
|
-
methods: {
|
|
134
|
-
// 点击详情事件
|
|
135
|
-
handleInfo(e: EventBase) {
|
|
136
|
-
let config = getApp().globalData.config;
|
|
137
|
-
let item = e.currentTarget.dataset.item;
|
|
138
|
-
mpx.navigateTo({
|
|
139
|
-
url: '/jmash/pages/cms/cms-location?tenant=' + this.organTenant + '&siteId=' + this.siteId + '&infoId=' + item.infoId,
|
|
140
|
-
});
|
|
141
|
-
// 浏览
|
|
142
|
-
this.handelBrowse(this.organTenant || config.tenant, item.infoId);
|
|
143
|
-
this.triggerEvent("info", item);
|
|
144
|
-
},
|
|
145
|
-
// 浏览
|
|
146
|
-
handelBrowse(tenant: string, infoId: string) {
|
|
147
|
-
const tempData = {
|
|
148
|
-
// 用于检测重复请求的唯一字符串ID
|
|
149
|
-
requestId: Math.random() * 10 + "",
|
|
150
|
-
// 类型
|
|
151
|
-
type: "information",
|
|
152
|
-
// 关系
|
|
153
|
-
relationId: infoId,
|
|
154
|
-
// 租户
|
|
155
|
-
tenant: tenant
|
|
156
|
-
};
|
|
157
|
-
cmsApi.createfrontBrowseRecord(tempData);
|
|
158
|
-
},
|
|
159
|
-
}
|
|
160
|
-
})
|
|
161
|
-
</script>
|
|
162
|
-
|
|
163
|
-
<style lang="scss">
|
|
164
|
-
@use "../../styles/index.scss" as *;
|
|
165
|
-
|
|
166
|
-
.article-main {
|
|
167
|
-
max-height: calc(100vh - 90rpx - env(safe-area-inset-bottom));
|
|
168
|
-
width: 100vw;
|
|
169
|
-
box-sizing: border-box;
|
|
170
|
-
background-color: #fff;
|
|
171
|
-
|
|
172
|
-
.article-list {
|
|
173
|
-
padding: 0 30rpx;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// 有分割线列表
|
|
178
|
-
.article-border {
|
|
179
|
-
padding: 24rpx 0;
|
|
180
|
-
border-bottom: 1rpx solid $border-line;
|
|
181
|
-
|
|
182
|
-
&:last-child {
|
|
183
|
-
border: none;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// 无分割线列表
|
|
188
|
-
.article-info {
|
|
189
|
-
position: relative;
|
|
190
|
-
padding: 24rpx;
|
|
191
|
-
background-color: #fff;
|
|
192
|
-
border-radius: 16rpx;
|
|
193
|
-
margin-bottom: 20rpx;
|
|
194
|
-
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.cms-info {
|
|
198
|
-
display: flex;
|
|
199
|
-
align-items: center;
|
|
200
|
-
gap: 24rpx;
|
|
201
|
-
|
|
202
|
-
.cms-text {
|
|
203
|
-
flex: 1;
|
|
204
|
-
min-width: 0;
|
|
205
|
-
display: flex;
|
|
206
|
-
flex-direction: column;
|
|
207
|
-
gap: 12rpx;
|
|
208
|
-
|
|
209
|
-
.cms-text-title {
|
|
210
|
-
color: #222;
|
|
211
|
-
font-size: 30rpx;
|
|
212
|
-
font-weight: 600;
|
|
213
|
-
line-height: 1.4;
|
|
214
|
-
overflow: hidden;
|
|
215
|
-
white-space: nowrap;
|
|
216
|
-
text-overflow: ellipsis;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.cms-text-desc {
|
|
220
|
-
color: #888;
|
|
221
|
-
font-size: 24rpx;
|
|
222
|
-
line-height: 1.5;
|
|
223
|
-
overflow: hidden;
|
|
224
|
-
display: -webkit-box;
|
|
225
|
-
-webkit-box-orient: vertical;
|
|
226
|
-
-webkit-line-clamp: 2;
|
|
227
|
-
text-overflow: ellipsis;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.cms-text-meta {
|
|
231
|
-
display: flex;
|
|
232
|
-
align-items: center;
|
|
233
|
-
gap: 6rpx;
|
|
234
|
-
|
|
235
|
-
.cms-meta-icon {
|
|
236
|
-
font-size: 22rpx;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.cms-meta-text {
|
|
240
|
-
color: #aaa;
|
|
241
|
-
font-size: 22rpx;
|
|
242
|
-
overflow: hidden;
|
|
243
|
-
white-space: nowrap;
|
|
244
|
-
text-overflow: ellipsis;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
.cms-image {
|
|
250
|
-
flex-shrink: 0;
|
|
251
|
-
width: 180rpx;
|
|
252
|
-
height: 180rpx;
|
|
253
|
-
border-radius: 12rpx;
|
|
254
|
-
overflow: hidden;
|
|
255
|
-
background: #f0f0f0;
|
|
256
|
-
|
|
257
|
-
.cms-image-thumb {
|
|
258
|
-
width: 100%;
|
|
259
|
-
height: 100%;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
.cms-arrow {
|
|
265
|
-
display: none;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// 无分割线列表显示右箭头
|
|
269
|
-
.article-info .cms-arrow {
|
|
270
|
-
display: block;
|
|
271
|
-
position: absolute;
|
|
272
|
-
right: 24rpx;
|
|
273
|
-
top: 50%;
|
|
274
|
-
transform: translateY(-50%);
|
|
275
|
-
font-size: 36rpx;
|
|
276
|
-
color: #ccc;
|
|
277
|
-
}
|
|
278
|
-
</style>
|
|
279
|
-
|
|
280
|
-
<script type="application/json">
|
|
281
|
-
{
|
|
282
|
-
"component": true,
|
|
283
|
-
"usingComponents": {
|
|
284
|
-
"jmash-cms-like": "./jmash-cms-like"
|
|
285
|
-
}
|
|
286
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<scroll-view class="article-main" type="custom" scroll-y scroll-top="{{ scrollTop }}" bindscrolltolower="loadMore">
|
|
3
|
+
<view class="article-list" wx:if="{{ styles == '1' }}">
|
|
4
|
+
<view class="article-border" wx:for="{{ articleList }}" wx:key="index" bind:tap="handleInfo"
|
|
5
|
+
data-item="{{ item }}">
|
|
6
|
+
<view class="cms-info">
|
|
7
|
+
<view class="cms-image" catch:tap="handlePreview" data-url="{{ item.imgUrl }}">
|
|
8
|
+
<image wx:if="{{ imageUrl }}" class="cms-image-thumb" src="{{ imageUrl + item.imgUrl }}"
|
|
9
|
+
mode="aspectFill" />
|
|
10
|
+
</view>
|
|
11
|
+
<view class="cms-text">
|
|
12
|
+
<view class="cms-text-title">{{ item.infoTitle }}</view>
|
|
13
|
+
<view class="cms-text-desc">{{ item.intro }}</view>
|
|
14
|
+
<view class="cms-text-meta">
|
|
15
|
+
<text class="cms-meta-icon">📍</text>
|
|
16
|
+
<text class="cms-meta-text">{{ item.address }}</text>
|
|
17
|
+
</view>
|
|
18
|
+
</view>
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
</view>
|
|
22
|
+
<view wx:if="{{ loading }}">加载中...</view>
|
|
23
|
+
</scroll-view>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script lang="ts">
|
|
27
|
+
import mpx, { createComponent, ref, watch } from "@mpxjs/core";
|
|
28
|
+
import { EventBase } from "../../api/types";
|
|
29
|
+
import { cmsApi } from '../../api/cms';
|
|
30
|
+
import { CmsInfoModel } from '../../api/cms/types';
|
|
31
|
+
|
|
32
|
+
createComponent({
|
|
33
|
+
properties: {
|
|
34
|
+
// 样式
|
|
35
|
+
styles: {
|
|
36
|
+
type: String,
|
|
37
|
+
value: "0",
|
|
38
|
+
},
|
|
39
|
+
// 组织租户
|
|
40
|
+
organTenant: {
|
|
41
|
+
type: String,
|
|
42
|
+
value: ""
|
|
43
|
+
},
|
|
44
|
+
// 站点ID
|
|
45
|
+
siteId: {
|
|
46
|
+
type: String,
|
|
47
|
+
value: ""
|
|
48
|
+
},
|
|
49
|
+
// 栏目ID
|
|
50
|
+
channelId: {
|
|
51
|
+
type: String,
|
|
52
|
+
value: ""
|
|
53
|
+
},
|
|
54
|
+
// 栏目别名
|
|
55
|
+
channelAlias: {
|
|
56
|
+
type: String,
|
|
57
|
+
value: ""
|
|
58
|
+
},
|
|
59
|
+
// 数量
|
|
60
|
+
pageSize: {
|
|
61
|
+
type: Number,
|
|
62
|
+
value: 5
|
|
63
|
+
},
|
|
64
|
+
// 搜索标题
|
|
65
|
+
likeInfoTitle: {
|
|
66
|
+
type: String,
|
|
67
|
+
value: ""
|
|
68
|
+
},
|
|
69
|
+
// refreshKey
|
|
70
|
+
refreshKey: {
|
|
71
|
+
type: Number,
|
|
72
|
+
value: 0
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
setup(props) {
|
|
76
|
+
let config = getApp().globalData.config;
|
|
77
|
+
const curPage = ref(1)
|
|
78
|
+
const totalSize = ref(0)
|
|
79
|
+
const loading = ref(false)
|
|
80
|
+
const scrollTop = ref(0)
|
|
81
|
+
// 资源路径
|
|
82
|
+
let resourceUrl = config.resourceUrl + '/images';
|
|
83
|
+
// 文章列表
|
|
84
|
+
let articleList = ref([] as CmsInfoModel[]);
|
|
85
|
+
console.log("cms", props);
|
|
86
|
+
|
|
87
|
+
const loadRecords = function (page: number = 1) {
|
|
88
|
+
if (!props.channelAlias && !props.channelId) return
|
|
89
|
+
if (loading.value) return
|
|
90
|
+
loading.value = true;
|
|
91
|
+
curPage.value = page;
|
|
92
|
+
cmsApi.findCmsInfoPage({
|
|
93
|
+
tenant: props.organTenant || config.siteTenant,
|
|
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
|
+
status: 'published',
|
|
101
|
+
}).then(res => {
|
|
102
|
+
if (res.statusCode === 200) {
|
|
103
|
+
if (curPage.value === 1) {
|
|
104
|
+
scrollTop.value = 0
|
|
105
|
+
articleList.value = res.data.results || []
|
|
106
|
+
} else {
|
|
107
|
+
articleList.value = [...articleList.value, ...(res.data.results || [])];
|
|
108
|
+
}
|
|
109
|
+
totalSize.value = res.data.totalSize as number;
|
|
110
|
+
}
|
|
111
|
+
}).finally(() => {
|
|
112
|
+
loading.value = false
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
// 接口图片资源路径 容器宽高度150rpx 裁剪2倍
|
|
116
|
+
let imageUrl = config.baseUrl + "/v1/file/image/clip/300/300/";
|
|
117
|
+
const loadMore = () => {
|
|
118
|
+
if (totalSize.value === articleList.value.length || loading.value) {
|
|
119
|
+
mpx.showToast({ title: "没有更多数据了", icon: "none" });
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
loadRecords(curPage.value + 1)
|
|
123
|
+
}
|
|
124
|
+
loadRecords(1);
|
|
125
|
+
watch(
|
|
126
|
+
() => props.refreshKey,
|
|
127
|
+
() => {
|
|
128
|
+
loadRecords(1)
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
return { resourceUrl, articleList, imageUrl, curPage, totalSize, loading, scrollTop, loadMore }
|
|
132
|
+
},
|
|
133
|
+
methods: {
|
|
134
|
+
// 点击详情事件
|
|
135
|
+
handleInfo(e: EventBase) {
|
|
136
|
+
let config = getApp().globalData.config;
|
|
137
|
+
let item = e.currentTarget.dataset.item;
|
|
138
|
+
mpx.navigateTo({
|
|
139
|
+
url: '/jmash/pages/cms/cms-location?tenant=' + this.organTenant + '&siteId=' + this.siteId + '&infoId=' + item.infoId,
|
|
140
|
+
});
|
|
141
|
+
// 浏览
|
|
142
|
+
this.handelBrowse(this.organTenant || config.tenant, item.infoId);
|
|
143
|
+
this.triggerEvent("info", item);
|
|
144
|
+
},
|
|
145
|
+
// 浏览
|
|
146
|
+
handelBrowse(tenant: string, infoId: string) {
|
|
147
|
+
const tempData = {
|
|
148
|
+
// 用于检测重复请求的唯一字符串ID
|
|
149
|
+
requestId: Math.random() * 10 + "",
|
|
150
|
+
// 类型
|
|
151
|
+
type: "information",
|
|
152
|
+
// 关系
|
|
153
|
+
relationId: infoId,
|
|
154
|
+
// 租户
|
|
155
|
+
tenant: tenant
|
|
156
|
+
};
|
|
157
|
+
cmsApi.createfrontBrowseRecord(tempData);
|
|
158
|
+
},
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
</script>
|
|
162
|
+
|
|
163
|
+
<style lang="scss">
|
|
164
|
+
@use "../../styles/index.scss" as *;
|
|
165
|
+
|
|
166
|
+
.article-main {
|
|
167
|
+
max-height: calc(100vh - 90rpx - env(safe-area-inset-bottom));
|
|
168
|
+
width: 100vw;
|
|
169
|
+
box-sizing: border-box;
|
|
170
|
+
background-color: #fff;
|
|
171
|
+
|
|
172
|
+
.article-list {
|
|
173
|
+
padding: 0 30rpx;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// 有分割线列表
|
|
178
|
+
.article-border {
|
|
179
|
+
padding: 24rpx 0;
|
|
180
|
+
border-bottom: 1rpx solid $border-line;
|
|
181
|
+
|
|
182
|
+
&:last-child {
|
|
183
|
+
border: none;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// 无分割线列表
|
|
188
|
+
.article-info {
|
|
189
|
+
position: relative;
|
|
190
|
+
padding: 24rpx;
|
|
191
|
+
background-color: #fff;
|
|
192
|
+
border-radius: 16rpx;
|
|
193
|
+
margin-bottom: 20rpx;
|
|
194
|
+
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.cms-info {
|
|
198
|
+
display: flex;
|
|
199
|
+
align-items: center;
|
|
200
|
+
gap: 24rpx;
|
|
201
|
+
|
|
202
|
+
.cms-text {
|
|
203
|
+
flex: 1;
|
|
204
|
+
min-width: 0;
|
|
205
|
+
display: flex;
|
|
206
|
+
flex-direction: column;
|
|
207
|
+
gap: 12rpx;
|
|
208
|
+
|
|
209
|
+
.cms-text-title {
|
|
210
|
+
color: #222;
|
|
211
|
+
font-size: 30rpx;
|
|
212
|
+
font-weight: 600;
|
|
213
|
+
line-height: 1.4;
|
|
214
|
+
overflow: hidden;
|
|
215
|
+
white-space: nowrap;
|
|
216
|
+
text-overflow: ellipsis;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.cms-text-desc {
|
|
220
|
+
color: #888;
|
|
221
|
+
font-size: 24rpx;
|
|
222
|
+
line-height: 1.5;
|
|
223
|
+
overflow: hidden;
|
|
224
|
+
display: -webkit-box;
|
|
225
|
+
-webkit-box-orient: vertical;
|
|
226
|
+
-webkit-line-clamp: 2;
|
|
227
|
+
text-overflow: ellipsis;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.cms-text-meta {
|
|
231
|
+
display: flex;
|
|
232
|
+
align-items: center;
|
|
233
|
+
gap: 6rpx;
|
|
234
|
+
|
|
235
|
+
.cms-meta-icon {
|
|
236
|
+
font-size: 22rpx;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.cms-meta-text {
|
|
240
|
+
color: #aaa;
|
|
241
|
+
font-size: 22rpx;
|
|
242
|
+
overflow: hidden;
|
|
243
|
+
white-space: nowrap;
|
|
244
|
+
text-overflow: ellipsis;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.cms-image {
|
|
250
|
+
flex-shrink: 0;
|
|
251
|
+
width: 180rpx;
|
|
252
|
+
height: 180rpx;
|
|
253
|
+
border-radius: 12rpx;
|
|
254
|
+
overflow: hidden;
|
|
255
|
+
background: #f0f0f0;
|
|
256
|
+
|
|
257
|
+
.cms-image-thumb {
|
|
258
|
+
width: 100%;
|
|
259
|
+
height: 100%;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.cms-arrow {
|
|
265
|
+
display: none;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// 无分割线列表显示右箭头
|
|
269
|
+
.article-info .cms-arrow {
|
|
270
|
+
display: block;
|
|
271
|
+
position: absolute;
|
|
272
|
+
right: 24rpx;
|
|
273
|
+
top: 50%;
|
|
274
|
+
transform: translateY(-50%);
|
|
275
|
+
font-size: 36rpx;
|
|
276
|
+
color: #ccc;
|
|
277
|
+
}
|
|
278
|
+
</style>
|
|
279
|
+
|
|
280
|
+
<script type="application/json">
|
|
281
|
+
{
|
|
282
|
+
"component": true,
|
|
283
|
+
"usingComponents": {
|
|
284
|
+
"jmash-cms-like": "./jmash-cms-like"
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
287
|
</script>
|