|
|
@@ -11,17 +11,19 @@ |
|
|
|
v-model="editDataDialog" |
|
|
|
:deleteCallback="editDataFunc" |
|
|
|
:deleteLoading ="editDataListLoading" |
|
|
|
deleteParam = "ruleForm" |
|
|
|
@input="initForm" |
|
|
|
> |
|
|
|
<div slot="title"> |
|
|
|
|
|
|
|
</div> |
|
|
|
<div slot="content"> |
|
|
|
<el-form :label-position="top" label-width="80px"> |
|
|
|
<el-form-item label="简介"> |
|
|
|
<el-input v-model="desc" type="textarea" ></el-input> |
|
|
|
<el-form label-position="top" :model="info" :rules="rule" ref="ruleForm"> |
|
|
|
<el-form-item label="简介" prop="desc"> |
|
|
|
<el-input v-model="info.desc" type="textarea" :autosize="{minRows:2,maxRows:6}"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="主页"> |
|
|
|
<el-input v-model="index_web"></el-input> |
|
|
|
<el-form-item label="主页" prop="index_web" > |
|
|
|
<el-input v-model="info.index_web" placeholder="主页(eg: https://git.openi.org.cn)"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
</div> |
|
|
@@ -30,13 +32,9 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
/* eslint-disable eqeqeq */ |
|
|
|
// import Dropzone from 'dropzone/dist/dropzone.js'; |
|
|
|
// import 'dropzone/dist/dropzone.css' |
|
|
|
|
|
|
|
const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config; |
|
|
|
|
|
|
|
// const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config; |
|
|
|
// const CloudBrainType = 0; |
|
|
|
import editDialogCmpt from './basic/editDialog.vue'; |
|
|
|
|
|
|
|
|
|
|
@@ -49,10 +47,18 @@ export default { |
|
|
|
vmContext: this, |
|
|
|
editDataDialog: false, |
|
|
|
editDataListLoading: false, |
|
|
|
desc: '', |
|
|
|
index_web: '', |
|
|
|
|
|
|
|
|
|
|
|
url: '', |
|
|
|
info: { |
|
|
|
desc: '', |
|
|
|
index_web: '', |
|
|
|
repo_name_name: '', |
|
|
|
}, |
|
|
|
// rule1:[{min:3,max:5,message:'1',trigger:"blur"}], |
|
|
|
rule: { |
|
|
|
index_web: [ |
|
|
|
{required: false, pattern: /(^$)|(^(http|https):\/\/(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).*)|(^(http|https):\/\/[a-zA-Z0-9]+([_\-\.][a-zA-Z0-9]+)*\.[a-zA-Z]{2,10}(:[0-9]{1,10})?(\?.*)?(\/.*)?$)/,message:'请输入有效的URL',tigger:['change','blur']} |
|
|
|
] |
|
|
|
} |
|
|
|
}; |
|
|
|
}, |
|
|
|
methods: { |
|
|
@@ -61,24 +67,65 @@ export default { |
|
|
|
}, |
|
|
|
getDesc() { |
|
|
|
const el = $('span.description').text(); |
|
|
|
console.log(el); |
|
|
|
this.desc = el; |
|
|
|
console.log(this.desc); |
|
|
|
this.info.desc = el; |
|
|
|
}, |
|
|
|
getWeb() { |
|
|
|
const el = $('a.link').text(); |
|
|
|
console.log(el); |
|
|
|
this.index_web = el; |
|
|
|
console.log(this.index_web); |
|
|
|
this.info.index_web = el; |
|
|
|
}, |
|
|
|
getRepoName() { |
|
|
|
const el = this.url.split('/')[2]; |
|
|
|
this.info.repo_name = el; |
|
|
|
}, |
|
|
|
initForm(diaolog) { |
|
|
|
if (diaolog === false) { |
|
|
|
console.log("--watch----------") |
|
|
|
this.getRepoName(); |
|
|
|
this.getDesc(); |
|
|
|
this.getWeb(); |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
editDataFunc(formName) { |
|
|
|
this.$refs[formName].validate((valid)=>{ |
|
|
|
if (valid) { |
|
|
|
this.$axios({ |
|
|
|
method: 'post', |
|
|
|
url: this.url, |
|
|
|
header: {'content-type': 'application/x-www-form-urlencoded'}, |
|
|
|
data: this.qs.stringify({ |
|
|
|
_csrf: csrf, |
|
|
|
action: 'update', |
|
|
|
repo_name: this.info.repo_name, |
|
|
|
description: this.info.desc, |
|
|
|
website: this.info.index_web |
|
|
|
}) |
|
|
|
}).then((res) => { |
|
|
|
location.reload(); |
|
|
|
this.editDataDialog = false; |
|
|
|
}).catch((error) => { |
|
|
|
this.editDataDialog = false; |
|
|
|
}) |
|
|
|
} |
|
|
|
else { |
|
|
|
return false; |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
getUrl() { |
|
|
|
const url = `${window.location.pathname}/settings`; |
|
|
|
this.url = url; |
|
|
|
} |
|
|
|
}, |
|
|
|
editDataFunc() { |
|
|
|
console.log(1); |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
|
|
|
|
this.getUrl(); |
|
|
|
this.getRepoName(); |
|
|
|
this.getDesc(); |
|
|
|
this.getWeb(); |
|
|
|
}, |
|
|
|
created() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
@@ -93,4 +140,5 @@ export default { |
|
|
|
color: #8c92a4; |
|
|
|
background-color: transparent; |
|
|
|
} |
|
|
|
|
|
|
|
</style> |