未封装版本
saveBumitButton() {
let that = this
if (this.paramsItem.articleType == 0) {
if (this.paramsItem.deleteState == 1) {
let checkedData = this.labelList.filter(item => item.checked)
let labels = checkedData.map((ele) => {
return ({
id: ele.value,
name: ele.name
})
})
if (that.labelList.length == 0) {
uni.showToast({
title: '请上传必填信息',
duration: 2000
})
} else {
uni.showLoading({
title: '存储中'
})
let resources = {
articleCoverImg: that.preImgUrl,
articleContent: uni.getStorageSync('richText'),
articleTitle: that.paramsItem.textModel,
isEmployeeLook: that.isEmployeeLook === true ? 1 : 0,
labels: labels,
articleType: that.paramsItem.articleType,
deployState: 0,
id:that.paramsItem.id,
}
apijournal.RequeryjournalArticlecreate(resources).then((res) => {
if (res.data.errno == 200) {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: res.data.errmsg
})
uni.removeStorageSync('preImgUrl')
uni.switchTab({
url: "/pages/DemoMins/release/release"
})
}
})
}
} else {
let labels = that.labelDataList.map((ele) => {
return ({
id: ele.value,
name: ele.name
})
})
if (that.labelDataList.length == 0) {
uni.showToast({
title: '请上传必填信息',
duration: 2000
})
} else {
uni.showLoading({
title: '存储中'
})
let resources = {
articleCoverImg: that.preImgUrl,
articleContent: uni.getStorageSync('richText'),
articleTitle: that.paramsItem.textModel,
isEmployeeLook: that.isEmployeeLook === true ? 1 : 0,
labels: labels,
articleType: that.paramsItem.articleType,
deployState: 0,
}
apijournal.RequeryjournalArticlecreate(resources).then((res) => {
if (res.data.errno == 200) {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: res.data.errmsg
})
uni.removeStorageSync('preImgUrl')
uni.switchTab({
url: "/pages/DemoMins/release/release"
})
}
})
}
}
} else if (this.paramsItem.articleType == 1) {
let that = this
if (this.paramsItem.deleteState == 1) {
let checkedData = this.labelList.filter(item => item.checked)
let labels = checkedData.map((ele) => {
return ({
id: ele.value,
name: ele.name
})
})
if (that.labelList.length == 0) {
uni.showToast({
title: '请上传必填信息',
duration: 2000
})
} else {
uni.showLoading({
title: '存储中'
})
let resources = {
articleMedium: that.paramsItem.articleMedium,
articleCoverImg: that.preImgUrl,
articleContent: that.paramsItem.articleContent,
articleTitle: that.paramsItem.articleTitle,
videoDuration: that.paramsItem.timeval,
isEmployeeLook: this.isEmployeeLook === true ? 1 : 0,
labels: labels,
articleType: this.paramsItem.articleType,
deployState: 0,
id:that.paramsItem.id,
}
apijournal.RequerycreateVideo(resources).then((res) => {
if (res.data.errno == 200) {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: res.data.data
})
uni.removeStorageSync('preImgUrl')
uni.switchTab({
url: "/pages/DemoMins/release/release"
})
}
})
}
} else {
let labels = this.labelDataList.map((ele) => {
return ({
id: ele.value,
name: ele.name
})
})
if (that.labelDataList.length == 0) {
uni.showToast({
title: '请上传必填信息',
duration: 2000
})
} else {
uni.showLoading({
title: '存储中'
})
let resources = {
articleMedium: that.paramsItem.articleMedium,
articleCoverImg: that.preImgUrl,
articleContent: that.paramsItem.articleContent,
articleTitle: that.paramsItem.articleTitle,
videoDuration: that.paramsItem.timeval,
isEmployeeLook: this.isEmployeeLook === true ? 1 : 0,
labels: labels,
articleType: this.paramsItem.articleType,
deployState: 0,
}
apijournal.RequerycreateVideo(resources).then((res) => {
if (res.data.errno == 200) {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: res.data.data
})
uni.removeStorageSync('preImgUrl')
uni.switchTab({
url: "/pages/DemoMins/release/release"
})
}
})
}
}
} else {
return
}
},
submitImg() {
let that = this
if (this.paramsItem.articleType == 0) {
let that = this
if (this.paramsItem.deleteState) {
let checkedData = this.labelList.filter(item => item.checked)
let labels = checkedData.map((ele) => {
return ({
id: ele.value,
name: ele.name
})
})
if (that.labelList.length == 0) {
uni.showToast({
title: '请上传必填信息',
duration: 2000
})
} else {
let resources = {
articleCoverImg: that.preImgUrl,
articleContent: uni.getStorageSync('richText'),
articleTitle: that.paramsItem.textModel,
isEmployeeLook: that.isEmployeeLook === true ? 1 : 0,
labels: labels,
articleType: that.paramsItem.articleType,
deployState: 1,
id:that.paramsItem.id
}
apijournal.RequeryjournalArticlecreate(resources).then((res) => {
if (res.data.errno == 200) {
uni.showToast({
icon: 'none',
title: res.data.errmsg
})
uni.removeStorageSync('preImgUrl')
uni.switchTab({
url: "/pages/DemoMins/release/release"
})
}
})
}
} else {
let labels = this.labelDataList.map((ele) => {
return ({
id: ele.value,
name: ele.name
})
})
if (that.labelDataList.length == 0) {
uni.showToast({
title: '请上传必填信息',
duration: 2000
})
} else {
uni.showLoading({
title:'发布中'
})
let resources = {
articleCoverImg: that.preImgUrl,
articleContent: uni.getStorageSync('richText'),
articleTitle: that.paramsItem.textModel,
isEmployeeLook: that.isEmployeeLook === true ? 1 : 0,
labels: labels,
articleType: that.paramsItem.articleType,
deployState: 1,
}
apijournal.RequeryjournalArticlecreate(resources).then((res) => {
if (res.data.errno == 200) {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: res.data.errmsg
})
uni.removeStorageSync('preImgUrl')
uni.switchTab({
url: "/pages/DemoMins/release/release"
})
}
})
}
}
} else if (this.paramsItem.articleType == 1) {
let that = this
if (this.paramsItem.deleteState == 1) {
let checkedData = this.labelList.filter(item => item.checked)
let labels = checkedData.map((ele) => {
return ({
id: ele.value,
name: ele.name
})
})
if (that.labelList.length == 0) {
uni.showToast({
title: '请上传必填信息',
duration: 2000
})
} else {
uni.showLoading({
title:'发布中'
})
let resources = {
articleMedium: that.paramsItem.articleMedium,
articleCoverImg: that.preImgUrl,
articleContent: that.paramsItem.articleContent,
articleTitle: that.paramsItem.articleTitle,
videoDuration: that.paramsItem.timeval,
isEmployeeLook: this.isEmployeeLook === true ? 1 : 0,
labels: labels,
articleType: this.paramsItem.articleType,
deployState: 1,
id:that.paramsItem.id
}
apijournal.RequerycreateVideo(resources).then((res) => {
if (res.data.errno == 200) {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: res.data.data
})
uni.removeStorageSync('preImgUrl')
uni.switchTab({
url: "/pages/DemoMins/release/release"
})
}
})
}
} else {
let labels = this.labelDataList.map((ele) => {
return ({
id: ele.value,
name: ele.name
})
})
if (that.labelDataList.length == 0) {
uni.showToast({
title: '请上传必填信息',
duration: 2000
})
} else {
uni.showLoading({
title:'发布中'
})
let resources = {
articleMedium: that.paramsItem.articleMedium,
articleCoverImg: that.preImgUrl,
articleContent: that.paramsItem.articleContent,
articleTitle: that.paramsItem.articleTitle,
videoDuration: that.paramsItem.timeval,
isEmployeeLook: this.isEmployeeLook === true ? 1 : 0,
labels: labels,
articleType: this.paramsItem.articleType,
deployState: 1,
}
apijournal.RequerycreateVideo(resources).then((res) => {
if (res.data.errno == 200) {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: res.data.data
})
uni.removeStorageSync('preImgUrl')
uni.switchTab({
url: "/pages/DemoMins/release/release"
})
}
})
}
}
}
版本二
<!-- 底部按钮区-->
<view class="btn_item">
<view class="brtn_item_btn" @click="saveBumitButton(0)">
<span>存草稿</span>
</view>
<view class="brtn_item_item_btn">
<view @click="saveBumitsubmit(1)">
<span>发布</span>
</view>
</view>
</view>
ImageTextDraftsHandle(id, ite, labels, articleType) {
let that = this
console.log("传递过来的参数====>", id, ite, labels, articleType)
uni.showLoading({
title: '存储中'
})
let resources = {
articleMedium: that.paramsItem.articleMedium ? that.paramsItem.articleMedium : null,
articleCoverImg: that.preImgUrl,
articleContent: that.paramsItem.articleContent ? that.paramsItem.articleContent : uni
.getStorageSync('richText'),
articleTitle: that.paramsItem.articleTitle ? that.paramsItem.articleTitle : that.paramsItem
.textModel,
isEmployeeLook: that.isEmployeeLook === true ? 1 : 0,
videoDuration: that.paramsItem.timeval ? that.paramsItem.timeval : null,
labels: labels,
articleType: articleType,
deployState: ite,
id: id,
}
if (articleType == 0) {
apijournal.RequeryjournalArticlecreate(resources).then((res) => {
if (res.data.errno == 200) {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: res.data.errmsg
})
uni.removeStorageSync('preImgUrl')
uni.switchTab({
url: "/pages/DemoMins/release/release"
})
}
})
} else {
apijournal.RequerycreateVideo(resources).then((res) => {
if (res.data.errno == 200) {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: res.data.data
})
uni.removeStorageSync('preImgUrl')
uni.switchTab({
url: "/pages/DemoMins/release/release"
})
}
})
}
},
postContentHandle(id, ite, labels, articleType) {
console.log('发布接收的数据是什么参数===>', id, ite, labels, articleType)
let that = this
uni.showLoading({
title: '存储中'
})
let resources = {
articleMedium: that.paramsItem.articleMedium ? that.paramsItem.articleMedium : null,
articleCoverImg: that.preImgUrl,
articleContent: that.paramsItem.articleContent ? that.paramsItem.articleContent : uni
.getStorageSync('richText'),
articleTitle: that.paramsItem.articleTitle ? that.paramsItem.articleTitle : that.paramsItem
.textModel,
videoDuration: that.paramsItem.timeval ? that.paramsItem.timeval : null,
isEmployeeLook: this.isEmployeeLook === true ? 1 : 0,
labels: labels,
articleType: articleType,
deployState: ite,
id: id,
}
if (articleType == 0) {
apijournal.RequeryjournalArticlecreate(resources).then((res) => {
if (res.data.errno == 200) {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: res.data.errmsg
})
uni.removeStorageSync('preImgUrl')
uni.switchTab({
url: "/pages/DemoMins/release/release"
})
}
})
} else {
apijournal.RequerycreateVideo(resources).then((res) => {
if (res.data.errno == 200) {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: res.data.data
})
uni.removeStorageSync('preImgUrl')
uni.switchTab({
url: "/pages/DemoMins/release/release"
})
}
})
}
},
saveBumitButton(ite) {
console.log("当前值是发布还是存草稿",ite)
let that = this
let labels = that.labelDataList.map((ele) => {
return ({
id: ele.value,
name: ele.name
})
})
if (labels.length == 0) {
uni.showToast({
title: '请上传必填信息',
duration: 2000
})
} else {
let id = that.paramsItem.id
let articleType = that.paramsItem.articleType
that.ImageTextDraftsHandle(id, ite, labels, articleType)
}
},
saveBumitsubmi(ite) {
console.log("当前值是发布还是存草稿",ite)
let that = this
let labels = that.labelDataList.map((ele) => {
return ({
id: ele.value,
name: ele.name
})
})
if (labels.length == 0) {
uni.showToast({
title: '请上传必填信息',
duration: 2000
})
} else {
let id = that.paramsItem.id
let articleType = that.paramsItem.articleType
that.ImageTextDraftsHandle(id, ite, labels, articleType)
}
},
版本三
<!-- 底部按钮区-->
<view class="btn_item">
<view class="brtn_item_btn" @click="saveBumitButton(0)">
<span>存草稿</span>
</view>
<view class="brtn_item_item_btn">
<view @click="saveBumitButton(1)">
<span>发布</span>
</view>
</view>
</view>
saveBumitButton(ite) {
let that = this
let labels = that.labelDataList.map((ele) => {
return ({
id: ele.value,
name: ele.name
})
})
if (labels.length == 0) {
uni.showToast({
title: '请上传必填信息',
duration: 2000
})
} else {
let id = that.paramsItem.id
let articleType = that.paramsItem.articleType
that.ImageTextDraftsHandle(id, ite, labels, articleType)
}
},
ImageTextDraftsHandle(id, ite, labels, articleType) {
let that = this
console.log("传递过来的参数====>", id, ite, labels, articleType)
uni.showLoading({
title: '存储中'
})
let resources = {
articleMedium: that.paramsItem.articleMedium ? that.paramsItem.articleMedium : null,
articleCoverImg: that.preImgUrl,
articleContent: that.paramsItem.articleContent ? that.paramsItem.articleContent : uni
.getStorageSync('richText'),
articleTitle: that.paramsItem.articleTitle ? that.paramsItem.articleTitle : that.paramsItem
.textModel,
isEmployeeLook: that.isEmployeeLook === true ? 1 : 0,
videoDuration: that.paramsItem.timeval ? that.paramsItem.timeval : null,
labels: labels,
articleType: articleType,
deployState: ite,
id: id,
}
if (articleType == 0) {
apijournal.RequeryjournalArticlecreate(resources).then((res) => {
if (res.data.errno == 200) {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: res.data.errmsg
})
uni.removeStorageSync('preImgUrl')
uni.switchTab({
url: "/pages/DemoMins/release/release"
})
}
})
} else {
apijournal.RequerycreateVideo(resources).then((res) => {
if (res.data.errno == 200) {
uni.hideLoading()
uni.showToast({
icon: 'none',
title: res.data.data
})
uni.removeStorageSync('preImgUrl')
uni.switchTab({
url: "/pages/DemoMins/release/release"
})
}
})
}
},