+
{
v.type = 'recommend-video'
diff --git a/src/pages/home/index.vue b/src/pages/home/index.vue
index 1e88159..454c564 100644
--- a/src/pages/home/index.vue
+++ b/src/pages/home/index.vue
@@ -158,6 +158,7 @@ const p = {
}
const store = useStore()
+const loading = computed(() => store.state.loading)
const friends = computed(() => store.state.friends)
const bodyHeight = computed(() => store.state.bodyHeight)
const bodyWidth = computed(() => store.state.bodyWidth)
@@ -168,14 +169,6 @@ const state = reactive({
baseIndex: 0,
navIndex: 0,
test: '',
- slide0: {
- loading: false,
- index: 0,
- list: [],
- totalSize: 0,
- pageSize: 10,
- pageNo: 0,
- },
slide1: {
loading: false,
index: 0,
@@ -225,9 +218,7 @@ const state = reactive({
],
isSharing: false,
canMove: true,
-
shareType: -1,
-
showPlayFeedback: false,
showShareDuoshan: false,
showShareDialog: false,
@@ -247,42 +238,10 @@ const state = reactive({
//用于改变zindex的层级到上层,反正比slide高就行。不然摸不到subType.
subTypeIsTop: false,
})
-
-const loading = computed(() => {
- return state[`slide${state.navIndex}`].loading
-})
-
-watch(
- () => state.navIndex,
- (newVal, oldValue) => {
- if (newVal === 0 && state.slide0.list.length === 0) {
- }
- if (newVal === 4 && state.slide4.list.length === 0) {
- return getSlide4Data()
- }
- if (newVal === 2) return
- if ([0, 2, 4].includes(newVal)) {
- let playItemIndex = state[`slide${newVal}`].index
- bus.emit(EVENT_KEY.SINGLE_CLICK_BROADCAST, {
- baseIndex: state.baseIndex,
- navIndex: newVal,
- itemIndex: playItemIndex,
- type: EVENT_KEY.ITEM_TOGGLE
- })
- }
- if ([0, 2, 4].includes(oldValue)) {
- let stopItemIndex = state[`slide${oldValue}`].index
- setTimeout(() => {
- bus.emit(EVENT_KEY.SINGLE_CLICK_BROADCAST, {
- baseIndex: state.baseIndex,
- navIndex: oldValue,
- itemIndex: stopItemIndex,
- type: EVENT_KEY.ITEM_STOP
- })
- }, 200)
- }
-
- })
+//
+// const loading = computed(() => {
+// return state[`slide${state.navIndex}`].loading
+// })
async function getSlide4Data(refresh = false) {
@@ -417,78 +376,6 @@ function render(item, itemIndex, play, position) {
height: calc(100vh - @footer-height) !important;
overflow: hidden;
- #slide0 {
- position: relative;
-
- .sub-type {
- width: 100%;
- position: fixed;
- top: 0;
-
- &.top {
- z-index: 2;
- }
-
- .local {
- transition: all .3s;
- font-size: 14rem;
- color: gray;
- background: #f9f9f9;
- display: flex;
- justify-content: center;
- align-items: center;
-
- .card {
- margin: 20rem;
- margin-top: @header-height;
- padding: 20rem;
- border-radius: 8rem;
- width: 100%;
- background: white;
- box-sizing: border-box;
- display: flex;
- align-items: flex-end;
- justify-content: space-between;
- overflow: auto;
- }
-
- .nav-item {
- @width: 35rem;
- display: flex;
- align-items: center;
- flex-direction: column;
- flex-shrink: 0;
- width: 17vw;
-
- img {
- width: @width;
- height: @width;
- margin-bottom: 5rem;
- }
- }
- }
- }
-
- .sub-type-notice {
- position: fixed;
- background: rgba(black, .4);
- top: 100rem;
- left: 50%;
- transform: translateX(-50%);
- padding: 3rem 12rem;
- border-radius: 10rem;
- z-index: 3;
- font-size: 12rem;
- color: white;
- }
-
- #slide0-infinite {
- z-index: 1;
- margin-top: 0;
- transition: height, margin-top .3s;
- }
- }
-
}
\ No newline at end of file
diff --git a/src/pages/home/slide/Slide1.vue b/src/pages/home/slide/Slide1.vue
index 72dc8f6..8fca3ef 100644
--- a/src/pages/home/slide/Slide1.vue
+++ b/src/pages/home/slide/Slide1.vue
@@ -44,8 +44,8 @@
v-if="state.subType===-1 && !state.subTypeVisible"
@click="showSubType">附近吃喝玩乐
-
props.active,
- (newVal, oldVal) => {
- console.log('newVal', newVal, 'oldVal', oldVal)
- if (newVal === false) {
- bus.emit(EVENT_KEY.SINGLE_CLICK_BROADCAST, {
- baseIndex: 0,
- navIndex: 0,
- itemIndex: state.index,
- type: EVENT_KEY.ITEM_STOP
- })
- } else {
- bus.emit(EVENT_KEY.SINGLE_CLICK_BROADCAST, {
- baseIndex: 0,
- navIndex: 0,
- itemIndex: state.index,
- type: EVENT_KEY.ITEM_PLAY
- })
- }
- })
const render = useSlideListItemRender({...props.cbs, ...p})
const subTypeRef = ref(null)
const listRef = ref(null)
const state = reactive({
- loading: false,
index: 0,
subType: -1,
subTypeVisible: false,
@@ -146,17 +125,6 @@ function pageClick(e) {
}
}
-function dislike() {
- listRef.value.dislike(state.list[1])
- state.list[state.index] = state.list[1]
- Utils.$notice('操作成功,将减少此类视频的推荐')
-}
-
-function end() {
- // this.$notice('暂时没有更多了')
-}
-
-
onMounted(() => {
// getData()
})
diff --git a/src/pages/home/slide/SlideList.vue b/src/pages/home/slide/SlideList.vue
index 548f2ce..baf577d 100644
--- a/src/pages/home/slide/SlideList.vue
+++ b/src/pages/home/slide/SlideList.vue
@@ -1,16 +1,15 @@
getData(true)"
/>
@@ -18,11 +17,13 @@
diff --git a/src/store/index.js b/src/store/index.js
index 2ffb994..5101a7c 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -45,8 +45,12 @@ const store = Vuex.createStore({
excludeRoutes: [],
judgeValue: 20,
homeRefresh: 60,
+ loading: false,
},
mutations: {
+ setLoading(store, val) {
+ store.loading = val
+ },
setUserinfo(store, val) {
store.userinfo = val
},
diff --git a/src/utils/bus.js b/src/utils/bus.js
index 70bf1df..8c76444 100644
--- a/src/utils/bus.js
+++ b/src/utils/bus.js
@@ -60,4 +60,5 @@ export const EVENT_KEY = {
NAV: 'NAV',
GO_USERINFO: 'GO_USERINFO',
SHOW_SHARE: 'SHOW_SHARE',
+ UPDATE_ITEM: 'UPDATE_ITEM',
}
diff --git a/src/utils/hooks/useSlideListItemRender.jsx b/src/utils/hooks/useSlideListItemRender.jsx
index e20c56b..b912b9b 100644
--- a/src/utils/hooks/useSlideListItemRender.jsx
+++ b/src/utils/hooks/useSlideListItemRender.jsx
@@ -3,7 +3,7 @@ import SlideUser from "@/components/slide/SlideUser.vue";
import BVideo from "@/components/slide/BVideo.vue";
export function useSlideListItemRender(props) {
- return function render(item, itemIndex, play, position) {
+ return function render(item, index, play, uniqueId) {
// console.log('item', item)
let node
if (item.type === 'img') {
@@ -23,7 +23,8 @@ export function useSlideListItemRender(props) {
node =
}
diff --git a/src/utils/index.jsx b/src/utils/index.jsx
index 796495c..d9c0a5f 100644
--- a/src/utils/index.jsx
+++ b/src/utils/index.jsx
@@ -8,6 +8,7 @@ import NoticeDialog from "../components/dialog/NoticeDialog";
import dayjs from 'dayjs'
import bus from "./bus";
import {cloneDeep} from "lodash";
+import {EVENT_KEY} from "./bus";
export default {
require2(url) {
@@ -382,7 +383,7 @@ export default {
let old = cloneDeep(props.item)
old[key] = val
emit('update:item', old)
- bus.emit('update:item', {position: props.position, item: old})
+ bus.emit(EVENT_KEY.UPDATE_ITEM, {position: props.position, item: old})
},
copy(val) {
const input = document.createElement('input');