parent
3f1e51deaa
commit
897e62f898
@ -0,0 +1,69 @@
|
||||
Yes, you can add a badge number (or badge count) to your Progressive Web App (PWA). This feature allows you to display a numerical value or a small badge icon on the app's icon, typically on the device's home screen or app launcher. This can be useful for displaying notifications, unread counts, or other relevant information to the user.
|
||||
|
||||
To implement this feature in your PWA, you need to use the Web App Manifest file (manifest.json) and the Notifications API or the Badging API (if supported by the browser).
|
||||
|
||||
Here's a general approach:
|
||||
|
||||
1. **Web App Manifest**:
|
||||
In your manifest.json file, ensure that you have the `badges` member defined in the `icons` array. This specifies the purpose of the icon and allows you to set a badge count or a small monochrome icon.
|
||||
|
||||
```json
|
||||
{
|
||||
"icons": [
|
||||
{
|
||||
"src": "icon.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "any maskable"
|
||||
},
|
||||
{
|
||||
"src": "badge.png",
|
||||
"sizes": "48x48",
|
||||
"type": "image/png",
|
||||
"purpose": "badge"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
2. **Set Badge Count**:
|
||||
You can use the Badging API (if supported by the browser) to set the badge count. This API is available in modern browsers like Chrome, Firefox, and Edge.
|
||||
|
||||
```javascript
|
||||
navigator.setAppBadge(42).catch(error => {
|
||||
console.log('Failed to set badge:', error);
|
||||
});
|
||||
```
|
||||
|
||||
If the Badging API is not supported, you can use the Notifications API as a fallback to display the badge count as a notification.
|
||||
|
||||
```javascript
|
||||
const permission = await Notification.requestPermission();
|
||||
if (permission === 'granted') {
|
||||
const notification = new Notification('My App', {
|
||||
body: 'You have 42 new notifications',
|
||||
badge: 'badge.png',
|
||||
icon: 'icon.png',
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
3. **Clear Badge Count**:
|
||||
To clear the badge count, you can use the `clearAppBadge()` method of the Badging API or clear the notification using the Notifications API.
|
||||
|
||||
```javascript
|
||||
navigator.clearAppBadge().catch(error => {
|
||||
console.log('Failed to clear badge:', error);
|
||||
});
|
||||
```
|
||||
|
||||
Or, for the Notifications API:
|
||||
|
||||
```javascript
|
||||
// Close the notification to clear the badge
|
||||
notification.close();
|
||||
```
|
||||
|
||||
Keep in mind that the Badging API and the Notifications API have varying levels of support across different browsers and platforms. You may need to implement fallback mechanisms or use third-party libraries to ensure cross-browser compatibility.
|
||||
|
||||
Additionally, some platforms (like iOS) have different requirements for displaying badge counts on PWA icons. You may need to follow platform-specific guidelines and use additional techniques to achieve the desired behavior.
|
@ -0,0 +1,57 @@
|
||||
---
|
||||
Created: 2023-09-09 Sat
|
||||
Updated: 2023-10-23 11:50 Mon
|
||||
---
|
||||
|
||||
## Kimkim
|
||||
|
||||
kimkim的描述:
|
||||
|
||||
- 顾问共享行程设计, 检索和重复使用, 创建副本, 重视个性化
|
||||
- 用户信息自动应用, 减少复制粘贴和输入错误
|
||||
- 行程设计: 固定的日期模板
|
||||
- 销售的最小单位: Activity
|
||||
- 积极跟踪
|
||||
- 移动端和PC端体验差异减小
|
||||
|
||||
顾问反馈:
|
||||
|
||||
- 不卡
|
||||
- 用户体验好, 操作流程清晰
|
||||
- 交互性好: 对报价的反馈; 删除内容, 控制预算
|
||||
- 数据统计: 服务量, 服务效率
|
||||
|
||||
## WhatsApp 数据获取备份和分析
|
||||
|
||||
- [Baileys](https://github.com/WhiskeySockets/Baileys)
|
||||
- 使用WhatsApp 多设备接口, 使同时登录以获取消息记录
|
||||
- 存储和分析以及其他需求自行开发
|
||||
- 免费
|
||||
- 有风险. 这个方法属于是WhatsApp的逆向工程\
|
||||
*WhatsApp要卖自己的商务服务, 按会话收费, 基于此的二次开发仓库都被要求删库, 社区目前还是积极的*
|
||||
- [WADesk](https://wadesk.io/)
|
||||
|
||||
## 客服系统
|
||||
|
||||
### 需求
|
||||
|
||||
- 促进即时通讯, 能够群聊
|
||||
- 管理沟通中的业务节点. 响应业务状态的变化
|
||||
- 结合业务节点, 方便快捷地帮助顾问
|
||||
- 希望达到Kim Kim那样, 在沟通中能迅速获取客户信息, 行程信息
|
||||
|
||||
对于自定业务的具体需求, 目前没有十分契合的供应商能够提供, 或者很贵
|
||||
|
||||
- WhatsApp官方api基于会话收费, 目前尚不支持群聊功能, 预计2024上半年开放
|
||||
- 开发费用
|
||||
|
||||
## 总结
|
||||
|
||||
1. 仅需获取WhatsApp沟通内容, 基于Baileys自主开发就行(与蜂巢原理一样). 或者继续使用蜂巢的服务
|
||||
- 消息记录存档
|
||||
- 对消息记录的数据分析.
|
||||
2. 客服系统
|
||||
- 仅作沟通工具, 不嵌入业务: 保持目前的流程, 上述[1]
|
||||
- 需要深入地辅助业务, 逐步达到取代邮件, 完全基于实际业务开发的客服系统
|
||||
- 扩展: 除了WhatsApp之外, 接入其他IM渠道
|
||||
- 选择社区框架还是官方接口?
|
@ -0,0 +1,6 @@
|
||||
#### 推送时间间隔
|
||||
1. 0s
|
||||
2. +20s
|
||||
3. +5min + 10s
|
||||
4. +30min + 10s
|
||||
5. +60min
|
@ -0,0 +1,8 @@
|
||||
|
||||
## 项目目标和成果
|
||||
### 三个目标
|
||||
## 项目过程和管理
|
||||
|
||||
## 技术实施和挑战
|
||||
|
||||
## 改进和优化
|
Loading…
Reference in New Issue