| | |
| | | <div |
| | | class="activity-content" |
| | | v-html="activityInfo.activityContent || '无内容'" |
| | | ref="“activityHTMLContent" |
| | | ></div> |
| | | </div> |
| | | </Col> |
| | |
| | | addActivity, |
| | | editActivity, |
| | | delActivityById, |
| | | delActivityBatch, |
| | | activityChangeStatus, |
| | | activityChangeRecommend, |
| | | activityMembersPage, |
| | | auditActivity |
| | | } from "@/api/activity.js" |
| | | import Editor from '@/components/editor/index.vue' |
| | | import { uploadFileByLmk, delByKey } from "@/api/common.js" |
| | | |
| | | import { quillEditor } from 'vue-quill-editor' |
| | | import Delta from 'quill-delta' |
| | | import 'quill/dist/quill.core.css'; |
| | | import 'quill/dist/quill.snow.css'; |
| | | import 'quill/dist/quill.bubble.css'; |
| | |
| | | |
| | | export default { |
| | | name: "ActivityManagement", |
| | | components: {Editor, quillEditor}, |
| | | components: { quillEditor}, |
| | | data() { |
| | | return { |
| | | auditForm: { |
| | |
| | | } |
| | | }, |
| | | { |
| | | title: '审核', |
| | | title: '审核状态', |
| | | key: 'auditStatus', |
| | | width: 100, |
| | | align: 'center', |
| | | render: (h, params) => { |
| | | const status = params.row.auditStatus; |
| | | let tagText, tagColor; |
| | | |
| | | // 根据状态设置文案和颜色 |
| | | switch (status) { |
| | | case 0: |
| | | tagText = '审核中'; |
| | | tagColor = 'orange'; // 橙色表示进行中 |
| | | break; |
| | | case 1: |
| | | tagText = '已通过'; |
| | | tagColor = 'green'; // 绿色表示通过 |
| | | break; |
| | | case 2: |
| | | tagText = '未通过'; |
| | | tagColor = 'red'; // 红色表示拒绝 |
| | | break; |
| | | default: |
| | | tagText = '未知状态'; |
| | | tagColor = 'default'; // 默认灰色 |
| | | } |
| | | |
| | | return h('Tag', { |
| | | props: { |
| | | color: params.row.auditStatus === 0 ? 'default' : 'green' |
| | | } |
| | | }, params.row.auditStatus === 0 ? '未审核' : '已审核') |
| | | } |
| | | color: tagColor, |
| | | }, |
| | | }, tagText); |
| | | }, |
| | | }, |
| | | { |
| | | title: '状态', |
| | |
| | | color: currentStatus.color |
| | | } |
| | | }, currentStatus.text); |
| | | } |
| | | }, |
| | | { |
| | | title: '活动报名时间段', |
| | | key: 'activityReportTimeRange', |
| | | width: 300, |
| | | render: (h, params) => { |
| | | return h('div', [ |
| | | h('div', `开始: ${this.formatDate(params.row.reportStartTime)}`), |
| | | h('div', `结束: ${this.formatDate(params.row.reportEndTime)}`) |
| | | ]) |
| | | } |
| | | }, |
| | | { |
| | |
| | | render: (h, params) => { |
| | | return h('Tag', { |
| | | props: { |
| | | color: params.row.disabled ? 'red' : 'green' |
| | | color: params.row.disabled ? 'green' : 'red' //true 正常 false被禁用 |
| | | } |
| | | }, params.row.disabled ? '禁用' : '正常') |
| | | }, params.row.disabled ? '正常' : '禁用') |
| | | } |
| | | } |
| | | ], |
| | |
| | | |
| | | // 失去焦点 |
| | | onEditorBlur(editor) { |
| | | |
| | | }, |
| | | |
| | | // 获得焦点 |
| | |
| | | |
| | | |
| | | if (fileType === 'video') { |
| | | console.log("插入") |
| | | this.Quill.insertEmbed(index, 'video', { |
| | | url:url, |
| | | controls:'controls', |
| | |
| | | this.$Message.warning('不支持的文件类型'); |
| | | return; |
| | | } |
| | | console.log(this.activityFrom.activityContent) |
| | | this.Quill.setSelection(index + 1); |
| | | console.log(this.content) |
| | | this.$Message.success('上传成功') |
| | | }else{ |
| | | this.$Message.error(res.msg) |
| | | } |
| | | }).catch(() => { |
| | | this.submitLoading = false |
| | |
| | | this.$Message.success(res.msg); |
| | | this.getActivityList(); |
| | | this.closeAuditModel(); |
| | | }else{ |
| | | this.$Message.error(res.msg) |
| | | } |
| | | }) |
| | | } |
| | |
| | | this.infoModelShow = true |
| | | this.activityInfo = row |
| | | this.activityInfo.activityContent = this.escapeStringHTML(this.activityInfo.activityContent); |
| | | this.$nextTick(() => { |
| | | this.processVideos(); |
| | | }); |
| | | |
| | | }, |
| | | processVideos() { |
| | | const videos = this.$el.querySelectorAll('video'); |
| | | videos.forEach(video => { |
| | | // 确保视频元素有必要的属性 |
| | | video.setAttribute('controls', ''); |
| | | video.setAttribute('playsinline', ''); // 针对移动端 |
| | | video.load(); |
| | | }); |
| | | }, |
| | | // 获取富文本编辑器的内容 |
| | | // 初始化数据 |
| | |
| | | statusLoading: false |
| | | })) |
| | | this.total = res.total |
| | | }else{ |
| | | this.$Message.error(res.msg) |
| | | } |
| | | }).catch(() => { |
| | | this.loading = false |
| | |
| | | this.activityFrom.coverType = this.coverType === '输入文字封面' ? 'text' : |
| | | this.file ? this.getFileCategory(this.file.type) : |
| | | this.activityFrom.coverType |
| | | //判断文字类型有点问题 |
| | | |
| | | this.$refs.form.validate(valid => { |
| | | if (valid) { |
| | | this.submitLoading = true |
| | |
| | | this.$Message.success(res.msg) |
| | | this.modelClose() |
| | | this.getActivityList() |
| | | }else{ |
| | | this.$Message.error(res.msg) |
| | | } |
| | | }).catch(() => { |
| | | this.submitLoading = false |
| | |
| | | title: '确认删除', |
| | | content: `确定要删除活动 "${row.activityName}" 吗?`, |
| | | onOk: () => { |
| | | //TODO 先判断活动是否发布,发布则需要先下架 |
| | | |
| | | delActivityById(row.id).then(res => { |
| | | if (res.code === 200) { |
| | | this.$Message.success(res.msg) |
| | | this.getActivityList() |
| | | }else{ |
| | | this.$Message.error(res.msg) |
| | | } |
| | | }) |
| | | } |
| | |
| | | |
| | | // 批量删除 |
| | | delBatch() { |
| | | //TODO 先判断活动是否发布,发布则需要先下架 |
| | | if (this.selectCount === 0) { |
| | | this.$Message.warning('请至少选择一条数据') |
| | | return |
| | |
| | | title: '确认删除', |
| | | content: `确定要删除选中的 ${this.selectCount} 条数据吗?`, |
| | | onOk: () => { |
| | | delActivityBatch({ids: this.selectList}).then(res => { |
| | | delActivityBatch(this.selectList).then(res => { |
| | | if (res.code === 200) { |
| | | this.$Message.success(res.msg) |
| | | this.selectList = [] |
| | |
| | | if (res.code === 200) { |
| | | this.$Message.success(res.msg) |
| | | row.recommend = recommend |
| | | }else{ |
| | | this.$Message.error(res.msg) |
| | | } |
| | | }).catch(() => { |
| | | row.recommendLoading = false |
| | |
| | | if (res.code === 200) { |
| | | this.$Message.success(res.msg) |
| | | row.publish = publish |
| | | }else{ |
| | | this.$Message.error(res.msg) |
| | | } |
| | | }).catch(() => { |
| | | row.statusLoading = false |
| | |
| | | if (res.code === 200) { |
| | | this.membersList = res.data |
| | | this.memberTotal = res.total |
| | | }else{ |
| | | this.$Message.error(res.msg) |
| | | } |
| | | }).catch(() => { |
| | | this.membersLoading = false |
| | |
| | | if (res.code === 200) { |
| | | this.activityFrom.cover = res.data.fileKey |
| | | this.$Message.success('上传成功') |
| | | }else{ |
| | | this.$Message.error(res.msg) |
| | | } |
| | | }).catch(() => { |
| | | this.submitLoading = false |
| | |
| | | if (res.code === 200) { |
| | | this.file = null |
| | | this.activityFrom.cover = '' |
| | | }else{ |
| | | this.$Message.error(res.msg) |
| | | } |
| | | }) |
| | | }, |