|
@@ -1,8 +1,6 @@
|
|
|
<template>
|
|
<template>
|
|
|
<view class="publish-container">
|
|
<view class="publish-container">
|
|
|
- <u-navbar title="发布动态" bgColor="#fff" @leftClick="cancel"></u-navbar>
|
|
|
|
|
-
|
|
|
|
|
- <view class="content-body" :style="{ marginTop: '44px' }">
|
|
|
|
|
|
|
+ <view class="content-body">
|
|
|
<view class="text-area">
|
|
<view class="text-area">
|
|
|
<u--textarea
|
|
<u--textarea
|
|
|
v-model="formData.title"
|
|
v-model="formData.title"
|
|
@@ -94,11 +92,17 @@
|
|
|
</u-cell-group>
|
|
</u-cell-group>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="footer-bar">
|
|
<view class="footer-bar">
|
|
|
|
|
+ <u-button
|
|
|
|
|
+ text="返回"
|
|
|
|
|
+ shape="circle"
|
|
|
|
|
+ customStyle="height: 38px; font-size: 18px; margin-right: 20rpx;"
|
|
|
|
|
+ @click="cancel"
|
|
|
|
|
+ ></u-button>
|
|
|
<u-button
|
|
<u-button
|
|
|
text="立即发布"
|
|
text="立即发布"
|
|
|
color="linear-gradient(80deg,#02f6c1 0%,#07cdc4 100%)"
|
|
color="linear-gradient(80deg,#02f6c1 0%,#07cdc4 100%)"
|
|
|
shape="circle"
|
|
shape="circle"
|
|
|
- customStyle="height: 48px; font-size: 18px;"
|
|
|
|
|
|
|
+ customStyle="height: 38px; font-size: 18px;"
|
|
|
@click="submit('publish')"
|
|
@click="submit('publish')"
|
|
|
></u-button>
|
|
></u-button>
|
|
|
</view>
|
|
</view>
|
|
@@ -221,7 +225,6 @@ export default {
|
|
|
this.mediaType = 'video'
|
|
this.mediaType = 'video'
|
|
|
this.uploadApi = baseUrl + '/common/uploadVi'
|
|
this.uploadApi = baseUrl + '/common/uploadVi'
|
|
|
this.formData.videoUrl = data.mediaList[0].mediaUrl
|
|
this.formData.videoUrl = data.mediaList[0].mediaUrl
|
|
|
- // this.formData.videoUrl = data.videoUrl
|
|
|
|
|
this.formData.videoCoverUrl = data.coverUrl
|
|
this.formData.videoCoverUrl = data.coverUrl
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -237,13 +240,16 @@ export default {
|
|
|
onSuccess(reslut) {
|
|
onSuccess(reslut) {
|
|
|
// 把服务端返回的图片地址添加到list中与组件数据同步
|
|
// 把服务端返回的图片地址添加到list中与组件数据同步
|
|
|
if (reslut.code === 200) {
|
|
if (reslut.code === 200) {
|
|
|
- const isVideo = reslut.url.endsWith('.mp4')
|
|
|
|
|
|
|
+ const isVideo =
|
|
|
|
|
+ reslut.url.endsWith('.mp4') ||
|
|
|
|
|
+ reslut.url.endsWith('.mov') ||
|
|
|
|
|
+ reslut.url.endsWith('.mkv') ||
|
|
|
|
|
+ reslut.url.endsWith('.wmv')
|
|
|
if (isVideo) {
|
|
if (isVideo) {
|
|
|
- this.formData.videoUrl = reslut.url
|
|
|
|
|
- console.log('视频地址:', this.formData.videoUrl)
|
|
|
|
|
- this.formData.videoCoverUrl = reslut.coverUrl
|
|
|
|
|
|
|
+ this.formData.videoUrl = baseUrl + reslut.url
|
|
|
|
|
+ this.formData.videoCoverUrl = baseUrl + reslut.coverUrl
|
|
|
} else {
|
|
} else {
|
|
|
- this.fileList.push(reslut.url)
|
|
|
|
|
|
|
+ this.fileList.push(baseUrl + reslut.url)
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
this.mediaType = 'all'
|
|
this.mediaType = 'all'
|
|
@@ -301,9 +307,25 @@ export default {
|
|
|
this.formData.visibleRange = e.value[0]
|
|
this.formData.visibleRange = e.value[0]
|
|
|
this.showScopePicker = false
|
|
this.showScopePicker = false
|
|
|
},
|
|
},
|
|
|
|
|
+ // 检查是否有未保存的内容
|
|
|
|
|
+ hasUnsavedContent() {
|
|
|
|
|
+ return (
|
|
|
|
|
+ this.formData.title ||
|
|
|
|
|
+ this.formData.content ||
|
|
|
|
|
+ this.fileList.length > 0 ||
|
|
|
|
|
+ this.formData.videoUrl ||
|
|
|
|
|
+ this.formData.location ||
|
|
|
|
|
+ this.formData.visibleRange
|
|
|
|
|
+ )
|
|
|
|
|
+ },
|
|
|
// 保存草稿
|
|
// 保存草稿
|
|
|
cancel() {
|
|
cancel() {
|
|
|
- this.popShow = true
|
|
|
|
|
|
|
+ if (!this.hasUnsavedContent()) {
|
|
|
|
|
+ uni.navigateBack()
|
|
|
|
|
+ return
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.popShow = true
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
popClose() {
|
|
popClose() {
|
|
|
this.popShow = false
|
|
this.popShow = false
|