Merge branch 'dev' of http://git.sinoecare.com/sinoecare/digital_village_cp/dv_cp_wechat_app into dev
This commit is contained in:
@@ -67,7 +67,10 @@ export default {
|
||||
computed: { ...mapState(['user']) },
|
||||
onLoad(o) {
|
||||
console.log(o)
|
||||
this.id = o.id
|
||||
if(o.id) {
|
||||
this.id = o.id
|
||||
}
|
||||
|
||||
this.moduleId = o.moduleId
|
||||
this.forms.areaId = this.user.areaId
|
||||
this.listName = o.listName
|
||||
@@ -111,54 +114,53 @@ export default {
|
||||
},
|
||||
submit() {
|
||||
if (this.flag) return
|
||||
if (!this.forms.title) {
|
||||
return this.$u.toast('请输入标题')
|
||||
}
|
||||
if (!this.forms.content) {
|
||||
return this.$u.toast('请输入正文')
|
||||
}
|
||||
|
||||
this.$refs.uForm.validate((valid) => {
|
||||
if (valid) {
|
||||
if (!this.forms.title) {
|
||||
return this.$u.toast('请输入标题')
|
||||
}
|
||||
if (!this.forms.content) {
|
||||
return this.$u.toast('请输入正文')
|
||||
}
|
||||
if(this.selectList.length && this.forms.selectIndex === '') {
|
||||
return this.$u.toast('请选择类别')
|
||||
}
|
||||
|
||||
if(this.selectList.length && this.forms.selectIndex === '') {
|
||||
return this.$u.toast('请选择类别')
|
||||
}
|
||||
var imgs = []
|
||||
if (this.forms.fileIds.length) {
|
||||
this.forms.fileIds.map((e) => {
|
||||
imgs.push({ url: e.url, id: e.id })
|
||||
})
|
||||
}
|
||||
|
||||
var imgs = []
|
||||
if (this.forms.fileIds) {
|
||||
this.forms.fileIds.map((e) => {
|
||||
imgs.push({ url: e.url, id: e.id })
|
||||
})
|
||||
}
|
||||
console.log(222)
|
||||
var categoryId = '', categoryName = ''
|
||||
|
||||
console.log(222)
|
||||
this.$http.post(`/app/appcontentinfo/addOrUpdate`, {
|
||||
title: this.forms.title,
|
||||
areaId: this.forms.areaId,
|
||||
content: this.forms.content,
|
||||
files: imgs || [],
|
||||
id: this.id,
|
||||
moduleId: this.moduleId,
|
||||
categoryId: this.selectList[this.forms.selectIndex].id,
|
||||
categoryName: this.selectList[this.forms.selectIndex].categoryName,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(333)
|
||||
if (res.code == 0) {
|
||||
uni.$emit('update')
|
||||
this.$u.toast('发布成功')
|
||||
this.flag = true
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 600)
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
} else {
|
||||
this.$u.toast('失败')
|
||||
if(this.selectList.length) {
|
||||
categoryId = this.selectList[this.forms.selectIndex].id
|
||||
categoryName = this.selectList[this.forms.selectIndex].categoryName
|
||||
}
|
||||
this.$http.post(`/app/appcontentinfo/addOrUpdate`, {
|
||||
title: this.forms.title,
|
||||
areaId: this.forms.areaId,
|
||||
content: this.forms.content,
|
||||
files: imgs || [],
|
||||
id: this.id,
|
||||
moduleId: this.moduleId,
|
||||
categoryId: categoryId,
|
||||
categoryName: categoryName,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(333)
|
||||
if (res.code == 0) {
|
||||
uni.$emit('update')
|
||||
this.$u.toast('发布成功')
|
||||
this.flag = true
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 600)
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.log(444333)
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<div class="titles">{{data.title}}</div>
|
||||
|
||||
<div class="titles-bottom">
|
||||
<span>类型:</span>
|
||||
<span>{{selectList[data.showIndex].categoryName}}</span>
|
||||
<span v-if="selectList.length">类型:</span>
|
||||
<span v-if="selectList.length">{{data.categoryName}}</span>
|
||||
<span class="to-left">浏览量:</span>
|
||||
<span>{{data.viewCount}}</span>
|
||||
</div>
|
||||
@@ -48,13 +48,6 @@ export default {
|
||||
this.$http.post(`/app/appcontentinfo/queryDetailById?id=${this.id}`).then((res) => {
|
||||
if (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.data && res.data[0].categoryList.length) {
|
||||
this.selectList = res.data[0].categoryList
|
||||
this.getDetail()
|
||||
}
|
||||
this.getDetail()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user