Commit f8618c03 authored by 吕祺's avatar 吕祺 ⛹🏽

ronghuipage

parent 3f63875b
import React from 'react'
import marked from 'marked'
import newsList from '../content/newsList.md'
import Head from 'next/head'
import { Title } from '../components/Title'
/* eslint-enable no-unused-vars */
import { yymmdd } from '../utils/date'
import './post.css'
export default class PostVideoPage extends React.Component {
constructor(props) {
super(props)
this.state = {
type: null,
article: [],
mounted: false
}
}
componentDidMount() {
// let date = document.location.href.match(/d=[^=&]*/)
// let type = document.location.href.match(/t=[^=&]*/)
let title = document.location.href.match(/t=([^=&]*)/)
if (!title || title.length === 0) {
return null
}
title = decodeURI(title[1])
// date = date[0].slice(2)
// type = type[0].slice(2)
const {
attributes: { news }
} = newsList
let article = []
news.map((n) => {
// const curDate = n.createDate.replace(/[^\d]/g, '')
if (n.title === title) {
article.push(n)
}
})
this.setState({
article,
mounted: true
})
}
render() {
const { article, mounted } = this.state
if (!article || !mounted) return null
if (article.length === 0) {
return <div>not found</div>
}
const post = article[0]
// console.log(post.content)
return (
<div className="post-page">
<Head>
<title>
{post.title}
</title>
</Head>
<div className="post-outline-wrapper">
<div className="bg"></div>
<div className="post-wrapper">
<Title >
{ post.title}
</Title>
<div className="post-dateshare-wrapper">
<div className="post-date">
{yymmdd(new Date(post.createDate)).join('/')}
</div>
</div>
<Video id="video" src={post.video}
poster={post.videoPoster}/>
<div
className="post-content"
dangerouslySetInnerHTML={(() => {
if (post.content) {
return { __html: marked(post.content) }
} else {
return { __html: '暂无内容' }
}
})()}
></div>
<div className="post-end">
<img src="/static/img/logo-yellow.svg" />
</div>
</div>
</div>
</div>
)
}
}
......@@ -47,6 +47,68 @@ collections:
- { label: "Cover", name: "cover", widget: "image" }
- { label: "JumpUrl", name: "jumpUrl", widget: "string", required: false }
- name: "ronghuiPage"
label: "ronghuiPage"
files:
- label: "ronghuiPage"
name: "ronghuiPage"
file: "content/ronghuiPage.md"
fields:
- { label: "RollImage1", name: "rollimage1", widget: "image" }
- { label: "RollImage2", name: "rollimage2", widget: "image", required: false }
- { label: "RollImage3", name: "rollimage3", widget: "image", required: false }
- { label: "HotTitle", name: "hotTitle", widget: "string" }
- { label: "HotSubTitle", name: "hotTitle", widget: "string" }
- { label: "HotCover", name: "hotCover", widget: "image" }
- { label: "HotJumpUrl", name: "hotJumpUrl", widget: "string" , required: false }
- label: "实战沙龙"
name: "shizhan"
widget: list
fields:
- { label: "Title", name: "title", widget: "string" }
- { label: "SubTitle", name: "subTitle", widget: "string" }
- { label: "Author", name: "author", widget: "string" }
- { label: "AuthorTitle", name: "authorTitle", widget: "string" }
- { label: "Cover", name: "cover", widget: "image" }
- { label: "JumpUrl", name: "jumpUrl", widget: "string", required: false }
- label: "Type"
name: "type"
widget: "select"
options: ["战略", "组织", "增长", "资本市场", "行业"]
- label: "行业探讨"
name: "industry"
widget: list
fields:
- { label: "Title", name: "title", widget: "string" }
- { label: "Cover", name: "cover", widget: "image" }
- { label: "JumpUrl", name: "jumpUrl", widget: "string", required: false }
- label: "平台参访"
name: "visit"
widget: list
fields:
- { label: "Title", name: "title", widget: "string" }
- { label: "SubTitle", name: "subTitle", widget: "string" }
- { label: "Cover", name: "cover", widget: "image" }
- { label: "logo", name: "logo", widget: "image" }
- { label: "JumpUrl", name: "jumpUrl", widget: "string", required: false }
- label: "深度增长营"
name: "camp"
widget: list
fields:
- { label: "Title", name: "title", widget: "string" }
- label: "SubTitle, no mark"
name: "subTitle"
widget: list
fields:
- { label: "Title", name: "title", widget: "string" }
- { label: "Cover", name: "cover", widget: "image" }
- { label: "JumpUrl", name: "jumpUrl", widget: "string", required: false }
- name: "article"
label: "article"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment