|
|
@@ -21,6 +21,9 @@
|
|
|
<el-button v-if="isTeacher" size="small" type="primary" @click.stop="$emit('switch')">
|
|
|
设为{{ isPublic ? "私有" : "公共" }}
|
|
|
</el-button>
|
|
|
+ <el-button v-if="isTeacher" size="small" type="success" plain :loading="syncingMembers" @click.stop="handleSyncMembers">
|
|
|
+ 同步成员
|
|
|
+ </el-button>
|
|
|
<el-button v-if="isPublic&&!isTeacher" size="small" type="primary" @click.stop="$emit('fork')">
|
|
|
Fork
|
|
|
</el-button>
|
|
|
@@ -65,6 +68,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
members: [],
|
|
|
+ syncingMembers: false,
|
|
|
};
|
|
|
},
|
|
|
computed:{
|
|
|
@@ -82,6 +86,31 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ async refreshMembers() {
|
|
|
+ const res = (await this.$apis.findProjectMembers(this.project.id)).data;
|
|
|
+ if (!res.code) {
|
|
|
+ this.members = res.data;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ async handleSyncMembers() {
|
|
|
+ if (this.syncingMembers) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.syncingMembers = true;
|
|
|
+ try {
|
|
|
+ const res = (await this.$apis.syncProjectMembers(this.project.id)).data;
|
|
|
+ if (res.code) {
|
|
|
+ ElMessage.error(res.message);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ await this.refreshMembers();
|
|
|
+ ElMessage.success("同步成员成功!");
|
|
|
+ } finally {
|
|
|
+ this.syncingMembers = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
async handleDeleteFork() {
|
|
|
try {
|
|
|
await ElMessageBox.confirm(
|