templateconfig_set.html 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <?php $shoname_name = D('Home/Front')->get_config_by_name('shoname'); ?>
  6. <title><?php echo $shoname; ?></title>
  7. <link rel="shortcut icon" href="" />
  8. <meta name="renderer" content="webkit">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  11. <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
  12. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  13. <!--[if lt IE 9]>
  14. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  15. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  16. <![endif]-->
  17. <link href="./resource/css/bootstrap.min.css?v=201903260001" rel="stylesheet">
  18. <link href="./resource/css/common.css?v=201903260001" rel="stylesheet">
  19. <script type="text/javascript">
  20. window.sysinfo = {
  21. <?php if (!empty($_W['uniacid']) ){ ?>'uniacid': '{$_W['uniacid']}',<?php } ?>
  22. <?php if( !empty($_W['acid']) ){ ?>'acid': '{$_W['acid']}',<?php } ?>
  23. <?php if (!empty($_W['openid']) ) { ?>'openid': '{$_W['openid']}',<?php } ?>
  24. <?php if( !empty($_W['uid']) ) { ?>'uid': '{$_W['uid']}',<?php } ?>
  25. 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
  26. 'siteroot': '{$_W['siteroot']}',
  27. 'siteurl': '{$_W['siteurl']}',
  28. 'attachurl': '{$_W['attachurl']}',
  29. 'attachurl_local': '{$_W['attachurl_local']}',
  30. 'attachurl_remote': '{$_W['attachurl_remote']}',
  31. 'module' : {'url' : '<?php if( defined('MODULE_URL') ) { ?>{MODULE_URL}<?php } ?>', 'name' : '<?php if (defined('IN_MODULE') ) { ?>{IN_MODULE}<?php } ?>'},
  32. 'cookie' : {'pre': ''},
  33. 'account' : {:json_encode($_W['account'])},
  34. };
  35. </script>
  36. <script type="text/javascript" src="./resource/js/lib/jquery-1.11.1.min.js"></script>
  37. <script type="text/javascript" src="./resource/js/lib/bootstrap.min.js"></script>
  38. <script type="text/javascript" src="./resource/js/app/util.js?v=201903260001"></script>
  39. <script type="text/javascript" src="./resource/js/app/common.min.js?v=201903260001"></script>
  40. <script type="text/javascript" src="./resource/js/require.js?v=201903260001"></script>
  41. <script type="text/javascript" src="./resource/js/lib/jquery.nice-select.js?v=201903260001"></script>
  42. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  43. <link href="/static/css/snailfish.css" rel="stylesheet">
  44. <script type="text/javascript" src="/static/js/dist/area/cascade.js"></script>
  45. <script src="https://map.qq.com/api/js?v=2.exp&key=6R4BZ-WAB3W-JITRG-OE7GY-R2753-P3BZ2" type="text/javascript" charset="utf-8"></script>
  46. </head>
  47. <body layadmin-themealias="default">
  48. <div class="layui-fluid">
  49. <div class="layui-card">
  50. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">消息设置</span></div>
  51. <div class="layui-card-body" style="padding:15px;">
  52. <form action="" method="post" class="layui-form" lay-filter="component-layui-form-item" enctype="multipart/form-data" >
  53. <div class="layui-form-item">
  54. <label class="layui-form-label">使用模板消息类型:</label>
  55. <div class="layui-input-block">
  56. <div class="input-group fixsingle-input-group">
  57. <label class='radio-inline'><input type='radio' name='parameter[weprogram_use_templatetype]' value='0' <?php if( !isset($data['weprogram_use_templatetype']) || $data['weprogram_use_templatetype']=='0' ){ ?>checked<?php } ?> title="模板消息" /> </label>
  58. <label class='radio-inline'><input type='radio' name='parameter[weprogram_use_templatetype]' value='1' <?php if( !empty($data['weprogram_use_templatetype']) && $data['weprogram_use_templatetype'] == 1 ){ ?>checked<?php } ?> title="订阅消息" /> </label>
  59. <span class='help-block'>模板消息即将下线,请尽快切换成订阅消息</span>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="layui-form-item">
  64. <label class="layui-form-label"></label>
  65. <div class="layui-input-block">
  66. <input type="submit" lay-submit lay-filter="formDemo" value="提交" class="btn btn-primary" />
  67. </div>
  68. </div>
  69. </form>
  70. </div>
  71. </div>
  72. </div>
  73. <script src="/layuiadmin/layui/layui.js"></script>
  74. <script>
  75. layui.config({
  76. base: '/layuiadmin/' //静态资源所在路径
  77. }).extend({
  78. index: 'lib/index' //主入口模块
  79. }).use('index');
  80. </script>
  81. <script>
  82. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  83. var layer = layui.layer;
  84. var $;
  85. var cur_open_div;
  86. var can_sub = true;
  87. layui.use(['jquery', 'layer','form'], function(){
  88. $ = layui.$;
  89. var form = layui.form;
  90. form.on('radio(linktype)', function(data){
  91. if (data.value == 2) {
  92. $('#typeGroup').show();
  93. } else {
  94. $('#typeGroup').hide();
  95. }
  96. });
  97. form.on('radio(all_msg_send_type)', function(data){
  98. if (data.value == 1) {
  99. $('#type_1').show();
  100. } else if( data.value == 2 )
  101. {
  102. $('#type_1').hide();
  103. $('#type_2').show();
  104. }
  105. else if( data.value == 3 )
  106. {
  107. $('#type_1').hide();
  108. $('#type_2').hide();
  109. }
  110. });
  111. //subtitle
  112. $(document).on("input propertychange","#subtitle",function(){
  113. //("\r|\n|\\s", "");
  114. var s_content = $('#subtitle').val();
  115. s_content.replace(/\r|\n|\\s/g,"");
  116. var regex3 = /\{\{(.+?)\}\}/g; // {}
  117. var new_arr = s_content.match(regex3);
  118. var s_html = "";
  119. for( var i in new_arr )
  120. {
  121. s_html+=' <div class="layui-form-item">';
  122. s_html+=' <label class="layui-form-label">'+new_arr[i]+'内容</label>';
  123. s_html+=' <div class="layui-input-block">';
  124. s_html+=' <input type="text" name="datas['+new_arr[i]+']" class="layui-input" lay-required="true" value="" />';
  125. s_html+=' </div>';
  126. s_html+=' </div>';
  127. }
  128. $('#analy_div').html(s_html);
  129. });
  130. $('#chose_member_id').click(function(){
  131. cur_open_div = $(this).attr('data-input');
  132. $.post("{:U('user/zhenquery', array('ok' => 1))}", {}, function(shtml){
  133. layer.open({
  134. type: 1,
  135. area: '930px',
  136. content: shtml //注意,如果str是object,那么需要字符拼接。
  137. });
  138. });
  139. })
  140. $('#chose_agent_id').click(function(){
  141. cur_open_div = $(this).attr('data-input');
  142. $.post("{:U('user/zhenquery_many', array('template' => 'mult'))}", {}, function(shtml){
  143. layer.open({
  144. type: 1,
  145. area: '930px',
  146. content: shtml //注意,如果str是object,那么需要字符拼接。
  147. });
  148. });
  149. })
  150. $('#chose_link').click(function(){
  151. cur_open_div = $(this).attr('data-input');
  152. $.post("{:U('util/selecturl', array('ok' => 1))}", {}, function(shtml){
  153. layer.open({
  154. type: 1,
  155. area: '930px',
  156. content: shtml //注意,如果str是object,那么需要字符拼接。
  157. });
  158. });
  159. })
  160. form.on('submit(auto_get)', function(data){
  161. var loadingIndex = layer.load(); // 加载中动画遮罩层(1)
  162. $.ajax({
  163. url: "{:U('weprogram/autotemplateconfig',array('ok'=>'1'))}",
  164. type: 'get',
  165. dataType:'json',
  166. success: function (info) {
  167. layer.close(loadingIndex); // 提交成功失败都需要关闭
  168. if(info.status == 0)
  169. {
  170. layer.msg('请选择会员',{time: 1000});
  171. }else if(info.status == 1){
  172. layer.msg('操作成功',{time: 1000,
  173. end:function(){
  174. var backurl = "{:U('weprogram/templateconfig')}";
  175. location.href = backurl;
  176. // location.href = info.result.url;
  177. }
  178. });
  179. can_sub = true;
  180. }
  181. }
  182. });
  183. return false;
  184. })
  185. //监听提交
  186. form.on('submit(formDemo)', function(data){
  187. var gd_ar = [];
  188. var gd_str = '';
  189. $('.mult_choose_member_id').each(function(){
  190. gd_ar.push( $(this).attr('data-member-id') );
  191. })
  192. gd_str = gd_ar.join(',');
  193. data.field.limit_user_list = gd_str;
  194. $.ajax({
  195. url: data.form.action,
  196. type: data.form.method,
  197. data: data.field,
  198. dataType:'json',
  199. success: function (info) {
  200. if(info.status == 0)
  201. {
  202. layer.msg(info.result.message,{icon: 1,time: 2000});
  203. }else if(info.status == 1){
  204. var go_url = location.href;
  205. if( info.result.hasOwnProperty("url") )
  206. {
  207. go_url = info.result.url;
  208. }
  209. layer.msg('操作成功',{time: 1000,
  210. end:function(){
  211. location.href = info.result.url;
  212. }
  213. });
  214. }
  215. }
  216. });
  217. return false;
  218. });
  219. })
  220. function cancle_bind(obj,sdiv)
  221. {
  222. $('#'+sdiv).val('');
  223. $(obj).parent().parent().remove();
  224. }
  225. </script>
  226. </body>