Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const PostsDetail = function({ setNotFound }: any) {
const { match } = useReactRouter();
const { id }: any = match.params || {};
const _isMember = useSelector((state: object)=>getUserInfo(state));
const list = useSelector((state: object)=>getPostsListById(state, id));
const store = useStore();
const _loadPostsList = (args: any)=>loadPostsList(args)(store.dispatch, store.getState);
const _viewPostsById = (args: any)=>viewPostsById(args)(store.dispatch, store.getState);
const _addHasRead = (args: any)=>addHasRead(args)(store.dispatch, store.getState);
const componentDidMount = function() {
// 如果已经存在 list,说明redux已经存在该帖子数据,则可以不重新请求
if (!list || !list.data) {
_loadPostsList({
id,
args: {
_id: id,
deleted: false
}
}).then(([err, res]:any)=>{
if (res && res.data && res.data[0]) {
export default function({
// displayLoading = true,
text = '上传图片',
multiple = true,
beforeUpload = ()=>{},
upload = ()=>{},
// onDrop = (files)=>{},
// onUpload = (file)=>{}
}: Props) {
const [ token, setToken ] = useState('');
const [ url, setUrl ] = useState('');
const store = useStore();
const _getQiNiuToken = () => getQiNiuToken()(store.dispatch, store.getState);
useEffect(()=>{
if (token) return;
_getQiNiuToken().then(([err, res]: any)=>{
if (res) {
setToken(res.token);
setUrl(res.url);
}
});
});
const HandleOnUpload = function(files:any) {
const Page = function ({ history, location, match, staticContext }: Props) {
// 添加 history 到全局变量中,用于给一些不能使用 useReactRouter 场景的页面跳转
if (typeof window != 'undefined') {
GlobalData.set('history', useReactRouter().history);
}
const [ notFound, setNotFound ] = useState('');
const store = useStore();
const { pathname, search } = location;
location.params = search ? parseUrl(search) : {};
useEffect(() => {
// 客户端浏览器设置滚动条位置
if (typeof window != 'undefined') {
setScrollPosition(pathname + search)(store.dispatch, store.getState);
}
return () => {
if (typeof window != 'undefined') {
// 客户端浏览器设置滚动条位置
// saveScrollPosition(pathname + search)(store.dispatch, store.getState);
export default Shell(function({ setNotFound }: any) {
const { location, match } = useReactRouter();
const { id } = match.params;
const store = useStore();
const _loadPeopleList = (args:object)=>loadPeopleList(args)(store.dispatch, store.getState);
const list = useSelector((state: object)=>getPeopleListById(state, id));
let { data = [], loading, more }: any = list || {};
let people = data[0] || null;
useEffect(()=>{
if (!people) {
_loadPeopleList({
id,
args: {
_id: id,
blocked: false
}
export default function () {
const account = createRef();
const nickname = createRef();
const password = createRef();
const male = createRef();
const female = createRef();
const captcha = createRef();
const [ areaCode, setAreaCode ] = useState('');
const [ type, setType ] = useState('phone');
const store = useStore();
const _signUp = (args:any)=>signUp(args)(store.dispatch, store.getState);
const _signIn = (args:any)=>signIn(args)(store.dispatch, store.getState);
const submit = function(event: any, test = false) {
if (event) event.preventDefault();
return new Promise(async (resolve, reject)=>{
const $account = account.current;
const $nickname = nickname.current;
const $password = password.current;
const $male = male.current;
const $female = female.current;
const $captcha = captcha.current;
export default function() {
const pcUrl = useRef();
const closeSwitch = useRef();
const me = useSelector((store: any)=>getUserInfo(store));
const store = useStore();
const load = (params: any) => loadADlist(params)(store.dispatch, store.getState);
const add = (params: any) => addAD(params)(store.dispatch, store.getState);
const update = (params: any) => updateAD(params)(store.dispatch, store.getState);
const [ pcImg, setPCImg ] = useState('');
const [ loading, setLoading ] = useState(true);
const componentDidMount = () => {
$('#ad-settings').on('show.bs.modal', async (e: any) => {
let [ ad ] = getADListDataById(store.getState(), me.ad);
setLoading(true);
export default Shell(() => {
const [full, isFull] = useState(false)
const [isfull, setIsfull] = useState(false)
const [showPic, setPic] = useState(false)
const [imgObj, setImgObj] = useState({})
const articleContent = useRef()
const {
location,
match: {
params: { id },
url
}
} = useReactRouter()
const store = useStore()
const me = useSelector(state => getUserInfo(state))
const articleData = useSelector(state => getArticle(state, id))
const newsData = useSelector(state => getNewsIndex(state, 'newslist', 44))
useEffect(() => {
const getArticleData = args => article(args)(store.dispatch, store.getState)
const getNewsData = args => newsIndex(args)(store.dispatch, store.getState)
document.onkeyup = event => {
if (event.which == '27') {
isFull(false)
}
}
if (!articleData.data) {
getArticleData({ id })
}
if (!newsData.data) {
export default Shell(() => {
const { location } = useReactRouter()
const store = useStore()
const [paused, setPaused] = useState(true)
const [time, setTime] = useState(sTime)
const _signUp = args => signUp(args)(store.dispatch, store.getState)
const [username, password, mobile, rePassword, code] = [useRef(), useRef(), useRef(), useRef(), useRef()]
const tick = () => {
if (syTime === 1) {
setTime(sTime)
setPaused(true)
} else {
syTime = syTime - 1
setTime(syTime)
setPaused(false)
}
setTimeout(() => tick(), 1000)
}
201: 'tv',
202: 'ova',
203: 'juchang',
4: 'tebie',
204: 'zhenren',
35: 'qita'
}
const {
location,
match: {
params: { id, sid = 1 }
}
} = useReactRouter()
const store = useStore()
const me = useSelector(state => getUserInfo(state))
const info = useSelector(state => getDetail(state, id))
const commentData = useSelector(state => getComment(state, `${sid}_${id}`))
const loveD = useSelector(state => getDetail(state, `love_${id}`))
const _comment = useCallback(args => comment(args)(store.dispatch, store.getState), [store.dispatch, store.getState])
const _love = useCallback(args => love(args)(store.dispatch, store.getState), [store.dispatch, store.getState])
const { userid, nickname } = me
useEffect(() => {
const getData = args => detail(args)(store.dispatch, store.getState)
if (!info || !info.data) {
getData({ id })
}
if (!commentData || !commentData.data) {
_comment({ id, sid })
const type = {
tv: 201,
ova: 202,
juchang: 203,
tebie: 4,
zhenren: 204,
qita: 35
}
const [eId, getId] = useState(type[name] || 3)
const [eMcid, getMcid] = useState(mcid ? parseInt(mcid) : '')
const [eArea, getArea] = useState(area || '全部')
const [eYear, getYear] = useState(year || '全部')
const [eLetter, getLetter] = useState(letter || '全部')
const [eOrder, getOrder] = useState(order)
const store = useStore()
const config = useSelector(state => getConfig(state, 'list'))
useEffect(() => {
const _configLoad = args => configLoad(args)(store.dispatch, store.getState)
if (!config.data) {
_configLoad({ tag: 'list' })
}
}, [config, config.data, eMcid, mcid, store.dispatch, store.getState])
const isSearch = () => {
const search = pathname.indexOf('search') !== -1
return search
}
const formatArray = (data = []) => {
let f = [{ title: '全部', id: '' }]