jmash-core-mp 0.1.26 → 0.1.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmash-core-mp",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
4
4
  "private": false,
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,7 +1,8 @@
1
1
  <template>
2
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 }}">
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 }}">
5
6
  <view class="cms-info">
6
7
  <view class="cms-image" catch:tap="handlePreview" data-url="{{ item.imgUrl }}">
7
8
  <image class="cms-image-thumb" src="{{ imageUrl + item.imgUrl }}" mode="aspectFill" />
@@ -16,9 +17,8 @@
16
17
  </view>
17
18
  </view>
18
19
  </view>
19
- </block>
20
- <view wx:if="{{ loading }}" class="load-tip">加载中...</view>
21
- <view wx:elif="{{ !hasMore && articleList.length > 0 }}" class="load-tip">没有更多了</view>
20
+ </view>
21
+ <view wx:if="{{ loading }}">加载中...</view>
22
22
  </scroll-view>
23
23
  </template>
24
24
 
@@ -31,7 +31,7 @@ import { CmsInfoModel } from '../../api/cms/types';
31
31
  createComponent({
32
32
  properties: {
33
33
  // 样式
34
- style: {
34
+ styles: {
35
35
  type: String,
36
36
  value: "0",
37
37
  },
@@ -74,7 +74,7 @@ createComponent({
74
74
  setup(props) {
75
75
  let config = getApp().globalData.config;
76
76
  const curPage = ref(1)
77
- const hasMore = ref(true)
77
+ const totalSize = ref(0)
78
78
  const loading = ref(false)
79
79
  const scrollTop = ref(0)
80
80
  // 资源路径
@@ -105,6 +105,7 @@ createComponent({
105
105
  } else {
106
106
  articleList.value = [...articleList.value, ...(res.data.results || [])];
107
107
  }
108
+ totalSize.value = res.data.totalSize as number;
108
109
  }
109
110
  }).finally(() => {
110
111
  loading.value = false
@@ -113,7 +114,10 @@ createComponent({
113
114
  // 接口图片资源路径 容器宽高度150rpx 裁剪2倍
114
115
  let imageUrl = config.baseUrl + "/v1/file/image/clip/300/300/";
115
116
  const loadMore = () => {
116
- if (!hasMore.value || loading.value) return
117
+ if (totalSize.value === articleList.value.length || loading.value) {
118
+ mpx.showToast({ title: "没有更多数据了", icon: "none" });
119
+ return;
120
+ }
117
121
  loadRecords(curPage.value + 1)
118
122
  }
119
123
  loadRecords(1);
@@ -123,7 +127,7 @@ createComponent({
123
127
  loadRecords(1)
124
128
  }
125
129
  )
126
- return { resourceUrl, articleList, imageUrl, curPage, hasMore, loading, scrollTop, loadMore }
130
+ return { resourceUrl, articleList, imageUrl, curPage, totalSize, loading, scrollTop, loadMore }
127
131
  },
128
132
  methods: {
129
133
  // 点击详情事件
@@ -159,9 +163,14 @@ createComponent({
159
163
  @use "../../styles/index.scss" as *;
160
164
 
161
165
  .article-main {
162
- padding: 0 30rpx;
163
- border-radius: 20rpx;
166
+ max-height: calc(100vh - 90rpx - env(safe-area-inset-bottom));
167
+ width: 100vw;
168
+ box-sizing: border-box;
164
169
  background-color: #fff;
170
+
171
+ .article-list {
172
+ padding: 0 30rpx;
173
+ }
165
174
  }
166
175
 
167
176
  // 有分割线列表
@@ -25,14 +25,20 @@ createComponent({
25
25
  channelAlias: {
26
26
  type: String,
27
27
  value: ""
28
- }
28
+ },
29
+ //refreshKey
30
+ refreshKey: {
31
+ type: Number,
32
+ value: 0
33
+ },
29
34
  },
30
35
  setup(props) {
31
36
  let contents = ref([{ contentId: "123" }]);
32
37
  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 }) => {
38
+ const { refreshKey } = toRefs(props)
39
+ watch(refreshKey, () => {
40
+ if (!props.channelAlias) return;
41
+ cmsApi.findCmsContentInfo({ siteId: props.siteId, channelAlias: props.channelAlias, tenant: props.tenant }).then(({ data }) => {
36
42
  console.log(data)
37
43
  title.value = data.cmsInfo.infoTitle;
38
44
  contents.value = data.infoContentResults;
@@ -1,5 +1,6 @@
1
1
  <template>
2
- <cms-protocol siteId="{{ siteId }}" tenant="{{ tenant }}" channelAlias="{{ channelAlias }}"></cms-protocol>
2
+ <cms-protocol siteId="{{ siteId }}" tenant="{{ tenant }}" channelAlias="{{ channelAlias }}"
3
+ refreshKey="{{ refreshKey }}"></cms-protocol>
3
4
  </template>
4
5
 
5
6
  <script>
@@ -12,13 +13,15 @@ createPage({
12
13
  let tenant = ref(config.siteTenant);
13
14
  let siteId = ref(config.siteId);
14
15
  let channelAlias = ref('');
16
+ let refreshKey = ref(0);
15
17
  onLoad((options) => {
16
18
  console.log(options);
17
19
  tenant.value = options.tenant || config.siteTenant;
18
20
  siteId.value = options.siteId || config.siteId;
19
21
  channelAlias.value = options.channelAlias || 'privacy';
22
+ refreshKey.value = refreshKey.value + 1;
20
23
  })
21
- return { siteId, tenant, channelAlias };
24
+ return { siteId, tenant, channelAlias, refreshKey };
22
25
  },
23
26
  })
24
27
  </script>
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <!-- 搜索框 -->
3
3
  <view class="search-box">
4
- <jmash-search placeholder="搜索" bind:handleSearch="handleInput" />
4
+ <jmash-search placeholder="搜索" backColor="#f3f4f6" bind:handleSearch="handleInput" />
5
5
  </view>
6
6
  <!-- 栏目列表 -->
7
- <jmash-cms-location-list isInfo="false" style="1" organTenant="{{ queryParams.tenant }}"
7
+ <jmash-cms-location-list isInfo="false" styles="1" organTenant="{{ queryParams.tenant }}"
8
8
  siteId="{{ queryParams.siteId }}" likeInfoTitle="{{ queryParams.likeInfoTitle }}"
9
9
  channelAlias="{{ queryParams.channelAlias }}" pageSize="10" refreshKey="{{ refreshKey }}" />
10
10
 
@@ -71,11 +71,6 @@ page {
71
71
  .search-box {
72
72
  padding: 15rpx 30rpx;
73
73
  }
74
-
75
- .article-list {
76
- max-height: calc(100vh - 90rpx - env(safe-area-inset-bottom));
77
- box-sizing: border-box;
78
- }
79
74
  </style>
80
75
 
81
76
  <script type="application/json">
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};