人人商城

uc.html 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. {php $newUI = true;}
  2. {template 'common/header'}
  3. <ul class="nav nav-tabs">
  4. <li class="active"><a href="{php echo url('mc/uc')}"><i class="icon-user"></i> UC站点整合</a></li>
  5. </ul>
  6. <div class="main">
  7. <form id="form1" action="{php echo url('mc/uc')}" method="post" class="form-horizontal form ng-cloak" ng-controller="ucSetting">
  8. <div class="panel panel-default">
  9. <div class="panel-heading">
  10. 设置UC参数
  11. </div>
  12. <div class="panel-body">
  13. <div class="alert alert-info">
  14. <p>
  15. 使用UC能够整合其他系统的会员信息. 如果你不清楚此功能的作用, 请咨询您的技术人员. <br />
  16. 1. 在UC系统中增加新的应用, 并填写[应用接口文件名称]为: uc.php?uniacid={$_W['uniacid']} <br />
  17. 2. 在下方启用UC, 并按照UC系统中新增的应用参数填写
  18. </p>
  19. </div>
  20. <div class="form-group">
  21. <label class="col-xs-12 col-sm-3 col-md-2 control-label">启用UC</label>
  22. <div class="col-sm-8 col-xs-12">
  23. <label class="radio-inline">
  24. <input type="radio" id="status1" name="status" ng-model="uc.status" value="1"/>
  25. 开启
  26. </label>
  27. <label class="radio-inline">
  28. <input type="radio" id="status0" name="status" ng-model="uc.status" value="0"/>
  29. 关闭
  30. </label>
  31. <span class="help-block">使用UC能够整合其他系统的会员信息. 如果你不清楚此功能的作用, 请咨询您的技术人员.</span>
  32. </div>
  33. </div>
  34. <div ng-show="uc.status == '1'">
  35. <div class="form-group">
  36. <label class="col-xs-12 col-sm-3 col-md-2 control-label">快速录入</label>
  37. <div class="col-sm-8 col-xs-12">
  38. <textarea class="form-control" rows="6" id="textarea"></textarea>
  39. <span class="help-block">你可以直接复制UC中的[应用的 UCenter 配置信息]来快速搞定配置参数.</span>
  40. </div>
  41. </div>
  42. <div class="form-group">
  43. <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
  44. <div class="col-sm-8 col-xs-12">
  45. <input id="submit" type="button" class="btn btn-primary" value="一键录入">
  46. </div>
  47. </div>
  48. <div class="form-group">
  49. <label class="col-xs-12 col-sm-3 col-md-2 control-label">通行证名称</label>
  50. <div class="col-sm-8 col-xs-12">
  51. <input type="text" name="title" class="form-control" value="{{uc.title}}" autocomplete="off">
  52. <span class="help-block">请输入你的通行证名称, 方便与UC系统联系.比如: 你的论坛名字</span>
  53. </div>
  54. </div>
  55. <div class="form-group">
  56. <label class="col-xs-12 col-sm-3 col-md-2 control-label">应用ID</label>
  57. <div class="col-sm-8 col-xs-12">
  58. <input type="text" name="appid" class="form-control" value="{{uc.appid}}" autocomplete="off">
  59. </div>
  60. </div>
  61. <div class="form-group">
  62. <label class="col-xs-12 col-sm-3 col-md-2 control-label">通信密钥</label>
  63. <div class="col-sm-8 col-xs-12">
  64. <input type="text" name="key" class="form-control" value="{{uc.key}}" autocomplete="off"/>
  65. </div>
  66. </div>
  67. <div class="form-group">
  68. <label class="col-xs-12 col-sm-3 col-md-2 control-label">UCenter字符集</label>
  69. <div class="col-sm-8 col-xs-12">
  70. <input type="text" name="charset" class="form-control" value="{{uc.charset}}" autocomplete="off"/>
  71. </div>
  72. </div>
  73. <div class="form-group">
  74. <label class="col-xs-12 col-sm-3 col-md-2 control-label">通信方式</label>
  75. <div class="col-sm-8 col-xs-12">
  76. <label class="radio-inline">
  77. <input type="radio" name="connect" ng-model="uc.connect" value="mysql"/>
  78. MYSQL方式
  79. </label>
  80. <label class="radio-inline">
  81. <input type="radio" name="connect" ng-model="uc.connect" value="http"/>
  82. 远程方式HTTP
  83. </label>
  84. </div>
  85. </div>
  86. <div class="tb mysql" ng-show="uc.connect == 'mysql';">
  87. <div class="form-group">
  88. <label class="col-xs-12 col-sm-3 col-md-2 control-label">数据库主机</label>
  89. <div class="col-sm-8 col-xs-12">
  90. <input type="text" name="dbhost" class="form-control" value="{{uc.dbhost}}" autocomplete="off">
  91. </div>
  92. </div>
  93. <div class="form-group">
  94. <label class="col-xs-12 col-sm-3 col-md-2 control-label">数据库用户名</label>
  95. <div class="col-sm-8 col-xs-12">
  96. <input type="text" name="dbuser" class="form-control" value="{{uc.dbuser}}" autocomplete="off"/>
  97. </div>
  98. </div>
  99. <div class="form-group">
  100. <label class="col-xs-12 col-sm-3 col-md-2 control-label">数据库密码</label>
  101. <div class="col-sm-8 col-xs-12">
  102. <input type="text" name="dbpw" class="form-control" value="{{uc.dbpw}}" autocomplete="off"/>
  103. </div>
  104. </div>
  105. <div class="form-group">
  106. <label class="col-xs-12 col-sm-3 col-md-2 control-label">数据库名称</label>
  107. <div class="col-sm-8 col-xs-12">
  108. <input type="text" name="dbname" class="form-control" value="{{uc.dbname}}" autocomplete="off"/>
  109. </div>
  110. </div>
  111. <div class="form-group">
  112. <label class="col-xs-12 col-sm-3 col-md-2 control-label">数据库字符集</label>
  113. <div class="col-sm-8 col-xs-12">
  114. <input type="text" name="dbcharset" class="form-control" value="{{uc.dbcharset}}" autocomplete="off"/>
  115. </div>
  116. </div>
  117. <div class="form-group">
  118. <label class="col-xs-12 col-sm-3 col-md-2 control-label">表前缀</label>
  119. <div class="col-sm-8 col-xs-12">
  120. <input type="text" name="dbtablepre" class="form-control" value="{{uc.dbtablepre}}" autocomplete="off"/>
  121. </div>
  122. </div>
  123. <div class="form-group">
  124. <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否持久连接</label>
  125. <div class="col-sm-8 col-xs-12">
  126. <label class="radio-inline">
  127. <input type="radio" name="dbconnect" value="1" ng-model="uc.dbconnect"/>
  128. </label>
  129. <label class="radio-inline">
  130. <input type="radio" name="dbconnect" value="0" ng-model="uc.dbconnect"/>
  131. </label>
  132. </div>
  133. </div>
  134. </div>
  135. <div class="tb http" ng-show="uc.connect != 'mysql';">
  136. <div class="form-group">
  137. <label class="col-xs-12 col-sm-3 col-md-2 control-label">服务端URL地址</label>
  138. <div class="col-sm-8 col-xs-12">
  139. <input type="text" name="api" class="form-control" value="{{uc.api}}" autocomplete="off"/>
  140. </div>
  141. </div>
  142. <div class="form-group">
  143. <label class="col-xs-12 col-sm-3 col-md-2 control-label">服务端IP</label>
  144. <div class="col-sm-8 col-xs-12">
  145. <input type="text" name="ip" class="form-control" value="{{uc.ip}}" autocomplete="off"/>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. </div>
  152. <div class="form-group col-sm-12">
  153. <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
  154. <input type="hidden" name="token" value="{$_W['token']}" />
  155. </div>
  156. </form>
  157. </div>
  158. <script type="text/javascript">
  159. angular.module('app', []).controller('ucSetting', function($scope, $http) {
  160. $scope.uc = {php echo json_encode($uc);};
  161. });
  162. angular.bootstrap(document, ['app']);
  163. //处理快速录入
  164. $("#submit").click(function(){
  165. var textarea = $("#textarea").val();
  166. var arr = textarea.split(';');
  167. var data = new Array();
  168. for(var i in arr) {
  169. var index0 = arr[i].indexOf("UC");
  170. var index1 = arr[i].indexOf("', '");
  171. var index2 = arr[i].indexOf("')");
  172. var key = arr[i].substring(index0,index1);
  173. var value = arr[i].substring(index1+4,index2);
  174. data[key] = value;
  175. }
  176. var $scope = angular.element('#form1').scope();
  177. $scope.uc.connect = data['UC_CONNECT'];
  178. $scope.uc.appid = data['UC_APPID'];
  179. $scope.uc.key = data['UC_KEY'];
  180. $scope.uc.charset = data['UC_CHARSET'];
  181. $scope.uc.dbhost = data['UC_DBHOST'];
  182. $scope.uc.dbuser = data['UC_DBUSER'];
  183. $scope.uc.dbname = data['UC_DBNAME'];
  184. $scope.uc.dbpw = data['UC_DBPW'];
  185. $scope.uc.dbcharset = data['UC_DBCHARSET'];
  186. $scope.uc.dbtablepre = data['UC_DBTABLEPRE'];
  187. $scope.uc.dbconnect = data['UC_DBCONNECT'];
  188. $scope.uc.api = data['UC_API'];
  189. $scope.uc.ip = data['UC_IP'];
  190. $scope.$digest();
  191. });
  192. $("#form1").submit(function(){
  193. if($(':radio[name="status"]:checked').val()=='1'){
  194. if($.trim($(':text[name="title"]').val()) == '') {
  195. util.message('必须输入通行证名称.', '', 'error');
  196. return false;
  197. }
  198. var appid = parseInt($(':text[name="appid"]').val());
  199. if(isNaN(appid)) {
  200. util.message('必须输入UCenter应用的ID.', '', 'error');
  201. return false;
  202. }
  203. if($.trim($(':text[name="key"]').val()) == '') {
  204. util.message('必须输入与UCenter的通信密钥.', '', 'error');
  205. return false;
  206. }
  207. if($.trim($(':text[name="charset"]').val()) == '') {
  208. util.message('必须输入UCenter的字符集.', '', 'error');
  209. return false;
  210. }
  211. if($(':radio[name="connect"]:checked').val() == 'mysql') {
  212. if($.trim($(':text[name="dbhost"]').val()) == '') {
  213. util.message('必须输入UCenter数据库主机地址.', '', 'error');
  214. return false;
  215. }
  216. if($.trim($(':text[name="dbuser"]').val()) == '') {
  217. util.message('必须输入UCenter数据库用户名.', '', 'error');
  218. return false;
  219. }
  220. if($.trim($(':text[name="dbpw"]').val()) == '') {
  221. util.message('必须输入UCenter数据库密码.', '', 'error');
  222. return false;
  223. }
  224. if($.trim($(':text[name="dbname"]').val()) == '') {
  225. util.message('必须输入UCenter数据库名称.', '', 'error');
  226. return false;
  227. }
  228. if($.trim($(':text[name="dbcharset"]').val()) == '') {
  229. util.message('必须输入UCenter数据库字符集.', '', 'error');
  230. return false;
  231. }
  232. if($.trim($(':text[name="dbtablepre"]').val()) == '') {
  233. util.message('必须输入UCenter数据表前缀.', '', 'error');
  234. return false;
  235. }
  236. } else if($(':radio[name="connect"]:checked').val() == 'http'){
  237. if($.trim($(':text[name="api"]').val()) == '') {
  238. util.message('必须输入UCenter 服务端的URL地址.', '', 'error');
  239. return false;
  240. }
  241. if($.trim($(':text[name="ip"]').val()) == '') {
  242. util.message('必须输入UCenter的IP.', '', 'error');
  243. return false;
  244. }
  245. }
  246. }
  247. });
  248. </script>
  249. {template 'common/footer'}