Merge: 合并电子名片及新组件微信视频号

This commit is contained in:
2026-01-15 15:21:46 +08:00
parent ef32e31e59
commit 1914cc9958
16 changed files with 732 additions and 137 deletions

View File

@@ -24,4 +24,44 @@ create table if not exists lucky_diy_view_util
constraint name
unique (name)
)
```
```
## 页面设计及组件展示
- src\app\model\web\DiyView.php
- src\app\shop\view\diy\edit.html
- src\public\static\ext\diyview\js\components.js
## 如何添加新组件
### 1. 添加组件到数据表中
```sql
insert into lucky_diy_view_util (name, title, type, value, addon_name, sort, support_diy_view, max_count, is_delete, icon, icon_type)
values ('test', '测试', 'SYSTEM', '{"test": "test"}', '', 0, '', 0, 0, '', 0);
--- 微信视频号组件
-- 仅当WechatChannel不存在时添加记录
INSERT INTO lucky_diy_view_util (`name`, `title`, `type`, `value`, `addon_name`, `sort`, `support_diy_view`, `max_count`, `is_delete`, `icon`, `icon_type`)
SELECT 'WechatChannel', '微信视频号', 'SYSTEM', '{ "list": [{ "channelName":"", "finderUserName": "", "avatarImageType": "url", "avatarUrl": "", "videoTitle": "", "coverImageType": "url", "coverUrl": "", "feedId": "", "feedToken": "", "viewCount": 0, "showViewCount": true, "embedMode": false, "channelType":"wechat" }], "rowCount": 2, "showStyle": "fixed", "aspectRatio":"16:9", "titleLineClamp": 1, "showPlayBtn": true}', '', 100110, '', 0, 0, '/public/static/img/svg/xuanxiangka.svg', 0
WHERE NOT EXISTS (
SELECT 1 FROM lucky_diy_view_util WHERE name = 'WechatChannel'
);
```
### 2. 建立组件的控制器
`src\app\component\controller` 目录下创建对应的控制器文件,处理组件的业务逻辑。
例如:创建 `src\app\component\controller\TestController.php` 文件,用于处理测试组件的业务逻辑。
### 3. 建立组件的视图
在 src\app\component\view 目录下创建对应的视图文件,处理组件的前端展示。
例如:创建 `src\app\component\view\test.php` 文件,用于展示测试组件。
### 4. 在前端页面中使用组件
在前端页面中使用组件,需要在页面中添加对应的组件标签。