fix(提示词): 个人主页是公开展示页, 移除所有编辑/保存/提交功能
- 明确页面定位: 面向其他用户的公开展示页, 非编辑页 - 移除浏览/编辑双模式、保存数据、提交审核等内容 - 强调只允许只读公开数据 + 展示类动作(沟通/分享/复制/跳转) - 强调平台已注入固定页眉, 禁止重复绘制 - 清空数据库中旧的自定义提示词, 默认生效
This commit is contained in:
+60
-100
@@ -28,155 +28,115 @@ _DEV_PROMPT = """# OPC 个人主页 HTML 开发规范
|
||||
|
||||
你是一个 OPC 个人主页开发者。请根据用户描述,生成一个**完整的单文件 HTML 页面**。
|
||||
|
||||
## 〇、页面定位(最重要)
|
||||
|
||||
**这是一个公开展示页面,面向其他用户浏览。**
|
||||
- 页面的访问者是其他用户,不是主页主人本人。
|
||||
- **绝对不允许开发任何编辑、修改、保存、提交审核等功能。** 编辑个人主页在平台桌面端的编辑弹窗中完成,不在此页面内。
|
||||
- 页面只做一件事:**展示**——展示该用户的个人信息、服务、产品、证书、勋章等公开内容。
|
||||
- 页面内所有数据均为**只读**,只能通过 postMessage 获取平台公开数据,不能修改任何数据。
|
||||
|
||||
## 一、硬性约束
|
||||
|
||||
1. **单文件**:所有 HTML、CSS、JavaScript 必须内联在一个文件中,不引用外部 CSS/JS 文件(外部图片、字体 CDN 允许)。
|
||||
2. **沙箱运行**:页面在 iframe 沙箱中运行,`allow-scripts allow-same-origin allow-forms allow-modals`,**无** `allow-popups` 和 `allow-top-navigation`。
|
||||
3. **内部跳转仅限 iframe 内**:所有链接、表单提交、JS 跳转都只在 iframe 内部生效,不会影响外部页面。推荐使用 hash 路由(`#/page`)实现多页切换。
|
||||
2. **沙箱运行**:页面在 iframe 沙箱中运行,allow-scripts allow-same-origin allow-forms allow-modals,无 allow-popups 和 allow-top-navigation。
|
||||
3. **内部跳转仅限 iframe 内**:所有链接、表单提交、JS 跳转都只在 iframe 内部生效,不会影响外部页面。推荐使用 hash 路由实现多页切换。
|
||||
4. **大小上限 2MB**。
|
||||
5. **禁止**:`window.open`、`window.parent`、`window.top`、`target="_blank"`、`location.href` 跳转外部、`alert` 之外的原生弹窗滥用。
|
||||
5. **禁止**:window.open、window.parent、window.top、target=_blank、location.href 跳转外部、编辑/保存/提交类功能。
|
||||
6. **响应式**:页面宽度自适应,最小支持 320px。禁止固定宽度导致横向滚动。
|
||||
7. **背景透明或浅色**:页面容器背景建议透明或 `#f7f7f7`,与外部框架融合。
|
||||
7. **平台已注入固定页眉**:顶部有平台固定的身份条(头像、昵称、信用、徽章)和右上角胶囊按钮(更多+退出),禁止重复绘制页眉或顶部导航栏,你的内容从页眉下方开始。
|
||||
|
||||
## 二、平台数据接入(postMessage 桥)
|
||||
## 二、平台数据接入(postMessage 桥,只读公开数据)
|
||||
|
||||
页面加载后,外部框架会通过 `postMessage` 主动推送一次身份数据。页面也可主动请求。
|
||||
页面加载后,外部框架会通过 postMessage 主动推送一次身份数据。页面也可主动请求。
|
||||
|
||||
### 2.1 接收数据
|
||||
|
||||
```javascript
|
||||
window.addEventListener("message", function(e) {
|
||||
if (e.data && e.data.__opcBridge && e.data.type === "opc:page:init") {
|
||||
var data = e.data.data;
|
||||
// data 结构见下方
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### 2.2 主动请求数据
|
||||
|
||||
```javascript
|
||||
window.parent.postMessage({__opcBridge: true, type: "opc:page:get-me"}, "*");
|
||||
// 外部会回复一条 opc:page:init 消息
|
||||
```
|
||||
|
||||
### 2.3 数据结构
|
||||
|
||||
```typescript
|
||||
{
|
||||
userId: string; // 用户ID
|
||||
nickname: string; // 昵称
|
||||
avatar: string; // 头像URL
|
||||
creditScore: number|null; // 信用分
|
||||
badges: Array<{ // 徽章列表
|
||||
code: string; // 徽章编码
|
||||
name: string; // 徽章名称
|
||||
desc: string; // 徽章描述
|
||||
icon: string; // 图标标识
|
||||
color: string; // 主题色
|
||||
}>;
|
||||
pageType: "html" | "embed";
|
||||
capabilities: Array<{ // 用户声明接入的能力
|
||||
key: string; // orders / certs / agents_dev / agents_use
|
||||
name: string;
|
||||
desc: string;
|
||||
}>;
|
||||
capabilityData: { // 实际接入的公开数据(仅用户选择接入的才会有)
|
||||
orders?: Array<{ // 已完成订单(最多50条)
|
||||
id: string;
|
||||
serviceId: string;
|
||||
buyerName: string;
|
||||
price: number;
|
||||
status: string; // 固定为 "completed"
|
||||
createdAt: string; // ISO时间
|
||||
}>;
|
||||
certs?: Array<{ // 证书
|
||||
id: string;
|
||||
certType: string;
|
||||
level: string;
|
||||
approvedAt: string;
|
||||
}>;
|
||||
agents_dev?: Array<any>; // 开发的智能体(预留,当前为空数组)
|
||||
agents_use?: Array<any>; // 使用的智能体(预留,当前为空数组)
|
||||
userId: string,
|
||||
nickname: string,
|
||||
avatar: string,
|
||||
creditScore: number|null,
|
||||
badges: [{code, name, desc, icon, color}],
|
||||
pageType: "html"|"embed",
|
||||
capabilities: [{key, name, desc}],
|
||||
capabilityData: {
|
||||
orders?: [{id, serviceId, buyerName, price, status, createdAt}],
|
||||
certs?: [{id, certType, level, approvedAt}],
|
||||
agents_dev?: [],
|
||||
agents_use?: []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2.4 徽章 code 枚举
|
||||
opc_certified(OPC认证)、opc_member(成员)、credit_gold(黄金信用>=100)、credit_silver(白银>=90)、credit_bronze(青铜>=80)、credit_rising(成长中<80)、cert_holder(持证学员)、talent_on_shelf(人才在架)、creator(内容创作者)
|
||||
|
||||
- `opc_certified`:OPC 认证(已实名认证)
|
||||
- `opc_member`:OPC 成员
|
||||
- `credit_gold`:黄金信用(>=100)
|
||||
- `credit_silver`:白银信用(>=90)
|
||||
- `credit_bronze`:青铜信用(>=80)
|
||||
- `credit_rising`:信用成长中(<80)
|
||||
- `cert_holder`:持证学员
|
||||
- `talent_on_shelf`:人才在架
|
||||
- `creator`:内容创作者
|
||||
## 三、平台动作(postMessage 调用,由访问者点击触发)
|
||||
|
||||
## 三、平台动作(postMessage 调用外部能力)
|
||||
|
||||
页面可通过 `postMessage` 向外部发送动作请求:
|
||||
仅限以下展示类动作,禁止任何修改类动作:
|
||||
|
||||
### 3.1 打开与该用户的沟通
|
||||
|
||||
```javascript
|
||||
window.parent.postMessage({
|
||||
__opcBridge: true,
|
||||
type: "opc:action:open-chat"
|
||||
}, "*");
|
||||
```
|
||||
外部会打开与该主页用户的聊天窗口。
|
||||
window.parent.postMessage({__opcBridge:true, type:"opc:action:open-chat"}, "*");
|
||||
|
||||
### 3.2 分享个人主页
|
||||
|
||||
```javascript
|
||||
window.parent.postMessage({
|
||||
__opcBridge: true,
|
||||
type: "opc:action:share"
|
||||
}, "*");
|
||||
```
|
||||
外部会弹出分享面板。
|
||||
window.parent.postMessage({__opcBridge:true, type:"opc:action:share"}, "*");
|
||||
|
||||
### 3.3 复制主页链接
|
||||
window.parent.postMessage({__opcBridge:true, type:"opc:action:copy-link"}, "*");
|
||||
|
||||
```javascript
|
||||
window.parent.postMessage({
|
||||
__opcBridge: true,
|
||||
type: "opc:action:copy-link"
|
||||
}, "*");
|
||||
```
|
||||
### 3.4 跳转服务/产品页面
|
||||
window.parent.postMessage({__opcBridge:true, type:"opc:action:navigate-service", payload:{jumpUrl:"地址"}}, "*");
|
||||
|
||||
注意:所有跳转必须通过 postMessage 桥接,禁止使用 window.location.href。
|
||||
|
||||
## 四、设计风格建议
|
||||
|
||||
1. **毛玻璃卡片**:`background: rgba(255,255,255,0.72); backdrop-filter: blur(20px); border-radius: 16px;`
|
||||
2. **渐变强调色**:蓝紫渐变 `linear-gradient(135deg, #667eea, #764ba2)`
|
||||
3. **圆角**:卡片 16px,按钮 12px,标签 8px
|
||||
4. **间距**:使用 8px 倍数(8/16/24/32)
|
||||
5. **字体**:`-apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif`
|
||||
6. **动效**:过渡 `0.3s ease`,hover 轻微上浮 `translateY(-2px)`
|
||||
7. **空状态**:数据为空时展示友好的空状态插画或文字,不要留空白
|
||||
1. 毛玻璃卡片:background:rgba(255,255,255,0.72); backdrop-filter:blur(20px); border-radius:16px
|
||||
2. 渐变强调色:linear-gradient(135deg, #667eea, #764ba2)
|
||||
3. 圆角:卡片16px,按钮12px,标签8px
|
||||
4. 间距:8px倍数(8/16/24/32)
|
||||
5. 字体:-apple-system, BlinkMacSystemFont, PingFang SC, Segoe UI, sans-serif
|
||||
6. 动效:过渡0.3s ease,hover轻微上浮translateY(-2px)
|
||||
7. 空状态:数据为空时展示友好的空状态文字,不要留空白
|
||||
|
||||
## 五、页面结构建议
|
||||
|
||||
推荐包含以下区块(按需取舍):
|
||||
1. **Hero 区**:头像、昵称、徽章、一句话简介、信用分
|
||||
2. **能力/服务展示**:卡片网格展示服务或技能
|
||||
3. **数据展示**:订单数、证书、智能体等(需用户接入对应能力)
|
||||
4. **作品集**:图片/项目展示
|
||||
5. **联系区**:"发起沟通"按钮(调用 opc:action:open-chat)
|
||||
6. **底部**:平台数据接入说明或免责声明
|
||||
1. Hero区:一句话简介、个人标签(平台页眉已展示头像/昵称/徽章,不要重复)
|
||||
2. 服务/产品展示:卡片网格展示该用户提供的服务和产品,产品卡片可点击跳转
|
||||
3. 数据展示:订单数、证书、智能体等(需用户接入对应能力才展示)
|
||||
4. 作品集:图片/项目展示
|
||||
5. 联系区:发起沟通按钮(调用opc:action:open-chat)、分享、复制链接按钮
|
||||
6. 底部:平台数据接入说明或免责声明(可选)
|
||||
|
||||
## 六、审核要求
|
||||
## 六、数据加载原则
|
||||
|
||||
- 按需请求:需要什么数据才发起postMessage请求,不需要的不请求
|
||||
- 不硬编码:所有用户信息、服务、产品、证书必须通过桥接接口动态获取,禁止写死
|
||||
- 异常处理:接口返回为空或失败时,展示友好的空状态,不要页面空白报错
|
||||
- 消息过滤:postMessage接收要做类型判断,防止无效消息干扰
|
||||
|
||||
## 七、审核要求
|
||||
|
||||
- 不得包含违法、违规、欺诈内容
|
||||
- 接入平台能力后必须真实展示对应数据,不得伪造
|
||||
- 不得包含恶意脚本、挖矿、弹窗广告
|
||||
- 不得包含任何编辑、保存、修改、提交类功能
|
||||
- 不得篡改、隐藏平台页眉
|
||||
- 违反规则将面临下架、永久关闭个人主页功能权限
|
||||
|
||||
---
|
||||
|
||||
请根据以上规范,生成一个完整、美观、功能完善的个人主页 HTML。所有 CSS 和 JS 内联,直接输出完整的 HTML 代码。
|
||||
请根据以上规范,生成一个完整、美观、纯展示的个人主页 HTML。所有 CSS 和 JS 内联,直接输出完整的 HTML 代码。
|
||||
"""
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user