tasks.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772
  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.memberIds.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 { parseDate } from '../../utils/format.js'
  177. import PlayfulCard from '@/components/PlayfulCard.vue'
  178. export default {
  179. components: { PlayfulCard },
  180. data() {
  181. return {
  182. tasks: [],
  183. isParent: false,
  184. currentRole: 'parent', // 当前角色
  185. currentChildId: '',
  186. children: [], // 孩子列表
  187. taskTemplates: [], // 任务模板
  188. selectedTemplate: null,
  189. showAddModal: false,
  190. batchMode: false,
  191. selectedTasks: [],
  192. newTask: {
  193. title: '',
  194. description: '',
  195. category: '',
  196. points: 2,
  197. duration: '',
  198. memberIds: [],
  199. taskType: 'onetime',
  200. frequency: '',
  201. maxFrequency: '',
  202. completeTypes: ['checkin'],
  203. needReview: 0,
  204. reviewType: 'parent',
  205. earliestStart: '',
  206. latestEnd: ''
  207. },
  208. categories: ['学习类', '生活类', '运动类', '小游戏类', '其他'],
  209. completeTypes: [
  210. { value: 'checkin', label: '打卡' },
  211. { value: 'text', label: '文本' },
  212. { value: 'audio', label: '语音' },
  213. { value: 'image', label: '图片' },
  214. { value: 'video', label: '视频' }
  215. ],
  216. frequencies: ['每天', '每周', '每月'],
  217. reviewTypes: [
  218. { value: 'creator', label: '创建人' },
  219. { value: 'parent', label: '家长' },
  220. { value: 'teacher', label: '成长规划师' },
  221. { value: 'ai', label: 'AI自动' }
  222. ]
  223. }
  224. },
  225. onShow() {
  226. // 规划师角色跳转到家庭管理页
  227. const role = uni.getStorageSync('currentRole') || uni.getStorageSync('role') || 'parent'
  228. if (role === 'teacher') {
  229. uni.redirectTo({ url: '/pages/teacher/families' })
  230. return
  231. }
  232. // 加载任务数据
  233. this.loadParentTasks()
  234. },
  235. methods: {
  236. async loadParentTasks() {
  237. try {
  238. const currentUserId = uni.getStorageSync('userId')
  239. const res = await getTodayParentTasks()
  240. this.tasks = (res.data || []).slice(0, 5)
  241. } catch (e) {
  242. console.error('加载任务失败', e)
  243. }
  244. },
  245. async loadChildren() {
  246. try {
  247. const res = await getChildren()
  248. this.children = res.data || []
  249. // 默认选中第一个孩子
  250. if (this.children.length > 0) {
  251. this.newTask.memberIds = [this.children[0].id]
  252. }
  253. } catch (e) {
  254. console.error('加载孩子失败', e)
  255. }
  256. },
  257. // 加载家长任务(分配给家长的任务)
  258. async loadParentTasks() {
  259. try {
  260. const res = await getTodayParentTasks()
  261. this.tasks = res.data || []
  262. } catch (e) {
  263. console.error('加载家长任务失败', e)
  264. }
  265. },
  266. async loadTasks() {
  267. try {
  268. const childrenRes = await getChildren()
  269. const children = childrenRes.data
  270. if (children && children.length > 0) {
  271. this.currentChildId = children[0].id
  272. const res = await getTodayTasks(this.currentChildId)
  273. this.tasks = res.data || []
  274. }
  275. } catch (e) {
  276. console.error('加载任务失败', e)
  277. }
  278. },
  279. // 完成任务(孩子模式)
  280. async completeTask(taskId) {
  281. try {
  282. const res = await completeTaskApi(taskId, this.currentChildId, '')
  283. uni.showToast({
  284. title: `获得 ${res.data.pointsEarned} 积分`,
  285. icon: 'success'
  286. })
  287. this.loadTasks()
  288. } catch (e) {
  289. console.error('完成任务失败', e)
  290. }
  291. },
  292. // 完成任务(家长模式)
  293. async completeParentTask(taskId) {
  294. try {
  295. const res = await completeParentTaskApi(taskId)
  296. uni.showToast({
  297. title: `获得 ${res.data.pointsEarned} 积分`,
  298. icon: 'success'
  299. })
  300. this.loadParentTasks()
  301. } catch (e) {
  302. console.error('完成任务失败', e)
  303. }
  304. },
  305. // 模板选择
  306. onTemplateChange(e) {
  307. if (e.detail.value >= 0) {
  308. this.selectedTemplate = this.taskTemplates[e.detail.value]
  309. this.applyTemplate(this.selectedTemplate)
  310. }
  311. },
  312. applyTemplate(template) {
  313. this.newTask.title = template.title || ''
  314. this.newTask.description = template.description || ''
  315. this.newTask.category = template.category || ''
  316. this.newTask.points = template.points || 2
  317. this.newTask.duration = template.duration || ''
  318. this.newTask.completeTypes = template.completeTypes ? template.completeTypes.split(',') : ['checkin']
  319. this.newTask.needReview = template.needReview || 0
  320. this.newTask.reviewType = template.reviewType || 'parent'
  321. },
  322. // 类型选择
  323. onCategoryChange(e) {
  324. this.newTask.category = this.categories[e.detail.value]
  325. },
  326. // 完成方式选择
  327. onCompleteTypeChange(e) {
  328. this.newTask.completeTypes = e.detail.value
  329. },
  330. // 孩子多选
  331. onChildSelectChange(e) {
  332. this.newTask.memberIds = e.detail.value.map(id => parseInt(id))
  333. },
  334. // 任务性质
  335. onTaskTypeChange(e) {
  336. this.newTask.taskType = e.detail.value
  337. },
  338. // 频率选择
  339. onFrequencyChange(e) {
  340. const freq = this.frequencies[e.detail.value]
  341. this.newTask.frequency = freq === '每天' ? 'daily' : (freq === '每周' ? 'weekly' : 'monthly')
  342. },
  343. // 是否需要审核
  344. onNeedReviewChange(e) {
  345. this.newTask.needReview = e.detail.value ? 1 : 0
  346. },
  347. // 审核人选择
  348. onReviewTypeChange(e) {
  349. this.newTask.reviewType = this.reviewTypes[e.detail.value].value
  350. },
  351. getReviewTypeLabel(value) {
  352. const found = this.reviewTypes.find(r => r.value === value)
  353. return found ? found.label : '请选择审核人'
  354. },
  355. // 时间选择
  356. onEarliestStartChange(e) {
  357. this.newTask.earliestStart = e.detail.value
  358. },
  359. onLatestEndChange(e) {
  360. this.newTask.latestEnd = e.detail.value
  361. },
  362. async createTask() {
  363. // 验证必填
  364. if (!this.newTask.title) {
  365. uni.showToast({ title: '请输入任务标题', icon: 'none' })
  366. return
  367. }
  368. if (!this.newTask.category) {
  369. uni.showToast({ title: '请选择类型', icon: 'none' })
  370. return
  371. }
  372. if (!this.newTask.completeTypes || this.newTask.completeTypes.length === 0) {
  373. uni.showToast({ title: '请选择完成方式', icon: 'none' })
  374. return
  375. }
  376. if (!this.newTask.memberIds || this.newTask.memberIds.length === 0) {
  377. uni.showToast({ title: '请选择完成孩子', icon: 'none' })
  378. return
  379. }
  380. try {
  381. await createTaskApi({
  382. title: this.newTask.title,
  383. description: this.newTask.description,
  384. category: this.newTask.category,
  385. points: parseInt(this.newTask.points) || 2,
  386. duration: parseInt(this.newTask.duration) || null,
  387. memberIds: this.newTask.memberIds,
  388. taskType: this.newTask.taskType,
  389. frequency: this.newTask.frequency,
  390. maxFrequency: parseInt(this.newTask.maxFrequency) || null,
  391. completeTypes: this.newTask.completeTypes,
  392. needReview: this.newTask.needReview,
  393. reviewType: this.newTask.reviewType,
  394. earliestStart: this.newTask.earliestStart || null,
  395. latestEnd: this.newTask.latestEnd || null
  396. })
  397. uni.showToast({ title: '创建成功', icon: 'success' })
  398. this.showAddModal = false
  399. this.resetNewTask()
  400. this.loadTasks()
  401. } catch (e) {
  402. console.error('创建任务失败', e)
  403. uni.showToast({ title: '创建失败', icon: 'none' })
  404. }
  405. },
  406. resetNewTask() {
  407. this.newTask = {
  408. title: '',
  409. description: '',
  410. category: '',
  411. points: 2,
  412. duration: '',
  413. memberIds: this.children.length > 0 ? [this.children[0].id] : [],
  414. taskType: 'onetime',
  415. frequency: '',
  416. maxFrequency: '',
  417. completeTypes: ['checkin'],
  418. needReview: 0,
  419. reviewType: 'parent',
  420. earliestStart: '',
  421. latestEnd: ''
  422. }
  423. this.selectedTemplate = null
  424. },
  425. formatTime(dateStr) {
  426. if (!dateStr) return ''
  427. const date = parseDate(dateStr)
  428. if (!date) return ''
  429. return `${date.getHours()}:${String(date.getMinutes()).padStart(2, '0')}`
  430. },
  431. enterBatchMode() {
  432. this.batchMode = true
  433. this.selectedTasks = []
  434. },
  435. exitBatchMode() {
  436. this.batchMode = false
  437. this.selectedTasks = []
  438. },
  439. toggleTaskSelect(taskId) {
  440. const index = this.selectedTasks.indexOf(taskId)
  441. if (index > -1) {
  442. this.selectedTasks.splice(index, 1)
  443. } else {
  444. this.selectedTasks.push(taskId)
  445. }
  446. },
  447. toggleSelectAll() {
  448. if (this.isAllSelected) {
  449. this.selectedTasks = []
  450. } else {
  451. this.selectedTasks = this.tasks.filter(t => t.status === 'pending').map(t => t.id)
  452. }
  453. },
  454. async batchComplete() {
  455. if (this.selectedTasks.length === 0) {
  456. uni.showToast({ title: '请选择任务', icon: 'none' })
  457. return
  458. }
  459. try {
  460. await batchCompleteTasks(this.selectedTasks)
  461. uni.showToast({ title: '批量完成成功', icon: 'success' })
  462. this.exitBatchMode()
  463. this.loadParentTasks()
  464. } catch (e) {
  465. console.error('批量完成失败', e)
  466. uni.showToast({ title: '批量完成失败', icon: 'none' })
  467. }
  468. },
  469. async batchDelete() {
  470. if (this.selectedTasks.length === 0) {
  471. uni.showToast({ title: '请选择任务', icon: 'none' })
  472. return
  473. }
  474. uni.showModal({
  475. title: '确认删除',
  476. content: `确定要删除选中的 ${this.selectedTasks.length} 个任务吗?`,
  477. success: async (res) => {
  478. if (res.confirm) {
  479. try {
  480. await batchDeleteTasks(this.selectedTasks)
  481. uni.showToast({ title: '批量删除成功', icon: 'success' })
  482. this.exitBatchMode()
  483. this.loadParentTasks()
  484. } catch (e) {
  485. console.error('批量删除失败', e)
  486. uni.showToast({ title: '批量删除失败', icon: 'none' })
  487. }
  488. }
  489. }
  490. })
  491. }
  492. },
  493. computed: {
  494. isAllSelected() {
  495. if (this.selectedTasks.length === 0) return false
  496. const pendingTasks = this.tasks.filter(t => t.status === 'pending')
  497. return pendingTasks.length > 0 && pendingTasks.every(t => this.selectedTasks.includes(t.id))
  498. }
  499. }
  500. }
  501. </script>
  502. <style scoped>
  503. .container {
  504. padding: 30rpx;
  505. padding-bottom: 120rpx;
  506. }
  507. .header-bar {
  508. display: flex;
  509. justify-content: space-between;
  510. align-items: center;
  511. margin-bottom: 30rpx;
  512. }
  513. .header-title {
  514. font-size: 32rpx;
  515. font-weight: bold;
  516. color: #333;
  517. }
  518. .btn-batch {
  519. background: #F97316;
  520. color: #fff;
  521. font-size: 24rpx;
  522. padding: 10rpx 30rpx;
  523. border-radius: 30rpx;
  524. }
  525. .batch-bar {
  526. display: flex;
  527. align-items: center;
  528. background: #f5f5f5;
  529. padding: 20rpx 30rpx;
  530. border-radius: 16rpx;
  531. margin-bottom: 30rpx;
  532. }
  533. .batch-label {
  534. font-size: 28rpx;
  535. color: #333;
  536. margin-left: 10rpx;
  537. margin-right: auto;
  538. }
  539. .batch-actions {
  540. display: flex;
  541. gap: 20rpx;
  542. }
  543. .batch-btn {
  544. font-size: 24rpx;
  545. padding: 10rpx 30rpx;
  546. border-radius: 30rpx;
  547. background: #F97316;
  548. color: #fff;
  549. }
  550. .batch-btn.complete {
  551. background: #52C41A;
  552. }
  553. .batch-btn.delete {
  554. background: #FF4D4F;
  555. }
  556. .batch-btn[disabled] {
  557. background: #ccc;
  558. }
  559. .batch-exit {
  560. font-size: 24rpx;
  561. color: #999;
  562. margin-left: 20rpx;
  563. }
  564. .task-item {
  565. background: #fff;
  566. border-radius: 16rpx;
  567. padding: 30rpx;
  568. margin-bottom: 20rpx;
  569. display: flex;
  570. justify-content: space-between;
  571. align-items: center;
  572. }
  573. .task-item.selected {
  574. background: #FFF1F0;
  575. border: 2rpx solid #F97316;
  576. }
  577. .task-checkbox {
  578. margin-right: 20rpx;
  579. }
  580. .task-title {
  581. background: #fff;
  582. border-radius: 16rpx;
  583. padding: 30rpx;
  584. margin-bottom: 20rpx;
  585. display: flex;
  586. justify-content: space-between;
  587. align-items: center;
  588. }
  589. .task-item.completed {
  590. opacity: 0.6;
  591. }
  592. .task-title {
  593. font-size: 30rpx;
  594. color: #333;
  595. margin-bottom: 10rpx;
  596. }
  597. .task-meta {
  598. display: flex;
  599. gap: 20rpx;
  600. }
  601. .points {
  602. color: #F97316;
  603. font-size: 24rpx;
  604. }
  605. .deadline {
  606. color: #999;
  607. font-size: 24rpx;
  608. }
  609. .btn-complete {
  610. background: #F97316;
  611. color: #fff;
  612. font-size: 26rpx;
  613. padding: 10rpx 30rpx;
  614. border-radius: 30rpx;
  615. }
  616. .completed-badge {
  617. color: #52C41A;
  618. font-size: 26rpx;
  619. }
  620. .minigame-badge {
  621. font-size: 28rpx;
  622. margin-left: 10rpx;
  623. }
  624. .add-btn {
  625. position: fixed;
  626. bottom: 30rpx;
  627. left: 30rpx;
  628. right: 30rpx;
  629. }
  630. .empty {
  631. text-align: center;
  632. color: #999;
  633. padding: 100rpx;
  634. }
  635. .modal-mask {
  636. position: fixed;
  637. top: 0;
  638. left: 0;
  639. right: 0;
  640. bottom: 0;
  641. background: rgba(0, 0, 0, 0.5);
  642. display: flex;
  643. align-items: center;
  644. justify-content: center;
  645. }
  646. .modal {
  647. background: #fff;
  648. border-radius: 20rpx;
  649. padding: 40rpx;
  650. width: 80%;
  651. max-height: 80vh;
  652. overflow-y: auto;
  653. }
  654. .modal-large {
  655. width: 90%;
  656. }
  657. .modal-title {
  658. font-size: 32rpx;
  659. font-weight: bold;
  660. margin-bottom: 30rpx;
  661. text-align: center;
  662. }
  663. .form-item {
  664. margin-bottom: 20rpx;
  665. }
  666. .form-label {
  667. font-size: 28rpx;
  668. color: #333;
  669. margin-bottom: 10rpx;
  670. }
  671. .form-label .required {
  672. color: #F97316;
  673. }
  674. .form-row {
  675. display: flex;
  676. gap: 20rpx;
  677. }
  678. .form-item.half {
  679. flex: 1;
  680. }
  681. .form-item input, .picker, .textarea {
  682. border: 1rpx solid #ddd;
  683. border-radius: 10rpx;
  684. padding: 20rpx;
  685. font-size: 28rpx;
  686. width: 100%;
  687. box-sizing: border-box;
  688. }
  689. .textarea {
  690. min-height: 100rpx;
  691. }
  692. .form-item checkbox-group {
  693. display: flex;
  694. flex-wrap: wrap;
  695. gap: 20rpx;
  696. }
  697. .form-item label {
  698. display: flex;
  699. align-items: center;
  700. gap: 10rpx;
  701. font-size: 28rpx;
  702. }
  703. .modal-btns {
  704. display: flex;
  705. gap: 20rpx;
  706. margin-top: 30rpx;
  707. }
  708. .modal-btns button {
  709. flex: 1;
  710. }
  711. </style>