Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

conf_api.htm 37KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  1. {include file="public/layout" /}
  2. <body class="bodystyle" style="overflow-y: scroll;min-width:auto;">
  3. <div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
  4. <div id="append_parent"></div>
  5. <div id="ajaxwaitid"></div>
  6. <div class="page" style="min-width: auto;box-shadow:none;">
  7. {include file="canal/bar" /}
  8. <!-- 操作说明 -->
  9. <div id="explanation" class="explanation" style="color: rgb(44, 188, 163); background-color: rgb(237, 251, 248); margin-bottom: 15px;">
  10. <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
  11. <h4 title="提示相关设置操作时应注意的要点">提示</h4>
  12. <span title="收起提示" id="explanationZoom" style="display: block;"></span>
  13. </div>
  14. <ul>
  15. <li>1,API接口:API接口不限于:原生小程序、uni-app小程序、vue制作的h5端等可想象的应用场景。为防止API接口被盗用,建议大家开启接口密钥,且一定要<a href="JavaScript:void(0);" onclick="click_to_eyou_1575506523('https://www.eyoucms.com/plus/view.php?aid=28345','API接口密钥的验证逻辑代码教程')" class="red">【查看教程】</a>加入这段验证逻辑。本系统推荐一款 <a href="https://gitee.com/weng_xianhu/eymini" target="_blank">易优微信开源小程序</a>,有基础能力的可以下载体验。</li>
  16. <li>2,微信小程序:登录 <a href="https://mp.weixin.qq.com" target="_blank">微信小程序平台</a> ,在“开发管理->开发设置”里获取AppID、AppSecret的值。微信支付配置:登录 <a href="https://pay.weixin.qq.com" target="_blank">微信支付商户平台</a> ,具体点击<a href="JavaScript:void(0);" onclick="click_to_eyou_1575506523('https://www.eyoucms.com/plus/view.php?aid=8829&origin_eycms=1','微信支付配置教程')" class="red">查看教程</a>操作。配置主要用于开源微信小程序。</li>
  17. <li>3,百度小程序:登录 <a href="https://smartprogram.baidu.com" target="_blank">智能小程序平台</a>,在“管理->基础设置->开发设置”里获取AppID、AppKey、AppSecret的值。配置主要用于开源微信小程序。</li>
  18. </ul>
  19. </div>
  20. <div class="flexigrid htitx">
  21. <form class="form-horizontal" id="post_form" action="{:url('Canal/conf_api')}" method="post">
  22. <div class="hDiv">
  23. <div class="hDivBox">
  24. <table cellspacing="0" cellpadding="0" style="width: 100%">
  25. <thead>
  26. <tr>
  27. <th class="sign w10" axis="col0">
  28. <div class="tc"></div>
  29. </th>
  30. <th abbr="article_title" axis="col3" class="w10">
  31. <div class="tc">API接口</div>
  32. </th>
  33. <th abbr="ac_id" axis="col4">
  34. <div class=""></div>
  35. </th>
  36. </tr>
  37. </thead>
  38. </table>
  39. </div>
  40. </div>
  41. <div class="ncap-form-default">
  42. <dl class="row none">
  43. <dt class="tit">
  44. <label for="apiopen">API接口</label>
  45. </dt>
  46. <dd class="opt">
  47. <label class="curpoin"><input id="apiopen1" name="apiopen" value="0" type="radio" {if condition="empty($data['apiopen'])"}checked="checked"{/if}>开启</label>
  48. &nbsp;
  49. <label class="curpoin"><input id="apiopen0" name="apiopen" value="1" type="radio" {if condition="!empty($data['apiopen'])"}checked="checked"{/if}>关闭</label>
  50. <span class="err"></span>
  51. <p class="notic"></p>
  52. </dd>
  53. </dl>
  54. <div id="div_apiverify" {if condition="false && !empty($data['apiopen'])"}class="none"{/if}>
  55. <dl class="row">
  56. <dt class="tit">
  57. <label for="apiverify">接口验证</label>
  58. </dt>
  59. <dd class="opt">
  60. <label class="curpoin"><input id="apiverify1" name="apiverify" value="1" type="radio" {if condition="!empty($data['apiverify'])"}checked="checked"{/if}>验证</label>
  61. &nbsp;
  62. <label class="curpoin"><input id="apiverify0" name="apiverify" value="0" type="radio" {if condition="empty($data['apiverify'])"}checked="checked"{/if}>忽略</label>
  63. <span class="err"></span>
  64. <p class="notic"></p>
  65. </dd>
  66. </dl>
  67. <dl class="row {if condition="empty($data['apiverify'])"}none{/if}" id="dl_apikey">
  68. <dt class="tit">
  69. <label for="apikey"><em>*</em>接口密钥</label>
  70. </dt>
  71. <dd class="opt">
  72. <input type="text" name="apikey" id="apikey" value="{$data['apikey']|default=''}" class="input-txt" autocomplete="off" onkeyup="this.value=this.value.replace(/[^\w]/g,'');" onpaste="this.value=this.value.replace(/[^\w]/g,'')">
  73. <input type="hidden" name="old_apikey" id="old_apikey" value="{$data['apikey']|default=''}" class="input-txt" autocomplete="off">
  74. &nbsp;<a href="javascript:void(0);" onclick="reset_apikey();" class="ncap-btn ncap-btn-green">刷新</a>
  75. <p class="notic">必须为英文或数字,长度至少32位字符</p>
  76. </dd>
  77. </dl>
  78. </div>
  79. <div class="bot">
  80. <a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
  81. </div>
  82. </div>
  83. </form>
  84. </div>
  85. <script type="text/javascript">
  86. $(function(){
  87. $('input[name=apiopen]').click(function(){
  88. var apiopen = $(this).val();
  89. if (1 == apiopen) {
  90. $('#div_apiverify').hide();
  91. } else {
  92. $('#div_apiverify').show();
  93. }
  94. });
  95. $('input[name=apiverify]').click(function(){
  96. var apiverify = $(this).val();
  97. if (1 == apiverify) {
  98. $('#dl_apikey').show();
  99. } else {
  100. $('#dl_apikey').hide();
  101. }
  102. });
  103. });
  104. // 判断输入框是否为空
  105. function checkForm(){
  106. var apikey = $.trim($('#apikey').val());
  107. if(apikey == ''){
  108. showErrorMsg('接口密钥不能为空!');
  109. $('#apikey').focus();
  110. return false;
  111. } else if (apikey.length < 32) {
  112. showErrorMsg('接口密钥长度至少32位字符!');
  113. $('#apikey').focus();
  114. return false;
  115. }
  116. layer_loading('正在处理');
  117. $.ajax({
  118. url: "{:url('Canal/conf_api', ['_ajax'=>1])}",
  119. type: 'POST',
  120. dataType: 'JSON',
  121. data: $('#post_form').serialize(),
  122. success: function (res) {
  123. layer.closeAll();
  124. if (1 == res.code) {
  125. layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
  126. window.location.reload();
  127. });
  128. } else {
  129. showErrorAlert(res.msg);
  130. return false;
  131. }
  132. },
  133. error: function (e) {
  134. layer.closeAll();
  135. showErrorAlert(e.responseText);
  136. return false;
  137. }
  138. });
  139. }
  140. // 重置接口密钥
  141. function reset_apikey(){
  142. var title = '您确定要刷新当前密钥吗?<br/><span style="color: red; ">一旦保存后,已关联密钥的小程序将失效,请重新添加新密钥到小程序里,并发布上线。</span>';
  143. title += '<style type="text/css">.layui-layer-content{text-align:left!important;}</style>';
  144. layer.confirm(title, {
  145. area: ['480px', '190px'],
  146. move: false,
  147. title: '刷新密钥',
  148. icon: 3,
  149. shade: layer_shade,
  150. btnAlign:'r',
  151. closeBtn: 3,
  152. btn: ['刷新', '取消'], //按钮
  153. success: function () {
  154. $(".layui-layer-content").css('text-align', 'left');
  155. }
  156. }, function () {
  157. $.ajax({
  158. url: "{:url('Canal/reset_apikey')}",
  159. type: 'POST',
  160. dataType: 'JSON',
  161. data: {_ajax:1},
  162. success: function (res) {
  163. layer.closeAll();
  164. if (1 == res.code) {
  165. $('#apikey').val(res.data.apikey);
  166. // layer.msg(res.msg, {time: 1000});
  167. } else {
  168. showErrorAlert(res.msg);
  169. return false;
  170. }
  171. },
  172. error: function (e) {
  173. layer.closeAll();
  174. showErrorAlert(e.responseText);
  175. return false;
  176. }
  177. });
  178. }, function (index) {
  179. layer.closeAll(index);
  180. });
  181. }
  182. </script>
  183. <div class="flexigrid htitx">
  184. <form class="form-horizontal" id="weixin_post_form" action="{:url('Canal/conf_weixin')}" method="post">
  185. <div class="hDiv">
  186. <div class="hDivBox">
  187. <table cellspacing="0" cellpadding="0" style="width: 100%">
  188. <thead>
  189. <tr>
  190. <th class="sign w10" axis="col0">
  191. <div class="tc"></div>
  192. </th>
  193. <th abbr="article_title" axis="col3" class="w10">
  194. <div class="tc">微信小程序</div>
  195. </th>
  196. <th abbr="ac_id" axis="col4">
  197. <div class=""></div>
  198. </th>
  199. </tr>
  200. </thead>
  201. </table>
  202. </div>
  203. </div>
  204. <div class="ncap-form-default" style="position: sticky;">
  205. <dl class="row"><dt class="tit"><label><b>微信登录</b></label></dt></dl>
  206. <dl class="row">
  207. <dt class="tit">
  208. <label for="weixin_appid"><em id="em_weixin_appid" {empty name='$weixin_data.appid'}style="display: none;"{/empty}>*</em>AppID</label>
  209. </dt>
  210. <dd class="opt">
  211. <input type="text" name="weixin_appid" id="weixin_appid" value="{$weixin_data.appid|default=''}" class="input-txt" autocomplete="off">
  212. <p class="notic">小程序ID</p>
  213. </dd>
  214. </dl>
  215. <dl class="row">
  216. <dt class="tit">
  217. <label for="weixin_appsecret"><em id="em_weixin_appsecret" {empty name='$weixin_data.appsecret'}style="display: none;"{/empty}>*</em>AppSecret</label>
  218. </dt>
  219. <dd class="opt">
  220. <input type="text" name="weixin_appsecret" id="weixin_appsecret" value="{$weixin_data.appsecret|default=''}" class="input-txt" autocomplete="off">
  221. <p class="notic">小程序密钥</p>
  222. </dd>
  223. </dl>
  224. <dl class="row"><dt class="tit"><label><b>微信支付</b></label></dt></dl>
  225. <dl class="row">
  226. <dt class="tit">
  227. <label for="weixin_mchid">商户号</label>
  228. </dt>
  229. <dd class="opt">
  230. <input type="text" name="weixin_mchid" id="weixin_mchid" value="{$weixin_data.mchid|default=''}" class="input-txt" autocomplete="off">
  231. <p class="notic">商户ID</p>
  232. </dd>
  233. </dl>
  234. <dl class="row">
  235. <dt class="tit">
  236. <label for="apikey">APIv2密钥</label>
  237. </dt>
  238. <dd class="opt">
  239. <input type="text" name="weixin_apikey" id="weixin_apikey" value="{$weixin_data.apikey|default=''}" class="input-txt" autocomplete="off">
  240. <p class="notic">APIv2密钥</p>
  241. </dd>
  242. </dl>
  243. <div class="bot">
  244. <a href="JavaScript:void(0);" onclick="checkFormWeixin();" class="ncap-btn-big ncap-btn-green" id="submitWeixinBtn">确认提交</a>
  245. </div>
  246. </div>
  247. <div class="" style="position: absolute;top: 53px;left: 750px;">
  248. <dl class="row {empty name='$weixin_qrcodeurl'}none{/empty}" id="dl_weixin_qrcode" style="background: #fff;">
  249. <dd class="opt">
  250. <span id="weixin_span_qrcode"></span>
  251. <div class="ercodepic">
  252. <img id="weixin_img_qrcode" src="__STATIC__/common/images/loading.gif" width="23" height="23" />
  253. </div>
  254. <p class="notic"></p>
  255. </dd>
  256. <dt class="tit" style="text-align: center;line-height: 32px;font-size: 16px;">
  257. <label for="baidu_qrcode">扫码浏览小程序</label>
  258. </dt>
  259. </dl>
  260. </div>
  261. </form>
  262. </div>
  263. <script type="text/javascript">
  264. $(function() {
  265. //操作提示缩放动画
  266. $("#weixin_checkZoom").toggle(
  267. function() {
  268. $("#weixin_explanation").animate({
  269. color: "#FFF",
  270. backgroundColor: "#4FD6BE",
  271. width: "80",
  272. height: "20",
  273. },300);
  274. $("#weixin_explanationZoom").hide();
  275. },
  276. function() {
  277. $("#weixin_explanation").animate({
  278. color: "#2CBCA3",
  279. backgroundColor: "#EDFBF8",
  280. width: "99%",
  281. height: "20",
  282. },300,function() {
  283. $(this).css('height', '100%');
  284. });
  285. $("#weixin_explanationZoom").show();
  286. }
  287. );
  288. $('#weixin_appid, #weixin_appsecret').keyup(function(){
  289. var weixin_appid = $.trim($('#weixin_appid').val());
  290. var weixin_appsecret = $.trim($('#weixin_appsecret').val());
  291. if (weixin_appid != '' || weixin_appsecret != '') {
  292. $('#em_weixin_appid').show();
  293. $('#em_weixin_appsecret').show();
  294. } else {
  295. $('#em_weixin_appid').hide();
  296. $('#em_weixin_appsecret').hide();
  297. }
  298. });
  299. function ajax_get_weixin_qrcode()
  300. {
  301. var weixin_appid = $.trim($('#weixin_appid').val());
  302. var weixin_appsecret = $.trim($('#weixin_appsecret').val());
  303. if (weixin_appid != '' && weixin_appsecret != '') {
  304. $('#dl_weixin_qrcode').show();
  305. var weixin_qrcodeurl = "{$weixin_qrcodeurl}";
  306. if (weixin_qrcodeurl != '') {
  307. $('#weixin_img_qrcode').attr('src', weixin_qrcodeurl);
  308. setTimeout(function(){
  309. $('#weixin_img_qrcode').attr('width', 122).attr('height', 122);
  310. },100);
  311. }
  312. }
  313. $.ajax({
  314. url: "{:url('Canal/ajax_get_weixin_qrcode', ['_ajax'=>1])}",
  315. type: 'GET',
  316. dataType: 'JSON',
  317. data: {},
  318. success: function (res) {
  319. if (1 == res.code) {
  320. $('#weixin_span_qrcode').hide();
  321. $('#weixin_img_qrcode').attr('src', '');
  322. $('#weixin_img_qrcode').attr('src', res.data.qrcodeurl).attr('width', 122).attr('height', 122).show();
  323. } else {
  324. $('#weixin_span_qrcode').html(res.msg);
  325. $('#weixin_img_qrcode').hide();
  326. return false;
  327. }
  328. },
  329. error: function (e) {
  330. $('#weixin_span_qrcode').html(e.responseText);
  331. $('#weixin_img_qrcode').hide();
  332. return false;
  333. }
  334. });
  335. }
  336. ajax_get_weixin_qrcode();
  337. });
  338. // 判断输入框是否为空
  339. function checkFormWeixin(){
  340. var weixin_appid = $.trim($('#weixin_appid').val());
  341. var weixin_appsecret = $.trim($('#weixin_appsecret').val());
  342. if (weixin_appid != '' || weixin_appsecret != '') {
  343. if(weixin_appid == ''){
  344. showErrorMsg('AppID不能为空!');
  345. $('#weixin_appid').focus();
  346. return false;
  347. }
  348. if(weixin_appsecret == ''){
  349. showErrorMsg('AppSecret不能为空!');
  350. $('#weixin_appsecret').focus();
  351. return false;
  352. }
  353. if($.trim($('#weixin_mchid').val()) == '' && $.trim($('#weixin_apikey').val()) != ''){
  354. showErrorMsg('微信支付商户号不能为空!');
  355. $('#weixin_mchid').focus();
  356. return false;
  357. }
  358. if($.trim($('#weixin_mchid').val()) != '' && $.trim($('#weixin_apikey').val()) == ''){
  359. showErrorMsg('微信支付API密钥不能为空!');
  360. $('#weixin_apikey').focus();
  361. return false;
  362. }
  363. }
  364. layer_loading('正在处理');
  365. $.ajax({
  366. url: "{:url('Canal/conf_weixin', ['_ajax'=>1])}",
  367. type: 'POST',
  368. dataType: 'JSON',
  369. data: $('#weixin_post_form').serialize(),
  370. success: function (res) {
  371. layer.closeAll();
  372. if (1 == res.code) {
  373. layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
  374. window.location.reload();
  375. });
  376. } else {
  377. showErrorAlert(res.msg);
  378. return false;
  379. }
  380. },
  381. error: function (e) {
  382. layer.closeAll();
  383. showErrorAlert(e.responseText);
  384. return false;
  385. }
  386. });
  387. }
  388. </script>
  389. <div class="flexigrid htitx">
  390. <form class="form-horizontal" id="baidu_post_form" action="{:url('Canal/conf_baidu')}" method="post">
  391. <div class="hDiv">
  392. <div class="hDivBox">
  393. <table cellspacing="0" cellpadding="0" style="width: 100%">
  394. <thead>
  395. <tr>
  396. <th class="sign w10" axis="col0">
  397. <div class="tc"></div>
  398. </th>
  399. <th abbr="article_title" axis="col3" class="w10">
  400. <div class="tc">百度小程序</div>
  401. </th>
  402. <th abbr="ac_id" axis="col4">
  403. <div class=""></div>
  404. </th>
  405. </tr>
  406. </thead>
  407. </table>
  408. </div>
  409. </div>
  410. <div class="ncap-form-default" style="position: sticky;">
  411. <dl class="row"><dt class="tit"><label><b>百度登录</b></label></dt></dl>
  412. <dl class="row">
  413. <dt class="tit">
  414. <label for="baidu_appid"><em id="em_baidu_appid" {empty name='$baidu_data.appid'}style="display: none;"{/empty}>*</em>App ID</label>
  415. </dt>
  416. <dd class="opt">
  417. <input type="text" name="baidu_appid" id="baidu_appid" value="{$baidu_data.appid|default=''}" class="input-txt" autocomplete="off">
  418. <p class="notic">智能小程序ID</p>
  419. </dd>
  420. </dl>
  421. <dl class="row">
  422. <dt class="tit">
  423. <label for="baidu_appkey"><em id="em_baidu_appkey" {empty name='$baidu_data.appkey'}style="display: none;"{/empty}>*</em>App Key</label>
  424. </dt>
  425. <dd class="opt">
  426. <input type="text" name="baidu_appkey" id="baidu_appkey" value="{$baidu_data.appkey|default=''}" class="input-txt" autocomplete="off">
  427. <p class="notic"></p>
  428. </dd>
  429. </dl>
  430. <dl class="row">
  431. <dt class="tit">
  432. <label for="baidu_appsecret"><em id="em_baidu_appsecret" {empty name='$baidu_data.appsecret'}style="display: none;"{/empty}>*</em>App Secret</label>
  433. </dt>
  434. <dd class="opt">
  435. <input type="text" name="baidu_appsecret" id="baidu_appsecret" value="{$baidu_data.appsecret|default=''}" class="input-txt" autocomplete="off">
  436. <p class="notic">智能小程序密匙</p>
  437. </dd>
  438. </dl>
  439. <div class="bot">
  440. <a href="JavaScript:void(0);" onclick="checkBaiduForm();" class="ncap-btn-big ncap-btn-green" id="submitBaiduBtn">确认提交</a>
  441. </div>
  442. </div>
  443. <div class="" style="position: absolute;top: 53px;left: 750px;">
  444. <dl class="row {empty name='$baidu_qrcodeurl'}none{/empty}" id="baidu_dl_qrcode" style="background: #fff;">
  445. <dd class="opt">
  446. <span id="baidu_span_qrcode"></span>
  447. <div class="ercodepic">
  448. <img id="img_baidu_qrcode" src="__STATIC__/common/images/loading.gif" width="23" height="23" />
  449. </div>
  450. <p class="notic"></p>
  451. </dd>
  452. <dt class="tit" style="text-align: center;line-height: 32px;font-size: 16px;">
  453. <label for="baidu_qrcode">扫码浏览小程序</label>
  454. </dt>
  455. </dl>
  456. </div>
  457. </form>
  458. </div>
  459. <script type="text/javascript">
  460. $(function() {
  461. //操作提示缩放动画
  462. $("#baidu_checkZoom").toggle(
  463. function() {
  464. $("#baidu_explanation").animate({
  465. color: "#FFF",
  466. backgroundColor: "#4FD6BE",
  467. width: "80",
  468. height: "20",
  469. },300);
  470. $("#baidu_explanationZoom").hide();
  471. },
  472. function() {
  473. $("#baidu_explanation").animate({
  474. color: "#2CBCA3",
  475. backgroundColor: "#EDFBF8",
  476. width: "99%",
  477. height: "20",
  478. },300,function() {
  479. $(this).css('height', '100%');
  480. });
  481. $("#baidu_explanationZoom").show();
  482. }
  483. );
  484. $('#baidu_appid, #baidu_appkey, #baidu_appsecret').keyup(function(){
  485. var baidu_appid = $.trim($('#baidu_appid').val());
  486. var baidu_appkey = $.trim($('#baidu_appkey').val());
  487. var baidu_appsecret = $.trim($('#baidu_appsecret').val());
  488. if (baidu_appid != '' || baidu_appkey != '' || baidu_appsecret != '') {
  489. $('#em_baidu_appid').show();
  490. $('#em_baidu_appkey').show();
  491. $('#em_baidu_appsecret').show();
  492. } else {
  493. $('#em_baidu_appid').hide();
  494. $('#em_baidu_appkey').hide();
  495. $('#em_baidu_appsecret').hide();
  496. }
  497. });
  498. function ajax_get_baidu_qrcode()
  499. {
  500. var baidu_appkey = $.trim($('#baidu_appkey').val());
  501. var baidu_appsecret = $.trim($('#baidu_appsecret').val());
  502. if (baidu_appkey != '' && baidu_appsecret != '') {
  503. $('#dl_baidu_qrcode').show();
  504. var baidu_qrcodeurl = "{$baidu_qrcodeurl}";
  505. if (baidu_qrcodeurl != '') {
  506. $('#img_baidu_qrcode').attr('src', baidu_qrcodeurl);
  507. setTimeout(function(){
  508. $('#img_baidu_qrcode').attr('width', 122).attr('height', 122);
  509. },100);
  510. }
  511. }
  512. $.ajax({
  513. url: "{:url('Canal/ajax_get_baidu_qrcode', ['_ajax'=>1])}",
  514. type: 'GET',
  515. dataType: 'JSON',
  516. data: {},
  517. success: function (res) {
  518. if (1 == res.code) {
  519. $('#span_baidu_qrcode').hide();
  520. $('#img_baidu_qrcode').attr('src', '');
  521. $('#img_baidu_qrcode').attr('src', res.data.qrcodeurl).attr('width', 122).attr('height', 122).show();
  522. } else {
  523. $('#span_baidu_qrcode').html(res.msg);
  524. $('#img_baidu_qrcode').hide();
  525. return false;
  526. }
  527. },
  528. error: function (e) {
  529. $('#span_baidu_qrcode').html(e.responseText);
  530. $('#img_baidu_qrcode').hide();
  531. return false;
  532. }
  533. });
  534. }
  535. ajax_get_baidu_qrcode();
  536. });
  537. // 判断输入框是否为空
  538. function checkBaiduForm(){
  539. var baidu_appid = $.trim($('#baidu_appid').val());
  540. var baidu_appkey = $.trim($('#baidu_appkey').val());
  541. var baidu_appsecret = $.trim($('#baidu_appsecret').val());
  542. if (baidu_appid != '' || baidu_appkey != '' || baidu_appsecret != '') {
  543. if(baidu_appid == ''){
  544. showErrorMsg('App ID不能为空!');
  545. $('input[name=baidu_appid]').focus();
  546. return false;
  547. }
  548. if(baidu_appkey == ''){
  549. showErrorMsg('App Key不能为空!');
  550. $('input[name=baidu_appkey]').focus();
  551. return false;
  552. }
  553. if(baidu_appsecret == ''){
  554. showErrorMsg('App Secret不能为空!');
  555. $('input[name=baidu_appsecret]').focus();
  556. return false;
  557. }
  558. }
  559. layer_loading('正在处理');
  560. $.ajax({
  561. url: "{:url('Canal/conf_baidu', ['_ajax'=>1])}",
  562. type: 'POST',
  563. dataType: 'JSON',
  564. data: $('#baidu_post_form').serialize(),
  565. success: function (res) {
  566. layer.closeAll();
  567. if (1 == res.code) {
  568. layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
  569. window.location.reload();
  570. });
  571. } else {
  572. showErrorAlert(res.msg);
  573. return false;
  574. }
  575. },
  576. error: function (e) {
  577. layer.closeAll();
  578. showErrorAlert(e.responseText);
  579. return false;
  580. }
  581. });
  582. }
  583. </script>
  584. <div class="flexigrid htitx">
  585. <form class="form-horizontal" id="toutiao_post_form">
  586. <div class="hDiv">
  587. <div class="hDivBox">
  588. <table cellspacing="0" cellpadding="0" style="width: 100%">
  589. <thead>
  590. <tr>
  591. <th class="sign w10" axis="col0">
  592. <div class="tc"></div>
  593. </th>
  594. <th abbr="article_title" axis="col3" class="w10">
  595. <div class="tc">抖音小程序</div>
  596. </th>
  597. <th abbr="ac_id" axis="col4">
  598. <div class=""></div>
  599. </th>
  600. </tr>
  601. </thead>
  602. </table>
  603. </div>
  604. </div>
  605. <div class="ncap-form-default" style="position: sticky;">
  606. <dl class="row"><dt class="tit"><label><b>抖音登录</b></label></dt></dl>
  607. <dl class="row">
  608. <dt class="tit">
  609. <label for="toutiao_appid">
  610. <em id="em_toutiao_appid" {empty name='$toutiao_data.appid'} style="display: none;" {/empty}>*</em>AppID
  611. </label>
  612. </dt>
  613. <dd class="opt">
  614. <input type="text" name="toutiao_appid" id="toutiao_appid" value="{$toutiao_data.appid|default=''}" class="input-txt" autocomplete="off">
  615. <p class="notic">小程序ID</p>
  616. </dd>
  617. </dl>
  618. <dl class="row">
  619. <dt class="tit">
  620. <label for="toutiao_appsecret">
  621. <em id="em_toutiao_appsecret" {empty name='$toutiao_data.secret'} style="display: none;" {/empty}>*</em>AppSecret
  622. </label>
  623. </dt>
  624. <dd class="opt">
  625. <input type="text" name="toutiao_appsecret" id="toutiao_appsecret" value="{$toutiao_data.secret|default=''}" class="input-txt" autocomplete="off">
  626. <p class="notic">小程序密钥</p>
  627. </dd>
  628. </dl>
  629. <dl class="row"><dt class="tit"><label><b>抖音支付</b></label></dt></dl>
  630. <dl class="row">
  631. <dt class="tit">
  632. <label for="toutiao_salt">SALT</label>
  633. </dt>
  634. <dd class="opt">
  635. <input type="text" name="toutiao_salt" id="toutiao_salt" value="{$toutiao_data.salt|default=''}" class="input-txt" autocomplete="off">
  636. <p class="notic">请在抖音开放平台-【某某小程序】-【能力】-【支付】-【支付方式管理】-【支付设置】中查看支付系统秘钥 SALT</p>
  637. </dd>
  638. </dl>
  639. <div class="bot">
  640. <a href="JavaScript:void(0);" onclick="checkFormToutiao();" class="ncap-btn-big ncap-btn-green">确认提交</a>
  641. </div>
  642. </div>
  643. <!-- <div class="" style="position: absolute;top: 53px;left: 750px;">
  644. <dl class="row {empty name='$weixin_qrcodeurl'}none{/empty}" id="dl_weixin_qrcode" style="background: #fff;">
  645. <dd class="opt">
  646. <span id="weixin_span_qrcode"></span>
  647. <div class="ercodepic">
  648. <img id="weixin_img_qrcode" src="__STATIC__/common/images/loading.gif" width="23" height="23" />
  649. </div>
  650. <p class="notic"></p>
  651. </dd>
  652. <dt class="tit" style="text-align: center;line-height: 32px;font-size: 16px;">
  653. <label for="baidu_qrcode">扫码浏览小程序</label>
  654. </dt>
  655. </dl>
  656. </div> -->
  657. </form>
  658. </div>
  659. <script type="text/javascript">
  660. $(function() {
  661. $('#toutiao_appid, #toutiao_appsecret').keyup(function(){
  662. var toutiao_appid = $.trim($('#toutiao_appid').val());
  663. var toutiao_appsecret = $.trim($('#toutiao_appsecret').val());
  664. if (toutiao_appid != '' || toutiao_appsecret != '') {
  665. $('#em_toutiao_appid').show();
  666. $('#em_toutiao_appsecret').show();
  667. } else {
  668. $('#em_toutiao_appid').hide();
  669. $('#em_toutiao_appsecret').hide();
  670. }
  671. });
  672. // function ajax_get_weixin_qrcode() {
  673. // var weixin_appid = $.trim($('#weixin_appid').val());
  674. // var weixin_appsecret = $.trim($('#weixin_appsecret').val());
  675. // if (weixin_appid != '' && weixin_appsecret != '') {
  676. // $('#dl_weixin_qrcode').show();
  677. // var weixin_qrcodeurl = "{$weixin_qrcodeurl}";
  678. // if (weixin_qrcodeurl != '') {
  679. // $('#weixin_img_qrcode').attr('src', weixin_qrcodeurl);
  680. // setTimeout(function(){
  681. // $('#weixin_img_qrcode').attr('width', 122).attr('height', 122);
  682. // },100);
  683. // }
  684. // }
  685. // $.ajax({
  686. // url: "{:url('Canal/ajax_get_weixin_qrcode', ['_ajax'=>1])}",
  687. // type: 'GET',
  688. // dataType: 'JSON',
  689. // data: {},
  690. // success: function (res) {
  691. // if (1 == res.code) {
  692. // $('#weixin_span_qrcode').hide();
  693. // $('#weixin_img_qrcode').attr('src', '');
  694. // $('#weixin_img_qrcode').attr('src', res.data.qrcodeurl).attr('width', 122).attr('height', 122).show();
  695. // } else {
  696. // $('#weixin_span_qrcode').html(res.msg);
  697. // $('#weixin_img_qrcode').hide();
  698. // return false;
  699. // }
  700. // },
  701. // error: function (e) {
  702. // $('#weixin_span_qrcode').html(e.responseText);
  703. // $('#weixin_img_qrcode').hide();
  704. // return false;
  705. // }
  706. // });
  707. // }
  708. // ajax_get_weixin_qrcode();
  709. });
  710. // 判断输入框是否为空
  711. function checkFormToutiao() {
  712. var toutiao_appid = $.trim($('#toutiao_appid').val());
  713. var toutiao_appsecret = $.trim($('#toutiao_appsecret').val());
  714. if (toutiao_appid == '') {
  715. showErrorMsg('AppID不能为空!');
  716. $('#toutiao_appid').focus();
  717. return false;
  718. }
  719. if (toutiao_appsecret == '') {
  720. showErrorMsg('AppSecret不能为空!');
  721. $('#toutiao_appsecret').focus();
  722. return false;
  723. }
  724. layer_loading('正在处理');
  725. $.ajax({
  726. url: "{:url('Canal/conf_toutiao', ['_ajax'=>1])}",
  727. type: 'POST',
  728. dataType: 'JSON',
  729. data: $('#toutiao_post_form').serialize(),
  730. success: function (res) {
  731. layer.closeAll();
  732. if (1 == res.code) {
  733. layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
  734. window.location.reload();
  735. });
  736. } else {
  737. showErrorAlert(res.msg);
  738. return false;
  739. }
  740. },
  741. error: function (e) {
  742. layer.closeAll();
  743. showErrorAlert(e.responseText);
  744. return false;
  745. }
  746. });
  747. }
  748. </script>
  749. </div>
  750. {include file="public/footer" /}