jmash-core-mp 0.1.13 → 0.1.15

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.
@@ -94,6 +94,7 @@ export interface CmsInfoModel {
94
94
  infoId?: string;
95
95
  modelCode?: string;
96
96
  infoTitle: string;
97
+ subTitle?: string;
97
98
  imgUrl?: string;
98
99
  author?: string;
99
100
  intro?: string;
@@ -104,6 +105,7 @@ export interface CmsInfoModel {
104
105
  channelId: Array<string>;
105
106
  sourceName?: string;
106
107
  siteId: string;
108
+ address?: string;
107
109
  }
108
110
  export interface CmsInfoContentReq {
109
111
  tenant?: string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -122,6 +122,9 @@ export const formatDateTime = (dateTimeString, format) => {
122
122
  if (format === "HH:mm:ss") {
123
123
  return hours + ":" + minutes + ":" + seconds;
124
124
  }
125
+ if (format === "HH:mm") {
126
+ return hours + ":" + minutes;
127
+ }
125
128
  return "";
126
129
  };
127
130
  /**
@@ -34,7 +34,7 @@ mpx.xfetch.interceptors.request.use(function (config) {
34
34
  }
35
35
  // 请求设置token和租户
36
36
  const expire = db.isTokenExpires();
37
- if (!expire) {
37
+ if (!expire && db.getToken()) {
38
38
  config.header["Authorization"] = "Bearer " + db.getToken();
39
39
  const organTenant = db.getOrganTenant(config.tenant);
40
40
  if (organTenant && config.header.GrpcMetadataTenant !== false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmash-core-mp",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "private": false,
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -186,6 +186,8 @@ export interface CmsInfoModel {
186
186
  modelCode?: string;
187
187
  // 内容标题
188
188
  infoTitle: string;
189
+ // 副标题
190
+ subTitle?: string;
189
191
  // 封面图片
190
192
  imgUrl?: string;
191
193
  // 作者
@@ -206,6 +208,8 @@ export interface CmsInfoModel {
206
208
  sourceName?: string;
207
209
  // 站点Id
208
210
  siteId: string;
211
+ // 地址
212
+ address?: string;
209
213
  }
210
214
  // 信息内容查询
211
215
  export interface CmsInfoContentReq {
@@ -23,7 +23,7 @@
23
23
  </view>
24
24
  </view>
25
25
  <text class="user-mobile" style="color: {{ userMobileColor }}">{{ userInfo.mobilePhoneIns || '未绑定手机号'
26
- }}</text>
26
+ }}</text>
27
27
  </view>
28
28
 
29
29
  <!-- 右侧箭头 -->
@@ -73,7 +73,7 @@ createComponent({
73
73
  type: String,
74
74
  value: 'false'
75
75
  },
76
- userNameColor: {
76
+ userNameColor: {
77
77
  type: String,
78
78
  value: '#111111'
79
79
  },
@@ -137,6 +137,7 @@ $text-3: #999999;
137
137
  $border: #e8e8e8;
138
138
  $bg-page: #f5f5f5;
139
139
  $bg-card: #ffffff;
140
+
140
141
  // 修改背景色从白色变到透明
141
142
  .auth-user-box {
142
143
  display: flex;
@@ -167,8 +168,8 @@ $bg-card: #ffffff;
167
168
  cursor: pointer;
168
169
 
169
170
  .avatar-img {
170
- width: 96rpx;
171
- height: 96rpx;
171
+ width: 130rpx;
172
+ height: 130rpx;
172
173
  border-radius: 50%;
173
174
  background-color: $bg-page;
174
175
  display: block;
@@ -1,8 +1,12 @@
1
1
  /**
2
2
  * 文章列表
3
- * @param style 样式 String (box:盒子列表效果 page:页面列表效果) 默认box
4
- * @param list 文章列表 Array
5
- * @event click 点击事件,参数为点击的项对象 item
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
6
10
  */
7
11
  <template>
8
12
  <!-- 文章列表 -->
@@ -11,16 +15,12 @@
11
15
  data-item="{{ item }}">
12
16
  <view class="article-title">{{ item.infoTitle }}</view>
13
17
  <view class="article-text">
14
- <!-- TODO:图标要改静态资源 -->
15
- <!-- <image class="text-image" src="/src/images/icon-address.png" mode="widthFix" /> -->
16
18
  <image class="text-image" src="{{ resourceUrl + 'icon-address.png' }}" mode="widthFix" />
17
19
  {{ item.address || item.subTitle }}
18
20
  </view>
19
21
  <view class="article-text">
20
- <!-- TODO:图标要改静态资源 -->
21
- <!-- <image class="text-image" src="/src/images/icon-time.png" mode="aspectFit" /> -->
22
22
  <image class="text-image" src="{{ resourceUrl + 'icon-time.png' }}" mode="widthFix" />
23
- {{ item.createTime }}
23
+ {{ item.publishDate }}
24
24
  </view>
25
25
  </view>
26
26
  </view>
@@ -31,13 +31,14 @@ import mpx, { createComponent, ref, onMounted } from "@mpxjs/core";
31
31
  import { EventBase } from "../../api/types";
32
32
  import { config } from '../../utils/config';
33
33
  import { cmsApi } from '../../api/cms';
34
+ import { CmsInfoModel } from '../../api/cms/types';
34
35
 
35
36
  createComponent({
36
37
  properties: {
37
38
  // 样式
38
39
  style: {
39
40
  type: String,
40
- value: "box",
41
+ value: "page",
41
42
  },
42
43
  // 组织租户
43
44
  organTenant: {
@@ -59,7 +60,7 @@ createComponent({
59
60
  type: String,
60
61
  value: ""
61
62
  },
62
- //数量
63
+ // 数量
63
64
  pageSize: {
64
65
  type: Number,
65
66
  value: 5
@@ -67,9 +68,9 @@ createComponent({
67
68
  },
68
69
  setup(props) {
69
70
  // 资源路径
70
- let resourceUrl = config.resourceUrl + '/images/cultrue/';
71
+ let resourceUrl = config.resourceUrl + '/images/';
71
72
  // 文章列表
72
- let articleList = ref([] as any[]);
73
+ let articleList = ref([] as CmsInfoModel[]);
73
74
  console.log("cms", props);
74
75
  onMounted(() => {
75
76
  cmsApi.findCmsInfoPage({
@@ -0,0 +1,241 @@
1
+ /**
2
+ * 文章内容列表item 组织组件
3
+ * @param isInfo 是否是文章详情页 Boolean 默认值为false
4
+ * @param style 样式 0:默认图片在右侧 1:默认图片在左侧 String 默认值为0
5
+ * @param organTenant 租户 String
6
+ * @param siteId 站点ID String
7
+ * @param channelId 栏目ID String
8
+ * @param channelAlias 栏目别名 String
9
+ * @param pageSize 数量 String 默认值为5
10
+ * @event info 文章详情点击事件,参数为文章项item
11
+ */
12
+ <template>
13
+ <!-- 文章内容列表item -->
14
+ <view class="{{ isInfo ? '' : 'article-main' }}">
15
+ <!-- 默认图片在右侧的样式 枚举值为0 -->
16
+ <block wx:for="{{ articleList }}" wx:key="index" wx:if="{{ style == '0' }}">
17
+ <view class="{{ isInfo ? 'article-info' : 'article-border' }}" bind:tap="handleInfo" data-item="{{ item }}">
18
+ <!-- 内容 -->
19
+ <view class="cms-info">
20
+ <view class="cms-left">
21
+ <!-- 标题 -->
22
+ <view class="cms-left-title">{{ item.infoTitle }}</view>
23
+ <!-- 内容 -->
24
+ <view class="cms-left-info">{{ item.intro }}</view>
25
+ </view>
26
+ <view bind:tap="handlePreview" data-url="{{ item.imgUrl }}">
27
+ <image class="cms-right-image" src="{{ imageUrl + item.imgUrl }}" mode="widthFix" />
28
+ </view>
29
+ </view>
30
+ <!-- 底部时间、点赞数、预览数 -->
31
+ <jmash-cms-like organTenant="{{ organTenant }}" interactId="{{ item.infoId }}"
32
+ publishDate="{{ item.publishDate }}"></jmash-cms-like>
33
+ </view>
34
+ </block>
35
+ <!-- 默认图片在左侧的样式 枚举值为1 -->
36
+ <block wx:for="{{ articleList }}" wx:key="index" wx:if="{{ style == '1' }}">
37
+ <view class="{{ isInfo ? 'article-info' : 'article-border' }}" bind:tap="handleInfo" data-item="{{ item }}">
38
+ <!-- 内容 -->
39
+ <view class="cms-info">
40
+ <view bind:tap="handlePreview" data-url="{{ item.imgUrl }}">
41
+ <image class="cms-right-image" src="{{ imageUrl + item.imgUrl }}" mode="widthFix" />
42
+ </view>
43
+ <view class="cms-left">
44
+ <!-- 标题 -->
45
+ <view class="cms-left-title">{{ item.infoTitle }}</view>
46
+ <!-- 内容 -->
47
+ <view class="cms-left-info">{{ item.intro }}</view>
48
+ </view>
49
+ </view>
50
+ <!-- 底部时间、点赞数、预览数 -->
51
+ <jmash-cms-like organTenant="{{ organTenant }}" interactId="{{ item.infoId }}"
52
+ publishDate="{{ item.publishDate }}"></jmash-cms-like>
53
+ </view>
54
+ </block>
55
+ </view>
56
+ </template>
57
+
58
+ <script lang="ts">
59
+ import mpx, { createComponent, ref, onMounted } from "@mpxjs/core";
60
+ import { EventBase } from "../../api/types";
61
+ import { config } from '../../utils/config';
62
+ import { cmsApi } from '../../api/cms';
63
+ import { CmsInfoModel } from '../../api/cms/types';
64
+
65
+ createComponent({
66
+ properties: {
67
+ // 是否更多详情
68
+ isInfo: {
69
+ type: Boolean,
70
+ value: false
71
+ },
72
+ // 样式
73
+ style: {
74
+ type: String,
75
+ value: "0",
76
+ },
77
+ // 组织租户
78
+ organTenant: {
79
+ type: String,
80
+ value: ""
81
+ },
82
+ // 站点ID
83
+ siteId: {
84
+ type: String,
85
+ value: ""
86
+ },
87
+ // 栏目ID
88
+ channelId: {
89
+ type: String,
90
+ value: ""
91
+ },
92
+ // 栏目别名
93
+ channelAlias: {
94
+ type: String,
95
+ value: ""
96
+ },
97
+ // 数量
98
+ pageSize: {
99
+ type: Number,
100
+ value: 5
101
+ },
102
+ },
103
+ setup(props) {
104
+ // 资源路径
105
+ let resourceUrl = config.resourceUrl + '/images';
106
+ // 文章列表
107
+ let articleList = ref([] as CmsInfoModel[]);
108
+ console.log("cms", props);
109
+ onMounted(() => {
110
+ cmsApi.findCmsInfoPage({
111
+ tenant: props.organTenant || config.tenant,
112
+ siteId: props.siteId,
113
+ channelId: props.channelId,
114
+ channelAlias: props.channelAlias,
115
+ curPage: 1,
116
+ pageSize: props.pageSize,
117
+ }).then(res => {
118
+ if (res.statusCode === 200) {
119
+ articleList.value = res.data.results;
120
+ }
121
+ });
122
+ });
123
+ // 接口图片资源路径 容器宽高度150rpx 裁剪2倍
124
+ let imageUrl = config.baseUrl + "/v1/file/image/clip/300/300/";
125
+ return { resourceUrl, articleList, imageUrl }
126
+ },
127
+ methods: {
128
+ // 点击详情事件
129
+ handleInfo(e: EventBase) {
130
+ let item = e.currentTarget.dataset.item;
131
+ mpx.navigateTo({
132
+ url: '/jmash/pages/cms/cms-article?siteId=' + this.siteId + '&infoId=' + item.infoId,
133
+ });
134
+ // 浏览
135
+ this.handelBrowse(this.organTenant || config.tenant, item.infoId);
136
+ this.triggerEvent("info", item);
137
+ },
138
+ // 浏览
139
+ handelBrowse(tenant: string, infoId: string) {
140
+ const tempData = {
141
+ // 用于检测重复请求的唯一字符串ID
142
+ requestId: Math.random() * 10 + "",
143
+ // 类型
144
+ type: "information",
145
+ // 关系
146
+ relationId: infoId,
147
+ // 租户
148
+ tenant: tenant
149
+ };
150
+ cmsApi.createfrontBrowseRecord(tempData);
151
+ },
152
+ }
153
+ })
154
+ </script>
155
+
156
+ <style lang="scss">
157
+ @use "../../styles/index.scss" as *;
158
+
159
+ .article-main {
160
+ padding: 0 30rpx;
161
+ border-radius: 20rpx;
162
+ background-color: #fff;
163
+ }
164
+
165
+ // 有分割线列表
166
+ .article-border {
167
+ padding: 30rpx 0;
168
+ border-bottom: 1rpx solid $border-line;
169
+
170
+ // 分割线最后一条内容无分割线
171
+ &:last-child {
172
+ border: none;
173
+ }
174
+ }
175
+
176
+ // 无分割线列表
177
+ .article-info {
178
+ padding: 30rpx;
179
+ background-color: #fff;
180
+ border-radius: 20rpx;
181
+ margin-bottom: 20rpx;
182
+ }
183
+
184
+ .cms-info {
185
+ display: flex;
186
+ align-items: center;
187
+ justify-content: space-between;
188
+ gap: 30rpx;
189
+ margin-bottom: 30rpx;
190
+
191
+ // 文章左侧内容
192
+ .cms-left {
193
+ width: 450rpx;
194
+ display: flex;
195
+ flex-direction: column;
196
+
197
+ .cms-left-title {
198
+ color: #333;
199
+ font-size: 28rpx;
200
+ font-weight: 600;
201
+ margin-bottom: 20rpx;
202
+ overflow: hidden;
203
+ /* 隐藏超出部分 */
204
+ white-space: nowrap;
205
+ /* 强制文本不换行 */
206
+ text-overflow: ellipsis;
207
+ /* 超出部分以省略号显示 */
208
+ }
209
+
210
+ .cms-left-info {
211
+ color: #666;
212
+ font-size: 26rpx;
213
+ line-height: 37rpx;
214
+ overflow: hidden;
215
+ /* 隐藏超出部分 */
216
+ display: -webkit-box;
217
+ -webkit-box-orient: vertical;
218
+ -webkit-line-clamp: 2;
219
+ /* 文本只显示两行 */
220
+ text-overflow: ellipsis;
221
+ /* 超出部分以省略号显示 */
222
+ }
223
+ }
224
+
225
+ // 文章右侧图片
226
+ .cms-right-image {
227
+ width: 150rpx;
228
+ height: 150rpx;
229
+ border-radius: 10rpx;
230
+ }
231
+ }
232
+ </style>
233
+
234
+ <script type="application/json">
235
+ {
236
+ "component": true,
237
+ "usingComponents": {
238
+ "jmash-cms-like": "./jmash-cms-like"
239
+ }
240
+ }
241
+ </script>
@@ -0,0 +1,132 @@
1
+ <template>
2
+ <view class="article-main">
3
+ <block>
4
+ <!-- 标题 -->
5
+ <view class="main-top" bind:tap="handleMore">
6
+ <view class="top-left-title">{{ title }}</view>
7
+ <view class="top-right-more">
8
+ <view class="more-text">更多</view>
9
+ <image class="more-image" src="{{ resourceUrl + '/components/caret-right_blcak.png' }}"
10
+ mode="widthFix" />
11
+ </view>
12
+ </view>
13
+ <!-- 文章列表 -->
14
+ <jmash-cms-article-item isInfo="{{ isInfo }}" organTenant="{{ organTenant }}" siteId="{{ siteId }}"
15
+ channelId="{{ channelId }}" channelAlias="{{ channelAlias }}" pageSize="{{ pageSize }}"
16
+ style="{{ style }}"></jmash-cms-article-item>
17
+ </block>
18
+ </view>
19
+ </template>
20
+
21
+ <script lang="ts">
22
+ import mpx, { createComponent } from "@mpxjs/core";
23
+ import { EventBase } from "../../api/types";
24
+ import { config } from '../../utils/config';
25
+
26
+ createComponent({
27
+ properties: {
28
+ // 标题
29
+ title: {
30
+ type: String,
31
+ value: ""
32
+ },
33
+ // 是否更多详情
34
+ isInfo: {
35
+ type: Boolean,
36
+ value: false
37
+ },
38
+ // 样式
39
+ style: {
40
+ type: String,
41
+ value: "0",
42
+ },
43
+ // 组织租户
44
+ organTenant: {
45
+ type: String,
46
+ value: ""
47
+ },
48
+ // 站点ID
49
+ siteId: {
50
+ type: String,
51
+ value: ""
52
+ },
53
+ // 栏目ID
54
+ channelId: {
55
+ type: String,
56
+ value: ""
57
+ },
58
+ // 栏目别名
59
+ channelAlias: {
60
+ type: String,
61
+ value: ""
62
+ },
63
+ //数量
64
+ pageSize: {
65
+ type: Number,
66
+ value: 5
67
+ },
68
+ },
69
+ setup(props) {
70
+ // 资源路径
71
+ let resourceUrl = config.resourceUrl + '/images';
72
+ return { resourceUrl }
73
+ },
74
+ methods: {
75
+ // 点击更多事件
76
+ handleMore(e: EventBase) {
77
+ mpx.navigateTo({
78
+ url: '/jmash/pages/cms/cms-article-list?organTenant=' + this.organTenant + '&siteId=' + this.siteId + '&channelId=' + this.channelId + '&channelAlias=' + this.channelAlias,
79
+ });
80
+ }
81
+ }
82
+ })
83
+ </script>
84
+
85
+ <style lang="scss">
86
+ @use "../../styles/index.scss" as *;
87
+
88
+ .article-main {
89
+ background-color: #fff;
90
+ border-radius: 20rpx;
91
+ margin-top: 20rpx;
92
+
93
+ .main-top {
94
+ display: flex;
95
+ align-items: center;
96
+ justify-content: space-between;
97
+ padding: 30rpx 30rpx 0 30rpx;
98
+
99
+ // 标题
100
+ .top-left-title {
101
+ color: #666;
102
+ font-size: 24rpx;
103
+ }
104
+
105
+ // 更多
106
+ .top-right-more {
107
+ display: flex;
108
+ align-items: center;
109
+
110
+ .more-text {
111
+ color: #666;
112
+ font-size: 24rpx;
113
+ }
114
+
115
+ .more-image {
116
+ width: 20rpx;
117
+ height: auto;
118
+ }
119
+ }
120
+ }
121
+
122
+ }
123
+ </style>
124
+
125
+ <script type="application/json">
126
+ {
127
+ "component": true,
128
+ "usingComponents": {
129
+ "jmash-cms-article-item": "./jmash-cms-article-item.mpx"
130
+ }
131
+ }
132
+ </script>
@@ -0,0 +1,151 @@
1
+ /**
2
+ * 底部时间、点赞数、预览数组件
3
+ * @param organTenant 租户 String
4
+ * @param interactId 互动ID String
5
+ * @param publishDate 发布时间 String
6
+ */
7
+ <template>
8
+ <view class="cms-bottom">
9
+ <!-- 时间 -->
10
+ <view>{{ showDate }}</view>
11
+
12
+ <view class="cms-bottom-right">
13
+ <!-- 浏览 -->
14
+ <view class="cms-bottom-look">
15
+ <image class="bottom-look-image-left" src="{{ resourceUrl + '/icon_image/eye_open.png' }}"
16
+ mode="widthFix" />
17
+ <view>{{ browseCount }}</view>
18
+ </view>
19
+ <!-- 点赞 -->
20
+ <view class="cms-bottom-look" catch:tap="handleLike" data-infoid="{{ interactId }}">
21
+ <image class="bottom-look-image-right"
22
+ src="{{ !isLikeStatus ? resourceUrl+'/icon_image/thumbs_up.png' : resourceUrl+'/icon_image/like_fill2x.png' }}"
23
+ mode="widthFix" />
24
+ <view>{{ likeCount }}</view>
25
+ </view>
26
+ </view>
27
+ </view>
28
+ </template>
29
+
30
+ <script lang="ts">
31
+ import { createComponent, ref, toRefs, watch, computed } from '@mpxjs/core'
32
+ import { cmsApi } from '../../api/cms/index'
33
+ import { config } from '../../utils/config';
34
+ import { FrontLikeCreateReq } from '../../api/cms/types'
35
+ import { EventBase } from '../../api/types'
36
+
37
+ createComponent({
38
+ properties: {
39
+ // 租户
40
+ organTenant: {
41
+ type: String,
42
+ value: ""
43
+ },
44
+ // 互动ID
45
+ interactId: {
46
+ type: String,
47
+ value: ""
48
+ },
49
+ // 发布时间
50
+ publishDate: {
51
+ type: String,
52
+ value: ""
53
+ }
54
+ },
55
+ setup(props) {
56
+ let browseCount = ref(0);
57
+ let likeCount = ref(0);
58
+ let isLikeStatus = ref(false);
59
+ let resourceUrl = config.resourceUrl + "/images";
60
+ // 点赞和收藏数量
61
+ let queryInteractData = function (tenant: string, interactId: string) {
62
+ cmsApi.cmsInfoInteractId({ interactId: interactId, tenant: tenant }).then((response) => {
63
+ likeCount.value = response.data.likeCount;
64
+ browseCount.value = response.data.browseCount;
65
+ });
66
+ }
67
+ // 是否已点赞
68
+ let queryIsLike = function (tenant: string, interactId: string) {
69
+ cmsApi.isLike({ relationId: interactId, tenant: tenant }).then((response) => {
70
+ isLikeStatus.value = response.data === 'true';
71
+ });
72
+ }
73
+ //监听
74
+ const { interactId } = toRefs(props)
75
+ watch(interactId, (newVal) => {
76
+ queryInteractData(props.organTenant, newVal);
77
+ queryIsLike(props.organTenant, newVal);
78
+ })
79
+ queryInteractData(props.organTenant, props.interactId);
80
+ queryIsLike(props.organTenant, props.interactId);
81
+
82
+ const showDate = computed(() => props.publishDate.substring(0, 10))
83
+
84
+ return { showDate, resourceUrl, isLikeStatus, likeCount, browseCount, queryInteractData, queryIsLike };
85
+ },
86
+ methods: {
87
+ // 点赞/取消点赞
88
+ handleLike(e: EventBase) {
89
+ const tempData = {
90
+ // 用于检测重复请求的唯一字符串ID
91
+ requestId: Math.random() * 10 + "",
92
+ // 点赞类型
93
+ likeType: "info",
94
+ // 关系
95
+ relationId: e.currentTarget?.dataset.infoid,
96
+ // 点赞true/取消点赞false
97
+ action: !this.isLikeStatus,
98
+ // 租户
99
+ tenant: this.organTenant || config.tenant
100
+ } as FrontLikeCreateReq;
101
+ // 点赞/取消点赞
102
+ cmsApi.frontLike(tempData).then((response) => {
103
+ if (response.data.likeId) {
104
+ // 获取互动数据
105
+ this.queryInteractData(this.organTenant, e.currentTarget?.dataset.infoid);
106
+ // 是否已点赞
107
+ this.queryIsLike(this.organTenant, e.currentTarget?.dataset.infoid);
108
+ }
109
+ });
110
+ },
111
+ }
112
+ })
113
+ </script>
114
+
115
+ <style lang="scss">
116
+ // 时间预览点赞
117
+ .cms-bottom {
118
+ display: flex;
119
+ align-items: center;
120
+ justify-content: space-between;
121
+ color: #999;
122
+ font-size: 12px;
123
+
124
+ // 预览/点赞
125
+ .cms-bottom-right {
126
+ display: flex;
127
+ align-items: center;
128
+ justify-content: space-between;
129
+ gap: 55rpx;
130
+
131
+ .cms-bottom-look {
132
+ display: flex;
133
+ align-items: center;
134
+
135
+ .bottom-look-image-left,
136
+ .bottom-look-image-right {
137
+ width: 32rpx;
138
+ height: 32rpx;
139
+ margin-right: 10rpx;
140
+ }
141
+ }
142
+ }
143
+ }
144
+ </style>
145
+
146
+ <script type="application/json">
147
+ {
148
+ "component": true,
149
+ "usingComponents": {}
150
+ }
151
+ </script>
@@ -4,7 +4,8 @@
4
4
  "./pages/auth/login",
5
5
  "./pages/auth/update-user",
6
6
  "./pages/auth/cms-protocol",
7
- "./pages/cms/cms-article"
7
+ "./pages/cms/cms-article",
8
+ "./pages/cms/cms-article-list"
8
9
  ]
9
10
  }
10
11
  </script>
@@ -0,0 +1,164 @@
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
+ import { config } from '../../../utils/config';
29
+
30
+ createPage({
31
+ setup(props) {
32
+ let organTenant = ref(getApp().globalData.config.tenant);
33
+ let siteId = ref(getApp().globalData.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 || getApp().globalData.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 item = e.currentTarget.dataset.item;
72
+ mpx.navigateTo({
73
+ url: '/jmash/pages/cms/cms-article?siteId=' + this.siteId + '&infoId=' + item.infoId,
74
+ });
75
+ // 浏览
76
+ this.handelBrowse(this.organTenant || config.tenant, item.infoId);
77
+ },
78
+ }
79
+ })
80
+ </script>
81
+
82
+ <style lang="scss">
83
+ @use "../../../styles/index.scss" as *;
84
+
85
+ .article-main {
86
+ padding: 0 30rpx;
87
+ border-radius: 20rpx;
88
+ background-color: #fff;
89
+ }
90
+
91
+ // 有分割线列表
92
+ .article-border {
93
+ padding: 30rpx 0;
94
+ border-bottom: 1rpx solid $border-line;
95
+
96
+ // 分割线最后一条内容无分割线
97
+ &:last-child {
98
+ border: none;
99
+ }
100
+ }
101
+
102
+ // 无分割线列表
103
+ .article-info {
104
+ padding: 30rpx;
105
+ background-color: #fff;
106
+ border-radius: 20rpx;
107
+ margin-bottom: 20rpx;
108
+ }
109
+
110
+ .cms-info {
111
+ display: flex;
112
+ align-items: center;
113
+ justify-content: space-between;
114
+ gap: 30rpx;
115
+ margin-bottom: 30rpx;
116
+
117
+ // 文章左侧内容
118
+ .cms-left {
119
+ width: 450rpx;
120
+ display: flex;
121
+ flex-direction: column;
122
+
123
+ .cms-left-title {
124
+ color: #333;
125
+ font-size: 28rpx;
126
+ font-weight: 600;
127
+ margin-bottom: 20rpx;
128
+ overflow: hidden;
129
+ /* 隐藏超出部分 */
130
+ white-space: nowrap;
131
+ /* 强制文本不换行 */
132
+ text-overflow: ellipsis;
133
+ /* 超出部分以省略号显示 */
134
+ }
135
+
136
+ .cms-left-info {
137
+ color: #666;
138
+ font-size: 26rpx;
139
+ line-height: 37rpx;
140
+ overflow: hidden;
141
+ /* 隐藏超出部分 */
142
+ display: -webkit-box;
143
+ -webkit-box-orient: vertical;
144
+ -webkit-line-clamp: 2;
145
+ /* 文本只显示两行 */
146
+ text-overflow: ellipsis;
147
+ /* 超出部分以省略号显示 */
148
+ }
149
+ }
150
+
151
+ // 文章右侧图片
152
+ .cms-right-image {
153
+ width: 150rpx;
154
+ height: 150rpx;
155
+ border-radius: 10rpx;
156
+ }
157
+ }
158
+ </style>
159
+
160
+ <script type="application/json">
161
+ {
162
+ "usingComponents": {}
163
+ }
164
+ </script>
@@ -2,6 +2,8 @@
2
2
  <view class="home-page">
3
3
  <text>主页(全屏登录)</text>
4
4
  <cms-acticle-list organTenant="xyvcard" siteId="{{ siteId }}" channelAlias="{{ channelAlias }}"></cms-acticle-list>
5
+ <cms-article-view title="企业动态" isInfo="{{ true }}" organTenant="xyvcard" siteId="{{ siteId }}"
6
+ channelAlias="{{ channelAlias }}" style="1"></cms-article-view>
5
7
  </view>
6
8
  </template>
7
9
 
@@ -45,6 +47,7 @@ createPage({
45
47
  {
46
48
  "usingComponents": {
47
49
  "cms-acticle-list": "../components/cms/jmash-cms-acticle-list",
50
+ "cms-article-view": "../components/cms/jmash-cms-article-view"
48
51
  }
49
52
  }
50
53
  </script>
@@ -126,6 +126,9 @@ export const formatDateTime = (dateTimeString: string, format?: any) => {
126
126
  if (format === "HH:mm:ss") {
127
127
  return hours + ":" + minutes + ":" + seconds;
128
128
  }
129
+ if (format === "HH:mm") {
130
+ return hours + ":" + minutes;
131
+ }
129
132
  return "";
130
133
  };
131
134
 
@@ -45,7 +45,7 @@ mpx.xfetch.interceptors.request.use(function (config) {
45
45
  }
46
46
  // 请求设置token和租户
47
47
  const expire = db.isTokenExpires();
48
- if (!expire) {
48
+ if (!expire && db.getToken()) {
49
49
  config.header["Authorization"] = "Bearer " + db.getToken();
50
50
  const organTenant = db.getOrganTenant(config.tenant);
51
51
  if (organTenant && config.header.GrpcMetadataTenant !== false) {