123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8"/>
- <meta name="author" content=""/>
- <meta name="description" content=""/>
- <meta name="keywords" content="扫码支付,线上投币,运营数据,物联网"/>
- <meta name="format-detection" content="telphone=no,email=no"/>
- <meta name="viewport"
- content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
- <meta http-equiv="pragma" content="no-cache">
- <meta http-equiv="cache-control" content="no-cache">
- <meta http-equiv="expires" content="0">
- <title>功能配置</title>
- <link rel="stylesheet" href="/components/lib/mui.min.css"/>
- <link rel="stylesheet" href="/components/custom/css/common.css"/>
- <link rel="stylesheet" href="/app/css/xyf.common.min.css">
- <style>
- * {
- /**IOS不兼容,需要手动复制方式**/
- -webkit-user-select: text !important;
- }
- #fooText {
- text-align: left;
- word-break: break-all;
- }
- #foo {
- height: 0;
- opacity: 0;
- padding: 0;
- margin: 0;
- position: absolute;
- }
- </style>
- </head>
- <body>
- <div class="mui-content" style="bottom: 0;top: 0;position: absolute;width: 100%;">
- <h5 class="mui-content-padded c-black">开关配置</h5>
- <div class="card-panel">
- <ul class="mui-table-view account-bd">
- <li class="mui-table-view-cell">
- <i class="iconfont icon-duoren c-green mui-pull-left"></i>
- 关注公众号才能使用
- <div class="switch switch-mini commonSwitch" key="forceFollowGzh">
- <div class="switch-handle"></div>
- </div>
- </li>
- </ul>
- </div>
- <div id="hide_dealer_register_url" class="mui-hidden">
- <h5 class="mui-content-padded c-black">生成我的推广链接,让经销商自行注册</h5>
- <ul class="mui-table-view account-bd">
- <li class="mui-table-view-cell">
- <a class="mui-navigate-right copyBtn copyUrl">
- <i class="iconfont icon-url c-primary"></i>生成经销商注册URL
- </a>
- </li>
- </ul>
- </div>
- <div id="apiSupport" class="mui-hidden">
- <h5 class="mui-content-padded c-black">获取API签名,注意保密,不要泄露</h5>
- <ul class="mui-table-view account-bd">
- <li class="mui-table-view-cell">
- <a class="mui-navigate-right copyBtn copyApi">
- <i class="iconfont icon-password c-green"></i>获取API签名
- </a>
- </li>
- </ul>
- </div>
- </div>
- <div class="mui-popup mui-popup-in dialog" style="display: none">
- <div class="mui-popup-inner">
- <div class="mui-popup-title">复制</div>
- <div class="mui-popup-text" id="fooText"></div>
- <input type="text" value="" id="foo">
- </div>
- <div class="mui-popup-buttons">
- <span class="mui-popup-button cancel-btn">取消</span>
- <span class="mui-popup-button mui-popup-button-bold copy-btn iconfont icon-copy" data-clipboard-target="#foo"> 复制</span>
- </div>
- </div>
- <div class="mui-popup-backdrop mui-active dialog-mask" style="display: none"></div>
- </body>
- <script src="/components/lib/jquery.min.js?v=1"></script>
- <script src="/components/lib/mui.min.js"></script>
- <script src="/components/lib/clipboard.min.js"></script>
- <script src="/components/custom/js/common.js"></script>
- <script src="/app/js/xyf.common.js"></script>
- <script>
- var agentId = null;
- getFeatureList("agent", {list: ['apiSupport', 'hide_dealer_register_url']}, function (payload) {
- //提现模块
- if (payload.apiSupport) {
- $("#apiSupport").removeClass("mui-hidden")
- }
- if (!payload.hide_dealer_register_url) {
- $("#hide_dealer_register_url").removeClass("mui-hidden")
- }
- });
- $(function () {
- //获取用户个人信息
- showLoading();
- sendRequest("/agent/accountInfo", "GET", null, function (response) {
- hideLoading();
- if (response.result == 1) {
- $("#headImg").attr("src", response.para.avatar);
- agentId = response.para.agentId;
- if (response.para.forceFollowGzh) {
- $('[key="forceFollowGzh"]').addClass("active");
- }
- } else {
- mui.toast(response.description);
- }
- });
- //自定义弹窗事件绑定
- $(".cancel-btn").on('tap', function (e) {
- $(".dialog").hide(300);
- $(".dialog-mask").hide(300);
- });
- $(".copy-btn").on('tap', function (e) {
- //必须加缓冲动画,否则事件穿透,跑到别的页面去了
- $(".dialog").hide(300);
- $(".dialog-mask").hide(300);
- });
- //在弹窗绑定 COPY组件
- var clipboard = new Clipboard('.copy-btn');
- clipboard.on('success', function (e) {
- e.clearSelection();
- mui.toast("复制成功");
- });
- clipboard.on('error', function (e) {
- mui.toast("请选择“拷贝”进行复制!")
- });
- //复制组件 ,使用tap事件会导致点击到弹窗输入框
- $('.copyBtn').on('click', function (e) {
- if ($(this).hasClass('copyApi')) {
- sendRequest({
- url: "/agent/getSign",
- type: "GET",
- data: {},
- success: function (res) {
- clickEnd(res.payload.sign)
- }
- });
- } else if ($(this).hasClass('copyUrl')) {
- //初始化 推广URL
- var currentDomain = location.protocol + "//" + location.host;
- var url = currentDomain + "/dealerAccess?agentId=" + agentId;
- if (agentId == null) {
- mui.toast("代理商ID未获取,请稍等再试!");
- return;
- }
- clickEnd(url)
- }
- function clickEnd(copyVal) {
- $("#foo").val(copyVal);
- $("#fooText").text(copyVal);
- $(".dialog").show();
- $(".dialog-mask").show();
- }
- });
- });
- var agentInfo = null;
- $('.mui-table-view-cell').on('tap', '.switch', function () {
- var that = this;
- $(this).toggleClass('active');
- var active = $(this).hasClass('active') ? true : false;
- var key = $(this).attr("key");
- var data = {};
- data[key] = active;
- if ($(this).hasClass('commonSwitch')) {
- if (agentInfo == null) {
- sendRequest({
- url: "/agent/getAgentInfo",
- type: "GET",
- data: {},
- success: function (res) {
- agentInfo = res.para;
- goSet()
- }
- });
- } else {
- goSet()
- }
- function goSet() {
- if (agentInfo.gzhServiceQrcodeUrl) {
- sendRequest('/agent/toggleSwitches', 'post', JSON.stringify(data),
- function (res) {
- if (res.result == 1) {
- mui.toast('设置成功');
- } else {
- mui.toast(res.description);
- }
- })
- } else {
- $(that).toggleClass('active');//切换到原状态
- var btnArray = ['取消', '去上传'];
- mui.confirm('请您先上传公众号二维码', '温馨提示', btnArray, function (e) {
- if (e.index == 1) {
- goPage("brand-setting.html");
- }
- });
- }
- }
- }
- });
- </script>
- </html>
|