@@ -13,21 +13,24 @@ export const useUserPage = ({web, status}) => {
1313 const user = useUserStore ( )
1414 const canGoBack = ref ( false )
1515
16- const webUrlList = [
16+ const whiteUrl = [
1717 '/app_manager/user' ,
1818 '/member_vip' ,
1919 '/login' ,
2020 '/register' ,
2121 '/logout'
2222 ]
23+ const urlMap = {
24+ '/app_manager/user' : '/member' ,
25+ }
2326
2427 const getUrl = ( ) => {
2528 const url = web . value . getURL ( )
2629 return new URL ( url ) . pathname ;
2730 }
2831
2932 const getCanGoBack = ( ) => {
30- if ( webUrlList [ 0 ] === getUrl ( ) ) {
33+ if ( whiteUrl [ 0 ] === getUrl ( ) ) {
3134 return false
3235 }
3336 return true
@@ -45,19 +48,30 @@ export const useUserPage = ({web, status}) => {
4548 web . value . executeJavaScript ( `document.body.setAttribute('data-theme', 'dark');` )
4649 }
4750 } )
51+ web . value . addEventListener ( 'close' , ( event : any ) => {
52+ if ( web . value . isDevToolsOpened ( ) ) {
53+ web . value . closeDevTools ( )
54+ }
55+ } )
4856 web . value . addEventListener ( 'dom-ready' , ( e ) => {
4957 // web.value.openDevTools()
5058 window . $mapi . user . refresh ( )
5159 canGoBack . value = getCanGoBack ( )
52- web . value . insertCSS ( `.pb-page-member-vip .top{ padding-left: 5rem; }` )
5360 web . value . executeJavaScript ( `
5461document.addEventListener('click', (event) => {
5562 const target = event.target;
5663 if (target.tagName !== 'A') return;
57- const url = target.href
64+ let url = target.href
5865 if(url.startsWith('javascript:')) return;
59- const urlPath = new URL(url).pathname;
60- const whiteList = ${ JSON . stringify ( webUrlList ) } ;
66+ let urlPath = new URL(url).pathname;
67+ const urlMap = ${ JSON . stringify ( urlMap ) } ;
68+ if(urlMap[urlPath]) {
69+ urlPath = urlMap[urlPath];
70+ const urlNew = new URL(url);
71+ urlNew.pathname = urlPath;
72+ url = urlNew.toString();
73+ }
74+ const whiteList = ${ JSON . stringify ( whiteUrl ) } ;
6175 if (whiteList.includes(urlPath)) return;
6276 event.preventDefault();
6377 window.$mapi.user.openWebUrl(url)
0 commit comments