+
+ {!isGameBottom.value && (
+
{
+ e.stopPropagation()
+ e.preventDefault()
+ if (gameRef.value) {
+ gameRef.value.scrollTop += 40
+ }
+ }}
+ >
+
+
+ )}
+
+
{
+ console.log('wheel')
+ }}
+ >
+ {store.state.list
+ .filter((val) => val.type === 'game')
+ .map((item) => (
+
+
+
+ {item.name}
+
+ {item.des}
+
+
+
+ ))}
+
+
+
+ {!isWorkBottom.value && (
+
{
+ e.stopPropagation()
+ e.preventDefault()
+ if (workRef.value) {
+ workRef.value.scrollTop += 20
+ }
+ }}
+ >
+
+
+ )}
+
+
{
+ console.log('wheel')
+ handleWorkScroll()
+ }}
+ >
+ {store.state.list
+ .filter((val) => val.type === 'work')
+ .map((item) => (
+
+
+
+ {item.name}
+
+ {item.des}
+
+
+
+ ))}
+
+
+
+ )
+})
diff --git a/src/widgets/video/index.ts b/src/widgets/video/index.ts
new file mode 100644
index 0000000..372edf2
--- /dev/null
+++ b/src/widgets/video/index.ts
@@ -0,0 +1,18 @@
+import asyncLoader from '@/utils/asyncLoader'
+import type { Widget } from '..'
+
+export default {
+ name: 'video',
+ label: '视频',
+ description: '热门视频',
+ icon: '/icons/recommendedIcon.png',
+ modal: null,
+ list: [
+ {
+ w: 4,
+ h: 2,
+ label: '大',
+ component: asyncLoader(() => import('./Large'))
+ }
+ ]
+} as Widget
diff --git a/src/widgets/video/useWeApplyStore.ts b/src/widgets/video/useWeApplyStore.ts
new file mode 100644
index 0000000..805c66b
--- /dev/null
+++ b/src/widgets/video/useWeApplyStore.ts
@@ -0,0 +1,29 @@
+import request from "@/utils/request"
+import { defineStore } from "pinia"
+import { reactive } from "vue"
+type WeApplyType = {
+ id: string;
+ name: string;
+ url: string;
+ icon: string;
+ des: string;
+ type: string;
+}
+export const useWeApplyStore = defineStore('weApply', () => {
+ const state = reactive({
+ list: [] as WeApplyType[]
+ })
+ const getWeApplyList = async () => {
+ return request('GET', '/api/app/weApplys').then(res => {
+ return res
+ })
+ }
+ const getList = async () => {
+ state.list = await getWeApplyList()
+ }
+ getList()
+ return {
+ state,
+ getList
+ }
+})
\ No newline at end of file
diff --git a/src/widgets/weApply/Large.tsx b/src/widgets/weApply/Large.tsx
index 93687aa..9694486 100644
--- a/src/widgets/weApply/Large.tsx
+++ b/src/widgets/weApply/Large.tsx
@@ -13,12 +13,11 @@ export default defineComponent(() => {
const computIsBottom = (ref: any) => {
if (ref) {
const { scrollTop, clientHeight, scrollHeight } = ref
- return scrollTop + clientHeight >= scrollHeight
+ return scrollTop + clientHeight >= scrollHeight -8
}
}
const handleGameScroll = () => {
const isAtBottom = computIsBottom(gameRef.value)
- console.log(isAtBottom ? '已滚动到底部!' : '未滚动到底部。')
if (isAtBottom) {
isGameBottom.value = true
} else {
@@ -27,40 +26,13 @@ export default defineComponent(() => {
}
const handleWorkScroll = () => {
const isAtBottom = computIsBottom(workRef.value)
- console.log(isAtBottom ? '已滚动到底部!' : '未滚动到底部。')
if (isAtBottom) {
isWorkBottom.value = true
} else {
isWorkBottom.value = false
}
}
- watch(gameRef, (val, _, onCleanup) => {
- console.log(val)
- if (!val) return
- val.addEventListener('scroll', handleGameScroll)
- // if (val + gameRef.value.clientHeight >= gameRef.value.scrollHeight) {
- // isGameBottom.value = true
- // } else {
- // isGameBottom.value = false
- // }
- onCleanup(() => {
- val.removeEventListener('scroll', handleGameScroll)
- })
- })
- watch(workRef, (val, _, onCleanup) => {
- console.log(val)
- if (!val) return
- val.addEventListener('scroll', handleWorkScroll)
- // if (val + gameRef.value.clientHeight >= gameRef.value.scrollHeight) {
- // isGameBottom.value = true
- // } else {
- // isGameBottom.value = false
- // }
- onCleanup(() => {
- val.removeEventListener('scroll', handleWorkScroll)
- })
- })
return () => (
{
e.preventDefault()
if (gameRef.value) {
gameRef.value.scrollTop += 40
+ handleGameScroll()
}
}}
>
@@ -95,7 +68,7 @@ export default defineComponent(() => {
ref={gameRef}
class={clsx('w-full h-full flex flex-col overflow-y-scroll gap-y-2 scrollbar-hide ')}
onWheel={() => {
- console.log('wheel')
+ handleGameScroll()
}}
>
{store.state.list
@@ -133,6 +106,8 @@ export default defineComponent(() => {
e.preventDefault()
if (workRef.value) {
workRef.value.scrollTop += 20
+ handleWorkScroll()
+
}
}}
>
@@ -144,7 +119,7 @@ export default defineComponent(() => {
ref={workRef}
class={clsx('w-full h-full flex flex-col overflow-y-scroll gap-y-2 scrollbar-hide ')}
onWheel={() => {
- console.log('wheel')
+ handleWorkScroll()
}}
>
{store.state.list
diff --git a/src/widgets/weApply/index.ts b/src/widgets/weApply/index.ts
index fa76ef1..c349852 100644
--- a/src/widgets/weApply/index.ts
+++ b/src/widgets/weApply/index.ts
@@ -4,7 +4,7 @@ import type { Widget } from '..'
export default {
name: 'weApply',
label: '大家都在用',
- description: '大家都在用',
+ description: '盘点近期大热的应用软件和热门游戏',
icon: '/icons/recommendedIcon.png',
modal: null,
list: [