123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta content="yes" name="apple-mobile-web-app-capable">
- <meta name="viewport"
- content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=0" />
- <link rel="stylesheet" type="text/css" href="./public/public_css.css" />
- <script type="text/javascript" src="./public/public.js"></script>
- <script type="text/javascript" src="./public/jquery-2.1.0.js"></script>
- <title>淘宝授权</title>
- <style>
- .container {
- width: 300px;
- height: 100px;
- position: absolute;
- top: 0;
- left: 0;
- bottom: 0;
- right: 0;
- margin: auto;
- display: none;
- }
- .hint {
- font-size: 13px;
- line-height: 30rpx;
- color: #666;
- text-align: center;
- }
- .button {
- display: block;
- width: 260px;
- line-height: 40px;
- border-radius: 40px;
- font-size: 16px;
- background-color: #eeeeee;
- color: #FFFFFF;
- background: linear-gradient(45deg, rgb(244, 117, 42), rgb(239, 15, 42));
- margin: auto;
- margin-top: 30px;
- }
- .errnoHint {
- width: 100%;
- height: 100px;
- font-size: 13px;
- line-height: 30rpx;
- color: #666;
- text-align: center;
- position: fixed;
- top: 0;
- bottom: 0;
- margin: auto;
- display: none;
- }
- </style>
- </head>
- <body>
- <div class="container">
- <div class="hint">您已完成淘宝授权,点击下方按钮进入小程序</div>
- <button class="button">进入小程序</button>
- </div>
- <div class="errnoHint">
- <!-- 淘宝授权失败原因 -->
- </div>
- </body>
- <script>
- const params = getQueryUrl();
- $().ready(function () {
- console.log(params, 'params')
- if (params.h5 == 'applet') { // 根据地址栏判断是h5(小程序使用)进来的,区分之前猎豆app使用此页面
- uploadData()
- }
- })
- //上传取到的数据
- async function uploadData () {
- $.ajax({
- type: "post",
- url: "https://ld.726p.com/api/v2/relationAuth/tbkUserToAuth",
- dataType: 'json',
- headers: {
- token: params.token,
- },
- data: params,
- success: function (res) {
- if (res.rst.flag == 1) {
- $('.container').show()
- } else {
- $('.errnoHint').show()
- $('.errnoHint').html(res.rst.msg)
- }
- }
- });
- }
- // 获取地址栏信息
- function getQueryUrl () {
- let url = window.location.href;
- let result = {};
- if (url.indexOf('?') > -1) {
- let str = url.split('?')[1];
- let temp = str.split('&');
- for (let i = 0; i < temp.length; i++) {
- let temp2 = temp[i].split('=');
- result[temp2[0]] = temp2[1]
- }
- }
- return result
- }
- </script>
- </html>
|