修改相關

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,15 +9,19 @@ 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() {
var self=this;
isMobile = common.isMobileWidth();
isPhone = common.isPhoneWidth();
//create trigger to resizeEnd event, called after event is finished //create trigger to resizeEnd event, called after event is finished
$(window).resize(function () { $(window).resize(function () {
@@ -29,13 +34,13 @@ $(window).resize(function() {
//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;
} }
@@ -50,12 +55,28 @@ $(window).scroll(function() {
}); });
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();
} }
@@ -85,11 +106,13 @@ function adjustElementsForScreen() {
$(".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 () {
@@ -114,12 +137,12 @@ function initHeader() {
$("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;
@@ -150,9 +173,7 @@ function highlightHeaderCategory() {
} }
} }
initListeners() {
//event listners for elements
function initListeners() {
$("#hamburger").on("click", function () { $("#hamburger").on("click", function () {
@@ -183,6 +204,7 @@ function initListeners() {
}); });
$("#screenOverlayBehindHeader, .linkGoBack").on("click", function (e) { $("#screenOverlayBehindHeader, .linkGoBack").on("click", function (e) {
if ($("#mobileMenu").hasClass("showing")) { if ($("#mobileMenu").hasClass("showing")) {
hideMobileMenu(); hideMobileMenu();
@@ -218,15 +240,9 @@ function initListeners() {
$(this).parent().remove(); $(this).parent().remove();
}); });
//location
/*$("#ourLocationSweden").on("click", function(e) {
e.preventDefault();
navigateTo("sweden", $(this));
});*/
} }
function initMobileMenu() { initMobileMenu() {
$("#mobileMenu a").on("click", function (e) { $("#mobileMenu a").on("click", function (e) {
if ($(this).hasClass("hasSubmenu")) { if ($(this).hasClass("hasSubmenu")) {
@@ -244,7 +260,7 @@ function initMobileMenu() {
} }
function initForms() { initForms() {
$(".btnQuitForm").on("click", function () { $(".btnQuitForm").on("click", function () {
@@ -266,7 +282,7 @@ function initForms() {
} }
function showForm(formName) { showForm(formName) {
$("#forms").show(); $("#forms").show();
$("#screenOverlay").show(); $("#screenOverlay").show();
@@ -294,7 +310,7 @@ function showForm(formName) {
} }
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",
{ {
@@ -324,7 +340,8 @@ function submitSupportForm(form) {
$("#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",
{ {
@@ -349,9 +366,9 @@ function submitContactForm(form) {
} }
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");
@@ -362,86 +379,49 @@ function adjustContentBannersForScreen() {
} }
} }
/*function navigateTo(destination, $element) { showMobileMenu() {
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"));
}
}
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() {
hideMobileMenu() {
$("#mobileMenu").slideUp(function () { $("#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){ scrollToTop() {
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
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');
} }
//is screen phone? (<= 480 px) isPhoneWidth() {
//#mobile_indicator is show/hidden via media query
function isPhoneWidth() {
return $('#phone_indicator').is(':visible'); return $('#phone_indicator').is(':visible');
} }
}
export const common = new Common();

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

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