From b09f0f1d9d92cc941e1bcf42c4b58a59e434d872 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 15 Oct 2019 17:32:01 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=80=E8=AF=B7=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/members/studentsList.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index ffdb9ed59..a63509c59 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -320,6 +320,9 @@ class studentsList extends Component{ isAdmin && on('updateNavSuccess', this.updateNavSuccess) } componentWillUnmount() { + if (this.clipboard) { + this.clipboard.destroy() + } const isAdmin = this.props.isAdmin() if (isAdmin) { off('addStudentSuccess', this.addStudentSuccessListener) @@ -420,12 +423,14 @@ class studentsList extends Component{ invite_code: result.data.invite_code, isSpin:false }, () => { - if (!this.clipboard) { - const clipboard = new ClipboardJS('.copybtn'); - clipboard.on('success', (e) => { - this.props.showNotification('复制成功') - }); - this.clipboard = clipboard + if (course_group_id) { + if (!this.clipboard) { + const clipboard = new ClipboardJS('.copybtn'); + clipboard.on('success', (e) => { + this.props.showNotification('复制成功') + }); + this.clipboard = clipboard + } } }) }