Commit da6b7ae2 authored by lujunye's avatar lujunye

sadfsafdsafsadfsdfafd

parent b5bd873f
......@@ -206,7 +206,9 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
print("页面加载完成...")
webView.takeScreenshotOfFullContent { (img) in
let imgV = UIImageView(frame: CGRect(x: 0, y: 0, width: 230, height: 230*0.75))
self.view.addSubview(imgV)
imgV.image = img
let command = TscCommand()
command.addSize(40, 30)
......@@ -215,22 +217,23 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
command.addTear("ON")
command.addQueryPrinterStatus(Response(rawValue: 1)!)
command.addCls()
command.addBitmapwithX(0, withY: 0, withMode: 0, withWidth: 400, with: img)
command.addPrint(1, 1)
ConnecterManager.sharedInstance()?.write(command.getCommand())
}
}
@IBAction func ck_action(_ sender: UIButton) {
let urlStr = "https://c.gelifood.com/market/src/views/Order/codeDetail.html?order_id=12767"
let urlStr = "http://z.gelifood.com/static/url/label.html?goods_name=破军碎星锤魔女斗篷反甲&spec_str=住宅就拉萨京东破军碎星锤魔女斗篷反甲方开始了大舅父&batch_sn=12312312313123&batch_id=444"
// let urlStr = "https://www.baidu.com"
let urlString = urlStr.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
let url = URL(string: urlString)
let request = URLRequest.init(url: url!, cachePolicy: .reloadRevalidatingCacheData, timeoutInterval: 10)
wkWebView.navigationDelegate = self
wkWebView.load(request)
wkWebView.bounds = CGRect(x: 0, y: 0, width: 230, height: 230*0.75)
return
if isGm {
......@@ -756,7 +759,7 @@ extension WKWebView {
public func takeScreenshotOfFullContent(_ completion: @escaping ((UIImage?) -> Void)) {
self.scrollView.setContentOffset(CGPoint(x: 0, y: 0), animated: false)
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {
let renderer = WebViewPrintPageRenderer.init(formatter: self.viewPrintFormatter(), contentSize: self.scrollView.contentSize)
let renderer = WebViewPrintPageRenderer.init(formatter: self.viewPrintFormatter(), contentSize: CGSize(width: 230, height: 230*0.75))
let image = renderer.printContentToImage()
completion(image)
}
......
......@@ -118,25 +118,25 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[Manager stopScan];
[Manager closePeripheral: _selectArray.firstObject];
[self.selectArray removeAllObjects];
if (indexPath.section == 1) {
CBPeripheral *peripheral = [self.dicts objectForKey:[self.dicts allKeys][indexPath.row]];
[self connectDevice:peripheral];
}else{
[SVProgressHUD showErrorWithStatus:@"断开连接"];
[self startScane];
}
[_tableView reloadData];
}
-(void)connectDevice:(CBPeripheral *)peripheral {
[Manager connectPeripheral:peripheral options:nil timeout:2 connectBlack:^(ConnectState state) {
if (state == 3) {
if ([_selectArray count] == 0) {
[self.selectArray addObject:peripheral];
[_tableView reloadData];
}
[SVProgressHUD showSuccessWithStatus:@"连接成功"];
......@@ -145,6 +145,7 @@
[SVProgressHUD showErrorWithStatus:@"连接失败"];
}
[self startScane];
}];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment