UNPKG

gxd-vue-library

Version:

依赖与element Ui插件库,聚福宝福利PC端插件库

161 lines (150 loc) 4.56 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script> document.addEventListener('DOMContentLoaded', function () { document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px' }) var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)')) document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />') function parseURL() { var url = window.location.href; var a = document.createElement('a'); a.href = url; return { source: url, protocol: a.protocol.replace(':', ''), host: a.hostname, port: a.port, query: a.search, params: (function () { var ret = {}, seg = a.search.replace(/^\?/, '').split('&'), len = seg.length, i = 0, s; for (; i < len; i++) { if (!seg[i]) { continue; } s = seg[i].split('='); if (s[1]) { ret[s[0]] = s[1]; } } return ret; })(), file: (a.pathname.match(/\/([^\/?#]+)$/i) || [, ''])[1], hash: a.hash.replace('#', ''), path: a.pathname.replace(/^([^\/])/, '/$1'), relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [, ''])[1], segments: a.pathname.replace(/^\//, '').split('/') }; } function jsonToParams(params) { var paramsStr = ''; var count = 0; for (var key in params) { if (count === 0) { paramsStr = key + '=' + encodeURIComponent(params[key]); } else { paramsStr += '&' + key + '=' + encodeURIComponent(params[key]); } count++; } return paramsStr; } </script> <style type="text/css"> html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, menu, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, main, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; } /* HTML5 display-role reset for older browsers */ article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section { display: block; } /* HTML5 hidden-attribute fix for newer browsers */ *[hidden] { display: none; } body { line-height: 1; } menu, ol, ul { list-style: none; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } table { border-collapse: collapse; border-spacing: 0; } .app-container { padding: 2vw; font-size: 13px; } .app-container p { margin-bottom: 1em; color: #333; } </style> </head> <body> <div class="app-container" id="app-container"></div> <script> function getContent(url, data, success) { if (parseURL().path.indexOf('sandbox') !== -1) url = 'https://sandbox-gonghui.jufubao.cn/api/pb/host/get-agreement'; if (parseURL().path.indexOf('product') !== -1) url = 'https://gonghui.jufubao.cn/api/pb/host/get-agreement'; if(url.indexOf('?') === -1) url = url +'?'+ jsonToParams(data); else url = url + jsonToParams(data); var x = new XMLHttpRequest(); x.open("GET", url, true); x.responseType = "text"; x.onload = (e) => { var response = e.srcElement || e.currentTarget; if(response.status === 200 && response.readyState === 4) { success(eval("(" + response.responseText + ")")) } else { console.log('onerror'); console.error(response); } }; x.onerror = (e) => { console.log('onerror'); console.error(e); }; x.send(); } getContent( 'https://gonghui.jufubao.cn/api/pb/host/get-agreement', parseURL().params, function (res) { var content = document.getElementById('app-container'); content.innerHTML = res.result['agreement']; } ); </script> </body> </html>