|
|
|
@ -28,21 +28,21 @@ class _ChatTypePageState extends State<ChatTypePage> {
|
|
|
|
|
elevation: 0,
|
|
|
|
|
),
|
|
|
|
|
body: ListView(
|
|
|
|
|
children: ListTile.divideTiles(
|
|
|
|
|
context: context,
|
|
|
|
|
tiles: [
|
|
|
|
|
children: ListTile.divideTiles(context: context, tiles: [
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text('技能组客服'),
|
|
|
|
|
trailing: Icon(Icons.keyboard_arrow_right),
|
|
|
|
|
onTap: () {
|
|
|
|
|
BytedeskKefu.startWorkGroupChat(context, _workGroupWid, "技能组客服-默认人工");
|
|
|
|
|
BytedeskKefu.startWorkGroupChat(
|
|
|
|
|
context, _workGroupWid, "技能组客服-默认人工");
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text('技能组客服-机器人'),
|
|
|
|
|
trailing: Icon(Icons.keyboard_arrow_right),
|
|
|
|
|
onTap: () {
|
|
|
|
|
BytedeskKefu.startWorkGroupChat(context, _workGroupWidRobot, "技能组客服-默认机器人");
|
|
|
|
|
BytedeskKefu.startWorkGroupChat(
|
|
|
|
|
context, _workGroupWidRobot, "技能组客服-默认机器人");
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
ListTile(
|
|
|
|
@ -50,25 +50,60 @@ class _ChatTypePageState extends State<ChatTypePage> {
|
|
|
|
|
trailing: Icon(Icons.keyboard_arrow_right),
|
|
|
|
|
onTap: () {
|
|
|
|
|
// 商品信息,type/title/content/price/url/imageUrl/id/categoryCode
|
|
|
|
|
// 注意:长度不能大于500字符
|
|
|
|
|
var custom = json.encode({
|
|
|
|
|
"type": BytedeskConstants.MESSAGE_TYPE_COMMODITY,
|
|
|
|
|
"title": "商品标题",
|
|
|
|
|
"content": "商品详情",
|
|
|
|
|
"price": "9.99",
|
|
|
|
|
"url": "https://item.m.jd.com/product/12172344.html",
|
|
|
|
|
"imageUrl": "https://bytedesk.oss-cn-shenzhen.aliyuncs.com/images/123.webp",
|
|
|
|
|
"id": 123,
|
|
|
|
|
"categoryCode": "100010003",
|
|
|
|
|
"client": "flutter"
|
|
|
|
|
"type": BytedeskConstants.MESSAGE_TYPE_COMMODITY, // 不能修改
|
|
|
|
|
"title": "商品标题", // 可自定义, 类型为字符串
|
|
|
|
|
"content": "商品详情", // 可自定义, 类型为字符串
|
|
|
|
|
"price": "9.99", // 可自定义, 类型为字符串
|
|
|
|
|
"url":
|
|
|
|
|
"https://item.m.jd.com/product/12172344.html", // 必须为url网址, 类型为字符串
|
|
|
|
|
"imageUrl":
|
|
|
|
|
"https://bytedesk.oss-cn-shenzhen.aliyuncs.com/images/123.webp", //必须为图片网址, 类型为字符串
|
|
|
|
|
"id": 123, // 可自定义
|
|
|
|
|
"categoryCode": "100010003", // 可自定义, 类型为字符串
|
|
|
|
|
"client": "flutter" // 可自定义, 类型为字符串
|
|
|
|
|
});
|
|
|
|
|
BytedeskKefu.startWorkGroupChatShop(
|
|
|
|
|
context, _workGroupWid, "技能组客服-电商", custom);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text('技能组客服-电商-回调'),
|
|
|
|
|
trailing: Icon(Icons.keyboard_arrow_right),
|
|
|
|
|
onTap: () {
|
|
|
|
|
// 商品信息,type/title/content/price/url/imageUrl/id/categoryCode
|
|
|
|
|
// 注意:长度不能大于500字符
|
|
|
|
|
var custom = json.encode({
|
|
|
|
|
"type": BytedeskConstants.MESSAGE_TYPE_COMMODITY, // 不能修改
|
|
|
|
|
"title": "商品标题", // 可自定义, 类型为字符串
|
|
|
|
|
"content": "商品详情", // 可自定义, 类型为字符串
|
|
|
|
|
"price": "9.99", // 可自定义, 类型为字符串
|
|
|
|
|
"url":
|
|
|
|
|
"https://item.m.jd.com/product/12172344.html", // 必须为url网址, 类型为字符串
|
|
|
|
|
"imageUrl":
|
|
|
|
|
"https://bytedesk.oss-cn-shenzhen.aliyuncs.com/images/123.webp", //必须为图片网址, 类型为字符串
|
|
|
|
|
"id": 123, // 可自定义
|
|
|
|
|
"categoryCode": "100010003", // 可自定义, 类型为字符串
|
|
|
|
|
"client": "flutter", // 可自定义, 类型为字符串
|
|
|
|
|
// 可自定义添加key:value, 客服端不可见,可用于回调原样返回
|
|
|
|
|
"other1": "", // 可另外添加自定义字段,客服端不可见,可用于回调原样返回
|
|
|
|
|
"other2": "", // 可另外添加自定义字段,客服端不可见,可用于回调原样返回
|
|
|
|
|
"other3": "", // 可另外添加自定义字段,客服端不可见,可用于回调原样返回
|
|
|
|
|
});
|
|
|
|
|
BytedeskKefu.startWorkGroupChatShopCallback(
|
|
|
|
|
context, _workGroupWid, "技能组客服-电商-回调", custom, (value) {
|
|
|
|
|
print('value为custom参数原样返回 $value');
|
|
|
|
|
// 主要用途:用户在聊天页面点击商品消息,回调此接口,开发者可在此打开进入商品详情页
|
|
|
|
|
});
|
|
|
|
|
BytedeskKefu.startWorkGroupChatShop(context, _workGroupWid, "技能组客服-电商", custom);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text('技能组客服-附言'),
|
|
|
|
|
trailing: Icon(Icons.keyboard_arrow_right),
|
|
|
|
|
onTap: () {
|
|
|
|
|
BytedeskKefu.startWorkGroupChatPostscript(context, _workGroupWid, "技能组客服-附言", "随便说点什么吧,我会自动发送给客服");
|
|
|
|
|
BytedeskKefu.startWorkGroupChatPostscript(
|
|
|
|
|
context, _workGroupWid, "技能组客服-附言", "随便说点什么吧,我会自动发送给客服");
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
@ -78,7 +113,7 @@ class _ChatTypePageState extends State<ChatTypePage> {
|
|
|
|
|
title: Text('指定一对一客服'),
|
|
|
|
|
trailing: Icon(Icons.keyboard_arrow_right),
|
|
|
|
|
onTap: () {
|
|
|
|
|
BytedeskKefu.startAppointedChat(context, _agentUid, "指定客服");
|
|
|
|
|
BytedeskKefu.startAppointedChat(context, _agentUid, "指定一对一客服");
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
ListTile(
|
|
|
|
@ -86,25 +121,58 @@ class _ChatTypePageState extends State<ChatTypePage> {
|
|
|
|
|
trailing: Icon(Icons.keyboard_arrow_right),
|
|
|
|
|
onTap: () {
|
|
|
|
|
// 商品信息,type/title/content/price/url/imageUrl/id/categoryCode
|
|
|
|
|
// 注意:长度不能大于500字符
|
|
|
|
|
var custom = json.encode({
|
|
|
|
|
"type": BytedeskConstants.MESSAGE_TYPE_COMMODITY,
|
|
|
|
|
"title": "商品标题",
|
|
|
|
|
"content": "商品详情",
|
|
|
|
|
"price": "9.99",
|
|
|
|
|
"url": "https://item.m.jd.com/product/12172344.html",
|
|
|
|
|
"imageUrl": "https://bytedesk.oss-cn-shenzhen.aliyuncs.com/images/123.webp",
|
|
|
|
|
"imageUrl":
|
|
|
|
|
"https://bytedesk.oss-cn-shenzhen.aliyuncs.com/images/123.webp",
|
|
|
|
|
"id": 123,
|
|
|
|
|
"categoryCode": "100010003",
|
|
|
|
|
"client": "flutter"
|
|
|
|
|
});
|
|
|
|
|
BytedeskKefu.startAppointedChatShop(context, _agentUid, "指定客服", custom);
|
|
|
|
|
BytedeskKefu.startAppointedChatShop(
|
|
|
|
|
context, _agentUid, "指定一对一客服-电商", custom);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text('指定一对一客服-电商-回调'),
|
|
|
|
|
trailing: Icon(Icons.keyboard_arrow_right),
|
|
|
|
|
onTap: () {
|
|
|
|
|
// 商品信息,type/title/content/price/url/imageUrl/id/categoryCode
|
|
|
|
|
// 注意:长度不能大于500字符
|
|
|
|
|
var custom = json.encode({
|
|
|
|
|
"type": BytedeskConstants.MESSAGE_TYPE_COMMODITY,
|
|
|
|
|
"title": "商品标题",
|
|
|
|
|
"content": "商品详情",
|
|
|
|
|
"price": "9.99",
|
|
|
|
|
"url": "https://item.m.jd.com/product/12172344.html",
|
|
|
|
|
"imageUrl":
|
|
|
|
|
"https://bytedesk.oss-cn-shenzhen.aliyuncs.com/images/123.webp",
|
|
|
|
|
"id": 123,
|
|
|
|
|
"categoryCode": "100010003",
|
|
|
|
|
"client": "flutter",
|
|
|
|
|
// 可自定义添加key:value, 客服端不可见,可用于回调原样返回
|
|
|
|
|
"other1": "", // 可另外添加自定义字段,客服端不可见,可用于回调原样返回
|
|
|
|
|
"other2": "", // 可另外添加自定义字段,客服端不可见,可用于回调原样返回
|
|
|
|
|
"other3": "", // 可另外添加自定义字段,客服端不可见,可用于回调原样返回
|
|
|
|
|
});
|
|
|
|
|
BytedeskKefu.startAppointedChatShopCallback(
|
|
|
|
|
context, _agentUid, "指定一对一客服-电商-回调", custom, (value) {
|
|
|
|
|
print('value为custom参数原样返回 $value');
|
|
|
|
|
// 主要用途:用户在聊天页面点击商品消息,回调此接口,开发者可在此打开进入商品详情页
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
ListTile(
|
|
|
|
|
title: Text('指定一对一客服-附言'),
|
|
|
|
|
trailing: Icon(Icons.keyboard_arrow_right),
|
|
|
|
|
onTap: () {
|
|
|
|
|
BytedeskKefu.startAppointedChatPostscript(context, _agentUid, "指定客服", "随便说点什么吧,我会自动发送给客服");
|
|
|
|
|
BytedeskKefu.startAppointedChatPostscript(
|
|
|
|
|
context, _agentUid, "指定一对一客服-附言", "随便说点什么吧,我会自动发送给客服");
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
@ -116,13 +184,13 @@ class _ChatTypePageState extends State<ChatTypePage> {
|
|
|
|
|
onTap: () {
|
|
|
|
|
print('h5 chat');
|
|
|
|
|
// 注意: 登录后台->客服管理->技能组(或客服账号)->获取客服代码 获取相应URL
|
|
|
|
|
String url = "http://www.bytedesk.com/chat?sub=vip&uid=201808221551193&wid=201807171659201&type=workGroup&aid=&hidenav=1&ph=ph";
|
|
|
|
|
String url =
|
|
|
|
|
"http://www.bytedesk.com/chat?sub=vip&uid=201808221551193&wid=201807171659201&type=workGroup&aid=&hidenav=1&ph=ph";
|
|
|
|
|
String title = 'H5在线客服演示';
|
|
|
|
|
BytedeskKefu.startH5Chat(context, url, title);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
).toList(),
|
|
|
|
|
]).toList(),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|