import { defineComponent, reactive } from 'vue'; import styles from './index.module.less'; import { NAvatar, NButton, NCheckbox, NInput, NModal, NSpace, useMessage } from 'naive-ui'; import commentBg from '../images/common-bg.png'; import commentTop from '../images/common-top.png'; import iconClose from '../images/icon-close-line.png'; import defultHeade from '@/components/layout/images/teacherIcon.png'; import { api_setComment } from '../../api'; import dayjs from 'dayjs'; import { storage } from '/src/utils/storage'; export default defineComponent({ name: 'commit-work', props: { /** 评语内容 */ comment: { type: String, default: '' }, workInfo: { type: Object, default: () => ({}) } }, emits: ['close', 'confrim'], setup(props, { emit }) { const message = useMessage(); const state = reactive({ removeVisiable1: false, comment: props.comment, btnLoading: false, commentRemind: true }); const onSubmit = async () => { const isCommentRemind = storage.get('isCommentRemind'); if (isCommentRemind != 1) { state.removeVisiable1 = true; return; } if (!state.comment) { message.error('请输入评语'); return; } state.btnLoading = true; try { await api_setComment({ comment: state.comment, id: props.workInfo.studentLessonTrainingId }); message.success('点评成功'); emit('confrim'); } catch { // } state.btnLoading = false; }; const onSure = () => { if (state.commentRemind) { storage.set('isCommentRemind', 1); } state.removeVisiable1 = false; onSubmit(); }; return () => (
提交时间:{dayjs(props.workInfo.submitTime).format('YYYY-MM-DD')}
评语提交后不可修改或删除,请确认是否提交