修改相關

This commit is contained in:
2018-10-28 20:53:08 +08:00
parent 2c37287d94
commit d16a2fabcf
7 changed files with 391 additions and 398 deletions

View File

@@ -4,10 +4,14 @@
<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">
<title>上海丙维科技有限公司</title> <title>上海丙维科技有限公司</title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
</body> </body>
</html> </html>

View File

@@ -1,5 +1,6 @@
var isMobile = isMobileWidth();
var isPhone = isPhoneWidth(); var isMobile = null;
var isPhone = null;
var wasMobile = isMobile; var wasMobile = isMobile;
var wasDesktop = !isMobile; var wasDesktop = !isMobile;
@@ -8,54 +9,74 @@ var isMiniHeader = false;
var myLocationLat = null; var myLocationLat = null;
var myLocationLong = null; var myLocationLong = null;
$(document).ready(function() {
initListeners(); class Common {
initHeader(); constructor(name, age) {
initForms(); this.name = name;
initMobileMenu(); this.age = age;
adjustElementsForScreen(); }
}); init() {
//create trigger to resizeEnd event, called after event is finished var self=this;
$(window).resize(function() {
if(this.resizeTO) clearTimeout(this.resizeTO); isMobile = common.isMobileWidth();
this.resizeTO = setTimeout(function() { isPhone = common.isPhoneWidth();
//create trigger to resizeEnd event, called after event is finished
$(window).resize(function () {
if (this.resizeTO) clearTimeout(this.resizeTO);
this.resizeTO = setTimeout(function () {
$(this).trigger('resizeEnd'); $(this).trigger('resizeEnd');
}, 100); }, 100);
}); });
//cdetermine scren type and call style functions after window resize is completed //cdetermine scren type and call style functions after window resize is completed
$(window).on('resizeEnd', function() { $(window).on('resizeEnd', function () {
adjustElementsForScreen(); self.adjustElementsForScreen();
}); });
$(window).scroll(function() { $(window).scroll(function () {
if($(window).scrollTop() > 200) { if ($(window).scrollTop() > 200) {
if(isMiniHeader === false && !isMobileWidth()) { if (isMiniHeader === false && !self.isMobileWidth()) {
$('.header').addClass('mini'); $('.header').addClass('mini');
isMiniHeader = true; isMiniHeader = true;
} }
} else { } else {
if(isMiniHeader === true) { if (isMiniHeader === true) {
$('.header').removeClass('mini'); $('.header').removeClass('mini');
isMiniHeader = false; isMiniHeader = false;
} }
} }
//var scroll = $(window).scrollTop(); //var scroll = $(window).scrollTop();
}); });
function adjustElementsForScreen() {
isMobile = isMobileWidth(); $.scrollToElement = function ($element) {
isPhone = isPhoneWidth();
if (!isMobileWidth()) { var adjustment = 0;
if (isMiniHeader) {
adjustment = 35;
}
var $header = $('.header:first');
$('html,body').animate({ scrollTop: $element.offset().top - ($header.length > 0 ? $header.height() : 0) - adjustment }, 'slow');
};
}
adjustElementsForScreen() {
isMobile = this.isMobileWidth();
isPhone = this.isPhoneWidth();
if (!this.isMobileWidth()) {
$(".mobileContent").hide(); $(".mobileContent").hide();
} }
@@ -79,20 +100,22 @@ function adjustElementsForScreen() {
$(".findUsSweden").attr("href", "https://www.google.com/maps/dir/?api=1&destination=Pythagoras+AB,+S%C3%B6der+M%C3%A4larstrand+27+B,+118+25+Stockholm"); $(".findUsSweden").attr("href", "https://www.google.com/maps/dir/?api=1&destination=Pythagoras+AB,+S%C3%B6der+M%C3%A4larstrand+27+B,+118+25+Stockholm");
$(".findUsUK").attr("href", "https://www.google.com/maps/dir/?api=1&destination=180+Piccadilly,+St.+James's,+London+W1J+9HF,+UK"); $(".findUsUK").attr("href", "https://www.google.com/maps/dir/?api=1&destination=180+Piccadilly,+St.+James's,+London+W1J+9HF,+UK");
$(".findUsNorway").attr("href", "https://www.google.com/maps/dir/?api=1&destination=Skogliveien+4a,+3047+Drammen,+Norway"); $(".findUsNorway").attr("href", "https://www.google.com/maps/dir/?api=1&destination=Skogliveien+4a,+3047+Drammen,+Norway");
}else{ } else {
$(".findUsSweden").attr("href", "https://www.google.com/maps/dir//Pythagoras+AB,+S%C3%B6der+M%C3%A4larstrand+27+B,+118+25+Stockholm"); $(".findUsSweden").attr("href", "https://www.google.com/maps/dir//Pythagoras+AB,+S%C3%B6der+M%C3%A4larstrand+27+B,+118+25+Stockholm");
$(".findUsUK").attr("href", "https://www.google.com/maps/dir//180+Piccadilly,+St.+James's,+London+W1J+9HF,+UK"); $(".findUsUK").attr("href", "https://www.google.com/maps/dir//180+Piccadilly,+St.+James's,+London+W1J+9HF,+UK");
$(".findUsNorway").attr("href", "https://www.google.com/maps/dir//Skogliveien+4a,+3047+Drammen,+Norway"); $(".findUsNorway").attr("href", "https://www.google.com/maps/dir//Skogliveien+4a,+3047+Drammen,+Norway");
} }
adjustContentBannersForScreen(); this.adjustContentBannersForScreen();
} }
function initHeader() {
initHeader() {
//go to main page if not there on logo click //go to main page if not there on logo click
$(".logoCell .logo").on("click", function() { $(".logoCell .logo").on("click", function () {
if (window.location.href.indexOf("index.php") === -1) { if (window.location.href.indexOf("index.php") === -1) {
window.location.href = "index.php"; window.location.href = "index.php";
} }
@@ -100,26 +123,26 @@ function initHeader() {
//show/hide main menu dropdowns on hover //show/hide main menu dropdowns on hover
$(".mainMenu > tbody > tr > td") $(".mainMenu > tbody > tr > td")
.on("mouseenter", function(e) { .on("mouseenter", function (e) {
e.stopPropagation(); e.stopPropagation();
$(".dropDown").hide(); $(".dropDown").hide();
$("table.mainMenu > tbody > tr > td.selected").css("box-shadow", "none"); $("table.mainMenu > tbody > tr > td.selected").css("box-shadow", "none");
$(this).find(".dropDown").addClass("droppedDown"); $(this).find(".dropDown").addClass("droppedDown");
$(this).find(".dropDown").slideDown(); $(this).find(".dropDown").slideDown();
}) })
.on("mouseleave", function(e) { .on("mouseleave", function (e) {
e.stopPropagation(); e.stopPropagation();
$(this).find(".dropDown").removeClass("droppedDown"); $(this).find(".dropDown").removeClass("droppedDown");
$(this).find(".dropDown").hide(); $(this).find(".dropDown").hide();
$("table.mainMenu > tbody > tr > td.selected").css("box-shadow", "0 -3px 0 #ff0000 inset"); $("table.mainMenu > tbody > tr > td.selected").css("box-shadow", "0 -3px 0 #ff0000 inset");
}); });
highlightHeaderCategory(); this.highlightHeaderCategory();
} }
//highlight the appproprate main header meny category by examing url
function highlightHeaderCategory() { highlightHeaderCategory() {
var myLocation = location.pathname; var myLocation = location.pathname;
@@ -127,7 +150,7 @@ function highlightHeaderCategory() {
if (myLocation.indexOf("index.php") !== -1) { if (myLocation.indexOf("index.php") !== -1) {
$("#mainMenuGroup0").addClass("selected"); $("#mainMenuGroup0").addClass("selected");
}else if ( } else if (
myLocation.indexOf("/fm-") !== -1 || myLocation.indexOf("/fm-") !== -1 ||
myLocation.indexOf("/prs-") !== -1 || myLocation.indexOf("/prs-") !== -1 ||
myLocation.indexOf("/lvh-") !== -1 || myLocation.indexOf("/lvh-") !== -1 ||
@@ -135,26 +158,24 @@ function highlightHeaderCategory() {
myLocation.indexOf("/sb-") !== -1 || myLocation.indexOf("/sb-") !== -1 ||
myLocation.indexOf("/tek-") !== -1) { myLocation.indexOf("/tek-") !== -1) {
$("#mainMenuGroup1").addClass("selected"); $("#mainMenuGroup1").addClass("selected");
}else if ( } else if (
myLocation.indexOf("/mobila-losningar.php") !== -1 || myLocation.indexOf("/mobila-losningar.php") !== -1 ||
myLocation.indexOf("/ifrs16.php") !== -1 || myLocation.indexOf("/ifrs16.php") !== -1 ||
myLocation.indexOf("/gdpr.php") !== -1) { myLocation.indexOf("/gdpr.php") !== -1) {
$("#mainMenuGroup2").addClass("selected"); $("#mainMenuGroup2").addClass("selected");
}else if ( } else if (
myLocation.indexOf("/det-har-ar-pythagoras.php") !== -1 || myLocation.indexOf("/det-har-ar-pythagoras.php") !== -1 ||
myLocation.indexOf("/kontakta-oss.php") !== -1 || myLocation.indexOf("/kontakta-oss.php") !== -1 ||
myLocation.indexOf("/jobba-hos-oss.php") !== -1) { myLocation.indexOf("/jobba-hos-oss.php") !== -1) {
$("#mainMenuGroup3").addClass("selected"); $("#mainMenuGroup3").addClass("selected");
}else if (myLocation.indexOf(".php") === -1){ } else if (myLocation.indexOf(".php") === -1) {
$("#mainMenuGroup0").addClass("selected"); $("#mainMenuGroup0").addClass("selected");
} }
} }
initListeners() {
//event listners for elements $("#hamburger").on("click", function () {
function initListeners() {
$("#hamburger").on("click", function() {
if ($("#mobileLanguageMenu").hasClass("showing")) { if ($("#mobileLanguageMenu").hasClass("showing")) {
$("#mobileLanguageMenu").hide(); $("#mobileLanguageMenu").hide();
@@ -163,12 +184,12 @@ function initListeners() {
if ($("#mobileMenu").hasClass("showing")) { if ($("#mobileMenu").hasClass("showing")) {
hideMobileMenu(); hideMobileMenu();
}else{ } else {
showMobileMenu(); showMobileMenu();
} }
}); });
$("#mobileLanguage").on("click", function(e) { $("#mobileLanguage").on("click", function (e) {
if ($("#mobileMenu").hasClass("showing")) { if ($("#mobileMenu").hasClass("showing")) {
$("#mobileMenu").hide(); $("#mobileMenu").hide();
@@ -177,13 +198,14 @@ function initListeners() {
if ($("#mobileLanguageMenu").hasClass("showing")) { if ($("#mobileLanguageMenu").hasClass("showing")) {
hideMobileLanguageMenu(); hideMobileLanguageMenu();
}else{ } else {
showMobileLanguageMenu(); showMobileLanguageMenu();
} }
}); });
$("#screenOverlayBehindHeader, .linkGoBack").on("click", function(e) {
$("#screenOverlayBehindHeader, .linkGoBack").on("click", function (e) {
if ($("#mobileMenu").hasClass("showing")) { if ($("#mobileMenu").hasClass("showing")) {
hideMobileMenu(); hideMobileMenu();
} }
@@ -192,42 +214,36 @@ function initListeners() {
} }
}); });
$("#mobileLanguageMenu a").on("click", function(e) { $("#mobileLanguageMenu a").on("click", function (e) {
e.preventDefault(); e.preventDefault();
}); });
//show support form //show support form
$("a.linkSupport").on("click", function(e) { $("a.linkSupport").on("click", function (e) {
e.preventDefault(); e.preventDefault();
showForm("support"); showForm("support");
}); });
//show contact form //show contact form
$("a.linkContactUs").on("click", function(e) { $("a.linkContactUs").on("click", function (e) {
e.preventDefault(); e.preventDefault();
showForm("contact"); showForm("contact");
}); });
$("#scrollToBoxes").on("click", function(e){ $("#scrollToBoxes").on("click", function (e) {
e.preventDefault(); e.preventDefault();
$.scrollToElement($("#pageBoxesContainer")); $.scrollToElement($("#pageBoxesContainer"));
}); });
$('.cookiesInfo').children('input[type=button]').on('click', function(){ $('.cookiesInfo').children('input[type=button]').on('click', function () {
$(this).parent().remove(); $(this).parent().remove();
}); });
//location }
/*$("#ourLocationSweden").on("click", function(e) {
e.preventDefault();
navigateTo("sweden", $(this));
});*/
} initMobileMenu() {
$("#mobileMenu a").on("click", function (e) {
function initMobileMenu() {
$("#mobileMenu a").on("click", function(e) {
if ($(this).hasClass("hasSubmenu")) { if ($(this).hasClass("hasSubmenu")) {
e.preventDefault(); e.preventDefault();
@@ -237,36 +253,36 @@ function initMobileMenu() {
//$(this).parent().css("border-bottom", "none"); //$(this).parent().css("border-bottom", "none");
$(this).parent().find(".subMenu").slideDown(); $(this).parent().find(".subMenu").slideDown();
}else{ } else {
hideMobileMenu(); hideMobileMenu();
} }
}); });
} }
function initForms() { initForms() {
$(".btnQuitForm").on("click", function() { $(".btnQuitForm").on("click", function () {
$("#forms").hide(); $("#forms").hide();
$("#screenOverlay").hide(); $("#screenOverlay").hide();
$("#formContactContainer").hide(); $("#formContactContainer").hide();
$("#formSupportContainer").hide(); $("#formSupportContainer").hide();
}); });
$("#formSupport").on("submit", function(e) { $("#formSupport").on("submit", function (e) {
e.preventDefault(); e.preventDefault();
submitSupportForm($(this)); submitSupportForm($(this));
}); });
$("#formContact").on("submit", function(e) { $("#formContact").on("submit", function (e) {
e.preventDefault(); e.preventDefault();
submitContactForm($(this)); submitContactForm($(this));
}); });
} }
function showForm(formName) { showForm(formName) {
$("#forms").show(); $("#forms").show();
$("#screenOverlay").show(); $("#screenOverlay").show();
@@ -281,7 +297,7 @@ function showForm(formName) {
if ($(".contentTableRight").find("[data-contact-link]").length) { if ($(".contentTableRight").find("[data-contact-link]").length) {
$conCommentsTitle.html("Berätta vad du vill veta mer om gällande " + $conCommentsTitle.html("Berätta vad du vill veta mer om gällande " +
$(".contentTableRight").find("[data-contact-link]").data("contact-link") + ": *"); $(".contentTableRight").find("[data-contact-link]").data("contact-link") + ": *");
}else{ } else {
$conCommentsTitle.html("Vad vill du veta mer om: "); $conCommentsTitle.html("Vad vill du veta mer om: ");
} }
$("#formContactContainer").show(); $("#formContactContainer").show();
@@ -291,10 +307,10 @@ function showForm(formName) {
scrollToTop(); scrollToTop();
} }
function submitSupportForm(form) { submitSupportForm(form) {
$.post("http://biz199.inmotionhosting.com/~rustyt6/pythagoras/php/submit_support_form.php", $.post("http://biz199.inmotionhosting.com/~rustyt6/pythagoras/php/submit_support_form.php",
{ {
@@ -306,7 +322,7 @@ function submitSupportForm(form) {
product: $("#supProduct").val(), product: $("#supProduct").val(),
comments: $("#supComments").val() comments: $("#supComments").val()
}, },
function(data) { function (data) {
console.log(data); console.log(data);
} }
); );
@@ -322,9 +338,10 @@ function submitSupportForm(form) {
$("#supPhone").val(""); $("#supPhone").val("");
$("#supProduct").val(""); $("#supProduct").val("");
$("#supComments").val(""); $("#supComments").val("");
} }
function submitContactForm(form) {
submitContactForm(form) {
$.post("http://biz199.inmotionhosting.com/~rustyt6/pythagoras/php/submit_contact_form.php", $.post("http://biz199.inmotionhosting.com/~rustyt6/pythagoras/php/submit_contact_form.php",
{ {
@@ -333,7 +350,7 @@ function submitContactForm(form) {
phone: $("#conPhone").val(), phone: $("#conPhone").val(),
comments: $("#conComments").val() comments: $("#conComments").val()
}, },
function(data) { function (data) {
console.log(data); console.log(data);
} }
); );
@@ -346,102 +363,65 @@ function submitContactForm(form) {
$("#conEmail").val(""); $("#conEmail").val("");
$("#conPhone").val(""); $("#conPhone").val("");
$("#conComments").val(""); $("#conComments").val("");
} }
function adjustContentBannersForScreen() { adjustContentBannersForScreen() {
if (isMobileWidth()) { if (this.isMobileWidth()) {
$("#pageBannerImage1").attr("src", "images/banner_page_mobile_solutions_mobile.jpg"); $("#pageBannerImage1").attr("src", "images/banner_page_mobile_solutions_mobile.jpg");
$("#pageBannerImage2").attr("src", "images/banner_page_ifrs16_mobile.jpg"); $("#pageBannerImage2").attr("src", "images/banner_page_ifrs16_mobile.jpg");
$("#pageBannerImage3").attr("src", "images/banner_page_gdpr_mobile.jpg"); $("#pageBannerImage3").attr("src", "images/banner_page_gdpr_mobile.jpg");
}else{ } else {
$("#pageBannerImage1").attr("src", "images/banner_page_mobile_solutions.jpg"); $("#pageBannerImage1").attr("src", "images/banner_page_mobile_solutions.jpg");
$("#pageBannerImage2").attr("src", "images/banner_page_ifrs16.jpg"); $("#pageBannerImage2").attr("src", "images/banner_page_ifrs16.jpg");
$("#pageBannerImage3").attr("src", "images/banner_page_gdpr.jpg"); $("#pageBannerImage3").attr("src", "images/banner_page_gdpr.jpg");
} }
}
/*function navigateTo(destination, $element) {
var baseAddress = "https://www.google.com/maps/dir/";
var addressSweden = "Pythagoras+AB,+S%C3%B6der+M%C3%A4larstrand+27+B,+118+25+Stockholm";
if (myLocationLat == null || myLocationLong == null) {
getUserLocationForDirections();
}else{
if ($element.attr("href").length <= 1) {
$element.attr("href", baseAddress + myLocationLat + "," + myLocationLong + "/" + addressSweden);
}
console.log($element.attr("href"));
} }
} showMobileMenu() {
function getUserLocationForDirections() {
$.post("https://www.googleapis.com/geolocation/v1/geolocate?key=AIzaSyB04D7_YYzWb3y3TDtVr-FR3rkBHSV6oOg",
function(data){
console.log(data);
myLocationLat = data.location.lat;
myLocationLong = data.location.lng;
console.log(myLocationLat, myLocationLong);
//setupDirections();
//https://www.google.com/maps/dir/?api=1&destination=Pythagoras+AB,+S%C3%B6der+M%C3%A4larstrand+27+B,+118+25+Stockholm
});
}*/
function showMobileMenu() {
$("#screenOverlayBehindHeader").show(); $("#screenOverlayBehindHeader").show();
$("#mobileMenu").slideDown(); $("#mobileMenu").slideDown();
$("#mobileMenu").addClass("showing"); $("#mobileMenu").addClass("showing");
} }
function hideMobileMenu() {
$("#mobileMenu").slideUp(function(){ hideMobileMenu() {
$("#mobileMenu").slideUp(function () {
$("#screenOverlayBehindHeader").hide(); $("#screenOverlayBehindHeader").hide();
}); });
$("#mobileMenu").removeClass("showing"); $("#mobileMenu").removeClass("showing");
} }
function showMobileLanguageMenu() { showMobileLanguageMenu() {
$("#screenOverlayBehindHeader").show(); $("#screenOverlayBehindHeader").show();
$("#mobileLanguageMenu").slideDown(); $("#mobileLanguageMenu").slideDown();
$("#mobileLanguageMenu").addClass("showing"); $("#mobileLanguageMenu").addClass("showing");
} }
function hideMobileLanguageMenu() { hideMobileLanguageMenu() {
$("#mobileLanguageMenu").slideUp(function(){ $("#mobileLanguageMenu").slideUp(function () {
$("#screenOverlayBehindHeader").hide(); $("#screenOverlayBehindHeader").hide();
}); });
$("#mobileLanguageMenu").removeClass("showing"); $("#mobileLanguageMenu").removeClass("showing");
}
$.scrollToElement = function($element){
var adjustment = 0;
if (isMiniHeader) {
adjustment = 35;
} }
var $header = $('.header:first');
$('html,body').animate({scrollTop: $element.offset().top-($header.length > 0 ? $header.height() : 0) - adjustment}, 'slow');
};
//scroll page to top scrollToTop() {
function scrollToTop() {
$("body,html").animate({ scrollTop: 0 }, "slow"); $("body,html").animate({ scrollTop: 0 }, "slow");
} }
//is screen mobile? (<= 768 px) isMobileWidth() {
//#mobile_indicator is show/hidden via media query
function isMobileWidth() {
return $('#mobile_indicator').is(':visible'); return $('#mobile_indicator').is(':visible');
}
isPhoneWidth() {
return $('#phone_indicator').is(':visible');
}
} }
//is screen phone? (<= 480 px)
//#mobile_indicator is show/hidden via media query export const common = new Common();
function isPhoneWidth() {
return $('#phone_indicator').is(':visible');
}

View File

@@ -87,11 +87,21 @@
</div> </div>
</template> </template>
<script> <script>
import { common } from "../assets/static/common";
export default { export default {
data() { data() {
return { return {
menus: window.config.menus menus: window.config.menus
}; };
},
mounted: function() {
common.init();
common.initListeners();
common.initHeader();
common.initForms();
common.initMobileMenu();
common.adjustElementsForScreen();
} }
}; };
</script> </script>

View File

@@ -4,6 +4,7 @@ import 'swiper/dist/css/swiper.css'
import './assets/static/config.js' import './assets/static/config.js'
import './assets/static/jquery.js' import './assets/static/jquery.js'
import './assets/static/common.js'
import 'es6-promise/auto' import 'es6-promise/auto'

View File

@@ -110,10 +110,10 @@ export default {
methods: { methods: {
onSlideChangeStart(currentPage) { onSlideChangeStart(currentPage) {
console.log("onSlideChangeStart", currentPage);
}, },
onSlideChangeEnd(currentPage) { onSlideChangeEnd(currentPage) {
console.log("onSlideChangeEnd", currentPage);
} }
} }
}; };

View File

@@ -10,7 +10,6 @@
</div> </div>
<ifooter></ifooter> <ifooter></ifooter>
</div> </div>
</template> </template>
<script> <script>

View File

@@ -9,8 +9,7 @@
</div> </div>
</div> </div>
<ifooter></ifooter> <ifooter></ifooter>
</div> </div>
</template> </template>
<script> <script>