|
@@ -109,53 +109,57 @@
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
let loadEle = document.getElementById("loading");
|
|
|
- let h5btn = document.getElementsByClassName('noticeButton')[0]
|
|
|
- loadEle.style.display = 'block'
|
|
|
- setTimeout(function () {
|
|
|
- loadEle.style.opacity = 1;
|
|
|
- },.1);
|
|
|
- let imgSrcFun = function() {};
|
|
|
- let iframeOnload = function() {
|
|
|
- //取得证书信息缓存
|
|
|
- let obj = location.searchObj();
|
|
|
- //是否是小程序端使用
|
|
|
- if(obj.isH5 === 0){
|
|
|
- h5btn.style.display = 'block';
|
|
|
- }else{
|
|
|
- h5btn.style.display = 'none';
|
|
|
- }
|
|
|
- let credTpl = window.frames['credTpl'].window; //获取证书框架window
|
|
|
- let mycertificate = new credTpl.certificate({ //生成图片
|
|
|
- format: 'jpg',
|
|
|
- data: {
|
|
|
- code: obj.credentialNo || '', //编号
|
|
|
- name: obj.companyName || obj.customerName || obj.nickName || '匿名用户', //购买者名字
|
|
|
- co2: obj.carbonAmount || 0, //碳汇量
|
|
|
- money: obj.orderAmount || 0, //购买多少钱
|
|
|
- date: obj.buyDate || '', //购买日期
|
|
|
- year:obj.year, //购买年度
|
|
|
- farmerName:obj.farmerName //农户姓名
|
|
|
- },
|
|
|
- success: function(_function) {
|
|
|
- imgSrcFun = _function('data');
|
|
|
- document.getElementById('showImg').src = imgSrcFun; //预览图片
|
|
|
- loadEle.style.opacity = 0;
|
|
|
- setTimeout(function () {
|
|
|
- loadEle.style.display = 'block'
|
|
|
- },900);
|
|
|
- }
|
|
|
- });
|
|
|
- mycertificate.down('A0');
|
|
|
- };
|
|
|
- /**
|
|
|
- * 证书框架加载完毕开始生成
|
|
|
- */
|
|
|
- let iframe = document.getElementById("credTpl");
|
|
|
- if (iframe.attachEvent) {
|
|
|
- iframe.attachEvent("onload", iframeOnload);
|
|
|
- } else {
|
|
|
- iframe.onload = iframeOnload;
|
|
|
- }
|
|
|
+ let h5btn = document.getElementsByClassName('noticeButton')[0]
|
|
|
+ loadEle.style.display = 'block'
|
|
|
+ setTimeout(function () {
|
|
|
+ loadEle.style.opacity = 1;
|
|
|
+ },.1);
|
|
|
+ let imgSrcFun = function() {};
|
|
|
+ let iframeOnload = function() {
|
|
|
+ //取得证书信息缓存
|
|
|
+ let obj = location.searchObj();
|
|
|
+ // alert(obj.toString())
|
|
|
+ // alert(JSON.stringify(obj))
|
|
|
+ // console.log(obj.isH5 == 'true')
|
|
|
+ // console.log(obj.isH5)
|
|
|
+ //是否是小程序端使用
|
|
|
+ if(obj.isH5 == 'true'){
|
|
|
+ h5btn.style.display = 'block';
|
|
|
+ }else{
|
|
|
+ h5btn.style.display = 'none';
|
|
|
+ }
|
|
|
+ let credTpl = window.frames['credTpl'].window; //获取证书框架window
|
|
|
+ let mycertificate = new credTpl.certificate({ //生成图片
|
|
|
+ format: 'jpg',
|
|
|
+ data: {
|
|
|
+ code: obj.credentialNo || '', //编号
|
|
|
+ name: obj.certName || '匿名用户', //购买者名字
|
|
|
+ co2: obj.carbonAmount || 0, //碳汇量
|
|
|
+ money: obj.orderAmount || 0, //购买多少钱
|
|
|
+ date: obj.buyDate || '', //购买日期
|
|
|
+ year:obj.year, //购买年度
|
|
|
+ farmerName:obj.farmerName //农户姓名
|
|
|
+ },
|
|
|
+ success: function(_function) {
|
|
|
+ imgSrcFun = _function('data');
|
|
|
+ document.getElementById('showImg').src = imgSrcFun; //预览图片
|
|
|
+ loadEle.style.opacity = 0;
|
|
|
+ setTimeout(function () {
|
|
|
+ loadEle.style.display = 'block'
|
|
|
+ },900);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ mycertificate.down('A0');
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * 证书框架加载完毕开始生成
|
|
|
+ */
|
|
|
+ let iframe = document.getElementById("credTpl");
|
|
|
+ if (iframe.attachEvent) {
|
|
|
+ iframe.attachEvent("onload", iframeOnload);
|
|
|
+ } else {
|
|
|
+ iframe.onload = iframeOnload;
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
</html>
|