diff --git a/miniprogram/src/app.config.js b/miniprogram/src/app.config.js index b0791e6..56f9478 100644 --- a/miniprogram/src/app.config.js +++ b/miniprogram/src/app.config.js @@ -38,6 +38,15 @@ export default { 'pages/pay-qr/index', 'pages/parks/index', 'pages/park-detail/index', + 'pages/hall/index', + 'pages/hall-talents/index', + 'pages/hall-talent-detail/index', + 'pages/hall-jobs/index', + 'pages/hall-job-detail/index', + 'pages/hall-services/index', + 'pages/hall-service-detail/index', + 'pages/community/index', + 'pages/community-post/index', 'pages/park-screens/index', 'pages/park-tasks/index', 'pages/park-screen-ctl/index', diff --git a/miniprogram/src/pages/community-post/index.jsx b/miniprogram/src/pages/community-post/index.jsx new file mode 100644 index 0000000..f941556 --- /dev/null +++ b/miniprogram/src/pages/community-post/index.jsx @@ -0,0 +1,43 @@ +import { View, Text, Input, Textarea, Button } from '@tarojs/components'; +import Taro from '@tarojs/taro'; +import { useState } from 'react'; +import { communityCreatePost } from '@/utils/hall'; +import { isAuthed } from '@/utils/auth'; +import { PageHeader } from '@/components/TopInset'; +import '@/styles/hall.scss'; + +const TOPICS = ['交流', '求助', '资源', '经验', '公告']; + +export default function CommunityPost() { + const [f, setF] = useState({ topic: '交流', title: '', content: '' }); + const [msg, setMsg] = useState(''); + const [busy, setBusy] = useState(false); + const submit = async () => { + if (!isAuthed()) { Taro.showToast({ title: '请先登录', icon: 'none' }); return; } + setBusy(true); setMsg(''); + try { + await communityCreatePost(f); + Taro.showToast({ title: '发布成功', icon: 'success' }); + setTimeout(() => Taro.navigateBack(), 800); + } catch (e) { setMsg((e && e.message) || '发布失败'); } + finally { setBusy(false); } + }; + return ( + + + + + {TOPICS.map((t) => ( + setF((s) => ({ ...s, topic: t }))}>{t} + ))} + + setF((s) => ({ ...s, title: e.detail.value }))} /> +