account-config.html 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <meta name="author" content=""/>
  6. <meta name="description" content=""/>
  7. <meta name="keywords" content="扫码支付,线上投币,运营数据,物联网"/>
  8. <meta name="format-detection" content="telphone=no,email=no"/>
  9. <meta name="viewport"
  10. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
  11. <meta http-equiv="pragma" content="no-cache">
  12. <meta http-equiv="cache-control" content="no-cache">
  13. <meta http-equiv="expires" content="0">
  14. <title>功能配置</title>
  15. <link rel="stylesheet" href="/components/lib/mui.min.css"/>
  16. <link rel="stylesheet" href="/components/custom/css/common.css"/>
  17. <link rel="stylesheet" href="/app/css/xyf.common.min.css">
  18. <style>
  19. * {
  20. /**IOS不兼容,需要手动复制方式**/
  21. -webkit-user-select: text !important;
  22. }
  23. #fooText {
  24. text-align: left;
  25. word-break: break-all;
  26. }
  27. #foo {
  28. height: 0;
  29. opacity: 0;
  30. padding: 0;
  31. margin: 0;
  32. position: absolute;
  33. }
  34. </style>
  35. </head>
  36. <body>
  37. <div class="mui-content" style="bottom: 0;top: 0;position: absolute;width: 100%;">
  38. <h5 class="mui-content-padded c-black">开关配置</h5>
  39. <div class="card-panel">
  40. <ul class="mui-table-view account-bd">
  41. <li class="mui-table-view-cell">
  42. <i class="iconfont icon-duoren c-green mui-pull-left"></i>
  43. 关注公众号才能使用
  44. <div class="switch switch-mini commonSwitch" key="forceFollowGzh">
  45. <div class="switch-handle"></div>
  46. </div>
  47. </li>
  48. </ul>
  49. </div>
  50. <div id="hide_dealer_register_url" class="mui-hidden">
  51. <h5 class="mui-content-padded c-black">生成我的推广链接,让经销商自行注册</h5>
  52. <ul class="mui-table-view account-bd">
  53. <li class="mui-table-view-cell">
  54. <a class="mui-navigate-right copyBtn copyUrl">
  55. <i class="iconfont icon-url c-primary"></i>生成经销商注册URL
  56. </a>
  57. </li>
  58. </ul>
  59. </div>
  60. <div id="apiSupport" class="mui-hidden">
  61. <h5 class="mui-content-padded c-black">获取API签名,注意保密,不要泄露</h5>
  62. <ul class="mui-table-view account-bd">
  63. <li class="mui-table-view-cell">
  64. <a class="mui-navigate-right copyBtn copyApi">
  65. <i class="iconfont icon-password c-green"></i>获取API签名
  66. </a>
  67. </li>
  68. </ul>
  69. </div>
  70. </div>
  71. <div class="mui-popup mui-popup-in dialog" style="display: none">
  72. <div class="mui-popup-inner">
  73. <div class="mui-popup-title">复制</div>
  74. <div class="mui-popup-text" id="fooText"></div>
  75. <input type="text" value="" id="foo">
  76. </div>
  77. <div class="mui-popup-buttons">
  78. <span class="mui-popup-button cancel-btn">取消</span>
  79. <span class="mui-popup-button mui-popup-button-bold copy-btn iconfont icon-copy" data-clipboard-target="#foo"> 复制</span>
  80. </div>
  81. </div>
  82. <div class="mui-popup-backdrop mui-active dialog-mask" style="display: none"></div>
  83. </body>
  84. <script src="/components/lib/jquery.min.js?v=1"></script>
  85. <script src="/components/lib/mui.min.js"></script>
  86. <script src="/components/lib/clipboard.min.js"></script>
  87. <script src="/components/custom/js/common.js"></script>
  88. <script src="/app/js/xyf.common.js"></script>
  89. <script>
  90. var agentId = null;
  91. getFeatureList("agent", {list: ['apiSupport', 'hide_dealer_register_url']}, function (payload) {
  92. //提现模块
  93. if (payload.apiSupport) {
  94. $("#apiSupport").removeClass("mui-hidden")
  95. }
  96. if (!payload.hide_dealer_register_url) {
  97. $("#hide_dealer_register_url").removeClass("mui-hidden")
  98. }
  99. });
  100. $(function () {
  101. //获取用户个人信息
  102. showLoading();
  103. sendRequest("/agent/accountInfo", "GET", null, function (response) {
  104. hideLoading();
  105. if (response.result == 1) {
  106. $("#headImg").attr("src", response.para.avatar);
  107. agentId = response.para.agentId;
  108. if (response.para.forceFollowGzh) {
  109. $('[key="forceFollowGzh"]').addClass("active");
  110. }
  111. } else {
  112. mui.toast(response.description);
  113. }
  114. });
  115. //自定义弹窗事件绑定
  116. $(".cancel-btn").on('tap', function (e) {
  117. $(".dialog").hide(300);
  118. $(".dialog-mask").hide(300);
  119. });
  120. $(".copy-btn").on('tap', function (e) {
  121. //必须加缓冲动画,否则事件穿透,跑到别的页面去了
  122. $(".dialog").hide(300);
  123. $(".dialog-mask").hide(300);
  124. });
  125. //在弹窗绑定 COPY组件
  126. var clipboard = new Clipboard('.copy-btn');
  127. clipboard.on('success', function (e) {
  128. e.clearSelection();
  129. mui.toast("复制成功");
  130. });
  131. clipboard.on('error', function (e) {
  132. mui.toast("请选择“拷贝”进行复制!")
  133. });
  134. //复制组件 ,使用tap事件会导致点击到弹窗输入框
  135. $('.copyBtn').on('click', function (e) {
  136. if ($(this).hasClass('copyApi')) {
  137. sendRequest({
  138. url: "/agent/getSign",
  139. type: "GET",
  140. data: {},
  141. success: function (res) {
  142. clickEnd(res.payload.sign)
  143. }
  144. });
  145. } else if ($(this).hasClass('copyUrl')) {
  146. //初始化 推广URL
  147. var currentDomain = location.protocol + "//" + location.host;
  148. var url = currentDomain + "/dealerAccess?agentId=" + agentId;
  149. if (agentId == null) {
  150. mui.toast("代理商ID未获取,请稍等再试!");
  151. return;
  152. }
  153. clickEnd(url)
  154. }
  155. function clickEnd(copyVal) {
  156. $("#foo").val(copyVal);
  157. $("#fooText").text(copyVal);
  158. $(".dialog").show();
  159. $(".dialog-mask").show();
  160. }
  161. });
  162. });
  163. var agentInfo = null;
  164. $('.mui-table-view-cell').on('tap', '.switch', function () {
  165. var that = this;
  166. $(this).toggleClass('active');
  167. var active = $(this).hasClass('active') ? true : false;
  168. var key = $(this).attr("key");
  169. var data = {};
  170. data[key] = active;
  171. if ($(this).hasClass('commonSwitch')) {
  172. if (agentInfo == null) {
  173. sendRequest({
  174. url: "/agent/getAgentInfo",
  175. type: "GET",
  176. data: {},
  177. success: function (res) {
  178. agentInfo = res.para;
  179. goSet()
  180. }
  181. });
  182. } else {
  183. goSet()
  184. }
  185. function goSet() {
  186. if (agentInfo.gzhServiceQrcodeUrl) {
  187. sendRequest('/agent/toggleSwitches', 'post', JSON.stringify(data),
  188. function (res) {
  189. if (res.result == 1) {
  190. mui.toast('设置成功');
  191. } else {
  192. mui.toast(res.description);
  193. }
  194. })
  195. } else {
  196. $(that).toggleClass('active');//切换到原状态
  197. var btnArray = ['取消', '去上传'];
  198. mui.confirm('请您先上传公众号二维码', '温馨提示', btnArray, function (e) {
  199. if (e.index == 1) {
  200. goPage("brand-setting.html");
  201. }
  202. });
  203. }
  204. }
  205. }
  206. });
  207. </script>
  208. </html>