人人商城

reply-post.html 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. {template 'common/header'}
  2. <div class="new-keyword">
  3. <ol class="breadcrumb we7-breadcrumb">
  4. <a href="{url 'platform/reply' array('m' => $m)}"><i class="wi wi-back-circle"></i> </a>
  5. <li>
  6. <a href="{url 'platform/reply' array('m' => $m)}">自动回复管理</a>
  7. </li>
  8. <li>
  9. {if empty($rid)}<a href="{url 'platform/reply/post' array('m' => $m)}">新建{$module['title']}</a></li>{/if}
  10. {if !empty($rid)}<a href="{php echo url('platform/reply/post', array('m' => $m, 'rid' => $rid))}">编辑{$module['title']}</a></li>{/if}
  11. </li>
  12. </ol>
  13. {if $m == 'keyword' || $m == 'userapi' || !in_array($m, $sysmods)}
  14. <form id="reply-form" action="{php echo url('platform/reply/post', array('m' => $m, 'rid' => $rid))}" method="post" enctype="multipart/form-data" ng-controller="KeywordReply" ng-cloak>
  15. <div class="we7-form">
  16. <input type="hidden" name="keywords">
  17. <table class="we7-table table-hover">
  18. <col width="530px"/>
  19. <col />
  20. <col width="150px"/>
  21. <tr>
  22. <th>关键字</th>
  23. <th>触发类型</th>
  24. <th class="text-right">操作</th>
  25. </tr>
  26. <tr ng-repeat="keyword in reply.entry.keywords">
  27. <td ng-bind="keyword.content"></td>
  28. <td>
  29. <span ng-if="keyword.type == 1">精准触发</span>
  30. <span ng-if="keyword.type == 2">包含关键字触发</span>
  31. <span ng-if="keyword.type == 3">正则匹配关键字触发</span>
  32. </td>
  33. <td>
  34. <div class="link-group">
  35. <!-- <a href="javascript:;" data-toggle="modal" data-target="keyword-edit" ng-click="editKeyword(keyword)">修改</a> -->
  36. <a href="javascript:;" class="del" ng-click="delKeyword(keyword)">删除</a>
  37. </div>
  38. </td>
  39. </tr>
  40. <tr>
  41. <td colspan="3" class="text-left" ng-click="showAddkeywordModal()">
  42. <a class="color-gray add-new-keyword" href="javascript:;">
  43. <span class="add-icon"><i class="wi wi-plus"></i></span>
  44. <span class="text">添加关键字</span>
  45. </a>
  46. </td>
  47. </tr>
  48. </table>
  49. <div class="modal fade" id="addkeywordModal" tabindex="-1" role="dialog" aria-labelledby="addkeywordsModalLabel">
  50. <div class="modal-dialog" role="document">
  51. <div class="modal-content">
  52. <div class="modal-header">
  53. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  54. <h4 class="modal-title" id="addkeywordsModalLabel">添加关键字</h4>
  55. </div>
  56. <div class="modal-body" ng-style="{'height': '335px'}">
  57. <div class="form-group">
  58. <label class="control-label col-sm-3">触发关键字</label>
  59. <div class="form-controls col-sm-8 form-coltrol-static">
  60. <input type="radio" id="radio1" name="radio" ng-model="newKeyword.type" value="1" ng-click="changeKeywordType(1)"/>
  61. <label for="radio1" ng-click="changeKeywordType(1)">精准触发</label>
  62. <input type="radio" id="radio2" name="radio" ng-model="newKeyword.type" value="2" ng-click="changeKeywordType(2)"/>
  63. <label for="radio2" ng-click="changeKeywordType(2)">包含关键字触发</label>
  64. <input type="radio" id="radio3" name="radio" ng-model="newKeyword.type" value="3" ng-click="changeKeywordType(3)"/>
  65. <label for="radio3" ng-click="changeKeywordType(3)">正则匹配关键字触发</label>
  66. </div>
  67. </div>
  68. <div class="form-group" ng-show="newKeyword.type == 1">
  69. <label for="" class="control-label col-sm-3"></label>
  70. <div class="form-controls input-group col-sm-6">
  71. <input type="text" class="keyword-input form-control" max="30" id="keyword-exact" ng-model="newKeyword.content" ng-blur="checkKeyWord($event);" data-type="keyword">
  72. <span class="help-block">&nbsp;</span>
  73. <span class="input-group-btn"><a href="javascript:;" class="btn btn-default" id="emoji-exact" ng-init="initEmotion();" style="position:absolute;top:0px"><i class="fa fa-github-alt" style="font-size:14px;"></i> 表情</a></span>
  74. </div>
  75. </div>
  76. <div class="form-group" ng-show="newKeyword.type == 2">
  77. <label for="" class="control-label col-sm-3"></label>
  78. <div class="form-controls input-group col-sm-6">
  79. <input type="text" class="keyword-input form-control" max="30" id="keyword-indistinct" ng-model="newKeyword.content" ng-blur="checkKeyWord($event);" data-type="keyword">
  80. <span class="help-block">&nbsp;</span>
  81. <span class="input-group-btn"><a href="javascript:;" class="btn btn-default" id="emoji-indistinct" style="position:absolute;top:0px"><i class="fa fa-github-alt" style="font-size:14px;"></i> 表情</a></span>
  82. </div>
  83. </div>
  84. <div class="form-group" ng-show="newKeyword.type == 3">
  85. <label for="" class="control-label col-sm-3"></label>
  86. <div class="form-controls input-group col-sm-6">
  87. <input type="text" class="keyword-input form-control" max="30" id="keyword-regexp" ng-model="newKeyword.content" ng-blur="checkKeyWord($event);" data-type="keyword">
  88. <span class="help-block">&nbsp;</span>
  89. </div>
  90. </div>
  91. <div class="form-controls col-sm-offset-3">
  92. <span class="help-block" ng-hide="newKeyword.type == 1 || newKeyword.type == 2">
  93. 用户进行交谈时,对话内容符合述关键字中定义的模式才会执行这条规则。<br/>
  94. 注意:如果你不明白正则表达式的工作方式,请不要使用正则匹配<br/>
  95. 注意:正则匹配使用MySQL的匹配引擎,请使用MySQL的正则语法<br/>
  96. 示例:<br/>
  97. ^微信匹配以“微信”开头的语句<br/>
  98. 微信$匹配以“微信”结尾的语句<br/>
  99. ^微信$匹配等同“微信”的语句<br/>
  100. 微信匹配包含“微信”的语句<br/>
  101. [0-9.-]匹配所有的数字,句号和减号<br/>
  102. ^[a-zA-Z_]$所有的字母和下划线<br/>
  103. ^[[:alpha:]]{3}$所有的3个字母的单词<br/>
  104. ^a{4}$aaaa<br/>
  105. ^a{2,4}$aa,aaa或aaaa<br/>
  106. ^a{2,}$匹配多于两个a的字符串<br/>
  107. </span>
  108. <span class="help-block" ng-hide="newKeyword.type == 3">多个关键字请使用逗号隔开,如天气,今日天气</span>
  109. </div>
  110. </div>
  111. <div class="modal-footer">
  112. <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  113. <button type="button" class="btn btn-primary" ng-click="addNewKeyword()">确定</button>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. <div class="form-group">
  119. <label for="" class="control-label col-sm-2">&nbsp;</label>
  120. <div class="form-controls color-default col-sm-10 text-right">
  121. <a href="javascript:void(0);" ng-click="changeShowAdvance()"><span ng-show="!reply.showAdvance">展开</span><span ng-show="reply.showAdvance">收起</span>高级设置<i class="fa fa-chevron-down" ng-class="{'fa-chevron-down': !reply.showAdvance, 'fa-chevron-up': reply.showAdvance}"></i></a>
  122. </div>
  123. </div>
  124. <div class="panel we7-panel" ng-show="reply.showAdvance">
  125. <div class="panel-body we7-padding" style="background-color: #f4f6f9;">
  126. <input type="hidden" name="rid" value="{$rid}" />
  127. <div class="form-group" ng-show="reply.showAdvance">
  128. <label for="" class="control-label col-sm-2">规则名称</label>
  129. <div class="form-controls col-sm-8">
  130. <input type="text" class="form-control" placeholder="请输入回复规则的名称" name="rulename" value="{if empty($reply['name']) && !empty($_GPC['name'])}{$_GPC['name']}{else}{$reply['name']}{/if}">
  131. <span class="help-block">您可以给这组触发关键字规则起一个名字, 方便下次修改和查看. </span>
  132. </div>
  133. </div>
  134. <div class="form-group" ng-show="reply.showAdvance">
  135. <label for="" class="control-label col-sm-2">全局置顶</label>
  136. <div class="form-controls col-sm-8">
  137. <input id="istop-1" type="radio" name="istop" ng-model="reply.entry.istop" ng-value="1" value="1" {if intval($reply['displayorder'] >= 255)} checked="checked"{/if}/>
  138. <label for="istop-1" >是</label>
  139. <input id="istop-2" type="radio" name="istop" ng-model="reply.entry.istop" ng-value="0" value="0" {if intval($reply['displayorder'] < 255)} checked="checked"{/if}/>
  140. <label for="istop-2">否</label>
  141. </div>
  142. </div>
  143. <div class="form-group" ng-show="reply.entry.istop == 0 && reply.showAdvance">
  144. <label for="" class="control-label col-sm-2">回复优先级</label>
  145. <div class="form-controls col-sm-4">
  146. <input type="number" min="0" max="254" name="displayorder_rule" value="{if intval($reply['displayorder']) < 255}{$reply['displayorder']}{/if}" placeholder="输入这条回复规则的优先级" class="form-control">
  147. <span class="help-block">
  148. 规则优先级,越大则越靠前,最大不得超过254
  149. </span>
  150. </div>
  151. </div>
  152. <div class="form-group" ng-show="reply.showAdvance">
  153. <label for="" class="control-label col-sm-2">是否开启</label>
  154. <div class="form-controls col-sm-8">
  155. <label>
  156. <input name="status" class="form-control" ng-model="reply.status" ng-hide="1">
  157. <div class="switch" ng-class="{'switchOn': reply.status}" ng-click="changeStatus()"></div>
  158. </label>
  159. <span class="help-block">您可以选择临时禁用这条回复.</span>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. </div>
  165. <div>
  166. <nav class="navbar navbar-wxapp-bottom navbar-fixed-bottom" role="navigation">
  167. <div class="container">
  168. <div class="pager">
  169. <input type="submit" name="submit" value="发布" class="reply-form-submit hidden">
  170. <span value="发布" class="btn btn-primary" ng-click="submitForm()">发布</span>
  171. </div>
  172. </div>
  173. </nav>
  174. </div>
  175. <div>
  176. {if $m == 'userapi'}
  177. {php echo module_build_form('userapi', $rid)}
  178. {elseif in_array($m, $sysmods)}
  179. {if !in_array($_W['account']['type'], array(ACCOUNT_TYPE_XZAPP_NORMAL, ACCOUNT_TYPE_XZAPP_AUTH))}
  180. {php echo module_build_form('core', $rid, array('basic'=> false,'news'=> false,'image'=> false,'music'=> false,'voice'=> false,'video'=> false))}
  181. {else}
  182. {php echo module_build_form('core', $rid, array('basic'=> false,'news'=> false,'image'=> false,'music'=> true,'voice'=> true,'video'=> true))}
  183. {/if}
  184. {else}
  185. {php echo module_build_form($m, $rid)}
  186. {/if}
  187. </div>
  188. <input type="hidden" name="token" value="{$_W['token']}">
  189. </form>
  190. {/if}
  191. {if $m == 'apply'}
  192. <div id="js-apply" ng-controller="ApplyReply" ng-cloak>
  193. <div class="we7-step">
  194. <ul>
  195. <li class="active">
  196. 1 选择应用
  197. </li>
  198. <li>
  199. 2 添加应用关键字
  200. </li>
  201. </ul>
  202. </div>
  203. <ul class="letters-list">
  204. <li ng-repeat="letter in alphabet" ng-style="{'background-color': letter == activeLetter ? '#ddd' : 'none'}" ng-class="{'active': letter == activeLetter}" ng-click="searchModule(letter)">
  205. <a href="javascript:;" ng-bind="letter"></a>
  206. </li>
  207. </ul>
  208. {if $moudles}
  209. <div class="keyword-app">
  210. <ul class="we7-list-group">
  211. {if $enable_modules}
  212. {loop $enable_modules $key $row}
  213. {if empty($current_user_permission_types) || in_array($key, $current_user_permission_types) || $row['issystem'] == 1}
  214. <li data-pinyin="{$row['title_first_pinyin']}" ng-show="activeLetter ? activeLetter == '{$row[title_first_pinyin]}' : '1'">
  215. <div class="we7-list-item">
  216. <!-- <span class="keyword-status" title="已启用"><i class="fa fa-2x fa-check-circle text-success"></i></span> -->
  217. <div class="keyword-app-info">
  218. <img src="{$row['icon']}" alt="{$row['title']}"/>
  219. <p>{$row['title']}</p>
  220. <a href="{if $row['type'] != 'system'}./index.php?c=home&a=welcome&do=ext&m={$row['name']}{else}./index.php?c=platform&a=reply{/if}" class="mask">
  221. <span class="entry">进入</span>
  222. </a>
  223. </div>
  224. </div>
  225. </li>
  226. {/if}
  227. {/loop}
  228. {/if}
  229. {if $unenable_modules}
  230. {loop $unenable_modules $key $row}
  231. <li data-pinyin="{$row['title_first_pinyin']}" ng-show="activeLetter == {$row['title_first_pinyin']}">
  232. <div class="we7-list-item">
  233. <!-- <span class="keyword-status" title="未启用"><i class="fa fa-2x fa-times-circle text-warning"></i></span> -->
  234. <div class="keyword-app-info">
  235. <img src="{$row['icon']}" alt="{$row['title']}"/>
  236. <p>{$row['title']}</p>
  237. <a href="{if $row['type'] != 'system'}./index.php?c=home&a=welcome&do=ext&m={$row['name']}{else}./index.php?c=platform&a=reply{/if}" class="mask">
  238. <span class="entry">进入</span>
  239. </a>
  240. </div>
  241. </div>
  242. </li>
  243. {/loop}
  244. {/if}
  245. </ul>
  246. </div>
  247. {/if}
  248. </div>
  249. {/if}
  250. </div>
  251. <script>
  252. {if $m == 'keyword' || $m == 'userapi' || !in_array($m, $sysmods)}
  253. require(['underscore'], function() {
  254. angular.module('replyFormApp').value('config', {
  255. replydata: {php echo json_encode($reply)},
  256. uniacid: {php echo json_encode($_W['uniacid'])},
  257. links: {
  258. postUrl: "{php echo url('platform/reply/post', array('m' => $_GPC['m']));}",
  259. },
  260. });
  261. angular.bootstrap($('#reply-form'), ['replyFormApp']);
  262. });
  263. {/if}
  264. {if $m == 'apply'}
  265. angular.bootstrap($('#js-apply'), ['replyFormApp']);
  266. {/if}
  267. </script>
  268. {template 'common/footer'}