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