ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
你可以把下面的代码添加到商城或者是论坛或者是文章的内容页里边,就可以生成宣传海报功能. ![](https://box.kancloud.cn/08b5dfed34e6dcc5b49e341da714de79_457x731.jpg) \template\index_style\default\shop\content\show.htm \template\index_style\default\bbs\content\show.htm \template\index_style\default\cms\content\show.htm 如果你装到有分销插件的话,就可以实现分销推广 ~~~ {php} $share_url = get_url('location'); if (!strstr($share_url,'p_uid=')) { if(strstr($share_url,'?')){ $share_url .= '&'; }else{ $share_url .= '?'; } $share_url .= 'p_uid='.$userdb['uid']; } $codeimg = get_qrcode($share_url); {/php} <!--这个是生成海报的按钮,样式可以自由修改,或者是把点击事件 share_btn() 放到别的按钮上--> <i style="position:fixed;right:30px;top:80px;z-index:200;font-size:30px;" onclick="share_btn()" class="fa fa-qrcode"></i> <script type="text/javascript" src="__STATIC__/libs/html2canvas/html2canvas.js"></script> <style type="text/css"> .share_box {margin: 0 auto;position: relative;background:#F5F4E9;} .add_tt{height:50px; line-height:50px; border-bottom:1px #f4f4f4 solid; text-align:center; background:#f8f8f8} .share_box{padding:10px;} .share_picurl img {width: 100%;} .share_pro {position: relative;padding-left:100px;height: 150px;margin-top: 10px;text-align: left;} .share_pro img {position: absolute;left: 0;top: 0;width:90px;height: 90px;} .share_name {height: 56px;overflow: hidden;line-height: 28px;color: #000;font-size:22px;} .share_name2 {overflow: hidden;line-height: 18px;font-size: 18px;} .font16{height:45px;font-size: 22px;} .font16 span:nth-child(2){height:45px;font-size: 28px;color: #F14D59;} .font16 span{font-size: 25px;color:blue;} .close_btn{background:url(__STATIC__/libs/html2canvas/close.png) no-repeat;background-size:22px auto;width:22px;height:22px;right:10px;top:14px;display:block;position:absolute} #page_share{display:none;} </style> <div id="page_share"> <div class="add_tt">长按下面的图片另存或分享给好友</div> <div class="close_btn" onclick="app_page_close();"></div> <div style="position:relative"> <div class="share_box" id="share_html"> <div class="share_picurl"><img src="{$info.picurl}" onerror="this.src='{:tempdir($webdb.logo)}'"></div> <div class="share_pro"> <img src="{$codeimg}"> <div class="share_name">{$info.title}</div> <div class="font16"><span>{$info.price}</span> <span>{$info.market_price}</span></div> <div class="share_name2">长按或扫一扫识别二维码查看详情</div> <div class="clear"></div> </div> </div> <img src="__STATIC__/libs/html2canvas/blank.png" id="share_img" style="position:absolute;top:0;left:0;display:none;background: #fff url(__STATIC__/libs/html2canvas/loading.gif) no-repeat center"> </div> </div> <script type="text/javascript"> //分享 function share_btn() { app_page('page_share', function(){ div_toimg("share_html", "share_img"); }); } </script> ~~~