Commit 8a282fb5 by 肖康

Merge branch 'master' of http://119.23.72.7/sunlong_v5/note-library

# Conflicts:
#	resources/views/web/record.blade.php
#	resources/views/web/showPage.blade.php
parents d673f9c8 8c305c70
......@@ -11,6 +11,7 @@ use App\Model\TemplateListModel;
use App\Model\NodesModel;
use DNS1D;
use DNS2D;
use Sunra\PhpSimple\HtmlDomParser;
class WebController extends Controller
{
......@@ -121,11 +122,54 @@ class WebController extends Controller
foreach($matches[1] as $k=>$field){
$arr[$k] = $info["ichunt2020"][$field];
}
if(!empty($matches)){
$html = str_replace($matches[0],$arr,$tmpRelation->tmpRelation->html);
}else{
$html = $tmpRelation->tmpRelation->html;
}
$dom = HtmlDomParser::str_get_html( $html );
$textareas = $dom->find('textarea');
foreach($textareas as $k=>$textarea){
$textarea->innertext = $textarea->datatypes;
}
$yiweimaits = $dom->find("div[name='yiweimait']");
foreach($yiweimaits as $k=>$yiweimait){
// dump($yiweimait->imagesurl);
// dump($yiweimait->style);
// dump($yiweimait->datatypes);
// dump(DNS1D::getBarcodePNG($yiweimait->datatypes, "C128"));
$a = $yiweimait->style;
$b = 'data:image/png;base64,' . DNS1D::getBarcodePNG($yiweimait->datatypes, "C128");
$c = preg_replace('/background: url\((.*?)\) 0% 0% \/ 100% 100%/'," background: url({$b}) 0% 0% / 100% 100% ",$a);
$yiweimait->style = $c;
}
$erweimas = $dom->find("div[name='erweimait']");
foreach($erweimas as $k=>$erweima){
// dump($erweima->datatypes);
$a =$erweima->style;
$b = 'data:image/png;base64,' . DNS2D::getBarcodePNG($erweima->datatypes, "QRCODE");
$c = preg_replace('/background: url\((.*?)\) 0% 0% \/ 100% 100%/'," background: url({$b}) 0% 0% / 100% 100% ",$a);
// dump($c);
$erweima->style = $c;
}
//exit;
// dump($dom);
// exit;
// \View::make('admin.messages', $info["ichunt2020"]);
// dump($html);exit;
$info["html"] = $html;
$info["html"] = $dom;
return view('web', $info);
}
......
......@@ -15,7 +15,8 @@
"hprose/hprose": "^2.0",
"php-amqplib/php-amqplib": "2.7",
"jenssegers/mongodb": "3.2.*",
"milon/barcode": "5.1"
"milon/barcode": "5.1",
"sunra/php-simple-html-dom-parser": "1.5.2"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
......

508 Bytes | W: | H:

134 Bytes | W: | H:

public4445645656.png
public4445645656.png
public4445645656.png
public4445645656.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -2,30 +2,30 @@
<br/>
<div style="border-top:1px solid #ccc;margin-top:20px;margin-bottom:20px;"></div>
<a class="downpng layui-btn" target="_blank" href="" download="downImg">下载</a>
<a class="downpng layui-btn" target="_blank" href="" download="downImg">下载</a>
<script src="https://cdn.bootcdn.net/ajax/libs/html2canvas/0.5.0-beta4/html2canvas.js"></script>
<script>
//创建一个新的canvas
//创建一个新的canvas
var canvas2 = document.createElement("canvas");
var _canvas = document.querySelector('.edit-con');
var w = parseInt(window.getComputedStyle(_canvas).width);
var h = parseInt(window.getComputedStyle(_canvas).height);
//将canvas画布放大若干倍,然后盛放在较小的容器内,就显得不模糊了
//将canvas画布放大若干倍,然后盛放在较小的容器内,就显得不模糊了
canvas2.width = w+Number($(".edit-con").css("borderWidth").split("px")[0])*2;
canvas2.height = h+Number($(".edit-con").css("borderWidth").split("px")[0])*2;
// canvas2.style.width = w + "px";
// canvas2.style.height = h + "px";
//可以按照自己的需求,对context的参数修改,translate指的是偏移量
//可以按照自己的需求,对context的参数修改,translate指的是偏移量
var context = canvas2.getContext("2d");
context.translate(-$(".edit-con").offset().left,-$(".edit-con").offset().top);
// var context = canvas2.getContext("2d");
// context.scale(2, 2);
html2canvas(document.querySelector('.edit-con'), { canvas: canvas2 }).then(function(canvas) {
//document.body.appendChild(canvas);
//canvas转换成url,然后利用a标签的download属性,直接下载,绕过上传服务器再下载
//canvas转换成url,然后利用a标签的download属性,直接下载,绕过上传服务器再下载
document.querySelector(".downpng").setAttribute('href', canvas.toDataURL());
});
</script>
......
This diff could not be displayed because it is too large.
......@@ -7,6 +7,7 @@ $baseDir = dirname($vendorDir);
return array(
'UpdateHelper\\' => array($vendorDir . '/kylekatarnls/update-helper/src'),
'Sunra\\PhpSimple\\HtmlDomParser' => array($vendorDir . '/sunra/php-simple-html-dom-parser/Src'),
'PHPExcel' => array($vendorDir . '/phpoffice/phpexcel/Classes'),
'Mockery' => array($vendorDir . '/mockery/mockery/library'),
'Milon\\Barcode' => array($vendorDir . '/milon/barcode/src'),
......
This diff could not be displayed because it is too large.
......@@ -3512,6 +3512,62 @@
"homepage": "https://github.com/sebastianbergmann/version"
},
{
"name": "sunra/php-simple-html-dom-parser",
"version": "v1.5.2",
"version_normalized": "1.5.2.0",
"source": {
"type": "git",
"url": "https://github.com/sunra/php-simple-html-dom-parser.git",
"reference": "75b9b1cb64502d8f8c04dc11b5906b969af247c6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sunra/php-simple-html-dom-parser/zipball/75b9b1cb64502d8f8c04dc11b5906b969af247c6",
"reference": "75b9b1cb64502d8f8c04dc11b5906b969af247c6",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-mbstring": "*",
"php": ">=5.3.2"
},
"time": "2016-11-22T22:57:47+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"Sunra\\PhpSimple\\HtmlDomParser": "Src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Sunra",
"email": "sunra@yandex.ru",
"homepage": "https://github.com/sunra"
},
{
"name": "S.C. Chen",
"homepage": "http://sourceforge.net/projects/simplehtmldom/"
}
],
"description": "Composer adaptation of: A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way! Require PHP 5+. Supports invalid HTML. Find tags on an HTML page with selectors just like jQuery. Extract contents from HTML in a single line.",
"homepage": "https://github.com/sunra/php-simple-html-dom-parser",
"keywords": [
"dom",
"html",
"parser"
]
},
{
"name": "swiftmailer/swiftmailer",
"version": "v5.4.12",
"version_normalized": "5.4.12.0",
......
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 sign in to comment