diff --git a/index.html b/index.html index 7187419..f9447e2 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ - + diff --git a/src/App.vue b/src/App.vue index bdbbd30..f503ad0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,12 +1,12 @@ @@ -24,13 +24,67 @@ import HeaderNav from './components/HeaderNav.vue' // import RegisterPage from './components/RegisterPage.vue' import Footer from './components/Footer.vue' +import isMobile from './components/isMobile' export default { components: { // ShortCut, HeaderNav, Footer, - }, + data() { + return { + isMobileView: false + } + }, + + beforeMount() { + this.checkDeviceAndRedirect(); + window.addEventListener('resize', this.checkDeviceAndRedirect); + }, + methods: { + checkDeviceAndRedirect() { + const mobile = isMobile(); + if (mobile && this.$route.name !== 'MobilePage') { + this.isMobileView = true; + this.$router.replace({ name: 'MobilePage' }); + } else if (!mobile && this.$route.name !== 'HomePage') { + this.isMobileView = false; + this.$router.replace({ name: 'HomePage' }); + } + } + }, + beforeUnmount() { + window.removeEventListener('resize', this.checkDeviceAndRedirect); + } + + // watch: { + // $route(to, from) { + // if (to.name === 'MobilePage') { + // this.HeaderNav = false; + // this.Footer = false; + // } else { + // this.HeaderNav = true; + // this.Footer = true; + // } + // }, + // }, + // created() { + // if (this.$route) { + // this.updateComponentVisibility(this.$route); + // } + // }, + // methods: { + // updateComponentVisibility(route) { + // if (route.name === 'MobilePage') { + // this.HeaderNav = false; + // this.Footer = false; + // } else { + // this.HeaderNav = true; + // this.Footer = true; + // } + // }, + // }, + // watch: { // // 监听路由变化 diff --git a/src/components/Register copy.html b/src/components/01Register copy.html similarity index 100% rename from src/components/Register copy.html rename to src/components/01Register copy.html diff --git a/src/components/01Register.html b/src/components/01Register.html new file mode 100644 index 0000000..291bbb8 --- /dev/null +++ b/src/components/01Register.html @@ -0,0 +1,838 @@ + + + + + + + + 注册界面 + + + + + + + + + + +
+ + + + +
+ + +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/src/components/register2 copy.html b/src/components/02register2 copy.html similarity index 100% rename from src/components/register2 copy.html rename to src/components/02register2 copy.html diff --git a/src/components/HeaderNav.vue b/src/components/HeaderNav.vue index 55cd925..0c41386 100644 --- a/src/components/HeaderNav.vue +++ b/src/components/HeaderNav.vue @@ -1,6 +1,5 @@