引入了fb

This commit is contained in:
luyuan 2020-10-28 15:23:28 +08:00
parent 62464051c3
commit 5c6e6b0516
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
5 changed files with 87 additions and 54 deletions

View File

@ -1,71 +1,87 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh_CN"> <html lang="zh_CN">
<head>
<head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title> <title><%= htmlWebpackPlugin.options.title %></title>
<script> <script>
//designWidth:设计稿的实际宽度值,需要根据实际设置 //designWidth:设计稿的实际宽度值,需要根据实际设置
//maxWidth:制作稿的最大宽度值,需要根据实际设置 //maxWidth:制作稿的最大宽度值,需要根据实际设置
//这段js的最后面有两个参数记得要设置一个为设计稿实际宽度一个为制作稿最大宽度例如设计稿为750最大宽度为750则为(750,750) //这段js的最后面有两个参数记得要设置一个为设计稿实际宽度一个为制作稿最大宽度例如设计稿为750最大宽度为750则为(750,750)
(function (designWidth, maxWidth) { (function (designWidth, maxWidth) {
var doc = document, var doc = document,
win = window, win = window,
docEl = doc.documentElement, docEl = doc.documentElement,
remStyle = document.createElement("style"), remStyle = document.createElement("style"),
tid; tid;
function refreshRem() { function refreshRem() {
var width = docEl.getBoundingClientRect().width; var width = docEl.getBoundingClientRect().width;
// maxWidth = maxWidth || 540; //不需要判断最大宽度 // maxWidth = maxWidth || 540; //不需要判断最大宽度
// width > maxWidth && (width = maxWidth); // width > maxWidth && (width = maxWidth);
var rem = width * 100 / designWidth; var rem = width * 100 / designWidth;
console.log(rem) console.log(rem)
remStyle.innerHTML = 'html{font-size:' + rem + 'px;}'; remStyle.innerHTML = 'html{font-size:' + rem + 'px;}';
} }
if (docEl.firstElementChild) { if (docEl.firstElementChild) {
docEl.firstElementChild.appendChild(remStyle); docEl.firstElementChild.appendChild(remStyle);
} else { } else {
var wrap = doc.createElement("div"); var wrap = doc.createElement("div");
wrap.appendChild(remStyle); wrap.appendChild(remStyle);
doc.write(wrap.innerHTML); doc.write(wrap.innerHTML);
wrap = null; wrap = null;
} }
//要等 wiewport 设置好后才能执行 refreshRem不然 refreshRem 会执行2次 //要等 wiewport 设置好后才能执行 refreshRem不然 refreshRem 会执行2次
refreshRem(); refreshRem();
win.addEventListener("resize", function () { win.addEventListener("resize", function () {
clearTimeout(tid); //防止执行两次 clearTimeout(tid); //防止执行两次
tid = setTimeout(refreshRem, 300); tid = setTimeout(refreshRem, 300);
}, false); }, false);
win.addEventListener("pageshow", function (e) { win.addEventListener("pageshow", function (e) {
if (e.persisted) { // 浏览器后退的时候重新计算 if (e.persisted) { // 浏览器后退的时候重新计算
clearTimeout(tid); clearTimeout(tid);
tid = setTimeout(refreshRem, 300); tid = setTimeout(refreshRem, 300);
} }
}, false); }, false);
if (doc.readyState === "complete") { if (doc.readyState === "complete") {
doc.body.style.fontSize = "16px"; doc.body.style.fontSize = "16px";
} else { } else {
doc.addEventListener("DOMContentLoaded", function (e) { doc.addEventListener("DOMContentLoaded", function (e) {
doc.body.style.fontSize = "16px"; doc.body.style.fontSize = "16px";
}, false); }, false);
} }
})(1366, 1024); })(1366, 1024);
</script> </script>
</head> </head>
<body>
<body>
<noscript> <noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
</body> <script>
</html> window.fbAsyncInit = function () {
FB.init({
appId: '277826133389999',
autoLogAppEvents: true,
xfbml: true,
version: 'v8.0'
});
};
</script>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js"></script>
</body>
</html>

4
src/import-png.d.ts vendored
View File

@ -11,4 +11,6 @@ declare module "ant-design-vue/es/locale/en_US" {
declare module "ant-design-vue/es/locale/zh_CN" { declare module "ant-design-vue/es/locale/zh_CN" {
const value: any; const value: any;
export default value; export default value;
} }
declare var FB: any;

View File

@ -53,6 +53,7 @@ export default createStore({
setUserInfo(state, userinfo){ setUserInfo(state, userinfo){
userinfo.money = userinfo.money.toString() userinfo.money = userinfo.money.toString()
state.userinfo = userinfo state.userinfo = userinfo
state.islogin = true;
}, },
login(state, islogin: boolean){ login(state, islogin: boolean){
state.islogin = islogin; state.islogin = islogin;

View File

@ -92,7 +92,7 @@
<div class="icons"> <div class="icons">
<img src="@/static/images/weixin.png" alt="" class="icon" /> <img src="@/static/images/weixin.png" alt="" class="icon" />
<img src="@/static/images/weibo.png" alt="" class="icon" /> <img src="@/static/images/weibo.png" alt="" class="icon" />
<img src="@/static/images/facebook.png" alt="" class="icon" /> <img src="@/static/images/facebook.png" alt="" class="icon" @click="slogin(3)" />
</div> </div>
</div> </div>
</div> </div>
@ -249,6 +249,18 @@ export default defineComponent({
function navto(){ function navto(){
router.push("/about") router.push("/about")
} }
function slogin(index: number){
console.log(index)
if(index == 3){
window.FB.login(function(response: any){
console.log(response)
// handle the response
});
}
}
return { return {
formLayout, formLayout,
tabselected, tabselected,
@ -265,7 +277,8 @@ export default defineComponent({
sublogin, sublogin,
videolist, videolist,
tovideoxq, tovideoxq,
navto navto,
slogin
}; };
}, },
}); });

View File

@ -367,6 +367,7 @@ export default defineComponent({
position: relative; position: relative;
left: 80px; left: 80px;
top: 11px; top: 11px;
display: inline-block;
} }
.submit { .submit {
font-size: 10px; font-size: 10px;