@jx3box/jx3box-common-ui 8.9.5 → 8.9.7

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": "@jx3box/jx3box-common-ui",
3
- "version": "8.9.5",
3
+ "version": "8.9.7",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/service/cms.js CHANGED
@@ -45,6 +45,10 @@ function getSliders(source_type, source_ids, client="std") {
45
45
  });
46
46
  }
47
47
 
48
+ function getSlider(params) {
49
+ return $cms({ mute: true }).get(`/api/cms/news/item`, { params });
50
+ }
51
+
48
52
  function getCollection(id) {
49
53
  return $cms({ mute: true }).get(`/api/cms/post/collection/${id}`);
50
54
  }
@@ -74,4 +78,4 @@ function setUserMeta(key,data) {
74
78
  }
75
79
 
76
80
  export { getPostAuthors, uploadImage, upload, getDecoration, getDecorationJson, checkTeamMember,
77
- getSliders, getCollection, getTopicBucket, getConfig, getUserMeta, setUserMeta };
81
+ getSliders,getSlider, getCollection, getTopicBucket, getConfig, getUserMeta, setUserMeta };
@@ -62,7 +62,7 @@ export default {
62
62
  default: false
63
63
  },
64
64
  post: {
65
- type: Object,
65
+ type: [Object, String],
66
66
  default: () => {}
67
67
  }
68
68
  },
@@ -14,7 +14,7 @@
14
14
  </template>
15
15
 
16
16
  <script>
17
- import { getSliders } from "../../service/cms";
17
+ import { getSlider } from "../../service/cms";
18
18
  import { getThumbnail } from "@jx3box/jx3box-common/js/utils";
19
19
  import dayjs from "dayjs";
20
20
  export default {
@@ -67,14 +67,11 @@ export default {
67
67
  },
68
68
  methods: {
69
69
  loadData() {
70
- getSliders(this.type, this.id, this.client).then((res) => {
71
- if (res.data.data?.list) {
72
- // 取创建时间最新的一条
73
- const list = res.data.data.list.sort((a, b) =>
74
- dayjs(b.created_at).isAfter(dayjs(a.created_at)) ? 1 : -1
75
- );
76
- this.topicInfo = list[0];
77
- }
70
+ getSlider({
71
+ source_type: this.type,
72
+ source_id: this.id,
73
+ }).then((res) => {
74
+ this.topicInfo = res.data?.data
78
75
  });
79
76
  },
80
77
  },