neo-cmp-cli 1.3.7 → 1.3.8
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/README.md +5 -5
- package/package.json +1 -1
- package/src/template/antd-custom-cmp-template/package.json +1 -1
- package/src/template/echarts-custom-cmp-template/package.json +1 -1
- package/src/template/{react-ts-custom-cmp-template → echarts-custom-cmp-template}/src/components/map-widget/index.tsx +56 -18
- package/src/template/echarts-custom-cmp-template/src/utils/url.ts +82 -0
- package/src/template/neo-custom-cmp-template/neo.config.js +4 -4
- package/src/template/neo-custom-cmp-template/package.json +1 -1
- package/src/template/react-custom-cmp-template/package.json +1 -1
- package/src/template/react-ts-custom-cmp-template/neo.config.js +4 -4
- package/src/template/react-ts-custom-cmp-template/package.json +2 -2
- package/src/template/vue2-custom-cmp-template/package.json +1 -1
- package/src/template/echarts-custom-cmp-template/src/components/info-card/index.tsx +0 -69
- package/src/template/echarts-custom-cmp-template/src/components/info-card/model.ts +0 -78
- package/src/template/echarts-custom-cmp-template/src/components/info-card/style.scss +0 -105
- package/src/template/neo-custom-cmp-template/src/components/contact-card-list/README.md +0 -61
- package/src/template/neo-custom-cmp-template/src/components/contact-card-list/index.tsx +0 -191
- package/src/template/neo-custom-cmp-template/src/components/contact-card-list/model.ts +0 -56
- package/src/template/neo-custom-cmp-template/src/components/contact-card-list/style.scss +0 -260
- package/src/template/neo-custom-cmp-template/src/components/contact-form/README.md +0 -94
- package/src/template/neo-custom-cmp-template/src/components/contact-form/index.tsx +0 -249
- package/src/template/neo-custom-cmp-template/src/components/contact-form/model.ts +0 -63
- package/src/template/neo-custom-cmp-template/src/components/contact-form/style.scss +0 -120
- package/src/template/react-ts-custom-cmp-template/src/components/info-card/index.tsx +0 -69
- package/src/template/react-ts-custom-cmp-template/src/components/info-card/model.ts +0 -78
- package/src/template/react-ts-custom-cmp-template/src/components/info-card/style.scss +0 -105
- /package/src/template/{react-ts-custom-cmp-template → echarts-custom-cmp-template}/src/components/map-widget/README.md +0 -0
- /package/src/template/{react-ts-custom-cmp-template → echarts-custom-cmp-template}/src/components/map-widget/USAGE.md +0 -0
- /package/src/template/{react-ts-custom-cmp-template → echarts-custom-cmp-template}/src/components/map-widget/model.ts +0 -0
- /package/src/template/{react-ts-custom-cmp-template → echarts-custom-cmp-template}/src/components/map-widget/style.scss +0 -0
package/README.md
CHANGED
|
@@ -12,11 +12,11 @@ neo-cmp-cli 是 Neo 自定义组件开发工具,基于 [AKFun](https://github.
|
|
|
12
12
|
|
|
13
13
|
### 内置的自定义组件模板
|
|
14
14
|
创建自定义组件时(执行初始化命令 neo init)可选用。
|
|
15
|
-
- **React 模板**: [react-custom-cmp-template](https://github.com/wibetter/react-custom-cmp-template)
|
|
16
|
-
- **React + TS 模板**: [react-ts-custom-cmp-template](https://github.com/wibetter/react-ts-custom-cmp-template)
|
|
17
|
-
- **Antd 模板**: [antd-custom-cmp-template](https://github.com/wibetter/antd-custom-cmp-template) Antd
|
|
18
|
-
- **Neo 模板**: [neo-custom-cmp-template](https://github.com/wibetter/neo-custom-cmp-template)
|
|
19
|
-
- **Echarts 模板**: [echarts-custom-cmp-template](https://github.com/wibetter/echarts-custom-cmp-template) Echarts
|
|
15
|
+
- **React 模板**: [react-custom-cmp-template](https://github.com/wibetter/react-custom-cmp-template)
|
|
16
|
+
- **React + TS 模板**: [react-ts-custom-cmp-template](https://github.com/wibetter/react-ts-custom-cmp-template) 内置信息卡片列表展示组件示例
|
|
17
|
+
- **Antd 模板**: [antd-custom-cmp-template](https://github.com/wibetter/antd-custom-cmp-template) 内置 Antd UI 组件实现的数据仪表板展示组件示例
|
|
18
|
+
- **Neo 模板**: [neo-custom-cmp-template](https://github.com/wibetter/neo-custom-cmp-template) 支持使用平台实体数据源(内置平台实体数据对象的增删改查示例组件)
|
|
19
|
+
- **Echarts 模板**: [echarts-custom-cmp-template](https://github.com/wibetter/echarts-custom-cmp-template) Echarts 图表自定义组件(含 高德地图展示组件示例)
|
|
20
20
|
- **Vue2 模板**: [vue2-custom-cmp-template](https://github.com/wibetter/vue2-custom-cmp-template) Vue2.0 自定义组件
|
|
21
21
|
|
|
22
22
|
## 快速开始
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { getUrlParam } from '../../utils/url';
|
|
2
3
|
import './style.scss';
|
|
3
4
|
|
|
4
5
|
// 扩展 Window 接口以支持 AMap
|
|
@@ -28,6 +29,7 @@ interface MapWidgetState {
|
|
|
28
29
|
isLoading: boolean;
|
|
29
30
|
error?: string;
|
|
30
31
|
currentAddress?: string;
|
|
32
|
+
urlLocationName?: string;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
/**
|
|
@@ -47,30 +49,33 @@ export default class MapWidget extends React.PureComponent<
|
|
|
47
49
|
|
|
48
50
|
private mapContainer: string = 'map-widget-container';
|
|
49
51
|
|
|
52
|
+
private locationName?: string = '';
|
|
53
|
+
|
|
50
54
|
constructor(props: MapWidgetProps) {
|
|
51
55
|
super(props);
|
|
56
|
+
|
|
52
57
|
this.state = {
|
|
53
|
-
isLoading:
|
|
58
|
+
isLoading: false,
|
|
54
59
|
error: undefined,
|
|
55
60
|
currentAddress: '',
|
|
61
|
+
urlLocationName: getUrlParam('location') || props.locationName || '',
|
|
56
62
|
};
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
componentDidMount() {
|
|
60
66
|
this.loadAMapScript();
|
|
67
|
+
// 监听 URL 变化
|
|
68
|
+
window.addEventListener('popstate', this.handleUrlChange);
|
|
69
|
+
window.addEventListener('hashchange', this.handleUrlChange);
|
|
61
70
|
}
|
|
62
71
|
|
|
63
|
-
componentDidUpdate(
|
|
64
|
-
prevProps: Readonly<MapWidgetProps>,
|
|
65
|
-
prevState: Readonly<MapWidgetState>,
|
|
66
|
-
snapshot?: any,
|
|
67
|
-
): void {
|
|
72
|
+
componentDidUpdate(prevProps: Readonly<MapWidgetProps>): void {
|
|
68
73
|
const { longitude, latitude, locationName, zoom = 14 } = this.props;
|
|
69
74
|
const {
|
|
70
75
|
longitude: prevLongitude,
|
|
71
76
|
latitude: prevLatitude,
|
|
72
|
-
locationName: prevLocationName,
|
|
73
77
|
zoom: prevZoom = 14,
|
|
78
|
+
locationName: prevLocationName,
|
|
74
79
|
} = prevProps;
|
|
75
80
|
if (
|
|
76
81
|
longitude !== prevLongitude ||
|
|
@@ -78,17 +83,42 @@ export default class MapWidget extends React.PureComponent<
|
|
|
78
83
|
locationName !== prevLocationName ||
|
|
79
84
|
zoom !== prevZoom
|
|
80
85
|
) {
|
|
81
|
-
this.initMap();
|
|
86
|
+
this.initMap(locationName);
|
|
82
87
|
}
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
componentWillUnmount() {
|
|
91
|
+
// 移除 URL 监听器
|
|
92
|
+
window.removeEventListener('popstate', this.handleUrlChange);
|
|
93
|
+
window.removeEventListener('hashchange', this.handleUrlChange);
|
|
94
|
+
|
|
86
95
|
if (this.map) {
|
|
87
96
|
this.map.destroy();
|
|
88
97
|
this.map = null;
|
|
89
98
|
}
|
|
90
99
|
}
|
|
91
100
|
|
|
101
|
+
/**
|
|
102
|
+
* 处理 URL 变化事件
|
|
103
|
+
*/
|
|
104
|
+
handleUrlChange = () => {
|
|
105
|
+
const newLocationName = getUrlParam('location');
|
|
106
|
+
|
|
107
|
+
// 如果 URL 中的 location 参数发生变化,则重新初始化地图
|
|
108
|
+
if (newLocationName !== this.locationName) {
|
|
109
|
+
this.setState(
|
|
110
|
+
{
|
|
111
|
+
urlLocationName: newLocationName,
|
|
112
|
+
error: undefined,
|
|
113
|
+
},
|
|
114
|
+
() => {
|
|
115
|
+
// 重新初始化地图
|
|
116
|
+
this.initMap(newLocationName);
|
|
117
|
+
},
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
92
122
|
/**
|
|
93
123
|
* 动态加载高德地图脚本
|
|
94
124
|
*/
|
|
@@ -100,6 +130,10 @@ export default class MapWidget extends React.PureComponent<
|
|
|
100
130
|
return;
|
|
101
131
|
}
|
|
102
132
|
|
|
133
|
+
this.setState({
|
|
134
|
+
isLoading: true,
|
|
135
|
+
});
|
|
136
|
+
|
|
103
137
|
// 使用 NeoCRM 部署的高德地图脚本: 使用企业内部部署的高德地图脚本,无需单独申请 API Key
|
|
104
138
|
const scriptUrl = 'https://neors.ingageapp.com/base/js/amap_2.0.5.21.js';
|
|
105
139
|
// 备用方案:使用高德官方API(需要申请key)
|
|
@@ -114,6 +148,10 @@ export default class MapWidget extends React.PureComponent<
|
|
|
114
148
|
script.onload = () => {
|
|
115
149
|
this.AMap = window.AMap;
|
|
116
150
|
this.initMap();
|
|
151
|
+
|
|
152
|
+
this.setState({
|
|
153
|
+
isLoading: false,
|
|
154
|
+
});
|
|
117
155
|
};
|
|
118
156
|
|
|
119
157
|
script.onerror = () => {
|
|
@@ -129,12 +167,18 @@ export default class MapWidget extends React.PureComponent<
|
|
|
129
167
|
/**
|
|
130
168
|
* 初始化地图
|
|
131
169
|
*/
|
|
132
|
-
initMap = () => {
|
|
170
|
+
initMap = (_locationName?: string) => {
|
|
133
171
|
const { longitude, latitude, locationName, zoom = 14 } = this.props;
|
|
172
|
+
const { urlLocationName } = this.state;
|
|
173
|
+
|
|
174
|
+
// 优先使用 URL 中的 location 参数
|
|
175
|
+
const finalLocationName = _locationName || urlLocationName || locationName;
|
|
134
176
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
177
|
+
this.locationName = finalLocationName;
|
|
178
|
+
|
|
179
|
+
// 如果提供了位置名称(URL 或 props),先进行地理编码
|
|
180
|
+
if (finalLocationName) {
|
|
181
|
+
this.geocodeAddress(finalLocationName, zoom);
|
|
138
182
|
}
|
|
139
183
|
// 如果提供了经纬度,直接初始化地图
|
|
140
184
|
else if (longitude !== undefined && latitude !== undefined) {
|
|
@@ -167,7 +211,6 @@ export default class MapWidget extends React.PureComponent<
|
|
|
167
211
|
});
|
|
168
212
|
} else {
|
|
169
213
|
this.setState({
|
|
170
|
-
isLoading: false,
|
|
171
214
|
error: `地址解析失败: ${address}`,
|
|
172
215
|
});
|
|
173
216
|
// 使用默认位置
|
|
@@ -199,14 +242,9 @@ export default class MapWidget extends React.PureComponent<
|
|
|
199
242
|
|
|
200
243
|
// 获取当前位置的地址信息
|
|
201
244
|
this.getAddressByLocation(center);
|
|
202
|
-
|
|
203
|
-
this.setState({
|
|
204
|
-
isLoading: false,
|
|
205
|
-
});
|
|
206
245
|
} catch (error) {
|
|
207
246
|
console.log('地图初始化失败 / error:', error);
|
|
208
247
|
this.setState({
|
|
209
|
-
isLoading: false,
|
|
210
248
|
error: '地图初始化失败',
|
|
211
249
|
});
|
|
212
250
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取URL参数
|
|
3
|
+
* @returns
|
|
4
|
+
*/
|
|
5
|
+
export function getUrlParams() {
|
|
6
|
+
const urlParams: { [key: string]: string } = {};
|
|
7
|
+
let url = window.location.href;
|
|
8
|
+
if (url.indexOf('?') !== -1) {
|
|
9
|
+
url = url.substring(url.indexOf('?') + 1, url.length);
|
|
10
|
+
const urlArr = url.split('&');
|
|
11
|
+
for (let i = 0, size = urlArr.length; i < size; i++) {
|
|
12
|
+
const urlArrItem = urlArr[i].split('=');
|
|
13
|
+
// 对参数值进行 URL 解码,避免中文字符串乱码
|
|
14
|
+
urlParams[urlArrItem[0]] = urlArrItem[1]
|
|
15
|
+
? decodeURIComponent(urlArrItem[1])
|
|
16
|
+
: '';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return urlParams;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 从URL参数中提取指定的字段数值
|
|
24
|
+
* @param paramName 参数名称
|
|
25
|
+
* @param defaultValue 默认值
|
|
26
|
+
* @returns 参数值或默认值
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // 从当前页面URL提取debug参数
|
|
30
|
+
* const debug = getUrlParam('debug', false)
|
|
31
|
+
*
|
|
32
|
+
* // 提取数字参数
|
|
33
|
+
* const page = getUrlParam('page', 1)
|
|
34
|
+
*
|
|
35
|
+
* // 提取字符串参数
|
|
36
|
+
* const mode = getUrlParam('mode', 'production')
|
|
37
|
+
*/
|
|
38
|
+
export function getUrlParam(paramName: string, defaultValue: any = null): any {
|
|
39
|
+
const urlParams = getUrlParams();
|
|
40
|
+
const paramValue = urlParams[paramName];
|
|
41
|
+
|
|
42
|
+
// 尝试转换数据类型
|
|
43
|
+
if (paramValue === 'true') return true;
|
|
44
|
+
if (paramValue === 'false') return false;
|
|
45
|
+
if (paramValue === 'null') return null;
|
|
46
|
+
if (paramValue === 'undefined') return undefined;
|
|
47
|
+
|
|
48
|
+
// 尝试转换为数字
|
|
49
|
+
const numValue = Number(paramValue);
|
|
50
|
+
if (!isNaN(numValue) && isFinite(numValue)) {
|
|
51
|
+
return numValue;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return paramValue ?? defaultValue;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 从URL参数中提取多个字段数值
|
|
59
|
+
* @param params 参数配置对象,键为参数名,值为默认值
|
|
60
|
+
* @param url 可选的URL字符串,默认使用当前页面URL
|
|
61
|
+
* @returns 包含所有参数值的对象
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* const params = getUrlParams({
|
|
65
|
+
* debug: false,
|
|
66
|
+
* mode: 'production',
|
|
67
|
+
* page: 1,
|
|
68
|
+
* theme: 'light'
|
|
69
|
+
* })
|
|
70
|
+
*/
|
|
71
|
+
export function getUrlParamsByKeys(
|
|
72
|
+
params: Record<string, any>,
|
|
73
|
+
url?: string,
|
|
74
|
+
): Record<string, any> {
|
|
75
|
+
const result: Record<string, any> = {};
|
|
76
|
+
|
|
77
|
+
for (const [paramName, defaultValue] of Object.entries(params)) {
|
|
78
|
+
result[paramName] = getUrlParam(paramName, defaultValue);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
@@ -80,8 +80,8 @@ module.exports = {
|
|
|
80
80
|
entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
|
|
81
81
|
// 外链调试(在线上页面设计器端预览自定义组件)
|
|
82
82
|
index: [
|
|
83
|
-
'./src/components/
|
|
84
|
-
'./src/components/
|
|
83
|
+
'./src/components/entity-form/register.ts',
|
|
84
|
+
'./src/components/entity-form/model.ts',
|
|
85
85
|
],
|
|
86
86
|
},
|
|
87
87
|
NODE_ENV: 'development',
|
|
@@ -105,8 +105,8 @@ module.exports = {
|
|
|
105
105
|
【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
|
|
106
106
|
NODE_ENV: 'production',
|
|
107
107
|
entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
|
|
108
|
-
InfoCardModel: './src/components/
|
|
109
|
-
infoCard: './src/components/
|
|
108
|
+
InfoCardModel: './src/components/entity-form/model.ts',
|
|
109
|
+
infoCard: './src/components/entity-form/register.ts'
|
|
110
110
|
},
|
|
111
111
|
cssExtract: false, // 不额外提取css文件
|
|
112
112
|
ossType: 'ali', // oss类型:ali、baidu
|
|
@@ -79,8 +79,8 @@ module.exports = {
|
|
|
79
79
|
entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
|
|
80
80
|
// 外链调试(在线上页面设计器端预览自定义组件)
|
|
81
81
|
index: [
|
|
82
|
-
'./src/components/
|
|
83
|
-
'./src/components/
|
|
82
|
+
'./src/components/list-widget/register.ts',
|
|
83
|
+
'./src/components/list-widget/model.ts',
|
|
84
84
|
],
|
|
85
85
|
},
|
|
86
86
|
NODE_ENV: 'development',
|
|
@@ -104,8 +104,8 @@ module.exports = {
|
|
|
104
104
|
【特别说明】以下配置项都自带默认值,非必填。如需自定义请自行配置。
|
|
105
105
|
NODE_ENV: 'production',
|
|
106
106
|
entry: { // 根据 src/components 目录下的文件自动生成 entry 相关配置
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
listWidgetModel: './src/components/list-widget/model.ts',
|
|
108
|
+
listWidget: './src/components/list-widget/register.ts'
|
|
109
109
|
},
|
|
110
110
|
cssExtract: false, // 不额外提取css文件
|
|
111
111
|
ossType: 'ali', // oss类型:ali、baidu
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-ts-custom-cmp-template",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "neo自定义组件模板(react&ts技术栈)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"自定义组件模板",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@commitlint/config-conventional": "^9.1.1",
|
|
47
47
|
"@types/react": "^16.9.11",
|
|
48
48
|
"@types/react-dom": "^16.9.15",
|
|
49
|
-
"neo-cmp-cli": "^1.3.
|
|
49
|
+
"neo-cmp-cli": "^1.3.8",
|
|
50
50
|
"husky": "^4.2.5",
|
|
51
51
|
"lint-staged": "^10.2.9",
|
|
52
52
|
"prettier": "^2.0.5"
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import './style.scss'; // 组件内容样式
|
|
3
|
-
|
|
4
|
-
interface InfoCardProps {
|
|
5
|
-
title: string;
|
|
6
|
-
backgroundImage: string;
|
|
7
|
-
imgCount: number;
|
|
8
|
-
commentCount: number;
|
|
9
|
-
data?: any;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default class InfoCard extends React.PureComponent<InfoCardProps> {
|
|
13
|
-
constructor(props: InfoCardProps) {
|
|
14
|
-
super(props);
|
|
15
|
-
this.agreeDataFormat = this.agreeDataFormat.bind(this);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
agreeDataFormat(agreeData: number) {
|
|
19
|
-
if (agreeData && agreeData <= 9999) {
|
|
20
|
-
return agreeData;
|
|
21
|
-
}
|
|
22
|
-
if (agreeData && agreeData > 9999) {
|
|
23
|
-
return `${Math.floor(agreeData / 1000) / 10}w`;
|
|
24
|
-
}
|
|
25
|
-
return '';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
render() {
|
|
29
|
-
const { title, backgroundImage, imgCount, commentCount } = this.props;
|
|
30
|
-
console.log('当前自定义组件:', this.props, this);
|
|
31
|
-
const curAmisData = this.props.data || {};
|
|
32
|
-
|
|
33
|
-
const userInfo = curAmisData.__NeoCurrentUser;
|
|
34
|
-
const systemInfo = curAmisData.__NeoSystemInfo || {};
|
|
35
|
-
|
|
36
|
-
const curBackgroundImage =
|
|
37
|
-
backgroundImage || 'https://neo-widgets.bj.bcebos.com/NeoCRM.jpg';
|
|
38
|
-
return (
|
|
39
|
-
<div className="info-card-container">
|
|
40
|
-
<div className="news-title">
|
|
41
|
-
{title ||
|
|
42
|
-
'营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。'}
|
|
43
|
-
{systemInfo.tenantName ? `【${systemInfo.tenantName}】` : ''}
|
|
44
|
-
</div>
|
|
45
|
-
<div className="item-imgbox">
|
|
46
|
-
{userInfo && userInfo.icon && (
|
|
47
|
-
<div className="user-info-box">
|
|
48
|
-
<img src={userInfo.icon} className="user-icon" />
|
|
49
|
-
<span className="user-name">{userInfo.name}</span>
|
|
50
|
-
</div>
|
|
51
|
-
)}
|
|
52
|
-
<div
|
|
53
|
-
className="news-img"
|
|
54
|
-
style={{ backgroundImage: `url(${curBackgroundImage})` }}
|
|
55
|
-
></div>
|
|
56
|
-
{imgCount > 0 && <div className="img-count">{imgCount}</div>}
|
|
57
|
-
</div>
|
|
58
|
-
<div className="news-info">
|
|
59
|
-
<div className="left media-mark">NeoCRM · 低代码平台</div>
|
|
60
|
-
{commentCount && commentCount > 0 && (
|
|
61
|
-
<div className="cmt-num right">
|
|
62
|
-
{this.agreeDataFormat(commentCount)}评
|
|
63
|
-
</div>
|
|
64
|
-
)}
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file 自定义组件对接编辑器的描述文件
|
|
3
|
-
*/
|
|
4
|
-
export class InfoCardModel {
|
|
5
|
-
/**
|
|
6
|
-
* cmpType 为自定义组件名称,用于标识组件的唯一性
|
|
7
|
-
* 在构建时根据当前组件目录名称自动生成
|
|
8
|
-
*/
|
|
9
|
-
// cmpType: string = 'info-card';
|
|
10
|
-
|
|
11
|
-
// 组件名称,用于设置在编辑器左侧组件面板中展示的名称
|
|
12
|
-
label: string = '信息卡片';
|
|
13
|
-
|
|
14
|
-
// 组件描述,用于设置在编辑器左侧组件面板中展示的描述
|
|
15
|
-
description: string = '信息展示卡片';
|
|
16
|
-
|
|
17
|
-
// 分类标签,用于设置在编辑器左侧组件面板哪个分类中展示(可设置多个分类标签)
|
|
18
|
-
tags: string[] = ['自定义组件'];
|
|
19
|
-
|
|
20
|
-
// 组件图标,用于设置在编辑器左侧组件面板中展示的图标
|
|
21
|
-
iconSrc: string = 'https://neo-widgets.bj.bcebos.com/custom-widget.svg';
|
|
22
|
-
// iconSrc = 'https://neo-widgets.bj.bcebos.com/favicon.png';
|
|
23
|
-
|
|
24
|
-
// 初次插入页面的默认属性数据
|
|
25
|
-
defaultComProps = {
|
|
26
|
-
title:
|
|
27
|
-
'营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。',
|
|
28
|
-
label: '信息卡片',
|
|
29
|
-
backgroundImage: 'https://neo-widgets.bj.bcebos.com/NeoCRM.jpg',
|
|
30
|
-
imgCount: 3,
|
|
31
|
-
commentCount: 2025,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
// 设计器端预览时展示的默认数据
|
|
35
|
-
previewComProps = {
|
|
36
|
-
label: '信息卡片',
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* 组件面板配置,用于生成编辑器右侧属性配置面板内容
|
|
41
|
-
*/
|
|
42
|
-
propsSchema = [
|
|
43
|
-
{
|
|
44
|
-
type: 'textarea',
|
|
45
|
-
name: 'title',
|
|
46
|
-
label: '卡片title',
|
|
47
|
-
value:
|
|
48
|
-
'营销服全场景智能CRM,帮助企业搭建数字化客户经营平台,实现业绩高质量增长。',
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
type: 'text',
|
|
52
|
-
name: 'backgroundImage',
|
|
53
|
-
label: '展示图片',
|
|
54
|
-
value: 'https://neo-widgets.bj.bcebos.com/NeoCRM.jpg',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
type: 'number',
|
|
58
|
-
name: 'imgCount',
|
|
59
|
-
label: '图片数量',
|
|
60
|
-
value: 3,
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
type: 'number',
|
|
64
|
-
name: 'commentCount',
|
|
65
|
-
label: '评论数',
|
|
66
|
-
value: 2025,
|
|
67
|
-
},
|
|
68
|
-
];
|
|
69
|
-
|
|
70
|
-
// 支持 函数式写法:propsSchemaCreator,com 为组件实例。优先级比 propsSchema 高
|
|
71
|
-
/*
|
|
72
|
-
propsSchemaCreator = (com: any) => {
|
|
73
|
-
return [];
|
|
74
|
-
};
|
|
75
|
-
*/
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export default InfoCardModel;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--padding-bottom: 12px;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.info-card-container {
|
|
6
|
-
position: relative;
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
|
|
9
|
-
/* border-bottom: 1px solid #ececec; */
|
|
10
|
-
margin: 6px 12px;
|
|
11
|
-
padding: 6px var(--padding-bottom);
|
|
12
|
-
background-color: #fff;
|
|
13
|
-
|
|
14
|
-
.news-title {
|
|
15
|
-
padding: 6px 0;
|
|
16
|
-
font-family: PingFangSC-Regular;
|
|
17
|
-
font-size: 16px;
|
|
18
|
-
line-height: 22px;
|
|
19
|
-
color: #5f5e5e;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.item-imgbox {
|
|
23
|
-
position: relative;
|
|
24
|
-
height: 395px;
|
|
25
|
-
background: #f0f0f0;
|
|
26
|
-
cursor: pointer;
|
|
27
|
-
box-sizing: border-box;
|
|
28
|
-
text-align: center;
|
|
29
|
-
overflow: hidden;
|
|
30
|
-
|
|
31
|
-
.news-img {
|
|
32
|
-
width: 100%;
|
|
33
|
-
height: 100%;
|
|
34
|
-
box-sizing: border-box;
|
|
35
|
-
background-size: contain;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.img-count {
|
|
39
|
-
position: absolute;
|
|
40
|
-
top: 0;
|
|
41
|
-
right: 0;
|
|
42
|
-
padding: 6px 8px;
|
|
43
|
-
color: #fff;
|
|
44
|
-
min-width: 60px;
|
|
45
|
-
text-align: center;
|
|
46
|
-
line-height: 1.2;
|
|
47
|
-
background: rgb(0 0 0 / 40%);
|
|
48
|
-
font-size: 25px;
|
|
49
|
-
box-sizing: border-box;
|
|
50
|
-
overflow: hidden;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.user-info-box {
|
|
54
|
-
position: absolute;
|
|
55
|
-
top: 10px;
|
|
56
|
-
left: 10px;
|
|
57
|
-
width: 100px;
|
|
58
|
-
min-height: 100px;
|
|
59
|
-
padding: 6px 8px;
|
|
60
|
-
color: #fff;
|
|
61
|
-
min-width: 60px;
|
|
62
|
-
text-align: center;
|
|
63
|
-
line-height: 1.2;
|
|
64
|
-
background: rgb(0 0 0 / 40%);
|
|
65
|
-
font-size: 25px;
|
|
66
|
-
box-sizing: border-box;
|
|
67
|
-
overflow: hidden;
|
|
68
|
-
display: flex;
|
|
69
|
-
flex-direction: column;
|
|
70
|
-
align-items: center;
|
|
71
|
-
justify-content: center;
|
|
72
|
-
|
|
73
|
-
.user-icon {
|
|
74
|
-
width: 64px;
|
|
75
|
-
height: 64px;
|
|
76
|
-
border-radius: 50%;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.user-name {
|
|
80
|
-
font-size: 16px;
|
|
81
|
-
font-weight: 600;
|
|
82
|
-
margin-top: 10px;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.news-info {
|
|
88
|
-
font-family: PingFangSC-Light;
|
|
89
|
-
height: 28px;
|
|
90
|
-
box-sizing: border-box;
|
|
91
|
-
display: flex;
|
|
92
|
-
justify-content: space-between;
|
|
93
|
-
align-items: center;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.media-mark,
|
|
97
|
-
.cmt-num {
|
|
98
|
-
display: inline-block;
|
|
99
|
-
height: 28px;
|
|
100
|
-
line-height: 28px;
|
|
101
|
-
font-family: PingFangSC-Light;
|
|
102
|
-
font-size: 18px;
|
|
103
|
-
color: #828282;
|
|
104
|
-
}
|
|
105
|
-
}
|