poster_special.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. {extend name="public/container"}
  2. {block name="title"}{$title} -- 推广海报{/block}
  3. {block name='head_top'}
  4. <style>
  5. body{background-color:#4c4c4c;}
  6. </style>
  7. {/block}
  8. {block name="content"}
  9. <div class="promotion-poster">
  10. <div class="tip">长按保存海报,分享到朋友圈</div>
  11. <div class="pictrue">
  12. <img src="/{$filename}">
  13. </div>
  14. <div class="shareBnt">分享链接给朋友</div>
  15. <div class="notes">
  16. <div class="title">推荐指引</div>
  17. {$promoter_guide}
  18. </div>
  19. <div class="shares-model" style="display: none">
  20. <img style="position: fixed;left: 0;top: 0;width: 100%;height: 100%;" src="{__WAP_PATH}zsff/images/share-info.png">
  21. </div>
  22. <div class="phraseWindow" style="display: none">
  23. <div class="name">推荐短语</div>
  24. <div class="phraseCon" id="phraseCon">{$special.phrase}</div>
  25. <div class="but acea-row row-center-wrapper">
  26. <div class="item" id="colne">取消</div>
  27. <div class="item copy" id="copy">一键复制</div>
  28. </div>
  29. </div>
  30. <div class="mask" style="display: none"></div>
  31. <img src="/wap/first/zsff/images/poster.png" class="phrase" id="phraseTap">
  32. </div>
  33. {/block}
  34. {block name="foot"}
  35. <script>
  36. var url="{$url}";
  37. require(['helper','store'],function($h,storeApi) {
  38. $('.shares-model').on('touchmove',function(e){
  39. e.preventDefault();
  40. });
  41. $('.mask').on('touchmove',function(e){
  42. e.preventDefault();
  43. });
  44. $("#copy").on('click',function (e) {
  45. copy('phraseCon',function () {
  46. $h.showMsg({title:'复制成功',icon:'success'});
  47. e.stopPropagation();
  48. $('.phraseWindow').hide();
  49. $('.mask').hide();
  50. },function () {
  51. $h.showMsg('复制失败');
  52. });
  53. });
  54. $('#phraseTap').on('click',function () {
  55. $('.phraseWindow').show();
  56. $('.mask').show();
  57. })
  58. $('#colne').on('click',function (e) {
  59. e.stopPropagation();
  60. $('.phraseWindow').hide();
  61. $('.mask').hide();
  62. });
  63. $('.mask').on('click',function () {
  64. $('.phraseWindow').hide();
  65. $(this).hide();
  66. })
  67. $('.shareBnt').on('click',function () {
  68. $('.shares-model').show();
  69. });
  70. $('.shares-model').on('click',function () {
  71. $('.shares-model').hide();
  72. })
  73. window.overallShare=false;
  74. mapleWx($jssdk(), function () {
  75. this.onMenuShareAll({
  76. title: '{$special.title}',
  77. desc: "{$special.abstract}",
  78. imgUrl: '{$special.image}',
  79. link: url
  80. });
  81. });
  82. function copy (id, attr,errorFn)
  83. {
  84. var target = null,successFn=null;
  85. if(typeof attr=='function'){
  86. successFn=attr;
  87. attr='';
  88. }
  89. if (attr && typeof attr=='string') {
  90. target = document.createElement('div');
  91. target.id = 'tempTarget';
  92. target.style.opacity = '0';
  93. if (id) {
  94. var curNode = document.querySelector('#' + id);
  95. target.innerText = curNode[attr];
  96. } else {
  97. target.innerText = attr;
  98. }
  99. document.body.appendChild(target);
  100. } else {
  101. target = document.querySelector('#' + id);
  102. }
  103. try {
  104. var range = document.createRange();
  105. range.selectNode(target);
  106. window.getSelection().removeAllRanges();
  107. window.getSelection().addRange(range);
  108. document.execCommand('copy');
  109. window.getSelection().removeAllRanges();
  110. successFn && successFn();
  111. } catch (e) {
  112. errorFn && errorFn();
  113. }
  114. if (attr) {
  115. // remove temp target
  116. target.parentElement.removeChild(target);
  117. }
  118. }
  119. })
  120. </script>
  121. {/block}