|
|
@ -7,15 +7,15 @@ |
|
|
|
<span class="per_back">返回</span> |
|
|
|
<span class="per_back">返回</span> |
|
|
|
<span class="per_school" v-text="id ? '编辑更新日志' : '新增更新日志'"></span> |
|
|
|
<span class="per_school" v-text="id ? '编辑更新日志' : '新增更新日志'"></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div v-if="!isDetail"> |
|
|
|
<div> |
|
|
|
<el-button type="primary" round v-preventReClick @click="submit(0)">发布</el-button> |
|
|
|
<el-button type="primary" round v-preventReClick @click="submit(0)">发布</el-button> |
|
|
|
<el-button v-if="!postStatus" type="primary" round v-preventReClick @click="submit(1)">草稿</el-button> |
|
|
|
<el-button v-if="draft || !id" type="primary" round v-preventReClick @click="submit(1)">草稿</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-card> |
|
|
|
</el-card> |
|
|
|
|
|
|
|
|
|
|
|
<el-card shadow="hover"> |
|
|
|
<el-card shadow="hover"> |
|
|
|
<el-form ref="form" label-width="120px" :disabled="isDetail"> |
|
|
|
<el-form ref="form" label-width="120px"> |
|
|
|
<el-form-item label="版本标题"> |
|
|
|
<el-form-item label="版本标题"> |
|
|
|
<el-input placeholder="请输入版本标题" v-model="form.versionName" maxlength="30" style="width: 400px"></el-input> |
|
|
|
<el-input placeholder="请输入版本标题" v-model="form.versionName" maxlength="30" style="width: 400px"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
@ -42,26 +42,26 @@ |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="更新内容"> |
|
|
|
<el-form-item label="更新内容"> |
|
|
|
<ul class="contents"> |
|
|
|
<ul class="contents"> |
|
|
|
<li v-for="(item, i) in form.content" :key="i"> |
|
|
|
<li v-for="(item, i) in form.logContents" :key="i"> |
|
|
|
<div class="action"> |
|
|
|
<div class="action"> |
|
|
|
<el-select v-model="value" size="small" placeholder="请选择版本"> |
|
|
|
<el-select v-model="item.type" size="small" placeholder="请选择"> |
|
|
|
<el-option |
|
|
|
<el-option |
|
|
|
v-for="item in vers" |
|
|
|
v-for="item in funcList" |
|
|
|
:key="item.value" |
|
|
|
:key="item.id" |
|
|
|
:label="item.label" |
|
|
|
:label="item.name" |
|
|
|
:value="item.value"> |
|
|
|
:value="item.id"> |
|
|
|
</el-option> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-select> |
|
|
|
<div class="btns"> |
|
|
|
<div class="btns"> |
|
|
|
<i v-if="i === form.content.length - 1" class="el-icon-circle-plus-outline" @click="add"></i> |
|
|
|
<i v-if="i === form.logContents.length - 1" class="el-icon-circle-plus-outline" @click="add"></i> |
|
|
|
<i class="el-icon-delete" @click="del"></i> |
|
|
|
<i class="el-icon-delete" @click="del(i)"></i> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<el-input |
|
|
|
<el-input |
|
|
|
type="textarea" |
|
|
|
type="textarea" |
|
|
|
:rows="5" |
|
|
|
:rows="5" |
|
|
|
placeholder="请输入" |
|
|
|
placeholder="请输入" |
|
|
|
v-model="textarea"> |
|
|
|
v-model="item.content"> |
|
|
|
</el-input> |
|
|
|
</el-input> |
|
|
|
</li> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</ul> |
|
|
@ -76,15 +76,38 @@ export default { |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
id : this.$route.query.id, |
|
|
|
id : this.$route.query.id, |
|
|
|
|
|
|
|
platformId: this.$route.query.platformId, |
|
|
|
|
|
|
|
draft : this.$route.query.draft === '1', |
|
|
|
|
|
|
|
headers: { |
|
|
|
|
|
|
|
token: sessionStorage.getItem("token") |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
funcList: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
id: 0, |
|
|
|
|
|
|
|
name: '新功能' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
id: 1, |
|
|
|
|
|
|
|
name: '修复' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
id: 2, |
|
|
|
|
|
|
|
name: '优化' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
form: { |
|
|
|
form: { |
|
|
|
versionName: '', |
|
|
|
versionName: '', |
|
|
|
coverUrl: '', |
|
|
|
coverUrl: '', |
|
|
|
content: [{}] |
|
|
|
logContents: [] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
originContent: { |
|
|
|
|
|
|
|
type: '', |
|
|
|
|
|
|
|
content: '' |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
|
this.id && this.getData() |
|
|
|
this.id ? this.getData() : this.form.logContents.push(JSON.parse(JSON.stringify(this.originContent))) |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
// 获取详情 |
|
|
|
// 获取详情 |
|
|
@ -93,27 +116,53 @@ export default { |
|
|
|
const { log } = res |
|
|
|
const { log } = res |
|
|
|
this.form.versionName = log.versionName |
|
|
|
this.form.versionName = log.versionName |
|
|
|
this.form.coverUrl = log.coverUrl |
|
|
|
this.form.coverUrl = log.coverUrl |
|
|
|
|
|
|
|
this.form.logContents = log.logContents.length ? log.logContents : [JSON.parse(JSON.stringify(this.originContent))] |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 新增内容 |
|
|
|
// 新增内容 |
|
|
|
add() { |
|
|
|
add() { |
|
|
|
this.form.content.push({}) |
|
|
|
this.form.logContents.push(JSON.parse(JSON.stringify(this.originContent))) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 删除内容 |
|
|
|
// 删除内容 |
|
|
|
del() { |
|
|
|
del(i) { |
|
|
|
|
|
|
|
this.form.logContents.splice(i, 1) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
handleExceed(files, fileList) { // 上传文件 |
|
|
|
|
|
|
|
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!"); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
uploadSuccess(res, file, fileList) { |
|
|
|
|
|
|
|
this.form.coverUrl = res.data.filesResult.fileUrl |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
uploadError(err, file, fileList) { |
|
|
|
|
|
|
|
this.$message({ |
|
|
|
|
|
|
|
message: "上传出错,请重试!", |
|
|
|
|
|
|
|
type: "error", |
|
|
|
|
|
|
|
center: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
beforeRemove(file, fileList) { |
|
|
|
|
|
|
|
return this.$confirm(`确定移除 ${file.name}?`); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
handleRemove(file, fileList) { |
|
|
|
|
|
|
|
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); |
|
|
|
|
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { |
|
|
|
|
|
|
|
this.coverUrl = '' |
|
|
|
|
|
|
|
}).catch(res => {}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 保存 |
|
|
|
// 保存 |
|
|
|
submit(draft){ |
|
|
|
submit(draft){ |
|
|
|
const { versionName, coverUrl } = this.form |
|
|
|
const { versionName, logContents } = this.form |
|
|
|
const id = this.id |
|
|
|
const id = this.id |
|
|
|
if (!versionName) return this.$message.error('请输入版本标题') |
|
|
|
if (!versionName) return this.$message.error('请输入版本标题') |
|
|
|
if (!coverUrl) return this.$message.error('请输入更新内容') |
|
|
|
if (!logContents.length || !logContents.find(e => e.type !== '' && e.content)) return this.$message.error('请输入更新内容') |
|
|
|
const data = { |
|
|
|
const data = { |
|
|
|
|
|
|
|
platformId: this.platformId, |
|
|
|
versionName, |
|
|
|
versionName, |
|
|
|
coverUrl, |
|
|
|
coverUrl: this.form.coverUrl, |
|
|
|
|
|
|
|
logContents, |
|
|
|
draft |
|
|
|
draft |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
debugger |
|
|
|
if (id) { |
|
|
|
if (id) { |
|
|
|
data.logId = id |
|
|
|
data.logId = id |
|
|
|
this.$post(this.api.listUpdate, data).then(res => { |
|
|
|
this.$post(this.api.listUpdate, data).then(res => { |
|
|
|