Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
web2022
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Website
web2022
Commits
e260ae1d
Commit
e260ae1d
authored
Aug 01, 2022
by
mxm-web-develop
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
321
parent
a2ec0a01
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
96 additions
and
25 deletions
+96
-25
.env.development
.env.development
+3
-2
LazyImg.tsx
src/components/LazyImg.tsx
+24
-0
dataFetch.tsx
src/fetch/dataFetch.tsx
+2
-2
api.ts
src/service/api.ts
+9
-3
index.ts
src/service/index.ts
+1
-1
index.tsx
src/views/Chain33/index.tsx
+10
-7
NewsDetails.tsx
src/views/News/NewsDetails.tsx
+39
-9
vite.config.ts
vite.config.ts
+8
-1
No files found.
.env.development
View file @
e260ae1d
NODE_ENV=dev
NODE_ENV=dev
VITE_FETCH_URL = http://localhost:3333/
VITE_FETCH_URL = http://localhost:3333/
VITE_CHAIN33_DOC = "http://localhost:3335"
VITE_CHAIN33_DOC = "http://localhost:3335"
VITE_BAAS33_DOC = "http://localhost:3336"
VITE_BAAS33_DOC = "http://localhost:3336"
\ No newline at end of file
VITE_NEWS_API = "'https://33.cn/api/"
\ No newline at end of file
src/components/LazyImg.tsx
0 → 100644
View file @
e260ae1d
import
{
IProps
}
from
"@/common/Iprops.interface"
import
{
useEffect
,
useRef
,
useState
}
from
"react"
import
{
gsap
}
from
'gsap'
interface
LazyImgType
extends
IProps
{
img
:
any
}
export
const
LazyImg
=
(
props
:
LazyImgType
)
=>
{
const
{
img
,
className
}
=
props
const
[
show
,
setShow
]
=
useState
(
false
)
const
imgbox
=
useRef
(
null
)
const
loaded
=
(
e
:
any
)
=>
{
if
(
e
){
setShow
(
true
)
}
}
useEffect
(()
=>
{
gsap
.
from
(
imgbox
.
current
,{
opacity
:
0
,
y
:
300
,
duration
:
0.8
})
},[])
return
(
<
img
src=
{
img
}
ref=
{
imgbox
}
className=
{
`${show?" visible":" invisible"} ${className}`
}
onLoad=
{
loaded
}
/>
)
}
\ No newline at end of file
src/fetch/dataFetch.tsx
View file @
e260ae1d
...
@@ -48,4 +48,5 @@ export const getEvents = (index:number)=>{
...
@@ -48,4 +48,5 @@ export const getEvents = (index:number)=>{
return
output
return
output
}));
}));
return
observable
return
observable
}
}
\ No newline at end of file
src/service/api.ts
View file @
e260ae1d
import
{
service
,
newsService
}
from
"."
;
import
{
service
,
newsService
}
from
"."
;
import
{
Job
}
from
"./types"
;
import
{
Job
}
from
"./types"
;
import
{
filter
,
from
}
from
"rxjs"
import
{
filter
,
from
,
map
}
from
"rxjs"
import
{
AxiosResponse
}
from
"axios"
;
import
{
AxiosResponse
}
from
"axios"
;
export
const
getJobsByDept
=
async
(
department
:
string
)
=>
{
export
const
getJobsByDept
=
async
(
department
:
string
)
=>
{
return
service
.
get
<
unknown
,
Job
[]
>
(
return
service
.
get
<
unknown
,
Job
[]
>
(
...
@@ -19,9 +19,14 @@ export const getJobsById = async (id: string) => {
...
@@ -19,9 +19,14 @@ export const getJobsById = async (id: string) => {
)
)
}
}
export
const
getNews
=
async
()
=>
{
export
const
getNews
=
()
=>
{
let
data
:
AxiosResponse
<
any
,
any
>
const
res
=
newsService
.
get
(
`news/newsList`
)
const
res
=
newsService
.
get
(
`news/newsList`
)
const
observable
=
from
(
res
).
pipe
(
filter
(
r
=>
r
.
data
))
const
observable
=
from
(
res
).
pipe
(
filter
(
r
=>
r
.
data
))
return
observable
return
observable
}
export
const
getNewsDetail
=
(
id
:
string
)
=>
{
const
res
=
newsService
.
get
(
`news/news?id=
${
id
}
`
)
const
ob
=
from
(
res
).
pipe
(
map
(
v
=>
v
.
data
))
return
ob
}
}
\ No newline at end of file
src/service/index.ts
View file @
e260ae1d
...
@@ -5,7 +5,7 @@ const service = Axios.create(
...
@@ -5,7 +5,7 @@ const service = Axios.create(
}
}
)
)
const
newsService
=
Axios
.
create
({
const
newsService
=
Axios
.
create
({
baseURL
:
'
https://33.cn/api/
'
baseURL
:
'
/proxyFile
'
})
})
const
response_interceptor
=
(
res
:
AxiosResponse
<
any
>
)
=>
{
const
response_interceptor
=
(
res
:
AxiosResponse
<
any
>
)
=>
{
...
...
src/views/Chain33/index.tsx
View file @
e260ae1d
...
@@ -4,7 +4,7 @@ import { PageLayout } from "@/layouts/PageLayout";
...
@@ -4,7 +4,7 @@ import { PageLayout } from "@/layouts/PageLayout";
import
chain33Bg
from
"@/assets/img/chain33.png"
;
import
chain33Bg
from
"@/assets/img/chain33.png"
;
import
StyledButton
from
"@/components/StyledButton"
;
import
StyledButton
from
"@/components/StyledButton"
;
import
{
IProps
}
from
"@/common/Iprops.interface"
;
import
{
IProps
}
from
"@/common/Iprops.interface"
;
import
{
useMemo
}
from
"react"
;
import
{
Suspense
,
useMemo
}
from
"react"
;
import
{
AppContianer
}
from
"@/layouts/AppContianer"
;
import
{
AppContianer
}
from
"@/layouts/AppContianer"
;
import
{
GradientLay
}
from
"@/layouts/GradientLay"
;
import
{
GradientLay
}
from
"@/layouts/GradientLay"
;
import
Gao
from
'@/assets/img/gao.png'
import
Gao
from
'@/assets/img/gao.png'
...
@@ -13,6 +13,7 @@ import Kuo from '@/assets/img/kuo.png'
...
@@ -13,6 +13,7 @@ import Kuo from '@/assets/img/kuo.png'
import
Weng
from
'@/assets/img/weng.png'
import
Weng
from
'@/assets/img/weng.png'
import
An
from
'@/assets/img/an.png'
import
An
from
'@/assets/img/an.png'
import
{
useNavigate
}
from
"react-router"
;
import
{
useNavigate
}
from
"react-router"
;
import
{
LazyImg
}
from
"@/components/LazyImg"
;
interface
HeroItemType
extends
IProps
{
interface
HeroItemType
extends
IProps
{
heroTitle
:
string
;
heroTitle
:
string
;
subtitle
:
string
;
subtitle
:
string
;
...
@@ -60,7 +61,9 @@ export default function Chain33() {
...
@@ -60,7 +61,9 @@ export default function Chain33() {
<
PageLayout
>
<
PageLayout
>
<
div
className=
"w-full h-full flex justify-center items-baseline overflow-hidden"
>
<
div
className=
"w-full h-full flex justify-center items-baseline overflow-hidden"
>
<
div
className=
"img-holder w-10/12 xl:w-8/12 relative "
>
<
div
className=
"img-holder w-10/12 xl:w-8/12 relative "
>
<
div
className=
"absolute w-full h-full flex items-center -translate-x-[5%] -translate-y-[15%] justify-center text-white"
>
<
div
className=
"absolute z-[999] w-full h-full flex items-center -translate-x-[5%] -translate-y-[15%] justify-center text-white"
>
<
div
>
<
div
>
<
div
className=
"p-5 border-white border-[4px] rounded xl:border-[8px]"
>
<
div
className=
"p-5 border-white border-[4px] rounded xl:border-[8px]"
>
<
div
className=
"text-7xl xl:text-9xl tracking-widest font-bold"
>
<
div
className=
"text-7xl xl:text-9xl tracking-widest font-bold"
>
...
@@ -78,11 +81,11 @@ export default function Chain33() {
...
@@ -78,11 +81,11 @@ export default function Chain33() {
</
div
>
</
div
>
</
div
>
</
div
>
<
i
mg
<
LazyI
mg
onLoad=
{
imgOnload
}
img=
{
chain33Bg
}
src=
{
chain33Bg
}
className=
'object-scale-down object-bottom z-[9]'
className=
"object-scale-down object-bottom"
></
LazyImg
>
/>
</
div
>
</
div
>
</
div
>
</
div
>
</
PageLayout
>
</
PageLayout
>
...
...
src/views/News/NewsDetails.tsx
View file @
e260ae1d
import
{
IProps
}
from
"@/common/Iprops.interface"
;
import
{
IProps
}
from
"@/common/Iprops.interface"
;
import
{
AppContianer
}
from
"@/layouts/AppContianer"
;
import
{
AppContianer
}
from
"@/layouts/AppContianer"
;
import
{
PageLayout
}
from
"@/layouts/PageLayout"
;
import
{
PageLayout
}
from
"@/layouts/PageLayout"
;
import
{
getNews
,
getNewsDetail
}
from
"@/service/api"
;
import
{
useEffect
,
useState
}
from
"react"
;
import
{
useParams
}
from
"react-router"
;
import
{
map
}
from
"rxjs"
;
interface
NewsDetailsType
extends
IProps
{}
interface
NewsDetailsType
extends
IProps
{}
export
const
NewsDetails
=
(
props
:
NewsDetailsType
)
=>
{
export
const
NewsDetails
=
(
props
:
NewsDetailsType
)
=>
{
const
params
=
useParams
()
const
[
data
,
setData
]
=
useState
<
any
>
()
const
[
latestNews
,
setLatestNews
]
=
useState
<
any
>
()
useEffect
(()
=>
{
if
(
params
[
'id'
]){
getNewsDetail
(
params
[
'id'
]).
subscribe
(
v
=>
{
setData
(
v
)
})
}
},[
params
])
useEffect
(()
=>
{
getNews
().
pipe
(
map
(
v
=>
v
.
data
.
list
)).
subscribe
(
v
=>
{
const
d
=
v
.
sort
((
a
:
any
,
b
:
any
)
=>
{
return
b
.
time_stamp
-
a
.
time_stamp
})
const
output
=
d
.
filter
((
i
:
any
,
index
:
number
)
=>
{
return
index
<
5
})
setLatestNews
(
output
)
})
},[])
return
(
return
(
<
PageLayout
>
<
PageLayout
className=
" overflow-y-scroll"
>
<
AppContianer
>
<
AppContianer
>
<
div
className=
"flex normal-text"
>
<
div
className=
"flex normal-text
"
>
<
div
className=
'left'
>
<
div
className=
"w-2/12"
>
<
div
className=
'flex-col pr-5 pt-12 text-center '
>
<
div
className=
'flex-col pr-5 pt-12 text-center '
>
<
div
className=
'py-5'
>
<
div
className=
'py-5'
>
<
div
>
- 来源 -
</
div
>
<
div
>
- 来源 -
</
div
>
...
@@ -21,20 +46,25 @@ export const NewsDetails = (props:NewsDetailsType)=>{
...
@@ -21,20 +46,25 @@ export const NewsDetails = (props:NewsDetailsType)=>{
</
div
>
</
div
>
<
div
className=
'py-5'
>
<
div
className=
'py-5'
>
<
div
>
- 作者 -
</
div
>
<
div
>
- 作者 -
</
div
>
<
div
className=
'content-sub-title-cn'
>
复杂美科技
</
div
>
<
div
className=
'content-sub-title-cn'
>
{
data
&&
data
.
publisher
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
'center flex-grow'
>
<
div
className=
"w-8/12"
>
<
div
className=
'richRender pt-5 px-20'
>
<
div
className=
'richRender pt-5 px-20'
>
richcontent from 33 news service
<
div
className=
'title-1-cn'
>
{
data
&&
data
.
title
}
</
div
>
<
div
dangerouslySetInnerHTML=
{
{
__html
:
data
&&
data
.
content
}
}
className=
"py-5"
></
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
'
right
'
>
<
div
className=
'
w-2/12
'
>
<
div
className=
'flex-col
pl-5
pt-12'
>
<
div
className=
'flex-col pt-12'
>
<
div
className=
'content-sub-title-cn'
>
最新消息
</
div
>
<
div
className=
'content-sub-title-cn'
>
最新消息
</
div
>
<
div
>
<
div
>
news Items
{
latestNews
&&
latestNews
.
map
((
k
:
any
,
index
:
number
)
=>
(
<
div
key=
{
index
}
className=
"py-1 normal-text cursor-pointer hover:text-theme-blue"
>
{
k
.
title
}
</
div
>
))
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
vite.config.ts
View file @
e260ae1d
...
@@ -20,7 +20,14 @@ export default defineConfig({
...
@@ -20,7 +20,14 @@ export default defineConfig({
},
},
},
},
server
:{
server
:{
port
:
8008
port
:
8008
,
proxy
:{
"/proxyFile"
:{
target
:
'https://33.cn/api/'
,
changeOrigin
:
true
,
rewrite
:
path
=>
path
.
replace
(
/^
\/
proxyFile/
,
''
)
}
}
},
},
build
:{
build
:{
sourcemap
:
false
,
sourcemap
:
false
,
...
...
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