slide.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. {extend name="default/base/base_seller" /}
  2. {block name="seller_main"}
  3. <div class="dssc-form-default">
  4. <div class="alert">
  5. <ul>
  6. <li>1. {$Think.lang.store_slide_description_one}</li>
  7. <li>2. {php}printf(lang('store_slide_description_two'),intval(config('ds_config.image_max_filesize'))/1024){/php}</li>
  8. <li>3. {$Think.lang.store_slide_description_three}</li>
  9. <li>4. {$Think.lang.store_slide_description_fore|raw}</li>
  10. <li>5. {$Think.lang.store_slide_description_five}</li>
  11. </ul>
  12. </div>
  13. {notempty name="store_slide"}
  14. <div class="dssc-sellerslider">
  15. <ul class="bd">
  16. {for start='0' end='5'}
  17. {if $store_slide[$i] != ''}
  18. <li>
  19. <a {if $store_slide_url[$i] !=''} href="{$store_slide_url[$i]}" {/if}><img src="{:ds_get_pic(ATTACH_SLIDE,$store_slide[$i])}" /></a>
  20. </li>
  21. {/if}
  22. {/for}
  23. </ul>
  24. <ul class="hd">
  25. {for start='0' end='5'}
  26. {if $store_slide[$i] != ''}
  27. <li></li>
  28. {/if}
  29. {/for}
  30. </ul>
  31. <a class="ctrl prev" href="javascript:void(0)">&lt;</a>
  32. <a class="ctrl next" href="javascript:void(0)">&gt;</a>
  33. </div>
  34. {/notempty}
  35. <script src="{$Think.PLUGINS_SITE_ROOT}/jquery.SuperSlide.2.1.1.js"></script>
  36. <script>
  37. //轮播
  38. jQuery(".dssc-sellerslider").slide({mainCell: "ul", autoPlay: true, delayTime: 500,interTime: 5000});
  39. </script>
  40. <form action="{:url('Sellersetting/store_slide')}" id="store_slide_form" method="post" >
  41. <!-- 图片上传部分 -->
  42. <ul class="dssc-store-slider" id="goods_images">
  43. {for start='0' end='5'}
  44. <li ds_type="handle_pic" id="thumbnail_{$i}">
  45. <div class="picture" dstype="file_{$i}">
  46. {empty name="store_slide[$i]"}
  47. <i class="iconfont">&#xe72a;</i>
  48. {else /}
  49. <img dstype="file_{$i}" src="{:ds_get_pic(ATTACH_SLIDE,$store_slide[$i])}"/>
  50. {/empty}
  51. <input type="hidden" name="image_path[]" dstype="file_{$i}" value="{$store_slide[$i]|default=''}"/>
  52. <a href="javascript:void(0)" dstype="del" class="del" title="{$Think.lang.remove}" file_id="{$i}">X</a>
  53. </div>
  54. <div class="url">
  55. <label>{$Think.lang.store_slide_image_url}</label>
  56. <input type="text" class="text w150" name="image_url[]" value="{notempty name='$store_slide_url[$i]'}{$store_slide_url[$i]}{else /}http://{/notempty}"/>
  57. </div>
  58. <div class="dssc-upload-btn">
  59. <a href="javascript:void(0);">
  60. <span>
  61. <input type="file" hidefocus="true" size="1" class="input-file" name="file_{$i}" id="file_{$i}" file_id="{$i}" />
  62. </span>
  63. <p><i class="iconfont">&#xe733;</i>{$Think.lang.store_slide_image_upload}</p>
  64. </a>
  65. </div>
  66. </li>
  67. {/for}
  68. </ul>
  69. <div class="bottom">
  70. <input type="submit" class="submit" value="{$Think.lang.store_slide_submit}">
  71. </div>
  72. </form>
  73. </div>
  74. <script src="{$Think.PLUGINS_SITE_ROOT}/ajaxfileupload.js"></script>
  75. <script>
  76. var HOMESITEROOT = '{$Think.HOME_SITE_ROOT}';
  77. var UPLOAD_SITE_URL = '{$Think.UPLOAD_SITE_URL}';
  78. var ATTACH_COMMON = '{$Think.ATTACH_COMMON}';
  79. var ATTACH_STORE = '{$Think.ATTACH_STORE}';
  80. $(function(){
  81. /* 商品图片ajax上传 */
  82. var url = "{:url('Sellersetting/silde_image_upload')}";
  83. $('.dssc-upload-btn').find('input[type="file"]').unbind().change(
  84. function() {
  85. //上传文件名
  86. var id = $(this).attr('id');
  87. //文件ID
  88. var file_id = $(this).attr('file_id');
  89. ajaxFileUpload(url, id, file_id);
  90. });
  91. /* 删除图片 */
  92. $('a[dstype="del"]').unbind().click(function() {
  93. var obj = $(this).parents('li');
  94. var file_id = $(this).attr('file_id');
  95. var img_src = obj.find('input[type="hidden"]:first').val();
  96. obj.find('img:first').attr('src', "{$Think.HOME_SITE_ROOT}/images/loading.gif");
  97. obj.find('img:first').replaceWith('<i class="iconfont">&#xe72a;</i>');
  98. $.getJSON(HOMESITEURL+'/Sellersetting/dorp_img.html', {file_id : file_id, img_src : img_src}, function(data) {
  99. obj.find('input[type="file"]').attr('file_id', '').end().find('input[type="hidden"]:first').val('');
  100. });
  101. });
  102. $(function() {
  103. $('#store_slide_form').validate({
  104. submitHandler: function(form) {
  105. ds_ajaxpost('store_slide_form');
  106. },
  107. rules: {
  108. },
  109. messages: {
  110. }
  111. });
  112. });
  113. });
  114. /* 图片上传ajax */
  115. function ajaxFileUpload(url, id, file_id)
  116. {
  117. $('div[dstype="'+id+'"]').find('i').remove().end().find('img').remove()
  118. .end().prepend('<img dstype="'+id+'" scr="'+'{$Think.HOME_SITE_ROOT}/images/loading.gif">');
  119. $('img[dstype="'+id+'"]').attr('src',"{$Think.HOME_SITE_ROOT}/images/loading.gif");
  120. $.ajaxFileUpload
  121. (
  122. {
  123. url:url,
  124. secureuri:false,
  125. fileElementId:id,
  126. dataType: 'json',
  127. data:{id:id, file_id:file_id},
  128. success: function (data, status)
  129. {
  130. if(typeof(data.error) != 'undefined')
  131. {
  132. alert(data.error);
  133. $('img[dstype="'+id+'"]').attr('src','{:ds_get_pic(ATTACH_COMMON,$Think.config.ds_config.default_goods_image)}');
  134. }else
  135. {
  136. $('input[dstype="'+id+'"]').val(data.file_name);
  137. $('img[dstype="'+id+'"]').attr('src',data.file_url+'?'+Math.random());
  138. }
  139. },
  140. error: function (data, status, e)
  141. {
  142. alert(e);
  143. }
  144. }
  145. )
  146. return false;
  147. }
  148. </script>
  149. {/block}