快速开始
环境要求
- Node.js >= 18
- npm >= 9 或 pnpm >= 8
- Git
安装
克隆仓库
bash
git clone https://github.com/gitcoffee-os/solinkcrm.git
cd solinkcrm安装依赖
bash
npm install
# 或
pnpm install开发
启动开发服务器
bash
npm run dev
# 或
pnpm dev开发服务器启动后,访问 http://localhost:3000 即可预览。
构建生产版本
bash
npm run build
# 或
pnpm build构建产物将输出到 dist 目录。
项目结构
solinkcrm/
├── apps/ # 应用目录
│ ├── mobile/ # 移动端应用
│ ├── desktop/ # 桌面端应用
│ ├── web/ # Web 端应用
│ └── miniapp/ # 小程序
├── packages/ # 共享包
│ ├── ui/ # UI 组件库
│ ├── sdk/ # CRM SDK
│ └── shared/ # 共享工具
├── server/ # 服务端
│ ├── gateway/ # 网关服务
│ ├── crm/ # CRM 核心服务
│ └── ai/ # AI 智能引擎
├── docs/ # 文档
└── scripts/ # 脚本配置说明
基础配置
在项目根目录创建 .env 文件:
env
# 服务端地址
VITE_API_BASE_URL=http://localhost:8080
# WebSocket 地址
VITE_WS_URL=ws://localhost:8080/ws
# 应用名称
VITE_APP_NAME=SolinkCRM多端配置
移动端
env
# apps/mobile/.env
VITE_PLATFORM=mobile
VITE_ENABLE_PUSH=true
VITE_PUSH_APP_KEY=your_push_key桌面端
env
# apps/desktop/.env
VITE_PLATFORM=desktop
VITE_ENABLE_SHORTCUT=trueWeb 端
env
# apps/web/.env
VITE_PLATFORM=web
VITE_ENABLE_PWA=true使用示例
初始化 SDK
typescript
import { CrmSDK } from '@solinkcrm/sdk'
const sdk = new CrmSDK({
apiBaseUrl: 'http://localhost:8080',
wsUrl: 'ws://localhost:8080/ws',
appKey: 'your_app_key'
})
await sdk.connect()线索管理
typescript
// 创建线索
await sdk.createLead({
name: '张三',
phone: '13800138000',
source: 'wechat',
tags: ['高意向', '科技行业']
})
// 查询线索
const leads = await sdk.queryLeads({
status: 'active',
source: 'wechat'
})客户管理
typescript
// 创建客户
await sdk.createCustomer({
name: '示例科技有限公司',
industry: '科技',
level: 'A',
contacts: [{ name: '李四', position: 'CTO' }]
})
// 获取客户画像
const profile = await sdk.getCustomerProfile('customer_id')AI 智能助手
typescript
// 线索评分
const score = await sdk.ai.scoreLead('lead_id')
// 获取跟进建议
const suggestion = await sdk.ai.getFollowUpSuggestion('customer_id')
// 客户洞察
const insight = await sdk.ai.getCustomerInsight('customer_id')常见问题
Q: 如何切换开发环境?
A: 使用 .env.development、.env.production 等文件来配置不同环境。
Q: 如何配置微信生态接入?
A: 在管理后台的「社交连接」模块中配置微信公众号、企业微信的 AppID 和 AppSecret。
Q: 如何自定义业务流程?
A: 在管理后台的「流程配置」模块中,支持自定义审批流程、跟进流程等。
Q: 如何接入 AI 大模型?
A: 在管理后台的「AI 资源管理」模块中,配置大模型供应商的 API Key 和模型参数。