Commit 6389984a by huyue

提交账户中心修改sessionId

1 parent 51584c5a
This diff could not be displayed because it is too large.
<template> <template>
<div> <IframeBox :iframeSrc="iframeSrc" :iframeUrl="iframeUrl"></IframeBox>
<iframe
id="myIframe"
class="box"
allowfullscreen
:src="iframeSrc + iframeUrlWithParams"
></iframe>
</div>
</template> </template>
<script> <script>
import { baseConfig } from "@/main" import { baseConfig } from "@/main"
import { mapState } from 'vuex' import IframeBox from "./components/iframeBox"
export default { export default {
data() { data() {
return { return {
// iframeSrc: 'https://oss-account-padtest.glsx.com.cn/customer/account', // iframeSrc: baseConfig.accountUrl + '/customer/account',
iframeSrc: baseConfig.accountUrl + '/customer/account', iframeSrc: 'http://192.168.1.68:8085' + '/customer/account',
iframeUrl: '/index.html' iframeUrl: '/index.html'
}; };
}, },
computed: { components: {IframeBox},
iframeUrlWithParams() {
// 检查是否已经有 t 参数
if (this.iframeUrl.includes('?t=')) {
// 如果已经有 t 参数,替换它
return this.iframeUrl.replace(/(\?|&)t=[^&]+/, '$1t=' + this.SSOInfo.t);
} else {
// 如果没有 t 参数,添加它
return this.iframeUrl.includes('?')
? this.iframeUrl + '&t=' + this.SSOInfo.t
: this.iframeUrl + '?t=' + this.SSOInfo.t;
}
},
...mapState({
SSOInfo: (state) => state.d2admin.user.SSOInfo,
})
},
mounted() {
// 监听来自 iframe 的消息
window.addEventListener('message', (event) => {
console.log('收到 iframe 消息:', event.data);
if (event.data.type === 'location-change') {
console.log('Iframe 地址已改变:', event.data.url);
// 在这里可以执行其他操作,比如更新 iframe 的 src 属性
this.handleIframeLocationChange(event.data.url);
}
});
},
methods: {
handleIframeLocationChange(url) {
const iframe = document.getElementById('myIframe');
const internalUrl = url;
let newInternalUrl = internalUrl;
if (internalUrl.includes('?t=')) {
newInternalUrl = internalUrl.replace(/(\?|&)t=[^&]+/, '$1t=' + this.SSOInfo.t);
} else {
newInternalUrl = internalUrl.includes('?')
? internalUrl + '&t=' + this.SSOInfo.t
: internalUrl + '?t=' + this.SSOInfo.t;
}
console.log('新的内部地址:', newInternalUrl);
this.iframeUrl = newInternalUrl
}
}
}; };
</script>
<style lang="scss" scoped>
.box {
position: absolute;
width: 97%;
height: 96%;
border: 0;
margin: 20px;
background-color: #fff;
}
</style>
\ No newline at end of file \ No newline at end of file
</script>
\ No newline at end of file \ No newline at end of file
<template>
<div>
<iframe
id="myIframe"
class="box"
allowfullscreen
:src="iframeSrc + iframeUrlWithParams"
></iframe>
</div>
</template>
<script>
import { mapState, mapActions } from 'vuex'
export default {
name: 'IframeBox',
props: {
// 域名 + 固定不会变的前缀
iframeSrc: {
type: String,
default: ''
},
// 具体页面地址
iframeUrl: {
type: String,
default: ''
}
},
data() {
return {
url: ''
}
},
watch: {
iframeUrl(value) {
return this.url = value
}
},
computed: {
iframeUrlWithParams() {
// 检查是否已经有 t 参数
if (this.url.includes('?t=')) {
// 如果已经有 t 参数,替换它
return this.url.replace(/(\?|&)t=[^&]+/, '$1t=' + this.SSOInfo.t);
} else {
// 如果没有 t 参数,添加它
return this.url.includes('?')
? this.url + '&t=' + this.SSOInfo.t
: this.url + '?t=' + this.SSOInfo.t;
}
},
...mapState({
SSOInfo: (state) => state.d2admin.user.SSOInfo,
})
},
mounted() {
// 监听来自 iframe 的消息
window.addEventListener('message', (event) => {
console.log('收到 iframe 消息:', event.data);
if (event.data.type === 'location-change') {
// 监听地址改变
console.log('Iframe 地址已改变:', event.data.url);
// 在这里可以执行其他操作,比如更新 iframe 的 src 属性
this.handleIframeLocationChange(event.data.url);
} else if (event.data.type === 'logout') {
// 监听登录过期需要登出
// this.$router.push('/login')
// this.logout()
// this.$StoreReset.call(this.$store) // 重置 store
}
});
},
methods: {
...mapActions('d2admin/account', ['logout']),
handleIframeLocationChange(url) {
const iframe = document.getElementById('myIframe');
const internalUrl = url;
let newInternalUrl = internalUrl;
if (internalUrl.includes('?t=')) {
newInternalUrl = internalUrl.replace(/(\?|&)t=[^&]+/, '$1t=' + this.SSOInfo.t);
} else {
newInternalUrl = internalUrl.includes('?')
? internalUrl + '&t=' + this.SSOInfo.t
: internalUrl + '?t=' + this.SSOInfo.t;
}
console.log('新的内部地址:', newInternalUrl);
this.url = newInternalUrl
}
}
}
</script>
<style lang="scss" scoped>
.box {
position: absolute;
width: 97%;
height: 96%;
border: 0;
margin: 20px;
background-color: #fff;
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<div> <IframeBox :iframeSrc="iframeSrc" :iframeUrl="iframeUrl"></IframeBox>
<iframe
id="myIframe"
class="box"
allowfullscreen
:src="iframeSrc + iframeUrlWithParams"
></iframe>
</div>
</template> </template>
<script> <script>
import { baseConfig } from "@/main" import { baseConfig } from "@/main"
import { mapState } from 'vuex' import IframeBox from "./components/iframeBox"
export default { export default {
data() { data() {
return { return {
// iframeSrc: 'https://oss-account-padtest.glsx.com.cn/customer/dictionaryManage', // iframeSrc: baseConfig.accountUrl + '/customer/dictionaryManage',
iframeSrc: baseConfig.accountUrl + '/customer/dictionaryManage', iframeSrc: 'http://192.168.1.68:8085' + '/customer/dictionaryManage',
iframeUrl: '/index.html' iframeUrl: '/index.html'
}; };
}, },
computed: { components: {IframeBox},
iframeUrlWithParams() {
// 检查是否已经有 t 参数
if (this.iframeUrl.includes('?t=')) {
// 如果已经有 t 参数,替换它
return this.iframeUrl.replace(/(\?|&)t=[^&]+/, '$1t=' + this.SSOInfo.t);
} else {
// 如果没有 t 参数,添加它
return this.iframeUrl.includes('?')
? this.iframeUrl + '&t=' + this.SSOInfo.t
: this.iframeUrl + '?t=' + this.SSOInfo.t;
}
},
...mapState({
SSOInfo: (state) => state.d2admin.user.SSOInfo,
})
},
mounted() {
// 监听来自 iframe 的消息
window.addEventListener('message', (event) => {
console.log('收到 iframe 消息:', event.data);
if (event.data.type === 'location-change') {
console.log('Iframe 地址已改变:', event.data.url);
// 在这里可以执行其他操作,比如更新 iframe 的 src 属性
this.handleIframeLocationChange(event.data.url);
}
});
},
methods: {
handleIframeLocationChange(url) {
const iframe = document.getElementById('myIframe');
const internalUrl = url;
let newInternalUrl = internalUrl;
if (internalUrl.includes('?t=')) {
newInternalUrl = internalUrl.replace(/(\?|&)t=[^&]+/, '$1t=' + this.SSOInfo.t);
} else {
newInternalUrl = internalUrl.includes('?')
? internalUrl + '&t=' + this.SSOInfo.t
: internalUrl + '?t=' + this.SSOInfo.t;
}
console.log('新的内部地址:', newInternalUrl);
this.iframeUrl = newInternalUrl
}
}
}; };
</script> </script>
<style lang="scss" scoped>
.box {
position: absolute;
width: 97%;
height: 96%;
border: 0;
margin: 20px;
background-color: #fff;
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<iframe <IframeBox :iframeSrc="iframeSrc"></IframeBox>
class="box"
allowfullscreen
:src="`${iframeSrc}?t=${SSOInfo.t}`"
></iframe>
</template> </template>
<script> <script>
import { baseConfig } from "@/main" import { baseConfig } from "@/main"
import { mapState } from 'vuex' import IframeBox from "./components/iframeBox"
export default { export default {
data() { data() {
return { return {
iframeSrc: baseConfig.merchantsUrl + '/html/employee/index.html' // iframeSrc: baseConfig.merchantsUrl + '/html/employee/index.html'
iframeSrc: 'http://192.168.1.68:5500' + '/html/employee/index.html'
} }
}, },
computed: { components: {IframeBox},
...mapState({
SSOInfo: (state) => state.d2admin.user.SSOInfo,
})
}
} }
</script> </script>
<style lang="scss" scoped>
.box {
position: absolute;
width: 97%;
height: 96%;
border: 0;
margin: 20px;
background-color: #fff;
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<iframe <IframeBox :iframeSrc="iframeSrc"></IframeBox>
class="box"
allowfullscreen
:src="`${iframeSrc}?t=${SSOInfo.t}`"
></iframe>
</template> </template>
<script> <script>
import { baseConfig } from "@/main" import { baseConfig } from "@/main"
import { mapState } from "vuex" import IframeBox from "./components/iframeBox"
export default { export default {
data() { data() {
return { return {
iframeSrc: baseConfig.accountUrl + '/productManage/functionList.html' // iframeSrc: baseConfig.accountUrl + '/productManage/functionList.html',
iframeSrc: 'http://192.168.1.68:8085' + '/productManage/functionList.html'
} }
}, },
computed: { components: {IframeBox},
...mapState({
SSOInfo: (state) => state.d2admin.user.SSOInfo,
})
}
} }
</script> </script>
<style lang="scss" scoped>
.box {
position: absolute;
width: 97%;
height: 96%;
border: 0;
margin: 20px;
background-color: #fff;
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<iframe <IframeBox :iframeSrc="iframeSrc"></IframeBox>
class="box"
allowfullscreen
:src="`${iframeSrc}?t=${SSOInfo.t}`"
></iframe>
</template> </template>
<script> <script>
import { baseConfig } from "@/main" import { baseConfig } from "@/main"
import { mapState } from 'vuex' import IframeBox from "./components/iframeBox"
export default { export default {
data() { data() {
return { return {
iframeSrc: baseConfig.accountUrl + '/productManage/menuList.html', // iframeSrc: baseConfig.accountUrl + '/productManage/menuList.html',
iframeSrc: 'http://192.168.1.68:8085' + '/productManage/menuList.html',
} }
}, },
computed: { components: {IframeBox},
...mapState({
SSOInfo: (state) => state.d2admin.user.SSOInfo,
})
}
} }
</script> </script>
<style lang="scss" scoped>
.box {
position: absolute;
width: 97%;
height: 96%;
border: 0;
margin: 20px;
background-color: #fff;
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<iframe <IframeBox :iframeSrc="iframeSrc"></IframeBox>
class="box"
allowfullscreen
:src="`${iframeSrc}?t=${SSOInfo.t}`"
></iframe>
</template> </template>
<script> <script>
import IframeBox from "./components/iframeBox"
import { baseConfig } from "@/main" import { baseConfig } from "@/main"
import { mapState } from 'vuex'
export default { export default {
data() { data() {
return { return {
iframeSrc: baseConfig.merchantsUrl + '/html/merchant/index.html', // iframeSrc: baseConfig.merchantsUrl + '/html/merchant/index.html',
iframeSrc: 'http://192.168.1.68:5500' + '/html/merchant/index.html'
} }
}, },
computed: { components: {IframeBox},
...mapState({
SSOInfo: (state) => state.d2admin.user.SSOInfo,
})
}
} }
</script>
<style lang="scss" scoped>
.box {
position: absolute;
width: 97%;
height: 96%;
border: 0;
margin: 20px;
background-color: #fff;
}
</style>
\ No newline at end of file \ No newline at end of file
</script>
\ No newline at end of file \ No newline at end of file
<template> <template>
<iframe <IframeBox :iframeSrc="iframeSrc"></IframeBox>
class="box"
allowfullscreen
:src="`${iframeSrc}?t=${SSOInfo.t}`"
></iframe>
</template> </template>
<script> <script>
import { baseConfig } from "@/main" import { baseConfig } from "@/main"
import { mapState } from 'vuex' import IframeBox from "./components/iframeBox"
export default { export default {
data() { data() {
return { return {
iframeSrc: baseConfig.accountUrl + '/productManage/productList.html' // iframeSrc: baseConfig.accountUrl + '/productManage/productList.html'
iframeSrc: 'http://192.168.1.68:8085' + '/productManage/productList.html'
} }
}, },
computed: { components: {IframeBox},
...mapState({
SSOInfo: (state) => state.d2admin.user.SSOInfo,
})
}
} }
</script> </script>
<style lang="scss" scoped>
.box {
position: absolute;
width: 97%;
height: 96%;
border: 0;
margin: 20px;
background-color: #fff;
}
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<iframe <IframeBox :iframeSrc="iframeSrc"></IframeBox>
class="box"
allowfullscreen
:src="`${iframeSrc}?t=${SSOInfo.t}`"
></iframe>
</template> </template>
<script> <script>
import { baseConfig } from "@/main" import { baseConfig } from "@/main"
import { mapState } from 'vuex' import IframeBox from "./components/iframeBox"
export default { export default {
data() { data() {
return { return {
iframeSrc: baseConfig.merchantsUrl + '/html/role/index.html' // iframeSrc: baseConfig.merchantsUrl + '/html/role/index.html',
iframeSrc: 'http://192.168.1.68:5500' + '/html/role/index.html',
} }
}, },
computed: { components: {IframeBox},
...mapState({
SSOInfo: (state) => state.d2admin.user.SSOInfo,
})
}
} }
</script>
<style lang="scss" scoped>
.box {
position: absolute;
width: 97%;
height: 96%;
border: 0;
margin: 20px;
background-color: #fff;
}
</style>
\ No newline at end of file \ No newline at end of file
</script>
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!