promote.html 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <style>
  2. .marked-message{height: 48px;background: #FFF5ED;font-size: 14px;font-family: Source Han Sans SC;font-weight: 400;color: #666;line-height: 50px;padding: 0 16px;display: flex;}
  3. .promote-flex{display: flex;margin-top: 15px;padding: 0 10px 0;}
  4. .promote-img{background-color: #f8f8f8;display: flex;justify-content: center;align-items: center;width: 200px;height: 200px;}
  5. .promote-img img{width: 140px;height: 140px;}
  6. .label-width{width: 100px;}
  7. .block-left{margin-left: 100px !important;display: flex;}
  8. .promote-download{margin-left: 20px;}
  9. .h5-path{margin-left: 20px;width: 300px;}
  10. .h5-path .fuzhi{width: 1px;height: 0px;border: 0px;}
  11. .h5-path span{display: block;margin-bottom: 10px;}
  12. .h5-path p input{height: 30px;line-height: 30px;border: 1px solid #e6e6e5;width: 150px;padding: 0px 5px;border-radius: 5px;margin-right: 10px;}
  13. </style>
  14. <script type="text/html" id="promote">
  15. <div>
  16. <div class="marked-message">
  17. <p>活动可分享至多个渠道推广,增加商品曝光率,提升商品分享打开率。</p>
  18. </div>
  19. <div class="promote-flex">
  20. <div class="promote-img">
  21. <img src="{{ ns.img(d.h5.path) }}" alt="推广二维码">
  22. </div>
  23. <div class="layui-form">
  24. <div class="layui-form-item">
  25. <label class="layui-form-label label-width">选择渠道:</label>
  26. <div class="layui-input-block block-left">
  27. <input type="radio" name="promote_type" value="h5" title="H5" checked lay-filter="promote_type" >
  28. <input type="radio" name="promote_type" value="weapp" title="微信小程序" lay-filter="promote_type">
  29. {if addon_is_exit('aliapp', request()->siteid())}
  30. <input type="radio" name="promote_type" value="aliapp" title="支付宝小程序" lay-filter="promote_type">
  31. {/if}
  32. </div>
  33. </div>
  34. <div class="h5-path">
  35. <span>推广链接</span>
  36. <p class="tips text-color"><input type="text" value="{{d.h5.url}}" readonly /><a class="layui-btn" href="javascript:ns.copy('h5_url_{{ d.id }}');">复制</a></p>
  37. <input type="text" id="h5_url_{{ d.id }}" value="{{d.h5.url}}" readonly class="fuzhi"/>
  38. </div>
  39. <div class="promote-download">
  40. <a class="text-color" href="{{ ns.img(d.h5.path) }}" download>下载二维码</a>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </script>
  46. <script>
  47. // 推广渠道监听
  48. function promoteTypeSwitch(form, res){
  49. form.on('radio(promote_type)', function(radio){
  50. if(radio.value == 'h5') {
  51. var no_html = "";
  52. no_html += '<img src="'+ ns.img(res.data.h5.path) +'"/>';
  53. $('.promote-img').html(no_html);
  54. $('.promote-download a').attr('href',ns.img(res.data.h5.path));
  55. $(".h5-path").show();
  56. }else {
  57. if(!res.data[radio.value] || res.data[radio.value].path == ""){
  58. var no_html = "";
  59. no_html += '<span>小程序配置错误</span>';
  60. $('.promote-img').html(no_html);
  61. }else{
  62. $('.promote-img img').attr('src', ns.img(res.data[radio.value].path));
  63. $('.promote-download a').attr('href',ns.img(res.data[radio.value].path));
  64. }
  65. $(".h5-path").hide();
  66. }
  67. });
  68. }
  69. </script>