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.
- package/lib/api/cms/types.d.ts +4 -3
- package/lib/components/cms/cms-channel-list.mpx.d.ts +1 -0
- package/lib/components/cms/jmash-cms-activity-page.mpx.d.ts +1 -0
- package/lib/components/cms/jmash-cms-article-list.mpx.d.ts +1 -0
- package/lib/components/cms/jmash-cms-location-page.mpx.d.ts +1 -0
- package/lib/components/cms/jmash-cms-location.mpx.d.ts +1 -0
- package/lib/components/common/jmash-none-data.mpx.d.ts +1 -0
- package/lib/components/common/jmash-search.mpx.d.ts +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +4 -0
- package/lib/packages/pages/cms/cms-activity-list.mpx.d.ts +1 -0
- package/lib/packages/pages/cms/cms-info.mpx.d.ts +1 -0
- package/lib/packages/pages/cms/cms-list.mpx.d.ts +1 -0
- package/lib/packages/pages/cms/cms-location-list.mpx.d.ts +1 -0
- package/package.json +3 -2
- package/src/api/cms/types.ts +7 -1
- package/src/components/cms/jmash-cms-activity-page.mpx +360 -0
- package/src/components/cms/jmash-cms-article.mpx +174 -11
- package/src/components/cms/jmash-cms-location-page.mpx +275 -0
- package/src/components/cms/jmash-cms-location.mpx +257 -0
- package/src/components/common/jmash-upload-picture.mpx +129 -126
- package/src/index.ts +5 -0
- package/src/packages/index.mpx +3 -1
- package/src/packages/pages/cms/cms-activity-list.mpx +95 -0
- package/src/packages/pages/cms/cms-location-list.mpx +95 -0
- package/src/packages/pages/cms/cms-location.mpx +33 -0
- package/src/pages/home.mpx +0 -2
- package/src/pages/home2.mpx +0 -2
- package/src/pages/tabbar/home.mpx +45 -34
- package/src/components/cms/jmash-cms-acticle-list.mpx +0 -183
- package/src/packages/pages/cms/cms-article-list.mpx +0 -165
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 搜索框 -->
|
|
3
|
+
<view class="search-box">
|
|
4
|
+
<jmash-search placeholder="搜索" bind:handleSearch="handleInput" />
|
|
5
|
+
</view>
|
|
6
|
+
<!-- 栏目列表 -->
|
|
7
|
+
|
|
8
|
+
<jmash-cms-location-page isInfo="false" style="1" organTenant="{{ queryParams.tenant }}"
|
|
9
|
+
siteId="{{ queryParams.siteId }}" likeInfoTitle="{{ queryParams.likeInfoTitle }}"
|
|
10
|
+
channelAlias="{{ queryParams.channelAlias }}" pageSize="10" refreshKey="{{ refreshKey }}" />
|
|
11
|
+
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import mpx, { createPage, ref } from "@mpxjs/core";
|
|
16
|
+
import { CmsChannelModel } from '../../../api/cms/types'
|
|
17
|
+
import { EventBase } from "../../../api/types";
|
|
18
|
+
|
|
19
|
+
createPage({
|
|
20
|
+
setup() {
|
|
21
|
+
let config = getApp().globalData.config;
|
|
22
|
+
// 搜索参数
|
|
23
|
+
let queryParams = ref({
|
|
24
|
+
tenant: mpx.getStorageSync("tenant"),
|
|
25
|
+
siteId: config.siteId,
|
|
26
|
+
channelAlias: "gmlj",
|
|
27
|
+
likeInfoTitle: "",
|
|
28
|
+
status: true,
|
|
29
|
+
isOpen: true,
|
|
30
|
+
});
|
|
31
|
+
// 栏目列表
|
|
32
|
+
let channelList = ref([] as CmsChannelModel[]);
|
|
33
|
+
|
|
34
|
+
let refreshKey = ref(0);
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
queryParams,
|
|
38
|
+
channelList,
|
|
39
|
+
refreshKey,
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 生命周期函数--监听页面加载
|
|
45
|
+
* @param options 页面跳转参数{title: string, tenant: string, siteId: string, alias: string}
|
|
46
|
+
*/
|
|
47
|
+
onLoad(options) {
|
|
48
|
+
console.log("cms文章列表页面参数 ==>", options);
|
|
49
|
+
let config = getApp().globalData.config;
|
|
50
|
+
mpx.setNavigationBarTitle({ title: options.title || "列表" });
|
|
51
|
+
this.queryParams.tenant = options.tenant || mpx.getStorageSync("tenant") || config.tenant;
|
|
52
|
+
this.queryParams.siteId = options.siteId as string || config.siteId;
|
|
53
|
+
this.queryParams.channelAlias = options.channelAlias as string || "gmlj";
|
|
54
|
+
this.refreshKey = this.refreshKey + 1;
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
// 搜索
|
|
58
|
+
handleInput(e: EventBase) {
|
|
59
|
+
console.log("搜索 ==>", e.detail);
|
|
60
|
+
this.queryParams.likeInfoTitle = e.detail;
|
|
61
|
+
this.refreshKey = this.refreshKey + 1;
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
})
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<style lang="scss">
|
|
68
|
+
@use "../../../styles/index.scss" as *;
|
|
69
|
+
|
|
70
|
+
page {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
height: 70vh;
|
|
74
|
+
margin: 0 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.search-box {
|
|
78
|
+
padding: 15rpx 30rpx;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.article-list {
|
|
82
|
+
max-height: calc(100vh - 90rpx - env(safe-area-inset-bottom));
|
|
83
|
+
box-sizing: border-box;
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
86
|
+
|
|
87
|
+
<script type="application/json">
|
|
88
|
+
{
|
|
89
|
+
"navigationBarTitleText": "列表",
|
|
90
|
+
"usingComponents": {
|
|
91
|
+
"jmash-search": "../../../components/common/jmash-search",
|
|
92
|
+
"jmash-cms-location-page": "../../../components/cms/jmash-cms-location-page.mpx"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
</script>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<cms-location siteId="{{ siteId }}" tenant="{{ tenant }}" infoId="{{ infoId }}"></cms-location>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import { createPage, ref, onLoad } from '@mpxjs/core'
|
|
7
|
+
|
|
8
|
+
createPage({
|
|
9
|
+
setup(props) {
|
|
10
|
+
//console.log("123", props);
|
|
11
|
+
let config = getApp().globalData.config;
|
|
12
|
+
let siteId = ref(config.siteId);
|
|
13
|
+
let tenant = ref(config.tenant);
|
|
14
|
+
let infoId = ref('');
|
|
15
|
+
onLoad((options) => {
|
|
16
|
+
console.log(options);
|
|
17
|
+
siteId.value = options.siteId || config.siteId;
|
|
18
|
+
infoId.value = options.infoId || '';
|
|
19
|
+
})
|
|
20
|
+
return { siteId, tenant, infoId };
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<style lang="scss"></style>
|
|
26
|
+
|
|
27
|
+
<script type="application/json">
|
|
28
|
+
{
|
|
29
|
+
"usingComponents": {
|
|
30
|
+
"cms-location": "../../../components/cms/jmash-cms-location.mpx"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
</script>
|
package/src/pages/home.mpx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="home-page">
|
|
3
3
|
<text>主页(全屏登录)</text>
|
|
4
|
-
<cms-acticle-list organTenant="xyvcard" siteId="{{ siteId }}" channelAlias="{{ channelAlias }}"></cms-acticle-list>
|
|
5
4
|
<cms-article-view title="企业动态" isInfo="{{ true }}" organTenant="xyvcard" siteId="{{ siteId }}"
|
|
6
5
|
channelAlias="{{ channelAlias }}" style="1"></cms-article-view>
|
|
7
6
|
</view>
|
|
@@ -46,7 +45,6 @@ createPage({
|
|
|
46
45
|
<script type="application/json">
|
|
47
46
|
{
|
|
48
47
|
"usingComponents": {
|
|
49
|
-
"cms-acticle-list": "../components/cms/jmash-cms-acticle-list",
|
|
50
48
|
"cms-article-view": "../components/cms/jmash-cms-article-view"
|
|
51
49
|
}
|
|
52
50
|
}
|
package/src/pages/home2.mpx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="home-page">
|
|
3
3
|
<text>主页(全屏登录)</text>
|
|
4
|
-
<cms-acticle-list organTenant="xyvcard" siteId="{{ siteId }}" channelAlias="{{ channelAlias }}"></cms-acticle-list>
|
|
5
4
|
<cms-article-view title="企业动态" isInfo="{{ true }}" organTenant="xyvcard" siteId="{{ siteId }}"
|
|
6
5
|
channelAlias="{{ channelAlias }}" style="1"></cms-article-view>
|
|
7
6
|
</view>
|
|
@@ -41,7 +40,6 @@ createPage({
|
|
|
41
40
|
<script type="application/json">
|
|
42
41
|
{
|
|
43
42
|
"usingComponents": {
|
|
44
|
-
"cms-acticle-list": "../components/cms/jmash-cms-acticle-list",
|
|
45
43
|
"cms-article-view": "../components/cms/jmash-cms-article-view"
|
|
46
44
|
}
|
|
47
45
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="page-body">
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<button type="default" bind:tap="loginOut">退出</button>
|
|
3
|
+
<jmash-menu menuGroups="{{ menuGroups }}" bind:itemClick="handleMenuClick"></jmash-menu>
|
|
4
|
+
<view class="logout-section">
|
|
5
|
+
<button type="warn" bind:tap="loginOut">退出登录</button>
|
|
6
|
+
</view>
|
|
8
7
|
</view>
|
|
9
8
|
</template>
|
|
10
9
|
|
|
@@ -15,6 +14,26 @@ import { useUserStore } from '../../store/user';
|
|
|
15
14
|
createPage({
|
|
16
15
|
data: {
|
|
17
16
|
userStore: null,
|
|
17
|
+
menuGroups: [
|
|
18
|
+
{
|
|
19
|
+
id: 1,
|
|
20
|
+
items: [
|
|
21
|
+
{ key: 'home', title: '主页(全屏登录检查)', icon: '🏠', iconBg: '#409eff', path: '/pages/home' },
|
|
22
|
+
{ key: 'home2', title: '主页(全屏登录)', icon: '🏠', iconBg: '#67c23a', path: '/pages/home2' },
|
|
23
|
+
{ key: 'half-home', title: '主页(半屏登录)', icon: '🏠', iconBg: '#e6a23c', path: '/pages/half-home' },
|
|
24
|
+
{ key: 'comp-test', title: '组件演示', icon: '🧩', iconBg: '#f56c6c', path: '/pages/basic-component' },
|
|
25
|
+
{
|
|
26
|
+
key: 'cms-location-list', title: '内容列表', icon: '📝', iconBg: '#409eff', path: '/jmash/pages/cms/cms-location-list'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
key: 'cms-activity-list', title: '活动列表', icon: '📝', iconBg: '#409eff', path: '/jmash/pages/cms/cms-activity-list'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: 'cms-article-list', title: '文章列表', icon: '📝', iconBg: '#409eff', path: '/jmash/pages/cms/cms-article-list'
|
|
33
|
+
},
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
]
|
|
18
37
|
},
|
|
19
38
|
onShow() {
|
|
20
39
|
this.userStore = useUserStore();
|
|
@@ -24,25 +43,11 @@ createPage({
|
|
|
24
43
|
}
|
|
25
44
|
},
|
|
26
45
|
methods: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
toHome2Page() {
|
|
33
|
-
mpx.navigateTo({
|
|
34
|
-
url: '/pages/home2'
|
|
35
|
-
})
|
|
36
|
-
},
|
|
37
|
-
toHalfHomePage() {
|
|
38
|
-
mpx.navigateTo({
|
|
39
|
-
url: '/pages/half-home'
|
|
40
|
-
})
|
|
41
|
-
},
|
|
42
|
-
toCompTestPage() {
|
|
43
|
-
mpx.navigateTo({
|
|
44
|
-
url: '/pages/basic-component'
|
|
45
|
-
})
|
|
46
|
+
handleMenuClick(e) {
|
|
47
|
+
const { item } = e.detail
|
|
48
|
+
if (item.path) {
|
|
49
|
+
mpx.navigateTo({ url: item.path })
|
|
50
|
+
}
|
|
46
51
|
},
|
|
47
52
|
loginOut() {
|
|
48
53
|
this.userStore.logout();
|
|
@@ -57,22 +62,28 @@ createPage({
|
|
|
57
62
|
|
|
58
63
|
<style lang="scss">
|
|
59
64
|
.page-body {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
min-height: 100vh;
|
|
66
|
+
background-color: #f5f5f5;
|
|
67
|
+
|
|
68
|
+
.logout-section {
|
|
69
|
+
display: flex;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
padding: 40rpx 16rpx;
|
|
65
72
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
button {
|
|
74
|
+
width: 80%;
|
|
75
|
+
height: 88rpx;
|
|
76
|
+
font-size: 30rpx;
|
|
77
|
+
border-radius: 44rpx;
|
|
78
|
+
}
|
|
70
79
|
}
|
|
71
80
|
}
|
|
72
81
|
</style>
|
|
73
82
|
|
|
74
83
|
<script type="application/json">
|
|
75
84
|
{
|
|
76
|
-
"usingComponents": {
|
|
85
|
+
"usingComponents": {
|
|
86
|
+
"jmash-menu": "../../components/common/jmash-menu.mpx"
|
|
87
|
+
}
|
|
77
88
|
}
|
|
78
89
|
</script>
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 文章列表
|
|
3
|
-
* @param style 样式 String (box:盒子列表效果 page:页面列表效果) 默认page
|
|
4
|
-
* @param organTenant 租户 String
|
|
5
|
-
* @param siteId 站点ID String
|
|
6
|
-
* @param channelId 栏目ID String
|
|
7
|
-
* @param channelAlias 栏目别名 String
|
|
8
|
-
* @param pageSize 数量 String 默认值为5
|
|
9
|
-
* @event info 文章详情点击事件,参数为点击的项对象 item
|
|
10
|
-
*/
|
|
11
|
-
<template>
|
|
12
|
-
<!-- 文章列表 -->
|
|
13
|
-
<view class="{{ 'article-list-' + style }}" wx:if="{{ articleList.length > 0 }}">
|
|
14
|
-
<view class="{{ 'article-item-' + style }}" wx:for="{{ articleList }}" wx:key="index" bind:tap="handleInfo"
|
|
15
|
-
data-item="{{ item }}">
|
|
16
|
-
<view class="article-title">{{ item.infoTitle }}</view>
|
|
17
|
-
<view class="article-text">
|
|
18
|
-
<image class="text-image" src="{{ resourceUrl + 'icon-address.png' }}" mode="widthFix" />
|
|
19
|
-
{{ item.address || item.subTitle }}
|
|
20
|
-
</view>
|
|
21
|
-
<view class="article-text">
|
|
22
|
-
<image class="text-image" src="{{ resourceUrl + 'icon-time.png' }}" mode="widthFix" />
|
|
23
|
-
{{ item.publishDate }}
|
|
24
|
-
</view>
|
|
25
|
-
</view>
|
|
26
|
-
</view>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<script lang="ts">
|
|
30
|
-
import mpx, { createComponent, ref, onMounted } from "@mpxjs/core";
|
|
31
|
-
import { EventBase } from "../../api/types";
|
|
32
|
-
import { cmsApi } from '../../api/cms';
|
|
33
|
-
import { CmsInfoModel } from '../../api/cms/types';
|
|
34
|
-
|
|
35
|
-
createComponent({
|
|
36
|
-
properties: {
|
|
37
|
-
// 样式
|
|
38
|
-
style: {
|
|
39
|
-
type: String,
|
|
40
|
-
value: "page",
|
|
41
|
-
},
|
|
42
|
-
// 组织租户
|
|
43
|
-
organTenant: {
|
|
44
|
-
type: String,
|
|
45
|
-
value: ""
|
|
46
|
-
},
|
|
47
|
-
// 站点ID
|
|
48
|
-
siteId: {
|
|
49
|
-
type: String,
|
|
50
|
-
value: ""
|
|
51
|
-
},
|
|
52
|
-
// 栏目ID
|
|
53
|
-
channelId: {
|
|
54
|
-
type: String,
|
|
55
|
-
value: ""
|
|
56
|
-
},
|
|
57
|
-
// 栏目别名
|
|
58
|
-
channelAlias: {
|
|
59
|
-
type: String,
|
|
60
|
-
value: ""
|
|
61
|
-
},
|
|
62
|
-
// 数量
|
|
63
|
-
pageSize: {
|
|
64
|
-
type: Number,
|
|
65
|
-
value: 5
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
setup(props) {
|
|
69
|
-
let config = getApp().globalData.config;
|
|
70
|
-
// 资源路径
|
|
71
|
-
let resourceUrl = config.resourceUrl + '/images/';
|
|
72
|
-
// 文章列表
|
|
73
|
-
let articleList = ref([] as CmsInfoModel[]);
|
|
74
|
-
console.log("cms", props);
|
|
75
|
-
onMounted(() => {
|
|
76
|
-
cmsApi.findCmsInfoPage({
|
|
77
|
-
tenant: props.organTenant || config.tenant,
|
|
78
|
-
siteId: props.siteId,
|
|
79
|
-
channelId: props.channelId,
|
|
80
|
-
channelAlias: props.channelAlias,
|
|
81
|
-
curPage: 1,
|
|
82
|
-
pageSize: props.pageSize,
|
|
83
|
-
}).then(res => {
|
|
84
|
-
if (res.statusCode === 200) {
|
|
85
|
-
articleList.value = res.data.results;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
return { resourceUrl, articleList }
|
|
90
|
-
},
|
|
91
|
-
methods: {
|
|
92
|
-
// 点击详情事件
|
|
93
|
-
handleInfo(e: EventBase) {
|
|
94
|
-
let item = e.currentTarget.dataset.item;
|
|
95
|
-
mpx.navigateTo({
|
|
96
|
-
url: '/jmash/pages/cms/cms-article?siteId=' + this.siteId + '&infoId=' + item.infoId,
|
|
97
|
-
});
|
|
98
|
-
this.triggerEvent("info", item);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
})
|
|
102
|
-
</script>
|
|
103
|
-
|
|
104
|
-
<style lang="scss">
|
|
105
|
-
@use "../../styles/index.scss" as *;
|
|
106
|
-
|
|
107
|
-
// 组件列表样式
|
|
108
|
-
.article-list-box {
|
|
109
|
-
margin: 20rpx 0;
|
|
110
|
-
padding: 20rpx;
|
|
111
|
-
background: $background-white-color;
|
|
112
|
-
border-radius: $border-mini-radius;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.article-item-box {
|
|
116
|
-
display: flex;
|
|
117
|
-
flex-direction: column;
|
|
118
|
-
gap: 10rpx;
|
|
119
|
-
padding: 20rpx 0;
|
|
120
|
-
box-sizing: border-box;
|
|
121
|
-
border-bottom: 2rpx solid $border-line;
|
|
122
|
-
background: $background-white-color;
|
|
123
|
-
|
|
124
|
-
&:first-child {
|
|
125
|
-
padding-top: 0;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
&:last-child {
|
|
129
|
-
border-bottom: none;
|
|
130
|
-
padding-bottom: 0;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// 页面列表样式
|
|
135
|
-
.article-list-page {
|
|
136
|
-
padding: 0 30rpx;
|
|
137
|
-
display: flex;
|
|
138
|
-
flex-direction: column;
|
|
139
|
-
gap: 20rpx;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.article-item-page {
|
|
143
|
-
display: flex;
|
|
144
|
-
flex-direction: column;
|
|
145
|
-
gap: 10rpx;
|
|
146
|
-
padding: 30rpx;
|
|
147
|
-
box-sizing: border-box;
|
|
148
|
-
background: $background-white-color;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.article-title {
|
|
152
|
-
font-weight: 600;
|
|
153
|
-
font-size: 26rpx;
|
|
154
|
-
color: $font-color;
|
|
155
|
-
line-height: 37rpx;
|
|
156
|
-
margin-bottom: 4rpx;
|
|
157
|
-
overflow: hidden;
|
|
158
|
-
text-overflow: ellipsis;
|
|
159
|
-
white-space: nowrap;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.article-text {
|
|
163
|
-
display: flex;
|
|
164
|
-
align-items: center;
|
|
165
|
-
gap: 20rpx;
|
|
166
|
-
font-weight: 400;
|
|
167
|
-
font-size: $font-size-mini;
|
|
168
|
-
color: $font-color-grey;
|
|
169
|
-
line-height: 33rpx;
|
|
170
|
-
|
|
171
|
-
.text-image {
|
|
172
|
-
width: 20rpx;
|
|
173
|
-
height: 20rpx;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
</style>
|
|
177
|
-
|
|
178
|
-
<script type="application/json">
|
|
179
|
-
{
|
|
180
|
-
"component": true,
|
|
181
|
-
"usingComponents": {}
|
|
182
|
-
}
|
|
183
|
-
</script>
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="article-main">
|
|
3
|
-
<!-- 默认图片在右侧的样式 枚举值为0 -->
|
|
4
|
-
<block wx:for="{{ articleList }}" wx:key="index">
|
|
5
|
-
<view class="{{ isInfo ? 'article-info' : 'article-border' }}" bind:tap="handleInfo" data-item="{{ item }}">
|
|
6
|
-
<!-- 内容 -->
|
|
7
|
-
<view class="cms-info">
|
|
8
|
-
<view class="cms-left">
|
|
9
|
-
<!-- 标题 -->
|
|
10
|
-
<view class="cms-left-title">{{ item.infoTitle }}</view>
|
|
11
|
-
<!-- 内容 -->
|
|
12
|
-
<view class="cms-left-info">{{ item.intro }}</view>
|
|
13
|
-
</view>
|
|
14
|
-
<view bind:tap="handlePreview" data-url="{{ item.imgUrl }}">
|
|
15
|
-
<image class="cms-right-image" src="{{ imageUrl + item.imgUrl }}" mode="widthFix" />
|
|
16
|
-
</view>
|
|
17
|
-
</view>
|
|
18
|
-
</view>
|
|
19
|
-
</block>
|
|
20
|
-
</view>
|
|
21
|
-
</template>
|
|
22
|
-
|
|
23
|
-
<script lang="ts">
|
|
24
|
-
import mpx, { createPage, ref, onLoad, onPullDownRefresh } from '@mpxjs/core'
|
|
25
|
-
import { EventBase } from '../../../api/types';
|
|
26
|
-
import { cmsApi } from '../../../api/cms';
|
|
27
|
-
import { CmsInfoModel } from '../../../api/cms/types';
|
|
28
|
-
|
|
29
|
-
createPage({
|
|
30
|
-
setup(props) {
|
|
31
|
-
let config = getApp().globalData.config;
|
|
32
|
-
let organTenant = ref(config.tenant);
|
|
33
|
-
let siteId = ref(config.siteId);
|
|
34
|
-
let channelId = ref('');
|
|
35
|
-
let channelAlias = ref('');
|
|
36
|
-
let curPage = ref(1);
|
|
37
|
-
let articleList = ref([] as CmsInfoModel[]);
|
|
38
|
-
let imageUrl = config.baseUrl + "/v1/file/image/clip/300/300/";
|
|
39
|
-
let queryCmsInfo = function () {
|
|
40
|
-
cmsApi.findCmsInfoPage({
|
|
41
|
-
tenant: organTenant.value || config.tenant,
|
|
42
|
-
siteId: siteId.value,
|
|
43
|
-
channelId: channelId.value,
|
|
44
|
-
channelAlias: channelAlias.value,
|
|
45
|
-
curPage: curPage.value,
|
|
46
|
-
pageSize: 10,
|
|
47
|
-
}).then(res => {
|
|
48
|
-
if (res.statusCode === 200) {
|
|
49
|
-
console.log("article-list-add", res.data.results);
|
|
50
|
-
articleList.value.push(...res.data.results);
|
|
51
|
-
curPage.value++;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
onLoad((options) => {
|
|
56
|
-
console.log("article-list", options);
|
|
57
|
-
siteId.value = options.siteId || config.siteId;
|
|
58
|
-
channelId.value = options.channelId || '';
|
|
59
|
-
channelAlias.value = options.channelAlias || '';
|
|
60
|
-
curPage.value = 1;
|
|
61
|
-
queryCmsInfo();
|
|
62
|
-
})
|
|
63
|
-
onPullDownRefresh(() => {
|
|
64
|
-
queryCmsInfo();
|
|
65
|
-
})
|
|
66
|
-
return { organTenant, siteId, channelId, channelAlias, curPage, articleList, imageUrl, queryCmsInfo };
|
|
67
|
-
},
|
|
68
|
-
methods: {
|
|
69
|
-
// 点击详情事件
|
|
70
|
-
handleInfo(e: EventBase) {
|
|
71
|
-
let config = getApp().globalData.config;
|
|
72
|
-
let item = e.currentTarget.dataset.item;
|
|
73
|
-
mpx.navigateTo({
|
|
74
|
-
url: '/jmash/pages/cms/cms-article?siteId=' + this.siteId + '&infoId=' + item.infoId,
|
|
75
|
-
});
|
|
76
|
-
// 浏览
|
|
77
|
-
this.handelBrowse(this.organTenant || config.tenant, item.infoId);
|
|
78
|
-
},
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
</script>
|
|
82
|
-
|
|
83
|
-
<style lang="scss">
|
|
84
|
-
@use "../../../styles/index.scss" as *;
|
|
85
|
-
|
|
86
|
-
.article-main {
|
|
87
|
-
padding: 0 30rpx;
|
|
88
|
-
border-radius: 20rpx;
|
|
89
|
-
background-color: #fff;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// 有分割线列表
|
|
93
|
-
.article-border {
|
|
94
|
-
padding: 30rpx 0;
|
|
95
|
-
border-bottom: 1rpx solid $border-line;
|
|
96
|
-
|
|
97
|
-
// 分割线最后一条内容无分割线
|
|
98
|
-
&:last-child {
|
|
99
|
-
border: none;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// 无分割线列表
|
|
104
|
-
.article-info {
|
|
105
|
-
padding: 30rpx;
|
|
106
|
-
background-color: #fff;
|
|
107
|
-
border-radius: 20rpx;
|
|
108
|
-
margin-bottom: 20rpx;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.cms-info {
|
|
112
|
-
display: flex;
|
|
113
|
-
align-items: center;
|
|
114
|
-
justify-content: space-between;
|
|
115
|
-
gap: 30rpx;
|
|
116
|
-
margin-bottom: 30rpx;
|
|
117
|
-
|
|
118
|
-
// 文章左侧内容
|
|
119
|
-
.cms-left {
|
|
120
|
-
width: 450rpx;
|
|
121
|
-
display: flex;
|
|
122
|
-
flex-direction: column;
|
|
123
|
-
|
|
124
|
-
.cms-left-title {
|
|
125
|
-
color: #333;
|
|
126
|
-
font-size: 28rpx;
|
|
127
|
-
font-weight: 600;
|
|
128
|
-
margin-bottom: 20rpx;
|
|
129
|
-
overflow: hidden;
|
|
130
|
-
/* 隐藏超出部分 */
|
|
131
|
-
white-space: nowrap;
|
|
132
|
-
/* 强制文本不换行 */
|
|
133
|
-
text-overflow: ellipsis;
|
|
134
|
-
/* 超出部分以省略号显示 */
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.cms-left-info {
|
|
138
|
-
color: #666;
|
|
139
|
-
font-size: 26rpx;
|
|
140
|
-
line-height: 37rpx;
|
|
141
|
-
overflow: hidden;
|
|
142
|
-
/* 隐藏超出部分 */
|
|
143
|
-
display: -webkit-box;
|
|
144
|
-
-webkit-box-orient: vertical;
|
|
145
|
-
-webkit-line-clamp: 2;
|
|
146
|
-
/* 文本只显示两行 */
|
|
147
|
-
text-overflow: ellipsis;
|
|
148
|
-
/* 超出部分以省略号显示 */
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// 文章右侧图片
|
|
153
|
-
.cms-right-image {
|
|
154
|
-
width: 150rpx;
|
|
155
|
-
height: 150rpx;
|
|
156
|
-
border-radius: 10rpx;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
</style>
|
|
160
|
-
|
|
161
|
-
<script type="application/json">
|
|
162
|
-
{
|
|
163
|
-
"usingComponents": {}
|
|
164
|
-
}
|
|
165
|
-
</script>
|