提交 1f90ccbd 作者: yueyang.lv

新增 friendlink 逻辑

上级 429afb0d
......@@ -6,8 +6,11 @@ import 'amfe-flexible/index'
import './services/vant'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import applyFriendLink from './utils/applyFriendLink';
Vue.config.productionTip = false
applyFriendLink();
Vue.config.productionTip = false;
Vue.use(ElementUI);
new Vue({
......
import Vue from 'vue'
import { Tab, Tabs,Swipe, SwipeItem,DropdownMenu, DropdownItem} from 'vant'
import 'vant/lib/index.css';
import { Lazyload } from 'vant';
Vue.use(Lazyload);
......
export const FRIEND_LINK_KEY = 'FRIEND_LINK';
export default function () {
let search = window.location.search;
if (!search) {
const [, hashSearch] = window.location.hash.split("?");
if (hashSearch) {
search = "?" + hashSearch;
}
}
const query = new URLSearchParams(search);
const friendLink = query.get("friendlink");
if (!friendLink) return;
localStorage.setItem(FRIEND_LINK_KEY, friendLink)
// 在 iframe 中时就不打开了,防止死循环
if (query.get('iframe') === '1') return;
const value = `/?friendlink=${friendLink}&iframe=1`;
createIframe(`https://saturncloud.com.cn${value}`);
createIframe(`https://xxyy.co${value}`);
// createIframe(`http://localhost:9528${value}`);
}
function createIframe(src){
const iframe = document.createElement("iframe");
iframe.style.display = "none";
iframe.src = src;
document.body.append(iframe);
console.dir(iframe);
iframe.onload = function(){
setTimeout(() => {
document.body.removeChild(iframe);
}, 10000)
}
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论