基本路由结构完成,内容待补充......

This commit is contained in:
2025-11-08 20:37:38 +08:00
parent e234a3daf2
commit 1c5c3c6773
10 changed files with 98 additions and 23 deletions

View File

@@ -0,0 +1,13 @@
<template lang="">
<div>
电影页面
</div>
</template>
<script>
export default {
}
</script>
<style lang="">
</style>

View File

@@ -4,8 +4,8 @@
<span class="location">杭州</span>
</router-link>
<ul>
<li v-for="(item, index) in list" @click="setIndex(index)" :class="{ active: activeIndex == index }">{{ item
}}
<li v-for="(item, index) in list" @click="setIndex(index)" :class="{ active: activeIndex == index }">
{{ item }}
</li>
<div class="redline" :class="{ left: activeIndex === 0, right: activeIndex === 2 }"></div>
</ul>
@@ -23,6 +23,21 @@ export default {
}, methods: {
setIndex(i) {
this.activeIndex = i;
console.log(this.activeIndex)
switch (this.activeIndex) {
case 0:
this.$router.push("/movie/movies/hot")
break
case 1:
this.$router.push("/movie/movies/cinema")
break
case 2:
this.$router.push("/movie/movies/wait")
break
}
console.log("case")
}
}
}
@@ -66,12 +81,15 @@ export default {
>ul {
position: relative;
>li {
li {
width: 44px;
padding: 0 5px;
margin: 0 5px;
}
>.redline {
@lineheight: 3px;
width: 20px;

View File

@@ -1,8 +1,6 @@
<template lang="html">
<div>
<Nav></Nav>
<router-view></router-view>
</div>
<Nav></Nav>
<router-view></router-view>
</template>
<script>
import Nav from '../components/MyNav.vue'

View File

@@ -1,8 +1,8 @@
<template>
<div class="main" ref="main">
<div class="box" ref="box">
<Most-Popular />
<Movie-List @soc="initsoc" :more="more" />
<MostPopular />
<MovieList @soc="initsoc" :more="more" />
</div>
</div>
</template>
@@ -33,13 +33,19 @@ export default {
const el = this.$refs.main;
this.total = data.total;
this.ids = data.ids;
setTimeout(() => {
console.log(el.offsetHeight);
console.log(this.$refs.box.offsetHeight);
})
let bs = new BScroll(el, {
// ...
pullUpLoad: true,
startX: 0,
startY: 0,
scrollY: true
})
//上拉数据传参
bs.on("pullingUp", async () => {
const ids = this.ids.slice(this.startIndex, this.startIndex + 10)
if (this.startIndex == this.total) { return }

View File

@@ -25,7 +25,7 @@
<script>
import BScroll from 'better-scroll'
import { nextTick } from 'vue'
import {request} from "@/utils"
import { request } from "@/utils"
export default {
data() {
return {
@@ -56,9 +56,6 @@ export default {
let el = this.$refs.ul1
console.log(el.offsetWidth)
new BScroll(el, {
// pullUpLoad: true,
// wheel: true,
// scrollbar: true,
startX: 0,
startY: 0,
scrollX: true
@@ -86,6 +83,7 @@ export default {
.wrap {
overflow: hidden;
display: block;
>ul {
display: inline-flex;
flex-wrap: nowrap;

View File

@@ -14,8 +14,10 @@
<p v-if="movie.globalReleased">{{ movie.showInfo }}</p>
</div>
<div class="btn-box">
<div class="btn" :style="{ backgroundColor: movie.showStateButton?'movie.showStateButton?.color':'white' }">{{ movie.showStateButton?.content
}}
<div class="btn"
:style="{ backgroundColor: movie.showStateButton ? 'movie.showStateButton?.color' : 'white' }">{{
movie.showStateButton?.content
}}
</div>
</div>
</div>
@@ -35,7 +37,7 @@ export default {
},
async mounted() {
let data = await request("http://101.35.148.193:3000/api/movies/list");
console.log(this.more)
// console.log(this.more)
if (data.success) {
this.data = data;
} else {
@@ -126,7 +128,6 @@ export default {
}
}
>.btn-box {
overflow: hidden;

View File

@@ -0,0 +1,13 @@
<template lang="html">
<div>
待映页
</div>
</template>
<script>
export default {
}
</script>
<style lang="">
</style>

View File

@@ -0,0 +1,15 @@
<template lang="html">
<Headers>搜索</Headers>
<div>
搜索页
</div>
</template>
<script>
import Headers from '../movie/components/MyHeader.vue';
export default {
components: {
Headers
}
}
</script>
<style lang="less"></style>

View File

@@ -1,13 +1,17 @@
import { createRouter, createWebHistory } from "vue-router";
import Movie from "@/pages/movie/index.vue";
import { createRouter, createWebHashHistory } from "vue-router";
import Main from "@/pages/index.vue";
import City from "@/pages/city/index.vue";
import Video from "@/pages/video/index.vue";
import Show from "@/pages/show/index.vue";
import User from "@/pages/user/index.vue";
import Movies from "@/pages/movie/hot/MyMovies.vue";
import Search from "@/pages/search/index.vue";
import MyMain from "@/pages/movie/hot/components/MyMain.vue";
import Cinema from "@/pages/movie/cinema/cinema.vue";
import Wait from "@/pages/movie/wait/wait.vue";
import { compile } from "ejs";
const routers = {
history: createWebHistory(),
history: createWebHashHistory(),
routes: [
{
path: "/",
@@ -16,11 +20,11 @@ const routers = {
{
path: "/movie",
component: Movie,
component: Main,
children: [
{
path: "/movie",
redirect: "/movie/hot",
redirect: "/movie/movies",
},
{
path: "/movie/movies",
@@ -36,6 +40,11 @@ const routers = {
},
{
path: "/movie/movies/cinema",
component: Cinema,
},
{
path: "/movie/movies/wait",
component: Wait,
},
],
},
@@ -57,6 +66,10 @@ const routers = {
path: "/city",
component: City,
},
{
path: "/search",
component: Search,
},
],
};