Commit 2b09573a authored by 陈孝伟's avatar 陈孝伟

兰蔻免登代码提交

parent 49233d86
......@@ -44,6 +44,20 @@ public class IndexController {
return modelAndView;
}
@GetMapping("/lankou/autologin")
public ModelAndView lankouAutologin() {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("lankou/autologin");
return modelAndView;
}
@GetMapping("/lankou/autologin3")
public ModelAndView lankouAutologin3() {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("lankou/autologin3");
return modelAndView;
}
@GetMapping("/jdshare")
public ModelAndView jdshare() {
ModelAndView modelAndView = new ModelAndView();
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>正在加载..</title>
<meta name="viewport"
content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="full-screen" content="true"/>
<meta name="screen-orientation" content="portrait"/>
<meta name="x5-fullscreen" content="true"/>
<meta name="360-fullscreen" content="true"/>
<script src="//yun.duiba.com.cn/aurora/assets/4c37d75a75d8e7534d9e3b056911ba06ac5bf8f8.js"></script>
<!-- <script src="//yun.duiba.com.cn/js-libs/vConsole/3.3.4/vconsole.min.js"></script> -->
<!-- jquery.min.js -->
<script src="//h5static.m.jd.com/act/jm-jdshare/2.0.0/jm-jdshare.js"></script>
<script src="//s3.pstatp.com/cdn/expire-1-M/jquery/3.3.1/jquery.min.js"></script>
<script>
// new VConsole();
</script>
<style>
.box {
width: 100%;
height: 100vh;
}
.box > div {
width: 100%;
height: 30px;
line-height: 30px;
text-align: center;
border: 2px solid #ccc;
margin: 5px 0;
}
</style>
</head>
<body>
<div class="box">
<!-- <div onclick="openLoginPanel()">唤起登录面板</div> -->
<!-- <div onclick="jumpToPage()">跳转</div> -->
</div>
<script language="javascript">
(function () {
openLoginPanel();
})()
function openLoginPanel() {
console.log("登录面板")
var isWechat = JSSDK.Client.isWeixin();
var isQQ = JSSDK.Client.isQQ();
if (isWechat || isQQ) {
var redirectUrlPrimary = window.location.href.replace('autologin', 'autologin3') + '&source=02'
var url = 'https://wq.jd.com/pinbind/pintokenredirect?biz=jm-business-center&url=' + encodeURIComponent(redirectUrlPrimary)
window.location.href = url;
return;
}
JSSDK.Isv.requestLogin(isLogin);
}
function isLogin(res) {
console.log("login回调/打开登录面板的回调", res)
setTimeout(function () {
console.log(res.data)
if (res.data == 1) {
// 已登录
getToken();
} else {
// 未登录
}
}, 0);
}
function getToken() {
console.log("进入获取token方法", window.location.href)
JSSDK.Isv.requestIsvToken({
url: window.location.href
}, callBackToken);
}
function callBackToken(res) {
console.log("获取token的返回", res)
autoLogin(res.data);
}
var pageUrl = "";
function autoLogin(token) {
var redirect = getUrlParam("redirect");
var env = getUrlParam("env");
var shopId = getUrlParam("shopId");
var venderId = getUrlParam("venderId");
var appKey = getUrlParam("appKey");
var needCredits = getUrlParam("needCredits");
$.ajax({
type: 'post',
url: `/open2Lankou/autologin`,
data: JSON.stringify({
token: token,
redirectUrl: redirect,
env: env,
shopId: shopId,
venderId: venderId,
appKey: appKey,
needCredits: needCredits
}),
async: false,
contentType: 'application/json',
dataType: 'json', //返回 JSON 数据
beforeSend: function () {
},
success: function (data, status) {
console.log("autoLogin返回参数:", data)
pageUrl = data.data;
console.log(pageUrl)
window.location.href = pageUrl;
},
complete: function () {
},
error: function (data, status, e) {
console.log("接口调用错误", e)
}
});
}
function jumpToPage() {
console.log(pageUrl)
window.location.href = pageUrl;
}
function getUrlParam(name) {
var search = window.location.search;
var matched = search
.slice(1)
.match(new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'));
return search.length ? matched && matched[2] : null;
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>正在加载..</title>
<meta name="viewport"
content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="full-screen" content="true"/>
<meta name="screen-orientation" content="portrait"/>
<meta name="x5-fullscreen" content="true"/>
<meta name="360-fullscreen" content="true"/>
<script src="//yun.duiba.com.cn/aurora/assets/4c37d75a75d8e7534d9e3b056911ba06ac5bf8f8.js"></script>
<!-- <script src="//yun.duiba.com.cn/js-libs/vConsole/3.3.4/vconsole.min.js"></script> -->
<!-- jquery.min.js -->
<script src="//h5static.m.jd.com/act/jm-jdshare/2.0.0/jm-jdshare.js"></script>
<script src="//s3.pstatp.com/cdn/expire-1-M/jquery/3.3.1/jquery.min.js"></script>
<script>
// new VConsole();
</script>
<style>
.box {
width: 100%;
height: 100vh;
}
.box > div {
width: 100%;
height: 30px;
line-height: 30px;
text-align: center;
border: 2px solid #ccc;
margin: 5px 0;
}
</style>
</head>
<body>
<div class="box">
<!-- <div onclick="openLoginPanel()">唤起登录面板</div> -->
<!-- <div onclick="jumpToPage()">跳转</div> -->
</div>
<script language="javascript">
(function () {
// openLoginPanel();
var token = getUrlParam("token");
autoLogin(token)
})()
function openLoginPanel() {
console.log("登录面板")
JSSDK.Isv.requestLogin(isLogin);
}
function isLogin(res) {
console.log("login回调/打开登录面板的回调", res)
setTimeout(function () {
console.log(res.data)
if (res.data == 1) {
// 已登录
getToken();
} else {
// 未登录
}
}, 0);
}
function getToken() {
console.log("进入获取token方法", window.location.href)
JSSDK.Isv.requestIsvToken({
url: window.location.href
}, callBackToken);
}
function callBackToken(res) {
console.log("获取token的返回", res)
autoLogin(res.data);
}
var pageUrl = "";
function autoLogin(token) {
var redirect = getUrlParam("redirect");
var env = getUrlParam("env");
var shopId = getUrlParam("shopId");
var venderId = getUrlParam("venderId");
var source = getUrlParam("source");
var appKey = getUrlParam("appKey");
var needCredits = getUrlParam("needCredits");
$.ajax({
type: 'post',
url: `/open2Lankou/autologin`,
data: JSON.stringify({
token: token,
redirectUrl: redirect,
source: '02',
env: env,
shopId: shopId,
venderId: venderId,
appKey: appKey,
needCredits: needCredits
}),
async: false,
contentType: 'application/json',
dataType: 'json', //返回 JSON 数据
beforeSend: function () {
},
success: function (data, status) {
console.log("autoLogin返回参数:", data)
pageUrl = data.data;
console.log(pageUrl)
window.location.href = pageUrl;
},
complete: function () {
},
error: function (data, status, e) {
console.log("接口调用错误", e)
}
});
}
function jumpToPage() {
console.log(pageUrl)
window.location.href = pageUrl;
}
function getUrlParam(name) {
var search = window.location.search;
var matched = search
.slice(1)
.match(new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'));
return search.length ? matched && matched[2] : null;
}
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment