人人商城

reply.html 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. {template 'common/header'}
  2. {if in_array($m, $sysmods)}
  3. <div class="we7-page-title">
  4. 自动回复
  5. </div>
  6. <ul class="we7-page-tab">
  7. {loop $active_sub_permission $active_menu}
  8. {if permission_check_account_user($active_menu['permission_name'], false) && (empty($active_menu['is_display']) || is_array($active_menu['is_display']) && in_array($_W['account']['type'], $active_menu['is_display']))}
  9. <li {if $m == $active_menu['active']}class="active"{/if}><a href="{$active_menu['url']}">{$active_menu['title']}</a></li>
  10. {/if}
  11. {/loop}
  12. </ul>
  13. {else}
  14. <div class="we7-page-title">
  15. 入口设置
  16. </div>
  17. <ul class="we7-page-tab">
  18. {if !empty($_W['current_module']['isrulefields']) &&!empty($_W['account']) && in_array($_W['account']['type'], array(ACCOUNT_TYPE_OFFCIAL_NORMAL, ACCOUNT_TYPE_OFFCIAL_AUTH))}<li class="active"><a href="{url 'platform/reply' array('m' => $m, 'version_id' => intval($_GPC['version_id']))}">关键字链接入口 </a></li>{/if}
  19. {if !empty($frames['section']['platform_module_common']['menu']['platform_module_cover'])}
  20. <li><a href="{url 'platform/cover' array('m' => $m, 'version_id' => intval($_GPC['version_id']))}">封面链接入口</a></li>
  21. {/if}
  22. </ul>
  23. {/if}
  24. {if $m == 'keyword' || $m == 'userapi' || !in_array($m, $sysmods)}
  25. <div id="js-keyword-display" ng-controller="KeywordDisplay" ng-cloak>
  26. <div class="keyword-list-head">
  27. <form action="./index.php" method="get" class="form-horizontal" role="form">
  28. <input type="hidden" name="c" value="platform">
  29. <input type="hidden" name="a" value="reply">
  30. <input type="hidden" name="m" value="{$_GPC['m']}" />
  31. <input type="hidden" name="status" value="{$status}" />
  32. <div class="keyword-list-head clearfix">
  33. <div class="pull-right">
  34. <a href="{url 'platform/reply/post' array('m' => $m)}" class="btn btn-primary">+添加{if $m == 'userapi'}自定义接口{else}关键字{/if}回复</a>
  35. {if in_array($m, $sysmods) && $m != 'userapi'}<a href="{url 'platform/reply/post' array('m' => 'apply')}" class="btn btn-danger we7-margin-left">+添加应用关键字</a>{/if}
  36. </div>
  37. <div class="input-group we7-margin-bottom" style="width:465px;">
  38. <select class="we7-select pull-left" name="search_type">
  39. <option value="keyword" {if $_GPC['search_type'] == 'keyword'}selected{/if}>关键字</option>
  40. <option value="rule" {if $_GPC['search_type'] == 'rule'}selected{/if}>规则名</option>
  41. </select>
  42. <input name="type" type="hidden" value="{$_GPC['type']}">
  43. <input class="form-control" name="keyword" type="text" value="{$_GPC['keyword']}" placeholder="输入规则名称或关键字名称" style="width: 330px;">
  44. <span class="input-group-btn"><button class="btn btn-default"><i class="fa fa-search"></i></button></span>
  45. </div>
  46. </div>
  47. </form>
  48. </div>
  49. {if in_array($m, $sysmods) && $m != 'userapi'}
  50. <div class="btn-group we7-btn-group we7-margin-bottom btn-group-justified">
  51. <a href="{url 'platform/reply/display' array('m' => 'keyword')}" class="btn {if !$_GPC[type]}active{/if}">全部</a>
  52. <a href="{url 'platform/reply/display' array('m' => 'keyword', 'type' => 'news')}" class="btn {if $_GPC[type] == 'news'}active{/if}">回复图文</a>
  53. <a href="{url 'platform/reply/display' array('m' => 'keyword', 'type' => 'apply')}" class="btn {if $_GPC[type] == 'apply'}active{/if}">回复模块</a>
  54. {if !in_array($_W['account']['type'], array(ACCOUNT_TYPE_XZAPP_NORMAL, ACCOUNT_TYPE_XZAPP_AUTH))}
  55. <a href="{url 'platform/reply/display' array('m' => 'keyword', 'type' => 'voice')}" class="btn {if $_GPC[type] == 'voice'}active{/if}">回复语音</a>
  56. {/if}
  57. <a href="{url 'platform/reply/display' array('m' => 'keyword', 'type' => 'basic')}" class="btn {if $_GPC[type] == 'basic'}active{/if}">回复文字</a>
  58. {if !in_array($_W['account']['type'], array(ACCOUNT_TYPE_XZAPP_NORMAL, ACCOUNT_TYPE_XZAPP_AUTH))}
  59. <a href="{url 'platform/reply/display' array('m' => 'keyword', 'type' => 'music')}" class="btn {if $_GPC[type] == 'music'}active{/if}">回复音乐</a>
  60. {/if}
  61. <a href="{url 'platform/reply/display' array('m' => 'keyword', 'type' => 'images')}" class="btn {if $_GPC[type] == 'images'}active{/if}">回复图片</a>
  62. {if !in_array($_W['account']['type'], array(ACCOUNT_TYPE_XZAPP_NORMAL, ACCOUNT_TYPE_XZAPP_AUTH))}
  63. <a href="{url 'platform/reply/display' array('m' => 'keyword', 'type' => 'video')}" class="btn {if $_GPC[type] == 'video'}active{/if}">回复视频</a>
  64. {/if}
  65. </div>
  66. {/if}
  67. <div class="clearfix"></div>
  68. <div class="table we7-tables {if !in_array($m, $sysmods)} we7-padding-bottom {/if}">
  69. <form action="{php echo url('platform/reply/delete');}" method="post" role="form" class="form we7-form" id="form1">
  70. <input type="hidden" name="m" value="{$m}">
  71. {if !empty($replies)}
  72. {loop $replies $row}
  73. <table class="table we7-table table-hover">
  74. <col width="80px"/>
  75. <col width=""/>
  76. <col width="120px"/>
  77. <col width="230px"/>
  78. <tr>
  79. <th class="text-left" colspan="2">
  80. <div class="pull-left">
  81. <input id='rid-{$row['id']}' type="checkbox" name='rid[]' we7-check-all="we7-check-all" value="{$row['id']}"/>
  82. <label class="text-over reply-item-name" for="rid-{$row['id']}">&nbsp;</label>
  83. <label class="text-over reply-item-name">{if !empty($row['name'])}规则名:{$row['name']}{/if}</label>
  84. </div>
  85. <span class="pull-right">
  86. {if $row['displayorder'] > 0}
  87. {if $row['displayorder'] == '255'}
  88. <span class="label label-primary">置顶</span>
  89. {else}
  90. <span class="label label-info">优先级 {$row['displayorder']}</span>
  91. {/if}
  92. {/if}
  93. </span>
  94. </th>
  95. <th>是否开启</th>
  96. <th class="text-right">操作</th>
  97. </tr>
  98. <tr>
  99. {if !in_array($row['module'], $sysmods)}
  100. <td class="vertical-middle">
  101. <img src="{$row['module_info']['logo']}" alt="" class="keyword-img"/>
  102. </td>
  103. <td class="text-left">
  104. {else}
  105. <td class="text-left" colspan="2">
  106. {/if}
  107. <div class="we7-form reply-item-keyword">
  108. <div class="form-inline">
  109. <label for="" class="control-label">关&nbsp;键&nbsp;字</label>
  110. <div class="form-controls form-control-static">
  111. {loop $row['keywords'] $kw}
  112. <span class="keyword-tag" data-toggle="tooltip" data-placement="bottom" title="{if $kw['type']==1}此关键字为精准触发{elseif $kw['type']==2}此关键字为包含触发{elseif $kw['type']==3}此关键字为正则匹配触发{/if}">{$kw['content']}</span>
  113. {if $kw['type'] == 4}<span class="form-control-static keyword-tag" data-toggle="tooltip" data-placement="bottom" title="托管">优先级在{$row['displayorder']}之下直接生效</span>{/if}
  114. {/loop}
  115. </div>
  116. <div class="form-inline">
  117. <label for="" class="control-label col-sm-2">回复内容</label>
  118. <div class="form-controls form-control-static">
  119. <span class="">
  120. {if $m == 'userapi'}
  121. 自定义
  122. {elseif in_array($row['module'], $sysmods)}
  123. 共{$row['allreply']['sum']}条({if $row['allreply']['basic'] > 0}{$row['allreply']['basic']}条文字 {/if}{if $row['allreply']['images'] > 0}{$row['allreply']['images']}条图片 {/if}{if $row['allreply']['news'] > 0}{$row['allreply']['news']}条图文 {/if}{if $row['allreply']['music'] > 0}{$row['allreply']['music']}条音乐 {/if}{if $row['allreply']['voice'] > 0}{$row['allreply']['voice']}条语音 {/if}{if $row['allreply']['video'] > 0}{$row['allreply']['video']}条视频 {/if}{if $row['allreply']['wxcard'] > 0}{$row['allreply']['wxcard']}条卡券{/if})
  124. {else}
  125. {php echo cutstr($row['module_info']['title'], 10);}应用
  126. {/if}
  127. </span>
  128. </div>
  129. </div>
  130. </div>
  131. </td>
  132. <td class="vertical-middle">
  133. <label>
  134. <div class="switch {if $row['status']} switchOn{/if}" id="key-{$row['id']}" ng-click="changeStatus({$row[id]})"></div>
  135. </label>
  136. </td>
  137. <td class="vertical-middle text-right">
  138. <div class="link-group">
  139. {if in_array($row['module'], $sysmods)}
  140. <a href="{php echo url('platform/reply/post', array('m' => $m, 'rid' => $row['id']))}">编辑</a>
  141. {else}
  142. <a href="{php echo url('platform/reply/post', array('m' => $row['module'], 'rid' => $row['id']))}">编辑</a>
  143. {/if}
  144. <a href="{php echo url('platform/reply/delete', array('m' => $m, 'rid' => $row['id']))}" class="del" onclick="return confirm('删除规则将同时删除关键字与回复,确认吗?');return false;">删除</a>
  145. {loop $entries['rule'] $ext_menu}
  146. <a href="{$ext_menu['url']}&id={$row['id']}&rid={$row['id']}">{$ext_menu['title']}</a>
  147. {/loop}
  148. </div>
  149. </td>
  150. </tr>
  151. </table>
  152. {/loop}
  153. <div>
  154. <input type="checkbox" name="rid[]" we7-check-all="we7-check-all" id="select_all" class="we7-margin-left" value="1" />
  155. <label for="select_all">&nbsp;</label>
  156. <input type="submit" class="btn btn-danger" value="删除" onclick="if(!confirm('确定删除选中的规则吗?')) return false;"/>
  157. <input type="hidden" name="token" value="{$_W['token']}"/>
  158. <div class="text-right">
  159. {$pager}
  160. </div>
  161. </div>
  162. {else}
  163. <p class="text-center we7-margin-top">暂无数据</p>
  164. {/if}
  165. </form>
  166. </div>
  167. </div>
  168. <script>
  169. $(function () {
  170. $('[data-toggle="tooltip"]').tooltip();
  171. $('#select_all').click(function(){
  172. $('#form1 :checkbox').prop('checked', $(this).prop('checked'));
  173. });
  174. $('#form1 :checkbox').click(function(){
  175. if(!$(this).prop('checked')) {
  176. $('#select_all').prop('checked', false);
  177. } else {
  178. var flag = 0;
  179. $('#form1 :checkbox[name="rid[]"]').each(function(){
  180. if(!$(this).prop('checked') && !flag) {
  181. flag = 1;
  182. }
  183. });
  184. if(flag) {
  185. $('#select_all').prop('checked', false);
  186. } else {
  187. $('#select_all').prop('checked', true);
  188. }
  189. }
  190. });
  191. });
  192. angular.bootstrap($('#js-keyword-display'), ['replyFormApp']);
  193. </script>
  194. {elseif $m == 'special'}
  195. <div class="NoKeyword-list" id="js-special-display" ng-controller="SpecialDisplay" ng-cloak>
  196. <div class="table we7-tables">
  197. <table class="table we7-table table-hover vertical-middle">
  198. <col width="160px"/>
  199. <col />
  200. <col width="120px"/>
  201. <col width="180px"/>
  202. <tr>
  203. <th class="text-left">类型</th>
  204. <th class="text-left">关键字/模块</th>
  205. <th>状态</th>
  206. <th class="text-left">操作</th>
  207. </tr>
  208. {loop $mtypes $name $title}
  209. <tr>
  210. <td class="text-left">
  211. {$title}
  212. </td>
  213. <td class="text-left">
  214. {if !empty($setting[$name]['type'])}
  215. {if $setting[$name]['type'] == 'keyword'}{$setting[$name]['keyword']}{else}{$module[$setting[$name]['module']]['title']}{/if}
  216. {else}
  217. {if !empty($setting[$name]['keyword'])}{$setting[$name]['keyword']}{else}{$module[$setting[$name]['module']]['title']}{/if}
  218. {/if}
  219. </td>
  220. <td>
  221. <label>
  222. <div ng-class="switch_class['{$name}']" ng-click="changestatus('{$name}')"></div>
  223. </label>
  224. </td>
  225. <td>
  226. <div class="link-group text-left">
  227. <a href="{php echo url('platform/reply/post', array('m' => 'special', 'type' => $name))}" class="keyword-link">编辑</a>
  228. </div>
  229. </td>
  230. </tr>
  231. {/loop}
  232. </table>
  233. </div>
  234. </div>
  235. <script>
  236. $(function() {
  237. angular.module('replyFormApp').value('config', {
  238. {loop $mtypes $name $title}
  239. '{$name}' : '{$setting[$name]['type']}',
  240. {/loop}
  241. 'url' : '{php echo url('platform/reply/change_status')}'
  242. });
  243. angular.bootstrap($('#js-special-display'), ['replyFormApp']);
  244. });
  245. </script>
  246. {elseif $m == 'welcome'}
  247. <div class="alert we7-page-alert">
  248. <i class="wi wi-info-sign"></i>用户关注公众号时,发送的欢迎信息。
  249. </div>
  250. <div class="new-keyword" id="welcome" ng-cloak>
  251. <div class="we7-form" ng-controller="WelcomeDisplay">
  252. <form id="reply-form" class="form-horizontal form" action="{php echo url('platform/reply/post', array('m' => $m, 'rid' => $rule_keyword_id))}" method="post" enctype="multipart/form-data">
  253. <div>
  254. {php echo module_build_form('core', $rule_keyword_id, array('keyword' => false))}
  255. </div>
  256. <input type="submit" name="submit" value="保存" class="btn btn-primary" style="padding: 6px 50px;"/>
  257. <input type="hidden" name="token" value="{$_W['token']}">
  258. <input type="hidden" name="m" value="{$m}">
  259. <input type="hidden" name="type" value="{$type}">
  260. </form>
  261. </div>
  262. </div>
  263. <script>
  264. require(['underscore'], function() {
  265. angular.bootstrap($('#welcome'), ['replyFormApp']);
  266. });
  267. </script>
  268. {elseif $m == 'default'}
  269. <div class="alert we7-page-alert">
  270. <i class="wi wi-info-sign"></i>当系统不知道该如何回复粉丝的消息时,默认发送的内容。
  271. </div>
  272. <div class="new-keyword" id="default">
  273. <div id="a" class="we7-form" ng-controller="DefaultDisplay">
  274. <form id="reply-form" class="form-horizontal form" action="{php echo url('platform/reply/post', array('m' => $m, 'rid' => $rule_keyword_id))}" method="post" enctype="multipart/form-data">
  275. <div>
  276. {php echo module_build_form('core', $rule_keyword_id, array('keyword' => false))}
  277. </div>
  278. <input type="submit" name="submit" value="保存" class="btn btn-primary" style="padding: 6px 50px;"/>
  279. <input type="hidden" name="token" value="{$_W['token']}">
  280. <input type="hidden" name="m" value="{$m}">
  281. <input type="hidden" name="type" value="{$type}">
  282. </form>
  283. </div>
  284. </div>
  285. <script>
  286. require(['underscore'], function() {
  287. angular.bootstrap($('#default'), ['replyFormApp']);
  288. });
  289. </script>
  290. {elseif $m == 'service'}
  291. <div class="NoKeyword-list" id="js-service-display" ng-controller="serviceDisplay" ng-cloak>
  292. <div class="table we7-tables">
  293. <table class="table we7-table table-hover">
  294. <col width="160px"/>
  295. <col />
  296. <col width="120px"/>
  297. <tr>
  298. <th class="text-left">服务名称</th>
  299. <th class="text-left">功能说明</th>
  300. <th>状态</th>
  301. </tr>
  302. <tr ng-repeat="(id, api) in service track by id" ng-if="service">
  303. <td class="text-left">
  304. {{ api.name }}
  305. </td>
  306. <td class="text-left" ng-bind-html="api.description">
  307. </td>
  308. <td class="vertical-middle">
  309. <label>
  310. <div ng-class="api.switch == 'checked' ? 'switch switchOn' : 'switch'" ng-click="changeStatus(id)"></div>
  311. </label>
  312. </td>
  313. </tr>
  314. <tr ng-if="!service">
  315. <td colspan="3" class="text-center">
  316. 暂无数据
  317. </td>
  318. </tr>
  319. </table>
  320. </div>
  321. </div>
  322. <script>
  323. $(function() {
  324. angular.module('replyFormApp').value('config', {
  325. 'url' : "{php echo url('platform/reply/change_status')}",
  326. 'service' : {php echo !empty($service_list) ? json_encode($service_list) : 'null'}
  327. });
  328. angular.bootstrap($('#js-service-display'), ['replyFormApp']);
  329. });
  330. </script>
  331. {/if}
  332. {template 'common/footer'}