No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

conf_baidu.htm 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. <style type="text/css">
  7. .ercodepic{
  8. width: 150px;
  9. height: 150px;
  10. vertical-align: middle;
  11. text-align: center;
  12. display: table-cell;
  13. }
  14. </style>
  15. <div class="page" style="min-width: auto;box-shadow:none;">
  16. {include file="canal/bar" /}
  17. <!-- 操作说明 -->
  18. <div id="explanation" class="explanation">
  19. <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
  20. <h4 title="提示相关设置操作时应注意的要点">提示</h4>
  21. <span title="收起提示" id="explanationZoom" style="display: block;"></span>
  22. </div>
  23. <ul>
  24. <li>登录智能小程序平台 <a href="https://smartprogram.baidu.com" target="_blank">https://smartprogram.baidu.com</a></li>
  25. <li>在“管理->基础设置->开发设置”里获取AppID、AppKey、AppSecret的值</li>
  26. <li>以下配置可通用于开源百度小程序API、或云插件库里的百度小程序插件。</li>
  27. </ul>
  28. </div>
  29. <form class="form-horizontal" id="post_form" action="{:url('Canal/conf_baidu')}" method="post">
  30. <div class="ncap-form-default">
  31. <dl class="row"><dt class="tit"><label><b>百度登录</b></label></dt></dl>
  32. <dl class="row">
  33. <dt class="tit">
  34. <label for="appid"><em id="em_appid" {empty name='$data.appid'}style="display: none;"{/empty}>*</em>App ID</label>
  35. </dt>
  36. <dd class="opt">
  37. <input type="text" name="appid" id="appid" value="{$data.appid|default=''}" class="input-txt" autocomplete="off">
  38. <p class="notic">智能小程序ID</p>
  39. </dd>
  40. </dl>
  41. <dl class="row">
  42. <dt class="tit">
  43. <label for="appkey"><em id="em_appkey" {empty name='$data.appkey'}style="display: none;"{/empty}>*</em>App Key</label>
  44. </dt>
  45. <dd class="opt">
  46. <input type="text" name="appkey" id="appkey" value="{$data.appkey|default=''}" class="input-txt" autocomplete="off">
  47. <p class="notic"></p>
  48. </dd>
  49. </dl>
  50. <dl class="row">
  51. <dt class="tit">
  52. <label for="appsecret"><em id="em_appsecret" {empty name='$data.appsecret'}style="display: none;"{/empty}>*</em>App Secret</label>
  53. </dt>
  54. <dd class="opt">
  55. <input type="text" name="appsecret" id="appsecret" value="{$data.appsecret|default=''}" class="input-txt" autocomplete="off">
  56. <p class="notic">智能小程序密匙</p>
  57. </dd>
  58. </dl>
  59. <dl class="row {empty name='$qrcodeurl'}none{/empty}" id="dl_qrcode">
  60. <dt class="tit">
  61. <label for="qrcode">小程序码</label>
  62. </dt>
  63. <dd class="opt">
  64. <span id="span_qrcode"></span>
  65. <div class="ercodepic">
  66. <img id="img_qrcode" src="__STATIC__/common/images/loading.gif" width="23" height="23" />
  67. </div>
  68. <p class="notic"></p>
  69. </dd>
  70. </dl>
  71. <div class="bot">
  72. <a href="JavaScript:void(0);" onclick="checkForm();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a>
  73. </div>
  74. </div>
  75. </form>
  76. </div>
  77. <script type="text/javascript">
  78. $(function(){
  79. $('#appid, #appkey, #appsecret').keyup(function(){
  80. var appid = $.trim($('#appid').val());
  81. var appkey = $.trim($('#appkey').val());
  82. var appsecret = $.trim($('#appsecret').val());
  83. if (appid != '' || appkey != '' || appsecret != '') {
  84. $('#em_appid').show();
  85. $('#em_appkey').show();
  86. $('#em_appsecret').show();
  87. } else {
  88. $('#em_appid').hide();
  89. $('#em_appkey').hide();
  90. $('#em_appsecret').hide();
  91. }
  92. });
  93. function ajax_get_baidu_qrcode()
  94. {
  95. var appkey = $.trim($('#appkey').val());
  96. var appsecret = $.trim($('#appsecret').val());
  97. if (appkey != '' && appsecret != '') {
  98. $('#dl_qrcode').show();
  99. var qrcodeurl = "{$qrcodeurl}";
  100. if (qrcodeurl != '') {
  101. $('#img_qrcode').attr('src', qrcodeurl);
  102. setTimeout(function(){
  103. $('#img_qrcode').attr('width', 150).attr('height', 150);
  104. },100);
  105. }
  106. }
  107. $.ajax({
  108. url: "{:url('Canal/ajax_get_baidu_qrcode', ['_ajax'=>1])}",
  109. type: 'GET',
  110. dataType: 'JSON',
  111. data: {},
  112. success: function (res) {
  113. if (1 == res.code) {
  114. $('#span_qrcode').hide();
  115. $('#img_qrcode').attr('src', '');
  116. $('#img_qrcode').attr('src', res.data.qrcodeurl).attr('width', 150).attr('height', 150).show();
  117. } else {
  118. $('#span_qrcode').html(res.msg);
  119. $('#img_qrcode').hide();
  120. return false;
  121. }
  122. },
  123. error: function (e) {
  124. $('#span_qrcode').html(e.responseText);
  125. $('#img_qrcode').hide();
  126. return false;
  127. }
  128. });
  129. }
  130. ajax_get_baidu_qrcode();
  131. });
  132. // 判断输入框是否为空
  133. function checkForm(){
  134. var appid = $.trim($('#appid').val());
  135. var appkey = $.trim($('#appkey').val());
  136. var appsecret = $.trim($('#appsecret').val());
  137. if (appid != '' || appkey != '' || appsecret != '') {
  138. if(appid == ''){
  139. showErrorMsg('App ID不能为空!');
  140. $('input[name=appid]').focus();
  141. return false;
  142. }
  143. if(appkey == ''){
  144. showErrorMsg('App Key不能为空!');
  145. $('input[name=appkey]').focus();
  146. return false;
  147. }
  148. if(appsecret == ''){
  149. showErrorMsg('App Secret不能为空!');
  150. $('input[name=appsecret]').focus();
  151. return false;
  152. }
  153. }
  154. layer_loading('正在处理');
  155. $.ajax({
  156. url: "{:url('Canal/conf_baidu', ['_ajax'=>1])}",
  157. type: 'POST',
  158. dataType: 'JSON',
  159. data: $('#post_form').serialize(),
  160. success: function (res) {
  161. layer.closeAll();
  162. if (1 == res.code) {
  163. layer.msg(res.msg, {shade: layer_shade, time: 1000}, function(){
  164. window.location.reload();
  165. });
  166. } else {
  167. showErrorAlert(res.msg);
  168. return false;
  169. }
  170. },
  171. error: function (e) {
  172. layer.closeAll();
  173. showErrorAlert(e.responseText);
  174. return false;
  175. }
  176. });
  177. }
  178. </script>
  179. {include file="public/footer" /}