2222 </v-chip >
2323 </template >
2424 </v-combobox >
25+ <span class =" form-item-title" >公共性</span >
26+ <span class =" text-describe" >将实例设置为私有,其他人将不会访问到你的实例。但每位用户最多只能有5个私有实例</span >
27+ <v-radio-group v-model =" form.ispublic" row mandatory >
28+ <v-radio label =" 公共" :value =" true" ></v-radio >
29+ <v-radio label =" 私有" :value =" false" ></v-radio >
30+ </v-radio-group >
2531 </v-form >
2632 </v-card-text >
2733 <v-card-actions style =" padding-bottom :20px " >
@@ -41,6 +47,7 @@ export default {
4147 form: {
4248 title: ' ' ,
4349 tags: [],
50+ ispublic: true ,
4451 },
4552 rules: {
4653 title: [(v ) => !! v || ' 请填写实例标题!' ],
@@ -60,10 +67,11 @@ export default {
6067 }
6168 },
6269 created () {
63- const { title , tags } = this .curInstanceDetail
70+ const { title , tags , ispublic } = this .curInstanceDetail
6471 this .form = {
6572 title,
6673 tags: tags ? tags .split (' ,' ) : [],
74+ ispublic,
6775 }
6876 },
6977 computed: {
@@ -83,19 +91,31 @@ export default {
8391 if (! this .validate ()) return void 0
8492 this .loading = true
8593 try {
86- const { title , tags } = this .form
87- const res = await this .$http .configWork ({
88- exampleId: this .curInstanceDetail .id ,
94+ const { title , tags , ispublic } = this .form
95+ const { id , ispublic: oldIspublic } = this .curInstanceDetail
96+ const reqObj = {
97+ exampleId: id,
8998 label: tags .toString (),
9099 exampleName: title,
91- })
100+ }
101+ if (ispublic !== oldIspublic) {
102+ reqObj .ispublic = ispublic
103+ }
104+ const res = await this .$http .configWork (reqObj)
92105 if (res .state ) {
93106 this .setVisibleDialogName (' ' )
94107 this .setCurInstanceDetail ({ title, tags: tags .toString () })
95- this .setVisibleDialogName (' ' )
96108 this .$message .success (' 实例设置修改成功!' )
97109 } else {
98- this .$message .success (' 实例设置修改失败!' )
110+ switch (res .msg ) {
111+ case 1 : {
112+ this .$message .error (' 私有实例已达上限!' )
113+ break
114+ }
115+ default : {
116+ this .$message .error (' 实例设置修改失败!' )
117+ }
118+ }
99119 }
100120 } catch (err) {
101121 console .log (err)
0 commit comments