Commit d543b54a by yanju

Merge branch 'xue' into 'master'

项目修改页面

See merge request pigbigbig/beyond-clouds-front!49
parents 63786dcd fb0da700
......@@ -104,6 +104,7 @@
>
<select-card
selectType="2"
v-if="false"
:class-list="classList"
@handleClass="(val) => this.childClass = val.tag"
placeholder="请选择项目子类型"></select-card>
......@@ -138,7 +139,7 @@
</p>
<div class="footer__right">
<p>已自动存为草稿</p>
<button class="preview">预览</button>
<button class="preview" >预览</button>
<button class="submit" @click="postProject">提交</button>
</div>
</div>
......@@ -155,6 +156,34 @@ import SelectCard from "../../../components/pc/select/selectCard";
import config from '../../../action/config';
export default {
async asyncData({$axios, query}) {
if (query.hasOwnProperty('id')) {
const response = await $axios.$get(config.api.get.Project.detail + query.id);
console.log(response);
return {
response:response,
}
}
},
mounted() {
if (this.$route.query.id) {
this.imgSrc = this.response.data.cover,
this.language = this.response.data.devLang,
this.$refs.language.$refs.select.value = this.response.data.devLang,
this.docLink = this.response.data.docLink,
this.homeLink = this.response.data.homeLink,
this.content = this.response.data.devLang,//内容
this.license = this.response.data.license,
this.$refs.license.$refs.select.value = this.response.data.license,
this.projectDescription = this.response.data.projectDescription,
this.name = this.response.data.projectName;
this.projectClass = this.response.data.projectType,
this.$refs.projectClass.$refs.select.value = this.response.data.projectType,
this.system = this.response.data.runtimePlatform,
this.$refs.system.$refs.select.value = this.response.data.runtimePlatform,
this.addressLink = this.response.data.sourceLink
}
},
components: {SelectCard, CardContainer},
data() {
return {
......@@ -356,35 +385,67 @@ export default {
}
}
},
//get修改信息
dataGetProject(id) {
this.$axios.$get(config.api.get.Project.list+id,).then((response)=>{
this.projectList=response.data.dataList;
// get修改信息
/* dataGetProject() {
this.$axios.$get(config.api.get.Project.detail+136,).then((response)=>{
//this.projectList=response.data.dataList;
//console.log(response);
this.imgSrc=response.data.cover,
this.language=response.data.devLang,
this.$refs.language.$refs.select.value=response.data.devLang,
this.docLink=response.data.docLink,
this.homeLink=response.data.homeLink,
this.content=response.data.devLang,//内容
this.license=response.data.license,
this.$refs.license.$refs.select.value=response.data.license,
this.projectDescription=response.data.projectDescription,
//this.projectDetail=response.data.content,
this.name=response.data.projectName;
// console.log(this.name)
this.projectClass=response.data.projectClass,
this.$refs.projectClass.$refs.select.value=response.data.projectClass,
this.system=response.data.runtimePlatform,
this.$refs.system.$refs.select.value=response.data.runtimePlatform,
this.addressLink=response.data.sourceLink
})
},
},*/
// 发布项目
async postProject() {
let projectRes;
if (this.checkProject()) {
if (this.$route.query.id) {
// 修改执行这个接口
projectRes = await this.$axios.$put(config.api.put.Project.revise, {
"author": this.author,
"categoryId": 1,//项目类型
"cover": this.imgSrc,//封面
"devLang": this.language,//开发语言
"docLink": this.docLink,//开发链接
"homeLink": this.homeLink,//主页链接
"license": this.license,//协议
"projectDescription": this.projectDescription,//项目描述
"projectDetail": this.projectDetail,//详情
"projectName": this.name,//项目名称
"projectType": this.projectClass,//项目类型
"runtimePlatform": this.system,//项目运行平台
"sourceLink": this.addressLink//项目源码地址
projectRes = await this.$axios.$put(config.api.put.Project.revise + this.$route.query.id, {
author: this.author,
categoryId: 1,
cover: this.imgSrc,
devLang: this.language,
docLink: this.docLink,
homeLink: this.homeLink,
content: this.content,//内容
//contentHtml: this.blogDetail,// 内容的html
license: this.license,
projectDescription: this.projectDescription,
contentHtml: this.projectDetail,
projectName: this.name,
projectType: this.projectClass,
runtimePlatform: this.system,
sourceLink: this.addressLink
})
.then((response) => {
if (response.code === 0) {
this.$message({
message: "修改项目成功",
type: 'success'
});
this.$router.push('/personal-center/home/project')
} else {
this.$message({
message: response.msg,
type: 'warning'
})
}
})
} else {
projectRes = await this.$axios.$post(config.api.post.Project.release, {
author: this.author,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment