Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
lab-learnvideo-web
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yangyutan
lab-learnvideo-web
Commits
5801ce16
Commit
5801ce16
authored
May 06, 2024
by
yangyutan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: backendData driven preview page
parent
0c0f4aa0
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
74 additions
and
71 deletions
+74
-71
package.json
package.json
+1
-1
test.mp4
public/test.mp4
+0
-0
test1.mp4
public/test1.mp4
+0
-0
index.jsx
src/commonents/antTest/index.jsx
+0
-0
index.css
src/commonents/cssAnimation/index.css
+0
-0
index.jsx
src/commonents/cssAnimation/index.jsx
+0
-0
index.css
src/commonents/fabricTest/index.css
+0
-0
index.jsx
src/commonents/fabricTest/index.jsx
+0
-0
index.jsx
src/pages/home/index.jsx
+0
-0
index.jsx
src/pages/preview/components/videoBox/index.jsx
+0
-0
index.jsx
src/pages/preview/index.jsx
+72
-69
index.jsx
src/pages/upload/components/uploadVideo/index.jsx
+0
-0
index.jsx
src/pages/upload/index.jsx
+1
-1
No files found.
package.json
View file @
5801ce16
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
"version"
:
"0.0.0"
,
"version"
:
"0.0.0"
,
"type"
:
"module"
,
"type"
:
"module"
,
"scripts"
:
{
"scripts"
:
{
"dev"
:
"vite"
,
"dev"
:
"vite
--host
"
,
"build"
:
"vite build"
,
"build"
:
"vite build"
,
"lint"
:
"eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0"
,
"lint"
:
"eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0"
,
"preview"
:
"vite preview"
"preview"
:
"vite preview"
...
...
public/test.mp4
View file @
5801ce16
No preview for this file type
public/test1.mp4
0 → 100644
View file @
5801ce16
File added
src/commonents/antTest/index.jsx
View file @
5801ce16
src/commonents/cssAnimation/index.css
View file @
5801ce16
src/commonents/cssAnimation/index.jsx
View file @
5801ce16
src/commonents/fabricTest/index.css
View file @
5801ce16
src/commonents/fabricTest/index.jsx
View file @
5801ce16
src/pages/home/index.jsx
View file @
5801ce16
src/pages/preview/components/videoBox/index.jsx
View file @
5801ce16
src/pages/preview/index.jsx
View file @
5801ce16
...
@@ -42,20 +42,71 @@ const VideoList = () => {
...
@@ -42,20 +42,71 @@ const VideoList = () => {
const
[
Videos
,
setVideos
]
=
useState
([])
const
[
Videos
,
setVideos
]
=
useState
([])
//Call the backend interface to obtain the latest video results
//Call the backend interface to obtain the latest video results
const
refreshVideo
=
async
()
=>
{
// const refreshVideo = async () => {
let
res
=
null
// let res = null
try
{
// try {
res
=
await
axios
.
get
(
`http://10.20.1.10:3100/2403/learnvideo/check?shotDirName=
${
state
.
reqData
.
shotDirName
}
`
)
// res = await axios.get(`http://10.20.1.10:3100/2403/learnvideo/check?shotDirName=${state.reqData.shotDirName}`)
}
catch
(
err
)
{
// } catch (err) {
message
.
error
(
'Connect server failed'
)
// message.error('Connect server failed')
console
.
error
(
err
)
// console.error(err)
}
// }
if
(
res
.
data
.
code
!=
200
)
{
// if (res.data.code != 200) {
message
.
error
(
`request server failed:
${
res
.
data
.
code
}
`
)
// console.log(res.data)
// message.error(`request server failed: ${res.data.code}`)
// }
// //Always refresh display list
// if (res.data.data.length) {
// let _Videos = res.data.data.map((video, index) => {
// let videoData = {
// url: video.url,
// targetAudience: video.data.targetAudience,
// painPoint: video.data.painPoint
// }
// return <VideoBox videoData={videoData} key={index} />
// })
// setVideos(_Videos)
// }
// let timer = setTimeout(() => {
// clearTimeout(timer)
// refreshVideo()
// }, 4000)
// }
useEffect
(()
=>
{
console
.
log
(
'state_is:'
,
state
)
// 模拟请求和渲染过程
let
res
=
{}
res
.
data
=
{
code
:
200
,
data
:
[
{
url
:
'/test.mp4'
,
data
:
{
targetAudience
:
'1忙碌的上班族和年轻家庭主妇...'
,
painPoint
:
'1工作繁忙,没时间去市场挑选新鲜海鲜...'
}
}
//Always refresh display list
},
if
(
res
.
data
.
data
.
length
)
{
{
url
:
'/test.mp4'
,
data
:
{
targetAudience
:
'2忙碌的上班族和年轻家庭主妇...'
,
painPoint
:
'2工作繁忙,没时间去市场挑选新鲜海鲜...'
}
},
{
url
:
'/test.mp4'
,
data
:
{
targetAudience
:
'3忙碌的上班族和年轻家庭主妇...'
,
painPoint
:
'3工作繁忙,没时间去市场挑选新鲜海鲜...'
}
}
]
}
const
refreshVideo
=
()
=>
{
setTimeout
(()
=>
{
if
(
res
.
data
.
code
==
200
)
{
let
_Videos
=
res
.
data
.
data
.
map
((
video
,
index
)
=>
{
let
_Videos
=
res
.
data
.
data
.
map
((
video
,
index
)
=>
{
let
videoData
=
{
let
videoData
=
{
url
:
video
.
url
,
url
:
video
.
url
,
...
@@ -65,68 +116,20 @@ const VideoList = () => {
...
@@ -65,68 +116,20 @@ const VideoList = () => {
return
<
VideoBox
videoData=
{
videoData
}
key=
{
index
}
/>
return
<
VideoBox
videoData=
{
videoData
}
key=
{
index
}
/>
})
})
setVideos
(
_Videos
)
setVideos
(
_Videos
)
res
.
data
.
data
.
push
({
url
:
'/test.mp4'
,
data
:
{
targetAudience
:
'3忙碌的上班族和年轻家庭主妇...'
,
painPoint
:
'3工作繁忙,没时间去市场挑选新鲜海鲜...'
}
}
let
timer
=
setTimeout
(()
=>
{
})
clearTimeout
(
timer
)
refreshVideo
()
refreshVideo
()
},
4000
)
}
},
3000
)
}
}
useEffect
(()
=>
{
console
.
log
(
'state_is:'
,
state
)
refreshVideo
()
// let res = {}
refreshVideo
()
// res.data = {
// code: 200,
// data: [
// {
// url: '/test1.mp4',
// data: {
// targetAudience: '1忙碌的上班族和年轻家庭主妇...',
// painPoint: '1工作繁忙,没时间去市场挑选新鲜海鲜...'
// }
// },
// {
// url: '/test.mp4',
// data: {
// targetAudience: '2忙碌的上班族和年轻家庭主妇...',
// painPoint: '2工作繁忙,没时间去市场挑选新鲜海鲜...'
// }
// },
// {
// url: '/test.mp4',
// data: {
// targetAudience: '3忙碌的上班族和年轻家庭主妇...',
// painPoint: '3工作繁忙,没时间去市场挑选新鲜海鲜...'
// }
// }
// ]
// }
// const refreshVideo = () => {
// setTimeout(() => {
// if (res.data.code == 200) {
// let _Videos = res.data.data.map((video, index) => {
// let videoData = {
// url: video.url,
// targetAudience: video.data.targetAudience,
// painPoint: video.data.painPoint
// }
// return <VideoBox videoData={videoData} key={index} />
// })
// setVideos(_Videos)
// res.data.data.push({
// url: '/test.mp4',
// data: {
// targetAudience: '3忙碌的上班族和年轻家庭主妇...',
// painPoint: '3工作繁忙,没时间去市场挑选新鲜海鲜...'
// }
// })
// refreshVideo()
// }
// }, 3000)
// }
// refreshVideo()
},
[])
},
[])
return
<>
{
Videos
}
</>
return
<>
{
Videos
}
</>
}
}
...
...
src/pages/upload/components/uploadVideo/index.jsx
View file @
5801ce16
src/pages/upload/index.jsx
View file @
5801ce16
...
@@ -85,7 +85,7 @@ const Upload = () => {
...
@@ -85,7 +85,7 @@ const Upload = () => {
clearTimeout
(
timer
)
clearTimeout
(
timer
)
setLoading
(
false
)
setLoading
(
false
)
navigate
(
'/preview'
,
{
state
:
{
reqData
}
})
navigate
(
'/preview'
,
{
state
:
{
reqData
}
})
},
2000
)
},
5000
)
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment