|
@@ -1,15 +1,73 @@
|
|
|
-import { defineComponent } from 'vue';
|
|
|
+import { defineComponent, reactive } from 'vue';
|
|
|
import styles from './index.module.less';
|
|
|
-import { NAvatar, NButton, NInput, NSpace } from 'naive-ui';
|
|
|
+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',
|
|
|
- emits: ['close'],
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ 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 () => (
|
|
|
<div class={styles.commonWork}>
|
|
|
<img src={commentTop} class={styles.dingPng} alt="" />
|
|
@@ -27,8 +85,10 @@ export default defineComponent({
|
|
|
<div class={styles.header}>
|
|
|
<NAvatar class={styles.navatar} round src={defultHeade} />
|
|
|
<div class={styles.userInfo}>
|
|
|
- <h3>胡小小</h3>
|
|
|
- <p>提交时间:2024-01-23</p>
|
|
|
+ <h3>{props.workInfo.studentName}</h3>
|
|
|
+ <p>
|
|
|
+ 提交时间:{dayjs(props.workInfo.submitTime).format('YYYY-MM-DD')}
|
|
|
+ </p>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -39,17 +99,52 @@ export default defineComponent({
|
|
|
maxlength={500}
|
|
|
showCount
|
|
|
autosize={false}
|
|
|
+ disabled={props.workInfo.isLook}
|
|
|
+ v-model:value={state.comment}
|
|
|
placeholder="请输入评语…"
|
|
|
/>
|
|
|
|
|
|
- <NSpace style={{ padding: '25px 0 0 0' }} justify="center">
|
|
|
- <NButton round type="default" onClick={() => emit('close')}>
|
|
|
- 取消
|
|
|
- </NButton>
|
|
|
- <NButton class={styles.submitAppBtn} round type="primary">
|
|
|
- 确定
|
|
|
- </NButton>
|
|
|
- </NSpace>
|
|
|
+ {!props.workInfo.isLook && (
|
|
|
+ <NSpace style={{ padding: '25px 0 0 0' }} justify="center">
|
|
|
+ <NButton round type="default" onClick={() => emit('close')}>
|
|
|
+ 取消
|
|
|
+ </NButton>
|
|
|
+ <NButton
|
|
|
+ class={styles.submitAppBtn}
|
|
|
+ round
|
|
|
+ type="primary"
|
|
|
+ loading={state.btnLoading}
|
|
|
+ onClick={onSubmit}>
|
|
|
+ 确定
|
|
|
+ </NButton>
|
|
|
+ </NSpace>
|
|
|
+ )}
|
|
|
+
|
|
|
+ <NModal
|
|
|
+ v-model:show={state.removeVisiable1}
|
|
|
+ preset="card"
|
|
|
+ class={['modalTitle', styles.removeVisiable1]}
|
|
|
+ title={'提交评语'}>
|
|
|
+ <div class={styles.studentRemove}>
|
|
|
+ <p>
|
|
|
+ 评语提交后<span>不可修改或删除</span>,请确认是否提交
|
|
|
+ </p>
|
|
|
+ <div class={styles.selectBtn}>
|
|
|
+ <NCheckbox v-model:checked={state.commentRemind}>
|
|
|
+ 下次不在提醒
|
|
|
+ </NCheckbox>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <NSpace class={styles.btnGroupModal} justify="center">
|
|
|
+ <NButton round onClick={() => (state.removeVisiable1 = false)}>
|
|
|
+ 取消
|
|
|
+ </NButton>
|
|
|
+ <NButton round type="primary" onClick={onSure}>
|
|
|
+ 确定
|
|
|
+ </NButton>
|
|
|
+ </NSpace>
|
|
|
+ </div>
|
|
|
+ </NModal>
|
|
|
</div>
|
|
|
);
|
|
|
}
|