tasks.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  1. <template>
  2. <PlayfulCard elevation="1">
  3. <view class="container">
  4. <!-- 批量操作栏 -->
  5. <view class="batch-bar" v-if="batchMode">
  6. <checkbox :checked="isAllSelected" @click="toggleSelectAll" />
  7. <text class="batch-label">全选</text>
  8. <view class="batch-actions">
  9. <button class="batch-btn complete" @click="batchComplete" :disabled="selectedTasks.length === 0">批量完成</button>
  10. <button class="batch-btn delete" @click="batchDelete" :disabled="selectedTasks.length === 0">批量删除</button>
  11. </view>
  12. <button class="batch-exit" @click="exitBatchMode">退出</button>
  13. </view>
  14. <!-- 正常模式顶部栏 -->
  15. <view class="header-bar" v-else>
  16. <text class="header-title">今日任务</text>
  17. <button class="btn-batch" @click="enterBatchMode" v-if="tasks.length > 0">批量操作</button>
  18. </view>
  19. <!-- 任务列表 -->
  20. <view class="task-list" v-if="tasks.length > 0">
  21. <view
  22. v-for="task in tasks"
  23. :key="task.id"
  24. class="task-item"
  25. :class="{ completed: task.status === 'completed', selected: selectedTasks.includes(task.id) }"
  26. >
  27. <view class="task-checkbox" v-if="batchMode" @click="toggleTaskSelect(task.id)">
  28. <checkbox :checked="selectedTasks.includes(task.id)" />
  29. </view>
  30. <view class="task-left">
  31. <view class="task-title">
  32. {{ task.title }}
  33. <text v-if="task.category === '小游戏类'" class="minigame-badge">🎮</text>
  34. </view>
  35. <view class="task-meta">
  36. <text class="points">+{{ task.points }}分</text>
  37. <text class="deadline">截止 {{ formatTime(task.deadline) }}</text>
  38. </view>
  39. </view>
  40. <view class="task-right" v-if="!batchMode">
  41. <button
  42. v-if="task.status === 'pending'"
  43. class="btn-complete"
  44. @click="isParent ? completeParentTask(task.id) : completeTask(task.id)"
  45. >
  46. 完成
  47. </button>
  48. <view v-else class="completed-badge">已完成</view>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="empty" v-else>
  53. <text>暂无今日任务</text>
  54. </view>
  55. <!-- 家长模式:添加任务按钮 -->
  56. <button
  57. v-if="isParent && !batchMode"
  58. class="btn-primary add-btn"
  59. @click="showAddModal = true"
  60. >
  61. + 添加任务
  62. </button>
  63. <!-- 添加任务弹窗 -->
  64. <view class="modal-mask" v-if="showAddModal" @click="showAddModal = false">
  65. <view class="modal modal-large" @click.stop>
  66. <view class="modal-title">创建任务</view>
  67. <!-- 任务模板选择 -->
  68. <view class="form-item">
  69. <view class="form-label">从模板选择(可选)</view>
  70. <picker mode="selector" :range="taskTemplates" range-key="title" @change="onTemplateChange">
  71. <view class="picker">{{ selectedTemplate ? selectedTemplate.title : '选择任务模板' }}</view>
  72. </picker>
  73. </view>
  74. <!-- 必填:标题 -->
  75. <view class="form-item">
  76. <view class="form-label">任务标题 <text class="required">*</text></view>
  77. <input v-model="newTask.title" placeholder="请输入任务标题" />
  78. </view>
  79. <!-- 内容 -->
  80. <view class="form-item">
  81. <view class="form-label">任务内容</view>
  82. <textarea v-model="newTask.description" placeholder="请输入任务描述" class="textarea" />
  83. </view>
  84. <!-- 类型 -->
  85. <view class="form-item">
  86. <view class="form-label">类型 <text class="required">*</text></view>
  87. <picker mode="selector" :range="categories" @change="onCategoryChange">
  88. <view class="picker">{{ newTask.category || '请选择类型' }}</view>
  89. </picker>
  90. </view>
  91. <!-- 完成方式 -->
  92. <view class="form-item">
  93. <view class="form-label">完成方式 <text class="required">*</text></view>
  94. <checkbox-group @change="onCompleteTypeChange">
  95. <label v-for="type in completeTypes" :key="type.value">
  96. <checkbox :value="type.value" :checked="newTask.completeTypes.includes(type.value)" />
  97. <text>{{ type.label }}</text>
  98. </label>
  99. </checkbox-group>
  100. </view>
  101. <!-- 积分和时长 -->
  102. <view class="form-row">
  103. <view class="form-item half">
  104. <view class="form-label">积分 <text class="required">*</text></view>
  105. <input v-model="newTask.points" type="number" placeholder="1-10" />
  106. </view>
  107. <view class="form-item half">
  108. <view class="form-label">时长(分钟)</view>
  109. <input v-model="newTask.duration" type="number" placeholder="时长" />
  110. </view>
  111. </view>
  112. <!-- 完成孩子(多选) -->
  113. <view class="form-item">
  114. <view class="form-label">完成孩子 <text class="required">*</text></view>
  115. <checkbox-group @change="onChildSelectChange">
  116. <label v-for="child in children" :key="child.id">
  117. <checkbox :value="child.id" :checked="newTask.childIds.includes(child.id)" />
  118. <text>{{ child.nickname }}</text>
  119. </label>
  120. </checkbox-group>
  121. </view>
  122. <!-- 任务性质 -->
  123. <view class="form-item">
  124. <view class="form-label">任务性质 <text class="required">*</text></view>
  125. <radio-group @change="onTaskTypeChange">
  126. <label><radio value="onetime" :checked="newTask.taskType === 'onetime'" />一次性</label>
  127. <label><radio value="recurring" :checked="newTask.taskType === 'recurring'" />循环任务</label>
  128. </radio-group>
  129. </view>
  130. <!-- 循环任务:频率和次数 -->
  131. <view class="form-item" v-if="newTask.taskType === 'recurring'">
  132. <view class="form-label">频率</view>
  133. <picker mode="selector" :range="frequencies" @change="onFrequencyChange">
  134. <view class="picker">{{ newTask.frequency || '请选择频率' }}</view>
  135. </picker>
  136. </view>
  137. <view class="form-item" v-if="newTask.taskType === 'recurring'">
  138. <view class="form-label">周期内最多完成次数</view>
  139. <input v-model="newTask.maxFrequency" type="number" placeholder="超过次数不记积分" />
  140. </view>
  141. <!-- 审核设置 -->
  142. <view class="form-item">
  143. <view class="form-label">需要审核</view>
  144. <switch :checked="newTask.needReview === 1" @change="onNeedReviewChange" />
  145. </view>
  146. <view class="form-item" v-if="newTask.needReview === 1">
  147. <view class="form-label">审核人</view>
  148. <picker mode="selector" :range="reviewTypes" range-key="label" @change="onReviewTypeChange">
  149. <view class="picker">{{ getReviewTypeLabel(newTask.reviewType) }}</view>
  150. </picker>
  151. </view>
  152. <!-- 非必填:时间 -->
  153. <view class="form-item">
  154. <view class="form-label">最早开始时间</view>
  155. <picker mode="datetime" :value="newTask.earliestStart" @change="onEarliestStartChange">
  156. <view class="picker">{{ newTask.earliestStart || '选择时间(不填表示不限时)' }}</view>
  157. </picker>
  158. </view>
  159. <view class="form-item">
  160. <view class="form-label">最晚结束时间</view>
  161. <picker mode="datetime" :value="newTask.latestEnd" @change="onLatestEndChange">
  162. <view class="picker">{{ newTask.latestEnd || '选择时间(不填表示不限时)' }}</view>
  163. </picker>
  164. </view>
  165. <view class="modal-btns">
  166. <button @click="showAddModal = false">取消</button>
  167. <button class="btn-primary" @click="createTask">创建任务</button>
  168. </view>
  169. </view>
  170. </view>
  171. </view>
  172. </PlayfulCard>
  173. </template>
  174. <script>
  175. import { getTodayTasks, completeTask as completeTaskApi, createTask as createTaskApi, getChildren, getTodayParentTasks, completeParentTask as completeParentTaskApi, batchCompleteTasks, batchDeleteTasks } from '../../utils/api.js'
  176. import PlayfulCard from '@/components/PlayfulCard.vue'
  177. export default {
  178. components: { PlayfulCard },
  179. data() {
  180. return {
  181. tasks: [],
  182. isParent: false,
  183. currentRole: 'parent', // 当前角色
  184. currentChildId: '',
  185. children: [], // 孩子列表
  186. taskTemplates: [], // 任务模板
  187. selectedTemplate: null,
  188. showAddModal: false,
  189. batchMode: false,
  190. selectedTasks: [],
  191. newTask: {
  192. title: '',
  193. description: '',
  194. category: '',
  195. points: 2,
  196. duration: '',
  197. childIds: [],
  198. taskType: 'onetime',
  199. frequency: '',
  200. maxFrequency: '',
  201. completeTypes: ['checkin'],
  202. needReview: 0,
  203. reviewType: 'parent',
  204. earliestStart: '',
  205. latestEnd: ''
  206. },
  207. categories: ['学习类', '生活类', '运动类', '小游戏类', '其他'],
  208. completeTypes: [
  209. { value: 'checkin', label: '打卡' },
  210. { value: 'text', label: '文本' },
  211. { value: 'audio', label: '语音' },
  212. { value: 'image', label: '图片' },
  213. { value: 'video', label: '视频' }
  214. ],
  215. frequencies: ['每天', '每周', '每月'],
  216. reviewTypes: [
  217. { value: 'creator', label: '创建人' },
  218. { value: 'parent', label: '家长' },
  219. { value: 'teacher', label: '成长规划师' },
  220. { value: 'ai', label: 'AI自动' }
  221. ]
  222. }
  223. },
  224. onShow() {
  225. // 规划师角色跳转到家庭管理页
  226. const role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || 'parent'
  227. if (role === 'teacher') {
  228. uni.redirectTo({ url: '/pages/teacher/families' })
  229. return
  230. }
  231. // 加载任务数据
  232. this.loadParentTasks()
  233. },
  234. methods: {
  235. async loadParentTasks() {
  236. try {
  237. const currentUserId = uni.getStorageSync('userId')
  238. const res = await getTodayParentTasks()
  239. this.tasks = (res.data || []).slice(0, 5)
  240. } catch (e) {
  241. console.error('加载任务失败', e)
  242. }
  243. },
  244. async loadChildren() {
  245. try {
  246. const res = await getChildren()
  247. this.children = res.data || []
  248. // 默认选中第一个孩子
  249. if (this.children.length > 0) {
  250. this.newTask.childIds = [this.children[0].id]
  251. }
  252. } catch (e) {
  253. console.error('加载孩子失败', e)
  254. }
  255. },
  256. // 加载家长任务(分配给家长的任务)
  257. async loadParentTasks() {
  258. try {
  259. const res = await getTodayParentTasks()
  260. this.tasks = res.data || []
  261. } catch (e) {
  262. console.error('加载家长任务失败', e)
  263. }
  264. },
  265. async loadTasks() {
  266. try {
  267. const childrenRes = await getChildren()
  268. const children = childrenRes.data
  269. if (children && children.length > 0) {
  270. this.currentChildId = children[0].id
  271. const res = await getTodayTasks(this.currentChildId)
  272. this.tasks = res.data || []
  273. }
  274. } catch (e) {
  275. console.error('加载任务失败', e)
  276. }
  277. },
  278. // 完成任务(孩子模式)
  279. async completeTask(taskId) {
  280. try {
  281. const res = await completeTaskApi(taskId, this.currentChildId, '')
  282. uni.showToast({
  283. title: `获得 ${res.data.pointsEarned} 积分`,
  284. icon: 'success'
  285. })
  286. this.loadTasks()
  287. } catch (e) {
  288. console.error('完成任务失败', e)
  289. }
  290. },
  291. // 完成任务(家长模式)
  292. async completeParentTask(taskId) {
  293. try {
  294. const res = await completeParentTaskApi(taskId)
  295. uni.showToast({
  296. title: `获得 ${res.data.pointsEarned} 积分`,
  297. icon: 'success'
  298. })
  299. this.loadParentTasks()
  300. } catch (e) {
  301. console.error('完成任务失败', e)
  302. }
  303. },
  304. // 模板选择
  305. onTemplateChange(e) {
  306. if (e.detail.value >= 0) {
  307. this.selectedTemplate = this.taskTemplates[e.detail.value]
  308. this.applyTemplate(this.selectedTemplate)
  309. }
  310. },
  311. applyTemplate(template) {
  312. this.newTask.title = template.title || ''
  313. this.newTask.description = template.description || ''
  314. this.newTask.category = template.category || ''
  315. this.newTask.points = template.points || 2
  316. this.newTask.duration = template.duration || ''
  317. this.newTask.completeTypes = template.completeTypes ? template.completeTypes.split(',') : ['checkin']
  318. this.newTask.needReview = template.needReview || 0
  319. this.newTask.reviewType = template.reviewType || 'parent'
  320. },
  321. // 类型选择
  322. onCategoryChange(e) {
  323. this.newTask.category = this.categories[e.detail.value]
  324. },
  325. // 完成方式选择
  326. onCompleteTypeChange(e) {
  327. this.newTask.completeTypes = e.detail.value
  328. },
  329. // 孩子多选
  330. onChildSelectChange(e) {
  331. this.newTask.childIds = e.detail.value.map(id => parseInt(id))
  332. },
  333. // 任务性质
  334. onTaskTypeChange(e) {
  335. this.newTask.taskType = e.detail.value
  336. },
  337. // 频率选择
  338. onFrequencyChange(e) {
  339. const freq = this.frequencies[e.detail.value]
  340. this.newTask.frequency = freq === '每天' ? 'daily' : (freq === '每周' ? 'weekly' : 'monthly')
  341. },
  342. // 是否需要审核
  343. onNeedReviewChange(e) {
  344. this.newTask.needReview = e.detail.value ? 1 : 0
  345. },
  346. // 审核人选择
  347. onReviewTypeChange(e) {
  348. this.newTask.reviewType = this.reviewTypes[e.detail.value].value
  349. },
  350. getReviewTypeLabel(value) {
  351. const found = this.reviewTypes.find(r => r.value === value)
  352. return found ? found.label : '请选择审核人'
  353. },
  354. // 时间选择
  355. onEarliestStartChange(e) {
  356. this.newTask.earliestStart = e.detail.value
  357. },
  358. onLatestEndChange(e) {
  359. this.newTask.latestEnd = e.detail.value
  360. },
  361. async createTask() {
  362. // 验证必填
  363. if (!this.newTask.title) {
  364. uni.showToast({ title: '请输入任务标题', icon: 'none' })
  365. return
  366. }
  367. if (!this.newTask.category) {
  368. uni.showToast({ title: '请选择类型', icon: 'none' })
  369. return
  370. }
  371. if (!this.newTask.completeTypes || this.newTask.completeTypes.length === 0) {
  372. uni.showToast({ title: '请选择完成方式', icon: 'none' })
  373. return
  374. }
  375. if (!this.newTask.childIds || this.newTask.childIds.length === 0) {
  376. uni.showToast({ title: '请选择完成孩子', icon: 'none' })
  377. return
  378. }
  379. try {
  380. await createTaskApi({
  381. title: this.newTask.title,
  382. description: this.newTask.description,
  383. category: this.newTask.category,
  384. points: parseInt(this.newTask.points) || 2,
  385. duration: parseInt(this.newTask.duration) || null,
  386. childIds: this.newTask.childIds,
  387. taskType: this.newTask.taskType,
  388. frequency: this.newTask.frequency,
  389. maxFrequency: parseInt(this.newTask.maxFrequency) || null,
  390. completeTypes: this.newTask.completeTypes,
  391. needReview: this.newTask.needReview,
  392. reviewType: this.newTask.reviewType,
  393. earliestStart: this.newTask.earliestStart || null,
  394. latestEnd: this.newTask.latestEnd || null
  395. })
  396. uni.showToast({ title: '创建成功', icon: 'success' })
  397. this.showAddModal = false
  398. this.resetNewTask()
  399. this.loadTasks()
  400. } catch (e) {
  401. console.error('创建任务失败', e)
  402. uni.showToast({ title: '创建失败', icon: 'none' })
  403. }
  404. },
  405. resetNewTask() {
  406. this.newTask = {
  407. title: '',
  408. description: '',
  409. category: '',
  410. points: 2,
  411. duration: '',
  412. childIds: this.children.length > 0 ? [this.children[0].id] : [],
  413. taskType: 'onetime',
  414. frequency: '',
  415. maxFrequency: '',
  416. completeTypes: ['checkin'],
  417. needReview: 0,
  418. reviewType: 'parent',
  419. earliestStart: '',
  420. latestEnd: ''
  421. }
  422. this.selectedTemplate = null
  423. },
  424. formatTime(dateStr) {
  425. if (!dateStr) return ''
  426. const date = new Date(dateStr)
  427. return `${date.getHours()}:${String(date.getMinutes()).padStart(2, '0')}`
  428. },
  429. enterBatchMode() {
  430. this.batchMode = true
  431. this.selectedTasks = []
  432. },
  433. exitBatchMode() {
  434. this.batchMode = false
  435. this.selectedTasks = []
  436. },
  437. toggleTaskSelect(taskId) {
  438. const index = this.selectedTasks.indexOf(taskId)
  439. if (index > -1) {
  440. this.selectedTasks.splice(index, 1)
  441. } else {
  442. this.selectedTasks.push(taskId)
  443. }
  444. },
  445. toggleSelectAll() {
  446. if (this.isAllSelected) {
  447. this.selectedTasks = []
  448. } else {
  449. this.selectedTasks = this.tasks.filter(t => t.status === 'pending').map(t => t.id)
  450. }
  451. },
  452. async batchComplete() {
  453. if (this.selectedTasks.length === 0) {
  454. uni.showToast({ title: '请选择任务', icon: 'none' })
  455. return
  456. }
  457. try {
  458. await batchCompleteTasks(this.selectedTasks)
  459. uni.showToast({ title: '批量完成成功', icon: 'success' })
  460. this.exitBatchMode()
  461. this.loadParentTasks()
  462. } catch (e) {
  463. console.error('批量完成失败', e)
  464. uni.showToast({ title: '批量完成失败', icon: 'none' })
  465. }
  466. },
  467. async batchDelete() {
  468. if (this.selectedTasks.length === 0) {
  469. uni.showToast({ title: '请选择任务', icon: 'none' })
  470. return
  471. }
  472. uni.showModal({
  473. title: '确认删除',
  474. content: `确定要删除选中的 ${this.selectedTasks.length} 个任务吗?`,
  475. success: async (res) => {
  476. if (res.confirm) {
  477. try {
  478. await batchDeleteTasks(this.selectedTasks)
  479. uni.showToast({ title: '批量删除成功', icon: 'success' })
  480. this.exitBatchMode()
  481. this.loadParentTasks()
  482. } catch (e) {
  483. console.error('批量删除失败', e)
  484. uni.showToast({ title: '批量删除失败', icon: 'none' })
  485. }
  486. }
  487. }
  488. })
  489. }
  490. },
  491. computed: {
  492. isAllSelected() {
  493. if (this.selectedTasks.length === 0) return false
  494. const pendingTasks = this.tasks.filter(t => t.status === 'pending')
  495. return pendingTasks.length > 0 && pendingTasks.every(t => this.selectedTasks.includes(t.id))
  496. }
  497. }
  498. }
  499. </script>
  500. <style scoped>
  501. .container {
  502. padding: 30rpx;
  503. padding-bottom: 120rpx;
  504. }
  505. .header-bar {
  506. display: flex;
  507. justify-content: space-between;
  508. align-items: center;
  509. margin-bottom: 30rpx;
  510. }
  511. .header-title {
  512. font-size: 32rpx;
  513. font-weight: bold;
  514. color: #333;
  515. }
  516. .btn-batch {
  517. background: #F97316;
  518. color: #fff;
  519. font-size: 24rpx;
  520. padding: 10rpx 30rpx;
  521. border-radius: 30rpx;
  522. }
  523. .batch-bar {
  524. display: flex;
  525. align-items: center;
  526. background: #f5f5f5;
  527. padding: 20rpx 30rpx;
  528. border-radius: 16rpx;
  529. margin-bottom: 30rpx;
  530. }
  531. .batch-label {
  532. font-size: 28rpx;
  533. color: #333;
  534. margin-left: 10rpx;
  535. margin-right: auto;
  536. }
  537. .batch-actions {
  538. display: flex;
  539. gap: 20rpx;
  540. }
  541. .batch-btn {
  542. font-size: 24rpx;
  543. padding: 10rpx 30rpx;
  544. border-radius: 30rpx;
  545. background: #F97316;
  546. color: #fff;
  547. }
  548. .batch-btn.complete {
  549. background: #52C41A;
  550. }
  551. .batch-btn.delete {
  552. background: #FF4D4F;
  553. }
  554. .batch-btn[disabled] {
  555. background: #ccc;
  556. }
  557. .batch-exit {
  558. font-size: 24rpx;
  559. color: #999;
  560. margin-left: 20rpx;
  561. }
  562. .task-item {
  563. background: #fff;
  564. border-radius: 16rpx;
  565. padding: 30rpx;
  566. margin-bottom: 20rpx;
  567. display: flex;
  568. justify-content: space-between;
  569. align-items: center;
  570. }
  571. .task-item.selected {
  572. background: #FFF1F0;
  573. border: 2rpx solid #F97316;
  574. }
  575. .task-checkbox {
  576. margin-right: 20rpx;
  577. }
  578. .task-title {
  579. background: #fff;
  580. border-radius: 16rpx;
  581. padding: 30rpx;
  582. margin-bottom: 20rpx;
  583. display: flex;
  584. justify-content: space-between;
  585. align-items: center;
  586. }
  587. .task-item.completed {
  588. opacity: 0.6;
  589. }
  590. .task-title {
  591. font-size: 30rpx;
  592. color: #333;
  593. margin-bottom: 10rpx;
  594. }
  595. .task-meta {
  596. display: flex;
  597. gap: 20rpx;
  598. }
  599. .points {
  600. color: #F97316;
  601. font-size: 24rpx;
  602. }
  603. .deadline {
  604. color: #999;
  605. font-size: 24rpx;
  606. }
  607. .btn-complete {
  608. background: #F97316;
  609. color: #fff;
  610. font-size: 26rpx;
  611. padding: 10rpx 30rpx;
  612. border-radius: 30rpx;
  613. }
  614. .completed-badge {
  615. color: #52C41A;
  616. font-size: 26rpx;
  617. }
  618. .minigame-badge {
  619. font-size: 28rpx;
  620. margin-left: 10rpx;
  621. }
  622. .add-btn {
  623. position: fixed;
  624. bottom: 30rpx;
  625. left: 30rpx;
  626. right: 30rpx;
  627. }
  628. .empty {
  629. text-align: center;
  630. color: #999;
  631. padding: 100rpx;
  632. }
  633. .modal-mask {
  634. position: fixed;
  635. top: 0;
  636. left: 0;
  637. right: 0;
  638. bottom: 0;
  639. background: rgba(0, 0, 0, 0.5);
  640. display: flex;
  641. align-items: center;
  642. justify-content: center;
  643. }
  644. .modal {
  645. background: #fff;
  646. border-radius: 20rpx;
  647. padding: 40rpx;
  648. width: 80%;
  649. max-height: 80vh;
  650. overflow-y: auto;
  651. }
  652. .modal-large {
  653. width: 90%;
  654. }
  655. .modal-title {
  656. font-size: 32rpx;
  657. font-weight: bold;
  658. margin-bottom: 30rpx;
  659. text-align: center;
  660. }
  661. .form-item {
  662. margin-bottom: 20rpx;
  663. }
  664. .form-label {
  665. font-size: 28rpx;
  666. color: #333;
  667. margin-bottom: 10rpx;
  668. }
  669. .form-label .required {
  670. color: #F97316;
  671. }
  672. .form-row {
  673. display: flex;
  674. gap: 20rpx;
  675. }
  676. .form-item.half {
  677. flex: 1;
  678. }
  679. .form-item input, .picker, .textarea {
  680. border: 1rpx solid #ddd;
  681. border-radius: 10rpx;
  682. padding: 20rpx;
  683. font-size: 28rpx;
  684. width: 100%;
  685. box-sizing: border-box;
  686. }
  687. .textarea {
  688. min-height: 100rpx;
  689. }
  690. .form-item checkbox-group {
  691. display: flex;
  692. flex-wrap: wrap;
  693. gap: 20rpx;
  694. }
  695. .form-item label {
  696. display: flex;
  697. align-items: center;
  698. gap: 10rpx;
  699. font-size: 28rpx;
  700. }
  701. .modal-btns {
  702. display: flex;
  703. gap: 20rpx;
  704. margin-top: 30rpx;
  705. }
  706. .modal-btns button {
  707. flex: 1;
  708. }
  709. </style>