merge limo to daylight
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<!--sso login-->
|
||||
<template>
|
||||
<view class="container">
|
||||
<web-view :src="url"></web-view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
@@ -11,26 +10,46 @@
|
||||
url:'',
|
||||
intervalId:null,
|
||||
newUrl:'',
|
||||
siteData:null
|
||||
siteData:null,
|
||||
samlWebview:null
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.siteData = uni.getStorageSync("siteData");
|
||||
if(options && options.uid && options.pwd){
|
||||
let username = options.uid.replaceAll(" ", "+");
|
||||
let password = options.pwd.replaceAll(" ", "+");
|
||||
this.url = this.siteData.internalUrl + this.siteData.apiPath + "/app/sso/login_saml_with_mfa?username="+encodeURIComponent(username)+"&password="+encodeURIComponent(password);
|
||||
}
|
||||
if (options && options.url){
|
||||
this.url = options.url;
|
||||
}
|
||||
this.listenUrl()
|
||||
},
|
||||
this.siteData = uni.getStorageSync("siteData");
|
||||
if(options && options.uid && options.pwd){
|
||||
let username = options.uid.replaceAll(" ", "+");
|
||||
let password = options.pwd.replaceAll(" ", "+");
|
||||
const loginUrl = this.siteData.internalUrl + this.siteData.apiPath + "/app/sso/login_saml_with_mfa?username="+encodeURIComponent(username)+"&password="+encodeURIComponent(password);
|
||||
this.url = loginUrl;
|
||||
this.openWebview(loginUrl);
|
||||
}
|
||||
if (options && options.url){
|
||||
this.url = options.url;
|
||||
this.openWebview(options.url);
|
||||
}
|
||||
this.listenUrl()
|
||||
},
|
||||
onShow() {
|
||||
this.siteData = uni.getStorageSync("siteData");
|
||||
},
|
||||
methods: {
|
||||
listenUrl() {
|
||||
openWebview(loginUrl) {
|
||||
// #ifdef APP-PLUS
|
||||
const wv = plus.webview.create(loginUrl, 'saml-login-webview', {
|
||||
'uni-app': 'none',
|
||||
top: '0px',
|
||||
bottom: '0px',
|
||||
additionalHttpHeaders: {
|
||||
'Origin': 'MGM_MCRM_APP'
|
||||
}
|
||||
});
|
||||
this.samlWebview = wv;
|
||||
const pages = getCurrentPages();
|
||||
const page = pages[pages.length - 1];
|
||||
page.$getAppWebview().append(wv);
|
||||
// #endif
|
||||
},
|
||||
listenUrl() {
|
||||
var that = this;
|
||||
var count = 0;
|
||||
this.intervalId = setInterval(() => {
|
||||
@@ -75,6 +94,11 @@
|
||||
}
|
||||
},
|
||||
getCurrentUrl(){
|
||||
if (this.samlWebview) {
|
||||
var url = this.samlWebview.getURL();
|
||||
console.log("=======当前地址======", url);
|
||||
return url;
|
||||
}
|
||||
var pages = getCurrentPages();
|
||||
var page = pages[pages.length - 1];
|
||||
var currentWebview = page.$getAppWebview();
|
||||
|
||||
Reference in New Issue
Block a user