This commit is contained in:
花有清香月有阴
2021-12-23 17:52:47 +08:00
2 changed files with 49 additions and 54 deletions

View File

@@ -67,7 +67,10 @@ export default {
computed: { ...mapState(['user']) }, computed: { ...mapState(['user']) },
onLoad(o) { onLoad(o) {
console.log(o) console.log(o)
if(o.id) {
this.id = o.id this.id = o.id
}
this.moduleId = o.moduleId this.moduleId = o.moduleId
this.forms.areaId = this.user.areaId this.forms.areaId = this.user.areaId
this.listName = o.listName this.listName = o.listName
@@ -111,9 +114,6 @@ export default {
}, },
submit() { submit() {
if (this.flag) return if (this.flag) return
this.$refs.uForm.validate((valid) => {
if (valid) {
if (!this.forms.title) { if (!this.forms.title) {
return this.$u.toast('请输入标题') return this.$u.toast('请输入标题')
} }
@@ -126,13 +126,19 @@ export default {
} }
var imgs = [] var imgs = []
if (this.forms.fileIds) { if (this.forms.fileIds.length) {
this.forms.fileIds.map((e) => { this.forms.fileIds.map((e) => {
imgs.push({ url: e.url, id: e.id }) imgs.push({ url: e.url, id: e.id })
}) })
} }
console.log(222) console.log(222)
var categoryId = '', categoryName = ''
if(this.selectList.length) {
categoryId = this.selectList[this.forms.selectIndex].id
categoryName = this.selectList[this.forms.selectIndex].categoryName
}
this.$http.post(`/app/appcontentinfo/addOrUpdate`, { this.$http.post(`/app/appcontentinfo/addOrUpdate`, {
title: this.forms.title, title: this.forms.title,
areaId: this.forms.areaId, areaId: this.forms.areaId,
@@ -140,8 +146,8 @@ export default {
files: imgs || [], files: imgs || [],
id: this.id, id: this.id,
moduleId: this.moduleId, moduleId: this.moduleId,
categoryId: this.selectList[this.forms.selectIndex].id, categoryId: categoryId,
categoryName: this.selectList[this.forms.selectIndex].categoryName, categoryName: categoryName,
}) })
.then((res) => { .then((res) => {
console.log(333) console.log(333)
@@ -154,11 +160,7 @@ export default {
}, 600) }, 600)
} }
}).catch((err) => { }).catch((err) => {
console.log(err) console.log(444333)
})
} else {
this.$u.toast('失败')
}
}) })
}, },

View File

@@ -4,8 +4,8 @@
<div class="titles">{{data.title}}</div> <div class="titles">{{data.title}}</div>
<div class="titles-bottom"> <div class="titles-bottom">
<span>类型</span> <span v-if="selectList.length">类型</span>
<span>{{selectList[data.showIndex].categoryName}}</span> <span v-if="selectList.length">{{data.categoryName}}</span>
<span class="to-left">浏览量</span> <span class="to-left">浏览量</span>
<span>{{data.viewCount}}</span> <span>{{data.viewCount}}</span>
</div> </div>
@@ -48,13 +48,6 @@ export default {
this.$http.post(`/app/appcontentinfo/queryDetailById?id=${this.id}`).then((res) => { this.$http.post(`/app/appcontentinfo/queryDetailById?id=${this.id}`).then((res) => {
if (res?.data) { if (res?.data) {
this.data = res.data this.data = res.data
if(this.selectList.length) {
this.selectList.map((item, index) => {
if(item.id == res.data.categoryId) {
this.data.showIndex = index
}
})
}
} }
}) })
}, },
@@ -63,8 +56,8 @@ export default {
if (res.code == 0) { if (res.code == 0) {
if(res.data && res.data[0].categoryList.length) { if(res.data && res.data[0].categoryList.length) {
this.selectList = res.data[0].categoryList this.selectList = res.data[0].categoryList
this.getDetail()
} }
this.getDetail()
} }
}) })
}, },